summaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/src/Include/cpython/frameobject.h
diff options
context:
space:
mode:
authorshadchin <[email protected]>2022-04-18 12:39:32 +0300
committershadchin <[email protected]>2022-04-18 12:39:32 +0300
commitd4be68e361f4258cf0848fc70018dfe37a2acc24 (patch)
tree153e294cd97ac8b5d7a989612704a0c1f58e8ad4 /contrib/tools/python3/src/Include/cpython/frameobject.h
parent260c02f5ccf242d9d9b8a873afaf6588c00237d6 (diff)
IGNIETFERRO-1816 Update Python 3 from 3.9.12 to 3.10.4
ref:9f96be6d02ee8044fdd6f124b799b270c20ce641
Diffstat (limited to 'contrib/tools/python3/src/Include/cpython/frameobject.h')
-rw-r--r--contrib/tools/python3/src/Include/cpython/frameobject.h50
1 files changed, 30 insertions, 20 deletions
diff --git a/contrib/tools/python3/src/Include/cpython/frameobject.h b/contrib/tools/python3/src/Include/cpython/frameobject.h
index 36a51baae87..5122ec41a3d 100644
--- a/contrib/tools/python3/src/Include/cpython/frameobject.h
+++ b/contrib/tools/python3/src/Include/cpython/frameobject.h
@@ -4,9 +4,20 @@
# error "this header file must not be included directly"
#endif
-#ifdef __cplusplus
-extern "C" {
-#endif
+/* These values are chosen so that the inline functions below all
+ * compare f_state to zero.
+ */
+enum _framestate {
+ FRAME_CREATED = -2,
+ FRAME_SUSPENDED = -1,
+ FRAME_EXECUTING = 0,
+ FRAME_RETURNED = 1,
+ FRAME_UNWINDING = 2,
+ FRAME_RAISED = 3,
+ FRAME_CLEARED = 4
+};
+
+typedef signed char PyFrameState;
typedef struct {
int b_type; /* what kind of block this is */
@@ -22,11 +33,8 @@ struct _frame {
PyObject *f_globals; /* global symbol table (PyDictObject) */
PyObject *f_locals; /* local symbol table (any mapping) */
PyObject **f_valuestack; /* points after the last local */
- /* Next free slot in f_valuestack. Frame creation sets to f_valuestack.
- Frame evaluation usually NULLs it, but a frame that yields sets it
- to the current stack top. */
- PyObject **f_stacktop;
PyObject *f_trace; /* Trace function */
+ int f_stackdepth; /* Depth of value stack */
char f_trace_lines; /* Emit per-line trace events? */
char f_trace_opcodes; /* Emit per-opcode trace events? */
@@ -34,18 +42,24 @@ struct _frame {
PyObject *f_gen;
int f_lasti; /* Last instruction if called */
- /* Call PyFrame_GetLineNumber() instead of reading this field
- directly. As of 2.3 f_lineno is only valid when tracing is
- active (i.e. when f_trace is set). At other times we use
- PyCode_Addr2Line to calculate the line from the current
- bytecode index. */
- int f_lineno; /* Current line number */
+ int f_lineno; /* Current line number. Only valid if non-zero */
int f_iblock; /* index in f_blockstack */
- char f_executing; /* whether the frame is still executing */
+ PyFrameState f_state; /* What state the frame is in */
PyTryBlock f_blockstack[CO_MAXBLOCKS]; /* for try and loop blocks */
PyObject *f_localsplus[1]; /* locals+stack, dynamically sized */
};
+static inline int _PyFrame_IsRunnable(struct _frame *f) {
+ return f->f_state < FRAME_EXECUTING;
+}
+
+static inline int _PyFrame_IsExecuting(struct _frame *f) {
+ return f->f_state == FRAME_EXECUTING;
+}
+
+static inline int _PyFrameHasCompleted(struct _frame *f) {
+ return f->f_state > FRAME_EXECUTING;
+}
/* Standard object interface */
@@ -57,8 +71,8 @@ PyAPI_FUNC(PyFrameObject *) PyFrame_New(PyThreadState *, PyCodeObject *,
PyObject *, PyObject *);
/* only internal use */
-PyFrameObject* _PyFrame_New_NoTrack(PyThreadState *, PyCodeObject *,
- PyObject *, PyObject *);
+PyFrameObject*
+_PyFrame_New_NoTrack(PyThreadState *, PyFrameConstructor *, PyObject *);
/* The rest of the interface is specific for frame objects */
@@ -78,7 +92,3 @@ PyAPI_FUNC(void) PyFrame_FastToLocals(PyFrameObject *);
PyAPI_FUNC(void) _PyFrame_DebugMallocStats(FILE *out);
PyAPI_FUNC(PyFrameObject *) PyFrame_GetBack(PyFrameObject *frame);
-
-#ifdef __cplusplus
-}
-#endif