summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorYury Selivanov <yury@magic.io>2018-01-26 22:24:52 (GMT)
committerGitHub <noreply@github.com>2018-01-26 22:24:52 (GMT)
commit226e50049da43097d89e9e99f9c55f212d1f7bd5 (patch)
tree8b7182050bd7ad56775e51ac89ed2c188b95df9d /Python
parent43c47fe09640c579462978ec16f81295f5857cde (diff)
downloadcpython-226e50049da43097d89e9e99f9c55f212d1f7bd5.zip
cpython-226e50049da43097d89e9e99f9c55f212d1f7bd5.tar.gz
cpython-226e50049da43097d89e9e99f9c55f212d1f7bd5.tar.bz2
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.
Diffstat (limited to 'Python')
-rw-r--r--Python/context.c3
1 files changed, 2 insertions, 1 deletions
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;
}