Skip to content

Commit 9e668c9

Browse files
committed
Merge branch 'main' into code-version
2 parents 46d77fd + 80c08d1 commit 9e668c9

File tree

1,065 files changed

+22862
-31601
lines changed

Some content is hidden

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

1,065 files changed

+22862
-31601
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ Parser/parser.c generated
8282
Parser/token.c generated
8383
Programs/test_frozenmain.h generated
8484
Python/Python-ast.c generated
85+
Python/generated_cases.c.h generated
8586
Python/opcode_targets.h generated
8687
Python/stdlib_module_names.h generated
8788
Tools/peg_generator/pegen/grammar_parser.py generated

.github/CONTRIBUTING.rst

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,9 @@ Contributing to Python
44
Build Status
55
------------
66

7-
- main
7+
- `Buildbot status overview <https://buildbot.python.org/all/#/release_status>`_
88

9-
+ `Stable buildbots <https://buildbot.python.org/3.x.stable/>`_
10-
11-
- 3.9
12-
13-
+ `Stable buildbots <https://buildbot.python.org/3.9.stable/>`_
14-
15-
- 3.8
16-
17-
+ `Stable buildbots <https://buildbot.python.org/3.8.stable/>`_
18-
19-
- 3.7
20-
21-
+ `Stable buildbots <https://buildbot.python.org/3.7.stable/>`_
9+
- `GitHub Actions status <https://github.com/python/cpython/actions/workflows/build.yml>`_
2210

2311

2412
Thank You

.github/SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
The Python team applies security fixes according to the table
66
in [the devguide](
7-
https://devguide.python.org/#status-of-python-branches
7+
https://devguide.python.org/versions/#supported-versions
88
).
99

1010
## Reporting a Vulnerability

.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:

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ gmon.out
4141
.DS_Store
4242

4343
*.exe
44-
!Lib/distutils/command/*.exe
4544

4645
# Ignore core dumps... but not Tools/msi/core/ or the like.
4746
core
@@ -58,7 +57,6 @@ Doc/.venv/
5857
Doc/env/
5958
Doc/.env/
6059
Include/pydtrace_probes.h
61-
Lib/distutils/command/*.pdb
6260
Lib/lib2to3/*.pickle
6361
Lib/site-packages/*
6462
!Lib/site-packages/README.txt
@@ -116,6 +114,7 @@ PCbuild/win32/
116114
Tools/unicode/data/
117115
/autom4te.cache
118116
/build/
117+
/builddir/
119118
/config.cache
120119
/config.log
121120
/config.status

Doc/c-api/call.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ This is a pointer to a function with the following signature:
9393
and they must be unique.
9494
If there are no keyword arguments, then *kwnames* can instead be *NULL*.
9595

96-
.. c:macro:: PY_VECTORCALL_ARGUMENTS_OFFSET
96+
.. data:: PY_VECTORCALL_ARGUMENTS_OFFSET
9797

9898
If this flag is set in a vectorcall *nargsf* argument, the callee is allowed
9999
to temporarily change ``args[-1]``. In other words, *args* points to

Doc/c-api/init_config.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1571,8 +1571,6 @@ Private provisional API:
15711571
15721572
* :c:member:`PyConfig._init_main`: if set to ``0``,
15731573
:c:func:`Py_InitializeFromConfig` stops at the "Core" initialization phase.
1574-
* :c:member:`PyConfig._isolated_interpreter`: if non-zero,
1575-
disallow threads, subprocesses and fork.
15761574
15771575
.. c:function:: PyStatus _Py_InitializeMain(void)
15781576

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/structures.rst

Lines changed: 40 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -387,27 +387,27 @@ Accessing attributes of extension types
387387
Structure which describes an attribute of a type which corresponds to a C
388388
struct member. Its fields are:
389389
390-
+------------------+---------------+-------------------------------+
391-
| Field | C Type | Meaning |
392-
+==================+===============+===============================+
393-
| :attr:`name` | const char \* | name of the member |
394-
+------------------+---------------+-------------------------------+
395-
| :attr:`!type` | int | the type of the member in the |
396-
| | | C struct |
397-
+------------------+---------------+-------------------------------+
398-
| :attr:`offset` | Py_ssize_t | the offset in bytes that the |
399-
| | | member is located on the |
400-
| | | type's object struct |
401-
+------------------+---------------+-------------------------------+
402-
| :attr:`flags` | int | flag bits indicating if the |
403-
| | | field should be read-only or |
404-
| | | writable |
405-
+------------------+---------------+-------------------------------+
406-
| :attr:`doc` | const char \* | points to the contents of the |
407-
| | | docstring |
408-
+------------------+---------------+-------------------------------+
390+
.. c:member:: const char* PyMemberDef.name
391+
392+
Name of the member
393+
394+
.. c:member:: int PyMemberDef.type
395+
396+
The type of the member in the C struct.
397+
398+
.. c:member:: Py_ssize_t PyMemberDef.offset
399+
400+
The offset in bytes that the member is located on the type’s object struct.
409401
410-
:attr:`!type` can be one of many ``T_`` macros corresponding to various C
402+
.. c:member:: int PyMemberDef.flags
403+
404+
Flag bits indicating if the field should be read-only or writable.
405+
406+
.. c:member:: const char* PyMemberDef.doc
407+
408+
Points to the contents of the docstring.
409+
410+
:c:member:`PyMemberDef.type` can be one of many ``T_`` macros corresponding to various C
411411
types. When the member is accessed in Python, it will be converted to the
412412
equivalent Python type.
413413
@@ -441,7 +441,7 @@ Accessing attributes of extension types
441441
handles use of the :keyword:`del` statement on that attribute more correctly
442442
than :c:macro:`T_OBJECT`.
443443
444-
:attr:`flags` can be ``0`` for write and read access or :c:macro:`READONLY` for
444+
:c:member:`PyMemberDef.flags` can be ``0`` for write and read access or :c:macro:`READONLY` for
445445
read-only access. Using :c:macro:`T_STRING` for :attr:`type` implies
446446
:c:macro:`READONLY`. :c:macro:`T_STRING` data is interpreted as UTF-8.
447447
Only :c:macro:`T_OBJECT` and :c:macro:`T_OBJECT_EX`
@@ -485,23 +485,25 @@ Accessing attributes of extension types
485485
Structure to define property-like access for a type. See also description of
486486
the :c:member:`PyTypeObject.tp_getset` slot.
487487
488-
+-------------+------------------+-----------------------------------+
489-
| Field | C Type | Meaning |
490-
+=============+==================+===================================+
491-
| name | const char \* | attribute name |
492-
+-------------+------------------+-----------------------------------+
493-
| get | getter | C function to get the attribute |
494-
+-------------+------------------+-----------------------------------+
495-
| set | setter | optional C function to set or |
496-
| | | delete the attribute, if omitted |
497-
| | | the attribute is readonly |
498-
+-------------+------------------+-----------------------------------+
499-
| doc | const char \* | optional docstring |
500-
+-------------+------------------+-----------------------------------+
501-
| closure | void \* | optional function pointer, |
502-
| | | providing additional data for |
503-
| | | getter and setter |
504-
+-------------+------------------+-----------------------------------+
488+
.. c:member:: const char* PyGetSetDef.name
489+
490+
attribute name
491+
492+
.. c:member:: getter PyGetSetDef.get
493+
494+
C funtion to get the attribute.
495+
496+
.. c:member:: setter PyGetSetDef.set
497+
498+
Optional C function to set or delete the attribute, if omitted the attribute is readonly.
499+
500+
.. c:member:: const char* PyGetSetDef.doc
501+
502+
optional docstring
503+
504+
.. c:member:: void* PyGetSetDef.closure
505+
506+
Optional function pointer, providing additional data for getter and setter.
505507
506508
The ``get`` function takes one :c:expr:`PyObject*` parameter (the
507509
instance) and a function pointer (the associated ``closure``)::

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/conf.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,6 @@
197197
coverage_ignore_modules = [
198198
r'[T|t][k|K]',
199199
r'Tix',
200-
r'distutils.*',
201200
]
202201

203202
coverage_ignore_functions = [

Doc/data/stable_abi.dat

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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)