Commit graph

131644 commits

Author SHA1 Message Date
Victor Stinner
a5c5edddbc
[3.15] gh-151546: Fix stack limits on musl (#151548) (#151583)
gh-151546: Fix stack limits on musl (#151548)

If the thread stack size is set by linker flags, pass the stack size
to Python/ceval.c via the new _Py_LINKER_THREAD_STACK_SIZE variable
to set Py_C_STACK_SIZE macro.

(cherry picked from commit 9a61d1c0c8)
2026-06-17 11:13:40 +02:00
Miss Islington (bot)
ff6e973c3b
[3.15] gh-151218: Replace sys.flags in PyConfig_Set() (GH-151402) (#151552)
gh-151218: Replace sys.flags in PyConfig_Set() (GH-151402)

PyConfig_Set() and sys.set_int_max_str_digits() now replace
sys.flags (create a new object), instead of modifying sys.flags in-place.

Modifying sys.flags in-place can lead to data races when multiple
threads are reading or writing sys.flags in parallel.

Use _Py_atomic functions to get and set max_str_digits members.
(cherry picked from commit b16d23fc9f)

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-06-16 16:48:56 +00:00
Miss Islington (bot)
19bf6a3fa1
[3.15] gh-151519: Check effective gid in _test_all_chown_common group-0 guard (GH-151521) (#151549)
gh-151519: Check effective gid in `_test_all_chown_common` group-0 guard (GH-151521)

The guard that skips the "chown to gid 0 should fail" assertion used
only `os.getgroups()` (supplementary groups). The kernel also accepts
the effective/filesystem gid for chown, so when a process runs with
egid 0 and a non-zero uid (common in containers and user namespaces),
chown(-1, 0) succeeds and the assertion spuriously fails.

Add an `os.getegid() != 0` check alongside the existing
`0 not in os.getgroups()` guard.
(cherry picked from commit 2ce260033b)

Co-authored-by: Itamar Oren <itamarost@gmail.com>
2026-06-16 09:42:24 -07:00
Miss Islington (bot)
ab61101f96
[3.15] gh-150771: Fix email serialization for shift_jis and euc-jp (GH-151120) (GH-151541)
Encode the payload with output_charset instead of input_charset.
(cherry picked from commit 0777a58d80)

Co-authored-by: dev <b.chouksey27@gmail.com>
2026-06-16 12:18:56 +00:00
Miss Islington (bot)
488a03bd2b
[3.15] gh-149716: Document PySlot_DATA for Py_mod_gil and Py_mod_multiple_interpreters (GH-150053) (#151322)
Co-authored-by: Taeknology <20297177+Taeknology@users.noreply.github.com>
2026-06-16 14:52:39 +03:00
Miss Islington (bot)
1a8e7435a5
[3.15] gh-151522: Guard against None transport in slow-socket SSL test (GH-151523) (#151528)
gh-151522: Guard against None transport in slow-socket SSL test (GH-151523)
(cherry picked from commit 11f032f904)

Co-authored-by: Itamar Oren <itamarost@gmail.com>
2026-06-15 22:54:42 -07:00
Miss Islington (bot)
e2c7fa7ff6
[3.15] gh-151422: Don't link libffi into _ctypes_test.so (GH-151423) (#151516)
_ctypes_test doesn't use libffi directly, and linking it into the module
causes emscripten tests to fail.
(cherry picked from commit 8646385076)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2026-06-15 22:45:45 +00:00
Miss Islington (bot)
255b3fff97
[3.15] gh-151223: fix tsan data races in load global specializations (GH-151393) (#151513)
gh-151223: fix tsan data races in load global specializations (GH-151393)
(cherry picked from commit e9d5280f6c)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2026-06-15 22:52:52 +05:30
Miss Islington (bot)
b5eea71702
[3.15] gh-148853: Catch PermissionError in test in_systemd_nspawn_sync_suppressed() (GH-148854) (#151506)
gh-148853: Catch PermissionError in test in_systemd_nspawn_sync_suppressed() (GH-148854)

/run/ on my FreeBSD install is not readable causing failing test.
(cherry picked from commit 35ce2e5f98)

Co-authored-by: Nick Begg <nick@stunttruck.net>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2026-06-15 14:55:27 +00:00
Miss Islington (bot)
cc91b26ce1
[3.15] Add .toml to .editorconfig (GH-151481) (#151491)
Add `.toml` to `.editorconfig` (GH-151481)
(cherry picked from commit 7a70afa199)

Co-authored-by: sobolevn <mail@sobolevn.me>
2026-06-15 09:42:09 +00:00
Miss Islington (bot)
f7ab7c4462
[3.15] gh-149671: Restore compatibility with setuptools -nspkg.pth files in site module (GH-151319) (#151489)
gh-149671: Restore compatibility with setuptools -nspkg.pth files in site module (GH-151319)

Inject the "sitedir" variable in the frame which executes ".pth" code.
(cherry picked from commit 18f3ffec43)

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-06-15 09:01:30 +00:00
Miss Islington (bot)
1b457d3bbc
[3.15] Skip test_highly_nested_objects_decoding during the PGO profile task. (GH-151460) (#151468)
Skip test_highly_nested_objects_decoding during the PGO profile task. (GH-151460)

Since the recursion guard tracks real C-stack bounds (gh-91079), this test
asserts that 500k nesting levels overflow the stack margin. On a 64 MiB stack
(some Nix build envs use one that large), the optimized interpreter uses ~160
bytes/level (raises at ~420k levels) so the assertion holds with only ~16%
margin; the PGO *instrumented* stage inlines less, its per-level scanner frames
are smaller, and the 500k-deep decode completes -- "RecursionError not raised"
fails the profile run and aborts `make profile-opt`. Upstream's
skip_if_unlimited_stack_size (gh-143460) only covers RLIM_INFINITY, not
large-finite stacks like ours.

We could also keep playing whack a mole and raise the 500k to a much larger
number... but there's little value in PGO training on this test anyways.
(cherry picked from commit e91f68ab40)

Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
2026-06-14 11:37:23 -07:00
Bartosz Sławecki
114a7a86a9
[3.15] gh-151390: Colorize match + and match - in the REPL (GH-151391) (#151476)
(cherry picked from commit a7007322c2)
2026-06-14 16:38:07 +00:00
Miss Islington (bot)
89e178d78c
[3.15] gh-151461: Fix encoding-related exception handling in file tokenizer (GH-151462) (GH-151470)
(cherry picked from commit f1a5f68e37)

Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
2026-06-14 12:58:37 +00:00
Miss Islington (bot)
03873bb5f0
[3.15] gh-139837: Document attributes of objects recorded by warnings.catch_warnings (GH-139893) (GH-151472)
(cherry picked from commit 47b7dc788c)

Co-authored-by: Aniket <148300120+Aniketsy@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-06-14 12:47:39 +00:00
Miss Islington (bot)
75289a92df
[3.15] gh-151424: Fix impossible stack traces in RemoteUnwinder(..., cache_frames=True) by copying chunks on cache miss (GH-151426) (#151459)
gh-151424: Fix impossible stack traces in `RemoteUnwinder(..., cache_frames=True)` by copying chunks on cache miss (GH-151426)
(cherry picked from commit 6ce088e20a)

Co-authored-by: Maurycy Pawłowski-Wieroński <maurycy@maurycy.com>
2026-06-13 23:40:19 +00:00
Miss Islington (bot)
5dd32176a1
[3.15] gh-151403: Fix use-after-free when an argv item's __fspath__ mutates args (GH-151404) (#151445)
gh-151403: Fix use-after-free when an argv item's __fspath__ mutates args (GH-151404)

---------
(cherry picked from commit 6679ac07d8)

Co-authored-by: tonghuaroot (童话) <tonghuaroot@gmail.com>
Co-authored-by: tonghuaroot <23011166+tonghuaroot@users.noreply.github.com>
2026-06-13 14:32:48 -07:00
Miss Islington (bot)
56ad6505e1
[3.15] gh-151443: Fix documented default of unittest.mock.mock_open's read_data parameter (GH-151444) (#151450)
(cherry picked from commit 9ad6ba0324)

Co-authored-by: Shardul Deshpande <iamsharduld@users.noreply.github.com>
2026-06-13 18:39:44 +00:00
Miss Islington (bot)
5156e8fb0d
[3.15] gh-77328: Update base64 module RFC references to RFC 4648 (GH-151275) (#151438)
(cherry picked from commit e933987688)

Co-authored-by: Stan Ulbrych <stan@python.org>
2026-06-13 14:00:54 +01:00
Miss Islington (bot)
5d7cf16f3f
[3.15] gh-101267: ProcessPoolExecutor no longer shares 1 BrokenProcessPool exception among all failed futures (GH-101268) (#151430)
gh-101267: ProcessPoolExecutor no longer shares 1 BrokenProcessPool exception among all failed futures (GH-101268)
(cherry picked from commit 3c00ebc2bb)

Co-authored-by: Daniel Shields <daniel.shields@twosigma.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2026-06-13 09:06:55 +00:00
Miss Islington (bot)
8b291463e3
[3.15] Docs: Fix method directive signatures in enum docs (GH-151429) (#151434)
(cherry picked from commit 5b38519762)

Co-authored-by: Jonathan Dung <jonathandung@yahoo.com>
2026-06-13 08:55:30 +00:00
Miss Islington (bot)
04973e705b
[3.15] Fix typos in the curses.ascii module documentation (GH-129300) (#151413)
(cherry picked from commit f4f102027a)

Co-authored-by: Rafael Fontenelle <rffontenelle@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <stan@python.org>
2026-06-12 16:11:06 +00:00
Miss Islington (bot)
bdb53b5553
[3.15] Docs: avoid repetitions of class references in functions.rst (GH-150891) (#151405)
Co-authored-by: Maciej Olko <maciej.olko@affirm.com>
2026-06-12 15:01:30 +00:00
Miss Islington (bot)
5caef8590a
[3.15] gh-151284: Fix test_capi on UBSan (GH-151286) (#151323)
gh-151284: Fix test_capi on UBSan (GH-151286)

Comment two checks relying on undefined behavior in
test_fromwidechar() of test_capi.

Enable test_capi in GitHub Action "Reusable Sanitizer".
(cherry picked from commit d87d772873)

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-06-12 13:10:41 +00:00
Miss Islington (bot)
3603bd318b
[3.15] gh-151126: Fix crash on unset memory error in ctypes.get_errno (GH-151382) (#151398)
gh-151126: Fix crash on unset memory error in `ctypes.get_errno` (GH-151382)
(cherry picked from commit 6b217ea90b)

Co-authored-by: sobolevn <mail@sobolevn.me>
2026-06-12 11:31:51 +00:00
Miss Islington (bot)
a2e551610f
[3.15] gh-151297: Fix undefined behavior in _PyObject_MiRealloc (GH-151358) (GH-151388)
The standard says that a call to `memcpy` must pass a valid source and
destination pointer even if the size is 0, so we must avoid calling
`memcpy` when our source pointer is NULL. If we don't, an optimizing
compiler can decide that the pointer must be non-NULL based on the
presence of UB, and optimize out checks for null pointers.

Specifically, note that the standard says:

    Where an argument declared as size_t n specifies the length of the
    array for a function, n can have the value zero on a call to that
    function. Unless explicitly stated otherwise in the description of
    a particular function in this subclause, pointer arguments on such
    a call shall still have valid values, as described in 7.1.4.

And section 7.1.4 says:

    If an argument to a function has an invalid value (such as a value
    outside the domain of the function, or a pointer outside the address
    space of the program, or a null pointer, or a pointer to
    non-modifiable storage when the corresponding parameter is not
    const-qualified) or a type (after default argument promotion) not
    expected by a function with a variable number of arguments, the
    behavior is undefined.

The specification for `memcpy` doesn't state that it's allowed to be
called with null pointers, and Linux's `/usr/include/string.h` declares
`memcpy` as `__nonnull ((1, 2))`.
(cherry picked from commit c37599200f)

Co-authored-by: Matt Wozniski <mwozniski@bloomberg.net>
2026-06-12 01:47:01 +00:00
Miss Islington (bot)
a12a0e9529
[3.15] gh-151065: Copy fix for memory leak from mimalloc upstream (GH-151066) (GH-151383)
Applies d7a72c4912 to our copy of mimalloc.
(cherry picked from commit 80f9467434)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2026-06-11 22:39:37 +00:00
Miss Islington (bot)
e87e732fda
[3.15] gh-151337: Avoid possible memory leak in _tkinter.c on Windows. (GH-151340) (GH-151379)
(cherry picked from commit 71805db429)

Co-authored-by: Ivy Xu <fakeshadow1337@gmail.com>
2026-06-11 20:25:05 +00:00
Miss Islington (bot)
f3632b47ce
[3.15] gh-138991: Update dataclass documentation for new eq behavior in Python 3.13 (GH-139007) (#151372)
gh-138991: Update dataclass documentation for new eq behavior in Python 3.13 (GH-139007)

And add tests.
(cherry picked from commit 402668b2b1)

Co-authored-by: Aniket <148300120+Aniketsy@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-06-11 17:45:30 +00:00
Miss Islington (bot)
f3fd7b8529
[3.15] gh-150285: Fix too long docstrings in GenericAlias and __class_getitem__ (GH-151354) (GH-151367)
(cherry picked from commit 65047f2e2f)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-06-11 17:22:52 +00:00
Miss Islington (bot)
b53743fb78
[3.15] gh-151126: Fix missing memory error in os._path_splitroot (GH-151339) (#151360)
gh-151126: Fix missing memory error in `os._path_splitroot` (GH-151339)
(cherry picked from commit 10595b1cb7)

Co-authored-by: sobolevn <mail@sobolevn.me>
2026-06-11 16:55:19 +00:00
Miss Islington (bot)
85404a02ba
[3.15] gh-151228: fix data race on clearing embedded dict values (GH-151330) (#151359)
gh-151228: fix data race on clearing embedded dict values (GH-151330)
(cherry picked from commit 6112d70abe)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2026-06-11 16:34:26 +00:00
Miss Islington (bot)
fdf0132e35
[3.15] gh-101100: Fix Sphinx nitpick in unittest.mock.rst (GH-151302) (#151355)
(cherry picked from commit b18168cb32)

Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com>
2026-06-11 16:42:23 +01:00
Miss Islington (bot)
42e81e35a0
[3.15] gh-151112: Fix crash in compiler_mod() when entering the current compilation unit fails (GH-151234) (#151350)
(cherry picked from commit 937d89c4d9)

Co-authored-by: Stan Ulbrych <stan@python.org>
2026-06-11 15:22:31 +00:00
Miss Islington (bot)
cedb4d65f1
[3.15] gh-139588: Fix nondeterministic make latex doc build under parallel make (GH-151343) (#151352)
(cherry picked from commit b9bffc09a6)

Co-authored-by: Maciej Olko <maciej.olko@affirm.com>
2026-06-11 15:21:26 +00:00
Miss Islington (bot)
0d4d4cd746
[3.15] gh-150397: Fix pyexpat bigmem test (GH-151329) (#151348)
gh-150397: Fix pyexpat bigmem test (GH-151329)

Add missing parameter (size).
(cherry picked from commit 0bbde07a0b)

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-06-11 15:15:10 +00:00
Miss Islington (bot)
dc7ca40343
[3.15] gh-150285: Suppress showing the __getstate__() comment in the help for dataclasses (GH-151328) (GH-151331)
(cherry picked from commit 0066fd73a2)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-06-11 18:01:11 +03:00
Miss Islington (bot)
f3532d62ed
[3.15] gh-151238: Check for _get_resized_exprs failure in _PyPegen_{joined,template}_str (GH-151259) (#151344)
(cherry picked from commit 4b44b1e1fd)

Co-authored-by: Stan Ulbrych <stan@python.org>
2026-06-11 14:58:13 +00:00
Miss Islington (bot)
dc5ebe3da4
[3.15] gh-123619: Fix PyUnstable_Object_EnableDeferredRefcount() (GH-151260) (#151326)
gh-123619: Fix PyUnstable_Object_EnableDeferredRefcount() (GH-151260)

Return 0 if the object is not tracked by the GC.
(cherry picked from commit 72e7eddce6)

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-06-11 11:21:26 +00:00
Miss Islington (bot)
491768da4c
[3.15] gh-151177: Fix race condition in _testembed (GH-151293) (GH-151312)
gh-151177: Fix race condition in `_testembed` (GH-151293)
(cherry picked from commit f9ffca3935)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2026-06-11 06:10:55 -04:00
Miss Islington (bot)
e3b94d8fa4
[3.15] gh-151112: Move an assert that may fail in cfg_builder_check (GH-151153) (#151313)
(cherry picked from commit 2d3381035d)

Co-authored-by: Stan Ulbrych <stan@python.org>
2026-06-11 09:46:04 +00:00
Miss Islington (bot)
a8ddc9a77a
[3.15] Drop historical :author:s from HOWTOs (GH-151091) (#151310)
(cherry picked from commit 9620f69cd4)

Co-authored-by: Stan Ulbrych <stan@python.org>
2026-06-11 08:55:01 +00:00
Miss Islington (bot)
9d0999133e
[3.15] gh-151295: Fix use-after-free in bytes.join()/bytearray.join() via re-entrant __buffer__ (GH-151296) (GH-151304)
(cherry picked from commit 84a322aa15)

Co-authored-by: tonghuaroot (童话) <tonghuaroot@gmail.com>
2026-06-11 11:30:24 +03:00
Miss Islington (bot)
f3316ca675
[3.15] gh-136880: Add warning about PYTHONPATH (GH-151098) (GH-151299)
(cherry picked from commit 84630e2cb9)
2026-06-11 07:38:03 +01:00
Miss Islington (bot)
e8d914fd49
[3.15] gh-151278: Fix test_faulthandler on UBSan (GH-151279) (#151281)
gh-151278: Fix test_faulthandler on UBSan (GH-151279)

* Py_FatalError() no longer calls _PyFaulthandler_Fini() if it
  doesn't hold the GIL.
* Skip test_faulthandler tests raising signals if run with UBSan.
* Enable test_faulthandler in GitHub Action "Reusable Sanitizer".
(cherry picked from commit e60c42dc3f)

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-06-10 20:07:07 +00:00
Victor Stinner
10f616cf39
[3.15] gh-151253: Dump the Python path configuration on _PyCodec_InitRegistry() failure (#151250) (#151269)
gh-151253: Dump the Python path configuration on _PyCodec_InitRegistry() failure (#151250)

If "import encodings" fails at Python startup, dump the Python path
configuration to help users debugging their configuration. The
encodings module is the first module imported during Python startup.

(cherry picked from commit 7b6e98911e)
2026-06-10 22:03:27 +02:00
Miss Islington (bot)
040cee94aa
[3.15] GHA: Display output when a sanitizer test fails (GH-151268) (#151272)
GHA: Display output when a sanitizer test fails (GH-151268)

Modify GitHub Action "Reusable Sanitizer" to display output when a
test fails: pass -W option.
(cherry picked from commit 3a8bebd86f)

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-06-10 17:37:52 +00:00
Miss Islington (bot)
5c83037313
[3.15] gh-109940: Respect VIRTUAL_ENV_DISABLE_PROMPT in activate.bat (GH-151215) (GH-151225)
Co-authored-by: Harjoth Khara <harjoth.khara@gmail.com>
2026-06-10 17:48:10 +01:00
Miss Islington (bot)
54ee910bcd
[3.15] gh-151126: Fix missing memory errors in _interpchannelsmodule.c (GH-151239) (#151265)
gh-151126: Fix missing memory errors in `_interpchannelsmodule.c` (GH-151239)
(cherry picked from commit 9fd1a125bc)

Co-authored-by: sobolevn <mail@sobolevn.me>
2026-06-10 16:26:38 +00:00
Miss Islington (bot)
68d2372240
[3.15] gh-141984: Reword the Generator expressions section (GH-150518) (GH-151261)
(cherry picked from commit 7bbb9607a2)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Blaise Pabon <blaise@gmail.com>
Co-authored-by: Stan Ulbrych <stan@python.org>
2026-06-10 18:04:48 +02:00