Commit Graph

122797 Commits

Author SHA1 Message Date
Miss Islington (bot) 927f882d76
[3.13] gh-117657: Fix TSan race in _PyDict_CheckConsistency (GH-121551) (#121590)
The only remaining race in dictobject.c was in _PyDict_CheckConsistency
when the dictionary has shared keys.
(cherry picked from commit 3ec719fabf)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-07-10 18:28:44 +00:00
Miss Islington (bot) 867cf40279
[3.13] gh-121460: Skip freeing unallocated arenas (gh-121589)
`munmap(NULL)` is not noop, like `free(NULL)` is.

Fixes an observed testsuite hang on 32-bit ARM systems.

(cherry picked from commit a802277914, AKA gh-121491)

Co-authored-by: Stefano Rivera <stefano@rivera.za.net>
2024-07-10 17:05:11 +00:00
Miss Islington (bot) 0113c56a20
[3.13] gh-107851: Fix spurious failures in fcntl eintr tests (GH-121556) (#121585)
On heavily loaded machines, the subprocess may finish its sleep before
the parent process manages to synchronize with it via a failed lock.

This leads to errors like:

  Exception: failed to sync child in 300.3 sec

Use pipes instead to mutually synchronize between parent and child.
(cherry picked from commit af9f6de6ea)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-07-10 15:02:26 +00:00
Miss Islington (bot) 0504f45b79
[3.13] gh-89364: Export PySignal_SetWakeupFd() function (GH-121537) (#121582)
gh-89364: Export PySignal_SetWakeupFd() function (GH-121537)

Export the PySignal_SetWakeupFd() function. Previously, the function
was documented but it couldn't be used in 3rd party code.
(cherry picked from commit ca0fb3423c)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-07-10 14:14:09 +00:00
Miss Islington (bot) 8c4728f6af
[3.13] gh-121567: Improve `slice` C-API docs by mentioning exceptions (GH-121568) (#121578)
gh-121567: Improve `slice` C-API docs by mentioning exceptions (GH-121568)
(cherry picked from commit 84a5597b08)

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2024-07-10 11:13:40 +00:00
Miss Islington (bot) ced3fe87b0
[3.13] gh-121571: Do not use `EnvironmentError` in tests, use `OSError` instead (GH-121572) (#121574)
gh-121571: Do not use `EnvironmentError` in tests, use `OSError` instead (GH-121572)
(cherry picked from commit e2822360da)

Co-authored-by: sobolevn <mail@sobolevn.me>
2024-07-10 10:38:48 +00:00
Serhiy Storchaka 35c9399078
[3.13] Improve zipimport tests (GH-121535) (GH-121570)
(cherry picked from commit 22a0bdbf9a)
2024-07-10 13:11:39 +03:00
Miss Islington (bot) a1fc8d31a7
[3.13] GH-121439: Allow PyTupleObjects with an ob_size of 20 in the free_list to be reused (gh-121428) (gh-121565)
GH-121439: Allow PyTupleObjects with an ob_size of 20 in the free_list to be reused (gh-121428)
(cherry picked from commit 9585a1a2a2)

Co-authored-by: satori1995 <132636720+satori1995@users.noreply.github.com>
2024-07-10 08:12:54 +00:00
Miss Islington (bot) 3824dc9fa3
[3.13] GH-121521: Detect when wasmtime is not installed in `Tools/wasm/wasi.py` (GH-121522) (GH-121558)
GH-121521: Detect when wasmtime is not installed in `Tools/wasm/wasi.py` (GH-121522)
(cherry picked from commit f62161837e)

Co-authored-by: Brett Cannon <brett@python.org>
2024-07-09 22:31:39 +00:00
Miss Islington (bot) 20a6341324
[3.13] GH-120372: Switch to wasmtime 22 (GH-121523) (GH-121557)
GH-120372: Switch to wasmtime 22 (GH-121523)

Along the way, make the cache key in GitHub Actions for `config.cache` be more robust in the face of potential env var changes from `Tools/wasm/wasi.py`.
(cherry picked from commit 8020946814)

Co-authored-by: Brett Cannon <brett@python.org>
2024-07-09 22:27:29 +00:00
Miss Islington (bot) eae8fa1178
[3.13] gh-117657: Skip test when running under TSan (GH-121549) (GH-121553)
gh-117657: Skip test when running under TSan (GH-121549)

The ProcessPoolForkserver combined with resource_tracker starts a thread
after forking, which is not supported by TSan.

Also skip test_multiprocessing_fork for the same reason
(cherry picked from commit 04397434aa)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-07-09 21:37:30 +00:00
Miss Islington (bot) 2f15383161
[3.13] gh-112075: Fix dict thread safety issues (GH-119288) (#121545)
(cherry picked from commit f0ed1863bd)

Co-authored-by: Germán Méndez Bravo <kronuz@fb.com>
2024-07-09 18:13:23 +00:00
Miss Islington (bot) f0d16f7e82
[3.13] gh-117657: Fix TSAN races in setobject.c (GH-121511) (#121541)
The `used` field must be written using atomic stores because `set_len`
and iterators may access the field concurrently without holding the
per-object lock.
(cherry picked from commit 9c08f40a61)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-07-09 16:36:36 +00:00
Miss Islington (bot) 8d473d8e57
[3.13] gh-121533: Improve `PyCell_[Get,Set]` docs: mention the exceptions (GH-121534) (#121539)
gh-121533: Improve `PyCell_[Get,Set]` docs: mention the exceptions (GH-121534)
(cherry picked from commit 649d5b6d7b)

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Victor Stinner <vstinner@python.org>
2024-07-09 16:06:46 +00:00
Miss Islington (bot) 3efe02e2c7
[3.13] Docs: fix typo and duplicate word in configure.rst (GH-121410) (#121532)
(cherry picked from commit 9ba2a4638d)

Co-authored-by: Rafael Fontenelle <rffontenelle@users.noreply.github.com>
2024-07-09 12:40:59 +00:00
Miss Islington (bot) 39f4add7a3
[3.13] gh-121333: Clarify what is the default executor for asyncio.run_in_executor (GH-121335) (#121526)
gh-121333: Clarify what is the default executor for asyncio.run_in_executor (GH-121335)
(cherry picked from commit facf9862da)

Co-authored-by: AN Long <aisk@users.noreply.github.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2024-07-09 15:12:45 +05:30
Miss Islington (bot) c1891e225e
[3.13] gh-121110: Fix Extension Module Tests Under Py_TRACE_REFS Builds (gh-121517)
The change in gh-118157 (b2cd54a) should have also updated clear_singlephase_extension() but didn't.  We fix that here.  Note that clear_singlephase_extension() (AKA _PyImport_ClearExtension()) is only used in tests.

(cherry picked from commit 15d48aea02, AKA gh-121503)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2024-07-08 21:34:58 +00:00
Miss Islington (bot) c128718f30
[3.13] gh-121368: Fix seq lock memory ordering in _PyType_Lookup (GH-121388) (#121505)
The `_PySeqLock_EndRead` function needs an acquire fence to ensure that
the load of the sequence happens after any loads within the read side
critical section. The missing fence can trigger bugs on macOS arm64.

Additionally, we need a release fence in `_PySeqLock_LockWrite` to
ensure that the sequence update is visible before any modifications to
the cache entry.
(cherry picked from commit 1d3cf79a50)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-07-08 19:15:58 +00:00
Miss Islington (bot) eef5c6443b
[3.13] gh-121487: Fix deprecation warning for ATOMIC_VAR_INIT in mimalloc (gh-121488) (#121504)
(cherry picked from commit 31873bea47)

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
2024-07-08 18:59:25 +00:00
Miss Islington (bot) 2f8919ee3c
[3.13] GH-121012: Set index to -1 when list iterators become exhausted in tier 2 (GH-121483) (GH-121494) 2024-07-08 18:09:54 +01:00
Miss Islington (bot) bccfd8a53f
[3.13] gh-121374: Correct docstrings in `_interpchannels` (gh-121501)
(cherry picked from commit 5289550b33, AKA gh-121418)

Co-authored-by: Max Muoto <maxmuoto@gmail.com>
2024-07-08 16:57:10 +00:00
Miss Islington (bot) 0790418a04
[3.13] gh-121338: Remove GH-pragma optimize (GH-121340) (#121492)
gh-121338: Remove GH-pragma optimize (GH-121340)
(cherry picked from commit d69529d31c)

Co-authored-by: Michael Droettboom <mdboom@gmail.com>
2024-07-08 09:22:44 -04:00
Miss Islington (bot) 0f5ca64596
Fixed regenerating files in a checkout path with spaces (GH-121384)
(cherry picked from commit 0e77540d86)

Co-authored-by: AraHaan <seandhunt_7@yahoo.com>
2024-07-08 13:18:02 +01:00
Miss Islington (bot) 3e786a462c
[3.13] gh-108297: Update crashers README for test_crashers removal (#121476)
Update Lib/test/crashers/README for test_crashers removal
(cherry picked from commit 59be79ae60)

Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
2024-07-08 16:54:51 +10:00
Miss Islington (bot) 2c3f30ba25
[3.13] gh-121461: Fix os.path.normpath documentation indentation (GH-121466) (#121472)
gh-121461: Fix os.path.normpath documentation indentation (GH-121466)
(cherry picked from commit bf74db731b)

Co-authored-by: CBerJun <121291537+CBerJun@users.noreply.github.com>
2024-07-08 04:08:13 +00:00
Miss Islington (bot) 78437b74ad
[3.13] gh-121467: Fix makefile to include mimalloc headers (GH-121469) (#121471)
gh-121467: Fix makefile to include mimalloc headers (GH-121469)
(cherry picked from commit 5aa1e60e0c)

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
2024-07-08 01:10:17 +00:00
Miss Islington (bot) 2b02431dd1
[3.13] gh-121351: Skip test_not_wiping_history_file() if no readline (GH-121422) (#121449)
gh-121351: Skip test_not_wiping_history_file() if no readline (GH-121422)
(cherry picked from commit 68e279b37a)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2024-07-06 23:18:20 +00:00
Miss Islington (bot) c2ad5fd1d1
[3.13] gh-119909: Fix ``NameError`` in ``asyncio`` REPL (GH-121341) (#121447)
gh-119909: Fix ``NameError`` in ``asyncio`` REPL (GH-121341)
(cherry picked from commit 114389470e)

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2024-07-07 01:02:33 +02:00
Miss Islington (bot) 29618b52ff
[3.13] Regen ``Doc/requirements-oldest-sphinx.txt`` (GH-121437) (#121441)
Regen ``Doc/requirements-oldest-sphinx.txt`` (GH-121437)

regen dependencies
(cherry picked from commit 53e12025cd)

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2024-07-06 18:23:31 +00:00
Miss Islington (bot) aae49ec595
[3.13] [docs] fix a Sphinx directive in `c-api/object.rst` (GH-121430) (#121440)
[docs] fix a Sphinx directive in `c-api/object.rst` (GH-121430)
(cherry picked from commit ada964fba0)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-07-06 18:13:57 +00:00
Miss Islington (bot) 4aa0c5ec34
[3.13] gh-121359: Run test_pyrepl in isolated mode (GH-121414) (#121417)
gh-121359: Run test_pyrepl in isolated mode (GH-121414)

run_repl() now pass the -I option (isolated mode) to Python if the
'env' parameter is not set.
(cherry picked from commit 6239d41527)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-07-05 20:55:14 +00:00
Miss Islington (bot) bc4cd91aef
[3.13] Update example of str.split, bytes.split (GH-121287) (#121415)
Update example of str.split, bytes.split (GH-121287)

In `{str,bytes}.strip(chars)`, multiple characters are not treated as a
prefix/suffix, but as individual characters. This may make users confuse
whether `split` has similar behavior.
Users may incorrectly expect that
`'Good morning, John.'.split(', .') == ['Good', 'morning', 'John']`

Adding a bit of clarification in the doc.

(cherry picked from commit 892e3a1b70)

Co-authored-by: Yuxin Wu <ppwwyyxxc@gmail.com>
Co-authored-by: Yuxin Wu <ppwwyyxx@users.noreply.github.com>
2024-07-05 20:25:35 +00:00
Miss Islington (bot) 3c3f9a209f
[3.13] gh-90437: Fix __main__.py documentation wording (GH-116309) (#121385)
gh-90437: Fix __main__.py documentation wording (GH-116309)
(cherry picked from commit cb688bab08)

Co-authored-by: Ali Tavallaie <tavallaie@users.noreply.github.com>
Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: Frank Dana <ferdnyc@gmail.com>
2024-07-04 23:05:02 +00:00
Miss Islington (bot) abefbcba8a
[3.13] gh-121084: Fix test_typing random leaks (GH-121360) (#121373)
gh-121084: Fix test_typing random leaks (GH-121360)

Clear typing ABC caches when running tests for refleaks (-R option):
call _abc_caches_clear() on typing abstract classes and their
subclasses.
(cherry picked from commit 5f660e8e2c)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-07-04 18:07:07 +00:00
Miss Islington (bot) 273c993b06
[3.13] gh-106597: Remove unnecessary CFrame offsets (GH-121369) (#121370)
gh-106597: Remove unnecessary CFrame offsets (GH-121369)
(cherry picked from commit f5c8d67de6)

Co-authored-by: Gabriele N. Tornetta <P403n1x87@users.noreply.github.com>
2024-07-04 17:52:03 +00:00
Steve Dower 868e9ab031
gh-118507: Amend news entry to mention ntpath.isfile bugfix (GH-120817) 2024-07-04 15:15:22 +00:00
Miss Islington (bot) 77ced7601c
[3.13] gh-121355: Fix incorrect word in simple_stmts.rst (GH-121356) (#121362)
(cherry picked from commit 715ec630dd)

Co-authored-by: Jongbum Won <71166964+Wondaeng@users.noreply.github.com>
2024-07-04 13:53:41 +00:00
Miss Islington (bot) 678fb82cd5
[3.13] gh-121201: Disable perf_trampoline on riscv64 for now (GH-121328) (#121336)
gh-121201: Disable perf_trampoline on riscv64 for now (GH-121328)

Disable perf_trampoline on riscv64 for now

Until support is added in perf_jit_trampoline.c

gh-120089 was incomplete.
(cherry picked from commit ca2e876500)

Co-authored-by: Stefano Rivera <stefano@rivera.za.net>
2024-07-04 08:57:52 +00:00
Miss Islington (bot) 65ed1b7429
[3.13] gh-117983: Defer import of threading for lazy module loading (GH-120233) (GH-121349)
gh-117983: Defer import of threading for lazy module loading (GH-120233)

As noted in gh-117983, the import importlib.util can be triggered at
interpreter startup under some circumstances, so adding threading makes
it a potentially obligatory load.
Lazy loading is not used in the stdlib, so this removes an unnecessary
load for the majority of users and slightly increases the cost of the
first lazily loaded module.

An obligatory threading load breaks gevent, which monkeypatches the
stdlib. Although unsupported, there doesn't seem to be an offsetting
benefit to breaking their use case.

For reference, here are benchmarks for the current main branch:

```
❯ hyperfine -w 8 './python -c "import importlib.util"'
Benchmark 1: ./python -c "import importlib.util"
  Time (mean ± σ):       9.7 ms ±   0.7 ms    [User: 7.7 ms, System: 1.8 ms]
  Range (min … max):     8.4 ms …  13.1 ms    313 runs
```

And with this patch:

```
❯ hyperfine -w 8 './python -c "import importlib.util"'
Benchmark 1: ./python -c "import importlib.util"
  Time (mean ± σ):       8.4 ms ±   0.7 ms    [User: 6.8 ms, System: 1.4 ms]
  Range (min … max):     7.2 ms …  11.7 ms    352 runs
```

Compare to:

```
❯ hyperfine -w 8 './python -c pass'
Benchmark 1: ./python -c pass
  Time (mean ± σ):       7.6 ms ±   0.6 ms    [User: 5.9 ms, System: 1.6 ms]
  Range (min … max):     6.7 ms …  11.3 ms    390 runs
```

This roughly halves the import time of importlib.util.
(cherry picked from commit 94f50f8ee6)

Co-authored-by: Chris Markiewicz <effigies@gmail.com>
2024-07-03 21:14:42 +00:00
Miss Islington (bot) e7008d78f3
[3.13] gh-118714: Make the pdb post-mortem restart/quit behavior more reasonable (GH-118725) (#121346)
gh-118714: Make the pdb post-mortem restart/quit behavior more reasonable (GH-118725)
(cherry picked from commit e245ed7d1e)

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
2024-07-03 12:15:53 -07:00
Miss Islington (bot) 3d4e533be5
[3.13] gh-112136: Restore removed _PyArg_Parser (GH-121262) (#121344)
gh-112136: Restore removed _PyArg_Parser (GH-121262)

Restore the private _PyArg_Parser structure and the private
_PyArg_ParseTupleAndKeywordsFast() function, previously removed
in Python 3.13 alpha 1.

Recreate Include/cpython/modsupport.h header file.
(cherry picked from commit f8373db153)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-07-03 18:29:00 +00:00
Miss Islington (bot) 8799f0537b
[3.13] gh-121300: Add `replace` to `copy.__all__` (GH-121302) (#121337)
(cherry picked from commit 7c66906802)

Co-authored-by: Max Muoto <maxmuoto@gmail.com>
2024-07-03 15:28:57 +00:00
Vinay Sajip 253c033251
[3.13] gh-121035: Update PNG image for logging flow diagram. (GH-121323) (GH-121324)
(cherry picked from commit 26d24eeb90)
2024-07-03 13:01:34 +01:00
Victor Stinner ec0f801a72
[3.13] gh-121279: Fix importlib DeprecatedAttrsTests (#121319)
Delete attributes after getting them, so the warning is emitted again
when the test is run multiple times (ex: when checking for reference
leaks).
2024-07-03 13:57:05 +02:00
Miss Islington (bot) 251667340e
[3.13] gh-121245: a regression test for site.register_readline() (GH-121259) (#121322) 2024-07-03 11:11:41 +00:00
Vinay Sajip 3302c5f155
[3.13] gh-121035: Further improve logging flow diagram with respect to dark/light modes. (GH-121265) (GH-121320)
[3.13] gh-121035: Further improve logging flow diagram with respect to dark/light modes. (GH-121265)
(cherry picked from commit 089835469d)
2024-07-03 11:41:18 +01:00
Vinay Sajip b62605d50f
[3.13] gh-121035: Improve logging flow diagram for dark/light modes. (GH-121254) (GH-121317)
(cherry picked from commit bfe0e4d769)
2024-07-03 11:01:50 +01:00
Miss Islington (bot) d3e586e652
[3.13] gh-106597: Add more offsets to _Py_DebugOffsets (GH-121311) (#121312)
gh-106597: Add more offsets to _Py_DebugOffsets (GH-121311)

Add more offsets to _Py_DebugOffsets

We add a few more offsets that are required by some out-of-process
tools, such as [Austin](https://github.com/p403n1x87/austin).
(cherry picked from commit c9bdfbe868)

Co-authored-by: Gabriele N. Tornetta <P403n1x87@users.noreply.github.com>
2024-07-03 09:18:15 +00:00
Miro Hrončok dacf4ffa79
[3.13] gh-121279: Re-add prematurely removed import warnings to importlib.abc (#121281)
Fixup for 51724620e8

Fixes https://github.com/python/cpython/issues/121279
2024-07-03 11:06:20 +02:00
Miss Islington (bot) ee1db25bc0
[3.13] docs: Fix "Py_TPFLAGS_MANAGED_WEAKREF is set in tp_flags" (GH-112237) (#121309)
docs: Fix "Py_TPFLAGS_MANAGED_WEAKREF is set in tp_flags" (GH-112237)
(cherry picked from commit 4232976b02)

Co-authored-by: da-woods <dw-git@d-woods.co.uk>
2024-07-03 08:23:51 +00:00