[3.13] gh-137490: Fix signal.sigwaitinfo() on NetBSD (GH-137523) (GH-138936)
Handle ECANCELED in the same way as EINTR to work around the Posix
violation in the NetBSD's implementation.
(cherry picked from commit 07d0b95b05dfaf5832f44c2fbc956761f9e29571)
[3.13] gh-131189: Fix "msvcrt" import warning on Linux when "_ctypes" is not available. (GH-131201) (GH-138934)
gh-131189: Fix "msvcrt" import warning on Linux when "_ctypes" is not available. (GH-131201)
Fix "msvcrt" import warning on Linux when "_ctypes" is not available.
On Linux, compiling without "libffi" causes a
"No module named 'msvcrt'" warning when launching PyREPL.
(cherry picked from commit f320c951c3220aa6727b581216463e8b3f8bcd6b)
[3.13] gh-71810: Fix corner case (length==0) for int.to_bytes() (GH-138739) (#138783)
gh-71810: Fix corner case (length==0) for int.to_bytes() (GH-138739)
```pycon
>>> (0).to_bytes(0, 'big', signed=True)
b''
>>> (-1).to_bytes(0, 'big', signed=True) # was b''
Traceback (most recent call last):
File "<python-input-0>", line 1, in <module>
(-1).to_bytes(0, 'big', signed=True)
~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
OverflowError: int too big to convert
```
(cherry picked from commit 011179a79a0d7b93ce074b25b0819e96b6dd3315)
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
[3.13] gh-138432: Improved invalid path checking in zoneinfo.reset_tzpath() (GH-138433) (GH-138778)
* Improve error messages for path-like relative paths and path-like bytes paths.
* TZPATH is now always a tuple of strings.
(cherry picked from commit 859aecc33b82f45e5b7ae30138d28f2a2f33a575)
[3.13] gh-137242: Add a --no-randomize option, and use it in Android CI (GH-138649) (#138685)
Adds a --no-randomize option to the CI runner, so that randomisation can be easily
disabled for --fast-ci and --slow-ci configurations on single-threaded testing platforms
like Android, iOS, and Emscripten.
[3.13] gh-126631: gh-137996: fix pre-loading of `__main__` (GH-135295) (#138609)
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.
[3.13] gh-118981: multiprocessing.popen_spawn_posix, fix potential hang (gh-118982) (#138606)
gh-118981: multiprocessing.popen_spawn_posix, fix potential hang (gh-118982)
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 8ed5a2b56cc6a8635e586c641b0b837669f6677b)
[3.13] gh-116946: fully implement GC protocol for `_curses_panel.panel` (GH-138333) (#138428)
[3.14] gh-116946: fully implement GC protocol for `_curses_panel.panel` (GH-138333)
This commit fixes possible reference loops via `panel.set_userptr`
by implementing `tp_clear` and `tp_traverse` for panel objects.
(cherry picked from commit 572df47840d910b9fc9cd951074232ae89442be1)
[3.13] gh-88375, gh-111788: Fix parsing errors and normalization in robotparser (GH-138502) (GH-138549)
* 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 cb7ef18d70a0bc1363799e2dfa475db457155e43)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
* Commit
* Commit
---------
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
[3.13] gh-60462: Fix locale.strxfrm() on Solaris (GH-138242) (GH-138449)
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 482fd0c811a366f25bd076fc73bf37ffb6b3081e)
[3.13] gh-138204: Forbid expansion of a shared anonymous mmap on Linux (GH-138220) (GH-138387)
This is a Linux kernel bug which caused a bus error.
https://bugzilla.kernel.org/show_bug.cgi?id=8691
(cherry picked from commit 33fcb0c4a054f646d9d3686c145209a893b09bb0)
[3.13] gh-138297 Point link in docs for `finally` to try/else, instead of if/else (GH-138298) (#138382)
Co-authored-by: James Parrott <80779630+JamesParrott@users.noreply.github.com> Co-authored-by: Brian Schubert <brianm.schubert@gmail.com> Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> Co-authored-by: Alexander Belopolsky <abalkin@users.noreply.github.com>
* Changes links to UCD 15.0.0
---------
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> Co-authored-by: Alexander Belopolsky <abalkin@users.noreply.github.com>
[3.13] gh-133829: Remove some specifics from the ``zipimport`` example (GH-133835) (#138273)
Co-authored-by: R Chintan Meher <meherrihaan@gmail.com> Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Co-authored-by: Peter Bierma <zintensitydev@gmail.com> Co-authored-by: sobolevn <mail@sobolevn.me> Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
[3.13] gh-138158: Use the `"data"` tarfile extraction filter in `Tools/ssl/multissltests.py` (GH-138147) (#138263)
gh-138158: Use the `"data"` tarfile extraction filter in `Tools/ssl/multissltests.py` (GH-138147)
The `Tools/ssl/multissltests.py` script may extract a possibly untrusted tarball.
Since the script does not necessarily use Python 3.14 or later (where the `"data"`
filter became the default `tarfile` extraction filter), the user may theoretically
suffer from a path traversal attack.
Although the script should not be used in production and usually relies on downloading
trusted sources, the `"data"` extraction filter is now explicitly used wherever relevant.
(cherry picked from commit 31d3836f26096f9503ca68f4e89d927bc1e060cd)
Co-authored-by: Tommaso Bona <piergeolo@gmail.com>
[3.13] gh-138257: Fix internal `RuleCollectorVisitor` attribute name (GH-138208) (#138260)
gh-138257: Fix internal `RuleCollectorVisitor` attribute name (GH-138208)
The internal `RuleCollectorVisitor` class had an attribute named "rulses"
instead of "rules" that other `GrammarVisitor` subclasses define.
(cherry picked from commit 11217a883da324b85a290f5d78f090d8f4880f16)
[3.13] gh-137317: Fix inspect.signature() for class with wrapped __init__ or __new__ (GH-137862) (GH-138225)
Fixed several cases where __init__, __new__ or metaclass` __call__ is a descriptor
that returns a wrapped function.
(cherry picked from commit 025a2135eff848abf24f9dc52c81386eea9da397)
[3.13] gh-71679: Improve tests for repr() of bytes and bytearray (GH-138180) (GH-138183)
* 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 0dbbf61cc2550428ff99daee367364c688031e1a)
Serhiy Storchaka [Mon, 25 Aug 2025 12:40:09 +0000 (15:40 +0300)]
[3.13] gh-137609: Update signatures of builtins in the documentation (GH-137610) (GH-138138)
Show signatures that match the actual signatures or future multisignatures
for all functions, classes and methods in the "builtins" module.
(cherry picked from commit 65fb4d11a0f3f3e4aea373bd84918e4445cbfe67)
[3.13] Lint: Create a project-wide ``.ruff.toml`` settings file (GH-133124) (#137670)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Bénédikt Tran [Sun, 24 Aug 2025 09:47:09 +0000 (11:47 +0200)]
[3.13] gh-135261: bring back CI job for testing OpenSSL 1.1.1w (GH-135262) (#138110)
This partially reverts commit ad944b5e1f304be1a8c2cc03e9f15005bcb97108
by bringing back the CI job for testing OpenSSL 1.1.1w. Despite this
version being upstream EOL, the rationale for keeping it as follows:
- It most resembles other 1.1.1-work-a-like ssl APIs supported by important vendors.
- Python officially requires OpenSSL 1.1.1 or later, although OpenSSL 3.0 or later
is recommended for cryptographic modules. Since changing the build requirements
requires a transition period, we need to keep testing the allowed versions.
- The code base still contains calls to OpenSSL functions that are deprecated since
OpenSSL 3.0 as well as `ifdef` blocks constrained to OpenSSL 1.1.1.
Serhiy Storchaka [Sun, 24 Aug 2025 08:37:41 +0000 (11:37 +0300)]
[3.13] gh-137986: Fix and improve the csv functions docstrings (GH-137987) (GH-138108)
The csv.register_dialect() docstring no longer imply that it returns a
dialect.
All functions have now signatures.
(cherry picked from commit aa1dbd4dde32951de2e7438b56d6761001604ee2)