mirror of
https://github.com/python/cpython.git
synced 2026-06-04 16:50:51 +00:00
gh-149590: Remove faulthandler_traverse (#150023)
`faulthandler_traverse` visits Python objects owned by `_PyRuntime`, not by the module instance. With multi-phase init allowing multiple module instances, each instance's GC traversal decrements `gc_refs` on the same runtime-owned objects, driving it negative when two instances are collected simultaneously.
This commit is contained in:
parent
9770e32ce0
commit
56737483c2
2 changed files with 1 additions and 16 deletions
|
|
@ -0,0 +1 @@
|
|||
Fix crash when faulthandler is imported more than once.
|
||||
|
|
@ -1349,21 +1349,6 @@ faulthandler__stack_overflow_impl(PyObject *module)
|
|||
#endif /* defined(FAULTHANDLER_USE_ALT_STACK) && defined(HAVE_SIGACTION) */
|
||||
|
||||
|
||||
static int
|
||||
faulthandler_traverse(PyObject *module, visitproc visit, void *arg)
|
||||
{
|
||||
Py_VISIT(thread.file);
|
||||
#ifdef FAULTHANDLER_USER
|
||||
if (user_signals != NULL) {
|
||||
for (size_t signum=0; signum < Py_NSIG; signum++)
|
||||
Py_VISIT(user_signals[signum].file);
|
||||
}
|
||||
#endif
|
||||
Py_VISIT(fatal_error.file);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#ifdef MS_WINDOWS
|
||||
/*[clinic input]
|
||||
faulthandler._raise_exception
|
||||
|
|
@ -1459,7 +1444,6 @@ static struct PyModuleDef module_def = {
|
|||
.m_name = "faulthandler",
|
||||
.m_doc = module_doc,
|
||||
.m_methods = module_methods,
|
||||
.m_traverse = faulthandler_traverse,
|
||||
.m_slots = faulthandler_slots
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue