Commit Graph

122993 Commits

Author SHA1 Message Date
Miss Islington (bot) 5b718e7fc7
[3.13] gh-121790: Fix interactive console initialization (GH-121793) (GH-121822)
(cherry picked from commit e5c7216f37)

Co-authored-by: Milan Oberkirch <milan.oberkirch@geops.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-07-16 00:49:41 +02:00
Miss Islington (bot) 0794220a69
[3.13] gh-121794: Don't set `ob_tid` to zero in fast-path dealloc (GH-121799) (#121821)
We should maintain the invariant that a zero `ob_tid` implies the
refcount fields are merged.

* Move the assignment in `_Py_MergeZeroLocalRefcount` to immediately
  before the refcount merge.
* Update `_PyTrash_thread_destroy_chain` to set `ob_ref_shared` to
  `_Py_REF_MERGED` when setting `ob_tid` to zero.

Also check this invariant with assertions in the GC in debug builds.
That uncovered a bug when running out of memory during GC.
(cherry picked from commit d23be3947c)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-07-15 22:15:23 +00:00
Miss Islington (bot) 6396c77571
[3.13] gh-117657: Skip tests that fork with threads under TSan (GH-121599) (#121819)
This avoids messages like:

  ThreadSanitizer: starting new threads after multi-threaded fork is not
  supported. Dying (set die_after_fork=0 to override)
(cherry picked from commit 82a4dac9f6)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-07-15 21:10:37 +00:00
Miss Islington (bot) 0a634e3702
[3.13] gh-121546: Disable contextvar caching on free-threading build (GH-121740) (#121808)
gh-121546: Disable contextvar caching on free-threading build (GH-121740)
(cherry picked from commit e904300882)

Co-authored-by: Ken Jin <kenjin@python.org>
2024-07-15 16:53:52 -04:00
Miss Islington (bot) b506de4eb5
[3.13] gh-121245: Refactor site.register_readline() (GH-121659) (GH-121816)
(cherry picked from commit 05d413764c)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-07-15 22:49:18 +02:00
Miss Islington (bot) 2ee2bfe617
[3.13] gh-121359: make clean environment (no PYTHON* vars) for test_pyrepl.TestMain (GH-121672) (GH-121810)
(cherry picked from commit fd085a411e)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-07-15 22:32:28 +02:00
Miss Islington (bot) 835f4add60
[3.13] gh-76785: Expand How Interpreter Channels Handle Interpreter Finalization (gh-121811)
See 6b98b274b6 for an explanation of the problem and solution.  Here I've applied the solution to channels.

(cherry picked from commit 8b209fd4f8, AKA gh-121805)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2024-07-15 20:15:47 +00:00
Kirill Podoprigora c4daec4319
[3.13] gh-121657: Display correct error message for yield from outsid… (GH-121768)
(cherry picked from commit 178e44de8f)

Co-authored-by: Gregor <36135323+gege-hoho@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-07-15 21:25:54 +02:00
Miss Islington (bot) f19ccfdae0
[3.13] gh-76785: Expand How Interpreter Queues Handle Interpreter Finalization (gh-121807)
Any cross-interpreter mechanism for passing objects between interpreters must be very careful to respect isolation, even when the object is effectively immutable (e.g. int, str).  Here this especially relates to when an interpreter sends one of its objects, and then is destroyed while the inter-interpreter machinery (e.g. queue) still holds a reference to the object.

When I added interpreters.Queue, I dealt with that case (using an atexit hook) by silently removing all items from the queue that were added by the finalizing interpreter.

Later, while working on concurrent.futures.InterpreterPoolExecutor (gh-116430), I noticed it was somewhat surprising when items were silently removed from the queue when the originating interpreter was destroyed.  (See my comment on that PR.)
 It took me a little while to realize what was going on.  I expect that users, which much less context than I have, would experience the same pain.

My approach, here, to improving the situation is to give users three options:

1. return a singleton (interpreters.queues.UNBOUND) from Queue.get() in place of each removed item
2. raise an exception (interpreters.queues.ItemInterpreterDestroyed) from Queue.get() in place of each removed item
3. existing behavior: silently remove each item (i.e. Queue.get() skips each one)

The default will now be (1), but users can still explicitly opt in any of them, including to the silent removal behavior.

The behavior for each item may be set with the corresponding Queue.put() call. and a queue-wide default may be set when the queue is created.  (This is the same as I did for "synconly".)

(cherry picked from commit 6b98b274b6, AKA gh-116431)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2024-07-15 19:13:51 +00:00
Miss Islington (bot) ff65d1e054
[3.13] gh-118297: Make Sure All Pending Calls Run in _Py_FinishPendingCalls() (gh-121806)
(cherry picked from commit 985dd8e17b, AKA gh-118298)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2024-07-15 19:09:40 +00:00
Miss Islington (bot) 308857b82a
[3.13] gh-121746: Bind Alt+Enter to "accept" in the REPL (GH-121754) (GH-121803)
(cherry picked from commit 6522f0e438)

Co-authored-by: Rodrigo Girão Serrão <5621605+rodrigogiraoserrao@users.noreply.github.com>
2024-07-15 20:14:50 +02:00
Sam Gross a2a4f5ebc5
[3.13] gh-121621: Use PyMutex for writes to asyncio state (GH-121622) (#121774)
(cherry picked from commit 5d6861ad06)

Co-authored-by: Ken Jin <kenjin@python.org>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2024-07-15 10:44:35 +05:30
Miss Islington (bot) 55ff124b9c
[3.13] gh-57141: Make shallow argument to filecmp.dircmp keyword-only (GH-121767) (#121777)
It is our general practice to make new optional parameters keyword-only,
even if the existing parameters are all positional-or-keyword. Passing
this parameter as positional would look confusing and could be error-prone
if additional parameters are added in the future.
(cherry picked from commit 50eec501fe)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-07-14 23:17:26 +00:00
Miss Islington (bot) da58e93e4c
[3.13] Generalize reusable Windows CI jobs (GH-121766) (#121775)
Co-authored-by: Sviatoslav Sydorenko (Святослав Сидоренко) <wk@sydorenko.org.ua>
2024-07-14 21:46:37 +00:00
Miss Islington (bot) 767f71466d
[3.13] gh-121731: Fix mimalloc compile error on GNU/Hurd (GH-121732) (#121773)
(cherry picked from commit d005f2c186)

Co-authored-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2024-07-14 17:14:30 +00:00
Miss Islington (bot) 97b06d543f
[3.13] gh-121660: Fix `ga_getitem` by explicitly checking for `NULL` result (GH-121661) (#121761)
gh-121660: Fix `ga_getitem` by explicitly checking for `NULL` result (GH-121661)
(cherry picked from commit bb802db8cf)

Co-authored-by: sobolevn <mail@sobolevn.me>
2024-07-14 11:48:33 +00:00
Miss Islington (bot) 295b791cf4
[3.13] Fix cache restoration for Hypothesis CI job (GH-121756) (#121759)
Co-authored-by: Sviatoslav Sydorenko (Святослав Сидоренко) <wk@sydorenko.org.ua>
2024-07-14 05:47:07 -06:00
Miss Islington (bot) 8f3ffb4156
[3.13] gh-121700 Emscripten trampolines not quite right since GH-106219 (GH-121701) (GH-121744)
(cherry picked from commit 3086b86cfd)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2024-07-14 12:37:00 +02:00
Miss Islington (bot) f672ee2242
[3.13] gh-121749: Fix discrepancy in docs for `PyModule_AddObjectRef` (GH-121750) (GH-121752)
(cherry picked from commit 26dfb27712)

Co-authored-by: Dominic H <dom@dominic.sk>
2024-07-14 12:31:46 +02:00
Miss Islington (bot) dfedbdba40
[3.13] gh-120012: clarify the behaviour of `multiprocessing.Queue.empty` on closed queues. (GH-120102) (#120469)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2024-07-14 04:24:58 -06:00
Miss Islington (bot) f17057dab1
[3.13] gh-121698 Emscripten: Use updated WebAssembly type reflection proposal (GH-121699) (GH-121745)
(cherry picked from commit cae1526716)

Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
2024-07-14 12:01:03 +02:00
Miss Islington (bot) 35d425e300
[3.13] gh-64308: Remove TestProgram from the unittest docs (GH-121675) (GH-121742)
(cherry picked from commit f6f4022a35)

Co-authored-by: Jan Musílek <jan.musilek@nic.cz>
2024-07-14 11:41:08 +02:00
Miss Islington (bot) e28f863bd5
[3.13] gh-121609: Fix pasting of characters containing unicode character joiner (GH-121667) (#121733)
Co-authored-by: Marta Gómez Macías <mgmacias@google.com>
2024-07-14 03:02:46 -06:00
Miss Islington (bot) e8594aadd5
[3.13] gh-121708: Improve test coverage for `unittest.util` (GH-121713) (GH-121738)
(cherry picked from commit 901ea411bf)

Co-authored-by: Tomas R <tomas.roun8@gmail.com>
2024-07-14 08:32:41 +00:00
Miss Islington (bot) 48a96d23a8
[3.13] gh-120642: Move _PyCode_CODE() to the internal C API (GH-121644) (#121729)
gh-120642: Move _PyCode_CODE() to the internal C API (GH-121644)

Move _PyCode_CODE() and _PyCode_NBYTES() macros to the internal C API
since they use _Py_CODEUNIT which is only part of the internal C API.
(cherry picked from commit a2bec77d25)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-07-13 21:31:30 +00:00
Miss Islington (bot) e0643d9bd7
[3.13] gh-73159 Added clarifications in multiprocessing docs on that objects are pickled. (GH-121686) (#121727)
gh-73159 Added clarifications in multiprocessing docs on that objects are pickled. (GH-121686)

Added explicit comments about that objects are pickled when transmitted via multiprocessing queues and pipes.
(cherry picked from commit b5805892d5)

Co-authored-by: Ulrik Södergren <ulrik@digitalfotografen.se>
2024-07-13 20:26:15 +00:00
Miss Islington (bot) f78e1aa1f0
[3.13] gh-121652: Handle `allocate_weakref` returning NULL (GH-121653) (#121721)
The `allocate_weakref` may return NULL when out of memory. We need to
handle that case and propagate the error.
(cherry picked from commit a640a605a8)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-07-13 16:31:50 +00:00
Miss Islington (bot) f0c29a2d9f
[3.13] gh-121711: Set `-m asyncio` return_code to 1 for ENOTTY (GH-121714) (GH-121718)
Set return_code to 1 for ENOTTY
(cherry picked from commit a183474293)

Co-authored-by: Milan Oberkirch <milan.oberkirch@geops.com>
2024-07-13 18:24:52 +02:00
Miss Islington (bot) 14c5bffcc5
[3.13] gh-121605: Increase timeout in test_pyrepl.run_repl (GH-121606) (#121702)
We also need to close the `slave_fd` earlier so that reading from
`master_fd` won't block forever when the subprocess finishes.
(cherry picked from commit abc3aeebdb)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-07-13 12:07:12 -04:00
Miss Islington (bot) 4af9c05e78
[3.13] gh-120452: improve documentation about private name mangling (GH-120451) (#121715)
gh-120452: improve documentation about private name mangling (GH-120451)
(cherry picked from commit f4d6e45c1e)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-07-13 15:21:30 +00:00
Miss Islington (bot) b9cfb812e2
[3.13] gh-120823: Fix doc for ftplib.FTP.retrbinary() (GH-121697) (GH-121707)
(cherry picked from commit 422855ad21)

Co-authored-by: Mirela Andreea GRIGORAS <magrigoras@bitdefender.com>
2024-07-13 14:45:32 +00:00
Miss Islington (bot) 62572f10aa
[3.13] gh-121497: Make Pyrepl respect correctly the history with input hook set (GH-121498) (#121703)
gh-121497: Make Pyrepl respect correctly the history with input hook set (GH-121498)
(cherry picked from commit 4e36dd7d87)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2024-07-13 14:28:49 +00:00
Miss Islington (bot) de51ee0c23
[3.13] gh-121499: Fix multi-line history rendering in the REPL (GH-121531) (#121679)
gh-121499: Fix multi-line history rendering in the REPL (GH-121531)
(cherry picked from commit 4b9e10d0ea)

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2024-07-13 15:56:56 +02:00
Miss Islington (bot) 5e8bb98419
[3.13] gh-121671: Increase test coverage of `ast.get_docstring` (GH-121674) (GH-121691)
(cherry picked from commit 0a26aa5007)

Co-authored-by: Tomas R <tomas.roun8@gmail.com>
2024-07-13 13:30:40 +00:00
Miss Islington (bot) da30c6ba0d
[3.13] gh-96765: Update ConfigParser.read() docs with multi-file read example (GH-121664) (GH-121687)
(cherry picked from commit fc21781175)

Co-authored-by: Timon Viola <44016238+timonviola@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-07-13 15:07:40 +02:00
Hugo van Kemenade fcc4a537b9
[3.13] NEWS: Fix Sphinx warnings and increase threshold for new news nits (GH-121482) (#121513)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-07-13 12:55:43 +00:00
Ken Jin cd74ed0a71
[3.13] gh-120198: Stop the world when setting __class__ on free-threaded build (#121591)
(cherry-picked from commit 3bfc9c8)
2024-07-12 19:35:53 +08:00
Miss Islington (bot) 15c875a57c
[3.13] Update retroactive comments from GH-117741 (segfault in `FutureIter_dealloc`) (GH-121638) (GH-121642)
Update retroactive comments from GH-117741 (segfault in `FutureIter_dealloc`) (GH-121638)

Address comments
(cherry picked from commit 65fededf9c)

Co-authored-by: Savannah Ostrowski <savannahostrowski@gmail.com>
2024-07-12 09:00:09 +00:00
Miss Islington (bot) 35f7155bc3
[3.13] gh-121103: Put free-threaded libraries in `lib/python3.14t` (GH-121293) (#121631)
On POSIX systems, excluding macOS framework installs, the lib directory
for the free-threaded build now includes a "t" suffix to avoid conflicts
with a co-located default build installation.
(cherry picked from commit e8c91d90ba)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-07-11 21:00:28 +00:00
Miss Islington (bot) c6dbfbbe3c
[3.13] gh-117482: Fix Builtin Types Slot Wrappers (gh-121630)
When builtin static types are initialized for a subinterpreter, various "tp" slots have already been inherited (for the main interpreter).  This was interfering with the logic in add_operators() (in Objects/typeobject.c), causing a wrapper to get created when it shouldn't.  This change fixes that by preserving the original data from the static type struct and checking that.

(cherry picked from commit 5250a03133, AKA gh-121602)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2024-07-11 20:47:38 +00:00
Jelle Zijlstra 38c4028dd9
[3.13] gh-121332: Make AST node constructor check _attributes instead of hardcoding attributes (GH-121334) (#121625)
(cherry picked from commit 58e8cf2bb6)
2024-07-11 15:51:32 +00:00
Miss Islington (bot) 3b5f8d256c
[3.13] gh-121592: Make select.poll() and related objects thread-safe (GH-121594) (#121623)
This makes select.poll() and kqueue() objects thread-safe in the
free-threaded build. Note that calling close() concurrently with other
functions is still not thread-safe due to races on file descriptors
(gh-121544).
(cherry picked from commit 44937d11a6)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-07-11 14:44:54 +00:00
Miss Islington (bot) 261c8e9d47
[3.13] gh-121615: Improve `module.rst` C-API docs with better error descriptions (GH-121616) (#121618)
gh-121615: Improve `module.rst` C-API docs with better error descriptions (GH-121616)
(cherry picked from commit e6264b44dc)

Co-authored-by: sobolevn <mail@sobolevn.me>
2024-07-11 09:15:18 +00:00
neonene c08a302249
[3.13] gh-117398: Use the correct module loader for iOS in datetime CAPI test (GH-120477) (#121561)
Use the correct binary module loader for iOS.
2024-07-11 06:48:53 +08:00
Miss Islington (bot) 5bb117586e
[3.13] gh-121596: Fix Sharing Interpreter Channels (gh-121600)
This fixes a mistake in gh-113012 and adds a test that verifies the fix.

(cherry picked from commit 35a67e36aa, AKA gh-121597)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2024-07-10 21:54:47 +00:00
Miss Islington (bot) 85e9018a01
[3.13] gh-117657: Remove TSAN suppressions for _abc.c (GH-121508) (#121598)
The functions look thread-safe and I haven't seen any warnings issued
when running the tests locally.
(cherry picked from commit 7641743d48)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-07-10 21:34:14 +00:00
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