summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_interpreters/test_queues.py
Commit message (Collapse)AuthorAgeFilesLines
* [3.14] gh-136285: Improve `pickle` protocol testing in `test_interpreters` ↵Miss Islington (bot)2025-07-061-3/+5
| | | | | | | | (GH-136286) (#136333) gh-136285: Improve `pickle` protocol testing in `test_interpreters` (GH-136286) (cherry picked from commit 06e347b84648f3f8e144e8f70671d610da082b77) Co-authored-by: sobolevn <mail@sobolevn.me>
* [3.14] gh-135698: Fix Cross-interpreter Queue.full() With Negative/Default ↵Miss Islington (bot)2025-06-201-11/+57
| | | | | | | | | | max_size (gh-135775) We weren't handling non-positive maxsize values (including the default) properly in Queue.full(). This change fixes that and adjusts an associated assert. (cherry picked from commit c5ea8e8e8, AKA gh-135724) Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* [3.14] gh-134939: Add the concurrent.interpreters Module (gh-135414)Eric Snow2025-06-121-9/+9
| | | | | | | | PEP-734 has been accepted (for 3.14). (FTR, I'm opposed to putting this under the concurrent package, but doing so is the SC condition under which the module can land in 3.14.) (cherry picked from commit 62143736b, AKA gh-133958)
* [3.14] gh-132775: Use _PyObject_GetXIData (With Fallback) (gh-134507)Miss Islington (bot)2025-05-221-120/+68
| | | | | | | This change includes some semi-related refactoring of queues and channels. (cherry picked from commit d0eedfa10e, gh-134440) Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* gh-76785: Expand How Interpreter Channels Handle Interpreter Finalization ↵Eric Snow2024-07-151-2/+2
| | | | | (gh-121805) See 6b98b274b6 for an explanation of the problem and solution. Here I've applied the solution to channels.
* gh-76785: Expand How Interpreter Queues Handle Interpreter Finalization ↵Eric Snow2024-07-151-18/+201
| | | | | | | | | | | | | | | | | | | | (gh-116431) 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".)
* gh-120417: Remove unused imports in tests (part 3) (#120631)Victor Stinner2024-06-171-1/+0
|
* gh-76785: Rename _xxsubinterpreters to _interpreters (gh-117791)Eric Snow2024-04-241-1/+1
| | | See https://discuss.python.org/t/pep-734-multiple-interpreters-in-the-stdlib/41147/26.
* gh-76785: Consolidate Some Interpreter-related Testing Helpers (gh-117485)Eric Snow2024-04-021-3/+3
| | | This eliminates the duplication of functionally identical helpers in the _testinternalcapi and _xxsubinterpreters modules.
* gh-76785: Minor Improvements to "interpreters" Module (gh-116328)Eric Snow2024-03-051-4/+67
| | | This includes adding pickle support to various classes, and small changes to improve the maintainability of the low-level _xxinterpqueues module.
* gh-115490: Make the interpreter.channels and interpreter.queues Modules ↵Eric Snow2024-03-041-0/+15
| | | | | Handle Reloading Properly (gh-115493) The problem manifested when the .py module got reloaded and the corresponding extension module didn't. The .py module registers types with the extension and the extension was not allowing that to happen more than once. The solution: let it happen more than once.
* gh-76785: Fix interpreters.Queue.get_nowait() (gh-116166)Eric Snow2024-03-011-47/+69
| | | I missed this change in gh-115566.
* gh-76785: Update test.support.interpreters to Align With PEP 734 (gh-115566)Eric Snow2024-02-281-36/+115
| | | | | This brings the code under test.support.interpreters, and the corresponding extension modules, in line with recent updates to PEP 734. (Note: PEP 734 has not been accepted at this time. However, we are using an internal copy of the implementation in the test suite to exercise the existing subinterpreters feature.)
* gh-76785: More Fixes for test.support.interpreters (gh-113012)Eric Snow2023-12-121-15/+81
| | | This brings the module (along with the associated extension modules) mostly in sync with PEP 734. There are only a few small things to wrap up.
* gh-76785: Fixes for test.support.interpreters (gh-112982)Eric Snow2023-12-121-0/+233
This involves a number of changes for PEP 734.