Commit graph

53948 commits

Author SHA1 Message Date
Miss Islington (bot)
fd1e3fe15f
[3.13] gh-141757: Comply with pickle protocol in test_reduce_5tuple (GH-141759) (GH-141783)
The 5th element of the __reduce__ tuple should be an iterator.
(cherry picked from commit 41b9ad5b38)

Co-authored-by: Arseny Boykov <36469655+Bobronium@users.noreply.github.com>
2025-11-20 09:20:00 +00:00
Victor Stinner
a0cbdd84af
[3.13] gh-141570: can_colorize: Expect fileno() to raise OSError, as documented (#141716) (#141748)
gh-141570: can_colorize: Expect fileno() to raise OSError, as documented (#141716)

In Fedora, we've been given a slightly incomplete reproducer for a problematic
Python 3.14 color-related change in argparse that leads to an exception when
Python is used from mod_wsgi: https://bugzilla.redhat.com/2414940

mod_wsgi replaces sys.stdout with a custom object that raises OSError on .fileno():

8460dbfcd5/src/server/wsgi_logger.c (L434-L440)

This should be supported, as the documentation of fileno explicitly says:

> An OSError is raised if the IO object does not use a file descriptor.

https://docs.python.org/3.14/library/io.html#io.IOBase.fileno

The previously expected exception inherits from OSError,
so it is still expected.

Fixes https://github.com/python/cpython/issues/141570



(cherry picked from commit 96f496a949)

Co-authored-by: Miro Hrončok <miro@hroncok.cz>
Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com>
2025-11-19 14:28:31 +00:00
Miss Islington (bot)
c7064e7d6b
[3.13] gh-140875: Fix handling of unclosed charrefs before EOF in HTMLParser (GH-140904) (GH-141746)
(cherry picked from commit 95296a9d40)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-11-19 12:17:54 +00:00
Petr Viktorin
1bca1b4da4
[3.13] gh-140691: urllib.request: Close FTP control socket if data socket can't connect (GH-140835) (GH-141657)
(cherry picked from commit f2bce51b98)

Co-authored-by: codenamenam <bluetire27@gmail.com>
2025-11-18 13:34:40 +01:00
Miss Islington (bot)
8f7188847f
[3.13] gh-140873: Fix the singledispatchmethod documentation (GH-141523) (GH-141710)
It does not support non-descriptor callables yet.
(cherry picked from commit d89eb2f984)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-11-18 11:38:38 +00:00
Krishna Chaitanya
7b3312747f
[3.13] gh-141497: Make ipaddress.IP{v4,v6}Network.hosts() always returning an iterator (GH-141547) (GH-141695)
(cherry picked from commit 6b1bdf6c7a)

Co-authored-by: Krishna Chaitanya <141550576+XChaitanyaX@users.noreply.github.com>
2025-11-18 11:43:15 +02:00
Miss Islington (bot)
0280744723
[3.13] gh-130693: Add more tests for tkinter.Text.search() (GH-130848) (GH-141669) (GH-141670)
(cherry picked from commit 8db1aadd65)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-11-17 16:49:41 +00:00
Tian Gao
7beb7e8d35
[3.13] gh-136057: Allow step and next to step over for loops (GH-136160) (#141641)
(cherry picked from commit 8be3b2f479)
2025-11-16 22:23:03 +00:00
Sergey Miryanov
cbeada9ec7
[3.13] GH-141312: Allow only integers to longrangeiter_setstate state (GH-141317) (GH-141568)
This fixes an assertion error when the new computed start is not an integer.
(cherry picked from commit 10bec7c1eb)
2025-11-15 21:14:17 +02:00
Gregory P. Smith
b693037040
[3.13] gh-140938: Raise ValueError for infinite inputs to stdev/pstdev (GH-141531) (#141584)
gh-140938: Raise ValueError for infinite inputs to stdev/pstdev (GH-141531)

Raise ValueError for infinite inputs to stdev/pstdev

---

(cherry picked from commit f0a8bc737a)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-11-15 04:45:28 +00:00
Pablo Galindo Salgado
7e1a0dbc07
[3.13] gh-141579: Fix perf_jit backend in sys.activate_stack_trampoline() (GH-141580) (#141582) 2025-11-15 03:17:49 +00:00
Miss Islington (bot)
fb7ae3fe83
[3.13] gh-136442: Fix unittest to return exit code 5 when setUpClass raises an exception (GH-136487) (#141577)
gh-136442: Fix unittest to return exit code 5 when setUpClass raises an exception (GH-136487)
(cherry picked from commit 53d65c840e)

Co-authored-by: Takuya UESHIN <ueshin@happy-camper.st>
2025-11-15 01:23:03 +00:00
Miss Islington (bot)
f50989f3cb
[3.13] gh-140748: socket_helper.transient_internet: Unwrap UrlError.__cause__ (GH-140749) (GH-141506)
(cherry picked from commit 75a1cbdd38)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-11-13 13:58:46 +01:00
Miss Islington (bot)
72b6ff0a85
[3.13] gh-140601: Refactor ElementTree.iterparse() tests (GH-141499) (GH-141503)
Split existing tests on smaller methods and move them to separate class.
Rename variable "content" to "it".
Use BytesIO instead of StringIO.
Add few more tests.
(cherry picked from commit 2fbd396666)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-11-13 11:57:58 +00:00
Miss Islington (bot)
e5b82c433c
[3.13] gh-103847: fix cancellation safety of asyncio.create_subprocess_exec (GH-140805) (#141447)
gh-103847: fix cancellation safety of `asyncio.create_subprocess_exec` (GH-140805)
(cherry picked from commit ef474cfafb)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-11-13 17:05:01 +05:30
Cody Maloney
7c62bd571b
[3.13] gh-141311: Avoid assertion in BytesIO.readinto() (GH-141333) (GH-141478)
Fix error in assertion which causes failure if pos is equal to PY_SSIZE_T_MAX.
Fix undefined behavior in read() and readinto() if pos is larger that the size
of the underlying buffer.
(cherry picked from commit 7d54374f9c)
2025-11-12 23:37:06 +02:00
Mohsin Mehmood
8402c28f11
[3.13] gh-141314: Fix TextIOWrapper.tell() assertion failure with standalone carriage return (GH-141331) (GH-141452)
The assertion was checking wrong variable (skip_back vs skip_bytes).
(cherry picked from commit af80fac425)
2025-11-12 12:40:14 +02:00
Miss Islington (bot)
54f620cc7f
[3.13] gh-138775: fix handle python -m base64 stdin correct with EOF signal (GH-138776) (#141433)
gh-138775: fix handle `python -m base64` stdin correct with EOF signal (GH-138776)

* fix: handle  stdin correct with EOF single.
* fix: flollow the comments when pipe stdin use buffer
* Apply suggestions from code review
* fix: apply review comments in Lib/base64.py
* fix: address comments
* Reword comment and NEWS entry.

---------
(cherry picked from commit f5c2a41f9a)

Signed-off-by: yihong0618 <zouzou0208@gmail.com>
Co-authored-by: yihong <zouzou0208@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2025-11-12 00:10:07 +00:00
Miss Islington (bot)
8f47ec58f6
[3.13] gh-140485: Catch ChildProcessError in multiprocessing resource tracker (GH-141132) (#141385)
gh-140485: Catch ChildProcessError in multiprocessing resource tracker (GH-141132)
(cherry picked from commit 9cb8c52d5e)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-11-11 05:21:20 +00:00
Bénédikt Tran
718886f6c6
[3.13] gh-140530: fix a reference leak in an error path for raise exc from cause (GH-140908) (#141283)
gh-140530: fix a reference leak in an error path for `raise exc from cause` (#140908)

Fix a reference leak in `raise E from T` when `T` is an exception
subtype for which `T.__new__` does not return an exception instance.

(cherry picked from commit 0c77e7c23b)
2025-11-09 15:57:26 +01:00
Bénédikt Tran
873f0d023c
[3.13] gh-100218: correctly set errno when socket.if_{nametoindex,indextoname} raise OSError (GH-140905) (#141285)
Previously, socket.if_nametoindex() and socket.if_indextoname() could raise
an `OSError` with a `None` errno. Now, the errno from libc is propagated.

(cherry picked from commit 3ce2d57b2f)
2025-11-09 13:31:49 +00:00
Miss Islington (bot)
be33104f88
[3.13] gh-140793: Improve documentatation and tests for the ensure_ascii option in the json module (GH-140906) (GH-141228)
* Document that ensure_ascii=True forces escaping not only non-ASCII, but also
  non-printable characters (the only affected ASCII character is U+007F).
* Ensure that the help output for the json module does not exceed 80
  columns (except one long line in an example and generated lines).
* Add more tests.
(cherry picked from commit 7e90bac3cc)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-11-08 10:30:15 +00:00
Stan Ulbrych
0923704b49
[3.13] gh-139246: zero-width word paste can be wrong in default repl (GH-139254) (GH-141166)
(cherry picked from commit 4e6dba0ef7)

Signed-off-by: yihong0618 <zouzou0208@gmail.com>
Co-authored-by: yihong <zouzou0208@gmail.com>
Co-authored-by: grayjk <grayjk@gmail.com>
2025-11-07 13:51:03 +01:00
Miss Islington (bot)
353bfc813b
[3.13] gh-141141: Make base64.b85decode() thread safe (GH-141149) (GH-141185)
(cherry picked from commit a7bf27f7f5)

Co-authored-by: Benel Tayar <86257734+beneltayar@users.noreply.github.com>
2025-11-07 11:10:21 +00:00
Miss Islington (bot)
dcd2dbaf36
[3.13] gh-140734: fix off-by-one error when comparing to _SUN_PATH_MAX (GH-140903) (#141182)
gh-140734: fix off-by-one error when comparing to `_SUN_PATH_MAX` (GH-140903)

The limit includes a NULL terminator.
(cherry picked from commit 9a19900673)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-11-07 10:18:06 +00:00
Stan Ulbrych
f1a93727c4
[3.13] gh-140939: Fix memory leak in _PyBytes_FormatEx error path (GH-140957) (#141155)
(cherry picked from commit d6c89a2df2)
2025-11-06 16:16:43 +00:00
Miss Islington (bot)
1be80bec79
[3.13] gh-125346: Add more base64 tests (GH-141061) (GH-141130) (GH-141133)
(cherry picked from commit fd17ee026f)

Add more tests for the altchars argument of b64decode() and for the map01
argument of b32decode().
(cherry picked from commit 13360efd38)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-11-06 14:32:42 +02:00
Miss Islington (bot)
89cb8aa3ba
[3.13] Minor fixes to idle.rst and regenerate help.html (GH-140037) (#141122)
Minor fixes to `idle.rst` and regenerate `help.html` (GH-140037)
(cherry picked from commit 4e6e208be9)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-11-06 12:11:50 +00:00
Miss Islington (bot)
54e5dea534
[3.13] gh-129876: Move misplaced IDLE news item (GH-141118) (#141120)
gh-129876: Move misplaced IDLE news item (GH-141118)
(cherry picked from commit 6a7c969d00)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2025-11-06 03:34:15 -05:00
Jan-Eric Nitschke
15db2421ce
[3.13] gh-138772: Add tests for Turtle.dot() signature (GH-138773) (#140992)
Co-authored-by: Jan-Eric Nitschke <47750513+JanEricNitschke@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-11-05 17:24:46 +02:00
Filip Łajszczak
d76e411891
[3.13] gh-139434: Update selected RFC 2822 references to RFC 5322 (GH-139435) (#141024)
Update selected RFC 2822 references to RFC 5322

RFC 2822 was obsoleted by RFC 5322 in 2008. This updates references
to use the current standard in documentation, docstrings, and comments.

It preserves RFC 2822 references in legacy API components to maintain their
historical context.

RFC 822 → RFC 2822 → RFC 5322 progression is explained where relevant.

In some places specific sections of RFC are referenced where it seems helpful.

Scout rule was applied in some places and RFC mentions format was
normalized in doc strings and comments.
(cherry picked from commit ce1bb85d28)
2025-11-04 16:22:31 -05:00
Miss Islington (bot)
ee894d2abb
[3.13] gh-140797: Forbid capturing groups in re.Scanner lexicon patterns (GH-140944) (GH-140983)
(cherry picked from commit fa9c3eefd4)

Co-authored-by: Abhishek Tiwari <Abhi210@users.noreply.github.com>
2025-11-04 11:17:29 +00:00
Jiucheng(Oliver)
10af8404b4
[3.13] gh-135307: Fix email error when policy max_line_length is set to 0 or None (GH-135367) (#140917)
[3.13] gh-135307: Fix email error when policy max_line_length is set to 0 or None (GH-135367)
(cherry picked from commit 6d45cd8dbb)

Co-authored-by: Jiucheng(Oliver) <git.jiucheng@gmail.com>
RDM: Like the change made in a earlier PR to the folder, we can/must use 'maxlen' as a stand in for 'unlimited' when computing line lengths when max_line_length is 0 or None; otherwise the computation results in a traceback.
2025-11-02 15:20:29 -05:00
Sebastian Pipping
bc36bd1786
[3.13] gh-90949: add Expat API to prevent XML deadly allocations (CVE-2025-59375) (GH-139234) (#139367)
* gh-90949: add Expat API to prevent XML deadly allocations (CVE-2025-59375) (#139234)

Expose the XML Expat 2.7.2 mitigation APIs to disallow use of
disproportional amounts of dynamic memory from within an Expat
parser (see CVE-2025-59375 for instance).

The exposed APIs are available on Expat parsers, that is,
parsers created by `xml.parsers.expat.ParserCreate()`, as:

- `parser.SetAllocTrackerActivationThreshold(threshold)`, and
- `parser.SetAllocTrackerMaximumAmplification(max_factor)`.

(cherry picked from commit f04bea44c3)
(cherry picked from commit 68a1778b77)
2025-11-02 12:39:11 +00:00
Miss Islington (bot)
9a3a147988
[3.13] gh-140874: Upgrade bundled pip to 25.3 (GH-140876) (gh-140880)
* gh-140874: Upgrade bundled pip to 25.3 (GH-140876)

Upgrade bundled pip to 25.3
(cherry picked from commit d440a0f96c)

Co-authored-by: Damian Shaw <damian.peter.shaw@gmail.com>

* Update Misc/NEWS.d/next/Library/2025-11-01-00-36-14.gh-issue-140874.eAWt3K.rst

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>

---------

Co-authored-by: Damian Shaw <damian.peter.shaw@gmail.com>
Co-authored-by: Paul Moore <p.f.moore@gmail.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-11-01 12:42:15 +00:00
Łukasz Langa
9ab89c026a
[3.13] gh-136065: Fix quadratic complexity in os.path.expandvars() (GH-134952) (GH-140845)
(cherry picked from commit f029e8db62)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2025-10-31 17:58:09 +01:00
Miss Islington (bot)
0329bd11c7
[3.13] gh-137836: Support more RAWTEXT and PLAINTEXT elements in HTMLParser (GH-137837) (GH-140842)
* the "plaintext" element
* the RAWTEXT elements "xmp", "iframe", "noembed" and "noframes"
* optionally RAWTEXT (if scripting=True) element "noscript"
(cherry picked from commit a17c57eee5)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-31 16:08:42 +00:00
Mikhail Efimov
eec9257aa5
[3.13] gh-140551: Fix dict crash if clear is called at lookup stage (GH-140558) (#140744)
* gh-140551: Fix `dict` crash if `clear` is called at `lookup` stage (#140558)

Co-authored-by: Inada Naoki <songofacandy@gmail.com>
2025-10-30 22:36:49 +05:30
Donghee Na
b0f12b5980
[3.13] gh-137821: Fix wrongly tested json.decoder.scanstring (gh-140781) 2025-10-30 22:51:10 +09:00
Miss Islington (bot)
32c3dcc7a4
[3.13] gh-138162: Fix logging.LoggerAdapter with merge_extra=True and without the extra argument (GH-140511) (GH-140785)
(cherry picked from commit 327dbbedff)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-30 11:31:54 +00:00
Mikhail Efimov
08cacb2a14
[3.13] gh-140576: Fixed crash produced by lexer in case of dedented zero byte (GH-140583) (#140762) 2025-10-29 14:33:55 +00:00
Miss Islington (bot)
62a3b6b0d9
[3.13] gh-140082: Forward colorizing from libregrtest to unittest (GH-140083) (#140755)
gh-140082: Forward colorizing from libregrtest to unittest (GH-140083)

libregrtest redirects test output to a file as part of its operation.
When `unittest` checks to see if it should colorize with
`isatty(sys.stdout)` that fails resulting in no colorizing of the
unittest output.

Update `libregrtest` to set `FORCE_COLOR=1` when redirecting test output
so that unittest will do color printing.
(cherry picked from commit 6ff62ac4fb)

Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-10-29 12:55:54 +00:00
Miss Islington (bot)
b3649a7122
[3.13] gh-140702: Log color and GHA env vars in test.pythoninfo (GH-140747) (#140754)
gh-140702: Log color and GHA env vars in test.pythoninfo (GH-140747)
(cherry picked from commit 376559bf54)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-10-29 12:51:18 +00:00
Cody Maloney
a1a71efa6e
[3.13] gh-140607: Validate returned byte count in RawIOBase.read (GH-140611) (#140730)
* [3.13] gh-140607: Validate returned byte count in RawIOBase.read (GH-140611)

While `RawIOBase.readinto` should return a count of bytes between 0 and
the length of the given buffer, it is not required to. Add validation
inside RawIOBase.read() that the returned byte count is valid.
(cherry picked from commit 0f0a362768)

Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com>
Co-authored-by: Shamil <ashm.tech@proton.me>
Co-authored-by: Victor Stinner <vstinner@python.org>

* fixup: Use older attribute name

---------

Co-authored-by: Shamil <ashm.tech@proton.me>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-10-29 13:31:57 +01:00
Miss Islington (bot)
a026f02fd4
[3.13] gh-140657: Don't rerun test_import single phase init test (GH-140712) (#140714)
gh-140657: Don't rerun test_import single phase init test (GH-140712)

test_basic_multiple_interpreters_main_no_reset() leaks memory:
import_in_subinterp() is called with postcleanup=False.
(cherry picked from commit c6d4c79c9a)

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-10-28 17:29:44 +00:00
Miss Islington (bot)
bec053c184
[3.13] GH-140590: Fix setstate for functools.partial C-module (GH-140671) (#140699)
GH-140590: Fix setstate for functools.partial C-module (GH-140671)

(cherry picked from commit d26686a7f8)

Co-authored-by: Sergey Miryanov <sergey.miryanov@gmail.com>
Co-authored-by: Mikhail Efimov <efimov.mikhail@gmail.com>
2025-10-28 18:14:14 +05:30
Miss Islington (bot)
9c8eade20c
[3.13] gh-140634: Fix a reference counting bug in os.sched_param.__reduce__() (GH-140667) (GH-140686)
(cherry picked from commit 364ae607d8)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-10-27 20:05:10 +00:00
Miss Islington (bot)
0e3b47b839
[3.13] gh-140633: AppleFrameworkLoader: Ignore AttributeError when setting __file__ (GH-140635) (GH-140659)
(cherry picked from commit 3416e7c8dc)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-10-27 14:08:09 +01:00
Bartosz Sławecki
15f92e66eb
[3.13] gh-137568: Ignore startup file in test_dumb_terminal_exits_cleanly (GH-140295) (GH-140632)
(cherry picked from commit 06c779474c)
2025-10-26 15:36:47 +00:00
Sebastian Pipping
7abbf51839
[3.13] gh-140593: Fix a memory leak in function my_ElementDeclHandler of pyexpat (GH-140602) (#140630)
[3.13] gh-140593: Fix a memory leak in function `my_ElementDeclHandler` of `pyexpat` (GH-140602)

Ensure that the memory allocated for the content model
passed to `my_ElementDeclHandler` is freed in all error
paths.

(cherry picked from commit e34a5e3304)
2025-10-26 15:22:20 +00:00