summaryrefslogtreecommitdiffstats
path: root/Python/pystate.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/pystate.c')
-rw-r--r--Python/pystate.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/Python/pystate.c b/Python/pystate.c
index f02de92..ee9507c 100644
--- a/Python/pystate.c
+++ b/Python/pystate.c
@@ -1671,8 +1671,11 @@ _check_xidata(PyThreadState *tstate, _PyCrossInterpreterData *data)
int
_PyObject_GetCrossInterpreterData(PyObject *obj, _PyCrossInterpreterData *data)
{
- // PyThreadState_Get() aborts if tstate is NULL.
- PyThreadState *tstate = PyThreadState_Get();
+ PyThreadState *tstate = _PyThreadState_GET();
+#ifdef Py_DEBUG
+ // The caller must hold the GIL
+ _Py_EnsureTstateNotNULL(tstate);
+#endif
PyInterpreterState *interp = tstate->interp;
// Reset data before re-populating.