Commit graph

55860 commits

Author SHA1 Message Date
Hugo van Kemenade
23116f998f Python 3.14.4 2026-04-07 16:13:20 +03:00
Gregory P. Smith
25369a8c78
[3.14] gh-144503: Pass sys.argv to forkserver as real argv elements (GH-148194) (#148195)
Avoid embedding the parent's sys.argv into the forkserver -c command
string via repr().  When sys.argv is large (e.g. thousands of file
paths from a pre-commit hook), the resulting single argument could
exceed the OS per-argument length limit (MAX_ARG_STRLEN on Linux,
typically 128 KiB), causing posix_spawn to fail and the parent to
observe a BrokenPipeError.

Instead, append the argv entries as separate command-line arguments
after -c; the forkserver child reads them back as sys.argv[1:].  This
cannot exceed any limit the parent itself did not already satisfy.

Regression introduced by gh-143706 / 298d5440eb.
(cherry picked from commit 5e9d90b615)
2026-04-07 06:19:32 +00:00
Miss Islington (bot)
8f59d40244
[3.14] gh-137586: Open external osascript program with absolute path (GH-137584) (#148173)
Co-authored-by: Fionn <1897918+fionn@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2026-04-07 03:35:12 +00:00
Miss Islington (bot)
07158b605d
[3.14] gh-146613: Fix re-entrant use-after-free in itertools._grouper (GH-147962) (#148010)
gh-146613: Fix re-entrant use-after-free in `itertools._grouper` (GH-147962)
(cherry picked from commit fc7a188fe7)

Co-authored-by: Ma Yukun <68433685+TheSkyC@users.noreply.github.com>
2026-04-06 18:23:08 +03:00
Miss Islington (bot)
40a0a94700
[3.14] gh-148157: Check for _PyPegen_add_type_comment_to_arg fail in _PyPegen_name_default_pair (GH-148158) (#148162)
(cherry picked from commit 1795fccfbc)

Co-authored-by: Stan Ulbrych <stan@python.org>
2026-04-06 12:22:33 +00:00
Miss Islington (bot)
64207c930b
[3.14] gh-145883: Fix two heap-buffer-overflows in _zoneinfo (GH-145885) (#148087)
(cherry picked from commit fe9befc1ca)

Co-authored-by: Stan Ulbrych <stan@python.org>
2026-04-04 17:13:13 +01:00
Miss Islington (bot)
1c3e3fbcfb
[3.14] gh-143394: Skip pyrepl test_no_newline() basic REPL if readline is missing (GH-147973) (#148005)
gh-143394: Skip pyrepl test_no_newline() basic REPL if readline is missing (GH-147973)
(cherry picked from commit 97babb8ef7)

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-04-04 08:38:43 +00:00
Russell Keith-Magee
ab3d37fab6
[3.14] gh-146541: Allow building the Android testbed for 32-bit targets (GH-146542) (#148064)
Allows building the Android testbed for 32-bit targets, adding the target triplets
`arm-linux-androideabi` and `i686-linux-android`.
(cherry picked from commit 848bbe9ff2)

Co-authored-by: Robert Kirkman <31490854+robertkirkman@users.noreply.github.com>
Co-authored-by: Malcolm Smith <smith@chaquo.com>
2026-04-04 03:58:20 +00:00
Miss Islington (bot)
594b5a05dc
[3.14] gh-143930: Tweak the exception message and increase test coverage (GH-146476) (GH-148042)
(cherry picked from commit 3681d47a44)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2026-04-03 18:28:52 +02:00
Miss Islington (bot)
25b48b84b8
[3.14] gh-143050: Correct PyLong_FromString() to use _PyLong_Negate() (GH-145901) (#147331)
gh-143050: Correct PyLong_FromString() to use _PyLong_Negate() (GH-145901)

The long_from_string_base() might return a small integer, when the
_pylong.py is used to do conversion.  Hence, we must be careful here to
not smash it "small int" bit by using the _PyLong_FlipSign().
(cherry picked from commit db5936c5b8)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-03-31 16:14:12 +02:00
Miss Islington (bot)
ed557e6a5f
[3.14] gh-146615: Fix crash in __get__() for METH_METHOD descriptors with invalid type argument (GH-146634) (GH-146647)
(cherry picked from commit 72d29ea363)

Co-authored-by: sunmy2019 <59365878+sunmy2019@users.noreply.github.com>
2026-03-31 08:20:00 +00:00
Miss Islington (bot)
3c434f7f0f
[3.14] gh-146250: Fix memory leak in re-initialization of SyntaxError (GH-146251) (#146517)
Co-authored-by: Brij Kapadia <97006829+bkap123@users.noreply.github.com>
2026-03-30 16:14:58 +00:00
Miss Islington (bot)
7317e9d761
[3.14] gh-146556: Fix infinite loop in annotationlib.get_annotations() on circular __wrapped__ (GH-146557) (#146622)
gh-146556: Fix infinite loop in annotationlib.get_annotations() on circular __wrapped__ (GH-146557)
(cherry picked from commit 2cf6a68f02)

Co-authored-by: Ramin Farajpour Cami <ramin.blackhat@gmail.com>
2026-03-29 22:30:14 -07:00
Miss Islington (bot)
1458ea0065
[3.14] gh-146090: fix memory management of internal sqlite3 callback contexts (GH-146569) (#146595)
gh-146090: fix memory management of internal `sqlite3` callback contexts (GH-146569)
(cherry picked from commit aa6680775d)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-03-29 15:15:05 +02:00
Bénédikt Tran
883b6d22d1
[3.14] gh-146080: fix a crash in SNI callbacks when the SSL object is gone (GH-146573) (#146597)
(cherry picked from commit 24db78c532)
2026-03-29 12:58:37 +00:00
Miss Islington (bot)
525f8e4dce
[3.14] gh-146004: fix test_args_from_interpreter_flags on windows (GH-146580) (#146585)
gh-146004: fix test_args_from_interpreter_flags on windows (GH-146580)
(cherry picked from commit 1af025dd22)

Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
2026-03-29 04:55:22 +00:00
Miss Islington (bot)
801f67c1af
[3.14] gh-146544: Fix asyncio.Queue docstring ambiguity (GH-146545) (#146567)
gh-146544: Fix `asyncio.Queue` docstring ambiguity (GH-146545)
(cherry picked from commit 578d726d46)

Co-authored-by: Jonathan Dung <jonathandung@yahoo.com>
2026-03-28 19:41:29 +05:30
Miss Islington (bot)
28d3b9bc56
[3.14] gh-146004: propagate all -X options to multiprocessing child processes (GH-146005) (#146552)
gh-146004: propagate all -X options to multiprocessing child processes (GH-146005)

Propagate all -X command line options to multiprocessing spawned child Python processes.
(cherry picked from commit 1efe441de7)

Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
2026-03-28 05:30:06 +00:00
Miss Islington (bot)
b4a0c8defe
[3.14] gh-146310: Fix ensurepip to treat empty WHEEL_PKG_DIR as unset (GH-146357) (#146534)
gh-146310: Fix ensurepip to treat empty WHEEL_PKG_DIR as unset (GH-146357)

Path('') resolves to CWD, so an empty WHEEL_PKG_DIR string caused
ensurepip to search the current working directory for wheel files.
Add a truthiness check to treat empty strings the same as None.
(cherry picked from commit 73cc1fd4f4)

Co-authored-by: Imgyu Kim <kimimgo@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-03-27 21:13:17 +00:00
Miss Islington (bot)
70affe0dc7
[3.14] gh-145616: Detect Android sysconfig ABI correctly on 32-bit ARM Android on 64-bit ARM kernel (GH-145617) (#146464)
gh-145616: Detect Android sysconfig ABI correctly on 32-bit ARM Android on 64-bit ARM kernel (GH-145617)

When Python is running on 32-bit ARM Android on a 64-bit ARM kernel, `os.uname().machine` is `armv8l`. Such devices run the same userspace code as `armv7l` devices, so apply the same `armeabi_v7a` Android ABI to them, which works.
(cherry picked from commit 3a2b81e919)

Co-authored-by: Robert Kirkman <31490854+robertkirkman@users.noreply.github.com>
2026-03-27 20:43:23 +01:00
Miss Islington (bot)
d7e04e7b8d
[3.14] gh-146480: Override the exception in _PyErr_SetKeyError() (GH-146486) (#146511)
gh-146480: Override the exception in _PyErr_SetKeyError() (GH-146486)

If _PyErr_SetKeyError() is called with an exception set, it now
replaces the current exception with KeyError (as expected), instead
of setting a SystemError or failing with a fatal error (in debug
mode).
(cherry picked from commit d4153a9f76)

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-03-27 11:48:29 +00:00
Miss Islington (bot)
cba54979df
[3.14] gh-146059: Cleanup pickle fast_save_enter() test (GH-146481) (#146509)
gh-146059: Cleanup pickle fast_save_enter() test (GH-146481)

Remove {"key": data}, it's not required to reproduce the bug.
Simplify also deep_nested_struct(): remove the seed parameter.
Fix a typo in a comment.
(cherry picked from commit 0c7a75aeef)

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-03-27 08:40:03 +00:00
Miss Islington (bot)
e8c3d31b2c
[3.14] gh-146059: Call fast_save_leave() in pickle save_frozenset() (GH-146173) (#146473)
gh-146059: Call fast_save_leave() in pickle save_frozenset() (GH-146173)

Add more pickle tests: test also nested structures.
(cherry picked from commit 5c0dcb3e0d)

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-03-26 17:02:20 +00:00
Miss Islington (bot)
8a25840a2a
[3.14] gh-145633: Fix struct.pack('f') on s390x (GH-146422) (#146460)
gh-145633: Fix struct.pack('f') on s390x (GH-146422)

Use PyFloat_Pack4() to raise OverflowError.
Add more tests on packing/unpacking floats.
(cherry picked from commit 8de70b31c5)

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2026-03-26 11:38:42 +00:00
Miss Islington (bot)
7efa72a6e4
[3.14] gh-138573: Filter out failing math tests on Solaris (GH-146402) (#146438)
gh-138573: Filter out failing math tests on Solaris (GH-146402)
(cherry picked from commit 8e1469c952)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2026-03-26 00:42:27 +00:00
Miss Islington (bot)
e34945a94c
[3.14] gh-146358: Fix warnings.catch_warnings on Free Threading (GH-146374) (#146418)
gh-146358: Fix warnings.catch_warnings on Free Threading (GH-146374)

catch_warnings now also overrides warnings.showwarning() on Free
Threading to support custom warnings.showwarning().
(cherry picked from commit 0055140b2c)

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-03-25 16:23:21 +00:00
Miss Islington (bot)
4f5f6ea7be
[3.14] gh-144984: Skip test under tracerefs (GH-146218) (GH-146384)
(cherry picked from commit 119fce7b88)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2026-03-25 10:35:31 +01:00
Miss Islington (bot)
ad273f76b2
[3.14] gh-146202: Create tmp_dir in regrtest worker (GH-146347) (#146349)
gh-146202: Create tmp_dir in regrtest worker (GH-146347)

Create tmp_dir in libregrtest.worker since the directory can be
different than the --tempdir directory.
(cherry picked from commit bcff99cb3f)

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-03-24 00:13:09 +00:00
Miss Islington (bot)
c1df96a930
[3.14] gh-145870: Fix Format.SOURCE reference in get_annotations docstring (GH-145889) (GH-146036)
The get_annotations() docstring incorrectly referred to the SOURCE
format, which was renamed to STRING during PEP 749 development.
(cherry picked from commit 2a0fa500f8)

Co-authored-by: wavebyrd <160968744+wavebyrd@users.noreply.github.com>
Co-authored-by: Carson Jones <carson@Carsons-MacBook-Pro.local>
2026-03-24 00:29:53 +01:00
Serhiy Storchaka
e31c551216
[3.14] gh-145264: Do not ignore excess Base64 data after the first padded quad (GH-145267) (GH-146326)
Base64 decoder (see binascii.a2b_base64(), base64.b64decode(), etc)
no longer ignores excess data after the first padded quad in non-strict
(default) mode.  Instead, in conformance with RFC 4648, it ignores the
pad character, "=", if it is present before the end of the encoded data.
(cherry picked from commit 4561f6418a)
2026-03-24 00:20:26 +01:00
Miss Islington (bot)
9669a912a0
[3.14] gh-143930: Reject leading dashes in webbrowser URLs (GH-146214)
(cherry picked from commit 82a24a4442)

Co-authored-by: Seth Michael Larson <seth@python.org>
2026-03-24 00:16:27 +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)
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
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
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
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)
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)
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
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)
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)
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)
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)
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
Gregory P. Smith
36805f6e44
[3.14] gh-145990: Sort python --help-xoptions by option name (GH-145993)
* Sort --help-xoptions alphabetically by name.
* add a sorting regression test in test_help_xoptions

manual backport of GH-145991
2026-03-15 15:17:07 -07:00