Co-authored-by: Thomas Grainger <tagrain@gmail.com> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Gregory P. Smith <greg@krypto.org>
[3.13] gh-126008: Improve docstrings for Tkinter cget and configure methods (GH-133303) (GH-137661)
* Explain the behavior of Widget.configure() depending on arguments.
* Unify descriptions.
* Replace "resource" with "option".
(cherry picked from commit 027cacb67ce1b16a96a6a2866299803eff16a4a6)
Sam Gross [Mon, 11 Aug 2025 16:07:21 +0000 (12:07 -0400)]
[3.13] gh-137400: Fix a crash when disabling profiling across all threads (gh-137471) (gh-137649)
The `PyEval_SetProfileAllThreads` function and other related functions
had a race condition on `tstate->c_profilefunc` that could lead to a
crash when disable profiling or tracing on all threads while another
thread is starting to profile or trace a a call.
There are still potential crashes when threads exit concurrently with
profiling or tracing be enabled/disabled across all threads.
(cherry picked from commit 362692852f13cdd1d33cc7ed35c0cbac7af1a785)
[3.13] gh-136914: Fix support of cached functions and properties in DocTest's lineno computation (GH-136930) (GH-137615)
Previously, DocTest's lineno of functions and methods decorated with
functools.cache(), functools.lru_cache() and functools.cached_property()
was not properly returned (None was returned) because the
computation relied on inspect.isfunction() which does not consider the
decorated result as a function.
We now use the more generic inspect.isroutine(), as elsewhere
in doctest's logic.
[3.13] gh-137026: Add an explainer guide for asyncio (GH-137215) (#137582)
gh-137026: Add an explainer guide for asyncio (GH-137215)
* - Add an explainer guide (aka HOWTO, not how-to) for asyncio.
* Fix linter errors.
* - Enforce max line length of roughly 79 chars.
- Start sentences on new lines to minimize disruption of diffs.
* Add reference to subinterpreters.
* - Significantly reduce article size. Remove both example sections & "Which concurrency do I want" section.
* Align section-header lengths with section names.
* - Remove reference to deleted section.
* - Fix a variety of rote style guide items like title-alignment, use of ie and $, and so forth.
- Add links to other parts of the docs for keywords and objects like await, coro, task, future, etc.
* - One last title alignment.
* - Style nit.
* - Rework a variety of I statements.
* Lint fix.
* - Firm up commentary on yield from in corotuines.
[3.13] Replace "ordered arguments" with "positional arguments" in `unittest.mock` documentation (GH-137552) (GH-137554)
Replace "ordered arguments" with "positional arguments" in `unittest.mock` documentation (GH-137552)
(cherry picked from commit 64ee1babfb971ddbc00fd8711cccebfbddf6e4ee)
Remove private _PyThreadState and _PyInterpreterState C API
functions: move them to the internal C API (pycore_pystate.h and
pycore_interp.h). Don't export most of these functions anymore, but
still export functions used by tests.
Remove _PyThreadState_Prealloc() and _PyThreadState_Init() from the C
API, but keep it in the stable API.
[3.13] gh-137463: Update validate_abstract_methods in test_collections.py (GH-137464) (#137521)
gh-137463: Update `validate_abstract_methods` in `test_collections.py` (#137464)
Update `validate_abstract_methods` in `test_collections.py`
The test for missing abstract methods in `validate_abstract_methods` incorrectly attempted to instantiate the generated class `C` with an argument (`C(name)`), which always raises a `TypeError: C() takes no arguments`. Although the test originally passes, it passes for the wrong reason.
This change makes the test correctly validate the enforcement of abstract methods in ABCs.
[3.13] gh-137044: Support large limit values in getrlimit() and setrlimit() (GH-137338) (GH-137507)
* Return large limit values as positive integers instead of negative integers
in resource.getrlimit().
* Accept large values and reject negative values (except RLIM_INFINITY)
for limits in resource.setrlimit().
(cherry picked from commit baefaa6cba1d69efd2f930cdc56bca682c54b139)
[3.13] gh-137134: Update SQLite to 3.50.4 for binary releases (GH-137135) (#137455)
gh-137134: Update SQLite to 3.50.4 for binary releases (GH-137135)
* Update SQLite to 3.50.3 for binary releases.
* macOS and Windows news entries. what about Android?
* update sbom hash
* newline fix via regen-sbom
* news wording
* Update SQLite to 3.50.4 for binary releases.
* update 3.50.4.0.tar.gz hash in sbom & regen-sbom to fix whitespace
* Postpone to a separate PR the build-installer changes to support additional hash types
Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com> Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com> Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Ned Deily <nad@python.org>
[3.13] gh-58124: Avoid CP_UTF8 in UnicodeDecodeError (GH-137415) (#137461)
gh-58124: Avoid CP_UTF8 in UnicodeDecodeError (GH-137415)
Fix name of the Python encoding in Unicode errors of the code page
codec: use "cp65000" and "cp65001" instead of "CP_UTF7" and "CP_UTF8"
which are not valid Python code names.
(cherry picked from commit ce1b747ff68754635b7b12870dfc527184ee3b39)
Co-authored-by: Victor Stinner <vstinner@python.org>
Separate the installer `Shell profile updater` postinstall script from the `Update Shell Profile.command` to enable more robust error handling.
(cherry picked from commit 781eb1a688e0575a38c79575493f3ff83208a33e)
* ensure that we can create AF_UNIX socket files
* emit a warning if system-wide temporary directory is used
(cherry picked from commit 1a07a01014bde23acd2684916ef38dc0cd73c2de)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
* rename warn -> _warn for the 3.13.x backport
[3.13] gh-135444: fix `asyncio.DatagramTransport.sendto` to account for datagram header size when data cannot be sent (GH-135445) (#137246)
gh-135444: fix `asyncio.DatagramTransport.sendto` to account for datagram header size when data cannot be sent (GH-135445)
(cherry picked from commit e3ea8613519bd08aa6ce7d142403e644ae32d843)
Petr Viktorin [Sat, 2 Aug 2025 14:19:20 +0000 (16:19 +0200)]
[3.13] gh-135755: Document __future__.* and CO_* as proper Sphinx objects (GH-135980) (GH-136371)
* Turn the __future__ table to list-table.
This'll make it easier to add entries that need longer markup
* Semantic markup for __future__ feature descriptions.
* Document CO_* C macros.
(cherry picked from commit 2468aafe984fdf923811ef0c6969e3d6c1b92a82)
Neil Schemenauer [Wed, 30 Jul 2025 18:06:44 +0000 (11:06 -0700)]
[3.13] GH-133136: Revise QSBR to reduce excess memory held (gh-135473) (gh-136480)
The free threading build uses QSBR to delay the freeing of dictionary
keys and list arrays when the objects are accessed by multiple threads
in order to allow concurrent reads to proceed with holding the object
lock. The requests are processed in batches to reduce execution
overhead, but for large memory blocks this can lead to excess memory
usage.
Take into account the size of the memory block when deciding when to
process QSBR requests.
Also track the amount of memory being held by QSBR for mimalloc pages.
Advance the write sequence if this memory exceeds a limit. Advancing
the sequence will allow it to be freed more quickly.
Process the held QSBR items from the "eval breaker", rather than from
`_PyMem_FreeDelayed()`. This gives a higher chance that the global read
sequence has advanced enough so that items can be freed.
[3.13] gh-130577: tarfile now validates archives to ensure member offsets are non-negative (GH-137027) (#137170)
gh-130577: tarfile now validates archives to ensure member offsets are non-negative (GH-137027)
(cherry picked from commit 7040aa54f14676938970e10c5f74ea93cd56aa38)
Co-authored-by: Alexander Urieles <aeurielesn@users.noreply.github.com> Co-authored-by: Gregory P. Smith <greg@krypto.org>
[3.13] gh-119711: describe `create_datagram_endpoint`'s behavior in asyncio when `local_addr` is `None` (GH-136913) (#137163)
gh-119711: describe `create_datagram_endpoint`'s behavior in asyncio when `local_addr` is `None` (GH-136913)
(cherry picked from commit 1481384141342479b3ba4b89f653b4e5bef0d272)
Co-authored-by: AN Long <aisk@users.noreply.github.com>
Brian Schubert [Mon, 28 Jul 2025 01:12:16 +0000 (21:12 -0400)]
[3.13] gh-84559: improve What's New entry for `multiprocessing` startmethod changes (GH-128173) (#137156)
[3.13] gh-84559: improve What's New entry for `multiprocessing` start method changes (GH-128173)
(cherry picked from commit b8c313a41c411331c603bbda28048b2a3f4a2ab4)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> Co-authored-by: Gregory P. Smith <greg@krypto.org> Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
[3.13] gh-136992: Add "None" as valid `SameSite` value as per RFC 6265bis (GH-137040) (#137141)
gh-136992: Add "None" as valid `SameSite` value as per RFC 6265bis (GH-137040)
The "SameSite" attribute defined in RFC 6265bis [1] allows the "Strict", "Lax" and "None"
enforcement modes. We already documented "Strict" and "Lax" as being valid values
but "None" was missing from the list. While the RFC has not been formally approved,
modern browsers support the "None" value [2, 3] thereby making sense to document it.
[3.13] gh-132898: Add a note in `multiprocessing.Process` docs about creating a process in a REPL (GH-137118) (#137155)
gh-132898: Add a note in `multiprocessing.Process` docs about creating a process in a REPL (GH-137118)
* Reword, expand, and clarify the limitation, highlighting the REPL case.
* Mention in the high level Process description.
* added a pointer to the GH issue from the doc note
[3.13] gh-136516: Mention installation artifacts as de-facto resources (GH-136419) (GH-137039)
Files like NUL on windows are, from `importlib.resources` point of
view, an artifact caused by installing to a filesystem directory.
Mention these.
(cherry picked from commit fac4964fdb2ae12969b485de496dd6d064fdbe99)
[3.13] gh-137043: mention `PyList_GET_ITEM` as unsafe borrowed API in free-threading docs (GH-137042) (#137046)
gh-137043: mention `PyList_GET_ITEM` as unsafe borrowed API in free-threading docs (GH-137042)
(cherry picked from commit 38b936cc9912fc6847265917f94af53f0bf228e9)
[3.13] gh-131531: Android test fixes (GH-136845) (#136963)
Modifies the test runner script to no longer export the the HOST environment
variable, and to allow for tests that produce no Python output (output from the
Android console is still expected and required). These changes stem from
knowledge gained during developing a PR for Android support in cibuildwheel.
(cherry picked from commit 149bddcc216a398d71ec9497e9bf3ec03d6f2914)
[3.13] gh-134411: assert `PyLong_FromLong(x) != NULL` when `x` is known to be small (GH-134415) (#136911)
gh-134411: assert `PyLong_FromLong(x) != NULL` when `x` is known to be small (GH-134415)
Since `PyLong_From Long(PY_MONITORING_DEBUGGER_ID)` falls to `small_int` case and can't return `NULL`. Added `assert`s for extra confidence.
https://github.com/python/cpython/issues/134411#issuecomment-2897653868
(cherry picked from commit cf19b6435d02dd7be11b84a44f4a8a9f1a935b15)