gh-128636: Fix crash in PyREPL when `os.environ` is overwritten with an invalid value (GH-128653)
(cherry picked from commit ba9a4b6215)
Co-authored-by: Tomas R <tomas.roun8@gmail.com>
gh-129093: Fix f-string debug text sometimes getting cut off when expression contains `!` (GH-129159)
(cherry picked from commit 767cf70844)
Co-authored-by: Tomas R <tomas.roun8@gmail.com>
gh-125553: Fix backslash continuation in `untokenize` (GH-126010)
(cherry picked from commit 7ad793e5db)
Co-authored-by: Tomas R <tomas.roun8@gmail.com>
gh-122845: fix parameter_list_starargs in function definition pseudo-grammar (GH-122847)
Thanks to Artur Chakhvadze for bugfix.
(cherry picked from commit 6105846390)
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
GH-121970: Extract ``changes`` into a new extension (GH-129105)
(cherry picked from commit e54ac3b69e)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Docs C API: Clarify what happens when null bytes are passed to `PyUnicode_AsUTF8` (GH-127458)
(cherry picked from commit e792f4bc2e)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Stan U. <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
gh-129044: Update glossary entry for 'loader' to reflect current import system (GH-129073)
(cherry picked from commit e1fa2fcc7c)
Co-authored-by: nikalinov <92603661+nikalinov@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
gh-128978: Fix a `NameError` in `sysconfig.expand_makefile_vars` (GH-128979)
This fixes a regression introduced by 4a53a397c3.
(cherry picked from commit df66ff14b4)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Add a mix-in class ExtraAssertions containing the following methods:
* assertHasAttr() and assertNotHasAttr()
* assertIsSubclass() and assertNotIsSubclass()
* assertStartsWith() and assertNotStartsWith()
* assertEndsWith() and assertNotEndsWith()
(cherry picked from commit 06cad77a5b)
GH-125722: Use long options for Sphinx (GH-129039)
(cherry picked from commit 4967fa6a9c)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
gh-129020: Remove ambiguous sentence from `tokenize.untokenize` docs (GH-129021)
(cherry picked from commit bca35f0e78)
Co-authored-by: Tomas R <tomas.roun8@gmail.com>
gh-80222: Fix email address header folding with long quoted-string (GH-122753)
Email generators using email.policy.default could incorrectly omit the
quote ('"') characters from a quoted-string during header refolding,
leading to invalid address headers and enabling header spoofing. This
change restores the quote characters on a bare-quoted-string as the
header is refolded, and escapes backslash and quote chars in the string.
(cherry picked from commit 5aaf416858)
Co-authored-by: Mike Edmunds <medmunds@gmail.com>
tracemalloc_alloc(), tracemalloc_realloc(), PyTraceMalloc_Track(),
PyTraceMalloc_Untrack() and _PyTraceMalloc_TraceRef() now check
tracemalloc_config.tracing after calling TABLES_LOCK().
_PyTraceMalloc_Stop() now protects more code with TABLES_LOCK(),
especially setting tracemalloc_config.tracing to 1.
Add a test using PyTraceMalloc_Track() to test tracemalloc.stop()
race condition.
Call _PyTraceMalloc_Init() at Python startup.
[3.13] gh-128991: Release the enter frame reference within bdb callback (GH-128992)
* Release the enter frame reference within bdb callback
* 📜🤖 Added by blurb_it.
---------
(cherry picked from commit 61b35f74aa)
gh-128998: Fix indentation of numbered list and literal block (GH-128999)
(cherry picked from commit e8092e5cdc)
Co-authored-by: Rafael Fontenelle <rffontenelle@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Previously, `_Py_RefcntAdd` hasn't called
`_Py_INCREF_STAT_INC/_Py_INCREF_IMMORTAL_STAT_INC` which is incorrect.
Now it has been fixed.
(cherry picked from commit ab05beb8ce)
gh-128916: Do not set `SO_REUSEPORT` on non-`AF_INET*` sockets (GH-128933)
* gh-128916: Do not set `SO_REUSEPORT` on non-`AF_INET*` sockets
Do not attempt to set ``SO_REUSEPORT`` on sockets of address familifies other
than ``AF_INET`` and ``AF_INET6``, as it is meaningless with these address
families, and the call with fail with Linux kernel 6.12.9 and newer.
* Apply suggestions from code review
---------
(cherry picked from commit 3829104ab4)
Co-authored-by: Michał Górny <mgorny@gentoo.org>
Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
gh-58689: Fix os.kill() error handling on Windows (GH-128932)
(cherry picked from commit 939df0f9f6)
Co-authored-by: Victor Stinner <vstinner@python.org>
* Fix a deprecation warning for using importlib.resources.abc.ResourceReader.
* Fix an import warning when importing readline (if it has not yet been imported).
(cherry picked from commit 599be687ec)
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
gh-97850: Suggest `TraversableResources` as the alternative for `ResourceLoader` (GH-128601)
Suggest TraversableResources as the alternative for ResourceLoader.
Previously, ResourceReader was the suggested alternative, but it
is itself deprecated in favour of TraversableResources.
(cherry picked from commit 256d6d2131)
Co-authored-by: Tomas R <tomas.roun8@gmail.com>
gh-67206: Document that `string.printable` is not printable in the POSIX sense (GH-128820)
(cherry picked from commit d906bde250)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
gh-106320: Document replacement for removed C API (GH-128787)
(cherry picked from commit 43ef9587ae)
Co-authored-by: Victor Stinner <vstinner@python.org>
Fix a "doctest" block in `Doc/library/turtle.rst` (GH-128831)
(cherry picked from commit 1598e18a65)
Co-authored-by: Rafael Fontenelle <rffontenelle@users.noreply.github.com>
gh-109959: Skip test_glob.test_selflink() flaky test (GH-128812)
(cherry picked from commit 1153e66e20)
Co-authored-by: Victor Stinner <vstinner@python.org>
[3.13] gh-128717: Stop-the-world when setting the recursion limit (GH-128741)
(cherry picked from commit f6c61bf2d7)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
gh-125997: Increase test coverage for `time.sleep()` (GH-128751)
- Add tests for durations of invalid types.
- Add tests for `int` and `float` durations, including signed zeroes durations.
- Add tests for nonzero very small durations and durations close to the clock resolution.
---------
(cherry picked from commit b70a567575)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>