summaryrefslogtreecommitdiffstats
path: root/Modules/_xxsubinterpretersmodule.c
Commit message (Collapse)AuthorAgeFilesLines
* bpo-43472: Ensure PyInterpreterState_New audit events are raised when called ↵Steve Dower2021-04-211-1/+1
| | | | through _xxsubinterpreters module (GH-25506)
* bpo-40941: Unify implicit and explicit state in the frame and generator ↵Mark Shannon2020-07-171-1/+1
| | | | | | | objects into a single value. (GH-20803) * Merge gen and frame state variables into one. * Replace stack pointer with depth in PyFrameObject. Makes code easier to read and saves a word of memory.
* Revert "bpo-32604: [_xxsubinterpreters] Propagate exceptions. (GH-19768)" ↵Victor Stinner2020-05-141-1026/+121
| | | | | | | | | | | (GH-20089) * Revert "bpo-40613: Remove compiler warning from _xxsubinterpretersmodule (GH-20069)" This reverts commit fa0a66e62d087765dbc5c1b89d6149a23ecfb0a6. * Revert "bpo-32604: [_xxsubinterpreters] Propagate exceptions. (GH-19768)" This reverts commit a1d9e0accd33af1d8e90fc48b34c13d7b07dcf57.
* bpo-40613: Remove compiler warning from _xxsubinterpretersmodule (GH-20069)Dong-hee Na2020-05-131-0/+8
|
* bpo-32604: [_xxsubinterpreters] Propagate exceptions. (GH-19768)Eric Snow2020-05-071-121/+1018
| | | | | | | | | (Note: PEP 554 is not accepted and the implementation in the code base is a private one for use in the test suite.) If code running in a subinterpreter raises an uncaught exception then the "run" call in the calling interpreter fails. A RunFailedError is raised there that summarizes the original exception as a string. The actual exception type, __cause__, __context__, state, etc. are all discarded. This turned out to be functionally insufficient in practice. There is a more helpful solution (and PEP 554 has been updated appropriately). This change adds the exception propagation behavior described in PEP 554 to the _xxsubinterpreters module. With this change a copy of the original exception is set to __cause__ on the RunFailedError. For now we are using "pickle", which preserves the exception's state. We also preserve the original __cause__, __context__, and __traceback__ (since "pickle" does not preserve those). https://bugs.python.org/issue32604
* bpo-40513: _xxsubinterpreters.run_string() releases the GIL (GH-19944)Victor Stinner2020-05-051-0/+15
| | | | In the experimental isolated subinterpreters build mode, _xxsubinterpreters.run_string() now releases the GIL.
* bpo-40453: Add PyConfig._isolated_subinterpreter (GH-19820)Victor Stinner2020-05-011-5/+9
| | | | | | | | | An isolated subinterpreter cannot spawn threads, spawn a child process or call os.fork(). * Add private _Py_NewInterpreter(isolated_subinterpreter) function. * Add isolated=True keyword-only parameter to _xxsubinterpreters.create(). * Allow again os.fork() in "non-isolated" subinterpreters.
* bpo-40429: PyThreadState_GetFrame() returns a strong ref (GH-19781)Victor Stinner2020-04-291-4/+7
| | | | The PyThreadState_GetFrame() function now returns a strong reference to the frame.
* bpo-38880: List interpreters associated with a channel end (GH-17323)Lewis Gaul2020-04-291-6/+83
| | | | | This PR adds the functionality requested by https://github.com/ericsnowcurrently/multi-core-python/issues/52. Automerge-Triggered-By: @ericsnowcurrently
* bpo-32604: Add support for a "default" arg in channel_recv(). (GH-19770)Eric Snow2020-04-281-11/+25
| | | | | This allows the caller to avoid creation of an exception when the channel is empty (just like `dict.get()` works). `ChannelEmptyError` is still raised if no default is provided. Automerge-Triggered-By: @ericsnowcurrently
* bpo-40302: Replace PY_INT64_T with int64_t (GH-19573)Victor Stinner2020-04-171-1/+1
| | | | | | | | | * Replace PY_INT64_T with int64_t * Replace PY_UINT32_T with uint32_t * Replace PY_UINT64_T with uint64_t sha3module.c no longer checks if PY_UINT64_T is defined since it's always defined and uint64_t is always available on platforms supported by Python.
* bpo-39947: Use PyThreadState_GetFrame() (GH-19159)Victor Stinner2020-03-251-3/+4
| | | | | _tracemalloc.c and _xxsubinterpretersmodule.c use PyThreadState_GetFrame() and PyThreadState_GetInterpreter() to no longer depend on the PyThreadState structure.
* bpo-39947: Add PyInterpreterState_Get() function (GH-18979)Victor Stinner2020-03-131-3/+3
| | | | | | * Rename _PyInterpreterState_Get() to PyInterpreterState_Get() and move it the limited C API. * Add _PyInterpreterState_Get() alias to PyInterpreterState_Get() for backward compatibility with Python 3.8.
* bpo-39573: Use Py_TYPE() macro in Modules directory (GH-18393)Victor Stinner2020-02-071-1/+1
| | | Replace direct access to PyObject.ob_type with Py_TYPE().
* closes bpo-39262: Use specific out-of-memory message in ↵Alex Henrie2020-01-091-2/+4
| | | | _sharedexception_bind. (GH-17908)
* bpo-36854: Clear the current thread later (GH-17279)Victor Stinner2019-11-201-1/+0
| | | | | | | | | | Clear the current thread later in the Python finalization. * The PyInterpreterState_Delete() function is now responsible to call PyThreadState_Swap(NULL). * The tstate_delete_common() function is now responsible to clear the "autoTSSKey" thread local storage and it only clears it once the thread state is fully cleared. It allows to still get the current thread from TSS in tstate_delete_common().
* bpo-38005: Fixed comparing and creating of InterpreterID and ChannelID. ↵Serhiy Storchaka2019-09-131-85/+65
| | | | | | | | | | | | | (GH-15652) * Fix a crash in comparing with float (and maybe other crashes). * They are now never equal to strings and non-integer numbers. * Comparison with a large number no longer raises OverflowError. * Arbitrary exceptions no longer silenced in constructors and comparisons. * TypeError raised in the constructor contains now the name of the type. * Accept only ChannelID and int-like objects in channel functions. * Accept only InterpreterId, int-like objects and str in the InterpreterId constructor. * Accept int-like objects, not just int in interpreter related functions.
* bpo-36974: tp_print -> tp_vectorcall_offset and tp_reserved -> tp_as_async ↵Jeroen Demeyer2019-05-311-1/+1
| | | | | | | | | (GH-13464) Automatically replace tp_print -> tp_vectorcall_offset tp_compare -> tp_as_async tp_reserved -> tp_as_async
* bpo-36594: Fix incorrect use of %p in format strings (GH-12769)Zackery Spytz2019-05-061-1/+1
| | | In addition, fix some other minor violations of C99.
* bpo-36097: Use only public C-API in the_xxsubinterpreters module (adding as ↵Eric Snow2019-03-151-334/+35
| | | | necessary). (gh-12359)
* Revert: bpo-33608: Factor out a private, per-interpreter ↵Victor Stinner2019-03-041-35/+334
| | | | | | | | | | | | | | | | | | | _Py_AddPendingCall(). (GH-11617) (GH-12159) * Revert "bpo-36097: Use only public C-API in the_xxsubinterpreters module (adding as necessary). (#12003)" This reverts commit bcfa450f210074e16feb761ae5b3e966a2532fcf. * Revert "bpo-33608: Simplify ceval's DISPATCH by hoisting eval_breaker ahead of time. (gh-12062)" This reverts commit bda918bf65a88560ec453aaba0758a9c0d49b449. * Revert "bpo-33608: Use _Py_AddPendingCall() in _PyCrossInterpreterData_Release(). (gh-12024)" This reverts commit b05b711a2cef6c6c381e01069dedac372e0b9fb2. * Revert "bpo-33608: Factor out a private, per-interpreter _Py_AddPendingCall(). (GH-11617)" This reverts commit ef4ac967e2f3a9a18330cc6abe14adb4bc3d0465.
* bpo-36097: Use only public C-API in the_xxsubinterpreters module (adding as ↵Eric Snow2019-03-011-334/+35
| | | | necessary). (#12003)
* bpo-35984: _xxsubinterpreters: Fix memory leak in _channel_send() (GH-11845)Alexey Izbyshev2019-02-151-0/+1
| | | https://bugs.python.org/issue35984
* bpo-33012: Fix invalid function cast warnings with gcc 8. (GH-6749)Serhiy Storchaka2018-11-271-10/+10
| | | | | | Fix invalid function cast warnings with gcc 8 for method conventions different from METH_NOARGS, METH_O and METH_VARARGS excluding Argument Clinic generated code.
* bpo-35081: Rename internal headers (GH-10275)Victor Stinner2018-11-121-1/+1
| | | | | | | | | | | | | | Rename Include/internal/ headers: * pycore_hash.h -> pycore_pyhash.h * pycore_lifecycle.h -> pycore_pylifecycle.h * pycore_mem.h -> pycore_pymem.h * pycore_state.h -> pycore_pystate.h Add missing headers to Makefile.pre.in and PCbuild: * pycore_condvar.h. * pycore_hamt.h * pycore_pyhash.h
* bpo-35081: Add pycore_ prefix to internal header files (GH-10263)Victor Stinner2018-10-311-1/+1
| | | | | | | | | | | | | | | | | | | | * Rename Include/internal/ header files: * pyatomic.h -> pycore_atomic.h * ceval.h -> pycore_ceval.h * condvar.h -> pycore_condvar.h * context.h -> pycore_context.h * pygetopt.h -> pycore_getopt.h * gil.h -> pycore_gil.h * hamt.h -> pycore_hamt.h * hash.h -> pycore_hash.h * mem.h -> pycore_mem.h * pystate.h -> pycore_state.h * warnings.h -> pycore_warnings.h * PCbuild project, Makefile.pre.in, Modules/Setup: add the Include/internal/ directory to the search paths of header files. * Update includes. For example, replace #include "internal/mem.h" with #include "pycore_mem.h".
* Fix misleading mentions of tp_size in comments (GH-9093)Peter Eisentraut2018-09-101-2/+2
| | | | Many type object initializations labeled a field "tp_size" in the comment, but the name of that field is tp_basicsize.
* bpo-34462: Add missing NULL check to _copy_raw_string() (GH-8863)Alexey Izbyshev2018-08-221-1/+1
| | | | Reported by Svace static analyzer.
* bpo-34301: Add _PyInterpreterState_Get() helper function (GH-8592)Victor Stinner2018-08-031-4/+3
| | | | sys_setcheckinterval() now uses a local variable to parse arguments, before writing into interp->check_interval.
* Hide some symbols from _xxsubinterpreters. (GH-8151)Benjamin Peterson2018-07-071-2/+2
|
* bpo-33615: Re-enable subinterpreter tests. (#7552)Eric Snow2018-06-131-37/+45
| | | All the subinterpreter tests were disabled in gh-7513. This commit re-enables them, but leaves one bad test disabled. The test is partly causing problems because it makes assumptions about the availability of a high-level interpreters module (see PEP 554). So I'm disabling the test until such a high-level module is available.
* bpo-33615: Re-enable a subinterpreter test. (gh-7251)Eric Snow2018-06-021-0/+1
| | | For bpo-32604 I added extra subinterpreter-related tests (see #6914), which caused a few buildbots to crash. This patch fixes the crash by ensuring that refcounts in channels are handled properly.
* bpo-33724: Use the right format code for int64_t in subinterpreters code. ↵Eric Snow2018-06-011-32/+33
| | | | | | (gh-7330)
* bpo-32604: Implement force-closing channels. (gh-6937)Eric Snow2018-05-171-21/+136
| | | This will make it easier to clean up channels (e.g. when used in tests).
* bpo-32604: Improve subinterpreter tests. (#6914)Eric Snow2018-05-161-73/+177
| | | Add more tests for subinterpreters. This patch also fixes a few small defects in the channel implementation.
* bpo-33454: Fix arguments parsing in _xxsubinterpreters.channel_close(). ↵Serhiy Storchaka2018-05-151-7/+3
| | | | (GH-6747)
* bpo-33012: Fix invalid function cast warnings with gcc 8 for METH_NOARGS. ↵Siddhesh Poyarekar2018-04-291-10/+10
| | | | | | | | | (GH-6030) METH_NOARGS functions need only a single argument but they are cast into a PyCFunction, which takes two arguments. This triggers an invalid function cast warning in gcc8 due to the argument mismatch. Fix this by adding a dummy unused argument.
* bpo-32604: Swap threads only if the interpreter is different. (gh-5778)Eric Snow2018-02-201-8/+14
| | | The CPython runtime assumes that there is a one-to-one relationship (for a given interpreter) between PyThreadState and OS threads. Sending and receiving on a channel in the same interpreter was causing crashes because of this (specifically due to a check in PyThreadState_Swap()). The solution is to not switch threads if the interpreter is the same.
* bpo-32604: Clean up created subinterpreters before runtime finalization. ↵Eric Snow2018-02-171-21/+276
| | | | | | (gh-5709)
* bpo-32604: Fix memory leaks in the new _xxsubinterpreters module. (#5507)Eric Snow2018-02-031-268/+596
|
* bpo-32604: NULL-terminate kwlist in channel_drop_interpreter(). (gh-5437)Eric Snow2018-01-301-1/+1
|
* bpo-32604: Expose the subinterpreters C-API in a "private" stdlib module. ↵Eric Snow2018-01-301-0/+2061
(gh-1748) The module is primarily intended for internal use in the test suite. Building the module under Windows will come in a follow-up PR.