Skip to content

Commit cc1f37a

Browse files
Merge branch 'main' into use-extra-assertions
2 parents 008cd2b + fafc618 commit cc1f37a

File tree

118 files changed

+2569
-2220
lines changed

Some content is hidden

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

118 files changed

+2569
-2220
lines changed

.github/CODEOWNERS

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
# https://git-scm.com/docs/gitignore#_pattern_format
66

77
# GitHub
8-
.github/** @ezio-melotti @hugovk
8+
.github/** @ezio-melotti @hugovk @AA-Turner
99

1010
# pre-commit
1111
.pre-commit-config.yaml @hugovk @AlexWaygood
12-
.ruff.toml @hugovk @AlexWaygood
12+
.ruff.toml @hugovk @AlexWaygood @AA-Turner
1313

1414
# Build system
1515
configure* @erlend-aasland @corona10
@@ -56,6 +56,14 @@ Tools/c-analyzer/ @ericsnowcurrently
5656
# dbm
5757
**/*dbm* @corona10 @erlend-aasland @serhiy-storchaka
5858

59+
# Doc/ tools
60+
Doc/conf.py @AA-Turner @hugovk
61+
Doc/Makefile @AA-Turner @hugovk
62+
Doc/make.bat @AA-Turner @hugovk
63+
Doc/requirements.txt @AA-Turner @hugovk
64+
Doc/_static/** @AA-Turner @hugovk
65+
Doc/tools/** @AA-Turner @hugovk
66+
5967
# runtime state/lifecycle
6068
**/*pylifecycle* @ericsnowcurrently
6169
**/*pystate* @ericsnowcurrently
@@ -293,6 +301,6 @@ Lib/configparser.py @jaraco
293301
Lib/test/test_configparser.py @jaraco
294302

295303
# Doc sections
296-
Doc/reference/ @willingc
304+
Doc/reference/ @willingc @AA-Turner
297305

298306
**/*weakref* @kumaraditya303

.github/actionlint.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
self-hosted-runner:
2-
labels: ["ubuntu-24.04-aarch64", "windows-aarch64"]
2+
labels: ["windows-aarch64"]
33

44
config-variables: null
55

66
paths:
77
.github/workflows/**/*.yml:
88
ignore:
99
- 1st argument of function call is not assignable
10-
- SC2(015|038|086|091|097|098|129|155)
10+
- SC2(015|038|086|091|097|098|129|155)

.github/workflows/build.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -244,17 +244,13 @@ jobs:
244244
- true
245245
os:
246246
- ubuntu-24.04
247-
- ubuntu-24.04-aarch64
248-
is-fork: # only used for the exclusion trick
249-
- ${{ github.repository_owner != 'python' }}
247+
- ubuntu-24.04-arm
250248
exclude:
251-
- os: ubuntu-24.04-aarch64
252-
is-fork: true
253249
# Do not test BOLT with free-threading, to conserve resources
254250
- bolt: true
255251
free-threading: true
256252
# BOLT currently crashes during instrumentation on aarch64
257-
- os: ubuntu-24.04-aarch64
253+
- os: ubuntu-24.04-arm
258254
bolt: true
259255
uses: ./.github/workflows/reusable-ubuntu.yml
260256
with:

.github/workflows/jit.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,7 @@ jobs:
8383
runner: ubuntu-24.04
8484
- target: aarch64-unknown-linux-gnu/gcc
8585
architecture: aarch64
86-
# Forks don't have access to our paid AArch64 runners. These jobs are skipped below:
87-
runner: ${{ github.repository_owner == 'python' && 'ubuntu-24.04-aarch64' || 'ubuntu-24.04' }}
86+
runner: ubuntu-24.04-arm
8887
steps:
8988
- uses: actions/checkout@v4
9089
with:
@@ -123,8 +122,7 @@ jobs:
123122
./python.exe -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3
124123
125124
- name: Native Linux
126-
# Forks don't have access to our paid AArch64 runners. Skip those:
127-
if: runner.os == 'Linux' && (matrix.architecture == 'x86_64' || github.repository_owner == 'python')
125+
if: runner.os == 'Linux'
128126
run: |
129127
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" ./llvm.sh ${{ matrix.llvm }}
130128
export PATH="$(llvm-config-${{ matrix.llvm }} --bindir):$PATH"

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ repos:
5656
- id: check-readthedocs
5757

5858
- repo: https://github.com/rhysd/actionlint
59-
rev: v1.7.6
59+
rev: v1.7.7
6060
hooks:
6161
- id: actionlint
6262

Doc/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ venv:
172172
else \
173173
echo "Creating venv in $(VENVDIR)"; \
174174
if $(UV) --version >/dev/null 2>&1; then \
175-
$(UV) venv $(VENVDIR); \
175+
$(UV) venv --python=$(PYTHON) $(VENVDIR); \
176176
VIRTUAL_ENV=$(VENVDIR) $(UV) pip install -r $(REQUIREMENTS); \
177177
else \
178178
$(PYTHON) -m venv $(VENVDIR); \

Doc/c-api/veryhigh.rst

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -348,8 +348,20 @@ the same library that the Python runtime is using.
348348
.. versionchanged:: 3.8
349349
Added *cf_feature_version* field.
350350
351+
The available compiler flags are accessible as macros:
351352
352-
.. c:var:: int CO_FUTURE_DIVISION
353+
.. c:namespace:: NULL
353354
354-
This bit can be set in *flags* to cause division operator ``/`` to be
355-
interpreted as "true division" according to :pep:`238`.
355+
.. c:macro:: PyCF_ALLOW_TOP_LEVEL_AWAIT
356+
PyCF_ONLY_AST
357+
PyCF_OPTIMIZED_AST
358+
PyCF_TYPE_COMMENTS
359+
360+
See :ref:`compiler flags <ast-compiler-flags>` in documentation of the
361+
:py:mod:`!ast` Python module, which exports these constants under
362+
the same names.
363+
364+
.. c:var:: int CO_FUTURE_DIVISION
365+
366+
This bit can be set in *flags* to cause division operator ``/`` to be
367+
interpreted as "true division" according to :pep:`238`.

Doc/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
'audit_events',
2626
'availability',
2727
'c_annotations',
28+
'changes',
2829
'glossary_search',
2930
'lexers',
3031
'pyspecific',

Doc/deprecations/pending-removal-in-3.15.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ Pending removal in Python 3.15
5151
This function is only useful for Jython support, has a confusing API,
5252
and is largely untested.
5353

54+
* :mod:`sysconfig`:
55+
56+
* The ``check_home`` argument of :func:`sysconfig.is_python_build` has been
57+
deprecated since Python 3.12.
58+
5459
* :mod:`threading`:
5560

5661
* :func:`~threading.RLock` will take no arguments in Python 3.15.

Doc/deprecations/pending-removal-in-3.16.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@ Pending removal in Python 3.16
8080
has been deprecated since Python 3.13.
8181
Use the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` environment variable instead.
8282

83+
* :mod:`sysconfig`:
84+
85+
* The ``~sysconfig.expand_makefile_vars`` function
86+
has been deprecated since Python 3.14.
87+
Use the ``vars`` argument of :func:`sysconfig.get_paths` instead.
88+
8389
* :mod:`tarfile`:
8490

8591
* The undocumented and unused :attr:`!TarFile.tarfile` attribute

Doc/howto/mro.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ with inheritance diagram
398398
399399
We see that class G inherits from F and E, with F *before* E: therefore
400400
we would expect the attribute *G.remember2buy* to be inherited by
401-
*F.rembermer2buy* and not by *E.remember2buy*: nevertheless Python 2.2
401+
*F.remember2buy* and not by *E.remember2buy*: nevertheless Python 2.2
402402
gives
403403

404404
>>> G.remember2buy # doctest: +SKIP

Doc/library/asyncio-eventloop.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,9 +392,9 @@ Creating Futures and Tasks
392392

393393
If *factory* is ``None`` the default task factory will be set.
394394
Otherwise, *factory* must be a *callable* with the signature matching
395-
``(loop, coro, context=None)``, where *loop* is a reference to the active
395+
``(loop, coro, **kwargs)``, where *loop* is a reference to the active
396396
event loop, and *coro* is a coroutine object. The callable
397-
must return a :class:`asyncio.Future`-compatible object.
397+
must pass on all *kwargs*, and return a :class:`asyncio.Task`-compatible object.
398398

399399
.. method:: loop.get_task_factory()
400400

Doc/library/ctypes.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,8 @@ Fundamental data types
266266
(1)
267267
The constructor accepts any object with a truth value.
268268

269-
Additionally, if IEC 60559 compatible complex arithmetic (Annex G) is supported, the following
270-
complex types are available:
269+
Additionally, if IEC 60559 compatible complex arithmetic (Annex G) is supported
270+
in both C and ``libffi``, the following complex types are available:
271271

272272
+----------------------------------+---------------------------------+-----------------+
273273
| ctypes type | C type | Python type |

Doc/library/dis.rst

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ the following command can be used to display the disassembly of
7575
>>> dis.dis(myfunc)
7676
2 RESUME 0
7777
<BLANKLINE>
78-
3 LOAD_GLOBAL 1 (len + NULL)
78+
3 LOAD_GLOBAL 0 (len)
79+
PUSH_NULL
7980
LOAD_FAST 0 (alist)
8081
CALL 1
8182
RETURN_VALUE
@@ -207,6 +208,7 @@ Example:
207208
...
208209
RESUME
209210
LOAD_GLOBAL
211+
PUSH_NULL
210212
LOAD_FAST
211213
CALL
212214
RETURN_VALUE
@@ -1215,21 +1217,28 @@ iterations of the loop.
12151217

12161218
.. opcode:: LOAD_ATTR (namei)
12171219

1218-
If the low bit of ``namei`` is not set, this replaces ``STACK[-1]`` with
1219-
``getattr(STACK[-1], co_names[namei>>1])``.
1220+
Replaces ``STACK[-1]`` with ``getattr(STACK[-1], co_names[namei>>1])``.
12201221

1221-
If the low bit of ``namei`` is set, this will attempt to load a method named
1222-
``co_names[namei>>1]`` from the ``STACK[-1]`` object. ``STACK[-1]`` is popped.
1222+
.. versionchanged:: 3.12
1223+
If the low bit of ``namei`` is set, then a ``NULL`` or ``self`` is
1224+
pushed to the stack before the attribute or unbound method respectively.
1225+
1226+
.. versionchanged:: 3.14
1227+
Reverted change from 3.12. The low bit of ``namei`` has no special meaning.
1228+
1229+
1230+
.. opcode:: LOAD_METHOD (namei)
1231+
1232+
Attempt to load a method named ``co_names[namei>>1]`` from the ``STACK[-1]`` object.
1233+
``STACK[-1]`` is popped.
12231234
This bytecode distinguishes two cases: if ``STACK[-1]`` has a method with the
12241235
correct name, the bytecode pushes the unbound method and ``STACK[-1]``.
12251236
``STACK[-1]`` will be used as the first argument (``self``) by :opcode:`CALL`
12261237
or :opcode:`CALL_KW` when calling the unbound method.
12271238
Otherwise, ``NULL`` and the object returned by
12281239
the attribute lookup are pushed.
12291240

1230-
.. versionchanged:: 3.12
1231-
If the low bit of ``namei`` is set, then a ``NULL`` or ``self`` is
1232-
pushed to the stack before the attribute or unbound method respectively.
1241+
.. versionadded:: 3.14
12331242

12341243

12351244
.. opcode:: LOAD_SUPER_ATTR (namei)
@@ -1926,12 +1935,6 @@ but are replaced by real opcodes or removed before bytecode is generated.
19261935
This opcode is now a pseudo-instruction.
19271936

19281937

1929-
.. opcode:: LOAD_METHOD
1930-
1931-
Optimized unbound method lookup. Emitted as a ``LOAD_ATTR`` opcode
1932-
with a flag set in the arg.
1933-
1934-
19351938
.. _opcode_collections:
19361939

19371940
Opcode collections

Doc/tools/extensions/changes.py

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
"""Support for documenting version of changes, additions, deprecations."""
2+
3+
from __future__ import annotations
4+
5+
from typing import TYPE_CHECKING
6+
7+
from sphinx.domains.changeset import (
8+
VersionChange,
9+
versionlabel_classes,
10+
versionlabels,
11+
)
12+
from sphinx.locale import _ as sphinx_gettext
13+
14+
if TYPE_CHECKING:
15+
from docutils.nodes import Node
16+
from sphinx.application import Sphinx
17+
from sphinx.util.typing import ExtensionMetadata
18+
19+
20+
def expand_version_arg(argument: str, release: str) -> str:
21+
"""Expand "next" to the current version"""
22+
if argument == "next":
23+
return sphinx_gettext("{} (unreleased)").format(release)
24+
return argument
25+
26+
27+
class PyVersionChange(VersionChange):
28+
def run(self) -> list[Node]:
29+
# Replace the 'next' special token with the current development version
30+
self.arguments[0] = expand_version_arg(
31+
self.arguments[0], self.config.release
32+
)
33+
return super().run()
34+
35+
36+
class DeprecatedRemoved(VersionChange):
37+
required_arguments = 2
38+
39+
_deprecated_label = sphinx_gettext(
40+
"Deprecated since version %s, will be removed in version %s"
41+
)
42+
_removed_label = sphinx_gettext(
43+
"Deprecated since version %s, removed in version %s"
44+
)
45+
46+
def run(self) -> list[Node]:
47+
# Replace the first two arguments (deprecated version and removed version)
48+
# with a single tuple of both versions.
49+
version_deprecated = expand_version_arg(
50+
self.arguments[0], self.config.release
51+
)
52+
version_removed = self.arguments.pop(1)
53+
if version_removed == "next":
54+
raise ValueError(
55+
"deprecated-removed:: second argument cannot be `next`"
56+
)
57+
self.arguments[0] = version_deprecated, version_removed
58+
59+
# Set the label based on if we have reached the removal version
60+
current_version = tuple(map(int, self.config.version.split(".")))
61+
removed_version = tuple(map(int, version_removed.split(".")))
62+
if current_version < removed_version:
63+
versionlabels[self.name] = self._deprecated_label
64+
versionlabel_classes[self.name] = "deprecated"
65+
else:
66+
versionlabels[self.name] = self._removed_label
67+
versionlabel_classes[self.name] = "removed"
68+
try:
69+
return super().run()
70+
finally:
71+
# reset versionlabels and versionlabel_classes
72+
versionlabels[self.name] = ""
73+
versionlabel_classes[self.name] = ""
74+
75+
76+
def setup(app: Sphinx) -> ExtensionMetadata:
77+
# Override Sphinx's directives with support for 'next'
78+
app.add_directive("versionadded", PyVersionChange, override=True)
79+
app.add_directive("versionchanged", PyVersionChange, override=True)
80+
app.add_directive("versionremoved", PyVersionChange, override=True)
81+
app.add_directive("deprecated", PyVersionChange, override=True)
82+
83+
# Register the ``.. deprecated-removed::`` directive
84+
app.add_directive("deprecated-removed", DeprecatedRemoved)
85+
86+
return {
87+
"version": "1.0",
88+
"parallel_read_safe": True,
89+
"parallel_write_safe": True,
90+
}

0 commit comments

Comments
 (0)