Skip to content

Commit 4b5c5fc

Browse files
Merge branch 'main' of https://github.com/python/cpython into asyncio-zero-copy
2 parents ee7e21e + 75a6fad commit 4b5c5fc

File tree

209 files changed

+6225
-2150
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

209 files changed

+6225
-2150
lines changed

.github/CODEOWNERS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Python/traceback.c @iritkatriel
5555
/Lib/html/ @ezio-melotti
5656
/Lib/_markupbase.py @ezio-melotti
5757
/Lib/test/test_html*.py @ezio-melotti
58-
/Tools/scripts/*html5* @ezio-melotti
58+
/Tools/build/parse_html5_entities.py @ezio-melotti
5959

6060
# Import (including importlib).
6161
# Ignoring importlib.h so as to not get flagged on
@@ -135,7 +135,7 @@ Lib/ast.py @isidentical
135135

136136
**/*idlelib* @terryjreedy
137137

138-
**/*typing* @gvanrossum @Fidget-Spinner @JelleZijlstra
138+
**/*typing* @gvanrossum @Fidget-Spinner @JelleZijlstra @AlexWaygood
139139

140140
**/*asyncore @giampaolo
141141
**/*asynchat @giampaolo

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
id: check
4242
run: |
4343
if [ -z "$GITHUB_BASE_REF" ]; then
44-
echo '::set-output name=run_tests::true'
44+
echo "run_tests=true" >> $GITHUB_OUTPUT
4545
else
4646
git fetch origin $GITHUB_BASE_REF --depth=1
4747
# git diff "origin/$GITHUB_BASE_REF..." (3 dots) may be more
@@ -57,7 +57,7 @@ jobs:
5757
# into the PR branch anyway.
5858
#
5959
# https://github.com/python/core-workflow/issues/373
60-
git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qvE '(\.rst$|^Doc|^Misc)' && echo '::set-output name=run_tests::true' || true
60+
git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qvE '(\.rst$|^Doc|^Misc)' && echo "run_tests=true" >> $GITHUB_OUTPUT || true
6161
fi
6262
6363
check_generated_files:

.github/workflows/verify-ensurepip-wheels.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ on:
66
paths:
77
- 'Lib/ensurepip/_bundled/**'
88
- '.github/workflows/verify-ensurepip-wheels.yml'
9-
- 'Tools/scripts/verify_ensurepip_wheels.py'
9+
- 'Tools/build/verify_ensurepip_wheels.py'
1010
pull_request:
1111
paths:
1212
- 'Lib/ensurepip/_bundled/**'
1313
- '.github/workflows/verify-ensurepip-wheels.yml'
14-
- 'Tools/scripts/verify_ensurepip_wheels.py'
14+
- 'Tools/build/verify_ensurepip_wheels.py'
1515

1616
permissions:
1717
contents: read
@@ -29,4 +29,4 @@ jobs:
2929
with:
3030
python-version: '3'
3131
- name: Compare checksums of bundled pip and setuptools to ones published on PyPI
32-
run: ./Tools/scripts/verify_ensurepip_wheels.py
32+
run: ./Tools/build/verify_ensurepip_wheels.py

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ Tools/ssl/win32
143143
Tools/freeze/test/outdir
144144

145145
# The frozen modules are always generated by the build so we don't
146-
# keep them in the repo. Also see Tools/scripts/freeze_modules.py.
146+
# keep them in the repo. Also see Tools/build/freeze_modules.py.
147147
Python/frozen_modules/*.h
148148
# The manifest can be generated at any time with "make regen-frozen".
149149
Python/frozen_modules/MANIFEST

Doc/c-api/init.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1933,7 +1933,7 @@ is not possible due to its implementation being opaque at build time.
19331933
19341934
.. note::
19351935
A freed key becomes a dangling pointer. You should reset the key to
1936-
`NULL`.
1936+
``NULL``.
19371937
19381938
19391939
Methods

Doc/c-api/refcounting.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,26 @@ The macros in this section are used for managing reference counts of Python
1111
objects.
1212

1313

14+
.. c:function:: Py_ssize_t Py_REFCNT(PyObject *o)
15+
16+
Get the reference count of the Python object *o*.
17+
18+
Use the :c:func:`Py_SET_REFCNT()` function to set an object reference count.
19+
20+
.. versionchanged:: 3.11
21+
The parameter type is no longer :c:expr:`const PyObject*`.
22+
23+
.. versionchanged:: 3.10
24+
:c:func:`Py_REFCNT()` is changed to the inline static function.
25+
26+
27+
.. c:function:: void Py_SET_REFCNT(PyObject *o, Py_ssize_t refcnt)
28+
29+
Set the object *o* reference counter to *refcnt*.
30+
31+
.. versionadded:: 3.9
32+
33+
1434
.. c:function:: void Py_INCREF(PyObject *o)
1535
1636
Increment the reference count for object *o*.

Doc/c-api/structures.rst

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ All Python objects ultimately share a small number of fields at the beginning
1717
of the object's representation in memory. These are represented by the
1818
:c:type:`PyObject` and :c:type:`PyVarObject` types, which are defined, in turn,
1919
by the expansions of some macros also used, whether directly or indirectly, in
20-
the definition of all other Python objects.
20+
the definition of all other Python objects. Additional macros can be found
21+
under :ref:`reference counting <countingrefs>`.
2122

2223

2324
.. c:type:: PyObject
@@ -121,26 +122,6 @@ the definition of all other Python objects.
121122
.. versionadded:: 3.9
122123
123124
124-
.. c:function:: Py_ssize_t Py_REFCNT(PyObject *o)
125-
126-
Get the reference count of the Python object *o*.
127-
128-
Use the :c:func:`Py_SET_REFCNT()` function to set an object reference count.
129-
130-
.. versionchanged:: 3.11
131-
The parameter type is no longer :c:expr:`const PyObject*`.
132-
133-
.. versionchanged:: 3.10
134-
:c:func:`Py_REFCNT()` is changed to the inline static function.
135-
136-
137-
.. c:function:: void Py_SET_REFCNT(PyObject *o, Py_ssize_t refcnt)
138-
139-
Set the object *o* reference counter to *refcnt*.
140-
141-
.. versionadded:: 3.9
142-
143-
144125
.. c:function:: Py_ssize_t Py_SIZE(PyVarObject *o)
145126
146127
Get the size of the Python object *o*.

Doc/c-api/tuple.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Tuple Objects
6969
7070
Return the slice of the tuple pointed to by *p* between *low* and *high*,
7171
or ``NULL`` on failure. This is the equivalent of the Python expression
72-
``p[low:high]``. Indexing from the end of the list is not supported.
72+
``p[low:high]``. Indexing from the end of the tuple is not supported.
7373
7474
7575
.. c:function:: int PyTuple_SetItem(PyObject *p, Py_ssize_t pos, PyObject *o)

Doc/c-api/type.rst

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,55 @@ Type Objects
5757
modification of the attributes or base classes of the type.
5858
5959
60+
.. c:function:: int PyType_AddWatcher(PyType_WatchCallback callback)
61+
62+
Register *callback* as a type watcher. Return a non-negative integer ID
63+
which must be passed to future calls to :c:func:`PyType_Watch`. In case of
64+
error (e.g. no more watcher IDs available), return ``-1`` and set an
65+
exception.
66+
67+
.. versionadded:: 3.12
68+
69+
70+
.. c:function:: int PyType_ClearWatcher(int watcher_id)
71+
72+
Clear watcher identified by *watcher_id* (previously returned from
73+
:c:func:`PyType_AddWatcher`). Return ``0`` on success, ``-1`` on error (e.g.
74+
if *watcher_id* was never registered.)
75+
76+
An extension should never call ``PyType_ClearWatcher`` with a *watcher_id*
77+
that was not returned to it by a previous call to
78+
:c:func:`PyType_AddWatcher`.
79+
80+
.. versionadded:: 3.12
81+
82+
83+
.. c:function:: int PyType_Watch(int watcher_id, PyObject *type)
84+
85+
Mark *type* as watched. The callback granted *watcher_id* by
86+
:c:func:`PyType_AddWatcher` will be called whenever
87+
:c:func:`PyType_Modified` reports a change to *type*. (The callback may be
88+
called only once for a series of consecutive modifications to *type*, if
89+
:c:func:`PyType_Lookup` is not called on *type* between the modifications;
90+
this is an implementation detail and subject to change.)
91+
92+
An extension should never call ``PyType_Watch`` with a *watcher_id* that was
93+
not returned to it by a previous call to :c:func:`PyType_AddWatcher`.
94+
95+
.. versionadded:: 3.12
96+
97+
98+
.. c:type:: int (*PyType_WatchCallback)(PyObject *type)
99+
100+
Type of a type-watcher callback function.
101+
102+
The callback must not modify *type* or cause :c:func:`PyType_Modified` to be
103+
called on *type* or any type in its MRO; violating this rule could cause
104+
infinite recursion.
105+
106+
.. versionadded:: 3.12
107+
108+
60109
.. c:function:: int PyType_HasFeature(PyTypeObject *o, int feature)
61110
62111
Return non-zero if the type object *o* sets the feature *feature*.

0 commit comments

Comments
 (0)