Skip to content

Commit e90adbb

Browse files
committed
Fix test failures.
1 parent 97fe202 commit e90adbb

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

Python/pystate.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -857,8 +857,6 @@ interpreter_clear(PyInterpreterState *interp, PyThreadState *tstate)
857857
*/
858858
// XXX Make sure we properly deal with problematic finalizers.
859859

860-
Py_CLEAR(interp->audit_hooks);
861-
862860
// gh-140257: Threads have already been cleared, but daemon threads may
863861
// still access eval_breaker atomically via take_gil() right before they
864862
// hang. Use an atomic store to prevent data races during finalization.

Python/sysmodule.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,8 @@ _PySys_ClearAuditHooks(PyThreadState *ts)
453453
PyMem_RawFree(e);
454454
e = n;
455455
}
456+
457+
Py_CLEAR(ts->interp->audit_hooks);
456458
}
457459

458460
static void
@@ -4315,6 +4317,7 @@ _PySys_Create(PyThreadState *tstate, PyObject **sysmod_p)
43154317
if (audit_hooks == NULL) {
43164318
goto error;
43174319
}
4320+
_PyObject_GC_UNTRACK(audit_hooks);
43184321
interp->audit_hooks = audit_hooks;
43194322

43204323
PyObject *modules = _PyImport_InitModules(interp);

0 commit comments

Comments
 (0)