From: Yury Selivanov Date: Fri, 26 Jan 2018 22:24:52 +0000 (-0500) Subject: bpo-32436: Make PyContextVar_Get a little bit faster (#5350) X-Git-Tag: v3.7.0b1~91 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=226e50049da43097d89e9e99f9c55f212d1f7bd5;p=python bpo-32436: Make PyContextVar_Get a little bit faster (#5350) Since context.c is compiled with Py_BUILD_CORE, using a macro will result in a slightly more optimal code. --- diff --git a/Python/context.c b/Python/context.c index d90ed25c4d..3928e94d06 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; }