bpo-32436: Make PyContextVar_Get a little bit faster (#5350) · python/cpython@226e500 (original) (raw)
Navigation Menu
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Appearance settings
Commit 226e500
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.
File tree
1 file changed
lines changed
1 file changed
lines changed
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -145,7 +145,8 @@ PyContextVar_Get(PyContextVar *var, PyObject *def, PyObject **val) | ||
145 | 145 | { |
146 | 146 | assert(PyContextVar_CheckExact(var)); |
147 | 147 | |
148 | -PyThreadState *ts = PyThreadState_Get(); | |
148 | +PyThreadState *ts = PyThreadState_GET(); | |
149 | +assert(ts != NULL); | |
149 | 150 | if (ts->context == NULL) { |
150 | 151 | goto not_found; |
151 | 152 | } |