Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions Python/pystate.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/* Thread and interpreter state structures and their interfaces */

#include "Python.h"
#include "objimpl.h"
#include "pycore_ceval.h"
#include "pycore_code.h" // stats
#include "pycore_frame.h"
Expand Down Expand Up @@ -1388,6 +1389,10 @@ PyThreadState_Next(PyThreadState *tstate) {
PyObject *
_PyThread_CurrentFrames(void)
{
// Disable the GC as this can cause a deadlock the interpreter.
// See issues 116969 and 106883.
PyGC_Disable();

PyThreadState *tstate = _PyThreadState_GET();
if (_PySys_Audit(tstate, "sys._current_frames", NULL) < 0) {
return NULL;
Expand Down Expand Up @@ -1440,12 +1445,20 @@ _PyThread_CurrentFrames(void)

done:
HEAD_UNLOCK(runtime);

// Once we release the runtime, the GC can be reenabled.
PyGC_Enable();

return result;
}

PyObject *
_PyThread_CurrentExceptions(void)
{
// Disable the GC as this can cause a deadlock the interpreter.
// See issues 116969 and 106883.
PyGC_Disable();

PyThreadState *tstate = _PyThreadState_GET();

_Py_EnsureTstateNotNULL(tstate);
Expand Down Expand Up @@ -1499,6 +1512,10 @@ _PyThread_CurrentExceptions(void)

done:
HEAD_UNLOCK(runtime);

// Once we release the runtime, the GC can be reenabled.
PyGC_Enable();

return result;
}

Expand Down