Skip to content

Commit 6a50c2f

Browse files
committed
Merge branch 'main' into mark-first-gc
2 parents db2e173 + 3966d8d commit 6a50c2f

File tree

476 files changed

+10937
-4059
lines changed

Some content is hidden

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

476 files changed

+10937
-4059
lines changed

.azure-pipelines/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ jobs:
55
displayName: Pre-build checks
66

77
pool:
8-
vmImage: ubuntu-22.04
8+
vmImage: ubuntu-24.04
99

1010
steps:
1111
- template: ./prebuild-checks.yml

.github/CODEOWNERS

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,17 @@ configure* @erlend-aasland @corona10
1616
Makefile.pre.in @erlend-aasland
1717
Modules/Setup* @erlend-aasland
1818

19+
# argparse
20+
**/*argparse* @savannahostrowski
21+
1922
# asyncio
2023
**/*asyncio* @1st1 @asvetlov @kumaraditya303 @willingc
2124

2225
# Core
2326
**/*context* @1st1
2427
**/*genobject* @markshannon
2528
**/*hamt* @1st1
26-
**/*jit* @brandtbucher
29+
**/*jit* @brandtbucher @savannahostrowski
2730
Objects/set* @rhettinger
2831
Objects/dict* @methane @markshannon
2932
Objects/typevarobject.c @JelleZijlstra

.github/workflows/build.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
# reproducible: to get the same tools versions (autoconf, aclocal, ...)
4747
runs-on: ubuntu-24.04
4848
container:
49-
image: ghcr.io/python/autoconf:2024.10.16.11360930377
49+
image: ghcr.io/python/autoconf:2024.11.11.11786316759
5050
timeout-minutes: 60
5151
needs: check_source
5252
if: needs.check_source.outputs.run_tests == 'true'
@@ -76,7 +76,7 @@ jobs:
7676
# Check for changes in regenerated files
7777
if test -n "$changes"; then
7878
echo "Generated files not up to date."
79-
echo "Perhaps you forgot to run make regen-all or build.bat --regen. ;)"
79+
echo "Perhaps you forgot to run make regen-configure ;)"
8080
echo "configure files must be regenerated with a specific version of autoconf."
8181
echo "$changes"
8282
echo ""
@@ -88,7 +88,7 @@ jobs:
8888
name: 'Check if generated files are up to date'
8989
# Don't use ubuntu-latest but a specific version to make the job
9090
# reproducible: to get the same tools versions (autoconf, aclocal, ...)
91-
runs-on: ubuntu-22.04
91+
runs-on: ubuntu-24.04
9292
timeout-minutes: 60
9393
needs: check_source
9494
if: needs.check_source.outputs.run_tests == 'true'
@@ -237,7 +237,7 @@ jobs:
237237
strategy:
238238
fail-fast: false
239239
matrix:
240-
os: [ubuntu-22.04]
240+
os: [ubuntu-24.04]
241241
openssl_ver: [3.0.15, 3.1.7, 3.2.3, 3.3.2]
242242
env:
243243
OPENSSL_VER: ${{ matrix.openssl_ver }}
@@ -297,7 +297,7 @@ jobs:
297297

298298
test_hypothesis:
299299
name: "Hypothesis tests on Ubuntu"
300-
runs-on: ubuntu-22.04
300+
runs-on: ubuntu-24.04
301301
timeout-minutes: 60
302302
needs: check_source
303303
if: needs.check_source.outputs.run_tests == 'true' && needs.check_source.outputs.run_hypothesis == 'true'
@@ -417,7 +417,7 @@ jobs:
417417
if: needs.check_source.outputs.run_tests == 'true'
418418
strategy:
419419
matrix:
420-
os: [ubuntu-22.04]
420+
os: [ubuntu-24.04]
421421
env:
422422
OPENSSL_VER: 3.0.15
423423
PYTHONSTRICTEXTENSIONBUILD: 1

.github/workflows/jit.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ jobs:
131131
brew update
132132
find /usr/local/bin -lname '*/Library/Frameworks/Python.framework/*' -delete
133133
brew install llvm@${{ matrix.llvm }}
134-
SDKROOT="$(xcrun --show-sdk-path)" \
135-
./configure --enable-experimental-jit ${{ matrix.debug && '--with-pydebug' || '--enable-optimizations --with-lto' }}
134+
export SDKROOT="$(xcrun --show-sdk-path)"
135+
./configure --enable-experimental-jit ${{ matrix.debug && '--with-pydebug' || '--enable-optimizations --with-lto' }}
136136
make all --jobs 4
137137
./python.exe -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3
138138

.github/workflows/posix-deps-apt.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ apt-get -yq install \
1313
libgdbm-dev \
1414
libgdbm-compat-dev \
1515
liblzma-dev \
16-
libmpdec-dev \
1716
libncurses5-dev \
1817
libreadline6-dev \
1918
libsqlite3-dev \

.github/workflows/reusable-tsan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ on:
2121
jobs:
2222
build_tsan_reusable:
2323
name: 'Thread sanitizer'
24-
runs-on: ubuntu-22.04
24+
runs-on: ubuntu-24.04
2525
timeout-minutes: 60
2626
steps:
2727
- uses: actions/checkout@v4

.github/workflows/reusable-ubuntu.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
strategy:
2121
fail-fast: false
2222
matrix:
23-
os: [ubuntu-22.04]
23+
os: [ubuntu-24.04]
2424
env:
2525
FORCE_COLOR: 1
2626
OPENSSL_VER: 3.0.15

.github/workflows/reusable-wasi.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ jobs:
1111
build_wasi_reusable:
1212
name: 'build and test'
1313
timeout-minutes: 60
14-
runs-on: ubuntu-22.04
14+
runs-on: ubuntu-24.04
1515
env:
1616
WASMTIME_VERSION: 22.0.0
1717
WASI_SDK_VERSION: 24
1818
WASI_SDK_PATH: /opt/wasi-sdk
1919
CROSS_BUILD_PYTHON: cross-build/build
20-
CROSS_BUILD_WASI: cross-build/wasm32-wasi
20+
CROSS_BUILD_WASI: cross-build/wasm32-wasip1
2121
steps:
2222
- uses: actions/checkout@v4
2323
# No problem resolver registered as one doesn't currently exist for Clang.
@@ -31,7 +31,7 @@ jobs:
3131
with:
3232
path: ${{ env.WASI_SDK_PATH }}
3333
key: ${{ runner.os }}-wasi-sdk-${{ env.WASI_SDK_VERSION }}
34-
- name: "Install WASI SDK"
34+
- name: "Install WASI SDK" # Hard-coded to x64.
3535
if: steps.cache-wasi-sdk.outputs.cache-hit != 'true'
3636
run: |
3737
mkdir ${{ env.WASI_SDK_PATH }} && \

Doc/c-api/allocation.rst

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@ Allocating Objects on the Heap
1515
.. c:function:: PyObject* PyObject_Init(PyObject *op, PyTypeObject *type)
1616
1717
Initialize a newly allocated object *op* with its type and initial
18-
reference. Returns the initialized object. If *type* indicates that the
19-
object participates in the cyclic garbage detector, it is added to the
20-
detector's set of observed objects. Other fields of the object are not
21-
affected.
18+
reference. Returns the initialized object. Other fields of the object are
19+
not affected.
2220
2321
2422
.. c:function:: PyVarObject* PyObject_InitVar(PyVarObject *op, PyTypeObject *type, Py_ssize_t size)

Doc/c-api/long.rst

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,39 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
582582
.. versionadded:: 3.14
583583
584584
585+
.. c:function:: int PyLong_IsPositive(PyObject *obj)
586+
587+
Check if the integer object *obj* is positive (``obj > 0``).
588+
589+
If *obj* is an instance of :c:type:`PyLongObject` or its subtype,
590+
return ``1`` when it's positive and ``0`` otherwise. Else set an
591+
exception and return ``-1``.
592+
593+
.. versionadded:: next
594+
595+
596+
.. c:function:: int PyLong_IsNegative(PyObject *obj)
597+
598+
Check if the integer object *obj* is negative (``obj < 0``).
599+
600+
If *obj* is an instance of :c:type:`PyLongObject` or its subtype,
601+
return ``1`` when it's negative and ``0`` otherwise. Else set an
602+
exception and return ``-1``.
603+
604+
.. versionadded:: next
605+
606+
607+
.. c:function:: int PyLong_IsZero(PyObject *obj)
608+
609+
Check if the integer object *obj* is zero.
610+
611+
If *obj* is an instance of :c:type:`PyLongObject` or its subtype,
612+
return ``1`` when it's zero and ``0`` otherwise. Else set an
613+
exception and return ``-1``.
614+
615+
.. versionadded:: next
616+
617+
585618
.. c:function:: PyObject* PyLong_GetInfo(void)
586619
587620
On success, return a read only :term:`named tuple`, that holds

Doc/c-api/object.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,3 +575,27 @@ Object Protocol
575575
has the :c:macro:`Py_TPFLAGS_MANAGED_DICT` flag set.
576576
577577
.. versionadded:: 3.13
578+
579+
.. c:function:: int PyUnstable_Object_EnableDeferredRefcount(PyObject *obj)
580+
581+
Enable `deferred reference counting <https://peps.python.org/pep-0703/#deferred-reference-counting>`_ on *obj*,
582+
if supported by the runtime. In the :term:`free-threaded <free threading>` build,
583+
this allows the interpreter to avoid reference count adjustments to *obj*,
584+
which may improve multi-threaded performance. The tradeoff is
585+
that *obj* will only be deallocated by the tracing garbage collector.
586+
587+
This function returns ``1`` if deferred reference counting is enabled on *obj*
588+
(including when it was enabled before the call),
589+
and ``0`` if deferred reference counting is not supported or if the hint was
590+
ignored by the runtime. This function is thread-safe, and cannot fail.
591+
592+
This function does nothing on builds with the :term:`GIL` enabled, which do
593+
not support deferred reference counting. This also does nothing if *obj* is not
594+
an object tracked by the garbage collector (see :func:`gc.is_tracked` and
595+
:c:func:`PyObject_GC_IsTracked`).
596+
597+
This function is intended to be used soon after *obj* is created,
598+
by the code that creates it.
599+
600+
.. versionadded:: next
601+

Doc/c-api/typeobj.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2230,7 +2230,7 @@ This is done by filling a :c:type:`PyType_Spec` structure and calling
22302230
.. _number-structs:
22312231

22322232
Number Object Structures
2233-
========================
2233+
------------------------
22342234

22352235
.. sectionauthor:: Amaury Forgeot d'Arc
22362236

@@ -2344,7 +2344,7 @@ Number Object Structures
23442344
.. _mapping-structs:
23452345

23462346
Mapping Object Structures
2347-
=========================
2347+
-------------------------
23482348

23492349
.. sectionauthor:: Amaury Forgeot d'Arc
23502350

@@ -2381,7 +2381,7 @@ Mapping Object Structures
23812381
.. _sequence-structs:
23822382

23832383
Sequence Object Structures
2384-
==========================
2384+
--------------------------
23852385

23862386
.. sectionauthor:: Amaury Forgeot d'Arc
23872387

@@ -2461,7 +2461,7 @@ Sequence Object Structures
24612461
.. _buffer-structs:
24622462

24632463
Buffer Object Structures
2464-
========================
2464+
------------------------
24652465

24662466
.. sectionauthor:: Greg J. Stein <greg@lyra.org>
24672467
.. sectionauthor:: Benjamin Peterson
@@ -2556,7 +2556,7 @@ Buffer Object Structures
25562556

25572557

25582558
Async Object Structures
2559-
=======================
2559+
-----------------------
25602560

25612561
.. sectionauthor:: Yury Selivanov <yselivanov@sprymix.com>
25622562

@@ -2624,7 +2624,7 @@ Async Object Structures
26242624
.. _slot-typedefs:
26252625

26262626
Slot Type typedefs
2627-
==================
2627+
------------------
26282628

26292629
.. c:type:: PyObject *(*allocfunc)(PyTypeObject *cls, Py_ssize_t nitems)
26302630
@@ -2733,7 +2733,7 @@ Slot Type typedefs
27332733
.. _typedef-examples:
27342734

27352735
Examples
2736-
========
2736+
--------
27372737

27382738
The following are simple examples of Python type definitions. They
27392739
include common usage you may encounter. Some demonstrate tricky corner

Doc/conf.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,7 @@
6767

6868
# General substitutions.
6969
project = 'Python'
70-
if sphinx.version_info[:2] >= (8, 1):
71-
copyright = "2001-%Y, Python Software Foundation"
72-
else:
73-
copyright = f"2001-{time.strftime('%Y')}, Python Software Foundation"
70+
copyright = "2001 Python Software Foundation"
7471

7572
# We look for the Include/patchlevel.h file in the current Python source tree
7673
# and replace the values accordingly.

Doc/copyright.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Copyright
44

55
Python and this documentation is:
66

7-
Copyright © 2001-2024 Python Software Foundation. All rights reserved.
7+
Copyright © 2001 Python Software Foundation. All rights reserved.
88

99
Copyright © 2000 BeOpen.com. All rights reserved.
1010

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

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
Pending removal in Python 3.14
22
------------------------------
33

4-
* The import system:
5-
6-
* Setting :attr:`~module.__loader__` on a module while
7-
failing to set :attr:`__spec__.loader <importlib.machinery.ModuleSpec.loader>`
8-
is deprecated. In Python 3.14, :attr:`!__loader__` will cease to be set or
9-
taken into consideration by the import system or the standard library.
10-
114
* :mod:`argparse`: The *type*, *choices*, and *metavar* parameters
125
of :class:`!argparse.BooleanOptionalAction` are deprecated
136
and will be removed in 3.14.
@@ -103,13 +96,6 @@ Pending removal in Python 3.14
10396
if :ref:`named placeholders <sqlite3-placeholders>` are used and
10497
*parameters* is a sequence instead of a :class:`dict`.
10598

106-
* :class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was
107-
deprecated in :pep:`626`
108-
since 3.10 and was planned to be removed in 3.12,
109-
but it only got a proper :exc:`DeprecationWarning` in 3.12.
110-
May be removed in 3.14.
111-
(Contributed by Nikita Sobolev in :gh:`101866`.)
112-
11399
* :mod:`typing`: :class:`!typing.ByteString`, deprecated since Python 3.9,
114100
now causes a :exc:`DeprecationWarning` to be emitted when it is used.
115101

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,15 @@ Pending removal in Python 3.15
5959
but the C version allows any number of positional or keyword arguments,
6060
ignoring every argument.
6161

62+
* :mod:`types`:
63+
64+
* :class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was
65+
deprecated in :pep:`626`
66+
since 3.10 and was planned to be removed in 3.12,
67+
but it only got a proper :exc:`DeprecationWarning` in 3.12.
68+
May be removed in 3.15.
69+
(Contributed by Nikita Sobolev in :gh:`101866`.)
70+
6271
* :mod:`typing`:
6372

6473
* The undocumented keyword argument syntax for creating

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
Pending removal in Python 3.16
22
------------------------------
33

4+
* The import system:
5+
6+
* Setting :attr:`~module.__loader__` on a module while
7+
failing to set :attr:`__spec__.loader <importlib.machinery.ModuleSpec.loader>`
8+
is deprecated. In Python 3.16, :attr:`!__loader__` will cease to be set or
9+
taken into consideration by the import system or the standard library.
10+
411
* :mod:`array`:
512

613
* The ``'u'`` format code (:c:type:`wchar_t`)

Doc/howto/logging-cookbook.rst

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,11 +1267,8 @@ to adapt in your own applications.
12671267

12681268
You could also write your own handler which uses the :class:`~multiprocessing.Lock`
12691269
class from the :mod:`multiprocessing` module to serialize access to the
1270-
file from your processes. The existing :class:`FileHandler` and subclasses do
1271-
not make use of :mod:`multiprocessing` at present, though they may do so in the
1272-
future. Note that at present, the :mod:`multiprocessing` module does not provide
1273-
working lock functionality on all platforms (see
1274-
https://bugs.python.org/issue3770).
1270+
file from your processes. The stdlib :class:`FileHandler` and subclasses do
1271+
not make use of :mod:`multiprocessing`.
12751272

12761273
.. currentmodule:: logging.handlers
12771274

Doc/library/aifc.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
:mod:`!aifc` --- Read and write AIFF and AIFC files
2+
===================================================
3+
4+
.. module:: aifc
5+
:synopsis: Removed in 3.13.
6+
:deprecated:
7+
8+
.. deprecated-removed:: 3.11 3.13
9+
10+
This module is no longer part of the Python standard library.
11+
It was :ref:`removed in Python 3.13 <whatsnew313-pep594>` after
12+
being deprecated in Python 3.11. The removal was decided in :pep:`594`.
13+
14+
The last version of Python that provided the :mod:`!aifc` module was
15+
`Python 3.12 <https://docs.python.org/3.12/library/aifc.html>`_.

0 commit comments

Comments
 (0)