Victor Stinner [Thu, 5 Jun 2025 15:02:09 +0000 (17:02 +0200)]
[3.13] gh-134989: Fix Py_RETURN_NONE in the limited C API (GH-135165) (#135182)
gh-134989: Fix Py_RETURN_NONE in the limited C API (GH-135165)
Fix Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE macros in the
limited C API 3.11 and older:
Don't treat Py_None, Py_True and Py_False as immortal.
[3.13] gh-135124: Change stdout errors in regrtest worker process (GH-135138) (#135169)
gh-135124: Change stdout errors in regrtest worker process (GH-135138)
Set sys.stdout encoder error handler to backslashreplace in regrtest
workers to avoid UnicodeEncodeError when printing a traceback
or any other non-encodable character.
Move the code from the Regrtest class to setup_process().
Malcolm Smith [Thu, 5 Jun 2025 09:23:46 +0000 (10:23 +0100)]
[3.13] gh-131531: android.py enhancements to support cibuildwheel (GH-132870) (#135164)
Modifies the environment handling and execution arguments of the Android management
script to support the compilation of third-party binaries, and the use of the testbed to
invoke third-party test code.
(cherry picked from commit 2e1544fd2b0cd46ba93fc51e3cdd47f4781d7499)
Co-authored-by: Malcolm Smith <smith@chaquo.com> Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
In file included from Python/pylifecycle.c:26:
Include/internal/pycore_runtime.h:47:26: warning:
initializer-string for array of 'char' truncates NUL terminator
but destination lacks 'nonstring' attribute (9 chars into 8
available) [-Wunterminated-string-initialization]
47 | #define _Py_Debug_Cookie "xdebugpy"
| ^~~~~~~~~~
[3.13] gh-126483: disable warnings filters mutation in concurrent test (GH-132694) (GH-135132)
The `test_ssl_in_multiple_threads` test failed because `test_check_hostname_idn()`
modified the global warnings filters via `warnings_helper.check_no_resource_warning()`.
Disable the warnings check in the multi-threaded test because `warnings_helper` isn't
thread-safe in 3.13 or earlier.
(cherry picked from commit 40c8be0008ecadb5d0dc9a017434b1133a3a6e06)
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
* Fix for 3.13
---------
Co-authored-by: Thomas Grainger <tagrain@gmail.com> Co-authored-by: Sam Gross <colesbury@gmail.com>
[3.13] gh-135101: When choosing the default simulator device, don't use `simctl --set testing` (GH-135102) (#135114)
On a fresh Xcode install (including some CI provider configurations), there is
no pre-existing testing set that can be used to identify simulator models. Use
the default device set to detect available models instead. Live testing
simulators are still created in the testing set.
(cherry picked from commit dba9de731b231ca0c079205f496d1e3d178b4fd3)
[3.13] gh-133489: Remove size restrictions on getrandbits() and randbytes() (GH-133658) (GH-134965)
random.getrandbits() can now generate more that 2**31 bits.
random.randbytes() can now generate more that 256 MiB.
(cherry picked from commit 68784fed78aa297f0de0d038742495709185bef5)
Sam Gross [Mon, 2 Jun 2025 19:40:42 +0000 (15:40 -0400)]
[3.13] gh-134908: Protect `textiowrapper_iternext` with critical section (gh-134910) (gh-135040)
The `textiowrapper_iternext` function called `_textiowrapper_writeflush`, but did not
use a critical section, making it racy in free-threaded builds.
(cherry picked from commit 44fb7c361cb24dcf9989a7a1cfee4f6aad5c81aa)
Bénédikt Tran [Sun, 1 Jun 2025 08:27:02 +0000 (10:27 +0200)]
[3.13] gh-134696: align OpenSSL and HACL*-based hash functions constructors AC signatures (GH-134713) (#134962)
OpenSSL and HACL*-based hash functions constructors now support both `data` and `string` parameters.
Previously these constructor functions inconsistently supported sometimes `data` and sometimes `string`,
while the documentation expected `data` to be given in all cases.
[3.13] gh-134954: Hard-cap max file descriptors in subprocess test fd_status (GH-134955) (#134981)
gh-134954: Hard-cap max file descriptors in subprocess test fd_status (GH-134955)
* Hard-cap max file descriptors in subprocess test fd_status
On some systems, `SC_OPEN_MAX` may return a very large value (i.e. 10**30), leading to the subprocess test timing out (or run forever).
Prevent this situation by applying a hard cap on how many file descriptors are checked.
This adds a warning about the possibly-missing NUL terminator, but in a way
that doesn't make it sound like a bug/wart.
(cherry picked from commit b783e1791b2076ef560104f8207156d75859c0a6)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Notice the "\x91" byte at the end of the first line: it's the
non-ASCII U+00E6 character encoded to the OEM cp437 code page.
(cherry picked from commit 91618278e7cd1ffc222efa03bb5334bd5a13dc5b)
Co-authored-by: Victor Stinner <vstinner@python.org>
[3.13] gh-134789: Document del s[i] operation for mutable sequences (GH-134804) (#134809)
gh-134789: Document del s[i] operation for mutable sequences (GH-134804)
[main] Update stdtypes.rst
- Added explicit mention of `del s[i]` (item deletion by index) to the Mutable Sequence Types section.
- Clarified that this operation removes the item at the specified index from the sequence.
- Addresses issue GH-134789.
(cherry picked from commit 967f361993c9c97eb3ff3076a409b78ea32938df)
Co-authored-by: Victor Stinner <vstinner@python.org> Co-authored-by: Petr Viktorin <encukou@gmail.com> Co-authored-by: Steve Dower <steve.dower@python.org>
[3.13] gh-80334: fix multiprocessing.freeze_support for other spawn platforms (GH-134462) (#134620)
gh-80334: fix multiprocessing.freeze_support for other spawn platforms (GH-134462)
Doc/library/multiprocessing.rst: freeze_support: Change to specify spawn method instead of platform
Have multiprocessing.freeze_support() enable on spawn, not just win32.
Co-authored-by: Seth Michael Larson <seth@python.org> Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Gregory P. Smith <greg@krypto.org>
[3.13] Add notes on nogil & reinitialization to the Opt-Out section in Module Isolation HOWTO (GH-134141) (GH-134491)
Add notes on nogil & reinitialization to the Opt-Out section in Module Isolation HOWTO (GH-134141)
(cherry picked from commit 1f0a294e8c2ff009c6b74ca5aa71da6269aec0dd)
Co-authored-by: Petr Viktorin <encukou@gmail.com> Co-authored-by: Sam Gross <colesbury@gmail.com>
[3.13] gh-114177: avoid calling connection lost callbacks when loop is already closed in asyncio subprocess (GH-134508) (#134562)
gh-114177: avoid calling connection lost callbacks when loop is already closed in asyncio subprocess (GH-134508)
(cherry picked from commit 5804ee7b467d86131be3ff7d569443efb0d0f9fd)
[3.13] gh-134309: Add ``github.actor`` to the GitHub Actions concurrency key (GH-134310) (#134485)
gh-134309: Add ``github.actor`` to the GitHub Actions concurrency key (GH-134310)
When inexperienced users create a PR from their default branch, all of the concurrency keys
collide as there is no namespacing. This becomes an issue at events with many new contributors,
where workflow runs are cancelled on other pull requests.
Disambiguate by adding the username of the relevant 'actor' to the concurrency key.
(cherry picked from commit 979d81a17905e922d32fb1671f9ed394e0ffbda6)
Authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Co-authored-by: Kira <coldcaption@gmail.com> Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Co-authored-by: Sviatoslav Sydorenko <sviat@redhat.com> Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
[3.13] gh-62184: Remove _pyio import of _io.FileIO (gh-134192) (gh-134436)
This was added in the add of `_io`, isn't used since bpo-21859 when a
`_pyio` implementation was added which defines `FileIO` lower down in
the file.
(cherry picked from commit 0a68068bd2a5bff98998067a141b17af5be9b750)
[3.13] gh-133982: Run unclosed file test on all io implementations (gh-134165) (gh-134434)
Update `test_io` `_check_warn_on_dealloc` to use `self.` to dispatch to
different I/O implementations.
Update the `_pyio` implementation to match expected behavior, using the
same `_dealloc_warn` design as the C implementation uses to report the
topmost `__del__` object.
The FileIO one now matches all the others, so can use IOBase. There was
a missing check on closing (self._fd must be valid), add that check
(cherry picked from commit 5b0e82752120a5dc66ce6ee778751d71ba2c33b2)
[3.13] gh-132246: Add special buffer methods to C API Type Object docs (gh-132247) (gh-134427)
Two special methods, __buffer__ and __release_buffer__ were added to
Python 3.12 by PEP 688. The C API Type Object documentation for slots
includes `tp_as_buffer`, and sub-slots `bf_getbuffer`, `bf_releasebuffer`
but does not refer to the Python Data Model version of those. Add the
missing references.
(cherry picked from commit b529b60fc239d19245e5fafd0514d90097c2eb40)
[3.13] gh-85045: clarified that the underlying buffer of a TextIOBase can be a RawIOBase (GH-134372) (#134375)
gh-85045: clarified that the underlying buffer of a TextIOBase can be a RawIOBase (GH-134372)
Added a clarification that the underlying binary buffer of a TextIOBase can be a BufferedIOBase OR a RawIOBase
(cherry picked from commit 36eb711d2f26849214774a017fe8c8a5be3eec30)