projects
/
python
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
43c47fe
)
bpo-32436: Make PyContextVar_Get a little bit faster (#5350)
author
Yury Selivanov
<yury@magic.io>
Fri, 26 Jan 2018 22:24:52 +0000
(17:24 -0500)
committer
GitHub
<noreply@github.com>
Fri, 26 Jan 2018 22:24:52 +0000
(17:24 -0500)
Since context.c is compiled with Py_BUILD_CORE, using a macro
will result in a slightly more optimal code.
Python/context.c
patch
|
blob
|
history
diff --git
a/Python/context.c
b/Python/context.c
index d90ed25c4d4068152583a8ebbba93516a72d35d8..3928e94d06453826d45a68742fe5eaff10017c27 100644
(file)
--- 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;
}