summaryrefslogtreecommitdiffstats
path: root/Include/cpython
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-04-28 14:32:48 (GMT)
committerGitHub <noreply@github.com>2020-04-28 14:32:48 (GMT)
commit7c59d7c9860cdbaf4a9c26c9142aebd3259d046e (patch)
tree25d14f4febac1b124878b5875a936b47c6706771 /Include/cpython
parent5da352616fb8290e3c2c0245f553280824093c6a (diff)
downloadcpython-7c59d7c9860cdbaf4a9c26c9142aebd3259d046e.zip
cpython-7c59d7c9860cdbaf4a9c26c9142aebd3259d046e.tar.gz
cpython-7c59d7c9860cdbaf4a9c26c9142aebd3259d046e.tar.bz2
bpo-40421: Add pyframe.h header file (GH-19755)
Add a new separated pyframe.h header file of the PyFrame public C API: it is included by Python.h. Add PyFrame_GetLineNumber() to the limited C API. Replace "struct _frame" with "PyFrameObject" in header files. PyFrameObject is now defined as struct _frame by pyframe.h which is included early enough in Python.h.
Diffstat (limited to 'Include/cpython')
-rw-r--r--Include/cpython/ceval.h2
-rw-r--r--Include/cpython/frameobject.h7
-rw-r--r--Include/cpython/pystate.h6
-rw-r--r--Include/cpython/traceback.h2
4 files changed, 7 insertions, 10 deletions
diff --git a/Include/cpython/ceval.h b/Include/cpython/ceval.h
index 020f787..e1922a6 100644
--- a/Include/cpython/ceval.h
+++ b/Include/cpython/ceval.h
@@ -23,7 +23,7 @@ PyAPI_FUNC(PyObject *) _PyEval_GetBuiltinId(_Py_Identifier *);
flag was set, else return 0. */
PyAPI_FUNC(int) PyEval_MergeCompilerFlags(PyCompilerFlags *cf);
-PyAPI_FUNC(PyObject *) _PyEval_EvalFrameDefault(PyThreadState *tstate, struct _frame *f, int exc);
+PyAPI_FUNC(PyObject *) _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int exc);
PyAPI_FUNC(void) _PyEval_SetSwitchInterval(unsigned long microseconds);
PyAPI_FUNC(unsigned long) _PyEval_GetSwitchInterval(void);
diff --git a/Include/cpython/frameobject.h b/Include/cpython/frameobject.h
index 4ced967..e819cef 100644
--- a/Include/cpython/frameobject.h
+++ b/Include/cpython/frameobject.h
@@ -14,7 +14,7 @@ typedef struct {
int b_level; /* value stack level to pop to */
} PyTryBlock;
-typedef struct _frame {
+struct _frame {
PyObject_VAR_HEAD
struct _frame *f_back; /* previous frame, or NULL */
PyCodeObject *f_code; /* code segment */
@@ -44,7 +44,7 @@ typedef struct _frame {
char f_executing; /* whether the frame is still executing */
PyTryBlock f_blockstack[CO_MAXBLOCKS]; /* for try and loop blocks */
PyObject *f_localsplus[1]; /* locals+stack, dynamically sized */
-} PyFrameObject;
+};
/* Standard object interface */
@@ -79,9 +79,6 @@ PyAPI_FUNC(int) PyFrame_ClearFreeList(void);
PyAPI_FUNC(void) _PyFrame_DebugMallocStats(FILE *out);
-/* Return the line of code the frame is currently executing. */
-PyAPI_FUNC(int) PyFrame_GetLineNumber(PyFrameObject *);
-
#ifdef __cplusplus
}
#endif
diff --git a/Include/cpython/pystate.h b/Include/cpython/pystate.h
index 9b28f66..f292da1 100644
--- a/Include/cpython/pystate.h
+++ b/Include/cpython/pystate.h
@@ -16,7 +16,7 @@ PyAPI_FUNC(PyObject *) _PyInterpreterState_GetMainModule(PyInterpreterState *);
/* State unique per thread */
/* Py_tracefunc return -1 when raising an exception, or 0 for success. */
-typedef int (*Py_tracefunc)(PyObject *, struct _frame *, int, PyObject *);
+typedef int (*Py_tracefunc)(PyObject *, PyFrameObject *, int, PyObject *);
/* The following values are used for 'what' for tracefunc functions
*
@@ -56,7 +56,7 @@ struct _ts {
PyInterpreterState *interp;
/* Borrowed reference to the current frame (it can be NULL) */
- struct _frame *frame;
+ PyFrameObject *frame;
int recursion_depth;
char overflowed; /* The stack has overflowed. Allow 50 more calls
to handle the runtime error. */
@@ -184,7 +184,7 @@ PyAPI_FUNC(void) PyThreadState_DeleteCurrent(void);
/* Frame evaluation API */
-typedef PyObject* (*_PyFrameEvalFunction)(PyThreadState *tstate, struct _frame *, int);
+typedef PyObject* (*_PyFrameEvalFunction)(PyThreadState *tstate, PyFrameObject *, int);
PyAPI_FUNC(_PyFrameEvalFunction) _PyInterpreterState_GetEvalFrameFunc(
PyInterpreterState *interp);
diff --git a/Include/cpython/traceback.h b/Include/cpython/traceback.h
index 746097d..837470c 100644
--- a/Include/cpython/traceback.h
+++ b/Include/cpython/traceback.h
@@ -9,7 +9,7 @@ extern "C" {
typedef struct _traceback {
PyObject_HEAD
struct _traceback *tb_next;
- struct _frame *tb_frame;
+ PyFrameObject *tb_frame;
int tb_lasti;
int tb_lineno;
} PyTracebackObject;