From 226e50049da43097d89e9e99f9c55f212d1f7bd5 Mon Sep 17 00:00:00 2001 From: Yury Selivanov Date: Fri, 26 Jan 2018 17:24:52 -0500 Subject: 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. --- Python/context.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Python/context.c b/Python/context.c index d90ed25..3928e94 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; } -- cgit v0.12