Skip to content

Commit f95263f

Browse files
authored
Merge branch 'main' into issue-92248
2 parents 808826b + e5b8b19 commit f95263f

File tree

490 files changed

+13556
-8953
lines changed

Some content is hidden

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

490 files changed

+13556
-8953
lines changed

.github/CODEOWNERS

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
configure* @erlend-aasland @corona10
1212

1313
# asyncio
14-
**/*asyncio* @1st1 @asvetlov @gvanrossum @kumaraditya303
14+
**/*asyncio* @1st1 @asvetlov @gvanrossum @kumaraditya303 @willingc
1515

1616
# Core
1717
**/*context* @1st1
@@ -25,6 +25,8 @@ Objects/frameobject.c @markshannon
2525
Objects/call.c @markshannon
2626
Python/ceval.c @markshannon
2727
Python/compile.c @markshannon @iritkatriel
28+
Python/assemble.c @markshannon @iritkatriel
29+
Python/flowgraph.c @markshannon @iritkatriel
2830
Python/ast_opt.c @isidentical
2931
Lib/test/test_patma.py @brandtbucher
3032
Lib/test/test_peepholer.py @brandtbucher

.github/workflows/build.yml

+4
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,10 @@ jobs:
308308
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
309309
- name: Install Dependencies
310310
run: sudo ./.github/workflows/posix-deps-apt.sh
311+
- name: Set up GCC-10 for ASAN
312+
uses: egor-tensin/setup-gcc@v1
313+
with:
314+
version: 10
311315
- name: Configure OpenSSL env vars
312316
run: |
313317
echo "MULTISSL_DIR=${GITHUB_WORKSPACE}/multissl" >> $GITHUB_ENV

.github/workflows/doc.yml

+22
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,13 @@ jobs:
5656

5757
# Add pull request annotations for Sphinx nitpicks (missing references)
5858
- name: 'Get list of changed files'
59+
if: github.event_name == 'pull_request'
5960
id: changed_files
6061
uses: Ana06/get-changed-files@v2.2.0
6162
with:
6263
filter: "Doc/**"
6364
- name: 'Build changed files in nit-picky mode'
65+
if: github.event_name == 'pull_request'
6466
continue-on-error: true
6567
run: |
6668
# Mark files the pull request modified
@@ -77,6 +79,26 @@ jobs:
7779
# Build docs with the '-n' (nit-picky) option, convert warnings to errors (-W)
7880
make -C Doc/ PYTHON=../python SPHINXOPTS="-q -n -W --keep-going" html 2>&1
7981
82+
# This build doesn't use problem matchers or check annotations
83+
# It also does not run 'make check', as sphinx-lint is not installed into the
84+
# environment.
85+
build_doc_oldest_supported_sphinx:
86+
name: 'Docs (Oldest Sphinx)'
87+
runs-on: ubuntu-latest
88+
timeout-minutes: 60
89+
steps:
90+
- uses: actions/checkout@v3
91+
- name: 'Set up Python'
92+
uses: actions/setup-python@v4
93+
with:
94+
python-version: '3.11' # known to work with Sphinx 3.2
95+
cache: 'pip'
96+
cache-dependency-path: 'Doc/requirements-oldest-sphinx.txt'
97+
- name: 'Install build dependencies'
98+
run: make -C Doc/ venv REQUIREMENTS="requirements-oldest-sphinx.txt"
99+
- name: 'Build HTML documentation'
100+
run: make -C Doc/ SPHINXOPTS="-q" SPHINXERRORHANDLING="-W --keep-going" html
101+
80102
# Run "doctest" on HEAD as new syntax doesn't exist in the latest stable release
81103
doctest:
82104
name: 'Doctest'
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Read the Docs PR preview
2+
# Automatically edits a pull request's descriptions with a link
3+
# to the documentation's preview on Read the Docs.
4+
5+
on:
6+
pull_request_target:
7+
types:
8+
- opened
9+
paths:
10+
- 'Doc/**'
11+
- '.github/workflows/doc.yml'
12+
13+
permissions:
14+
pull-requests: write
15+
16+
concurrency:
17+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
18+
cancel-in-progress: true
19+
20+
jobs:
21+
documentation-links:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: readthedocs/actions/preview@v1
25+
with:
26+
project-slug: "cpython-previews"
27+
single-version: "true"

.mailmap

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# This file sets the canonical name for contributors to the repository.
2+
# Documentation: https://git-scm.com/docs/gitmailmap
3+
Amethyst Reese <amethyst@n7.gg> <john@noswap.com>

.readthedocs.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Read the Docs configuration file
2+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3+
# Project page: https://readthedocs.org/projects/cpython-previews/
4+
5+
version: 2
6+
7+
sphinx:
8+
configuration: Doc/conf.py
9+
10+
build:
11+
os: ubuntu-22.04
12+
tools:
13+
python: "3"
14+
15+
commands:
16+
- make -C Doc venv html
17+
- mkdir _readthedocs
18+
- mv Doc/build/html _readthedocs/html

Doc/Makefile

+3-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ JOBS = auto
1313
PAPER =
1414
SOURCES =
1515
DISTVERSION = $(shell $(PYTHON) tools/extensions/patchlevel.py)
16+
REQUIREMENTS = requirements.txt
1617
SPHINXERRORHANDLING = -W
1718

1819
# Internal variables.
@@ -154,8 +155,8 @@ venv:
154155
echo "To recreate it, remove it first with \`make clean-venv'."; \
155156
else \
156157
$(PYTHON) -m venv $(VENVDIR); \
157-
$(VENVDIR)/bin/python3 -m pip install -U pip setuptools; \
158-
$(VENVDIR)/bin/python3 -m pip install -r requirements.txt; \
158+
$(VENVDIR)/bin/python3 -m pip install --upgrade pip; \
159+
$(VENVDIR)/bin/python3 -m pip install -r $(REQUIREMENTS); \
159160
echo "The venv has been created in the $(VENVDIR) directory"; \
160161
fi
161162

Doc/c-api/bytearray.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Byte Array Objects
66
------------------
77

8-
.. index:: object: bytearray
8+
.. index:: pair: object; bytearray
99

1010

1111
.. c:type:: PyByteArrayObject

Doc/c-api/bytes.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Bytes Objects
88
These functions raise :exc:`TypeError` when expecting a bytes parameter and
99
called with a non-bytes parameter.
1010

11-
.. index:: object: bytes
11+
.. index:: pair: object; bytes
1212

1313

1414
.. c:type:: PyBytesObject

Doc/c-api/capsule.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Capsules
66
--------
77

8-
.. index:: object: Capsule
8+
.. index:: pair: object; Capsule
99

1010
Refer to :ref:`using-capsules` for more information on using these objects.
1111

Doc/c-api/complex.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Complex Number Objects
66
----------------------
77

8-
.. index:: object: complex number
8+
.. index:: pair: object; complex number
99

1010
Python's complex number objects are implemented as two distinct types when
1111
viewed from the C API: one is the Python object exposed to Python programs, and

Doc/c-api/concrete.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ This section describes Python type objects and the singleton object ``None``.
4040
Numeric Objects
4141
===============
4242

43-
.. index:: object: numeric
43+
.. index:: pair: object; numeric
4444

4545
.. toctree::
4646

@@ -55,7 +55,7 @@ Numeric Objects
5555
Sequence Objects
5656
================
5757

58-
.. index:: object: sequence
58+
.. index:: pair: object; sequence
5959

6060
Generic operations on sequence objects were discussed in the previous chapter;
6161
this section deals with the specific kinds of sequence objects that are
@@ -77,7 +77,7 @@ intrinsic to the Python language.
7777
Container Objects
7878
=================
7979

80-
.. index:: object: mapping
80+
.. index:: pair: object; mapping
8181

8282
.. toctree::
8383

Doc/c-api/dict.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Dictionary Objects
66
------------------
77

8-
.. index:: object: dictionary
8+
.. index:: pair: object; dictionary
99

1010

1111
.. c:type:: PyDictObject

Doc/c-api/exceptions.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ Signal Handling
602602
.. c:function:: int PyErr_CheckSignals()
603603
604604
.. index::
605-
module: signal
605+
pair: module; signal
606606
single: SIGINT
607607
single: KeyboardInterrupt (built-in exception)
608608
@@ -633,7 +633,7 @@ Signal Handling
633633
.. c:function:: void PyErr_SetInterrupt()
634634
635635
.. index::
636-
module: signal
636+
pair: module; signal
637637
single: SIGINT
638638
single: KeyboardInterrupt (built-in exception)
639639
@@ -648,7 +648,7 @@ Signal Handling
648648
.. c:function:: int PyErr_SetInterruptEx(int signum)
649649
650650
.. index::
651-
module: signal
651+
pair: module; signal
652652
single: KeyboardInterrupt (built-in exception)
653653
654654
Simulate the effect of a signal arriving. The next time

Doc/c-api/file.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
File Objects
66
------------
77

8-
.. index:: object: file
8+
.. index:: pair: object; file
99

1010
These APIs are a minimal emulation of the Python 2 C API for built-in file
1111
objects, which used to rely on the buffered I/O (:c:expr:`FILE*`) support

Doc/c-api/float.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Floating Point Objects
66
----------------------
77

8-
.. index:: object: floating point
8+
.. index:: pair: object; floating point
99

1010

1111
.. c:type:: PyFloatObject

Doc/c-api/function.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Function Objects
66
----------------
77

8-
.. index:: object: function
8+
.. index:: pair: object; function
99

1010
There are a few functions specific to Python functions.
1111

Doc/c-api/gcsupport.rst

+20-1
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,31 @@ rules:
5959
Analogous to :c:func:`PyObject_New` but for container objects with the
6060
:const:`Py_TPFLAGS_HAVE_GC` flag set.
6161
62-
6362
.. c:function:: TYPE* PyObject_GC_NewVar(TYPE, PyTypeObject *type, Py_ssize_t size)
6463
6564
Analogous to :c:func:`PyObject_NewVar` but for container objects with the
6665
:const:`Py_TPFLAGS_HAVE_GC` flag set.
6766
67+
.. c:function:: PyObject* PyUnstable_Object_GC_NewWithExtraData(PyTypeObject *type, size_t extra_size)
68+
69+
Analogous to :c:func:`PyObject_GC_New` but allocates *extra_size*
70+
bytes at the end of the object (at offset
71+
:c:member:`~PyTypeObject.tp_basicsize`).
72+
The allocated memory is initialized to zeros,
73+
except for the :c:type:`Python object header <PyObject>`.
74+
75+
The extra data will be deallocated with the object, but otherwise it is
76+
not managed by Python.
77+
78+
.. warning::
79+
The function is marked as unstable because the final mechanism
80+
for reserving extra data after an instance is not yet decided.
81+
For allocating a variable number of fields, prefer using
82+
:c:type:`PyVarObject` and :c:member:`~PyTypeObject.tp_itemsize`
83+
instead.
84+
85+
.. versionadded:: 3.12
86+
6887
6988
.. c:function:: TYPE* PyObject_GC_Resize(TYPE, PyVarObject *op, Py_ssize_t newsize)
7089

Doc/c-api/import.rst

+3-1
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,10 @@ Importing Modules
186186
187187
.. versionadded:: 3.2
188188
.. versionchanged:: 3.3
189-
Uses :func:`imp.source_from_cache()` in calculating the source path if
189+
Uses :func:`!imp.source_from_cache()` in calculating the source path if
190190
only the bytecode path is provided.
191+
.. versionchanged:: 3.12
192+
No longer uses the removed :mod:`!imp` module.
191193
192194
193195
.. c:function:: long PyImport_GetMagicNumber()

Doc/c-api/init.rst

+7-7
Original file line numberDiff line numberDiff line change
@@ -336,9 +336,9 @@ Initializing and finalizing the interpreter
336336
single: PyEval_InitThreads()
337337
single: modules (in module sys)
338338
single: path (in module sys)
339-
module: builtins
340-
module: __main__
341-
module: sys
339+
pair: module; builtins
340+
pair: module; __main__
341+
pair: module; sys
342342
triple: module; search; path
343343
single: PySys_SetArgv()
344344
single: PySys_SetArgvEx()
@@ -1051,7 +1051,7 @@ code, or when embedding the Python interpreter:
10511051
10521052
.. deprecated:: 3.9
10531053
1054-
.. index:: module: _thread
1054+
.. index:: pair: module; _thread
10551055
10561056
10571057
.. c:function:: int PyEval_ThreadsInitialized()
@@ -1494,9 +1494,9 @@ function. You can create and destroy them using the following functions:
14941494
.. c:function:: PyThreadState* Py_NewInterpreter()
14951495
14961496
.. index::
1497-
module: builtins
1498-
module: __main__
1499-
module: sys
1497+
pair: module; builtins
1498+
pair: module; __main__
1499+
pair: module; sys
15001500
single: stdout (in module sys)
15011501
single: stderr (in module sys)
15021502
single: stdin (in module sys)

Doc/c-api/intro.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ complete listing.
261261
Objects, Types and Reference Counts
262262
===================================
263263

264-
.. index:: object: type
264+
.. index:: pair: object; type
265265

266266
Most Python/C API functions have one or more arguments as well as a return value
267267
of type :c:expr:`PyObject*`. This type is a pointer to an opaque data type
@@ -705,9 +705,9 @@ interpreter can only be used after the interpreter has been initialized.
705705

706706
.. index::
707707
single: Py_Initialize()
708-
module: builtins
709-
module: __main__
710-
module: sys
708+
pair: module; builtins
709+
pair: module; __main__
710+
pair: module; sys
711711
triple: module; search; path
712712
single: path (in module sys)
713713

Doc/c-api/list.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
List Objects
66
------------
77

8-
.. index:: object: list
8+
.. index:: pair: object; list
99

1010

1111
.. c:type:: PyListObject

Doc/c-api/long.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
Integer Objects
66
---------------
77

8-
.. index:: object: long integer
9-
object: integer
8+
.. index:: pair: object; long integer
9+
pair: object; integer
1010

1111
All integers are implemented as "long" integer objects of arbitrary size.
1212

Doc/c-api/memoryview.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
.. _memoryview-objects:
44

55
.. index::
6-
object: memoryview
6+
pair: object; memoryview
77

88
MemoryView objects
99
------------------

0 commit comments

Comments
 (0)