Skip to content

Commit 68a7a91

Browse files
authored
Merge branch 'python:3.11' into 3.11
2 parents b53e953 + 9707bf2 commit 68a7a91

349 files changed

Lines changed: 6973 additions & 3358 deletions

File tree

Some content is hidden

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

.github/workflows/build.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ jobs:
4242
id: check
4343
run: |
4444
if [ -z "$GITHUB_BASE_REF" ]; then
45-
echo '::set-output name=run_tests::true'
46-
echo '::set-output name=run_ssl_tests::true'
45+
echo "run_tests=true" >> $GITHUB_OUTPUT
46+
echo "run_ssl_tests=true" >> $GITHUB_OUTPUT
4747
else
4848
git fetch origin $GITHUB_BASE_REF --depth=1
4949
# git diff "origin/$GITHUB_BASE_REF..." (3 dots) may be more
@@ -59,8 +59,8 @@ jobs:
5959
# into the PR branch anyway.
6060
#
6161
# https://github.com/python/core-workflow/issues/373
62-
git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qvE '(\.rst$|^Doc|^Misc)' && echo '::set-output name=run_tests::true' || true
63-
git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qE '(ssl|hashlib|hmac|^.github)' && echo '::set-output name=run_ssl_tests::true' || true
62+
git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qvE '(\.rst$|^Doc|^Misc)' && echo "run_tests=true" >> $GITHUB_OUTPUT || true
63+
git diff --name-only origin/$GITHUB_BASE_REF.. | grep -qE '(ssl|hashlib|hmac|^.github)' && echo "run_ssl_tests=true" >> $GITHUB_OUTPUT || true
6464
fi
6565
6666
check_abi:
@@ -84,8 +84,7 @@ jobs:
8484
make -j4
8585
- name: Check for changes in the ABI
8686
run: |
87-
make check-abidump
88-
if [ $? -neq 0 ] ; then
87+
if ! make check-abidump; then
8988
echo "Generated ABI file is not up to date."
9089
echo "Please, add the release manager of this branch as a reviewer of this PR."
9190
echo ""

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ PCbuild/win32/
114114
Tools/unicode/data/
115115
/autom4te.cache
116116
/build/
117+
/builddir/
117118
/config.cache
118119
/config.log
119120
/config.status

Doc/c-api/frame.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,24 @@ can be used to get a frame object.
1919

2020
See also :ref:`Reflection <reflection>`.
2121

22+
.. c:var:: PyTypeObject PyFrame_Type
23+
24+
The type of frame objects.
25+
It is the same object as :py:class:`types.FrameType` in the Python layer.
26+
27+
.. versionchanged:: 3.11
28+
29+
Previously, this type was only available after including
30+
``<frameobject.h>``.
31+
32+
.. c:function:: int PyFrame_Check(PyObject *obj)
33+
34+
Return non-zero if *obj* is a frame object.
35+
36+
.. versionchanged:: 3.11
37+
38+
Previously, this function was only available after including
39+
``<frameobject.h>``.
2240
2341
.. c:function:: PyFrameObject* PyFrame_GetBack(PyFrameObject *frame)
2442

Doc/c-api/init_config.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ PyPreConfig
254254
255255
.. c:member:: int configure_locale
256256
257-
Set the LC_CTYPE locale to the user preferred locale?
257+
Set the LC_CTYPE locale to the user preferred locale.
258258
259259
If equals to ``0``, set :c:member:`~PyPreConfig.coerce_c_locale` and
260260
:c:member:`~PyPreConfig.coerce_c_locale_warn` members to ``0``.

Doc/c-api/memory.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ for the I/O buffer escapes completely the Python memory manager.
9595
Allocator Domains
9696
=================
9797

98+
.. _allocator-domains:
99+
98100
All allocating functions belong to one of three different "domains" (see also
99101
:c:type:`PyMemAllocatorDomain`). These domains represent different allocation
100102
strategies and are optimized for different purposes. The specific details on
@@ -479,6 +481,25 @@ Customize Memory Allocators
479481
See also :c:member:`PyPreConfig.allocator` and :ref:`Preinitialize Python
480482
with PyPreConfig <c-preinit>`.
481483
484+
.. warning::
485+
486+
:c:func:`PyMem_SetAllocator` does have the following contract:
487+
488+
* It can be called after :c:func:`Py_PreInitialize` and before
489+
:c:func:`Py_InitializeFromConfig` to install a custom memory
490+
allocator. There are no restrictions over the installed allocator
491+
other than the ones imposed by the domain (for instance, the Raw
492+
Domain allows the allocator to be called without the GIL held). See
493+
:ref:`the section on allocator domains <allocator-domains>` for more
494+
information.
495+
496+
* If called after Python has finish initializing (after
497+
:c:func:`Py_InitializeFromConfig` has been called) the allocator
498+
**must** wrap the existing allocator. Substituting the current
499+
allocator for some other arbitrary one is **not supported**.
500+
501+
502+
482503
.. c:function:: void PyMem_SetupDebugHooks(void)
483504
484505
Setup :ref:`debug hooks in the Python memory allocators <pymem-debug-hooks>`

Doc/c-api/typeobj.rst

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,16 @@ Quick Reference
149149
+------------------------------------------------+-----------------------------------+-------------------+---+---+---+---+
150150

151151
.. [#slots]
152-
A slot name in parentheses indicates it is (effectively) deprecated.
153-
Names in angle brackets should be treated as read-only.
154-
Names in square brackets are for internal use only.
155-
"<R>" (as a prefix) means the field is required (must be non-``NULL``).
152+
153+
**()**: A slot name in parentheses indicates it is (effectively) deprecated.
154+
155+
**<>**: Names in angle brackets should be initially set to ``NULL`` and
156+
treated as read-only.
157+
158+
**[]**: Names in square brackets are for internal use only.
159+
160+
**<R>** (as a prefix) means the field is required (must be non-``NULL``).
161+
156162
.. [#cols] Columns:
157163
158164
**"O"**: set on :c:type:`PyBaseObject_Type`
@@ -1213,6 +1219,17 @@ and :c:type:`PyType_Type` effectively act as defaults.)
12131219
**Inheritance:**
12141220

12151221
This flag is not inherited.
1222+
However, subclasses will not be instantiable unless they provide a
1223+
non-NULL :c:member:`~PyTypeObject.tp_new` (which is only possible
1224+
via the C API).
1225+
1226+
.. note::
1227+
1228+
To disallow instantiating a class directly but allow instantiating
1229+
its subclasses (e.g. for an :term:`abstract base class`),
1230+
do not use this flag.
1231+
Instead, make :c:member:`~PyTypeObject.tp_new` only succeed for
1232+
subclasses.
12161233

12171234
.. versionadded:: 3.10
12181235

@@ -1892,8 +1909,19 @@ and :c:type:`PyType_Type` effectively act as defaults.)
18921909
18931910
Tuple of base types.
18941911

1895-
This is set for types created by a class statement. It should be ``NULL`` for
1896-
statically defined types.
1912+
This field should be set to ``NULL`` and treated as read-only.
1913+
Python will fill it in when the type is :c:func:`initialized <PyType_Ready>`.
1914+
1915+
For dynamically created classes, the ``Py_tp_bases``
1916+
:c:type:`slot <PyType_Slot>` can be used instead of the *bases* argument
1917+
of :c:func:`PyType_FromSpecWithBases`.
1918+
The argument form is preferred.
1919+
1920+
.. warning::
1921+
1922+
Multiple inheritance does not work well for statically defined types.
1923+
If you set ``tp_bases`` to a tuple, Python will not raise an error,
1924+
but some slots will only be inherited from the first base.
18971925

18981926
**Inheritance:**
18991927

@@ -1905,6 +1933,8 @@ and :c:type:`PyType_Type` effectively act as defaults.)
19051933
Tuple containing the expanded set of base types, starting with the type itself
19061934
and ending with :class:`object`, in Method Resolution Order.
19071935

1936+
This field should be set to ``NULL`` and treated as read-only.
1937+
Python will fill it in when the type is :c:func:`initialized <PyType_Ready>`.
19081938

19091939
**Inheritance:**
19101940

Doc/data/refcounts.dat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,10 +1010,10 @@ PyImport_Import:PyObject*::+1:
10101010
PyImport_Import:PyObject*:name:0:
10111011

10121012
PyImport_ImportFrozenModule:int:::
1013-
PyImport_ImportFrozenModule:const char*:::
1013+
PyImport_ImportFrozenModule:const char*:name::
10141014

10151015
PyImport_ImportFrozenModuleObject:int:::
1016-
PyImport_ImportFrozenModuleObject:PyObject*::+1:
1016+
PyImport_ImportFrozenModuleObject:PyObject*:name:+1:
10171017

10181018
PyImport_ImportModule:PyObject*::+1:
10191019
PyImport_ImportModule:const char*:name::

Doc/extending/embedding.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -298,16 +298,16 @@ be directly useful to you:
298298

299299
.. code-block:: shell-session
300300
301-
$ /opt/bin/python3.4-config --cflags
302-
-I/opt/include/python3.4m -I/opt/include/python3.4m -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes
301+
$ /opt/bin/python3.11-config --cflags
302+
-I/opt/include/python3.11 -I/opt/include/python3.11 -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall
303303
304-
* ``pythonX.Y-config --ldflags`` will give you the recommended flags when
305-
linking:
304+
* ``pythonX.Y-config --ldflags --embed`` will give you the recommended flags
305+
when linking:
306306

307307
.. code-block:: shell-session
308308
309-
$ /opt/bin/python3.4-config --ldflags
310-
-L/opt/lib/python3.4/config-3.4m -lpthread -ldl -lutil -lm -lpython3.4m -Xlinker -export-dynamic
309+
$ /opt/bin/python3.11-config --ldflags --embed
310+
-L/opt/lib/python3.11/config-3.11-x86_64-linux-gnu -L/opt/lib -lpython3.11 -lpthread -ldl -lutil -lm
311311
312312
.. note::
313313
To avoid confusion between several Python installations (and especially

0 commit comments

Comments
 (0)