/* Forward declarations */
struct pyruntimestate;
struct _ceval_runtime_state;
+struct _frame;
+
+#include "pycore_pystate.h" /* PyInterpreterState.eval_frame */
PyAPI_FUNC(void) _Py_FinishPendingCalls(struct pyruntimestate *runtime);
PyAPI_FUNC(void) _PyEval_Initialize(struct _ceval_runtime_state *);
/* Private function */
void _PyEval_Fini(void);
+static inline PyObject*
+_PyEval_EvalFrame(PyThreadState *tstate, struct _frame *f, int throwflag)
+{
+ return tstate->interp->eval_frame(f, throwflag);
+}
+
#ifdef __cplusplus
}
#endif
#include "Python.h"
+#include "pycore_ceval.h" /* _PyEval_EvalFrame() */
#include "pycore_object.h"
#include "pycore_pyerrors.h"
#include "pycore_pystate.h"
Py_INCREF(*args);
fastlocals[i] = *args++;
}
- PyObject *result = PyEval_EvalFrameEx(f, 0);
+ PyObject *result = _PyEval_EvalFrame(tstate, f, 0);
if (Py_REFCNT(f) > 1) {
Py_DECREF(f);
/* Generator object implementation */
#include "Python.h"
+#include "pycore_ceval.h" /* _PyEval_EvalFrame() */
#include "pycore_object.h"
#include "pycore_pystate.h"
#include "frameobject.h"
gen->gi_running = 1;
gen->gi_exc_state.previous_item = tstate->exc_info;
tstate->exc_info = &gen->gi_exc_state;
- result = PyEval_EvalFrameEx(f, exc);
+ result = _PyEval_EvalFrame(tstate, f, exc);
tstate->exc_info = gen->gi_exc_state.previous_item;
gen->gi_exc_state.previous_item = NULL;
gen->gi_running = 0;
/* Interpreter main loop */
PyObject *
-PyEval_EvalFrame(PyFrameObject *f) {
+PyEval_EvalFrame(PyFrameObject *f)
+{
/* This is for backward compatibility with extension modules that
used this API; core interpreter code should call
PyEval_EvalFrameEx() */
- return PyEval_EvalFrameEx(f, 0);
+ PyThreadState *tstate = _PyThreadState_GET();
+ return _PyEval_EvalFrame(tstate, f, 0);
}
PyObject *
PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
{
- PyInterpreterState *interp = _PyInterpreterState_GET_UNSAFE();
- return interp->eval_frame(f, throwflag);
+ PyThreadState *tstate = _PyThreadState_GET();
+ return _PyEval_EvalFrame(tstate, f, throwflag);
}
PyObject* _Py_HOT_FUNCTION
return gen;
}
- retval = PyEval_EvalFrameEx(f,0);
+ retval = _PyEval_EvalFrame(tstate, f, 0);
fail: /* Jump here from prelude on failure */