[3.13] gh-130117: Document why nested `Union`, `Literal`, and `Annotated` types referenced through a type alias are not flattened (GH-130119) (#133488)
gh-130117: Document why nested `Union`, `Literal`, and `Annotated` types referenced through a type alias are not flattened (GH-130119)
Co-authored-by: Sergey Miryanov <sergey.miryanov@gmail.com> Co-authored-by: Tomas R. <tomas.roun8@gmail.com> Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
Co-authored-by: Chris Eibl <138194463+chris-eibl@users.noreply.github.com> Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
[3.13] gh-124096: Enable REPL virtual terminal support on Windows (GH-124119) (GH-133457)
To support virtual terminal mode in Windows PYREPL, we need a scanner
to read over the supported escaped VT sequences.
Windows REPL input was using virtual key mode, which does not support
terminal escape sequences. This patch calls `SetConsoleMode` properly
when initializing and send sequences to enable bracketed-paste modes
to support verbatim copy-and-paste.
(cherry picked from commit a65366ed879a3d9f27cbcc811ed2e05ad1a2af06)
Co-authored-by: Y5 <124019959+y5c4l3@users.noreply.github.com> Signed-off-by: y5c4l3 <y5c4l3@proton.me> Co-authored-by: Petr Viktorin <encukou@gmail.com> Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com> Co-authored-by: Dustin L. Howett <dustin@howett.net> Co-authored-by: wheeheee <104880306+wheeheee@users.noreply.github.com>
[tests] test_subprocess maybe avoid a timeout race condition? (GH-133420)
The few buildbot failures on https://github.com/python/cpython/pull/133103
are possibly just due to racing a child process launch and exit?
(cherry picked from commit b64aa302d7bc09454ba8d5b19922ff6a4192dd96)
Co-authored-by: Gregory P. Smith <greg@krypto.org>
[3.13] gh-133089: Use original timeout value for `TimeoutExpired` when the func `subprocess.run` is called with a timeout (GH-133103) (#133418)
gh-133089: Use original timeout value for `TimeoutExpired` when the func `subprocess.run` is called with a timeout (GH-133103)
(cherry picked from commit 2bbcaedb75942389dacb51866948f40de5951c9c)
Signed-off-by: Manjusaka <me@manjusaka.me> Co-authored-by: Nadeshiko Manju <me@manjusaka.me> Co-authored-by: Gregory P. Smith <greg@krypto.org>
[3.13] gh-109700: Improve stress tests for interpreter creation (GH-109946) (GH-133391)
* Ensure that destructors are called in the test that created interpreters, not after finishing it.
* Try to create/run interpreters in threads simultaneously.
* Mark tests that requires over 6GB of memory with bigmemtest.
(cherry picked from commit 61b50a98b42a75a66ec52d78811b32e70220bcaf)
[3.13] gh-122559: Synchronize C and Python implementation of the io module about pickling (GH-122628) (GH-133381)
In the C implementation, remove __reduce__ and __reduce_ex__ methods
that always raise TypeError and restore __getstate__ methods that always
raise TypeErrori.
[3.13] gh-119605: Respect `follow_wrapped` for `__init__` and `__new__` when getting class signature with `inspect.signature` (GH-132055) (#133277)
gh-119605: Respect `follow_wrapped` for `__init__` and `__new__` when getting class signature with `inspect.signature` (GH-132055)
(cherry picked from commit b8633f9aca9b198e5592106b649389d638cbc620)
[3.13] gh-131531: Make Android build retry after network failures (GH-133193) (#133236)
Adds a retry strategy when downloading compilation resources for Android, plus some other cleanups.
(cherry picked from commit feac343d1aeef9edce91640e4bbc74516980db9a)
[3.13] gh-133167: Fix compilation process with `--enable-optimizations` and `--without-docstrings` (GH-133187) (#133207)
gh-133167: Fix compilation process with `--enable-optimizations` and `--without-docstrings` (GH-133187)
(cherry picked from commit cc39b19f0fca8db0f881ecaf02f88d72d9f93776)
[3.13] gh-132308: prevent `TracebackException` swallowing attributes of a falsey `Exception` or `ExceptionGroup` (GH-132363) (#132725)
gh-132308: prevent `TracebackException` swallowing attributes of a falsey `Exception` or `ExceptionGroup` (GH-132363)
(cherry picked from commit 69cda31261dd98b0462dc5ca63bdbcd0954dfa77)
Neil Schemenauer [Tue, 29 Apr 2025 03:33:13 +0000 (20:33 -0700)]
[3.13] gh-133122: Fix for test_type_lookup_mro_reference. (gh-133127)
Change the unit test case to use `getattr()` so that we avoid the
bytecode specializer optimizing the access. The specializer will call
the `__eq__` method before the unit test expects, causing it to fail.
In the 3.14 branch (gh-128164) the test is changed in a different way
to avoid the same issue.
Neil Schemenauer [Mon, 28 Apr 2025 22:08:09 +0000 (15:08 -0700)]
[3.13] gh-132942: Fix races in type lookup cache (gh-133114)
Two races related to the type lookup cache, when used in the
free-threaded build. This caused test_opcache to sometimes fail (as
well as other hard to re-produce failures).
[3.13] gh-132026: Ensure _MIPS_SIM has defined _ABI identifiers for comparison (GH-133092)
When built on a MIPS architecture, `_MIPS_SIM` is used to determine
architecture specifics. The value is expected to match either
`_ABIO32`, `_ABIN32` or `_ABI64`.
In `gcc` config/mips/mips.h these values are defined as compiler
`builtin_define` inside of a switch/case. That means, mips64el and
mips64 architectures know about `_ABI64` but don't know about `_ABIO32`
and `_ABIN32`. In turn, when CPython tries to use them in comparison,
they may be undefined identifiers.
In default compiler behavior, the undefined identifier will be
evaluated as zero, and it will not match `_MIPS_SIM`. However, the
issues pop up when `-Wundef` (or, even worse, `-Werror=undef`) compiler
flag is enabled. Then suddenly it's visible as a warning or error.
(cherry picked from commit 6985e2e6dea67630cf13fc02b7ca727af383207b)
Co-authored-by: Valters Jansons <sigv@users.noreply.github.com>
[3.13] gh-132742: Improve tests for fcntl.ioctl() (GH-132791) (GH-133066)
* Use better tests for integer argument.
* Add also parallel tests for tcflush() and tcflow().
(cherry picked from commit ed8e886f4f59df4eceefeb7eef2e3d146967df34)
[3.13] gh-91221: fix `test_curses.test_use_default_colors` for xterm-256color (GH-132990) (#132992)
gh-91221: fix `test_curses.test_use_default_colors` for xterm-256color (GH-132990)
Terminals with `xterm-256color` Xterm support may use 15 (bright white) as their default foreground color.
(cherry picked from commit 7f02ded29fb0e7f4ee115b5be32a591ff7b449b8)
Co-authored-by: Christian Veenhuis <124370897+ChVeen@users.noreply.github.com> Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu> Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
Replace setuptools._distutils.dep_util with setuptools.modified in
peg_generator compile_c_extension().
(cherry picked from commit 1a70f66ea856de1b1b0ca47baf9ee8ba6799ae18)
Co-authored-by: Victor Stinner <vstinner@python.org>
[3.13] gh-132415: Use shutil.which() in missing_compiler_executable() (GH-132906) (#132916)
gh-132415: Use shutil.which() in missing_compiler_executable() (GH-132906)
Replace deprecated distutils.spawn.find_executable() with
shutil.which() in missing_compiler_executable() of test.support.
(cherry picked from commit de6482eda3a46cc9c9a03fb9ba57295ab99b4722)
Co-authored-by: Victor Stinner <vstinner@python.org>
[3.13] gh-109981: Resolve situation on iOS regarding fd_count. (GH-132823) (#132824)
Modifies the test helper that counts the list of open file descriptors to use
the optimised ``/dev/fd`` approach on all Apple platforms, not just macOS. This
avoids crashes caused by guarded file descriptors.
(cherry picked from commit 862fd890361005598a6f4614ea0608c8447831c2)
[3.13] gh-83994, gh-132843: Fix and improve test_ioctl (GH-132848) (GH-132850)
* Skip test_ioctl_tcflush if termios.TCFLSH is not available.
* Do not skip ALL ioctl() tests when /dev/tty is not available.
(cherry picked from commit 4b4b9fbb06198f65424ed5be06c59f8b2801b99b)
Add union_init_parameters() helper function. Use a critical section
to initialize the 'parameters' member.
(cherry picked from commit dc3e9638c22fc1fa807a88c32316ac2558a4b879)
Co-authored-by: Victor Stinner <vstinner@python.org>
[3.13] gh-132742: Add more tests for fcntl.ioctl() (GH-132756) (GH-132764)
Test with different types of argument: integer, mutable and immutable
buffers, immutable buffer with mutable_flag set to false.
(cherry picked from commit a04390b4dad071195f834db347aa686292811051)
[3.13] gh-129098: avoid using content of `_pyrepl/__main__.py` when reporting tracebacks (GH-130721) (#132755)
gh-129098: avoid using content of `_pyrepl/__main__.py` when reporting tracebacks (GH-130721)
(cherry picked from commit 492e3e6976d05b8de1892c37c900ada23eaeaf06)
[3.13] gh-129327: revise hashlib documentation to account for FIPS removing sha1 (GH-132729) (#132740)
gh-129327: revise hashlib documentation to account for FIPS removing sha1 (GH-132729)
* gh-129327: revise hashlib documentation to account for FIPS removing sha1
More generally, the current documentation is a bit scattered, talking
about what terms are "equal" despite those terms not being very
interesting and given the term "secure hash", probably wrong (because
md5 and sha1 are not secure anymore).
Let's talk about cryptographically secure instead, and note that two of
them aren't. And then we can also link to the source for NIST going
through the removal process for SHA1.