Skip to content

Commit 19d7af1

Browse files
committed
Merge branch 'main' into pythongh-114271-remove-tstate_lock
2 parents 196081d + c32bae5 commit 19d7af1

File tree

269 files changed

+3774
-1681
lines changed

Some content is hidden

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

269 files changed

+3774
-1681
lines changed

.github/workflows/build.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ jobs:
132132
with:
133133
python-version: '3.x'
134134
- name: Restore config.cache
135-
uses: actions/cache@v3
135+
uses: actions/cache@v4
136136
with:
137137
path: config.cache
138138
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}-${{ env.pythonLocation }}
@@ -259,7 +259,7 @@ jobs:
259259
steps:
260260
- uses: actions/checkout@v4
261261
- name: Restore config.cache
262-
uses: actions/cache@v3
262+
uses: actions/cache@v4
263263
with:
264264
path: config.cache
265265
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
@@ -274,7 +274,7 @@ jobs:
274274
echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}/lib" >> $GITHUB_ENV
275275
- name: 'Restore OpenSSL build'
276276
id: cache-openssl
277-
uses: actions/cache@v3
277+
uses: actions/cache@v4
278278
with:
279279
path: ./multissl/openssl/${{ env.OPENSSL_VER }}
280280
key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
@@ -319,7 +319,7 @@ jobs:
319319
echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}/lib" >> $GITHUB_ENV
320320
- name: 'Restore OpenSSL build'
321321
id: cache-openssl
322-
uses: actions/cache@v3
322+
uses: actions/cache@v4
323323
with:
324324
path: ./multissl/openssl/${{ env.OPENSSL_VER }}
325325
key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
@@ -342,7 +342,7 @@ jobs:
342342
- name: Bind mount sources read-only
343343
run: sudo mount --bind -o ro $GITHUB_WORKSPACE $CPYTHON_RO_SRCDIR
344344
- name: Restore config.cache
345-
uses: actions/cache@v3
345+
uses: actions/cache@v4
346346
with:
347347
path: ${{ env.CPYTHON_BUILDDIR }}/config.cache
348348
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
@@ -375,7 +375,7 @@ jobs:
375375
./python -m venv $VENV_LOC && $VENV_PYTHON -m pip install -r ${GITHUB_WORKSPACE}/Tools/requirements-hypothesis.txt
376376
- name: 'Restore Hypothesis database'
377377
id: cache-hypothesis-database
378-
uses: actions/cache@v3
378+
uses: actions/cache@v4
379379
with:
380380
path: ./hypothesis
381381
key: hypothesis-database-${{ github.head_ref || github.run_id }}
@@ -421,7 +421,7 @@ jobs:
421421
steps:
422422
- uses: actions/checkout@v4
423423
- name: Restore config.cache
424-
uses: actions/cache@v3
424+
uses: actions/cache@v4
425425
with:
426426
path: config.cache
427427
key: ${{ github.job }}-${{ runner.os }}-${{ needs.check_source.outputs.config_hash }}
@@ -440,7 +440,7 @@ jobs:
440440
echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}/lib" >> $GITHUB_ENV
441441
- name: 'Restore OpenSSL build'
442442
id: cache-openssl
443-
uses: actions/cache@v3
443+
uses: actions/cache@v4
444444
with:
445445
path: ./multissl/openssl/${{ env.OPENSSL_VER }}
446446
key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}

.github/workflows/jit.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
11
name: JIT
22
on:
33
pull_request:
4-
paths: '**jit**'
4+
paths:
5+
- '**jit**'
6+
- 'Python/bytecodes.c'
57
push:
6-
paths: '**jit**'
8+
paths:
9+
- '**jit**'
10+
- 'Python/bytecodes.c'
711
workflow_dispatch:
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
15+
cancel-in-progress: true
16+
817
jobs:
918
jit:
1019
name: ${{ matrix.target }} (${{ matrix.debug && 'Debug' || 'Release' }})
1120
runs-on: ${{ matrix.runner }}
21+
timeout-minutes: 60
1222
strategy:
1323
fail-fast: false
1424
matrix:

.github/workflows/reusable-docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ jobs:
8989
timeout-minutes: 60
9090
steps:
9191
- uses: actions/checkout@v4
92-
- uses: actions/cache@v3
92+
- uses: actions/cache@v4
9393
with:
9494
path: ~/.cache/pip
9595
key: ubuntu-doc-${{ hashFiles('Doc/requirements.txt') }}

.github/workflows/reusable-macos.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,27 @@ on:
1212
jobs:
1313
build_macos:
1414
name: 'build and test'
15-
runs-on: macos-latest
1615
timeout-minutes: 60
1716
env:
1817
HOMEBREW_NO_ANALYTICS: 1
1918
HOMEBREW_NO_AUTO_UPDATE: 1
2019
HOMEBREW_NO_INSTALL_CLEANUP: 1
2120
PYTHONSTRICTEXTENSIONBUILD: 1
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
os: [
25+
"macos-14", # M1
26+
"macos-13", # Intel
27+
]
28+
runs-on: ${{ matrix.os }}
2229
steps:
2330
- uses: actions/checkout@v4
2431
- name: Restore config.cache
25-
uses: actions/cache@v3
32+
uses: actions/cache@v4
2633
with:
2734
path: config.cache
28-
key: ${{ github.job }}-${{ runner.os }}-${{ inputs.config_hash }}
35+
key: ${{ github.job }}-${{ matrix.os }}-${{ inputs.config_hash }}
2936
- name: Install Homebrew dependencies
3037
run: brew install pkg-config [email protected] xz gdbm tcl-tk
3138
- name: Configure CPython

.github/workflows/reusable-ubuntu.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}/lib" >> $GITHUB_ENV
3030
- name: 'Restore OpenSSL build'
3131
id: cache-openssl
32-
uses: actions/cache@v3
32+
uses: actions/cache@v4
3333
with:
3434
path: ./multissl/openssl/${{ env.OPENSSL_VER }}
3535
key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
@@ -53,7 +53,7 @@ jobs:
5353
- name: Bind mount sources read-only
5454
run: sudo mount --bind -o ro $GITHUB_WORKSPACE $CPYTHON_RO_SRCDIR
5555
- name: Restore config.cache
56-
uses: actions/cache@v3
56+
uses: actions/cache@v4
5757
with:
5858
path: ${{ env.CPYTHON_BUILDDIR }}/config.cache
5959
key: ${{ github.job }}-${{ runner.os }}-${{ inputs.config_hash }}

.pre-commit-config.yaml

Lines changed: 1 addition & 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: v0.1.7
3+
rev: v0.2.0
44
hooks:
55
- id: ruff
66
name: Run Ruff on Lib/test/

Doc/c-api/import.rst

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,8 @@ Importing Modules
1313
single: __all__ (package variable)
1414
single: modules (in module sys)
1515
16-
This is a simplified interface to :c:func:`PyImport_ImportModuleEx` below,
17-
leaving the *globals* and *locals* arguments set to ``NULL`` and *level* set
18-
to 0. When the *name*
19-
argument contains a dot (when it specifies a submodule of a package), the
20-
*fromlist* argument is set to the list ``['*']`` so that the return value is the
21-
named module rather than the top-level package containing it as would otherwise
22-
be the case. (Unfortunately, this has an additional side effect when *name* in
23-
fact specifies a subpackage instead of a submodule: the submodules specified in
24-
the package's ``__all__`` variable are loaded.) Return a new reference to the
25-
imported module, or ``NULL`` with an exception set on failure. A failing
26-
import of a module doesn't leave the module in :data:`sys.modules`.
27-
28-
This function always uses absolute imports.
29-
16+
This is a wrapper around :c:func:`PyImport_Import()` which takes a
17+
:c:expr:`const char *` as an argument instead of a :c:expr:`PyObject *`.
3018
3119
.. c:function:: PyObject* PyImport_ImportModuleNoBlock(const char *name)
3220

Doc/c-api/list.rst

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,21 @@ List Objects
5656
Similar to :c:func:`PyList_Size`, but without error checking.
5757
5858
59-
.. c:function:: PyObject* PyList_GetItem(PyObject *list, Py_ssize_t index)
59+
.. c:function:: PyObject* PyList_GetItemRef(PyObject *list, Py_ssize_t index)
6060
6161
Return the object at position *index* in the list pointed to by *list*. The
6262
position must be non-negative; indexing from the end of the list is not
63-
supported. If *index* is out of bounds (<0 or >=len(list)),
63+
supported. If *index* is out of bounds (:code:`<0 or >=len(list)`),
6464
return ``NULL`` and set an :exc:`IndexError` exception.
6565
66+
.. versionadded:: 3.13
67+
68+
69+
.. c:function:: PyObject* PyList_GetItem(PyObject *list, Py_ssize_t index)
70+
71+
Like :c:func:`PyList_GetItemRef`, but returns a
72+
:term:`borrowed reference` instead of a :term:`strong reference`.
73+
6674
6775
.. c:function:: PyObject* PyList_GET_ITEM(PyObject *list, Py_ssize_t i)
6876

Doc/data/refcounts.dat

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,6 +1133,10 @@ PyList_GetItem:PyObject*::0:
11331133
PyList_GetItem:PyObject*:list:0:
11341134
PyList_GetItem:Py_ssize_t:index::
11351135

1136+
PyList_GetItemRef:PyObject*::+1:
1137+
PyList_GetItemRef:PyObject*:list:0:
1138+
PyList_GetItemRef:Py_ssize_t:index::
1139+
11361140
PyList_GetSlice:PyObject*::+1:
11371141
PyList_GetSlice:PyObject*:list:0:
11381142
PyList_GetSlice:Py_ssize_t:low::

Doc/data/stable_abi.dat

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

Doc/glossary.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ Glossary
341341
docstring
342342
A string literal which appears as the first expression in a class,
343343
function or module. While ignored when the suite is executed, it is
344-
recognized by the compiler and put into the :attr:`__doc__` attribute
344+
recognized by the compiler and put into the :attr:`!__doc__` attribute
345345
of the enclosing class, function or module. Since it is available via
346346
introspection, it is the canonical place for documentation of the
347347
object.
@@ -1104,10 +1104,12 @@ Glossary
11041104
The :class:`collections.abc.Sequence` abstract base class
11051105
defines a much richer interface that goes beyond just
11061106
:meth:`~object.__getitem__` and :meth:`~object.__len__`, adding
1107-
:meth:`count`, :meth:`index`, :meth:`~object.__contains__`, and
1107+
:meth:`!count`, :meth:`!index`, :meth:`~object.__contains__`, and
11081108
:meth:`~object.__reversed__`. Types that implement this expanded
11091109
interface can be registered explicitly using
1110-
:func:`~abc.ABCMeta.register`.
1110+
:func:`~abc.ABCMeta.register`. For more documentation on sequence
1111+
methods generally, see
1112+
:ref:`Common Sequence Operations <typesseq-common>`.
11111113

11121114
set comprehension
11131115
A compact way to process all or part of the elements in an iterable and

Doc/howto/enum.rst

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,13 +497,30 @@ the :meth:`~Enum.__repr__` omits the inherited class' name. For example::
497497
>>> Creature.DOG
498498
<Creature.DOG: size='medium', legs=4>
499499

500-
Use the :func:`!dataclass` argument ``repr=False``
500+
Use the :func:`~dataclasses.dataclass` argument ``repr=False``
501501
to use the standard :func:`repr`.
502502

503503
.. versionchanged:: 3.12
504504
Only the dataclass fields are shown in the value area, not the dataclass'
505505
name.
506506

507+
.. note::
508+
509+
Adding :func:`~dataclasses.dataclass` decorator to :class:`Enum`
510+
and its subclasses is not supported. It will not raise any errors,
511+
but it will produce very strange results at runtime, such as members
512+
being equal to each other::
513+
514+
>>> @dataclass # don't do this: it does not make any sense
515+
... class Color(Enum):
516+
... RED = 1
517+
... BLUE = 2
518+
...
519+
>>> Color.RED is Color.BLUE
520+
False
521+
>>> Color.RED == Color.BLUE # problem is here: they should not be equal
522+
True
523+
507524

508525
Pickling
509526
--------

Doc/howto/logging-cookbook.rst

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1933,30 +1933,28 @@ This dictionary is passed to :func:`~config.dictConfig` to put the configuration
19331933

19341934
LOGGING = {
19351935
'version': 1,
1936-
'disable_existing_loggers': True,
1936+
'disable_existing_loggers': False,
19371937
'formatters': {
19381938
'verbose': {
1939-
'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
1939+
'format': '{levelname} {asctime} {module} {process:d} {thread:d} {message}',
1940+
'style': '{',
19401941
},
19411942
'simple': {
1942-
'format': '%(levelname)s %(message)s'
1943+
'format': '{levelname} {message}',
1944+
'style': '{',
19431945
},
19441946
},
19451947
'filters': {
19461948
'special': {
19471949
'()': 'project.logging.SpecialFilter',
19481950
'foo': 'bar',
1949-
}
1951+
},
19501952
},
19511953
'handlers': {
1952-
'null': {
1953-
'level':'DEBUG',
1954-
'class':'django.utils.log.NullHandler',
1955-
},
1956-
'console':{
1957-
'level':'DEBUG',
1958-
'class':'logging.StreamHandler',
1959-
'formatter': 'simple'
1954+
'console': {
1955+
'level': 'INFO',
1956+
'class': 'logging.StreamHandler',
1957+
'formatter': 'simple',
19601958
},
19611959
'mail_admins': {
19621960
'level': 'ERROR',
@@ -1966,9 +1964,8 @@ This dictionary is passed to :func:`~config.dictConfig` to put the configuration
19661964
},
19671965
'loggers': {
19681966
'django': {
1969-
'handlers':['null'],
1967+
'handlers': ['console'],
19701968
'propagate': True,
1971-
'level':'INFO',
19721969
},
19731970
'django.request': {
19741971
'handlers': ['mail_admins'],

0 commit comments

Comments
 (0)