summaryrefslogtreecommitdiffstats
path: root/Modules/_interpqueuesmodule.c
Commit message (Collapse)AuthorAgeFilesLines
* gh-140306: Fix memory leaks in cross-interpreter data handling (GH-140307)Shamil2025-10-191-1/+1
|
* GH-137630: Convert ``_interpqueues`` to use Argument Clinic (#137685)Adam Turner2025-09-171-217/+173
|
* GH-132775: Fix argument parsing for ``_interpqueues.put()`` (#137686)Adam Turner2025-08-211-1/+1
|
* gh-135839: Fix `module_traverse` and `module_clear` in subinterp modules ↵sobolevn2025-06-251-4/+2
| | | | (#135937)
* gh-135698: Fix Cross-interpreter Queue.full() With Negative/Default max_size ↵Eric Snow2025-06-201-2/+5
| | | | | | (gh-135724) We weren't handling non-positive maxsize values (including the default) properly in Queue.full(). This change fixes that and adjusts an associated assert.
* gh-134939: Add the concurrent.interpreters Module (gh-133958)Eric Snow2025-06-111-7/+4
| | | | | | 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.)
* gh-132775: Expand the Capability of Interpreter.call() (gh-133484)Eric Snow2025-05-301-4/+4
| | | It now supports most callables, full args, and return values.
* gh-132775: Fix Recently Introduced Warnings (gh-134530)Eric Snow2025-05-221-1/+1
|
* gh-132775: Use _PyObject_GetXIData (With Fallback) (gh-134440)Eric Snow2025-05-221-77/+98
| | | This change includes some semi-related refactoring of queues and channels.
* gh-132775: Support Fallbacks in _PyObject_GetXIData() (gh-133482)Eric Snow2025-05-211-2/+2
| | | It now supports a "full" fallback to _PyFunction_GetXIData() and then `_PyPickle_GetXIData()`. There's also room for other fallback modes if that later makes sense.
* gh-132775: Cleanup Related to crossinterp.c Before Further Changes (gh-132974)Eric Snow2025-04-281-1/+1
| | | This change consists of adding tests and moving code around, with some renaming thrown in.
* gh-132781: Cleanup Code Related to NotShareableError (gh-132782)Eric Snow2025-04-251-7/+4
| | | | | | | | | | The following are added to the internal C-API: * _PyErr_FormatV() * _PyErr_SetModuleNotFoundError() * _PyXIData_GetNotShareableErrorType() * _PyXIData_FormatNotShareableError() We also drop _PyXIData_lookup_context_t and _PyXIData_GetLookupContext().
* gh-111178: fix UBSan failures in `Modules/_interp*module.c` (GH-129779)Bénédikt Tran2025-02-171-5/+5
| | | | | Fix UBSan failures for `XIBufferViewObject` Remove redundant casts, suppress unused return values
* gh-76785: Improved Subinterpreters Compatibility with 3.12 (2/2) (gh-126707)Eric Snow2024-11-121-3/+8
| | | | | | | | | These changes makes it easier to backport the _interpreters, _interpqueues, and _interpchannels modules to Python 3.12. This involves the following: * add the _PyXI_GET_STATE() and _PyXI_GET_GLOBAL_STATE() macros * add _PyXIData_lookup_context_t and _PyXIData_GetLookupContext() * add _Py_xi_state_init() and _Py_xi_state_fini()
* gh-76785: Minor Cleanup of "Cross-interpreter" Code (gh-126457)Eric Snow2024-11-071-29/+24
| | | | | | | | The primary objective here is to allow some later changes to be cleaner. Mostly this involves renaming things and moving a few things around. * CrossInterpreterData -> XIData * crossinterpdatafunc -> xidatafunc * split out pycore_crossinterp_data_registry.h * add _PyXIData_lookup_t
* gh-125716: Use A Global Mutex When Initializing Global State For The ↵Eric Snow2024-10-211-32/+40
| | | | | | | _interpqueues Module (gh-125803) This includes a drive-by cleanup in _queues_init() and _queues_fini(). This change also applies to the _interpchannels module.
* gh-125716: Raise an Exception If _globals_init() Fails In the _interpqueues ↵Eric Snow2024-10-211-2/+3
| | | | | | | Module (gh-125802) The fix applies to the _interpchannels module as well. I've also included a drive-by typo fix for _interpqueues.
* gh-125667: Statically Initialize the Arg Converter Data Values in ↵Eric Snow2024-10-171-9/+9
| | | | _interpqueuesmodule.c (gh-125668)
* gh-76785: Expand How Interpreter Channels Handle Interpreter Finalization ↵Eric Snow2024-07-151-40/+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-59/+184
| | | | | | | | | | | | | | | | | | | | (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-121040: Use __attribute__((fallthrough)) (#121044)Victor Stinner2024-06-271-1/+1
| | | | | | | | | | | | | Fix warnings when using -Wimplicit-fallthrough compiler flag. Annotate explicitly "fall through" switch cases with a new _Py_FALLTHROUGH macro which uses __attribute__((fallthrough)) if available. Replace "fall through" comments with _Py_FALLTHROUGH. Add _Py__has_attribute() macro. No longer define __has_attribute() macro if it's not defined. Move also _Py__has_builtin() at the top of pyport.h. Co-Authored-By: Nikita Sobolev <mail@sobolevn.me>
* gh-116322: Add Py_mod_gil module slot (#116882)Brett Simmers2024-05-031-0/+1
| | | | | | | | | | | | | | This PR adds the ability to enable the GIL if it was disabled at interpreter startup, and modifies the multi-phase module initialization path to enable the GIL when loading a module, unless that module's spec includes a slot indicating it can run safely without the GIL. PEP 703 called the constant for the slot `Py_mod_gil_not_used`; I went with `Py_MOD_GIL_NOT_USED` for consistency with gh-104148. A warning will be issued up to once per interpreter for the first GIL-using module that is loaded. If `-v` is given, a shorter message will be printed to stderr every time a GIL-using module is loaded (including the first one that issues a warning).
* gh-76785: Rename _xxsubinterpreters to _interpreters (gh-117791)Eric Snow2024-04-241-0/+1881
See https://discuss.python.org/t/pep-734-multiple-interpreters-in-the-stdlib/41147/26.