diff --git a/Python/context.c b/Python/context.c index d90ed25c4d4..3928e94d064 100644 --- a/Python/context.c +++ b/Python/context.c @@ -145,7 +145,8 @@ PyContextVar_Get(PyContextVar *var, PyObject *def, PyObject **val) { assert(PyContextVar_CheckExact(var)); - PyThreadState *ts = PyThreadState_Get(); + PyThreadState *ts = PyThreadState_GET(); + assert(ts != NULL); if (ts->context == NULL) { goto not_found; }