Skip to content

Commit 0a1018f

Browse files
Merge branch 'main' into asyncio-policy-rm
2 parents 68b9948 + 1b9fe5c commit 0a1018f

243 files changed

Lines changed: 18995 additions & 3840 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.

.editorconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
root = true
22

3-
[*.{py,c,cpp,h,js,rst,md,yml,yaml,gram}]
3+
[*.{py,c,cpp,h,js,rst,md,yml,yaml,toml,gram}]
44
trim_trailing_whitespace = true
55
insert_final_newline = true
66
indent_style = space
77

8-
[*.{py,c,cpp,h,gram}]
8+
[*.{py,c,cpp,h,toml,gram}]
99
indent_size = 4
1010

1111
[*.rst]

.github/workflows/jit.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,9 @@ jobs:
183183
- name: JIT without optimizations (Debug)
184184
configure_flags: --enable-experimental-jit --with-pydebug
185185
test_env: "PYTHON_UOPS_OPTIMIZE=0"
186+
- name: JIT with stress testing (Debug)
187+
configure_flags: --enable-experimental-jit --with-pydebug
188+
test_env: "PYTHON_JIT_STRESS=1"
186189
- name: JIT with tail calling interpreter
187190
configure_flags: --enable-experimental-jit --with-tail-call-interp --with-pydebug
188191
use_clang: true

.github/workflows/reusable-san.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,12 @@ jobs:
8686
run: >-
8787
./python -m test
8888
${{ inputs.sanitizer == 'TSan' && '--tsan' || '' }}
89-
-j4 -W
89+
-j4 -W --timeout=900 --slowest
9090
- name: Parallel tests
9191
if: >-
9292
inputs.sanitizer == 'TSan'
9393
&& fromJSON(inputs.free-threading)
94-
run: ./python -m test --tsan-parallel --parallel-threads=4 -j4 -W
94+
run: ./python -m test --tsan-parallel --parallel-threads=4 -j4 -W --timeout=600 --slowest
9595
- name: Display logs
9696
if: always()
9797
run: find "${GITHUB_WORKSPACE}" -name 'san_log.*' | xargs head -n 1000

.pre-commit-config.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: e05c5c0818279e5ac248ac9e954431ba58865e61 # frozen: v0.15.7
3+
rev: 3b3f7c3f57fe9925356faf5fe6230835138be230 # frozen: v0.15.17
44
hooks:
55
- id: ruff-check
66
name: Run Ruff (lint) on Platforms/Apple/
@@ -10,6 +10,11 @@ repos:
1010
name: Run Ruff (lint) on Doc/
1111
args: [--exit-non-zero-on-fix]
1212
files: ^Doc/
13+
- id: ruff-check
14+
name: Run Ruff (lint) on Lib/
15+
args: [--exit-non-zero-on-fix]
16+
files: ^Lib/
17+
exclude: ^Lib/test/
1318
- id: ruff-check
1419
name: Run Ruff (lint) on Lib/test/
1520
args: [--exit-non-zero-on-fix]
@@ -18,6 +23,11 @@ repos:
1823
name: Run Ruff (lint) on Platforms/WASI/
1924
args: [--exit-non-zero-on-fix, --config=Platforms/WASI/.ruff.toml]
2025
files: ^Platforms/WASI/
26+
- id: ruff-check
27+
name: Run Ruff (lint) on Tools/
28+
args: [--exit-non-zero-on-fix]
29+
files: ^Tools/
30+
exclude: ^Tools/(build|clinic|i18n|peg_generator|wasm)/
2131
- id: ruff-check
2232
name: Run Ruff (lint) on Tools/build/
2333
args: [--exit-non-zero-on-fix, --config=Tools/build/.ruff.toml]

Doc/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ htmlhelp: build
8888
"build/htmlhelp/pydoc.hhp project file."
8989

9090
.PHONY: latex
91-
latex: _ensure-sphinxcontrib-svg2pdfconverter
9291
latex: BUILDER = latex
93-
latex: build
92+
latex: _ensure-sphinxcontrib-svg2pdfconverter
93+
$(MAKE) build BUILDER=$(BUILDER)
9494
@echo "Build finished; the LaTeX files are in build/latex."
9595
@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
9696
"run these through (pdf)latex."

Doc/c-api/bytes.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,14 +384,18 @@ Getters
384384
385385
Get the writer size.
386386
387+
The function does not invalidate pointers returned by
388+
:c:func:`PyBytesWriter_GetData`.
389+
387390
The function cannot fail.
388391
389392
.. c:function:: void* PyBytesWriter_GetData(PyBytesWriter *writer)
390393
391394
Get the writer data: start of the internal buffer.
392395
393-
The pointer is valid until :c:func:`PyBytesWriter_Finish` or
394-
:c:func:`PyBytesWriter_Discard` is called on *writer*.
396+
The pointer remains valid until a :c:type:`PyBytesWriter` function other
397+
than :c:func:`PyBytesWriter_GetData` or :c:func:`PyBytesWriter_GetSize` is
398+
called on *writer*.
395399
396400
The function cannot fail.
397401

Doc/c-api/init_config.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,10 @@ Some options are read from the :mod:`sys` attributes. For example, the option
623623
624624
.. versionadded:: 3.14
625625
626+
.. versionchanged:: next
627+
The function now replaces :data:`sys.flags` (create a new object),
628+
instead of modifying :data:`sys.flags` in-place.
629+
626630
627631
.. _pyconfig_api:
628632

Doc/c-api/type.rst

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -563,10 +563,10 @@ but need extra remarks for use as slots:
563563
:c:member:`Slot ID <PySlot.sl_id>` for the name of the type,
564564
used to set :c:member:`PyTypeObject.tp_name`.
565565
566-
This slot (or :c:func:`PyType_Spec.name`) is required to create a type.
566+
This slot (or :c:member:`PyType_Spec.name`) is required to create a type.
567567
568568
This may not be used in :c:member:`PyType_Spec.slots`.
569-
Use :c:func:`PyType_Spec.name` instead.
569+
Use :c:member:`PyType_Spec.name` instead.
570570
571571
.. impl-detail::
572572
@@ -585,7 +585,7 @@ but need extra remarks for use as slots:
585585
The value must be positive.
586586
587587
This may not be used in :c:member:`PyType_Spec.slots`.
588-
Use :c:func:`PyType_Spec.basicsize` instead.
588+
Use :c:member:`PyType_Spec.basicsize` instead.
589589
590590
This slot may not be used with :c:func:`PyType_GetSlot`.
591591
Use :c:member:`PyTypeObject.tp_basicsize` instead if needed, but be aware
@@ -616,7 +616,7 @@ but need extra remarks for use as slots:
616616
:c:macro:`!Py_tp_extra_basicsize` is an error.
617617
618618
This may not be used in :c:member:`PyType_Spec.slots`.
619-
Use negative :c:func:`PyType_Spec.basicsize` instead.
619+
Use negative :c:member:`PyType_Spec.basicsize` instead.
620620
621621
This slot may not be used with :c:func:`PyType_GetSlot`.
622622
@@ -648,7 +648,7 @@ but need extra remarks for use as slots:
648648
- With the :c:macro:`Py_TPFLAGS_ITEMS_AT_END` flag.
649649
650650
This may not be used in :c:member:`PyType_Spec.slots`.
651-
Use :c:func:`PyType_Spec.itemsize` instead.
651+
Use :c:member:`PyType_Spec.itemsize` instead.
652652
653653
This slot may not be used with :c:func:`PyType_GetSlot`.
654654
@@ -663,13 +663,44 @@ but need extra remarks for use as slots:
663663
:c:func:`PyType_FromSpecWithBases` sets it automatically.
664664
665665
This may not be used in :c:member:`PyType_Spec.slots`.
666-
Use negative :c:func:`PyType_Spec.basicsize` instead.
666+
Use negative :c:member:`PyType_Spec.basicsize` instead.
667667
668668
This slot may not be used with :c:func:`PyType_GetSlot`.
669669
Use :c:func:`PyType_GetFlags` instead.
670670
671671
.. versionadded:: 3.15
672672
673+
.. c:macro:: Py_tp_bases
674+
675+
:c:member:`Slot ID <PySlot.sl_id>` for type flags, used to set
676+
:c:member:`PyTypeObject.tp_bases`.
677+
678+
The slot can be set to a tuple of type objects which the newly created
679+
type should inherit from, like the "positional arguments" of
680+
a Python :ref:`class definition <class>`.
681+
682+
Alternately, the slot can be set to a single type object to specify
683+
a single base.
684+
The effect is the same as specifying a one-element tuple.
685+
686+
.. versionchanged:: 3.15
687+
688+
Previously, :c:macro:`!Py_tp_bases` required a tuple of types.
689+
690+
.. c:macro:: Py_tp_base
691+
692+
Equivalent to :c:macro:`Py_tp_bases` (with ``s`` at the end).
693+
If both are specified, :c:macro:`!Py_tp_bases` takes priority and
694+
this slot is ignored.
695+
696+
.. versionchanged:: 3.15
697+
698+
Previously, :c:macro:`!Py_tp_base` required a single type, not a tuple.
699+
700+
.. soft-deprecated:: 3.15
701+
702+
When not targetting older Python versions, pefer :c:macro:`!Py_tp_bases`.
703+
673704
The following slots do not correspond to public fields in the
674705
underlying structures:
675706

Doc/c-api/typeobj.rst

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1936,12 +1936,12 @@ and :c:data:`PyType_Type` effectively act as defaults.)
19361936

19371937
.. c:member:: PyTypeObject* PyTypeObject.tp_base
19381938
1939-
.. corresponding-type-slot:: Py_tp_base
1940-
19411939
An optional pointer to a base type from which type properties are inherited. At
19421940
this level, only single inheritance is supported; multiple inheritance require
19431941
dynamically creating a type object by calling the metatype.
19441942

1943+
For the corresponding slot ID, see :c:macro:`Py_tp_base`.
1944+
19451945
.. note::
19461946

19471947
.. from Modules/xxmodule.c
@@ -2253,17 +2253,12 @@ and :c:data:`PyType_Type` effectively act as defaults.)
22532253

22542254
.. c:member:: PyObject* PyTypeObject.tp_bases
22552255
2256-
.. corresponding-type-slot:: Py_tp_bases
2257-
22582256
Tuple of base types.
22592257

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

2263-
For dynamically created classes, the :c:data:`Py_tp_bases`
2264-
:c:type:`slot <PyType_Slot>` can be used instead of the *bases* argument
2265-
of :c:func:`PyType_FromSpecWithBases`.
2266-
The argument form is preferred.
2261+
For the corresponding slot ID, see :c:macro:`Py_tp_bases`.
22672262

22682263
.. warning::
22692264

Doc/library/curses.ascii.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ C library:
114114

115115
.. function:: isblank(c)
116116

117-
Checks for an ASCII whitespace character; space or horizontal tab.
117+
Checks for an ASCII blank character; space or horizontal tab.
118118

119119

120120
.. function:: iscntrl(c)
@@ -130,7 +130,7 @@ C library:
130130

131131
.. function:: isgraph(c)
132132

133-
Checks for ASCII any printable character except space.
133+
Checks for any ASCII printable character except space.
134134

135135

136136
.. function:: islower(c)
@@ -145,7 +145,7 @@ C library:
145145

146146
.. function:: ispunct(c)
147147

148-
Checks for any printable ASCII character which is not a space or an alphanumeric
148+
Checks for any ASCII printable character which is not a space or an alphanumeric
149149
character.
150150

151151

@@ -168,7 +168,8 @@ C library:
168168

169169
.. function:: isctrl(c)
170170

171-
Checks for an ASCII control character (ordinal values 0 to 31).
171+
Checks for an ASCII control character (ordinal values 0 to 31). Unlike
172+
:func:`iscntrl`, this does not include the delete character (0x7f).
172173

173174

174175
.. function:: ismeta(c)

0 commit comments

Comments
 (0)