Skip to content

Commit 226e500

Browse files
authored
bpo-32436: Make PyContextVar_Get a little bit faster (python#5350)
Since context.c is compiled with Py_BUILD_CORE, using a macro will result in a slightly more optimal code.
1 parent 43c47fe commit 226e500

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Python/context.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@ PyContextVar_Get(PyContextVar *var, PyObject *def, PyObject **val)
145145
{
146146
assert(PyContextVar_CheckExact(var));
147147

148-
PyThreadState *ts = PyThreadState_Get();
148+
PyThreadState *ts = PyThreadState_GET();
149+
assert(ts != NULL);
149150
if (ts->context == NULL) {
150151
goto not_found;
151152
}

0 commit comments

Comments
 (0)