Commit graph

34125 commits

Author SHA1 Message Date
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)
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)
e07b78c01a
[3.14] gh-116738: test uuid module thread safety in free-threading (GH-140068) (#140229)
gh-116738: test `uuid` module thread safety in free-threading (GH-140068)
(cherry picked from commit 9a87ce8b57)

Co-authored-by: Alper <alperyoney@fb.com>
2025-10-17 20:59:15 +05:30
Miss Islington (bot)
889e9184bf
[3.14] gh-135801: Add tests for filtering warnings by module (GH-140240) (GH-140246)
(cherry picked from commit fbf0843e39)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-17 11:48:03 +00: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)
e69fb2008e
[3.14] gh-140170: Fix test_site with -s flag (GH-140179) (#140198)
gh-140170: Fix test_site with -s flag (GH-140179)

Commit
(cherry picked from commit 7ac94fcb1d)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-10-16 12:31:59 +02:00
yihong
5caf64335c
[3.14] gh-140080: Add test for executing atexit callbacks under no memory (GH-140161) 2025-10-15 11:25:06 -04: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
Miss Islington (bot)
11ac373d7c
[3.14] GH-139979: Add @force_not_colorized_test_class to TestOptionalHelpVersionActions (GH-139980) (#140005)
GH-139979: Add @force_not_colorized_test_class to TestOptionalHelpVersionActions (GH-139980)
(cherry picked from commit 0fc5c56815)

Co-authored-by: Savannah Ostrowski <savannah@python.org>
2025-10-12 17:16:21 +00:00
Miss Islington (bot)
6d6d02a982
[3.14] gh-116738: test dbm.gnu module on FT Python build (GH-138467) (#139987)
gh-116738: test `dbm.gnu` module on FT Python build (GH-138467)
(cherry picked from commit a18843dbfb)

Co-authored-by: Alper <alperyoney@fb.com>
2025-10-12 12:51:42 +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)
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)
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)
17873b9b9c
[3.14] gh-139743: Avoid import-time print in test_sqlite3 (GH-139746) (GH-139828)
(cherry picked from commit 65089406a5)

Co-authored-by: Peter <peter86225@gmail.com>
2025-10-09 08:25:38 +00:00
Miss Islington (bot)
56072f9c05
[3.14] gh-139805: Bump test_repl_eio timeout for slow builtbots (GH-139807) (#139812)
gh-139805: Bump `test_repl_eio` timeout for slow builtbots (GH-139807)
(cherry picked from commit e7e3d1d4a8)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-10-08 23:00:20 +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
Dino Viehland
81dc8b12f0
[3.14] gh-139525: Don't specialize functions which have a modified vectorcall (GH-139524) (#139709)
Don't specialize functions which have a modified vectorcall
2025-10-08 09:13:34 -07:00
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)
a96cde9f80
[3.14] gh-133210: Fix test_pydoc without docstrings (GH-139654) (#139777)
gh-133210: Fix `test_pydoc` without docstrings (GH-139654)
(cherry picked from commit 708de26e31)

Co-authored-by: Mikhail Efimov <efimov.mikhail@gmail.com>
2025-10-08 14:15:52 +00:00
Miss Islington (bot)
d8bdc1e6f7
[3.14] gh-133210: Fix test_inspect without docstrings (GH-139651) (#139776)
gh-133210: Fix `test_inspect` without docstrings (GH-139651)
(cherry picked from commit 7c70cc5c23)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-10-08 14:14:19 +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)
d729fcf6e3
[3.14] gh-137589: Zipfile tests: close file objects (GH-138080) (#139766)
gh-137589: Zipfile tests: close file objects (GH-138080)

Zipfile tests: close file objects
(cherry picked from commit 5cea843594)

Co-authored-by: Rogdham <3994389+Rogdham@users.noreply.github.com>
2025-10-08 15:52:08 +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)
fb223e691e
[3.14] GH-137573: Add test to check that the margin used for overflow protection is larger than the stack space used by the interpreter (GH-137724) (GH-139295)
(cherry picked from commit 16eae6d90d)

Co-authored-by: Mark Shannon <mark@hotpy.org>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-10-08 14:44:16 +02:00
Miss Islington (bot)
7ed5419604
[3.14] gh-137463: Update validate_abstract_methods in test_collections.py (GH-137464) (GH-137503)
Update `validate_abstract_methods` in `test_collections.py`

The test for missing abstract methods in `validate_abstract_methods` incorrectly attempted to instantiate the generated class `C` with an argument (`C(name)`), which always raises a `TypeError: C() takes no arguments`. Although the test originally passes, it passes for the wrong reason.

This change makes the test correctly validate the enforcement of abstract methods in ABCs.
(cherry picked from commit 5be872350d)

Co-authored-by: Guilherme Leobas <guilhermeleobas@gmail.com>
2025-10-08 14:30:54 +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)
ebbce6b0f9
[3.14] gh-71679: Improve tests for repr() of bytes and bytearray (GH-138180) (GH-138182)
* Merge existing tests test_repr_str and test_to_str.
* Add more tests for non-printable and non-ASCII bytes.
* Add tests for special escape sequences ('\t\n\r').
* Add tests for slashes.
* Add more tests for quotes.
* Add tests for subclasses.
* Add test for non-ASCII class name.
* Only apply @check_bytes_warnings for str() tests.
(cherry picked from commit 0dbbf61cc2)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-08 14:27:28 +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)
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
Miss Islington (bot)
c625839237
[3.14] gh-91214: Skip tests failing on Solaris (GH-31978) (GH-138450)
(cherry picked from commit 34ed03875a)

Co-authored-by: Jakub Kulík <Kulikjak@gmail.com>
2025-10-08 11:42:42 +03:00
Miss Islington (bot)
8ab7081015
[3.14] gh-135386: Fix "unable to open database file" errors on readonly DB (GH-135566) (GH-138056)
Add immutable=1 flag for read-only SQLite access to avoid WAL/SHM errors on readonly DB.
(cherry picked from commit c0ae92b7c0)

Co-authored-by: General_K1ng <generak1ng0@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-10-08 11:41:09 +03:00
Miss Islington (bot)
51dfc67092
[3.14] gh-138010: Fix __init_subclass__ forwarding by warnings.deprecated (GH-138210) (#138561)
gh-138010: Fix `__init_subclass__` forwarding by `warnings.deprecated` (GH-138210)
(cherry picked from commit e2c038f5be)

Co-authored-by: Brian Schubert <brianm.schubert@g
2025-10-07 21:29:28 -07:00
Miss Islington (bot)
e104aadcaf
[3.14] gh-127647: Fix and enable I/O protocol tests (GH-138369) (#138376)
gh-127647: Fix and enable I/O protocol tests (GH-138369)
(cherry picked from commit 3f23888fd7)

Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
2025-10-07 21:29:02 -07:00
Miss Islington (bot)
dd5d86c7d5
[3.14] gh-137706: make typing._is_unpacked_typevartuple check for True instead of truthy (GH-137712) (#138574)
gh-137706: make typing._is_unpacked_typevartuple check for `True` instead of truthy (GH-137712)
(cherry picked from commit 7e652f402f)

Co-authored-by: David Ellis <ducksual@gmail.com>
2025-10-07 21:23:47 -07:00
Miss Islington (bot)
ed0e63fd0a
[3.14] gh-138558: Improve handling of Template annotations in annotationlib (GH-139072) (#139272)
gh-138558: Improve handling of Template annotations in annotationlib (GH-139072)
(cherry picked from commit 6ec058a1f7)

Co-authored-by: Dave Peck <davepeck@gmail.com>
2025-10-07 21:23:22 -07:00
Miss Islington (bot)
6b26e62f37
[3.14] gh-138813: Fix mutable default kwargs={} in multiprocessing BaseProcess and DummyProcess to use None (GH-138814) (#139084)
gh-138813: Fix mutable default kwargs={} in multiprocessing BaseProcess and DummyProcess to use None (GH-138814)

* gh-138813: Default `BaseProcess` `kwargs` to `None` (GH-138814)

Set `BaseProcess.__init__(..., kwargs=None)` and initialize `kwargs` with
`dict(kwargs) if kwargs else {}`. This avoids a shared mutable default and
matches threading.Thread behavior.



* DummyProcess kwargs=None (which threading.Thread accepts properly)
(cherry picked from commit 5a15e73789)

Co-authored-by: Denis Sergeev <newjimbatler00@gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
2025-10-08 00:37:30 +00:00
Miss Islington (bot)
64f0e2d6fa
[3.14] gh-126631: gh-137996: fix pre-loading of __main__ (GH-135295) (#138607)
gh-126631: gh-137996: fix pre-loading of `__main__` (GH-135295)

gh-126631: gh-137996: fix pre-loading of `__main__`

The `main_path` parameter was renamed `init_main_from_name`, update the
forkserver code accordingly.  This was leading to slower startup times when people
were trying to preload the main module.

---------
(cherry picked from commit 0912b3a6db)

Co-authored-by: Duane Griffin <duaneg@dghda.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
2025-10-08 00:37:04 +00:00
Miss Islington (bot)
d11e69d620
[3.14] gh-139700: Check consistency of the zip64 end of central directory record (GH-139702) (GH-139706)
Support records with "zip64 extensible data" if there are no bytes
prepended to the ZIP file.
(cherry picked from commit 162997bb70)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-07 23:16:26 +02:00
Miss Islington (bot)
09fdd219a5
[3.14] gh-105487: Fix __dir__ entries of GenericAlias (GH-138578) (GH-138629)
(cherry picked from commit b0420b505e)

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Emma Smith <emma@emmatyping.dev>
2025-10-07 23:12:13 +02:00