diff options
author | Eric Snow <ericsnowcurrently@gmail.com> | 2023-08-03 19:51:08 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-03 19:51:08 (GMT) |
commit | 58ef74186795c56e3ec86e8c8f351a1d7826638a (patch) | |
tree | 592cedc60a6828d0185d6dc84319cbcc97564e8b /Include/internal/pycore_runtime_init.h | |
parent | 14fbd4e6b16dcbcbff448b047f7e2faa27bbedba (diff) | |
download | cpython-58ef74186795c56e3ec86e8c8f351a1d7826638a.zip cpython-58ef74186795c56e3ec86e8c8f351a1d7826638a.tar.gz cpython-58ef74186795c56e3ec86e8c8f351a1d7826638a.tar.bz2 |
gh-107080: Fix Py_TRACE_REFS Crashes Under Isolated Subinterpreters (gh-107567)
The linked list of objects was a global variable, which broke isolation between interpreters, causing crashes. To solve this, we've moved the linked list to each interpreter.
Diffstat (limited to 'Include/internal/pycore_runtime_init.h')
-rw-r--r-- | Include/internal/pycore_runtime_init.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Include/internal/pycore_runtime_init.h b/Include/internal/pycore_runtime_init.h index dcfceef..e89d368 100644 --- a/Include/internal/pycore_runtime_init.h +++ b/Include/internal/pycore_runtime_init.h @@ -157,6 +157,7 @@ extern PyTypeObject _PyExc_MemoryError; { .threshold = 10, }, \ }, \ }, \ + .object_state = _py_object_state_INIT(INTERP), \ .dtoa = _dtoa_state_INIT(&(INTERP)), \ .dict_state = _dict_state_INIT, \ .func_state = { \ @@ -186,6 +187,16 @@ extern PyTypeObject _PyExc_MemoryError; .context_ver = 1, \ } +#ifdef Py_TRACE_REFS +# define _py_object_state_INIT(INTERP) \ + { \ + .refchain = {&INTERP.object_state.refchain, &INTERP.object_state.refchain}, \ + } +#else +# define _py_object_state_INIT(INTERP) \ + { 0 } +#endif + // global objects |