Skip to content

Commit 6318eb7

Browse files
committed
Merge branch 'main' into pythongh-89812-omgtarpath
2 parents 1e462b0 + d93b4ac commit 6318eb7

782 files changed

Lines changed: 22271 additions & 11771 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.

‎.coveragerc‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ exclude_lines =
77
# Don't complain if non-runnable code isn't run:
88
if 0:
99
if __name__ == .__main__.:
10+
raise AssertionError\(
11+
12+
# Empty bodies in protocols or abstract methods
13+
^\s*def [a-zA-Z0-9_]+\(.*\)(\s*->.*)?:\s*\.\.\.(\s*#.*)?$
14+
^\s*\.\.\.(\s*#.*)?$
1015

1116
.*# pragma: no cover
1217
.*# pragma: no branch

‎.gitattributes‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,12 @@ Doc/library/token-list.inc generated
7272
Include/internal/pycore_ast.h generated
7373
Include/internal/pycore_ast_state.h generated
7474
Include/internal/pycore_opcode.h generated
75+
Include/internal/pycore_opcode_metadata.h generated
7576
Include/internal/pycore_*_generated.h generated
7677
Include/opcode.h generated
78+
Include/opcode_ids.h generated
7779
Include/token.h generated
80+
Lib/_opcode_metadata.py generated
7881
Lib/keyword.py generated
7982
Lib/test/levenshtein_examples.json generated
8083
Lib/test/test_stable_abi_ctypes.py generated

‎.github/CODEOWNERS‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ Python/traceback.c @iritkatriel
6969

7070
# Import (including importlib).
7171
**/*import* @brettcannon @ericsnowcurrently @ncoghlan @warsaw
72+
/Python/import.c @kumaraditya303
7273
**/*importlib/resources/* @jaraco @warsaw @FFY00
7374
**/importlib/metadata/* @jaraco @warsaw
7475

‎.github/ISSUE_TEMPLATE/bug.md‎

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,46 @@ labels: "type-bug"
55
---
66

77
<!--
8-
If you're new to Python and you're not sure whether what you're experiencing is a bug, the CPython issue tracker is not
9-
the right place to seek help. Consider the following options instead:
8+
New to Python? The issue tracker isn't the right place to get help.
9+
Consider instead:
1010
1111
- reading the Python tutorial: https://docs.python.org/3/tutorial/
12-
- posting in the "Users" category on discuss.python.org: https://discuss.python.org/c/users/7
13-
- emailing the Python-list mailing list: https://mail.python.org/mailman/listinfo/python-list
14-
- searching our issue tracker (https://github.com/python/cpython/issues) to see if
15-
your problem has already been reported
12+
- posting at https://discuss.python.org/c/users/7
13+
- emailing https://mail.python.org/mailman/listinfo/python-list
1614
-->
1715

1816
# Bug report
1917

20-
A clear and concise description of what the bug is.
21-
Include a minimal, reproducible example (https://stackoverflow.com/help/minimal-reproducible-example), if possible.
18+
## Checklist
19+
20+
<!-- Bugs in third-party projects (e.g. `requests`) do not belong in the CPython issue tracker -->
21+
22+
- [ ] I am confident this is a bug in CPython, not a bug in a third-party project
23+
- [ ] I have searched the CPython issue tracker, and am confident this bug has not been reported before
24+
25+
## A clear and concise description of the bug
26+
27+
<!--
28+
Include a minimal, reproducible example if possible.
29+
(https://stackoverflow.com/help/minimal-reproducible-example)
30+
31+
Put any code blocks inside triple backticks:
32+
33+
```py
34+
your code here
35+
```
36+
37+
-->
38+
39+
2240

2341
# Your environment
2442

25-
<!-- Include as many relevant details as possible about the environment you experienced the bug in -->
43+
<!-- Include all relevant details about the environment you experienced the bug in -->
2644

2745
- CPython versions tested on:
2846
- Operating system and architecture:
2947

3048
<!--
31-
You can freely edit this text. Remove any lines you believe are unnecessary.
49+
You can freely edit this form. Remove any lines you believe are unnecessary.
3250
-->

‎.github/ISSUE_TEMPLATE/crash.md‎

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,44 @@ labels: "type-crash"
55
---
66

77
<!--
8-
Use this template for hard crashes of the interpreter, segmentation faults, failed C-level assertions, and similar.
9-
Do not submit this form if you encounter an exception being unexpectedly raised from a Python function.
10-
Most of the time, these should be filed as bugs, rather than crashes.
8+
This form is for hard crashes of the Python interpreter, segmentation faults,
9+
failed C-level assertions, and similar.
10+
Exceptions unexpectedly raised from stdlib Python functions
11+
count as bugs rather than crashes.
1112
12-
The CPython interpreter is itself written in a different programming language, C.
13-
For CPython, a "crash" is when Python itself fails, leading to a traceback in the C stack.
13+
The CPython interpreter is written in a different programming language, C.
14+
A "CPython crash" is when Python itself fails, leading to a traceback in the C stack.
1415
-->
1516

1617
# Crash report
1718

18-
Tell us what happened, ideally including a minimal, reproducible example (https://stackoverflow.com/help/minimal-reproducible-example).
19+
<!--
20+
Tell us what happened. Ideally, include a minimal, reproducible example.
21+
(https://stackoverflow.com/help/minimal-reproducible-example)
22+
23+
Put any code blocks inside triple backticks:
24+
25+
```py
26+
your code here
27+
```
28+
29+
-->
30+
31+
1932

2033
# Error messages
2134

22-
Enter any relevant error message caused by the crash, including a core dump if there is one.
35+
<!-- Enter any error messages caused by the crash, including a core dump if there is one -->
36+
37+
2338

2439
# Your environment
2540

26-
<!-- Include as many relevant details as possible about the environment you experienced the bug in -->
41+
<!-- Include all relevant details about the environment you experienced the crash in -->
2742

2843
- CPython versions tested on:
2944
- Operating system and architecture:
3045

3146
<!--
32-
You can freely edit this text. Remove any lines you believe are unnecessary.
47+
You can freely edit this form. Remove any lines you believe are unnecessary.
3348
-->

‎.github/ISSUE_TEMPLATE/feature.md‎

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,47 @@ about: Submit a proposal for a new CPython feature or enhancement
44
labels: "type-feature"
55
---
66

7+
<!--
8+
Proposing a new feature for Python?
9+
You'll need to demonstrate widespread support for your idea among the community.
10+
11+
Major feature proposals should generally be discussed at
12+
https://discuss.python.org/c/ideas/6 before opening a GitHub issue.
13+
Wait until it's clear that most people support your idea
14+
before filling in this form.
15+
-->
16+
717
# Feature or enhancement
818

9-
(A clear and concise description of your proposal.)
19+
<!-- A clear and concise description of your proposal. -->
20+
21+
1022

1123
# Pitch
1224

13-
(Explain why this feature or enhancement should be implemented and how it would be used.
14-
Add examples, if applicable.)
25+
<!--
26+
Explain why this feature or enhancement should be implemented and how it would be used.
27+
Add examples, if applicable.
28+
29+
Put any code blocks inside triple backticks:
30+
31+
```py
32+
your code here
33+
```
34+
35+
-->
36+
37+
1538

1639
# Previous discussion
1740

1841
<!--
19-
New features to Python should first be discussed elsewhere before creating issues on GitHub,
20-
for example in the "ideas" category (https://discuss.python.org/c/ideas/6) of discuss.python.org,
21-
or the python-ideas mailing list (https://mail.python.org/mailman3/lists/python-ideas.python.org/).
22-
Use this space to post links to the places where you have already discussed this feature proposal:
42+
Use this space to post links to the places
43+
where you have already discussed your feature proposal:
2344
-->
2445

2546

47+
2648
<!--
27-
You can freely edit this text. Remove any lines you believe are unnecessary.
49+
You can freely edit this form. Remove any lines you believe are unnecessary.
2850
-->

‎.github/workflows/reusable-docs.yml‎

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,35 +28,28 @@ jobs:
2828
cache-dependency-path: 'Doc/requirements.txt'
2929
- name: 'Install build dependencies'
3030
run: make -C Doc/ venv
31-
- name: 'Build HTML documentation'
32-
run: make -C Doc/ SPHINXOPTS="-q" SPHINXERRORHANDLING="-W --keep-going" html
3331

34-
# Add pull request annotations for Sphinx nitpicks (missing references)
32+
# To annotate PRs with Sphinx nitpicks (missing references)
3533
- name: 'Get list of changed files'
3634
if: github.event_name == 'pull_request'
3735
id: changed_files
3836
uses: Ana06/get-changed-files@v2.2.0
3937
with:
4038
filter: "Doc/**"
4139
format: csv # works for paths with spaces
42-
- name: 'Build changed files in nit-picky mode'
43-
if: github.event_name == 'pull_request'
40+
- name: 'Build HTML documentation'
4441
continue-on-error: true
4542
run: |
4643
set -Eeuo pipefail
47-
# Mark files the pull request modified
48-
python Doc/tools/touch-clean-files.py --clean '${{ steps.changed_files.outputs.added_modified }}'
49-
# Build docs with the '-n' (nit-picky) option; convert warnings to annotations
50-
make -C Doc/ PYTHON=../python SPHINXOPTS="-q -n --keep-going" html 2>&1 |
51-
python Doc/tools/warnings-to-gh-actions.py
52-
53-
# Ensure some files always pass Sphinx nit-picky mode (no missing references)
54-
- name: 'Build known-good files in nit-picky mode'
44+
# Build docs with the '-n' (nit-picky) option; write warnings to file
45+
make -C Doc/ PYTHON=../python SPHINXOPTS="-q -n -W --keep-going -w sphinx-warnings.txt" html
46+
- name: 'Check warnings'
47+
if: github.event_name == 'pull_request'
5548
run: |
56-
# Mark files that must pass nit-picky
57-
python Doc/tools/touch-clean-files.py
58-
# Build docs with the '-n' (nit-picky) option, convert warnings to errors (-W)
59-
make -C Doc/ PYTHON=../python SPHINXOPTS="-q -n -W --keep-going" html 2>&1
49+
python Doc/tools/check-warnings.py \
50+
--check-and-annotate '${{ steps.changed_files.outputs.added_modified }}' \
51+
--fail-if-regression \
52+
--fail-if-improved
6053
6154
# This build doesn't use problem matchers or check annotations
6255
build_doc_oldest_supported_sphinx:

‎.pre-commit-config.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ repos:
1010
types_or: [c, python, rst]
1111

1212
- repo: https://github.com/sphinx-contrib/sphinx-lint
13-
rev: v0.6.7
13+
rev: v0.6.8
1414
hooks:
1515
- id: sphinx-lint
1616
args: [--enable=default-role]

‎Doc/c-api/allocation.rst‎

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,31 +27,35 @@ Allocating Objects on the Heap
2727
length information for a variable-size object.
2828
2929
30-
.. c:function:: TYPE* PyObject_New(TYPE, PyTypeObject *type)
30+
.. c:macro:: PyObject_New(TYPE, typeobj)
3131
32-
Allocate a new Python object using the C structure type *TYPE* and the
33-
Python type object *type*. Fields not defined by the Python object header
34-
are not initialized; the object's reference count will be one. The size of
35-
the memory allocation is determined from the :c:member:`~PyTypeObject.tp_basicsize` field of
36-
the type object.
32+
Allocate a new Python object using the C structure type *TYPE*
33+
and the Python type object *typeobj* (``PyTypeObject*``).
34+
Fields not defined by the Python object header are not initialized.
35+
The caller will own the only reference to the object
36+
(i.e. its reference count will be one).
37+
The size of the memory allocation is determined from the
38+
:c:member:`~PyTypeObject.tp_basicsize` field of the type object.
3739
3840
39-
.. c:function:: TYPE* PyObject_NewVar(TYPE, PyTypeObject *type, Py_ssize_t size)
41+
.. c:macro:: PyObject_NewVar(TYPE, typeobj, size)
4042
4143
Allocate a new Python object using the C structure type *TYPE* and the
42-
Python type object *type*. Fields not defined by the Python object header
44+
Python type object *typeobj* (``PyTypeObject*``).
45+
Fields not defined by the Python object header
4346
are not initialized. The allocated memory allows for the *TYPE* structure
44-
plus *size* fields of the size given by the :c:member:`~PyTypeObject.tp_itemsize` field of
45-
*type*. This is useful for implementing objects like tuples, which are
47+
plus *size* (``Py_ssize_t``) fields of the size
48+
given by the :c:member:`~PyTypeObject.tp_itemsize` field of
49+
*typeobj*. This is useful for implementing objects like tuples, which are
4650
able to determine their size at construction time. Embedding the array of
4751
fields into the same allocation decreases the number of allocations,
4852
improving the memory management efficiency.
4953
5054
5155
.. c:function:: void PyObject_Del(void *op)
5256
53-
Releases memory allocated to an object using :c:func:`PyObject_New` or
54-
:c:func:`PyObject_NewVar`. This is normally called from the
57+
Releases memory allocated to an object using :c:macro:`PyObject_New` or
58+
:c:macro:`PyObject_NewVar`. This is normally called from the
5559
:c:member:`~PyTypeObject.tp_dealloc` handler specified in the object's type. The fields of
5660
the object should not be accessed after this call as the memory is no
5761
longer a valid Python object.

‎Doc/c-api/apiabiversion.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ See :ref:`stable` for a discussion of API and ABI stability across versions.
6060

6161
Use this for numeric comparisons, e.g. ``#if PY_VERSION_HEX >= ...``.
6262

63-
This version is also available via the symbol :data:`Py_Version`.
63+
This version is also available via the symbol :c:var:`Py_Version`.
6464

6565
.. c:var:: const unsigned long Py_Version
6666

0 commit comments

Comments
 (0)