summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2018-08-03 13:33:52 (GMT)
committerGitHub <noreply@github.com>2018-08-03 13:33:52 (GMT)
commitcaba55b3b735405b280273f7d99866a046c18281 (patch)
tree3a98ac383b1fbab272158933255fb1a14107ebf6 /Python/ceval.c
parent2ebd3813af9172fe1f9b2f6004edf6f1e1e5d9f1 (diff)
downloadcpython-caba55b3b735405b280273f7d99866a046c18281.zip
cpython-caba55b3b735405b280273f7d99866a046c18281.tar.gz
cpython-caba55b3b735405b280273f7d99866a046c18281.tar.bz2
bpo-34301: Add _PyInterpreterState_Get() helper function (GH-8592)
sys_setcheckinterval() now uses a local variable to parse arguments, before writing into interp->check_interval.
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 46da295..f3a74b0 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -532,8 +532,8 @@ PyEval_EvalFrame(PyFrameObject *f) {
PyObject *
PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
{
- PyThreadState *tstate = PyThreadState_GET();
- return tstate->interp->eval_frame(f, throwflag);
+ PyInterpreterState *interp = _PyInterpreterState_GET_UNSAFE();
+ return interp->eval_frame(f, throwflag);
}
PyObject* _Py_HOT_FUNCTION
@@ -4435,7 +4435,7 @@ PyEval_GetBuiltins(void)
{
PyFrameObject *current_frame = PyEval_GetFrame();
if (current_frame == NULL)
- return PyThreadState_GET()->interp->builtins;
+ return _PyInterpreterState_GET_UNSAFE()->builtins;
else
return current_frame->f_builtins;
}
@@ -4769,7 +4769,7 @@ import_name(PyFrameObject *f, PyObject *name, PyObject *fromlist, PyObject *leve
}
/* Fast path for not overloaded __import__. */
- if (import_func == PyThreadState_GET()->interp->import_func) {
+ if (import_func == _PyInterpreterState_GET_UNSAFE()->import_func) {
int ilevel = _PyLong_AsInt(level);
if (ilevel == -1 && PyErr_Occurred()) {
return NULL;
@@ -5136,7 +5136,7 @@ _Py_GetDXProfile(PyObject *self, PyObject *args)
Py_ssize_t
_PyEval_RequestCodeExtraIndex(freefunc free)
{
- PyInterpreterState *interp = PyThreadState_Get()->interp;
+ PyInterpreterState *interp = _PyInterpreterState_GET_UNSAFE();
Py_ssize_t new_index;
if (interp->co_extra_user_count == MAX_CO_EXTRA_USERS - 1) {