Commit graph

131417 commits

Author SHA1 Message Date
Miss Islington (bot)
77cc4428a7
[3.15] gh-146452: Fix pickle segfault on concurrent mutation of dict in pickle (GH-146470) (#150292)
gh-146452: Fix pickle segfault on concurrent mutation of dict in pickle (GH-146470)
(cherry picked from commit e62a61177f)

Co-authored-by: Farhan Saif <fsaif@uic.edu>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2026-05-23 07:33:21 +00:00
Victor Stinner
795dd3bd35
[3.15] Revert "[3.15] gh-146452: Improve locking granularity in pickle's batch_dict_exact and fix race condition (GH-150025) (#150039)" (#150262)
Revert "[3.15] gh-146452: Improve locking granularity in pickle's batch_dict_exact and fix race condition (GH-150025) (#150039)"

This reverts commit 66ade2861f.
2026-05-23 12:27:27 +05:30
Miss Islington (bot)
081187f169
[3.15] gh-82907: Document mtime=0 for reproducible tarfile gzip output (GH-150269) (GH-150271)
(cherry picked from commit 9df2b6ccc7)

Co-authored-by: Omkar Kabde <omkarkabde@gmail.com>
2026-05-23 00:17:51 +03:00
Miss Islington (bot)
3daf1fad7a
[3.15] gh-149189: Revert "Modern defaults for pprint (GH-149190)" (GH-150249) (#150268)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2026-05-22 20:49:36 +00:00
Miss Islington (bot)
f5231469b5
[3.15] gh-148829: Make sentinels' repr and module customizable (GH-149654) (#150092)
Implementation of python/peps#4968.
(cherry picked from commit 08218030a5)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2026-05-22 07:44:34 -07:00
Miss Islington (bot)
b79112fb34
[3.15] CI: Move Homebrew dependencies into Brewfile (GH-148335) (#149882)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Brett Cannon <brett@python.org>
2026-05-22 14:44:08 +00:00
Miss Islington (bot)
50c5c07d2f
[3.15] gh-149902: Remove dead packaging docs link and add a new section for external resources (GH-150030) (#150241)
Co-authored-by: Mia Albert <micha@2231puppy.tech>
Co-authored-by: Stan Ulbrych <stan@python.org>
Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2026-05-22 11:40:49 +00:00
Miss Islington (bot)
e192a0ea52
[3.15] gh-137571: Protect against possible UnboundLocalError in gzip._GzipReader.read() (GH-150222) (GH-150229)
This has not been observed in practice, but we cannot be 100% sure that
it will not happen with some weird gzip data.
(cherry picked from commit 28eac9a726)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-05-22 09:46:14 +00:00
Miss Islington (bot)
b039d1bd97
[3.15] gh-133998: Fix gzip file creation when time is out of range (GH-134278) (GH-150221)
(cherry picked from commit 1daad8a163)

Co-authored-by: adang1345 <adang1345@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-05-22 07:48:42 +00:00
Miss Islington (bot)
591c4ffdd9
[3.15] gh-149995: Update typing.py docstrings and documentation (GH-149996) (#150215)
gh-149995: Update typing.py docstrings and documentation (GH-149996)

Some of these docstrings read as if they were written when typing.py was
first written, and things have evolved since then.

A few motivations:
- Call protocols protocols instead of ABCs. They are also ABCs, but the fact
  they are protocols is more relevant to typing.
- Avoid recommending direct use of .__annotations__ and steer users to
  annotationlib instead.
- For TypedDict, mention NotRequired before total=False since it is more
  general and probably more frequently useful.
- For overloads, mention runtime use first instead of stub use. I think early on
  there was talk of allowing overload only in stubs, but it is now heavily used at
  runtime too and that's more likely to be relevant to users.
(cherry picked from commit f159419ae2)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2026-05-22 06:41:43 +00:00
Miss Islington (bot)
072246a780
[3.15] gh-148294: Make configure find g++ correctly (GH-150212)
The `AC_PATH_TOOL` calls had included a duplicated argument, causing a "`PATH`"
consisting of `notfound` to be searched instead of `$PATH`.
(cherry picked from commit c613f72eee)

Co-authored-by: sendaoYan <yansendao@126.com>
2026-05-22 02:18:28 +00:00
Miss Islington (bot)
233cf75d6d
[3.15] gh-149819: fix .pth and .start file processing in subprocess when inheriting PYTHONPATH (GH-150177) (#150202)
gh-149819: fix .pth and .start file processing in subprocess when inheriting PYTHONPATH (GH-150177)

* gh-149819: Fix .pth files not loaded in Python subprocesses

After PR gh-149583 (Fix double evaluation of .pth and .site files in
venvs), .pth files are no longer loaded in subprocesses started with
subprocess.run([sys.executable, ...]).  The root cause: main() seeds
known_paths from removeduppaths() with all sys.path entries inherited
from the parent process.  addsitedir() then skips .pth processing for
every directory already in known_paths.

Fix:
- main(): call removeduppaths() for dedup but start known_paths as a
  fresh empty set, so that addsitedir() processes .pth files in every
  site-packages directory regardless of inherited sys.path.
- addsitedir(): move known_paths.add() before the sys.path.append and
  guard the append with 'sitedir not in sys.path' to avoid creating
  duplicate entries when called with a fresh known_paths.

This preserves the gh-75723 dedup guarantee while allowing subprocesses
to load .pth files.

* Fill out the tests for GH#149888

* Extend _make_start() and _make_pth() to take an optional `basedir` which is used instead of
 `site.tmpdir` if given.
* Add test_pth_processed_when_sitedir_already_on_path() to test the core GH#149819 bug: .pth files
  in subprocesses aren't handled if PYTHONPATH pointing to the .pth directory is inherited.
* Similarly add test_start_processed_when_sitedir_already_on_path() to verify that .start files in
  the same circumstances are also now processed.

* Update Lib/site.py



* Oops!  Remove redundant code

---------
(cherry picked from commit 3c298e2e38)

Co-authored-by: Barry Warsaw <barry@python.org>
Co-authored-by: BugBounty Mind <bugbounty-mind@deepseek.tui>
Co-authored-by: scoder <stefan_ml@behnel.de>
2026-05-21 15:31:41 -07:00
Miss Islington (bot)
e6e3b9f490
[3.15] gh-107398: Fix tarfile stream mode exception when process the file with the gzip extra field (GH-126304) (GH-150199)
(cherry picked from commit 65f99329ed)

Co-authored-by: Nadeshiko Manju <me@manjusaka.me>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-05-21 20:02:10 +00:00
Miss Islington (bot)
9d042ad9ae
[3.15] gh-149219: Test frozendict in Lib/test/test_crossinterp.py (GH-149220) (#150186)
gh-149219: Test `frozendict` in `Lib/test/test_crossinterp.py` (GH-149220)
(cherry picked from commit c35b0f2b62)

Co-authored-by: sobolevn <mail@sobolevn.me>
2026-05-21 15:22:24 +00:00
sobolevn
a56a271000
[3.15] gh-149981: Test lazy import corner cases with module-level __getattr__ (GH-149982) (#150185)
(cherry picked from commit 6dbf4ba403)
2026-05-21 09:53:00 +00:00
Miss Islington (bot)
dea552c1b6
[3.15] Add summary table to the unicodedata doc (GH-149957) (#150161)
(cherry picked from commit 87a879f4d0)

Co-authored-by: Stan Ulbrych <stan@python.org>
2026-05-20 21:10:21 +01:00
Miss Islington (bot)
ca0da94f09
[3.15] gh-134261: ZipFile - Don't rely on local time for reproducible builds & tests (GH-134264) (#150137)
gh-134261: ZipFile - Don't rely on local time for reproducible builds & tests (GH-134264)

---------
(cherry picked from commit 9dcf94e906)

Co-authored-by: Caleb <23644849+ctrlaltf2@users.noreply.github.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Emma Smith <emma@emmatyping.dev>
Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2026-05-20 19:49:13 +00:00
Miss Islington (bot)
fb6984f305
[3.15] gh-143387: Add news blurb for importlib.metadata highlighting the change. (GH-150169) (#150171)
gh-143387: Add news blurb for importlib.metadata highlighting the change. (GH-150169)
(cherry picked from commit cb3b4b98d8)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2026-05-20 19:48:04 +00:00
Miss Islington (bot)
ad2f0cb997
[3.15] PEP 810 - Update some error strings (GH-150126) (#150135) 2026-05-20 15:17:28 +00:00
Miss Islington (bot)
61444f60a1
[3.15] gh-150146: Fix NULL dereference in _Py_subs_parameters (GH-150147) (#150153)
gh-150146: Fix NULL dereference in `_Py_subs_parameters` (GH-150147)
(cherry picked from commit f621ba16b7)

Co-authored-by: sobolevn <mail@sobolevn.me>
2026-05-20 13:55:30 +00:00
Miss Islington (bot)
9c2620964e
[3.15] gh-150034: Print JSONL filename when profiling finishes (GH-150035) (#150151) 2026-05-20 12:00:49 +00:00
Miss Islington (bot)
034c536d56
[3.15] gh-149584: Fix excessive overhead in the Tachyon profiler regarding the cache behavior (GH-149649) (#150152) 2026-05-20 11:59:10 +00:00
Miss Islington (bot)
7f29fa5032
[3.15] gh-149807: Fix hash(frozendict): compute (key, value) pair hash (GH-149841) (#150149)
gh-149807: Fix hash(frozendict): compute (key, value) pair hash (GH-149841)
(cherry picked from commit 244300162d)

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-05-20 11:51:54 +00:00
Miss Islington (bot)
c555e26061
[3.15] gh-148260: Use at least 1 MiB stack size on musl (GH-149993) (#150150)
gh-148260: Use at least 1 MiB stack size on musl (GH-149993)

On Linux when Python is linked to the musl C library, use a thread
stack size of at least 1 MiB instead of musl default which is 128
kiB.
(cherry picked from commit df6c157e51)

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-05-20 11:48:24 +00:00
Miss Islington (bot)
653f12b2bf
[3.15] gh-143387: Update docs to reflect the behavior and note the changed version. (GH-150095) (#150106)
gh-143387: Update docs to reflect the behavior and note the changed version. (GH-150095)
(cherry picked from commit 192796cfd4)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2026-05-19 18:03:47 -07:00
Miss Islington (bot)
eb7be9ab52
[3.15] gh-72088: clarify inspect.ismethod and inspect.isfunction (and related) usage with class-level access (GH-150013) (GH-150119)
(cherry picked from commit 0aa59ce2d4)

Co-authored-by: Stefanie Molin <24376333+stefmolin@users.noreply.github.com>
Co-authored-by: CHINMAY <89741289+Das-Chinmay@users.noreply.github.com>
2026-05-20 03:00:54 +02:00
Miss Islington (bot)
4baf3e5b0d
[3.15] gh-134887: Add references to locale module for locale-aware number formatting references in string module docs (GH-134888) (GH-150120)
(cherry picked from commit 47723af4e7)

Co-authored-by: Stefanie Molin <24376333+stefmolin@users.noreply.github.com>
2026-05-20 02:54:59 +02:00
Miss Islington (bot)
d6dda0d23c
[3.15] gh-150042: queue.SimpleQueue.put: fix minor refleak. (GH-150043) (GH-150127)
If queue.SimpleQueue.put can't handoff the item to a
waiting thread, and fails to allocate memory when adding
the item to a ringbuf, it would leak a reference.  Fixed.
(cherry picked from commit 79088e0d82)

Co-authored-by: larryhastings <larry@hastings.org>
2026-05-20 02:46:42 +02:00
Miss Islington (bot)
de401ef6a5
[3.15] gh-150114: Reduce memory usage of test_free_threading.test_iteration (gh-150115) (#150124)
Reduce NUMITEMS from 100000 to 5000. Peak RSS for the full
test_free_threading suite drops from ~850 MB to ~175 MB.

(cherry picked from commit 61f12211fc)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2026-05-19 22:05:19 +00:00
Dino Viehland
6847f4bc60
[3.15] gh-150052: Resolve un-loaded lazily loaded submodules via module.__getattr__ instead of publishing lazy values (#150055) 2026-05-19 21:23:30 +00:00
Miss Islington (bot)
f46b397975
[3.15] gh-149983: Fix PyErr_NoMemory call without GIL in winconsoleio.c (GH-149984) (GH-150113)
(cherry picked from commit 3d2aa899ba)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
2026-05-19 23:11:13 +02:00
Miss Islington (bot)
021381759f
[3.15] gh-124111: Keep tests passing for Tcl prior to 9.0 (GH-150102)
Also disables the UWP build in CI, since it was breaking (and is no longer released).
(cherry picked from commit ec9ce3ee98)

Co-authored-by: Steve Dower <steve.dower@python.org>
2026-05-19 21:57:21 +01:00
Miss Islington (bot)
3227857de8
[3.15] gh-149945: Fix potential OOM for gzip with large header (GH-149979) (GH-150093)
Do not read the whole filename and comment to memory for calculating the CRC.
(cherry picked from commit 51a5715df9)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-05-19 20:38:47 +00:00
Miss Islington (bot)
bec4336bad
[3.15] gh-69619: Clarify whitespace definition in str.strip docs (#150049)
(cherry picked from commit 17eb17d43f)

Co-authored-by: Daniil <d.mayorov@innopolis.university>
2026-05-19 18:48:48 +01:00
Miss Islington (bot)
65b255416a
[3.15] gh-146581: Update docs for dangerous filenames in ZIP files (GH-149994) (GH-150064)
gh-146581: Update docs for dangerous filenames in ZIP files (GH-149994)
(cherry picked from commit ba0aca3bff)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Sebastian Gassner <sebastian.gassner@gmail.com>
2026-05-19 08:44:35 +00:00
Miss Islington (bot)
28f275f713
[3.15] gh-86533: Restore os.makedirs() ability to apply *mode* recursively (GH-150011) (#150036)
bpo-42367: Restore os.makedirs() and pathlib.mkdir() ability to apply *mode* recursively via a new parent_mode= keyword argument.
(cherry picked from commit 9770e32ce0)

+ Make Path.mkdir parent_mode tests umask-independent

test_mkdir_with_parent_mode, test_mkdir_parent_mode_deep_hierarchy and
test_mkdir_parent_mode_same_as_mode assert exact directory mode bits but
did not pin the process umask.  On buildbots running with a restrictive
umask (e.g. 0o077) the 0o755 leaf was masked down to 0o700, failing the
assertions.  Wrap them in os_helper.temp_umask(0o022), matching the
other umask-aware mkdir tests in this file.

---------

Co-authored-by: nessita <124304+nessita@users.noreply.github.com>
Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Co-authored-by: Erlend E. Aasland <erlend@python.org>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2026-05-18 22:10:01 -07:00
Miss Islington (bot)
d36e08099d
[3.15] gh-149816: fix dict.clear() race on split-table dict with non-embedded values (GH-149914) (#150000)
gh-149816: fix `dict.clear()` race on split-table dict with non-embedded values (GH-149914)
(cherry picked from commit 1692854706)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2026-05-19 10:12:25 +05:30
Miss Islington (bot)
0b92f01c59
[3.15] gh-149816: fix thread safety of deletion of list slice (GH-149936) (#150003)
gh-149816: fix thread safety of deletion of list slice (GH-149936)
(cherry picked from commit 00ea77613b)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2026-05-19 10:11:43 +05:30
Dino Viehland
94c8bac2cd
[3.15] gh-148587: Make sys.lazy_modules match PEP and keep internal lazy submodules tra… (#150014)
Make sys.lazy_modules match PEP and keep internal lazy submodules tracking internal
2026-05-18 17:53:54 -07:00
Miss Islington (bot)
66ade2861f
[3.15] gh-146452: Improve locking granularity in pickle's batch_dict_exact and fix race condition (GH-150025) (#150039)
gh-146452: Improve locking granularity in pickle's batch_dict_exact and fix race condition (GH-150025)

Remove assertion that could fail in rare race condition.

Replace the coarse critical section wrapping the entire function with
fine-grained sections covering only PyDict_Next + Py_INCREF.
Also handle PyDict_Next returning 0 in the single-item fast path.
(cherry picked from commit 57a0e570d3)

Co-authored-by: Saul Cooperman <58375603+scopreon@users.noreply.github.com>
2026-05-18 23:53:57 +00:00
Miss Islington (bot)
c417fcabfd
[3.15] gh-149590: Remove faulthandler_traverse (GH-150023) (#150037)
gh-149590: Remove faulthandler_traverse (GH-150023)

`faulthandler_traverse` visits Python objects owned by `_PyRuntime`, not
by the module instance. With multi-phase init allowing multiple module
instances, each instance's GC traversal decrements `gc_refs` on the same
runtime-owned objects, driving it negative when two instances are
collected simultaneously.
(cherry picked from commit 56737483c2)

Co-authored-by: Armaan Vakharia <43391096+armaan-v924@users.noreply.github.com>
2026-05-18 23:28:04 +00:00
Miss Islington (bot)
16f8ed5a82
[3.15] gh-95816: Fix TLS version range example in docs (GH-148574) (#150008)
gh-95816: Fix TLS version range example in docs (GH-148574)

docs(ssl): Fix TLS version range example
(cherry picked from commit dbd8985e82)

Co-authored-by: Jan Brasna <1784648+janbrasna@users.noreply.github.com>
2026-05-18 14:47:19 -07:00
Miss Islington (bot)
84ea87cde0
[3.15] gh-149977: Fix extra output of -m test test_lazy_import (GH-149978) (#150016)
gh-149977: Fix extra output of `-m test test_lazy_import` (GH-149978)
(cherry picked from commit 6d5be4b1d6)

Co-authored-by: sobolevn <mail@sobolevn.me>
2026-05-18 19:24:06 +00:00
Miss Islington (bot)
01b07df858
[3.15] gh-149816: Fix a RC in _random.Random.__init__ method (GH-149824) (#149997)
gh-149816: Fix a RC in `_random.Random.__init__` method (GH-149824)
(cherry picked from commit 14af19e6c0)

Co-authored-by: sobolevn <mail@sobolevn.me>
2026-05-18 16:16:55 +00:00
Miss Islington (bot)
34e4005c35
[3.15] gh-149887: Install python3t.lib for GIL-enabled Windows install (GH-149900)
gh-149887: Install python3t.lib for GIL-enabled Windows install (GH-149900)
(cherry picked from commit bd6bf91fcb)

Co-authored-by: Nathan Goldbaum <nathan.goldbaum@gmail.com>
2026-05-18 13:52:17 +00:00
Miss Islington (bot)
6e83c55e64
[3.15] gh-149953: Fix null pointer dereference order in code_objects.c (GH-149956) (#149976)
gh-149953: Fix null pointer dereference order in `code_objects.c` (GH-149956)

Move  check before
(cherry picked from commit 0ed497a350)

Co-authored-by: Nezuko Agent <nezukoagent@gmail.com>
2026-05-18 09:00:19 +00:00
Miss Islington (bot)
42ff9b4959
[3.15] gh-149921: Fix reference leaks in _interpchannels and _interpqueues modules (GH-149922) (#149943)
gh-149921: Fix reference leaks in _interpchannels and _interpqueues modules (GH-149922)
(cherry picked from commit acefff95ea)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
2026-05-17 11:01:15 +00:00
Miss Islington (bot)
bdc44c55a2
[3.15] gh-149916: Restore the commented out part of test_body_encode in test_email (GH-149917) (GH-149937)
(cherry picked from commit 1cbe035723)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-05-17 08:33:11 +00:00
Miss Islington (bot)
ec3aa6ab48
[3.15] gh-149816: Fix a race condition in _PyBytes_FromList with free-threading (GH-149909) (#149911)
gh-149816: Fix a race condition in `_PyBytes_FromList` with free-threading (GH-149909)
(cherry picked from commit 46afba7b93)

Co-authored-by: sobolevn <mail@sobolevn.me>
2026-05-16 09:06:14 +00:00
Miss Islington (bot)
6136ad6801
[3.15] gh-142349: Add help("lazy") support (GH-149886) (#149889)
gh-142349: Add `help("lazy")` support (GH-149886)
(cherry picked from commit 8be3fb1b50)

Co-authored-by: sobolevn <mail@sobolevn.me>
2026-05-15 16:57:59 +00:00