Commit graph

124748 commits

Author SHA1 Message Date
Gregory P. Smith
9face218e7
[3.13] gh-87135: Hang non-main threads that attempt to acquire the GIL during finalization (GH-105805) (GH-137827)
* [3.13] gh-87135: Hang non-main threads that attempt to acquire the GIL during finalization (GH-105805)

Instead of surprise crashes and memory corruption, we now hang threads that attempt to re-enter the Python interpreter after Python runtime finalization has started. These are typically daemon threads (our long standing mis-feature) but could also be threads spawned by extension modules that then try to call into Python. This marks the `PyThread_exit_thread` public C API as deprecated as there is no plausible safe way to accomplish that on any supported platform in the face of things like C++ code with finalizers anywhere on a thread's stack. Doing this was the least bad option.

(cherry picked from commit 8cc5aa47ee)

Co-authored-by: Jeremy Maitin-Shepard <jeremy@jeremyms.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>

* state "3.13.7 and earlier"
* backport: do not add the deprecated marker
* fix Py_IsFinalizing doc ref

---------

Co-authored-by: Jeremy Maitin-Shepard <jeremy@jeremyms.com>
2025-08-17 09:08:14 -07:00
Miss Islington (bot)
f2b7954ce0
[3.13] gh-135661: Fix parsing unterminated bogus comments in HTMLParser (GH-137873) (GH-137875)
Bogus comments that start with "<![CDATA[" should not include the starting "!"
in its value.
(cherry picked from commit 7636a66635)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-08-17 10:59:24 +00:00
Miss Islington (bot)
133f7bd22b
[3.13] gh-137846: Add missing 'be' to profile doc. (GH-137856) (#137858)
gh-137846: Add missing 'be' to profile doc. (GH-137856)

Insert 'be' into 'will interpreted'.
(cherry picked from commit 3663b2ad54)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2025-08-16 10:56:21 -04:00
Miss Islington (bot)
33a3f5e458
[3.13] gh-90483: fix docs of SubprocessTransport.get_pipe_transport (GH-137852) (#137854)
gh-90483: fix docs of `SubprocessTransport.get_pipe_transport ` (GH-137852)
(cherry picked from commit 038a6e3b95)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-08-16 11:17:55 +00:00
Miss Islington (bot)
7f18b0e45d
[3.13] gh-101359: clarify docs for asyncio.Event.clear (GH-137849) (#137851)
gh-101359: clarify docs for `asyncio.Event.clear` (GH-137849)
(cherry picked from commit 4b2dbe8e0a)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-08-16 16:29:26 +05:30
Miss Islington (bot)
8d6e1075da
[3.13] gh-131178: Add tests for site command-line interface (GH-133582) (GH-137833)
gh-131178: Add tests for `site` command-line interface  (GH-133582)
(cherry picked from commit 03f5519d77)

Co-authored-by: ggqlq <124190229+ggqlq@users.noreply.github.com>
2025-08-15 18:22:46 +00:00
Miss Islington (bot)
83e4b43626
[3.13] gh-137777: Disband the 'Program Frameworks' chapter (GH-137796) (#137831)
Co-authored-by: rimchoi <hyerimc858@gmail.com>
2025-08-15 17:50:47 +00:00
Jason R. Coombs
0607fdd56c
[3.13] gh-123085: Fix issue in inferred caller when resource package has no source (GH-123102) (#124024) 2025-08-15 14:21:16 +00:00
Miss Islington (bot)
2c614a8264
[3.13] Mention the "context manager" keyword in concurrent.futures documentation (GH-130976) (#137811)
Mention the "context manager" keyword in concurrent.futures documentation (GH-130976)
(cherry picked from commit 095bc775ec)

Co-authored-by: Jakub Stasiak <jakub@stasiak.at>
2025-08-15 19:41:04 +05:30
Miss Islington (bot)
929a77cfce
[3.13] gh-137760: Update REPL constants documentation (gh-137798) (gh-137823)
gh-137760: Update REPL constants documentation (gh-137798)
(cherry picked from commit d6719c6be6)

Co-authored-by: Chaemin-Lim <antraxmin@naver.com>
2025-08-15 13:59:18 +00:00
adam j hartz
5131b8fe7e
[3.13] gh-137576: Fix for Basic REPL showing incorrect code in tracebacks with PYTHONSTARTUP (GH-137625) (#137778)
(cherry picked from commit 04f8ef663b)

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2025-08-15 12:10:39 +03:00
Miss Islington (bot)
785b396719
[3.13] gh-134262: Catch both URLError and ConnectionError in retries (GH-135365) (#137779)
gh-134262: Catch both URLError and ConnectionError in retries (GH-135365)
(cherry picked from commit acc20a83f4)

Co-authored-by: Emma Smith <emma@emmatyping.dev>
2025-08-14 12:56:42 -07:00
Miss Islington (bot)
4c29fc2b02
[3.13] gh-134262: Fix off by one errors in download retry functions (GH-137775)
(cherry picked from commit e64395e8eb)

Co-authored-by: Emma Smith <emma@emmatyping.dev>
2025-08-14 19:01:13 +00:00
Miss Islington (bot)
a33596765b
[3.13] gh-135661: Fix CDATA section parsing in HTMLParser (GH-135665) (GH-137773)
"] ]>" and "]] >" no longer end the CDATA section.

Make CDATA section parsing  context depending.
Add private method HTMLParser._set_support_cdata() to change the context.
If called with True, "<[CDATA[" starts a CDATA section which ends with "]]>".
If called with False, "<[CDATA[" starts a bogus comments which ends with ">".
(cherry picked from commit 0cbbfc4621)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-08-14 21:44:16 +03:00
Thomas Wouters
46b2577b42 Merge branch '3.13' of https://github.com/python/cpython into 3.13 2025-08-14 20:13:46 +02:00
Thomas Wouters
470091376e Post 3.13.7 2025-08-14 20:13:25 +02:00
Miss Islington (bot)
e0ae4cbfc7
[3.13] gh-109975: Indicate the minimum version for PyREPL in the tutorial (GH-136046) (#137767)
Co-authored-by: Konstantin Morenko <konstantin-morenko@users.noreply.github.com>
2025-08-14 17:08:14 +01:00
Thomas Wouters
bcee1c3221 Python 3.13.7 2025-08-14 13:12:11 +02:00
Miss Islington (bot)
d22276dc7d
[3.13] gh-131788: make resource_tracker re-entrant safe (GH-131787) (#137738)
gh-131788: make resource_tracker re-entrant safe (GH-131787)
(cherry picked from commit f24a012350)

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>
2025-08-14 12:52:30 +02:00
Miss Islington (bot)
9417ea5941
[3.13] gh-87281: Improve documentation for locale.setlocale() and locale.getlocale() (GH-137313) (GH-137723)
Add a section explaining the locale name formats.
(cherry picked from commit 15ab45775c)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-08-13 21:11:25 +03:00
Serhiy Storchaka
3a74d52584
[3.13] gh-137668: Document that ord() supports also bytes and bytearray (GH-137669) (GH-137704)
(cherry picked from commit 35759fe2fa)
2025-08-13 09:37:15 +00:00
sobolevn
165532ccdb
[3.13] gh-133403: Run mypy on Tools/build/mypy.ini changes (GH-137692) (#137699)
(cherry picked from commit e93dca7223)
2025-08-13 06:18:29 +00:00
sobolevn
5e48662726
[3.13] gh-133403: Check generate_stdlib_module_names and check_extension_modules with mypy (GH-137546) (#137691)
(cherry picked from commit 68a61b0f1d)
2025-08-13 08:47:48 +03:00
Hugo van Kemenade
30194914c2
[3.13] gh-137242: Add Android CI job (GH-137186) (#137684)
(cherry picked from commit f660ec3753)

Co-authored-by: Malcolm Smith <smith@chaquo.com>
Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>
2025-08-13 06:00:20 +08:00
Miss Islington (bot)
85637f0bd9
[3.13] gh-136672: Docs: Move Enum functions and add examples (GH-136791) (#137689)
Co-authored-by: RafaelWO <38643099+RafaelWO@users.noreply.github.com>
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2025-08-12 21:27:50 +01:00
🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко)
5d64571b43
[3.13] Update pre-commit hooks (GH-137591) (GH-137641)
(cherry picked from commit b36d23f58e)

Co-authored-by: Malcolm Smith <smith@chaquo.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-08-12 13:42:55 +02:00
Miss Islington (bot)
4a630d7b29
[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 027cacb67c)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-08-12 05:17:24 +00:00
Peter Bierma
da39cb9716
[3.13] gh-137583: Only lock the SSL context, not the SSL socket (GH-137588) (GH-137613)
Fixes a deadlock introduced in 3.13.6.

(cherry picked from commit 55788a9096)
2025-08-11 22:05:13 -04:00
Miss Islington (bot)
c1e1c880ee
[3.13] gh-131885: Use positional-only markers for `max() and min()` (GH-131868) (#137657)
Co-authored-by: Evan Kohilas <ekohilas@users.noreply.github.com>
2025-08-11 23:37:52 +00:00
Miss Islington (bot)
8531f5b52a
[3.13] gh-125897: Mark range function parameters as positional only (GH-125945) (#137653)
Co-authored-by: Konstantin Baikov <konstantin.baikov@gmail.com>
2025-08-12 00:26:02 +01:00
Sam Gross
e236568c0e
[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 362692852f)
2025-08-11 16:07:21 +00:00
Miss Islington (bot)
63a9494878
[3.13] Add test for opening an SQLite with bytes path (GH-136331) (GH-137633)
Add test for opening an SQLite with bytes path (GH-136331)
(cherry picked from commit 1bde13b0e9)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-08-11 16:04:54 +03:00
Miss Islington (bot)
0c8c7fb2dc
[3.13] Fix documentation of hash in PyHash_FuncDef (GH-137595) (#137643)
Fix documentation of hash in PyHash_FuncDef (GH-137595)

Because of a small typo, it wasn't showing up in the generated docs.
(cherry picked from commit 70218b4008)

Co-authored-by: da-woods <dw-git@d-woods.co.uk>
2025-08-11 11:25:13 +00:00
Miss Islington (bot)
23b7a95f41
[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.

Also, added a special case for functools.cached_property().
(cherry picked from commit fece15d29f)

Co-authored-by: Denis Laxalde <denis@laxalde.org>
2025-08-10 20:05:28 +00:00
Miss Islington (bot)
a64c9488ac
[3.13] gh-137499: Fixed dead link to NIST website (GH-137500) (#137501)
Co-authored-by: tobiasjcat <70606111+tobiasjcat@users.noreply.github.com>
Co-authored-by: Senthil Kumaran <senthil@python.org>
2025-08-09 13:42:25 +01:00
Miss Islington (bot)
ddf951c616
[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.

* Update language comparing await and yield from.

* - Remove await-ing Tasks and futures section

* Update Doc/howto/a-conceptual-overview-of-asyncio.rst



* Update Doc/howto/a-conceptual-overview-of-asyncio.rst



* - Address comments related to style & writing flow.

* per-thread event loop note.

* Add section describing coroutines roots in generators.

* Phrasing tweak.

* Use asyncio.create_task instead of asyncio.Task

* Update Doc/howto/a-conceptual-overview-of-asyncio.rst



* Update Doc/howto/a-conceptual-overview-of-asyncio.rst



* small phrasing.

* Update Doc/howto/a-conceptual-overview-of-asyncio.rst



* phrasing nit.

* style nits

* Update Doc/howto/a-conceptual-overview-of-asyncio.rst



* phrasing nit

* Fix misnaming of async generator.

* phrasing nits.

* Update Doc/howto/a-conceptual-overview-of-asyncio.rst



* Update Doc/howto/a-conceptual-overview-of-asyncio.rst



* consistent spacing

* Update Doc/howto/a-conceptual-overview-of-asyncio.rst



* phrasing nits

* Update Doc/howto/a-conceptual-overview-of-asyncio.rst



* Update Doc/howto/a-conceptual-overview-of-asyncio.rst



* Update Doc/howto/a-conceptual-overview-of-asyncio.rst



* Update Doc/howto/a-conceptual-overview-of-asyncio.rst



* add conclusion

* nits

* - Variety of style & grammar improvements thanks to ZeroIntensity's comments.

* - Make all directives start with a 3 space indent. Then 4 thereafter.

* - Use :linenos: instead of manually writing the line numbers.

* - Fix label typo for article.

* fix label link.

* Apply suggestions from code review





* - introduce async-sleep name

* Phrasing

* nit

* ungendered octopus

* teammates

* jobs

* rework fella to penguin

* - remove byline; add seealso

* Change ref from asyncio to use seealso block.

* Remove typehints. Fix indentation in one code example.

* Slight rephrase for clarity.

* Make references point to asyncio. Wrap some long lines.

* - Variety of style/phrasing improvements based on PR feedback.

* phrasing.

* phrasing nit.

* Apply suggestions from code review



* Update Doc/howto/a-conceptual-overview-of-asyncio.rst



* nit

* Apply suggestions from code review



* fix backticks.

* nits

* nit

* add section on asyncio.run

* title change under the hood.

* modify task coro example.

* howtos article link.

* prefer await without backticks.

* phrasing tweak.

* Rework phrasing around how await tasks pauses and returns control in the await section.

* move code block to beforfe explanation in coroutine under the hood.

* phrasing.

* link to yield from.

* style nits

* nit

* - Modify language re: event-loop cycling endlessly.
- Discuss why await was designed to not yield for coros.

* - Add a note about debug=True on asyncio.run to await coro section.

* clarity nit

* - Add two other references in seealso block.

* nit

* Language simplification

* Apply suggestions from code review



* nit

* grammar fix.

* fix

* worker bees

* rework event loop paragraph to significantly deemphasize queues

* remove all references to queue besides the initial analogy.

* add note about garbage collection of tasks

* add practical note re: garbage collection

* phrasing nits

* re arrange note on task gc.

* line wrap nit

* Update Doc/howto/a-conceptual-overview-of-asyncio.rst



* link to debug mode docs.

* readd part2 prefix.

* simplify title.

* fix titles. tihnk I messed this up earlier.

* avoid idiom in title.

* fix titles once agian.

* Apply suggestions from code review



* rework task gc example.

* phrasing tweak.

* tewak.

* nit

* nit

* nit

* nit

---------
(cherry picked from commit 3964f97489)

Co-authored-by: Alexander Nordin <alexander.f.nordin@gmail.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-08-09 05:35:38 +00:00
Hugo van Kemenade
aa4525fc45
[3.13] Fix typo in Doc/extending/extending.rst (GH-136890) (#137561)
Co-authored-by: Cornelius Roemer <cornelius.roemer@gmail.com>
2025-08-08 16:29:36 +00:00
Miss Islington (bot)
05292462b6
[3.13] gh-136155: Docs: check for EPUB fatal errors in CI (GH-134074) (#137538)
Co-authored-by: Maciej Olko <maciej.olko@affirm.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-08-08 19:05:24 +03:00
Miss Islington (bot)
74c3805cef
[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 64ee1babfb)

Co-authored-by: Tom Forbes <tom@tomforb.es>
2025-08-08 14:08:01 +00:00
Miss Islington (bot)
5c055cd8f6
[3.13] Bump mypy to 1.17.1 (GH-137542) (#137544)
Bump mypy to 1.17.1 (GH-137542)
(cherry picked from commit fb1cb00030)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-08-08 07:37:24 +00:00
Miss Islington (bot)
3491368f22
[3.13] [Doc] Remove unnecessary quotes from typing module (GH-137207) (#137540)
[Doc] Remove unnecessary quotes from typing module (GH-137207)

* gh-106320: Remove private _PyInterpreterState functions (GH-106335)

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.

* Doc: minor change

* Revert "Doc: minor change"

This reverts commit ebfa0937c2.

* [Doc] Remove unnecessary quotes from typing (See Also section)

* [Doc] Remove unnecessary quotes from typing

---------
(cherry picked from commit f06fcb7f4b)

Co-authored-by: Adorilson Bezerra <adorilson@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-08-08 02:21:21 +00:00
Miss Islington (bot)
f565c0961a
[3.13] gh-130102: drop "require numeric arguments" from pow() docs (GH-137456) (#137537)
gh-130102: drop "require numeric arguments" from pow() docs (GH-137456)
(cherry picked from commit 37b5a0d671)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Senthil Kumaran <senthil@python.org>
2025-08-07 18:25:24 -07:00
Miss Islington (bot)
4ad360353f
[3.13] gh-137412: fix default_builtin_hashes values in test_hashlib.py (GH-137413) (#137535)
gh-137412: fix `default_builtin_hashes` values in `test_hashlib.py` (GH-137413)

fix `default_builtin_hashes` in test_hashlib
(cherry picked from commit deb385a143)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-08-07 22:54:27 +00:00
Guilherme Leobas
16cebe69a8
[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.

(cherry picked from commit 5be872350d)
2025-08-08 00:29:45 +03:00
Miss Islington (bot)
d1d543fb1e
[3.13] gh-137526: Fix broken link to drdobbs journal in difflib.rst (GH-137527) (#137532)
gh-137526: Fix broken link to drdobbs journal in difflib.rst (GH-137527)
(cherry picked from commit 244c7b8c4c)

Co-authored-by: Sebastien Williams-Wynn <s.williamswynn.mail@gmail.com>
2025-08-07 19:42:04 +00:00
Miss Islington (bot)
599454e65d
[3.13] gh-137440: Update comment in Python/hamt.c on importing for testing (GH-137441) (GH-137520)
gh-137440: Update comment in Python/hamt.c on importing for testing (GH-137441)

Switch from `_testcapi` to `_testinternalcapi`.
(cherry picked from commit 7ab68cd506)

Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
2025-08-07 16:54:52 +00:00
Miss Islington (bot)
8905f7a99b
[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 baefaa6cba)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-08-07 09:37:02 +00:00
Emma Smith
751a890f16
[3.13] gh-134262: increase retries in Tools/build/generate_sbom.py … (#137496)
[3.13] gh-134262: increase retries in `Tools/build/generate_sbom.py` (GH-134558)
(cherry picked from commit 3f9eb55e09)
2025-08-07 07:17:28 +03:00
Emma Smith
7762de2527
[3.13] gh-134262: Add retries to generate_sbom.py (GH-134263) (#137468)
(cherry picked from commit 0c5a8b0b55)

Co-authored-by: Semyon Moroz <donbarbos@proton.me>
2025-08-06 15:58:08 -07:00
Miss Islington (bot)
b772427902
[3.13] Docs: Small clarity change for `except*` (GH-121073) (#137495)
Co-authored-by: Greg Stein <gstein@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-08-06 22:04:15 +00:00