Commit graph

128774 commits

Author SHA1 Message Date
Miss Islington (bot)
7d074702eb
[3.14] gh-143650: Fix importlib race condition on import failure (GH-143651) (#144662)
gh-143650: Fix importlib race condition on import failure (GH-143651)

Fix a race condition where a thread could receive a partially-initialized
module when another thread's import fails. The race occurs when:

1. Thread 1 starts importing, adds module to sys.modules
2. Thread 2 sees the module in sys.modules via the fast path
3. Thread 1's import fails, removes module from sys.modules
4. Thread 2 returns a stale module reference not in sys.modules

The fix adds verification after the "skip lock" optimization in both Python
and C code paths to check if the module is still in sys.modules. If the
module was removed (due to import failure), we retry the import so the
caller receives the actual exception from the import failure rather than
a stale module reference.
(cherry picked from commit ac8b5b6890)

Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-11 06:06:51 +00:00
Victor Stinner
815f21bda9
[3.14] gh-144490: Test the internal C API in test_cext (#144678)
Backport changes from the main branch.

Test also datetime.h in test_cppext.
2026-02-10 20:04:13 +00:00
Savannah Ostrowski
306049ba3c
[3.14] GH-144552: Clean up tail-call.yml CI (GH-144553) (#144683)
Co-authored-by: Savannah Ostrowski <savannah@python.org>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2026-02-10 20:42:18 +02:00
Hugo van Kemenade
1ae5771cba
[3.14] Bump pre-commit hooks (GH-144576) (#144591)
(cherry picked from commit e682141c49)

Co-authored-by: Savannah Ostrowski <savannah@python.org>
2026-02-10 10:10:20 -08:00
Miss Islington (bot)
befa954efe
[3.14] gh-144629: Add test for the PyFunction_GetAnnotations() function (GH-144630) (#144670)
gh-144629: Add test for the PyFunction_GetAnnotations() function (GH-144630)
(cherry picked from commit cc81707e40)

Co-authored-by: Nybblista <170842536+nybblista@users.noreply.github.com>
2026-02-10 15:05:25 +00:00
Bartosz Sławecki
616e611844
[3.14] gh-144563: Fix remote debugging with duplicate libpython mappings from ctypes (GH-144595) (#144655) 2026-02-10 14:31:49 +00:00
Victor Stinner
8b4210c30e
[3.14] gh-138744: Skip test_dtrace on Windows (#144657)
Co-authored-by: Ken Jin <kenjin@python.org>
2026-02-10 15:30:05 +01:00
Miss Islington (bot)
bcbeff52be
[3.14] Clarify the docs for args in asyncio callbacks (GH-143873) (#144663)
Clarify the docs for `args` in asyncio callbacks (GH-143873)
(cherry picked from commit 40a82abe93)

Co-authored-by: Aarni Koskela <akx@iki.fi>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2026-02-10 13:16:26 +00:00
Miss Islington (bot)
13b3dd0622
[3.14] gh-143543: Fix re-entrant use-after-free in itertools.groupby (GH-143738) (GH-144626)
(cherry picked from commit a91b5c3fb5)

Co-authored-by: VanshAgarwal24036 <148854295+VanshAgarwal24036@users.noreply.github.com>
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2026-02-10 14:01:10 +01:00
Miss Islington (bot)
caab302332
[3.14] gh-144652: Support Windows exit status in support get_signal_name() (GH-144653) (#144658)
gh-144652: Support Windows exit status in support get_signal_name() (GH-144653)

Format Windows exit status as hexadecimal.
(cherry picked from commit b121dc4347)

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-02-10 11:42:26 +00:00
Victor Stinner
2abaf12917
[3.14] gh-144490: Test the internal C API in test_cppext (#144547)
Backport changes from the main branch.
2026-02-10 11:55:57 +01:00
Miss Islington (bot)
3fc48c152b
[3.14] Disable pip version check when upgrading certifi (GH-144632) (#144641)
(cherry picked from commit 80ba4e10f5)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2026-02-10 03:24:17 +00:00
Miss Islington (bot)
2cc0720bdb
[3.14] gh-144492: Fix process_changed_files outputs for reusable-{macos, wasi}.yml (GH-144518) (#144635)
gh-144492: Fix `process_changed_files` outputs for `reusable-{macos, wasi}.yml` (GH-144518)

Fix `process_changed_files` double-processing reusable-{macos, wasi] ending up with incorrect outputs
(cherry picked from commit fd190d1fa1)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2026-02-09 17:57:43 +00:00
Miss Islington (bot)
9cc8e4948c
[3.14] gh-134179: Use sys._clear_internal_caches() at test_cmd_line (GH-134180) (#144631)
gh-134179: Use sys._clear_internal_caches() at test_cmd_line (GH-134180)

Use sys._clear_internal_caches() instead of deprecated sys._clear_type_cache() at test_cmd_line.
(cherry picked from commit dd2da42ea4)

Co-authored-by: alexey semenyuk <alexsemenyuk88@gmail.com>
2026-02-09 15:06:28 +00:00
Miss Islington (bot)
c9646df644
[3.14] gh-119740: Remove obsoleted removal announce for trunc delegation (GH-144622) (GH-144624)
This was done in GH-119743 (3.14).
(cherry picked from commit aa6ed802f2)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2026-02-09 16:04:52 +02:00
Miss Islington (bot)
2e3f0146f2
[3.14] gh-144363: Update bundled libexpat to 2.7.4 (GH-144365) (GH-144499)
(cherry picked from commit d5cb9f6a9b)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2026-02-09 14:21:54 +01:00
Miss Islington (bot)
27baa1cd5d
[3.14] gh-106318: Add examples for str.partition() method (GH-142823) (#144611)
gh-106318: Add examples for str.partition() method (GH-142823)
(cherry picked from commit 432ddd99e2)

Co-authored-by: Adorilson Bezerra <adorilson@gmail.com>
2026-02-08 22:17:46 +00:00
Miss Islington (bot)
2494a90fbc
[3.14] gh-106318: Add example for str.isalnum() (GH-137550) (#144609)
gh-106318: Add example for str.isalnum() (GH-137550)
(cherry picked from commit 3dd7a3c65a)

Co-authored-by: Adorilson Bezerra <adorilson@gmail.com>
2026-02-08 22:14:19 +00:00
Miss Islington (bot)
0cc73ad642
[3.14] For enum.bin, update versionadded directive from 3.10 to 3.11 (GH-144574) (#144588)
For `enum.bin`, update versionadded directive from 3.10 to 3.11 (GH-144574)
(cherry picked from commit d73634935c)

Co-authored-by: Guo Ci <zguoci@gmail.com>
2026-02-08 07:41:33 +00:00
Miss Islington (bot)
626a6bcb31
[3.14] gh-143700: document secrets.DEFAULT_ENTROPY as an opaque value (GH-144568) (#144579)
gh-143700: document `secrets.DEFAULT_ENTROPY` as an opaque value (GH-144568)
(cherry picked from commit 934997218e)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-02-07 22:42:16 +00:00
Miss Islington (bot)
6b9c21cbea
[3.14] gh-142044: Add note to prefer asyncio.timeout[_at] over asyncio.Timeout (GH-144449) (#144565)
gh-142044: Add note to prefer `asyncio.timeout[_at]` over `asyncio.Timeout` (GH-144449)
(cherry picked from commit 0e7c06a858)

Co-authored-by: kovan <xaum.io@gmail.com>
2026-02-07 13:31:29 +01:00
Miss Islington (bot)
470e8f27ee
[3.14] gh-140490: Document changes for PurePath.stem in Python 3.14 (GH-144450) (#144564)
gh-140490: Document changes for `PurePath.stem` in Python 3.14 (GH-144450)
(cherry picked from commit 16efaa225c)

Co-authored-by: kovan <xaum.io@gmail.com>
2026-02-07 12:25:09 +00:00
Miss Islington (bot)
226eb88ff2
[3.14] gh-144538: Upgrade bundled pip to 26.0.1 (gh-144556) (#144562)
gh-144538: Upgrade bundled pip to 26.0.1 (gh-144556)

Upgrade bundled pip to 26.0.1
(cherry picked from commit f4364a51c1)

Co-authored-by: Damian Shaw <damian.peter.shaw@gmail.com>
2026-02-07 14:22:45 +02:00
Miss Islington (bot)
60d4281352
[3.14] gh-144490: Fix C++ compatibility in pycore_cell.h (GH-144482) (GH-144555)
gh-144490: Fix C++ compatibility in pycore_cell.h (GH-144482)
(cherry picked from commit a2495ff1e7)

Co-authored-by: Alper <alperyoney@fb.com>
2026-02-07 03:37:41 +00:00
Ned Batchelder
bdba86ea31
[3.14] Docs: module pages should not link to themselves (GH-144505) (#144542)
Docs: module pages should not link to themselves

A re-application of the same changes as #144505.
2026-02-06 14:06:50 -05:00
Miss Islington (bot)
6006005893
[3.14] gh-144446: Fix some frame object thread-safety issues (gh-144479) (#144546)
Fix thread-safety issues when accessing frame attributes while another
thread is executing the frame:

- Add critical section to frame_repr() to prevent races when accessing
  the frame's code object and line number

- Add _Py_NO_SANITIZE_THREAD to PyUnstable_InterpreterFrame_GetLasti()
  to allow intentional racy reads of instr_ptr.

- Fix take_ownership() to not write to the original frame's f_executable
(cherry picked from commit 5bb3bbb9c6)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2026-02-06 15:25:36 +00:00
Miss Islington (bot)
3fe97357ce
[3.14] gh-141004: Reorganize and reword the 'Useful macros' section (GH-144471) (GH-144541)
- Group the macros
- Roughly order them to put the most important ones first
- Add expansions where it makes sense; especially if there's
  an equivalent in modern C or a common compiler

(cherry picked from commit f85e1170d2)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2026-02-06 12:50:06 +01:00
Victor Stinner
160810de89
[3.14] gh-144330: Initialize classmethod and staticmethod in new (#144498)
gh-144330: Initialize classmethod and staticmethod in new

Initialize cm_callable and sm_callable to None in classmethod and
staticmethod constructor.

Co-authored-by: Aniket Singh Yadav <singhyadavaniket43@gmail.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2026-02-06 10:21:02 +01:00
Miss Islington (bot)
f4239df276
[3.14] gh-140414: add fastpath for current running loop in asyncio.all_tasks (GH-140542) (#144494)
* gh-140414: add fastpath for current running loop in `asyncio.all_tasks` (GH-140542)

Optimize `asyncio.all_tasks()` for the common case where the event loop is running in the current thread by avoiding stop-the-world pauses and locking.

This optimization is already present for `asyncio.current_task()` so we do the same for `asyncio.all_tasks()`.
(cherry picked from commit 95e5d59630)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2026-02-06 08:48:06 +05:30
Miss Islington (bot)
6614a3c30c
[3.14] gh-74955: Document that __all__ must contain strings in normalization form NFKC (GH-144504) (GH-144519)
(cherry picked from commit c81e1843d4)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-02-05 18:12:28 +00:00
Miss Islington (bot)
3e1197e50d
[3.14] gh-144484: Warn users not to use wsgiref in production (#144511)
gh-144484: Warn users not to use wsgiref in production
(cherry picked from commit 7e777c587f)

Co-authored-by: Seth Michael Larson <seth@python.org>
2026-02-05 18:21:31 +02:00
Serhiy Storchaka
2fb9cde118
[3.14] gh-144148: Update the urllib.parse documentation (GH-144497) (GH-144507)
Document urlsplit() as the main parsing function and urlparse() as
an obsolete variant.
(cherry picked from commit 67ddba9aa9)
2026-02-05 17:24:24 +02:00
Miss Islington (bot)
f27896c319
[3.14] gh-141984: Reword and reorganize Subscription (and Slicing) docs (GH-141985) (GH-144476)
(cherry picked from commit e423e0c2cc)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Blaise Pabon <blaise@gmail.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2026-02-05 10:41:32 +01:00
Miss Islington (bot)
48015091a9
[3.14] Itertools recipes: Replace the tabulate() example with running_mean() (gh-144483) (gh-144485) 2026-02-04 20:27:41 +00:00
Miss Islington (bot)
9f5191f8e7
[3.14] gh-106318: Add examples for str.startswith() method (GH-144369) (#144481)
gh-106318: Add examples for `str.startswith()` method (GH-144369)
(cherry picked from commit 1b6d737ee0)

Co-authored-by: Adorilson Bezerra <adorilson@gmail.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2026-02-04 17:23:55 +00:00
Miss Islington (bot)
e3d05d2dd6
[3.14] gh-141004: Document remaining pyport.h utility macros (GH-144279) (GH-144477)
gh-141004: Document remaining `pyport.h` utility macros (GH-144279)
(cherry picked from commit 914fbec214)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-02-04 16:49:41 +00:00
Miss Islington (bot)
fddd858810
[3.14] gh-141444: Replace dead URL in urllib.robotparser example (GH-144443) (#144464)
Co-authored-by: kovan <217326+kovan@users.noreply.github.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 11:36:34 +00:00
Hugo van Kemenade
360214e257 Post 3.14.3 2026-02-03 20:27:58 +02:00
Hugo van Kemenade
323c59a5e3 Python 3.14.3 2026-02-03 17:32:20 +02:00
Miss Islington (bot)
07d080a608
[3.14] gh-127313: Use getLogger() without argument to get root logger in logging cookbook (GH-143683) (GH-144431)
gh-127313: Use getLogger() without argument to get root logger in logging cookbook (GH-143683)

Use getLogger() to get root logger in logging cookbook
(cherry picked from commit 53fecbe6e1)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
2026-02-03 14:55:07 +00:00
Miss Islington (bot)
eb0790f2d7
[3.14] gh-74453: Add stronger security warning to os.path.commonprefix
gh-74453: Add stronger security warning to os.path.commonprefix (GH-144401)
(cherry picked from commit 4e15b8d95d)

Co-authored-by: Seth Michael Larson <seth@python.org>
2026-02-03 14:28:39 +00:00
Miss Islington (bot)
cc8fd6ac43
[3.14] gh-106318: Add examples for str.rindex() method (GH-143887) (#144421)
gh-106318: Add examples for str.rindex() method (GH-143887)
(cherry picked from commit 45d00a0791)

Co-authored-by: Adorilson Bezerra <adorilson@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-02-03 14:36:27 +01:00
Miss Islington (bot)
72ec166846
[3.14] gh-142555: Fix null pointer dereference in array.__setitem__ via re-entrant __index__ (GH-142713) (#144396)
gh-142555: Fix null pointer dereference in array.__setitem__ via re-entrant __index__ (GH-142713)
(cherry picked from commit 39f16a93ef)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
2026-02-03 11:38:50 +01:00
Miss Islington (bot)
5af4e680a9
[3.14] gh-75572: Speed up test_xpickle (GH-144393) (GH-144403)
Run a long living subprocess which handles multiple requests instead of
running a new subprocess for each request.
(cherry picked from commit 29acc08c8d)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-02-03 10:34:16 +00:00
Miss Islington (bot)
b3937135a6
[3.14] gh-144415: Android testbed fixes (GH-142912) (#144416)
Modifies handling of `.gz` files in Android app payloads, and ensures that
when the Android testbed streams logs, stream flushes aren't treated as
newlines. This improves the output of test suites that use "one dot per test"
progress indicators.
(cherry picked from commit cb1dc91dcb)

Co-authored-by: Malcolm Smith <smith@chaquo.com>
2026-02-03 17:18:49 +08:00
Stan Ulbrych
f68d634dfe
[3.14] gh-144376: Only run 'address' fuzzer for python3-libraries (GH-144398) (#144399)
(cherry picked from commit 5f91577cdd)

Co-authored-by: Seth Michael Larson <seth@python.org>
2026-02-02 17:50:33 +01:00
Miss Islington (bot)
8ba2ddb95c
[3.14] gh-144348: annotationlib: fix test that relies on set ordering (GH-144359) (#144375)
gh-144348: annotationlib: fix test that relies on set ordering (GH-144359)
(cherry picked from commit b6256014be)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2026-02-02 15:12:12 +00:00
Miss Islington (bot)
343679ee6a
[3.14] gh-144380: Fix incorrect type check in buffered_iternext() (GH-144381) (#144389)
gh-144380: Fix incorrect type check in `buffered_iternext()` (GH-144381)
(cherry picked from commit 40d07cad38)

Co-authored-by: Ruiyang Ke <me@ry.ke>
2026-02-02 10:30:34 +00:00
Peter Bierma
c766dda80d
[3.14] gh-144277: Fix usage of free-threaded terminology in the documentation (GH-144333) (GH-144385)
(cherry picked from commit 3a0e183556)
2026-02-01 21:01:43 -05:00
Sam Gross
06f9c8ca1c
[3.14] gh-144295: Fix data race in dict method lookup and global load (gh-144312) (#144346)
In `_Py_dict_lookup_threadsafe_stackref`, call `ensure_shared_on_read()` to
prevent a race between the lookup and concurrent dict resizes, which may free
the PyDictKeysObject (i.e., it ensures that the resize uses QSBR).

(cherry picked from commit e666a01ef4)
2026-01-30 12:15:47 -05:00