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 /Python/ceval_gil.c | |
| 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 'Python/ceval_gil.c')
| -rw-r--r-- | Python/ceval_gil.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Python/ceval_gil.c b/Python/ceval_gil.c index 3b7e6cb..ba16f5e 100644 --- a/Python/ceval_gil.c +++ b/Python/ceval_gil.c @@ -763,7 +763,7 @@ _PyEval_SignalReceived(PyInterpreterState *interp) /* Push one item onto the queue while holding the lock. */ static int _push_pending_call(struct _pending_calls *pending, - int (*func)(void *), void *arg) + _Py_pending_call_func func, void *arg) { int i = pending->last; int j = (i + 1) % NPENDINGCALLS; @@ -810,7 +810,7 @@ _pop_pending_call(struct _pending_calls *pending, int _PyEval_AddPendingCall(PyInterpreterState *interp, - int (*func)(void *), void *arg, + _Py_pending_call_func func, void *arg, int mainthreadonly) { assert(!mainthreadonly || _Py_IsMainInterpreter(interp)); @@ -834,7 +834,7 @@ _PyEval_AddPendingCall(PyInterpreterState *interp, } int -Py_AddPendingCall(int (*func)(void *), void *arg) +Py_AddPendingCall(_Py_pending_call_func func, void *arg) { /* Legacy users of this API will continue to target the main thread (of the main interpreter). */ @@ -878,7 +878,7 @@ _make_pending_calls(struct _pending_calls *pending) { /* perform a bounded number of calls, in case of recursion */ for (int i=0; i<NPENDINGCALLS; i++) { - int (*func)(void *) = NULL; + _Py_pending_call_func func = NULL; void *arg = NULL; /* pop one item off the queue while holding the lock */ |
