Skip to content

gh-91053: Add an optional callback that is invoked whenever a function is modified #97834

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 152 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
152 commits
Select commit Hold shift + click to select a range
48eb802
Add an optional callback that is invoked whenever a function is modified
mpage Sep 23, 2022
18329a1
Merge branch 'main' into func-modified-cb
mpage Oct 4, 2022
501c4dd
Fix the build on windows
mpage Oct 4, 2022
b727aa2
Fix refcounting for the result of vectorcall
mpage Oct 4, 2022
e3a8230
Move callback into _PyRuntimeState
mpage Oct 5, 2022
b2e20ef
Handle multiple events being dispatched
mpage Oct 5, 2022
0a30690
Add NEWS entry
mpage Oct 5, 2022
73dd809
Make the callback per-interpreter, rather than per-runtime
mpage Oct 5, 2022
4fa1cc8
Call the builtin `id` to return the id for a function that's about to…
mpage Oct 5, 2022
80f49f0
Fix prototype for restore_func_event_callback
mpage Oct 6, 2022
81fcd2c
gh-93357: Start porting asyncio server test cases to IsolatedAsyncioT…
arhadthedev Oct 4, 2022
cc60df0
GH-95913: Update what's new in 3.11 for asyncio (#97806)
gvanrossum Oct 4, 2022
39bef03
gh-90301: Doc: Add references to PEP 686 (#96816)
methane Oct 4, 2022
de65e64
gh-96448: fix documentation for _thread.lock.acquire (#96449)
dgiger42 Oct 4, 2022
c00e5c5
gh-97008: Add a Python implementation of AttributeError and NameError…
ambv Oct 4, 2022
75af114
gh-58451: Add optional delete_on_close parameter to NamedTemporaryFil…
Ev2geny Oct 4, 2022
937cc6d
gh-95913: Move py.exe to appropriate What's New section & refine text…
CAM-Gerlach Oct 4, 2022
1fce505
gh-88355: Fix backslashes in AF_PIPE (#96543)
cousteaulecommandant Oct 4, 2022
bb89f15
gh-93738: Documentation C syntax (:c:type:`Py_UNICODE*` -> :c:expr:`P…
AA-Turner Oct 4, 2022
1007409
gh-93738: Documentation C syntax (:c:type:`PyUnicodeObject*` -> :c:ex…
AA-Turner Oct 4, 2022
86e2243
gh-93738: Documentation C syntax (:c:type:`PyBytesObject*` -> :c:expr…
AA-Turner Oct 4, 2022
ff43073
gh-93738: Documentation C syntax (:c:type:`PyTupleObject*` -> :c:expr…
AA-Turner Oct 4, 2022
b220c7f
gh-93738: Documentation C syntax (:c:type:`PyInterpreterState *` -> :…
AA-Turner Oct 4, 2022
82b2939
gh-93738: Documentation C syntax (:c:type:`PyObject` -> :c:expr:`PyOb…
AA-Turner Oct 4, 2022
c9733b2
gh-95913: Copyedit/improve Other Language Changes What's New section …
CAM-Gerlach Oct 4, 2022
9455377
gh-93738: Documentation C syntax (:c:data:`view->obj` -> :c:expr:`vie…
AA-Turner Oct 4, 2022
3d795a2
gh-93738: Documentation C syntax (Use `c:struct`) (#97772)
AA-Turner Oct 4, 2022
cb408c6
gh-93738: Documentation C syntax (:c:type:`TYPE` -> :c:expr:`TYPE`) (…
AA-Turner Oct 4, 2022
dde4563
gh-93738: Documentation C syntax (:c:type:`FILE` -> :c:expr:`FILE`) (…
AA-Turner Oct 4, 2022
3a134eb
gh-93738: Documentation C syntax (:c:type: to :c:expr:, misc. cases) …
AA-Turner Oct 4, 2022
556e861
gh-95913: Copyedit/improve Implementation Changes What's New section …
CAM-Gerlach Oct 5, 2022
2eeacb0
gh-97837: Change deprecation warning message in `unittest` (#97838)
sobolevn Oct 5, 2022
76e702c
GH-97779: Ensure that *all* frame objects are backed by "complete" fr…
brandtbucher Oct 5, 2022
0ba4aad
GH-91079: Decouple C stack overflow checks from Python recursion chec…
markshannon Oct 5, 2022
86eb98c
gh-97654: Add auto exception chaining example to tutorial (#97703)
smheidrich Oct 5, 2022
83e1296
Add re.VERBOSE flag documentation example (#97678)
athos-ribeiro Oct 5, 2022
2efca9c
gh-97825: fix AttributeError when calling subprocess.check_output(inp…
akulakov Oct 5, 2022
ae65da9
gh-93738: Documentation C syntax (:c:type:`PyTypeObject*` -> :c:expr:…
AA-Turner Oct 5, 2022
681e059
GH-96704: Add {Task,Handle}.get_context(), use it in call_exception_h…
gvanrossum Oct 5, 2022
6d4d702
gh-87092: bring compiler code closer to a preprocessing-opt-assembler…
iritkatriel Oct 5, 2022
45b9d05
gh-97661: Improve accuracy of sqlite3.Cursor.fetchone docs (#97662)
jiajunjie Oct 5, 2022
c34bef6
gh-74696: Pass root_dir to custom archivers which support it (GH-94251)
serhiy-storchaka Oct 5, 2022
18523e0
gh-97758: Fix a crash in getpath_joinpath() called without arguments …
serhiy-storchaka Oct 5, 2022
a47df46
gh-95196: Disable incorrect pickling of the C implemented classmethod…
serhiy-storchaka Oct 5, 2022
2d20cf5
gh-93357: Port test cases to IsolatedAsyncioTestCase, part 2 (#97896)
arhadthedev Oct 5, 2022
d1e99a7
gh-93738: Documentation C syntax (Function glob patterns -> literal m…
AA-Turner Oct 5, 2022
129a24f
gh-88050: Fix asyncio subprocess to kill process cleanly when process…
kumaraditya303 Oct 5, 2022
4017dd4
GH-95172 Make the same version `versionadded` oneline (#95172)
180909 Oct 5, 2022
6eee387
build(deps): bump actions/stale from 5 to 6 (#97701)
dependabot[bot] Oct 5, 2022
f200192
gh-91539: improve performance of get_proxies_environment (#91566)
eendebakpt Oct 5, 2022
5da6c6b
gh-93738: Documentation C syntax (:c:type:<C type> -> :c:expr:<C type…
AA-Turner Oct 5, 2022
9a24191
I changed my surname early this year (#96671)
tshepang Oct 5, 2022
0aca8ca
gh-97850: Remove all known instances of module_repr() (#97876)
warsaw Oct 5, 2022
0ee0e4d
docs(typing): add "see PEP 675" to LiteralString (#97926)
simon04 Oct 5, 2022
351eda5
gh-65961: Raise `DeprecationWarning` when `__package__` differs from …
brettcannon Oct 5, 2022
adc2815
gh-96865: [Enum] fix Flag to use CONFORM boundary (GH-97528)
ethanfurman Oct 5, 2022
3335bbe
GH-88968: Add notes about socket ownership transfers (#97936)
gvanrossum Oct 5, 2022
97a27d8
gh-95691: Doc BufferedWriter and BufferedReader (#95703)
180909 Oct 5, 2022
a857648
gh-94808: Cover `PyObject_PyBytes` case with custom `__bytes__` metho…
sobolevn Oct 6, 2022
d458682
gh-94808: Cover `PyUnicode_Count` in CAPI (#96929)
sobolevn Oct 6, 2022
79fbf97
gh-97897: Prevent os.mkfifo and os.mknod segfaults with macOS 13 SDK …
ned-deily Oct 6, 2022
a0d2d63
gh-95986: Fix the example using match keyword (#95989)
180909 Oct 6, 2022
32cc2fd
gh-93738: Disallow pre-v3 syntax in the C domain (#97962)
AA-Turner Oct 6, 2022
bf234f5
GH-88050: fix race in closing subprocess pipe in asyncio (#97951)
kumaraditya303 Oct 6, 2022
af96109
gh-94808: Coverage: Test that maximum indentation level is handled (#…
mdboom Oct 6, 2022
149ed7f
gh-97943: PyFunction_GetAnnotations should return a borrowed referenc…
larryhastings Oct 6, 2022
ff0d621
gh-86482: Document assignment expression need for ()s (#23291)
terryjreedy Oct 6, 2022
d68c84f
gh-97781: Apply changes from importlib_metadata 5. (GH-97785)
jaraco Oct 6, 2022
aa83510
Add Pynche's move to the What's new in 3.11 (#97974)
warsaw Oct 6, 2022
a9a8f2e
gh-94590: add signatures to operator itemgetter, attrgetter, methodca…
eriknw Oct 6, 2022
22986c3
Docs: pin sphinx-lint (GH-97992)
hugovk Oct 6, 2022
9ffbad4
gh-97850: Remove the open issues section from the import reference (#…
brettcannon Oct 6, 2022
7064cd5
gh-65961: Do not rely solely on `__cached__` (GH-97990)
brettcannon Oct 6, 2022
0c970bd
fixes gh-96078: os.sched_yield release the GIL while calling sched_yi…
corona10 Oct 6, 2022
078e3ed
gh-97973: Return all necessary information from the tokenizer (GH-97984)
lysnikolaou Oct 6, 2022
cea3697
GH-97002: Prevent `_PyInterpreterFrame`s from backing more than one `…
brandtbucher Oct 6, 2022
f8e002a
bpo-38693: Use f-strings instead of str.format() within importlib (#1…
gpshead Oct 6, 2022
4f9e610
GH-91052: Add C API for watching dictionaries (GH-31787)
carljm Oct 7, 2022
395bc9a
bpo-35540 dataclasses.asdict now supports defaultdict fields (gh-32056)
kwsp Oct 7, 2022
7eba427
GH-90985: Revert "Deprecate passing a message into cancel()" (#97999)
gvanrossum Oct 7, 2022
e896751
Remove extra spaces in custom openSSL documentation. (#93568)
xiaochen7 Oct 7, 2022
04a52de
gh-97850: Remove deprecated functions from `importlib.utils` (#97898)
sobolevn Oct 7, 2022
bd03a34
Docs: Fix backtick errors found by sphinx-lint (#97998)
hugovk Oct 7, 2022
c729f2d
gh-82874: Convert remaining importlib format uses to f-str. (#98005)
gpshead Oct 7, 2022
2781fef
gh-86298: Ensure that __loader__ and __spec__.loader agree in warning…
warsaw Oct 7, 2022
6fe8abf
Doc: sphinx-lint finds two other default roles. (GH-98019)
JulienPalard Oct 7, 2022
a1ce6e1
Misc updates to the itertools recipes and tests (GH-98018)
rhettinger Oct 7, 2022
81021bf
gh-71316: Update dis documentation to include changes to jump argumen…
Christopher-Chianelli Oct 7, 2022
e75ada1
gh-97983: Revert "Lay the foundation for further work in asyncio.test…
arhadthedev Oct 7, 2022
43583f7
Fix memory leaks in test_capi (#98017)
carljm Oct 7, 2022
f100fc3
gh-94808: Cover `%p` in `PyUnicode_FromFormat` (#96677)
sobolevn Oct 7, 2022
603deaf
Add note on capture_output arg to subprocess.run() docstring (#98012)
akulakov Oct 7, 2022
bdf0373
Add more syslog tests (GH-97953)
serhiy-storchaka Oct 7, 2022
72bd5b9
gh-96415: Remove `types._cell_factory` from a module namespace (#96416)
sobolevn Oct 7, 2022
5df9a71
gh-64373: Convert `_functools` to Argument Clinic (#96640)
sobolevn Oct 7, 2022
ca73c85
Fix a mistake in isSet() deprecated message doc (#95720)
marcmonfort Oct 7, 2022
4ca8bb0
Make _symtable_entry.ste_type's comment consistent wit _Py_block_ty (…
zikcheng Oct 7, 2022
97ae2e9
gh-97669: Move difflib examples to Doc/includes/ (#97964)
vstinner Oct 7, 2022
1096dfa
gh-97955: Migrate `zoneinfo` to Argument Clinic (#97958)
sobolevn Oct 7, 2022
e7d9ea0
gh-64921: Clarify wording for open()'s newline arg (#96171)
slateny Oct 7, 2022
bd66031
gh-65496: Correct wording on csv's skipinitialspace argument (#96170)
slateny Oct 7, 2022
41b8172
GH-96073: Fix wild replacement in inspect.formatannotation (#96074)
iyume Oct 7, 2022
358e173
Add a warning message about PyOS_snprintf (#95993)
eric-wieser Oct 7, 2022
af02efe
gh-96959: Update HTTP links which are redirected to HTTPS (#98039)
180909 Oct 7, 2022
8bc17aa
gh-97956: Mention `generate_global_objects.py` in `AC How-To` (#97957)
sobolevn Oct 7, 2022
dc2c10e
gh-97923: Always run Ubuntu SSL tests with others in CI (#97940)
sobolevn Oct 7, 2022
9f5d3b5
gh-97646: Change `.js` and `.mjs` files mimetype to conform to RFC 92…
noamcohen97 Oct 7, 2022
0085f20
gh-73196: Add namespace/scope clarification for inheritance section (…
slateny Oct 7, 2022
53bc2db
gh-96265: Fix some formatting in faq/design.rst (#96924)
slateny Oct 7, 2022
8ce4739
gh-91708: Revert params note in urllib.parse.urlparse table (#96699)
slateny Oct 7, 2022
053555c
gh-96346: Use double caching for re._compile() (#96347)
serhiy-storchaka Oct 7, 2022
8cb415b
GH-88968: Reject socket that is already used as a transport (#98010)
gvanrossum Oct 7, 2022
7a39f02
gh-97997: Add col_offset field to tokenizer and use that for AST node…
lysnikolaou Oct 7, 2022
ca135e1
gh-92886: [clinic.py] raise exception on invalid input instead of ass…
iritkatriel Oct 7, 2022
875841a
gh-96073: fix backticks in NEWS entry (GH-98056)
JelleZijlstra Oct 7, 2022
b9bd94d
gh-96288: Add a sentence to `os.mkdir`'s docstring. (#96271)
hagai-helman Oct 7, 2022
864f9b9
gh-61105: Add default param, note on using cookiejar subclass (#95427)
slateny Oct 7, 2022
c437b6e
GH-83901: Improve Signature.bind error message for missing keyword-on…
RazerM Oct 7, 2022
5a71338
gh-90085: Remove vestigial -t and -c timeit options (#94941)
hauntsaninja Oct 7, 2022
6444029
gh-94808: Fix regex on exotic platforms (#98036)
JelleZijlstra Oct 7, 2022
c42b931
gh-57179: Add note on symlinks for os.walk (#94799)
slateny Oct 7, 2022
dcbae74
gh-92886: make test_coroutines pass with -O (assertions off) (GH-98060)
iritkatriel Oct 7, 2022
efbc783
gh-92886: make test_ast pass with -O (assertions off) (GH-98058)
iritkatriel Oct 7, 2022
6cd489d
GH-94182: Run the PidfdChildWatcher on the running loop (#94184)
graingert Oct 8, 2022
776f894
GH-98023: Change default child watcher to PidfdChildWatcher on suppor…
kumaraditya303 Oct 8, 2022
7bba92f
gh-91052: Add PyDict_Unwatch for unwatching a dictionary (#98055)
carljm Oct 8, 2022
e20a190
gh-97822: Fix http.server documentation reference to test() function …
Jason-Y-Z Oct 8, 2022
98b3aca
[doc] Fix broken links to C extensions accelerating stdlib modules (#…
partev Oct 8, 2022
637bf6a
gh-97913 Docs: Add walrus operator to the index (#97921)
hugovk Oct 8, 2022
d2abe90
Add `@ezio-melotti` as codeowner for `.github/`. (#98079)
ezio-melotti Oct 8, 2022
b31a5ee
GitHub Workflows security hardening (#96492)
sashashura Oct 8, 2022
65d36ba
gh-97922: Run the GC only on eval breaker (#97920)
pablogsal Oct 8, 2022
423a627
gh-68686: Retire eptag ptag scripts (#98064)
nanjekyejoannah Oct 8, 2022
1e204b1
gh-95011: Migrate syslog module to Argument Clinic (GH-95012)
noamcohen97 Oct 8, 2022
5723b53
Auto-cancel old builds when new commit pushed to branch (#98009)
hugovk Oct 8, 2022
8e3d19b
GH-94597: deprecate `SafeChildWatcher`, `FastChildWatcher` and `Multi…
kumaraditya303 Oct 8, 2022
095c522
Fix link to Lifecycle of a Pull Request in CONTRIBUTING (#98102)
jacobtylerwalls Oct 8, 2022
cef2db9
Minor edits to the Descriptor HowTo Guide (GH-24901)
geryogam Oct 9, 2022
4165f80
gh-97841: Add methoddef for _filters_mutated (gh-98115)
corona10 Oct 9, 2022
69c00cc
Update whatsnew instructions for GitHub (#98124)
carljm Oct 9, 2022
4bc4dfd
gh-56133: copyreg docs: Clarify function/constructor parameter (#95497)
slateny Oct 10, 2022
a15d14e
Fix types in buffer/memoryview docs (#98118)
da-woods Oct 10, 2022
ad713e8
gh-98083: Fix URLs in `README.rst` (#98082)
kwsp Oct 10, 2022
a87db59
bpo-43564: preserve original exception in args of FTP URLError (#24938)
carljm Oct 10, 2022
096a6a0
doc: remove a misleading statement. (GH-98093)
JulienPalard Oct 10, 2022
70a2708
gh-83940: os docs: Improve wording for getenv/getenvb (#98113)
slateny Oct 10, 2022
fbfd13b
gh-94808: Add coverage for bytesarray_setitem (#95802)
mdboom Oct 10, 2022
6d91946
gh-96821: Fix undefined behaviour in `audioop.c` (#96923)
matthiasgoergens Oct 10, 2022
9eda93b
Rename function event callbacks to match dict watchers
mpage Oct 10, 2022
ebf15c7
Support multiple watchers
mpage Oct 10, 2022
f357352
Rename function events to match naming scheme used by dict watchers
mpage Oct 10, 2022
08877e6
Add documentation for the new C-API functions and types
mpage Oct 11, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ Include/internal/pycore_runtime_init_generated.h generated
Include/opcode.h generated
Include/token.h generated
Lib/keyword.py generated
Lib/test/levenshtein_examples.json generated
Lib/test/test_stable_abi_ctypes.py generated
Lib/token.py generated
Objects/typeslots.inc generated
Expand Down
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
# It uses the same pattern rule for gitignore file
# https://git-scm.com/docs/gitignore#_pattern_format

# GitHub
.github/** @ezio-melotti

# asyncio
**/*asyncio* @1st1 @asvetlov @gvanrossum

Expand Down
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ also suggestions on how you can most effectively help the project.

Please be aware that our workflow does deviate slightly from the typical GitHub
project. Details on how to properly submit a pull request are covered in
`Lifecycle of a Pull Request <https://devguide.python.org/pullrequest/>`_.
`Lifecycle of a Pull Request <https://devguide.python.org/getting-started/pull-request-lifecycle.html>`_.
We utilize various bots and status checks to help with this, so do follow the
comments they leave and their "Details" links, respectively. The key points of
our workflow that are not covered by a bot or status check are:
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,23 @@ on:
permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
check_source:
name: 'Check for source changes'
runs-on: ubuntu-latest
outputs:
run_tests: ${{ steps.check.outputs.run_tests }}
run_ssl_tests: ${{ steps.check.outputs.run_ssl_tests }}
steps:
- uses: actions/checkout@v3
- name: Check for source changes
id: check
run: |
if [ -z "$GITHUB_BASE_REF" ]; then
echo '::set-output name=run_tests::true'
echo '::set-output name=run_ssl_tests::true'
else
git fetch origin $GITHUB_BASE_REF --depth=1
# git diff "origin/$GITHUB_BASE_REF..." (3 dots) may be more
Expand All @@ -56,7 +58,6 @@ jobs:
#
# https://github.com/python/core-workflow/issues/373
git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qvE '(\.rst$|^Doc|^Misc)' && echo '::set-output name=run_tests::true' || true
git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qE '(ssl|hashlib|hmac|^.github)' && echo '::set-output name=run_ssl_tests::true' || true
fi

check_generated_files:
Expand Down Expand Up @@ -230,7 +231,7 @@ jobs:
name: 'Ubuntu SSL tests with OpenSSL'
runs-on: ubuntu-20.04
needs: check_source
if: needs.check_source.outputs.run_tests == 'true' && needs.check_source.outputs.run_ssl_tests == 'true'
if: needs.check_source.outputs.run_tests == 'true'
strategy:
fail-fast: false
matrix:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/build_msi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ on:
permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
build:
name: Windows Installer
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ on:
permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
build_doc:
name: 'Docs'
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/project-updater.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
- opened
- labeled

permissions:
contents: read

jobs:
add-to-project:
name: Add issues to projects
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

steps:
- name: "Check PRs"
uses: actions/stale@v5
uses: actions/stale@v6
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-pr-message: 'This PR is stale because it has been open for 30 days with no activity.'
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/verify-ensurepip-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ on:
permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
verify:
runs-on: ubuntu-latest
Expand Down
88 changes: 44 additions & 44 deletions Doc/c-api/arg.rst
Original file line number Diff line number Diff line change
Expand Up @@ -129,17 +129,17 @@ which disallows mutable objects such as :class:`bytearray`.
``S`` (:class:`bytes`) [PyBytesObject \*]
Requires that the Python object is a :class:`bytes` object, without
attempting any conversion. Raises :exc:`TypeError` if the object is not
a bytes object. The C variable may also be declared as :c:type:`PyObject*`.
a bytes object. The C variable may also be declared as :c:expr:`PyObject*`.

``Y`` (:class:`bytearray`) [PyByteArrayObject \*]
Requires that the Python object is a :class:`bytearray` object, without
attempting any conversion. Raises :exc:`TypeError` if the object is not
a :class:`bytearray` object. The C variable may also be declared as :c:type:`PyObject*`.
a :class:`bytearray` object. The C variable may also be declared as :c:expr:`PyObject*`.

``U`` (:class:`str`) [PyObject \*]
Requires that the Python object is a Unicode object, without attempting
any conversion. Raises :exc:`TypeError` if the object is not a Unicode
object. The C variable may also be declared as :c:type:`PyObject*`.
object. The C variable may also be declared as :c:expr:`PyObject*`.

``w*`` (read-write :term:`bytes-like object`) [Py_buffer]
This format accepts any object which implements the read-write buffer
Expand All @@ -152,10 +152,10 @@ which disallows mutable objects such as :class:`bytearray`.
It only works for encoded data without embedded NUL bytes.

This format requires two arguments. The first is only used as input, and
must be a :c:type:`const char*` which points to the name of an encoding as a
must be a :c:expr:`const char*` which points to the name of an encoding as a
NUL-terminated string, or ``NULL``, in which case ``'utf-8'`` encoding is used.
An exception is raised if the named encoding is not known to Python. The
second argument must be a :c:type:`char**`; the value of the pointer it
second argument must be a :c:expr:`char**`; the value of the pointer it
references will be set to a buffer with the contents of the argument text.
The text will be encoded in the encoding specified by the first argument.

Expand All @@ -175,10 +175,10 @@ which disallows mutable objects such as :class:`bytearray`.
characters.

It requires three arguments. The first is only used as input, and must be a
:c:type:`const char*` which points to the name of an encoding as a
:c:expr:`const char*` which points to the name of an encoding as a
NUL-terminated string, or ``NULL``, in which case ``'utf-8'`` encoding is used.
An exception is raised if the named encoding is not known to Python. The
second argument must be a :c:type:`char**`; the value of the pointer it
second argument must be a :c:expr:`char**`; the value of the pointer it
references will be set to a buffer with the contents of the argument text.
The text will be encoded in the encoding specified by the first argument.
The third argument must be a pointer to an integer; the referenced integer
Expand Down Expand Up @@ -215,59 +215,59 @@ Numbers

``b`` (:class:`int`) [unsigned char]
Convert a nonnegative Python integer to an unsigned tiny int, stored in a C
:c:type:`unsigned char`.
:c:expr:`unsigned char`.

``B`` (:class:`int`) [unsigned char]
Convert a Python integer to a tiny int without overflow checking, stored in a C
:c:type:`unsigned char`.
:c:expr:`unsigned char`.

``h`` (:class:`int`) [short int]
Convert a Python integer to a C :c:type:`short int`.
Convert a Python integer to a C :c:expr:`short int`.

``H`` (:class:`int`) [unsigned short int]
Convert a Python integer to a C :c:type:`unsigned short int`, without overflow
Convert a Python integer to a C :c:expr:`unsigned short int`, without overflow
checking.

``i`` (:class:`int`) [int]
Convert a Python integer to a plain C :c:type:`int`.
Convert a Python integer to a plain C :c:expr:`int`.

``I`` (:class:`int`) [unsigned int]
Convert a Python integer to a C :c:type:`unsigned int`, without overflow
Convert a Python integer to a C :c:expr:`unsigned int`, without overflow
checking.

``l`` (:class:`int`) [long int]
Convert a Python integer to a C :c:type:`long int`.
Convert a Python integer to a C :c:expr:`long int`.

``k`` (:class:`int`) [unsigned long]
Convert a Python integer to a C :c:type:`unsigned long` without
Convert a Python integer to a C :c:expr:`unsigned long` without
overflow checking.

``L`` (:class:`int`) [long long]
Convert a Python integer to a C :c:type:`long long`.
Convert a Python integer to a C :c:expr:`long long`.

``K`` (:class:`int`) [unsigned long long]
Convert a Python integer to a C :c:type:`unsigned long long`
Convert a Python integer to a C :c:expr:`unsigned long long`
without overflow checking.

``n`` (:class:`int`) [:c:type:`Py_ssize_t`]
Convert a Python integer to a C :c:type:`Py_ssize_t`.

``c`` (:class:`bytes` or :class:`bytearray` of length 1) [char]
Convert a Python byte, represented as a :class:`bytes` or
:class:`bytearray` object of length 1, to a C :c:type:`char`.
:class:`bytearray` object of length 1, to a C :c:expr:`char`.

.. versionchanged:: 3.3
Allow :class:`bytearray` objects.

``C`` (:class:`str` of length 1) [int]
Convert a Python character, represented as a :class:`str` object of
length 1, to a C :c:type:`int`.
length 1, to a C :c:expr:`int`.

``f`` (:class:`float`) [float]
Convert a Python floating point number to a C :c:type:`float`.
Convert a Python floating point number to a C :c:expr:`float`.

``d`` (:class:`float`) [double]
Convert a Python floating point number to a C :c:type:`double`.
Convert a Python floating point number to a C :c:expr:`double`.

``D`` (:class:`complex`) [Py_complex]
Convert a Python complex number to a C :c:type:`Py_complex` structure.
Expand All @@ -283,7 +283,7 @@ Other objects
``O!`` (object) [*typeobject*, PyObject \*]
Store a Python object in a C object pointer. This is similar to ``O``, but
takes two C arguments: the first is the address of a Python type object, the
second is the address of the C variable (of type :c:type:`PyObject*`) into which
second is the address of the C variable (of type :c:expr:`PyObject*`) into which
the object pointer is stored. If the Python object does not have the required
type, :exc:`TypeError` is raised.

Expand All @@ -292,13 +292,13 @@ Other objects
``O&`` (object) [*converter*, *anything*]
Convert a Python object to a C variable through a *converter* function. This
takes two arguments: the first is a function, the second is the address of a C
variable (of arbitrary type), converted to :c:type:`void *`. The *converter*
variable (of arbitrary type), converted to :c:expr:`void *`. The *converter*
function in turn is called as follows::

status = converter(object, address);

where *object* is the Python object to be converted and *address* is the
:c:type:`void*` argument that was passed to the :c:func:`PyArg_Parse\*` function.
:c:expr:`void*` argument that was passed to the ``PyArg_Parse*`` function.
The returned *status* should be ``1`` for a successful conversion and ``0`` if
the conversion has failed. When the conversion fails, the *converter* function
should raise an exception and leave the content of *address* unmodified.
Expand Down Expand Up @@ -372,9 +372,9 @@ what is specified for the corresponding format unit in that case.

For the conversion to succeed, the *arg* object must match the format
and the format must be exhausted. On success, the
:c:func:`PyArg_Parse\*` functions return true, otherwise they return
``PyArg_Parse*`` functions return true, otherwise they return
false and raise an appropriate exception. When the
:c:func:`PyArg_Parse\*` functions fail due to conversion failure in one
``PyArg_Parse*`` functions fail due to conversion failure in one
of the format units, the variables at the addresses corresponding to that
and the following format units are left untouched.

Expand Down Expand Up @@ -444,7 +444,7 @@ API Functions
*args*; it must actually be a tuple. The length of the tuple must be at least
*min* and no more than *max*; *min* and *max* may be equal. Additional
arguments must be passed to the function, each of which should be a pointer to a
:c:type:`PyObject*` variable; these will be filled in with the values from
:c:expr:`PyObject*` variable; these will be filled in with the values from
*args*; they will contain :term:`borrowed references <borrowed reference>`.
The variables which correspond
to optional parameters not given by *args* will not be filled in; these should
Expand Down Expand Up @@ -481,7 +481,7 @@ Building values
.. c:function:: PyObject* Py_BuildValue(const char *format, ...)

Create a new value based on a format string similar to those accepted by the
:c:func:`PyArg_Parse\*` family of functions and a sequence of values. Returns
``PyArg_Parse*`` family of functions and a sequence of values. Returns
the value or ``NULL`` in the case of an error; an exception will be raised if
``NULL`` is returned.

Expand Down Expand Up @@ -531,7 +531,7 @@ Building values
Same as ``s#``.

``u`` (:class:`str`) [const wchar_t \*]
Convert a null-terminated :c:type:`wchar_t` buffer of Unicode (UTF-16 or UCS-4)
Convert a null-terminated :c:expr:`wchar_t` buffer of Unicode (UTF-16 or UCS-4)
data to a Python Unicode object. If the Unicode buffer pointer is ``NULL``,
``None`` is returned.

Expand All @@ -547,51 +547,51 @@ Building values
Same as ``s#``.

``i`` (:class:`int`) [int]
Convert a plain C :c:type:`int` to a Python integer object.
Convert a plain C :c:expr:`int` to a Python integer object.

``b`` (:class:`int`) [char]
Convert a plain C :c:type:`char` to a Python integer object.
Convert a plain C :c:expr:`char` to a Python integer object.

``h`` (:class:`int`) [short int]
Convert a plain C :c:type:`short int` to a Python integer object.
Convert a plain C :c:expr:`short int` to a Python integer object.

``l`` (:class:`int`) [long int]
Convert a C :c:type:`long int` to a Python integer object.
Convert a C :c:expr:`long int` to a Python integer object.

``B`` (:class:`int`) [unsigned char]
Convert a C :c:type:`unsigned char` to a Python integer object.
Convert a C :c:expr:`unsigned char` to a Python integer object.

``H`` (:class:`int`) [unsigned short int]
Convert a C :c:type:`unsigned short int` to a Python integer object.
Convert a C :c:expr:`unsigned short int` to a Python integer object.

``I`` (:class:`int`) [unsigned int]
Convert a C :c:type:`unsigned int` to a Python integer object.
Convert a C :c:expr:`unsigned int` to a Python integer object.

``k`` (:class:`int`) [unsigned long]
Convert a C :c:type:`unsigned long` to a Python integer object.
Convert a C :c:expr:`unsigned long` to a Python integer object.

``L`` (:class:`int`) [long long]
Convert a C :c:type:`long long` to a Python integer object.
Convert a C :c:expr:`long long` to a Python integer object.

``K`` (:class:`int`) [unsigned long long]
Convert a C :c:type:`unsigned long long` to a Python integer object.
Convert a C :c:expr:`unsigned long long` to a Python integer object.

``n`` (:class:`int`) [:c:type:`Py_ssize_t`]
Convert a C :c:type:`Py_ssize_t` to a Python integer.

``c`` (:class:`bytes` of length 1) [char]
Convert a C :c:type:`int` representing a byte to a Python :class:`bytes` object of
Convert a C :c:expr:`int` representing a byte to a Python :class:`bytes` object of
length 1.

``C`` (:class:`str` of length 1) [int]
Convert a C :c:type:`int` representing a character to Python :class:`str`
Convert a C :c:expr:`int` representing a character to Python :class:`str`
object of length 1.

``d`` (:class:`float`) [double]
Convert a C :c:type:`double` to a Python floating point number.
Convert a C :c:expr:`double` to a Python floating point number.

``f`` (:class:`float`) [float]
Convert a C :c:type:`float` to a Python floating point number.
Convert a C :c:expr:`float` to a Python floating point number.

``D`` (:class:`complex`) [Py_complex \*]
Convert a C :c:type:`Py_complex` structure to a Python complex number.
Expand All @@ -614,7 +614,7 @@ Building values

``O&`` (object) [*converter*, *anything*]
Convert *anything* to a Python object through a *converter* function. The
function is called with *anything* (which should be compatible with :c:type:`void*`)
function is called with *anything* (which should be compatible with :c:expr:`void*`)
as its argument and should return a "new" Python object, or ``NULL`` if an
error occurred.

Expand Down
2 changes: 1 addition & 1 deletion Doc/c-api/buffer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ a buffer, see :c:func:`PyObject_GetBuffer`.
For :term:`contiguous` arrays, the value points to the beginning of
the memory block.

.. c:member:: void *obj
.. c:member:: PyObject *obj

A new reference to the exporting object. The reference is owned by
the consumer and automatically decremented and set to ``NULL`` by
Expand Down
Loading