From d0c4febd7a4a00d5f3a5452905fecb9c9e670e46 Mon Sep 17 00:00:00 2001 From: Yury Selivanov Date: Fri, 26 Jan 2018 16:22:51 -0500 Subject: [PATCH] bpo-32436: Make PyContextVar_Get a little bit faster Since context.c is compiled with Py_BUILD_CORE, using a macro will result in a slightly more optimal code. --- Python/context.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Python/context.c b/Python/context.c index d90ed25c4d40681..3928e94d0645382 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; }