Commit graph

128988 commits

Author SHA1 Message Date
Miss Islington (bot)
abd276ab3d
[3.14] docs: fix f-string in ExceptionGroup example (GH-146108) (GH-146126)
(cherry picked from commit 2c6afb935a)

Co-authored-by: Bartosz Grabowski <58475557+bartosz-grabowski@users.noreply.github.com>
2026-03-24 00:09:00 +01:00
Miss Islington (bot)
74d104d66c
[3.14] gh-145305: Update ocert.org URLs in docs from http to https (GH-145304) (GH-145322)
(cherry picked from commit 11eec7a492)

Co-authored-by: indoor47 <indoor47@gmail.com>
Co-authored-by: Adam (indoor47) <adamai@agentmail.to>
2026-03-23 23:36:40 +01:00
dr-carlos
dd4ea46917
[3.14] gh-141732: Fix ExceptionGroup repr changing when original exception sequence is mutated (GH-141736) (GH-144445)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2026-03-23 23:31:32 +01:00
Miss Islington (bot)
1b2f0bd54c
[3.14] gh-136672: Docs: Move parts of Enum HOWTO to API Docs (GH-139176) (GH-144802)
To avoid duplicate content in the Enum HOWTO and
API documentation which is not automatically synced,
the section about supported __dunder__ and _sunder
names is moved from HOWTO to API docs.

See also https://github.com/python/cpython/pull/136791
(cherry picked from commit 629a363ddd)

Co-authored-by: Rafael Weingartner-Ortner <38643099+RafaelWO@users.noreply.github.com>
2026-03-23 21:21:41 +01:00
Victor Stinner
c6dd764719
[3.14] gh-146197: Run -m test.pythoninfo on the Emscripten CI (#146332) (#146336)
gh-146197: Run -m test.pythoninfo on the Emscripten CI (#146332)


(cherry picked from commit a57209eb98)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2026-03-23 17:54:57 +00:00
Miss Islington (bot)
f883bbd433
[3.14] gh-108907: ctypes: Document _type_ codes (GH-145837) (GH-146328)
gh-108907: ctypes: Document _type_ codes (GH-145837)

Add `_SimpleCData._type_` docs.

Add type codes to the summary table.

Cross-link `struct`, `array`, and `ctypes`; throw in `numpy` too.
(Anyone wanting to add a code should be aware of those.)

Add `py_object`, and `VARIANT_BOOL` for completeness.
(cherry picked from commit 1114d7f7f8)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2026-03-23 14:07:24 +01:00
Miss Islington (bot)
8e7c62b41a
[3.14] gh-145144: Add more tests for UserList, UserDict, etc (GH-145145) (GH-146290)
(cherry picked from commit 161329cde2)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-03-22 15:47:37 +00:00
Miss Islington (bot)
114d1c38b1
[3.14] gh-143959: Fix test_datetime if _datetime is unavailable (GH-145248) (GH-146288)
(cherry picked from commit 97c725cd39)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-03-22 14:41:38 +00:00
Miss Islington (bot)
69a37be21c
[3.14] gh-146245: Fix reference and buffer leaks via audit hook in socket module (GH-146248) (GH-146274)
(cherry picked from commit c30fae4bea)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
2026-03-22 11:55:13 +00:00
Serhiy Storchaka
796513306f
[3.14] gh-146056: Fix repr() for lists and tuples containing NULLs (GH-146129) (GH-146155)
(cherry picked from commit 0f2246b155)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-03-22 09:25:02 +02:00
Miss Islington (bot)
d65e8d9094
[3.14] Docs: replace all datetime imports with import datetime as dt (GH-145640) (#146258)
Docs: replace all `datetime` imports with `import datetime as dt` (GH-145640)
(cherry picked from commit 83360b5869)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2026-03-21 20:19:07 +02:00
Maciej Olko
9737ce2ac2
[3.14] gh-139588: Docs: fix PDF build (#145741) 2026-03-21 19:07:12 +02:00
Miss Islington (bot)
f2c70247fb
[3.14] gh-138234: clarify returncode behavior for subprocesses created with shell=True (GH-138536) (#146254)
gh-138234: clarify returncode behavior for subprocesses created with `shell=True` (GH-138536)
(cherry picked from commit 8a531f89df)

Co-authored-by: andreuu-tsai <32549555+andreuu-tsai@users.noreply.github.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2026-03-21 12:38:34 +00:00
Miss Islington (bot)
d6e0066920
[3.14] GH-100108: Add async generators best practices section (GH-141885) (#146252)
GH-100108: Add async generators best practices section (GH-141885)
(cherry picked from commit 897fa231a7)

Co-authored-by: Sergey Miryanov <sergey.miryanov@gmail.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2026-03-21 12:05:06 +00:00
AN Long
6bd5992d8b
[3.14] gh-129849: Add tests for Py_tp_bases (GH-143208) (#146225)
(cherry picked from commit 6f8867a676)
2026-03-21 15:22:58 +05:30
Sam Gross
73e74eeb2f
[3.14] gh-146227: Fix wrong type in _Py_atomic_load_uint16 in pyatomic_std.h (gh-146229) (#146232)
Also fix a few related issues in the pyatomic headers:

* Fix _Py_atomic_store_uint_release in pyatomic_msc.h to use __stlr32
  on ARM64 instead of a plain volatile store (which is only relaxed on
  ARM64).

* Add missing _Py_atomic_store_uint_release to pyatomic_gcc.h.

* Fix pseudo-code comment for _Py_atomic_store_ptr_release in
  pyatomic.h.

(cherry picked from commit 1eff27f2c0)
2026-03-20 20:08:20 +00:00
Miss Islington (bot)
a2a45d7d13
[3.14] gh-146092: Raise MemoryError on allocation failure in _zoneinfo (GH-146165) (#146223)
gh-146092: Raise MemoryError on allocation failure in _zoneinfo (GH-146165)
(cherry picked from commit 6450b1d142)

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-03-20 16:44:19 +00:00
Victor Stinner
6e73225c32
[3.14] gh-146196: Fix Undefined Behavior in _PyUnicodeWriter_WriteASCIIString() (#146201) (#146220)
gh-146196: Fix Undefined Behavior in _PyUnicodeWriter_WriteASCIIString() (#146201)

Avoid calling memcpy(data + writer->pos, NULL, 0)
which has an undefined behavior.


(cherry picked from commit cd10a2e65c)

Co-authored-by: Shamil <ashm.tech@proton.me>
2026-03-20 16:26:18 +00:00
Miss Islington (bot)
8b447fb56c
[3.14] gh-91279: Note SOURCE_DATE_EPOCH support in ZipFile.writestr() doc (GH-139396) (#146222)
gh-91279: Note `SOURCE_DATE_EPOCH` support in `ZipFile.writestr()` doc (GH-139396)
(cherry picked from commit 5ad738f8fb)

Co-authored-by: Wulian233 <1055917385@qq.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-03-20 16:20:39 +00:00
Serhiy Storchaka
2105187546
[3.14] Improve tests for the PyUnicodeWriter C API (GH-146157) (GH-146180)
Add tests for corner cases: NULL pointers and out of range values.
(cherry picked from commit ab47892c32)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-03-20 11:44:25 +00:00
Miss Islington (bot)
7ba9580f00
[3.14] gh-145754: Update signature retrieval in unittest.mock to use forwardref annotation format (GH-145756) (#146191)
gh-145754: Update signature retrieval in unittest.mock to use forwardref annotation format (GH-145756)
(cherry picked from commit d357a7dbf3)

Co-authored-by: Matthias Schoettle <git@mattsch.com>
2026-03-20 03:06:03 +00:00
Miss Islington (bot)
bc6edf8350
[3.14] gh-145177: Add emscripten run --test, uses test args from config.toml (GH-146160) (#146186)
This allows us to change the test arguments from the python repo rather
than having to change buildmaster-config.
(cherry picked from commit 6b5511d66b)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
2026-03-20 06:39:48 +08:00
Miss Islington (bot)
6a8436138a
[3.14] gh-145177: Add make-dependencies command to emscripten build script (GH-146158) (#146184)
Adds a standalone target for building all dependencies so that the buildbot
script is independent of a specific dependency list.
(cherry picked from commit db11623694)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2026-03-19 22:27:30 +00:00
Miss Islington (bot)
0a9f397239
[3.14] gh-145177: Put node version into emscripten/config.toml. (GH-146156) (#146159)
Configure node version as part of the emscripten build script, and install
that node version if it isn't available.
(cherry picked from commit 91e1312b95)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2026-03-20 05:23:39 +08:00
Sam Gross
fa3143a1d2
[3.14] gh-145779: Improve classmethod/staticmethod scaling in free-threaded build (gh-145826) (#146088)
Add special cases for classmethod and staticmethod descriptors in
_PyObject_GetMethodStackRef() to avoid calling tp_descr_get, which
avoids reference count contention on the bound method and underlying
callable. This improves scaling when calling classmethods and
staticmethods from multiple threads.

Also refactor method_vectorcall in classobject.c into a new
_PyObject_VectorcallPrepend() helper so that it can be used by
PyObject_VectorcallMethod as well.

(cherry picked from commit e0f7c1097e)
2026-03-19 10:49:12 -04:00
Victor Stinner
7f29c1d0da
[3.14] gh-146092: Fix error handling in _BINARY_OP_ADD_FLOAT opcode (#146119)
Fix error handling in _PyFloat_FromDouble_ConsumeInputs() used by
_BINARY_OP_ADD_FLOAT, _BINARY_OP_SUBTRACT_FLOAT and
_BINARY_OP_MULTIPLY_FLOAT opcodes. PyStackRef_FromPyObjectSteal()
must not be called with a NULL pointer.

Fix also _BINARY_OP_INPLACE_ADD_UNICODE opcode.
2026-03-19 12:14:33 +01:00
Miss Islington (bot)
cfdc5e86dd
[3.14] gh-145254: Fix formatting of thread safety annotations (GH-146111) (#146163)
- Add leading space so that the spacing between the previous annotation
  and the thread safety annotation looks correct.
- Remove trailing period from the link to the thread safety level.
(cherry picked from commit 580043dfae)

Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
2026-03-19 11:08:27 +00:00
Miss Islington (bot)
888026fa7c
[3.14] gh-145805: Add python Platforms/emscripten run subcommand (GH-146051) (#146150)
Provides a `run` command in the Emscripten build tooling, and adds
environment variable configuration for EMSDK_CACHE, CROSS_BUILD_DIR
and QUIET.
(cherry picked from commit abd5246305)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2026-03-19 10:05:09 +08:00
Victor Stinner
8eeb800faf
[3.14] gh-146092: Handle _PyFrame_GetFrameObject() failures properly (#146124) (#146132)
gh-146092: Handle _PyFrame_GetFrameObject() failures properly (#146124)

* Fix _PyFrame_GetLocals() and _PyFrame_GetLocals() error handling.
* _PyEval_ExceptionGroupMatch() now fails on _PyFrame_GetLocals()
  error.

(cherry picked from commit e1e4852133)
2026-03-18 17:57:08 +00:00
Miss Islington (bot)
5feedc7593
[3.14] gh-146093: Fix csv _set_str(): check if PyUnicode_DecodeASCII() failed (GH-146113) (#146130)
gh-146093: Fix csv _set_str(): check if PyUnicode_DecodeASCII() failed (GH-146113)

The function can fail on a memory allocation failure.

Bug reported by devdanzin.
(cherry picked from commit 724c7c8146)

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-03-18 17:47:39 +00:00
Miss Islington (bot)
3ebf54ed93
[3.14] gh-142518: Annotate PyList_* C APIs for thread safety (GH-146109) (#146125)
(cherry picked from commit 5b25eaec37)

Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
2026-03-18 17:48:38 +01:00
Miss Islington (bot)
19cbcc0f85
[3.14] gh-142183: Cache one datachunk per tstate to prevent alloc/dealloc thrashing (GH-145789) (#145828)
Cache one datachunk per tstate to prevent alloc/dealloc thrashing when repeatedly hitting the same call depth at exactly the wrong boundary.

Move new _ts member to the end to not mess up remote debuggers' ideas of the
struct's layout. (The struct is only created by the runtime, and the new
field only used by the runtime, so it should be safe.)

(cherry picked from commit 706fd4ec08)
Co-authored-by: T. Wouters <thomas@python.org>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2026-03-18 16:47:36 +01:00
Miss Islington (bot)
6980b94c3a
[3.14] gh-146076: Fix crash when a ZoneInfo subclass is missing a _weak_cache (GH-146082) (GH-146116)
(cherry picked from commit 3b06d68d8a)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2026-03-18 15:23:46 +00:00
Miss Islington (bot)
f20a637644
[3.14] gh-142518: Add thread safety notes for the buffer protocol (GH-145911) (#146106)
(cherry picked from commit 847f83ef1c)

Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
2026-03-18 14:28:52 +01:00
Miss Islington (bot)
c9900734fa
[3.14] gh-146054: Limit the growth of encodings.search_function cache (GH-146055) (GH-146067)
(cherry picked from commit 9d7621b75b)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2026-03-18 13:47:13 +01:00
Sam Gross
b3c2ef5f31
[3.14] gh-134043: use stackrefs for dict lookup in _PyObject_GetMethodStackRef (GH-136412) (#146077)
(cherry picked from commit cbe6ebe15b)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2026-03-17 16:59:26 -04:00
Serhiy Storchaka
a005f323b7
[3.14] gh-144545: Improve handling of default values in Argument Clinic (GH-146016) (GH-146052)
* Add the c_init_default attribute which is used to initialize the C variable
  if the default is not explicitly provided.
* Add the c_default_init() method which is used to derive c_default from
  default if c_default is not explicitly provided.
* Explicit c_default and py_default are now almost always have precedence
  over the generated value.
* Add support for bytes literals as default values.
* Improve support for str literals as default values (support non-ASCII
  and non-printable characters and special characters like backslash or quotes).
* Fix support for str and bytes literals containing trigraphs, "/*" and "*/".
* Improve support for default values in converters "char" and "int(accept={str})".
* Converter "int(accept={str})" now requires 1-character string instead of
  integer as default value.
* Add support for non-None default values in converter "Py_buffer": NULL,
  str and bytes literals.
* Improve error handling for invalid default values.
* Rename Null to NullType for consistency.
(cherry picked from commit 99e2c5eccd)
2026-03-17 10:55:15 +00:00
Miss Islington (bot)
7ad3093d76
[3.14] gh-141707: Skip TarInfo DIRTYPE normalization during GNU long name handling (GH-145819)
(cherry picked from commit 42d754e34c)

Co-authored-by: Seth Michael Larson <seth@python.org>
Co-authored-by: Eashwar Ranganathan <eashwar@eashwar.com>
2026-03-17 10:51:19 +01:00
Miss Islington (bot)
4601007395
[3.14] Docs: a brief note in the sets tutorial about order (GH-145984) (#146049)
Docs: a brief note in the sets tutorial about order (GH-145984)
(cherry picked from commit 4f5e79805e)


Docs: a brief note in the sets tut about order

Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
2026-03-17 05:18:11 -04:00
Miss Islington (bot)
f06961e044
[3.14] gh-145176 Move Emscripten files into Platforms/emscripten (GH-145806) (#146043)
Moves Emscripten build files into Platforms/emscripten.
(cherry picked from commit 1b118353bb)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2026-03-17 10:17:47 +08:00
Miss Islington (bot)
0548f41053
[3.14] gh-144984: Fix crash in Expat's ExternalEntityParserCreate error paths (GH-144992) (#146019)
gh-144984: Fix crash in Expat's `ExternalEntityParserCreate` error paths (GH-144992)
(cherry picked from commit e6b9a14069)

Co-authored-by: Ramin Farajpour Cami <ramin.blackhat@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-03-17 01:49:39 +01:00
Miss Islington (bot)
e050831bd9
[3.14] Docs: remove unmatched parenthesis for asyncio.TaskGroup note (GH-146035) (#146037)
Docs: remove unmatched parenthesis for `asyncio.TaskGroup` note (GH-146035)
(cherry picked from commit 4e96282ee4)

Co-authored-by: trag1c <dev@jakubr.me>
2026-03-16 21:59:31 +01:00
Miss Islington (bot)
9743d88334
[3.14] gh-135329: Remove flaky test_repl_eio test (gh-145932) (#146028)
The test doesn't actually test any pyrepl code (it runs Python with -S)
and has a race condition that causes intermittent timeouts on CI.
(cherry picked from commit e18abc6a1f)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2026-03-16 11:42:47 -04:00
Miss Islington (bot)
62ceb396fc
[3.14] gh-145599, CVE 2026-3644: Reject control characters in http.cookies.Morsel.update() (GH-145600) (#146023)
gh-145599, CVE 2026-3644: Reject control characters in `http.cookies.Morsel.update()` (GH-145600)

Reject control characters in `http.cookies.Morsel.update()` and `http.cookies.BaseCookie.js_output`.
(cherry picked from commit 57e88c1cf9)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Victor Stinner <victor.stinner@gmail.com>
2026-03-16 14:13:19 +00:00
Miss Islington (bot)
8bc3aa9ac3
[3.14] gh-145649: Fix man page text wrapping for -X option (GH-145656) (#146015)
gh-145649: Fix man page text wrapping for -X option (GH-145656)

Replace hardcoded space indentation with proper troff macros
(.TP, .RS/.RE, .IP) for -X sub-options so text wraps correctly
at any terminal width.
(cherry picked from commit 36b5284f04)

Co-authored-by: Matt Van Horn <mvanhorn@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 11:01:28 +00:00
Miss Islington (bot)
cccd9dd3e4
[3.14] gh-145376: Fix GC tracking in structseq.__replace__ (GH-145820) (#145922)
gh-145376: Fix GC tracking in `structseq.__replace__` (GH-145820)
(cherry picked from commit 00a25859a9)

Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
2026-03-16 14:38:15 +05:30
Miss Islington (bot)
88e52acf90
[3.14] Docs: fix a form error and a grammatical error in float.rst (GH-140989) (#146012)
Docs: fix a form error and a grammatical error in float.rst (GH-140989)
(cherry picked from commit 70397fd103)

Co-authored-by: RayXu <xu_ruihong2009@163.com>
2026-03-16 14:38:00 +05:30
Miss Islington (bot)
a1f2fefc32
[3.14] gh-144986: Fix memory leak in atexit.register() (GH-144987) (#145020)
gh-144986: Fix memory leak in atexit.register() (GH-144987)
(cherry picked from commit 50c14719fb)

Co-authored-by: Shamil <ashm.tech@proton.me>
2026-03-16 13:56:05 +05:30
Miss Islington (bot)
a887eae459
[3.14] gh-140814: Fix freeze_support() setting start method as side effect (GH-144608) (#146008)
gh-140814: Fix freeze_support() setting start method as side effect (GH-144608)

freeze_support() called get_start_method() without allow_none=True,
which locked in the default start method context. This caused a
subsequent set_start_method() call to raise "context has already been
set". Use allow_none=True and accept None as a matching value, since
spawn.freeze_support() independently detects spawned child processes.

Test that freeze_support() does not lock in the default start method,
which would prevent a subsequent set_start_method() call.
(cherry picked from commit ee5318025b)

Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-03-16 06:17:34 +00:00
Gregory P. Smith
b8cb83703f
[3.14] gh-145990: sort --help-env sections by environment variable name (GH-146001)
* sort --help-env alphabetically by name.
* add a sorting regression test in test_help_env.

manual backport of GH-145997
2026-03-15 22:55:08 +00:00