Commit graph

54300 commits

Author SHA1 Message Date
Stan Ulbrych
e7d4c3ff42
[3.13] gh-149144: Use decodeURIComponent() for UTF-8 support in js_output() (GH-149157) (#150949)
Co-authored-by: Seth Larson <seth@python.org>
2026-06-08 20:15:21 +01:00
Stan Ulbrych
8e73feee5c
[3.13] gh-148801: Fix unbound C recursion in Element.__deepcopy__() (GH-148802) (#148843) 2026-06-08 20:14:48 +01:00
Miss Islington (bot)
4834b45ee7
[3.13] gh-150633: Properly handle null characters in the name when importing frozen modules (GH-150634) (GH-151102)
(cherry picked from commit 54de5475cd)

Co-authored-by: Thomas Kowalski <thom.kowa@gmail.com>
2026-06-08 18:55:43 +00:00
Miss Islington (bot)
947aa707c1
[3.13] gh-150368: Change Windows user group to secure identifier in test_tempfile (GH-150369) (#150703)
gh-150368: Change Windows user group to secure identifier in test_tempfile (GH-150369)
(cherry picked from commit 9d64c355b5)

Co-authored-by: Dawid Konrad Kohnke <51542233+anytokin@users.noreply.github.com>
2026-06-08 18:16:44 +00:00
Miss Islington (bot)
cbbddff73a
[3.13] gh-123853: Update locale.windows_locale (GH-123901) (GH-148877)
Update the table of Windows language code identifiers (LCIDs) to
protocol version 16.0 (2024-04-23).
(cherry picked from commit bfe6f9f590)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-06-08 20:58:00 +03:00
Miss Islington (bot)
2d322c4641
[3.13] gh-151019: Fix test_os on 32-bit FreeBSD (GH-151087) (#151095)
gh-151019: Fix test_os on 32-bit FreeBSD (GH-151087)

Remove references to server.handler_instance. This attribute has been
removed in 2022 by commit 3ae975f1ac.
(cherry picked from commit a9002349cb)

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-06-08 17:20:57 +00:00
Miss Islington (bot)
619a12b2e5
[3.13] gh-150599: Prevent bz2 decompressor reuse after errors (GH-150600)
(cherry picked from commit 157a5df8cb)

Co-authored-by: Stan Ulbrych <stan@python.org>
2026-06-08 10:55:32 +01:00
Miss Islington (bot)
ac07245fd3
[3.13] gh-148954: Escape methodname in xmlrpc.client.dumps() to prevent XML injection (GH-148968) (GH-151035)
(cherry picked from commit ab930175e7)

Co-authored-by: Sanyam Kumat <124618873+sanyamk23@users.noreply.github.com>
2026-06-07 10:53:16 +03:00
Miss Islington (bot)
2fa0d4bc5d
[3.13] gh-50948: IDLE: Warn if saving a file will overwrite a newer version (GH-17578) (GH-151028)
(cherry picked from commit 69851a6407)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Co-authored-by: Guilherme Polo <ggpolo@gmail.com>
Co-authored-by: Priya Pappachan <priyapappachan010@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-06-07 00:12:20 +03:00
Miss Islington (bot)
73f9188587
[3.13] gh-149835: Use realpath() instead of abspath() in shutil.move() (GH-149986) (GH-151011)
(cherry picked from commit fab449bddb)

Co-authored-by: Thomas Kowalski <thom.kowa@gmail.com>
2026-06-06 13:29:32 +03:00
Miss Islington (bot)
68250323fc
[3.13] gh-150913: Fix sqlite3.Blob validation for empty slice assignment (GH-150915) (GH-150925)
ass_subscript_slice() returned early when the computed slice length
was zero, bypassing validation performed for non-empty slices.
(cherry picked from commit fc9c4db130)

Co-authored-by: Jiseok CHOI <jiseok.dev@gmail.com>
2026-06-04 13:59:11 +00:00
Miss Islington (bot)
ba91d8792a
[3.13] gh-91099: fix[imaplib]: call Exception with string instance (GH-31823) (#150809)
* bpo-46943: fix[imaplib]: call Exception with string instance

Adjust the behavior of 'login' to be similar to `authenticate()`,
where self.error is called with a str() instance.
(cherry picked from commit 29805f00a1)

Co-authored-by: Florian Best <spaceone@users.noreply.github.com>
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
2026-06-03 09:12:00 -04:00
Miss Islington (bot)
fa3af11739
[3.13] gh-101913: changed wording of docstring for _parsedate_tz (GH-134446) (#150798)
Fixed incorrect word.
(cherry picked from commit f7e0fb60cf)

Co-authored-by: Gustaf <79180496+gostak-dd@users.noreply.github.com>
Co-authored-by: Gustaf <79180496+GGyll@users.noreply.github.com>
2026-06-02 13:52:09 -04:00
Petr Viktorin
ba785b88ad
[3.13] gh-149079: Fix O(n^2) canonical ordering in unicodedata.normalize() (GH-149080) (#150780)
Replace the insertion sort used for canonical ordering of combining
characters with a hybrid approach: insertion sort for short runs (< 20)
and counting sort for longer runs, reducing worst-case complexity from
O(n^2) to O(n). This prevents denial of service via crafted Unicode
strings with many combining characters in alternating CCC order.
(cherry picked from commit 991224b1e8)

Co-authored-by: Seth Larson <seth@python.org>
Co-authored-by: ch4n3-yoon <ch4n3.yoon@gmail.com>
Co-authored-by: Seokchan Yoon <13852925+ch4n3-yoon@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <stan@python.org>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Maurycy Pawłowski-Wieroński <maurycy@maurycy.com>
2026-06-02 16:12:42 +00:00
Victor Stinner
b8ce8a38d1
[3.13] gh-149738: Fix segmentation fault bug in sqllite3 (#149754) (#150770)
gh-149738: Fix segmentation fault bug in sqllite3 (#149754)

Deleting the `row_factory` or `text_factory` attribute is no longer allowed.

(cherry picked from commit 60fdb3192b)

Co-authored-by: Sepehr Rasouli <sepehrrasouli06@gmail.com>
2026-06-02 14:52:30 +02:00
Miss Islington (bot)
542e01c526
[3.13] gh-148508: Add another common pattern for iOS SSL failures to test_ssl (GH-150442) (#150699)
gh-148508: Add another common pattern for iOS SSL failures to test_ssl (GH-150442)

Match also '[SSL: HTTP_REQUEST] http request (_ssl.c:1143)'.
(cherry picked from commit 540b3d0a7f)

Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
2026-06-01 22:19:53 +00:00
Victor Stinner
ff9c8dea8f
[3.13] gh-150436: Skip subprocess test on STATUS_DLL_INIT_FAILED (#150704) (#150721)
gh-150436: Skip subprocess test on STATUS_DLL_INIT_FAILED (#150704)

If a subprocess spawned with CREATE_NEW_CONSOLE creation flag fails
with STATUS_DLL_INIT_FAILED return code, skip the test. It's likely a
memory allocation failure in the desktop heap memory which caused the
DLL init failure.

(cherry picked from commit e8034dd841)
2026-06-01 15:44:54 +00:00
Miss Islington (bot)
62bd651d16
[3.13] gh-150685: update bundled pip to 26.1.2 (gh-150686) (gh-150689) 2026-05-31 21:13:21 +01:00
Miss Islington (bot)
b46df7fe42
[3.13] gh-149489: Fix ElementTree serialization to HTML (GH-149490) (GH-150596) (GH-150609)
* The content of elements "xmp", "iframe", "noembed", "noframes",
  and "plaintext" is no longer escaped.
* The "plaintext" element no longer have the closing tag.
(cherry picked from commit c42e6d3f1a)


(cherry picked from commit bcd29e466f)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-05-30 11:16:32 +00:00
Miss Islington (bot)
ad3a39654f
[3.13] gh-150107: Fix asyncio sendfile fallback ignoring non-zero offset (GH-150270) (#150571)
gh-150107: Fix asyncio sendfile fallback ignoring non-zero offset (GH-150270)
(cherry picked from commit c72d5ea638)

Co-authored-by: Grant Herman <grantlouisherman041@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-05-29 18:40:40 +05:30
Miss Islington (bot)
f20bcf0f23
[3.13] gh-150046: Fix test_add_python_opts to ignore PYTHON* env vars (GH-150089) (#150563)
gh-150046: Fix `test_add_python_opts` to ignore `PYTHON*` env vars (GH-150089)

Avoid the runtime environment from affecting the tests' behaviours,
which notably checks the warning filters which can be controlled by
various PYTHON environment variables.
(cherry picked from commit ef2246f788)

Co-authored-by: Pradyun Gedam <pradyunsg@gmail.com>
2026-05-28 17:08:53 +00:00
Serhiy Storchaka
a2c7551b62
[3.13] gh-150285: Fix too long docstrings in some Python modules (GH-150366) (GH-150375) (GH-150519) (GH-150530)
(cherry picked from commit 01c6d3d76b)
(cherry picked from commit 03244b9f04)
(cherry picked from commit 2a5e7d5bd0)

Co-authored-by: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
2026-05-27 18:22:35 +00:00
Miss Islington (bot)
dad9bec4fa
[3.13] gh-84353: Preserve non-UTF-8 filenames when appending to ZipFile (GH-150091) (GH-150529)
Preserve non-UTF-8 filenames when appending to a ZipFile.

---------
(cherry picked from commit 24c6bbc92b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2026-05-27 18:21:14 +00:00
Miss Islington (bot)
a58c24d9fd
[3.13] gh-88726: Stop using non-standard charset names eucgb2312_cn and big5_tw in email (GH-149959) (GH-150493)
(cherry picked from commit 5e467f4331)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-05-27 10:53:08 +00:00
Miss Islington (bot)
98a9ccbe39
[3.13] gh-149571: Fix the C implementation of Element.itertext() (GH-149929) (GH-150511)
It no longer emits text for comments and processing instructions.
(cherry picked from commit 7de4fcd445)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-05-27 10:49:54 +00:00
Miss Islington (bot)
43f71b0005
[3.13] gh-150175: Fix ThreadingMock call_count race condition (GH-150176) (#150180)
gh-150175: Fix ThreadingMock call_count race condition (GH-150176)

ThreadingMock._increment_mock_call() was not thread-safe.
Multiple threads calling the mock simultaneously could lose
increments due to race conditions on call_count and other
attributes.

Fix by overriding _increment_mock_call in ThreadingMixin
and wrapping it with the existing _mock_calls_events_lock.
(cherry picked from commit 388e023fe1)

Co-authored-by: saisneha196 <156835592+saisneha196@users.noreply.github.com>
2026-05-26 12:47:20 -07:00
Serhiy Storchaka
96d66ac33b
[3.13] gh-150285: Fix too long docstrings in the io module (GH-150287) (GH-150458) (GH-150470)
(cherry picked from commit 36137e46a8)
(cherry picked from commit 160dc74122)
2026-05-26 10:29:28 +00:00
Serhiy Storchaka
59cafbbeaf
[3.13] gh-150285: Fix too long docstrings in the curses module (GH-150286) (GH-150457) (GH-150469)
(cherry picked from commit e7f1216204)
(cherry picked from commit 4c0fe2d134)
2026-05-26 09:58:11 +00:00
Miss Islington (bot)
9463c9d33e
[3.13] gh-150285: Fix too long docstrings in the decimal module (GH-150288) (GH-150460) (GH-150465)
(cherry picked from commit 9d79e71fb6)
(cherry picked from commit 6bed57a3b6)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-05-26 12:49:41 +03:00
Miss Islington (bot)
20805238e5
[3.13] gh-80198: Improve test_pwd and test_grp (GH-150380) (GH-150398) (GH-150423)
Fix tests for non-existing names and ids when getpwall()/getgrall()
don't return all users/groups.

Add tests for out-of-range uids, integer float ids, bytes names,
null-terminated names, names with surrogates, empty names, excessive
arguments.
(cherry picked from commit 4bdff2cc89)
(cherry picked from commit 46e8f7a9e7)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-05-25 19:10:25 +00:00
Miss Islington (bot)
60d843777c
[3.13] gh-149449: Fix use-after-free in _PyUnicode_GetNameCAPI (GH-150323) (#150354)
gh-149449: Fix use-after-free in `_PyUnicode_GetNameCAPI` (GH-150323)
(cherry picked from commit 43c60ec2fd)

Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2026-05-25 16:10:48 +05:30
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
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
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)
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
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)
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
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
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)
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)
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