mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
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.
This commit is contained in:
parent
14fbd4e6b1
commit
58ef741867
6 changed files with 62 additions and 29 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue