Commit graph

31301 commits

Author SHA1 Message Date
Miss Islington (bot)
d7fe4e99a2
[3.14] gh-140301: Fix memory leak in subinterpreter PyConfig cleanup (GH-140303) (#140360)
gh-140301: Fix memory leak in subinterpreter `PyConfig` cleanup (GH-140303)
(cherry picked from commit a615fb49c9)

Co-authored-by: Shamil <ashm.tech@proton.me>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-10-20 09:54:41 +00:00
Miss Islington (bot)
6cee144d3a
[3.14] gh-140306: Fix memory leaks in cross-interpreter data handling (GH-140307) (GH-140338)
(cherry picked from commit f9323213c9)

Co-authored-by: Shamil <ashm.tech@proton.me>
2025-10-19 19:53:36 +00:00
Miss Islington (bot)
9ff705c6c5
[3.14] gh-63161: Fix PEP 263 support (GH-139481) (GH-139898)
* Support non-UTF-8 shebang and comments if non-UTF-8 encoding is specified.
* Detect decoding error in comments for UTF-8 encoding.
* Include the decoding error position for default encoding in SyntaxError.
(cherry picked from commit 5c942f11cd)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-19 19:16:33 +00:00
Kumar Aditya
1d11627ba5
[3.14] gh-140067: Fix memory leak in sub-interpreter creation (GH-140111) (#140118)
* [3.14] gh-140067: Fix memory leak in sub-interpreter creation  (GH-140111)

Fix memory leak in sub-interpreter creation caused by overwriting of the previously used `_malloced` field. Now the pointer is stored in the first word of the memory block to avoid it being overwritten accidentally.
(cherry picked from commit 59547a251f)

Co-authored-by: Shamil <ashm.tech@proton.me>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-10-18 19:40:43 +05:30
Miss Islington (bot)
3ca7ea1f8f
[3.14] gh-140257: fix data race on eval_breaker during finalization (GH-140265) (#140294)
gh-140257: fix data race on eval_breaker during finalization (GH-140265)
(cherry picked from commit c8729c9909)

Co-authored-by: Shamil <ashm.tech@proton.me>
2025-10-18 11:28:53 +00:00
Miss Islington (bot)
b2d3957511
[3.14] Move the NEWS entry for gh-140272 to the correct place (GH-140290) (GH-140291)
(cherry picked from commit 936de256a9)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-18 11:00:28 +00:00
Miss Islington (bot)
128f48fd2d
[3.14] gh-140272: Fix memory leak in _gdbm.gdbm.clear() (GH-140274) (GH-140285)
(cherry picked from commit f937468e7c)

Co-authored-by: Shamil <ashm.tech@proton.me>
2025-10-18 13:17:42 +03:00
Miss Islington (bot)
f59236b746
[3.14] GH-133789: Fix unpickling of pathlib objects pickled in Python 3.13 (GH-133831) (#140276)
GH-133789: Fix unpickling of pathlib objects pickled in Python 3.13 (GH-133831)

In Python 3.13 (but not 3.12 or 3.14), pathlib classes are defined in
`pathlib._local` rather than `pathlib`. In hindsight this was a mistake,
but it was difficult to predict how the abstract/local split would pan out.

In this patch we re-introduce `pathlib._local` as a stub module that
re-exports the classes from `pathlib`. This allows path objects pickled in
3.13 to be unpicked in 3.14+
(cherry picked from commit f4e51f253a)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
2025-10-17 22:23:01 +00:00
Miss Islington (bot)
5513f6a99d
[3.14] gh-131788: make resource_tracker re-entrant safe (GH-131787) (#137737)
gh-131788: make resource_tracker re-entrant safe (GH-131787)

* make resource_tracker re-entrant safe
* Update Lib/multiprocessing/resource_tracker.py
* trim trailing whitespace
* use f-string and args = [x, *y, z]
* raise self._reentrant_call_error

---------
(cherry picked from commit f24a012350)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
2025-10-16 21:25:14 -07:00
Miss Islington (bot)
32e60fa220
[3.14] gh-140120: Refresh HACL* to fix an hmac memory leak (GH-140188) (#140192)
gh-140120: Refresh HACL* to fix an hmac memory leak (GH-140188)

This pulls an updated version of HACL* that fixes the memory leak reported in GH-140120, via an upstream fix.
(cherry picked from commit 3a81313019)

Co-authored-by: Jonathan Protzenko <jonathan.protzenko+github@gmail.com>
2025-10-16 20:53:12 -07:00
Miss Islington (bot)
54261b6782
[3.14] gh-138859: Account for ParamSpec defaults that are not lists … (GH-138868) (#140207)
gh-138859: Account for `ParamSpec` defaults that are not lists … (GH-138868)
(cherry picked from commit 379fd020a0)

Co-authored-by: bzoracler <50305397+bzoracler@users.noreply.github.com>
2025-10-16 13:26:29 -07:00
Miss Islington (bot)
504bf76dd2
[3.14] gh-140041: Fix import of ctypes on Android and Cygwin when ABI flags are present (GH-140178) (#140180)
Use sysconfig to determine the full name of libpython, rather than hardcoding
a library name that doesn't have ABI flags.
(cherry picked from commit 7f371ed84b)

Co-authored-by: Malcolm Smith <smith@chaquo.com>
2025-10-15 22:08:35 +00:00
Miss Islington (bot)
95c03d018d
[3.14] gh-140153: Fix Py_REFCNT() definition on limited C API 3.11-3.13 (GH-140158) (#140164)
gh-140153: Fix Py_REFCNT() definition on limited C API 3.11-3.13 (GH-140158)
(cherry picked from commit 728d239e57)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-10-15 15:02:03 +00:00
Miss Islington (bot)
045e34964a
[3.14] gh-140061: Use _PyObject_IsUniquelyReferenced() to check if objects are uniquely referenced (gh-140062) (gh-140157)
The previous `Py_REFCNT(x) == 1` checks can have data races in the free
threaded build. `_PyObject_IsUniquelyReferenced(x)` is a more conservative
check that is safe in the free threaded build and is identical to
`Py_REFCNT(x) == 1` in the default GIL-enabled build.
(cherry picked from commit 32c264982e)

Co-authored-by: Sergey Miryanov <sergey.miryanov@gmail.com>
2025-10-15 14:49:17 +00:00
Miss Islington (bot)
9e235ffb21
[3.14] gh-138993: Dedent credits text (GH-138994) (#140088)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-10-15 14:05:47 +03:00
Miss Islington (bot)
af28efd8b4
[3.14] gh-139640: Fix swallowing syntax warnings in different modules (GH-139755) (GH-140117)
Revert GH-131993.

Fix swallowing some syntax warnings in different modules if they accidentally
have the same message and are emitted from the same line.

Fix duplicated warnings in the "finally" block.

(cherry picked from commit 279db6bede)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>

* Update 2025-10-06-10-03-37.gh-issue-139640.gY5oTb.rst

---------

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-14 15:56:01 +00:00
Miss Islington (bot)
99e42ab49c
[3.14] gh-101828: Fix jisx0213 codecs removing null characters (gh-139340) (gh-140110)
gh-101828: Fix `jisx0213` codecs removing null characters (gh-139340)
(cherry picked from commit 87eadce3e0)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-10-14 14:36:05 +00:00
Sergey B Kirpichev
1c55b9163b
[3.14] gh-102431: Clarify constraints on operands of Decimal logical operations (GH-102836) (#140105)
* [3.14] gh-102431: Clarify constraints on operands of Decimal logical operations (GH-102836)

Sync C/Python implementation of the decimal: logical_ops for contexts.
(cherry picked from commit 6ecf77dbde)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2025-10-14 15:44:30 +02:00
Miss Islington (bot)
45577c93de
[3.14] gh-70765: Remove unnecessary extra backtick from Changelog entry (GH-140071) (#140102)
gh-70765: Remove unnecessary extra backtick from Changelog entry (GH-140071)
(cherry picked from commit f70082b477)

Co-authored-by: Rafael Fontenelle <rffontenelle@users.noreply.github.com>
2025-10-14 11:15:36 +00:00
Miss Islington (bot)
7a13953bc3
[3.14] gh-140000: Traverse name attribute for TypeVar, TypeVarTuple, TypeAliasType, ParamSpec (GH-140016) (#140063)
gh-140000: Traverse `name` attribute for `TypeVar`, `TypeVarTuple`, `TypeAliasType`, `ParamSpec` (GH-140016)
(cherry picked from commit be60e4b4f3)

Co-authored-by: Mikhail Efimov <efimov.mikhail@gmail.com>
2025-10-13 20:36:24 +00:00
Miss Islington (bot)
c5edf7d6f4
gh-139810: Always generate -dev tags for PyManager packages (GH-139814)
(cherry picked from commit c46265d94a)

Co-authored-by: Steve Dower <steve.dower@python.org>
2025-10-13 20:08:42 +00:00
Kumar Aditya
511078099a
[3.14] gh-125996: fix thread safety of collections.OrderedDict (GH-133734) (#140053)
(cherry picked from commit 6481539a6d)
2025-10-13 23:25:24 +05:30
Miss Islington (bot)
07eb67b859
[3.14] gh-127081: add critical sections to dbm objects (gh-132749) (#139996)
gh-127081: add critical sections to `dbm` objects (gh-132749)
(cherry picked from commit ffaeb3dddf)

Co-authored-by: Duane Griffin <duaneg@dghda.com>
2025-10-12 17:56:29 +05:30
Miss Islington (bot)
3b9694a8e6
[3.14] gh-139988: fix a leak when failing to create a Union type (GH-139990) (#139993)
gh-139988: fix a leak when failing to create a Union type (GH-139990)
(cherry picked from commit 6710156bd2)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-10-12 11:16:43 +00:00
Miss Islington (bot)
46148d18a2
[3.14] gh-139905: Provide suggestion in error message if Generic.__init_subclass__ was not called (GH-139943) (#139955)
gh-139905: Provide suggestion in error message if `Generic.__init_subclass__` was not called (GH-139943)
(cherry picked from commit 5776d0d2e0)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-10-11 15:40:23 +00:00
Miss Islington (bot)
1a355d7366
[3.14] gh-96491: Deduplicate version in IDLE shell title (GH-139841) (#139931)
gh-96491: Deduplicate version in IDLE shell title (GH-139841)

Saving to a file added both the filename and repeated the version.
---------
(cherry picked from commit d4e5802588)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2025-10-11 02:02:34 +00:00
Miss Islington (bot)
2660e98b30
[3.14] gh-139001: Fix thread-safety issue in pathlib.Path (gh-139066) (gh-139926)
Don't cache the joined path in `_raw_path` because the caching isn't thread safe.
(cherry picked from commit d9b4eef71e)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2025-10-10 21:47:47 +00:00
Kumar Aditya
72f25a8d9a
[3.14] gh-139894: fix incorrect sharing of current task while forking in asyncio (GH-139897) (#139913)
* [3.14] gh-139894: fix incorrect sharing of current task while forking in `asyncio`  (GH-139897)

Fix incorrect sharing of current task with the forked child process by clearing thread state's current task and current loop in `PyOS_AfterFork_Child`.
(cherry picked from commit b881df47ff)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>

* Update Lib/test/test_asyncio/test_unix_events.py
2025-10-10 22:36:02 +05:30
Miss Islington (bot)
51b1043029
[3.14] gh-138860: Lazy import rlcompleter in pdb to avoid deadlock in subprocess (GH-139185) (GH-139305) (GH-139280)
* gh-138860: Lazy import rlcompleter in pdb to avoid deadlock in subprocess (GH-139185)
(cherry picked from commit c8624cd367)

* gh-139289: Lazy import rlcompleter to fix the refleak (GH-139305)
(cherry picked from commit 8288f3693f)

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
2025-10-10 16:23:52 +02:00
Miss Islington (bot)
ade6dea24b
[3.14] gh-139065: Fix trailing space before long word in textwrap (GH-139070) (GH-139902)
Fix trailing space before a wrapped long word if the line length with
a space is exactly "width".
(cherry picked from commit 1c598e0436)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-10 13:54:46 +00:00
Miss Islington (bot)
08738ce521
[3.14] gh-139783: Fix inspect.getsourcelines() for the case when a decorator is followed by a comment or an empty line (GH-139836) (GH-139889)
(cherry picked from commit f4104f5d74)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-10 08:18:32 +00:00
Miss Islington (bot)
af1cb1cdb8
[3.14] GH-139809: Fix argparse subcommand prog not respecting color environment variables (GH-139818) (#139866)
GH-139809: Fix argparse subcommand prog not respecting color environment variables (GH-139818)
(cherry picked from commit 9fc4366f09)

Co-authored-by: Savannah Ostrowski <savannah@python.org>
2025-10-09 17:19:54 +00:00
Miss Islington (bot)
925625447f
[3.14] gh-139845: do not print twice in default asyncio REPL (GH-139846) (#139859)
gh-139845: do not print twice in default asyncio REPL (GH-139846)
(cherry picked from commit a310b3a99d)

Co-authored-by: yihong <zouzou0208@gmail.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-10-09 16:13:11 +00:00
Miss Islington (bot)
8761d6e644
[3.14] gh-139391: properly handle signal.signal() in UnixConsole when called from a non-main thread (GH-139392) (#139858)
gh-139391: properly handle `signal.signal()` in `UnixConsole` when called from a non-main thread (GH-139392)
(cherry picked from commit b8c8b8f1d3)

Co-authored-by: yihong <zouzou0208@gmail.com>
2025-10-09 16:10:51 +00:00
Łukasz Langa
de87549eb8
[3.14] gh-133400: Fixed Ctrl+D (^D) behavior in :mod:_pyrepl module (GH-133883) (GH-139850)
(cherry picked from commit 81959a0364)

Co-authored-by: DeepWzh <wzh2012@outlook.com>
Co-authored-by: adam j hartz <adam@smatz.net>
2025-10-09 17:38:25 +02:00
Kumar Aditya
926d734840
[3.14] gh-116738: make mmap module thread-safe (GH-139237) (#139825)
* [3.14] gh-116738: make `mmap` module thread-safe (GH-139237)
(cherry picked from commit 7f155f9c46)

Co-authored-by: Alper <alperyoney@fb.com>
2025-10-09 20:19:03 +05:30
Miss Islington (bot)
342b644bd2
[3.14] gh-139742: Add support for Python 3.14 t-string prefixes in IDLE colorizer and tests (GH-139756) (#139831)
gh-139742: Add support for Python 3.14 t-string prefixes in IDLE colorizer and tests (GH-139756)

Add 't' prefix to colorizer.py stringprefix regex to support Python 3.14 template strings.
Add t prefixes to test_colorizer.py source test text and adjust line numbers on test methods.
---------
(cherry picked from commit 6fd1418341)

Co-authored-by: Anuradha Agrawal <paysur2111@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-10-09 09:51:58 +00:00
Kumar Aditya
90cd009209
[3.14] gh-139748: fix leaks in AC error paths when using unicode FS-b… (#139789)
* [3.14] gh-139748: fix leaks in AC error paths when using unicode FS-based converters (GH-139765)
(cherry picked from commit b04a57deef)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-10-08 22:16:21 +05:30
Miss Islington (bot)
14c923cc85
[3.14] gh-139736: Fix argparse indentation overshoot (GH-139738) (#139793)
gh-139736: Fix argparse indentation overshoot (GH-139738)
(cherry picked from commit 72e370c910)

Co-authored-by: ed <s@ocv.me>
Co-authored-by: Savannah Ostrowski <savannahostrowski@gmail.com>
2025-10-08 16:02:08 +00:00
Miss Islington (bot)
b5230d73a9
[3.14] gh-83424: Allow empty name if handle is non-null when create ctypes.CDLL on Windows (GH-136878) (#138546)
gh-83424: Allow empty name if handle is non-null when create ctypes.CDLL on Windows (GH-136878)
(cherry picked from commit ed522ed211)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-10-08 15:56:13 +02:00
Miss Islington (bot)
7e23d36770
[3.14] gh-137317: Fix inspect.signature() for class with wrapped __init__ or __new__ (GH-137862) (#138224)
gh-137317: Fix inspect.signature() for class with wrapped __init__ or __new__ (GH-137862)

Fixed several cases where __init__, __new__ or metaclass` __call__ is a descriptor
that returns a wrapped function.
(cherry picked from commit 025a2135ef)

Co-authored-by: Ju4tCode <42488585+yanyongyu@users.noreply.github.com>
2025-10-08 15:48:06 +02:00
Miss Islington (bot)
5579708b1c
[3.14] gh-60462: Fix locale.strxfrm() on Solaris (GH-138242) (GH-138448)
It should interpret the result of wcsxfrm() as a sequence of abstract
integers, not a sequence of Unicode code points or using other encoding
scheme that does not preserve ordering.
(cherry picked from commit 482fd0c811)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-08 14:34:51 +02:00
Miss Islington (bot)
4e8f5e65eb
[3.14] gh-137490: Fix signal.sigwaitinfo() on NetBSD (GH-137523) (GH-138935)
Handle ECANCELED in the same way as EINTR to work around the Posix
violation in the NetBSD's implementation.
(cherry picked from commit 07d0b95b05)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-08 14:33:30 +02:00
Miss Islington (bot)
333cab0da7
[3.14] gh-137754: Fix import of zoneinfo if _datetime is not available (GH-137845) (GH-138084)
Both modules should use the Python implementation in that case.
(cherry picked from commit 6620ef0ff6)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-08 14:28:41 +02:00
Miss Islington (bot)
d424344ce9
[3.14] bpo-41839: Fix error checking in sched_get_priority_ functions (GH-22374) (GH-138201)
(cherry picked from commit bbcb75c986)

Co-authored-by: Jakub Kulík <Kulikjak@gmail.com>
2025-10-08 14:26:59 +02:00
Miss Islington (bot)
669253fde5
[3.14] gh-138204: Forbid expansion of a shared anonymous mmap on Linux (GH-138220) (GH-138386)
This is a Linux kernel bug which caused a bus error.
https://bugzilla.kernel.org/show_bug.cgi?id=8691
(cherry picked from commit 33fcb0c4a0)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-08 14:26:09 +02:00
Miss Islington (bot)
8da7c7e1f3
[3.14] gh-88375, gh-111788: Fix parsing errors and normalization in robotparser (GH-138502) (GH-138548)
* Don't fail trying to parse weird patterns.
* Don't fail trying to decode non-UTF-8 "robots.txt" files.
* No longer ignore trailing "?" in patterns and URLs.
* Distinguish raw special characters "?", "=" and "&" from the
  percent-encoded ones.
* Remove tests that do nothing.
(cherry picked from commit cb7ef18d70)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-08 14:22:44 +02:00
Miss Islington (bot)
3013683e99
[3.14] gh-118981: multiprocessing.popen_spawn_posix, fix potential hang (gh-118982) (GH-138605)
fix potential hang.

It can happen that the child crashes right in the beginning for whatever reason. In this case, the parent will hang when writing into the pipe, because the child fd is not closed yet.

The normal pattern is to close the child fds right after the child proc is forked/executed/spawned, so when the child dies, then also the pipes will be closed, and there will be no hang (the parent gets SIGPIPE instead).
(cherry picked from commit 8ed5a2b56c)

Co-authored-by: Albert Zeyer <albzey@gmail.com>
2025-10-08 14:22:05 +02:00
Miss Islington (bot)
32233d68d8
[3.14] gh-70765: avoid waiting for HTTP headers when parsing HTTP/0.9 requests (GH-139514) (#139600)
(cherry picked from commit 13dc2fde8c)
(cherry picked from commit 1fe89d324e)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-10-08 10:39:59 +00:00
Bénédikt Tran
8ad6eda483
[3.14] gh-136912: fix handling of OverflowError in hmac.digest (GH-136917) (#137116)
The OpenSSL and HACL* implementations of HMAC single-shot
digest computation reject keys whose length exceeds `INT_MAX`
and `UINT32_MAX` respectively. The OpenSSL implementation
also rejects messages whose length exceed `INT_MAX`.

Using such keys in `hmac.digest` previously raised an `OverflowError`
which was propagated to the caller. This commit mitigates this case by
making `hmac.digest` fall back to HMAC's pure Python implementation
which accepts arbitrary large keys or messages.

This change only affects the top-level entrypoint `hmac.digest`, leaving
`_hashopenssl.hmac_digest` and `_hmac.compute_digest` untouched.

(cherry picked from commit d658b9053b)
2025-10-08 12:09:45 +02:00