bpo-38644: Add _PyEval_EvalFrame() with tstate (GH-17131)
Add _PyEval_EvalFrame() static inline function to get eval_frame from
tstate->interp.
diff --git a/Objects/call.c b/Objects/call.c
index a8ae41a..96174c4 100644
--- a/Objects/call.c
+++ b/Objects/call.c
@@ -1,4 +1,5 @@
#include "Python.h"
+#include "pycore_ceval.h" /* _PyEval_EvalFrame() */
#include "pycore_object.h"
#include "pycore_pyerrors.h"
#include "pycore_pystate.h"
@@ -303,7 +304,7 @@
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);
diff --git a/Objects/genobject.c b/Objects/genobject.c
index b72248c..98eb9c3 100644
--- a/Objects/genobject.c
+++ b/Objects/genobject.c
@@ -1,6 +1,7 @@
/* Generator object implementation */
#include "Python.h"
+#include "pycore_ceval.h" /* _PyEval_EvalFrame() */
#include "pycore_object.h"
#include "pycore_pystate.h"
#include "frameobject.h"
@@ -219,7 +220,7 @@
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;