bpo-38644: Add _PyEval_EvalFrame() with tstate (GH-17131) · python/cpython@b9e6812 · GitHub
Skip to content

Commit b9e6812

Browse files
authored
bpo-38644: Add _PyEval_EvalFrame() with tstate (GH-17131)
Add _PyEval_EvalFrame() static inline function to get eval_frame from tstate->interp.
1 parent 3ccdd9b commit b9e6812

4 files changed

Lines changed: 20 additions & 7 deletions

File tree

Include/internal/pycore_ceval.h

Lines changed: 9 additions & 0 deletions

Objects/call.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "Python.h"
2+
#include "pycore_ceval.h" /* _PyEval_EvalFrame() */
23
#include "pycore_object.h"
34
#include "pycore_pyerrors.h"
45
#include "pycore_pystate.h"
@@ -303,7 +304,7 @@ function_code_fastcall(PyCodeObject *co, PyObject *const *args, Py_ssize_t nargs
303304
Py_INCREF(*args);
304305
fastlocals[i] = *args++;
305306
}
306-
PyObject *result = PyEval_EvalFrameEx(f, 0);
307+
PyObject *result = _PyEval_EvalFrame(tstate, f, 0);
307308

308309
if (Py_REFCNT(f) > 1) {
309310
Py_DECREF(f);

Objects/genobject.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* Generator object implementation */
22

33
#include "Python.h"
4+
#include "pycore_ceval.h" /* _PyEval_EvalFrame() */
45
#include "pycore_object.h"
56
#include "pycore_pystate.h"
67
#include "frameobject.h"
@@ -219,7 +220,7 @@ gen_send_ex(PyGenObject *gen, PyObject *arg, int exc, int closing)
219220
gen->gi_running = 1;
220221
gen->gi_exc_state.previous_item = tstate->exc_info;
221222
tstate->exc_info = &gen->gi_exc_state;
222-
result = PyEval_EvalFrameEx(f, exc);
223+
result = _PyEval_EvalFrame(tstate, f, exc);
223224
tstate->exc_info = gen->gi_exc_state.previous_item;
224225
gen->gi_exc_state.previous_item = NULL;
225226
gen->gi_running = 0;

Python/ceval.c

Lines changed: 7 additions & 5 deletions

0 commit comments

Comments
 (0)