diff options
author | Eric Snow <ericsnowcurrently@gmail.com> | 2023-09-19 21:01:34 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-19 21:01:34 (GMT) |
commit | fd7e08a6f35581e1189b9bf12feb51f7167a86c5 (patch) | |
tree | 0844ef241ff291d4d50d293e185532b1284b276b /Include/internal | |
parent | 754519a9f8c2bb06d85ff9b3e9fe6f967ac46d5c (diff) | |
download | cpython-fd7e08a6f35581e1189b9bf12feb51f7167a86c5.zip cpython-fd7e08a6f35581e1189b9bf12feb51f7167a86c5.tar.gz cpython-fd7e08a6f35581e1189b9bf12feb51f7167a86c5.tar.bz2 |
gh-76785: Use Pending Calls When Releasing Cross-Interpreter Data (gh-109556)
This fixes some crashes in the _xxinterpchannels module, due to a race between interpreters.
Diffstat (limited to 'Include/internal')
-rw-r--r-- | Include/internal/pycore_ceval.h | 2 | ||||
-rw-r--r-- | Include/internal/pycore_ceval_state.h | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/Include/internal/pycore_ceval.h b/Include/internal/pycore_ceval.h index e953502..23d0fa3 100644 --- a/Include/internal/pycore_ceval.h +++ b/Include/internal/pycore_ceval.h @@ -44,7 +44,7 @@ extern void _PyEval_SignalReceived(PyInterpreterState *interp); // Export for '_testinternalcapi' shared extension PyAPI_FUNC(int) _PyEval_AddPendingCall( PyInterpreterState *interp, - int (*func)(void *), + _Py_pending_call_func func, void *arg, int mainthreadonly); diff --git a/Include/internal/pycore_ceval_state.h b/Include/internal/pycore_ceval_state.h index 6e3d669..d0af5b5 100644 --- a/Include/internal/pycore_ceval_state.h +++ b/Include/internal/pycore_ceval_state.h @@ -11,6 +11,8 @@ extern "C" { #include "pycore_gil.h" // struct _gil_runtime_state +typedef int (*_Py_pending_call_func)(void *); + struct _pending_calls { int busy; PyThread_type_lock lock; @@ -22,7 +24,7 @@ struct _pending_calls { int async_exc; #define NPENDINGCALLS 32 struct _pending_call { - int (*func)(void *); + _Py_pending_call_func func; void *arg; } calls[NPENDINGCALLS]; int first; |