Commit graph

125852 commits

Author SHA1 Message Date
Miss Islington (bot)
effcfd725d
[3.13] gh-145896: Fix typos and stale docstrings in the traceback module (GH-145897) (GH-150384)
(cherry picked from commit 832afeddce)

Co-authored-by: devdanzin <74280297+devdanzin@users.noreply.github.com>
2026-05-25 10:07:38 +00:00
Miss Islington (bot)
80c422d442
[3.13] gh-110704: Recommend distclean target over clean when source tree is not clean (GH-112610) (#150344)
gh-110704: Recommend `distclean` target over `clean` when source tree is not clean (GH-112610)

Recommend `distclean` target over `clean` when source tree is not clean
(cherry picked from commit 34631058f2)

Co-authored-by: James <6125322+SnoopJ@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2026-05-24 08:47:49 -07:00
Bénédikt Tran
e102378eca
[3.13] gh-142516: fix reference leaks in ssl.SSLContext objects (GH-143685) (GH-145075) (#148371)
Cherry picked from commits 3a2a686cc4
and 1decc7ee20 with minor amendments.
2026-05-24 11:43:03 +02:00
Jonathan Dung
29fcf3c5f9
[3.13] Document that import sys.monitoring raises ModuleNotFoundError (GH-148320) (#148422) 2026-05-24 12:54:29 +05:30
Hai Zhu
5d03b24827
[3.13] gh-148450: abc.register needs to update type_version when tp_flags is changed (GH-148623) (#150307) 2026-05-23 17:20:16 +05:30
Miss Islington (bot)
95c93239be
[3.13] gh-150178: Fix refcount leaks in hamt allocation failure paths (GH-150179) (#150301)
gh-150178: Fix refcount leaks in hamt allocation failure paths (GH-150179)
(cherry picked from commit 32823af153)

Co-authored-by: pengyu lee <lipengyu@kylinos.cn>
2026-05-23 14:54:11 +05:30
Miss Islington (bot)
7388a67340
[3.13] gh-150232: update Thread group parameter doc (GH-150283) (#150299)
gh-150232: update Thread group parameter doc (GH-150283)
(cherry picked from commit 82191c6d2c)

Co-authored-by: My-ABC <569817555@qq.com>
2026-05-23 14:04:15 +05:30
Miss Islington (bot)
c0e40601d7
[3.13] Remove 'expat' dependency for Linux in Misc/Brewfile (GH-150118) (#150254)
Co-authored-by: Brett Cannon <brett@python.org>
2026-05-22 14:28:10 +00:00
Miss Islington (bot)
5cf32883dc
[3.13] gh-149902: Remove dead packaging docs link and add a new section for external resources (GH-150030) (#150239)
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 14:45:31 +03:00
Miss Islington (bot)
26a814e4e1
[3.13] Replace deprecated action with RtD app (GH-149111) (#150234)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2026-05-22 11:08:42 +00:00
Miss Islington (bot)
46cff6be90
[3.13] gh-137571: Protect against possible UnboundLocalError in gzip._GzipReader.read() (GH-150222) (GH-150231)
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:37:57 +00:00
Jelle Zijlstra
1df755c135
[3.13] gh-149995: Update typing.py docstrings and documentation (#150217)
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)
2026-05-22 05:09:41 +00:00
Miss Islington (bot)
cfa3daa7fe
[3.13] gh-107398: Fix tarfile stream mode exception when process the file with the gzip extra field (GH-126304) (GH-150201)
(cherry picked from commit 65f99329ed)

Co-authored-by: Nadeshiko Manju <me@manjusaka.me>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-05-21 22:38:54 +03:00
Stan Ulbrych
6f72734446
[3.13] Fix minor typos in unicode.rst (GH-149587) (#150163)
(cherry picked from commit 4e97ff3351)

Co-authored-by: Manoj K M <manojkmdev24@gmail.com>
2026-05-20 15:37:06 +00:00
sobolevn
32feeff72d
[3.13] gh-150146: Fix NULL dereference in _Py_subs_parameters (GH-150147) (#150155)
* [3.13] 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 14:04:17 +00:00
Shamil
e87baa8d24
[3.13] gh-142831: Fix use-after-free in json encoder during re-entrant mutation (gh-142851) (#150079)
gh-142831: Fix use-after-free in json encoder during re-entrant mutation (gh-142851)

User callbacks invoked during JSON encoding (e.g. the `default` callback or
a custom string encoder) can mutate or clear the dict or sequence being
encoded, invalidating borrowed references to items, keys, and values. Hold
strong references unconditionally while iterating.



(cherry picked from commit 235fa7244a)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2026-05-19 20:33:22 -07:00
Miss Islington (bot)
792a552879
[3.13] gh-134887: Add references to locale module for locale-aware number formatting references in string module docs (GH-134888) (GH-150122)
(cherry picked from commit 47723af4e7)

Co-authored-by: Stefanie Molin <24376333+stefmolin@users.noreply.github.com>
2026-05-20 02:55:24 +02:00
Miss Islington (bot)
23fcb4824f
[3.13] gh-149983: Fix PyErr_NoMemory call without GIL in winconsoleio.c (GH-149984) (GH-150112)
(cherry picked from commit 3d2aa899ba)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
2026-05-19 23:11:28 +02:00
Miss Islington (bot)
6fb207ef3e
[3.13] gh-69619: Clarify whitespace definition in str.strip docs (GH-150021) (GH-150047)
(cherry picked from commit 17eb17d43f)

Co-authored-by: Daniil <d.mayorov@innopolis.university>
2026-05-19 23:07:20 +02:00
Armaan Vakharia
44f314933c
[3.13] gh-149590: Remove faulthandler_traverse (GH-150023) (#150087)
`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)
2026-05-19 15:04:13 +00:00
Miss Islington (bot)
8ee6aff140
[3.13] gh-146581: Update docs for dangerous filenames in ZIP files (GH-149994) (GH-150066)
(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:21 +00:00
Miss Islington (bot)
09b2e00b42
[3.13] gh-95816: Fix TLS version range example in docs (GH-148574) (#150010)
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:35 -07:00
Miss Islington (bot)
9e071c9b28
[3.13] gh-146211: Reject CR/LF in HTTP tunnel request headers (GH-146212) (#148343)
gh-146211: Reject CR/LF in HTTP tunnel request headers (GH-146212)
(cherry picked from commit 05ed7ce7ae)

Co-authored-by: Seth Larson <seth@python.org>
Co-authored-by: Illia Volochii <illia.volochii@gmail.com>
2026-05-18 19:44:36 +02:00
Hugo van Kemenade
419fe42b5a
[3.13] CI: Move Homebrew dependencies into Brewfile (GH-148335) (#149884)
Co-authored-by: Brett Cannon <brett@python.org>
2026-05-18 16:33:04 +03:00
AN Long
5531c77d33
[3.13] gh-149921: Fix reference leaks in _interpchannels and _interpqueues modules (GH-149922) (#149954)
(cherry picked from commit acefff95ea)
2026-05-17 13:36:32 +00:00
Miss Islington (bot)
b2b35bad02
[3.13] gh-149916: Restore the commented out part of test_body_encode in test_email (GH-149917) (GH-149939)
(cherry picked from commit 1cbe035723)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-05-17 08:29:33 +00:00
Miss Islington (bot)
e90f3baf5d
[3.13] gh-134837: Correct and improve base85 documentation for base64 module (GH-145843) (GH-149743) (GH-149893)
(cherry picked from commit e667d62f11)
(cherry picked from commit 9ad8a1b955)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: David Huggins-Daines <dhd@ecolingui.ca>
2026-05-15 21:36:47 +03:00
Miss Islington (bot)
012530ba4f
[3.13] gh-149801: Add IANA registered names and aliases with leading zeros (GH-149804) (GH-149872)
Like IBM00858, CP00858, IBM01140, CP01140.
(cherry picked from commit 20438866ae)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-05-15 15:08:50 +03:00
Victor Stinner
782880ba23
[3.13] gh-149707: Fix compiler warning in _ctypes_test on strchr() (#149791) (#149867)
gh-149707: Fix compiler warning in _ctypes_test on strchr() (#149791)

Change my_strchr() return type to "const char*" (add "const").

Fix the compiler warning:

Modules/_ctypes/_ctypes_test.c: In function 'my_strchr':
Modules/_ctypes/_ctypes_test.c:451:12: warning: return discards
'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  451 |     return strchr(s, c);
      |            ^~~~~~

When using C23, strchr(text, ch) return type is "const char*" if text
type is "const char*".

(cherry picked from commit 5465b69255)
2026-05-15 11:32:58 +00:00
sobolevn
a89fafca65
[3.13] gh-149763: Improve availablity docs in select.rst (GH-149764) (#149856)
(cherry picked from commit 7e98debdf4)
2026-05-15 07:33:33 +00:00
Miss Islington (bot)
4da3e91363
[3.13] Link to existing rules in compound_stmts.rst (GH-149811) (GH-149838)
Link to existing rules in compound_stmts.rst (GH-149811)

In gh-138418, `!` was added to links to rules that don't exist in
the docs, in order to silence broken link warnings.
However, productionlist doesn't parse the `!`, which ends up in
the rendered documentation. (It's possible that gh-127835 broke
the `!` support.)

Replace the names with ones that appear in docs:

- `star_named_expression` in the grammar corresponds to
  `flexible_expression` in the docs
- `star_named_expressions` in the grammar corresponds to
  `flexible_expression_list` in the docs
- `named_expression` in the grammar corresponds to
  `assignment_expression` in the docs

Having two sets of names isn't great of course. Consolidating them
is tracked in (subissues of) gh-127833.
(cherry picked from commit c37529293d)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2026-05-14 19:34:29 +02:00
Miss Islington (bot)
6fff3e4bc6
[3.13] gh-149698: Update bundled expat to 2.8.1 (GH-149699) (#149827)
(cherry picked from commit f1a47e79fb)

Co-authored-by: Stan Ulbrych <stan@python.org>
2026-05-14 15:24:39 +00:00
Miss Islington (bot)
ae31e50d3f
[3.13] gh-149017: Upgrade bundled Expat to 2.8.0 (GH-149020) (#149099)
(cherry picked from commit 005555a3f0)

Co-authored-by: Stan Ulbrych <stan@python.org>
2026-05-14 16:00:07 +01:00
Miss Islington (bot)
a6ebca755c
[3.13] gh-148821: Add more tests for invalid XML encodings (GH-149820) (GH-149823)
(cherry picked from commit c6f7368157)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-05-14 10:34:45 +00:00
Miss Islington (bot)
82db654e13
[3.13] gh-128110: Fix rfc2047 whitespace handling in email parser address headers (GH-130749) (#149789)
RFC 2047 Section 6.2 requires that "any 'linear-white-space' that
separates a pair of adjacent 'encoded-word's is ignored." The modern
header value parser correctly implements that for unstructured headers,
but had missed a case in structured headers. This could cause a parsed
address header to include extraneous spaces in a display-name.

Switch to @bitdancer's fix from review feedback. Recharacterize space
between ews as fws after parsing in get_phrase.

RDM: This fix is dependent on the fact that "subsequent" atoms will never have
leading whitespace because that's been consumed already. I don't think
it's worth adding extra code for the possibility of leading whitespace
because the parser won't produce it. It's a bit of parser fragility in the
face of code changes, but I think that's a minor concern given the
parser design (which is that it consumes whitespace greedily)
(cherry picked from commit 7a4c6dfb88)

Co-authored-by: Mike Edmunds <medmunds@gmail.com>
Co-authored-by: R David Murray <rdmurray@bitdance.com>
2026-05-13 16:29:07 -04:00
Miss Islington (bot)
bb3446dda6
[3.13] gh-87451: Apply CVE-2021-4189 PASV fix to ftplib.ftpcp() (GH-149648) (#149794)
gh-87451: Apply CVE-2021-4189 PASV fix to ftplib.ftpcp() (GH-149648)

ftpcp() called parse227() directly and passed the source server's
self-reported PASV IPv4 address to the target server's PORT command,
bypassing the CVE-2021-4189 fix that was applied only to FTP.makepasv().
A malicious source FTP server could use this to redirect the target
server's data connection to an arbitrary host:port (SSRF).

ftpcp() now uses the source server's actual peer address, honoring the
existing trust_server_pasv_ipv4_address opt-out, the same as makepasv().

Thanks to Qi Ding at Aurascape AI for the report. (GHSA-w8c5-q2xf-gf7c)
(cherry picked from commit eac4fe3b2c)

Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
2026-05-13 17:58:26 +00:00
Miss Islington (bot)
49d08674d8
[3.13] gh-149776: Skip UDP Lite tests if it's not supported (GH-149777) (#149782)
gh-149776: Skip UDP Lite tests if it's not supported (GH-149777)

Fix test_socket on Linux kernel 7.1 and newer: skip UDP Lite tests if
it's not supported.
(cherry picked from commit 3cfc249e11)

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-05-13 15:27:56 +00:00
Miss Islington (bot)
5ed8090081
[3.13] Run mypy with four worker processes and uv (GH-149726) (GH-149774) (#149775)
[3.14] Run mypy with four worker processes and uv (GH-149726) (GH-149774)
(cherry picked from commit bb5a81a1ac)


(cherry picked from commit 6304eb1f5b)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2026-05-13 15:03:58 +03:00
Miss Islington (bot)
4e2cf29607
[3.13] gh-148821: Add more strict tests for XML encodings (GH-149765) (GH-149772)
Exclude encodings like 'utf-8-sig', 'iso2022-jp' and 'hz' from the list of
supported encodings.
(cherry picked from commit fa2afa64d9)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-05-13 11:05:06 +00:00
Miss Islington (bot)
9e220bbfeb
[3.13] gh-149701: Fully silence potential hash -r error (GH-149702) (GH-149759)
(cherry picked from commit cd6096887e)
2026-05-13 09:22:02 +01:00
Miss Islington (bot)
a76d9f48d5
[3.13] gh-149574: Document that is_typeddict, is_protocol, is_dataclass, isclass return False for generic aliases (GH-149604) (#149752)
gh-149574: Document that is_typeddict, is_protocol, is_dataclass, isclass return False for generic aliases (GH-149604)
(cherry picked from commit a4e51c8dac)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2026-05-13 03:07:24 +00:00
Stan Ulbrych
ea8c3e028b
[3.13] gh-145376: Fix various reference leaks (GH-145377) (#148661)
(cherry picked from commit bd13cc09fa)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2026-05-12 18:35:27 +00:00
Hugo van Kemenade
a2864ec643
[3.13] Remove myself from CODEOWNERS (GH-149727) (#149734)
(cherry picked from commit 058c12528d)

Co-authored-by: Berker Peksag <berker.peksag@gmail.com>
2026-05-12 16:20:25 +00:00
Miss Islington (bot)
d36f61d8c8
[3.13] Update mypy to 2.1.0 (GH-149709) (#149713)
Update mypy to 2.1.0 (GH-149709)
(cherry picked from commit b546cc10f5)

Co-authored-by: sobolevn <mail@sobolevn.me>
2026-05-12 09:06:58 +00:00
Miss Islington (bot)
ae65e0cf85
[3.13] gh-148669: Clarify __reduce__() module lookup behavior (GH-148670) (#149705)
gh-148669: Clarify `__reduce__()` module lookup behavior (GH-148670)
(cherry picked from commit 54a5fd4126)

Co-authored-by: Victorien <65306057+Viicos@users.noreply.github.com>
2026-05-12 02:52:36 +00:00
Miss Islington (bot)
5ad22a8de6
[3.13] gh-112821: Fix rlcompleter failures on objects with descriptors (GH-149577) (#149658)
* gh-112821: Fix rlcompleter failures on objects with descriptors (GH-149577)

* gh-112821: Fix rlcompleter failures on objects with descriptors

* Confirm no accesses
(cherry picked from commit f23a1837d7)

Co-authored-by: Michael Droettboom <mdboom@gmail.com>

* Add missing import

---------

Co-authored-by: Michael Droettboom <mdboom@gmail.com>
Co-authored-by: Michael Droettboom <mdroettboom@nvidia.com>
2026-05-11 12:08:20 -04:00
Miss Islington (bot)
a42082b6a1
[3.13] gh-146061: Clarify indent=None in json docs (GH-146095) (GH-149669)
(cherry picked from commit 833dae7c1f)

Co-authored-by: Jonathan Dung <jonathandung@yahoo.com>
2026-05-11 11:38:56 +00:00
Miss Islington (bot)
0478bd83d8
[3.13] gh-149486: tarfile.data_filter: validate written link target (GH-149487) (GH-149555)
* gh-149486: tarfile.data_filter: validate written link target (GH-149487)

The data filter rewrote linknames with normpath() but ran the
containment check against the un-normalised value, and computed a
symlink's directory before stripping trailing slashes.  Both let a
crafted archive create links pointing outside the destination.  Also
reject link members that resolve to the destination directory itself,
which could otherwise replace it with a symlink and redirect all
subsequent members.

(Patch by Greg; Petr's just reviewing & merging.)
(cherry picked from commit 578411982c)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2026-05-11 11:58:26 +02:00
Miss Islington (bot)
6ab65b3e7e
[3.13] gh-149388: Make asyncio PipeHandle.close idempotent (GH-149518) (#149607)
gh-149388: Make asyncio `PipeHandle.close` idempotent (GH-149518)
(cherry picked from commit 7241f2739c)

Co-authored-by: Max Schmitt <max@schmitt.mx>
2026-05-09 20:38:09 +05:30
Miss Islington (bot)
ba894f1767
[3.13] gh-79638: Test other HTTP error codes besides 403 in test_robotparser (GH-149569) (GH-149582)
Also, use urllib.request.urlcleanup() in NetworkTestCase.
(cherry picked from commit 57ef219950)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-05-08 20:46:14 +00:00