annotate Include/frameobject.h @ 79675:c0a2294de787 2.7

Issue #16199: Backport 2to3 typo fix from 3.2.
author Chris Jerdonek <chris.jerdonek@gmail.com>
date Thu, 11 Oct 2012 16:15:46 -0700
parents 9ef683d41c9b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
145
853b736a6a9e Added copyright notice.
Guido van Rossum <guido@python.org>
parents: 86
diff changeset
1
86
a6934380c6e7 "Compiling" version
Guido van Rossum <guido@python.org>
parents:
diff changeset
2 /* Frame object interface */
a6934380c6e7 "Compiling" version
Guido van Rossum <guido@python.org>
parents:
diff changeset
3
13444
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
4 #ifndef Py_FRAMEOBJECT_H
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
5 #define Py_FRAMEOBJECT_H
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
6 #ifdef __cplusplus
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
7 extern "C" {
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
8 #endif
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
9
86
a6934380c6e7 "Compiling" version
Guido van Rossum <guido@python.org>
parents:
diff changeset
10 typedef struct {
13444
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
11 int b_type; /* what kind of block this is */
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
12 int b_handler; /* where to jump to find handler */
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
13 int b_level; /* value stack level to pop to */
2129
05360cd616ae The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents: 2098
diff changeset
14 } PyTryBlock;
86
a6934380c6e7 "Compiling" version
Guido van Rossum <guido@python.org>
parents:
diff changeset
15
a6934380c6e7 "Compiling" version
Guido van Rossum <guido@python.org>
parents:
diff changeset
16 typedef struct _frame {
19575
7edc2fce1f88 Make frames a PyVarObject instead of a PyObject.
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents: 18237
diff changeset
17 PyObject_VAR_HEAD
13444
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
18 struct _frame *f_back; /* previous frame, or NULL */
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
19 PyCodeObject *f_code; /* code segment */
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
20 PyObject *f_builtins; /* builtin symbol table (PyDictObject) */
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
21 PyObject *f_globals; /* global symbol table (PyDictObject) */
32463
d4a59230e93a SF Bug #215126: Over restricted type checking on eval() function
Raymond Hettinger <python@rcn.com>
parents: 25207
diff changeset
22 PyObject *f_locals; /* local symbol table (any mapping) */
13444
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
23 PyObject **f_valuestack; /* points after the last local */
18237
f02605b8fdc1 PyFrameObject: rename f_stackbottom to f_stacktop, since it points to
Tim Peters <tim.peters@gmail.com>
parents: 18148
diff changeset
24 /* Next free slot in f_valuestack. Frame creation sets to f_valuestack.
f02605b8fdc1 PyFrameObject: rename f_stackbottom to f_stacktop, since it points to
Tim Peters <tim.peters@gmail.com>
parents: 18148
diff changeset
25 Frame evaluation usually NULLs it, but a frame that yields sets it
f02605b8fdc1 PyFrameObject: rename f_stackbottom to f_stacktop, since it points to
Tim Peters <tim.peters@gmail.com>
parents: 18148
diff changeset
26 to the current stack top. */
f02605b8fdc1 PyFrameObject: rename f_stackbottom to f_stacktop, since it points to
Tim Peters <tim.peters@gmail.com>
parents: 18148
diff changeset
27 PyObject **f_stacktop;
13444
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
28 PyObject *f_trace; /* Trace function */
38418
708eaf0896bf Patch 1145039.
Tim Peters <tim.peters@gmail.com>
parents: 38253
diff changeset
29
708eaf0896bf Patch 1145039.
Tim Peters <tim.peters@gmail.com>
parents: 38253
diff changeset
30 /* If an exception is raised in this frame, the next three are used to
708eaf0896bf Patch 1145039.
Tim Peters <tim.peters@gmail.com>
parents: 38253
diff changeset
31 * record the exception info (if any) originally in the thread state. See
708eaf0896bf Patch 1145039.
Tim Peters <tim.peters@gmail.com>
parents: 38253
diff changeset
32 * comments before set_exc_info() -- it's not obvious.
708eaf0896bf Patch 1145039.
Tim Peters <tim.peters@gmail.com>
parents: 38253
diff changeset
33 * Invariant: if _type is NULL, then so are _value and _traceback.
708eaf0896bf Patch 1145039.
Tim Peters <tim.peters@gmail.com>
parents: 38253
diff changeset
34 * Desired invariant: all three are NULL, or all three are non-NULL. That
708eaf0896bf Patch 1145039.
Tim Peters <tim.peters@gmail.com>
parents: 38253
diff changeset
35 * one isn't currently true, but "should be".
708eaf0896bf Patch 1145039.
Tim Peters <tim.peters@gmail.com>
parents: 38253
diff changeset
36 */
13444
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
37 PyObject *f_exc_type, *f_exc_value, *f_exc_traceback;
38418
708eaf0896bf Patch 1145039.
Tim Peters <tim.peters@gmail.com>
parents: 38253
diff changeset
38
13444
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
39 PyThreadState *f_tstate;
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
40 int f_lasti; /* Last instruction if called */
53931
9ef683d41c9b Issue 5954, PyFrame_GetLineNumber:
Jeffrey Yasskin <jyasskin@gmail.com>
parents: 45341
diff changeset
41 /* Call PyFrame_GetLineNumber() instead of reading this field
9ef683d41c9b Issue 5954, PyFrame_GetLineNumber:
Jeffrey Yasskin <jyasskin@gmail.com>
parents: 45341
diff changeset
42 directly. As of 2.3 f_lineno is only valid when tracing is
9ef683d41c9b Issue 5954, PyFrame_GetLineNumber:
Jeffrey Yasskin <jyasskin@gmail.com>
parents: 45341
diff changeset
43 active (i.e. when f_trace is set). At other times we use
9ef683d41c9b Issue 5954, PyFrame_GetLineNumber:
Jeffrey Yasskin <jyasskin@gmail.com>
parents: 45341
diff changeset
44 PyCode_Addr2Line to calculate the line from the current
9ef683d41c9b Issue 5954, PyFrame_GetLineNumber:
Jeffrey Yasskin <jyasskin@gmail.com>
parents: 45341
diff changeset
45 bytecode index. */
13444
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
46 int f_lineno; /* Current line number */
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
47 int f_iblock; /* index in f_blockstack */
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
48 PyTryBlock f_blockstack[CO_MAXBLOCKS]; /* for try and loop blocks */
5709ddba423c ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
49 PyObject *f_localsplus[1]; /* locals+stack, dynamically sized */
2129
05360cd616ae The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents: 2098
diff changeset
50 } PyFrameObject;
86
a6934380c6e7 "Compiling" version
Guido van Rossum <guido@python.org>
parents:
diff changeset
51
a6934380c6e7 "Compiling" version
Guido van Rossum <guido@python.org>
parents:
diff changeset
52
a6934380c6e7 "Compiling" version
Guido van Rossum <guido@python.org>
parents:
diff changeset
53 /* Standard object interface */
a6934380c6e7 "Compiling" version
Guido van Rossum <guido@python.org>
parents:
diff changeset
54
24752
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24232
diff changeset
55 PyAPI_DATA(PyTypeObject) PyFrame_Type;
2129
05360cd616ae The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents: 2098
diff changeset
56
05360cd616ae The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents: 2098
diff changeset
57 #define PyFrame_Check(op) ((op)->ob_type == &PyFrame_Type)
38766
79983cf634c0 Get rid of f_restricted too. Doc the other 4 ints that were already removed
Neal Norwitz <nnorwitz@gmail.com>
parents: 38418
diff changeset
58 #define PyFrame_IsRestricted(f) \
79983cf634c0 Get rid of f_restricted too. Doc the other 4 ints that were already removed
Neal Norwitz <nnorwitz@gmail.com>
parents: 38418
diff changeset
59 ((f)->f_builtins != (f)->f_tstate->interp->builtins)
86
a6934380c6e7 "Compiling" version
Guido van Rossum <guido@python.org>
parents:
diff changeset
60
24752
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24232
diff changeset
61 PyAPI_FUNC(PyFrameObject *) PyFrame_New(PyThreadState *, PyCodeObject *,
17034
ba81d79dc3a3 Variety of small INC/DECREF patches that fix reported memory leaks
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 16355
diff changeset
62 PyObject *, PyObject *);
86
a6934380c6e7 "Compiling" version
Guido van Rossum <guido@python.org>
parents:
diff changeset
63
a6934380c6e7 "Compiling" version
Guido van Rossum <guido@python.org>
parents:
diff changeset
64
a6934380c6e7 "Compiling" version
Guido van Rossum <guido@python.org>
parents:
diff changeset
65 /* The rest of the interface is specific for frame objects */
a6934380c6e7 "Compiling" version
Guido van Rossum <guido@python.org>
parents:
diff changeset
66
a6934380c6e7 "Compiling" version
Guido van Rossum <guido@python.org>
parents:
diff changeset
67 /* Block management functions */
a6934380c6e7 "Compiling" version
Guido van Rossum <guido@python.org>
parents:
diff changeset
68
24752
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24232
diff changeset
69 PyAPI_FUNC(void) PyFrame_BlockSetup(PyFrameObject *, int, int, int);
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24232
diff changeset
70 PyAPI_FUNC(PyTryBlock *) PyFrame_BlockPop(PyFrameObject *);
1079
e4c6a0dd5c2b * bltinmodule.c: added built-in function cmp(a, b)
Guido van Rossum <guido@python.org>
parents: 790
diff changeset
71
e4c6a0dd5c2b * bltinmodule.c: added built-in function cmp(a, b)
Guido van Rossum <guido@python.org>
parents: 790
diff changeset
72 /* Extend the value stack */
e4c6a0dd5c2b * bltinmodule.c: added built-in function cmp(a, b)
Guido van Rossum <guido@python.org>
parents: 790
diff changeset
73
24752
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24232
diff changeset
74 PyAPI_FUNC(PyObject **) PyFrame_ExtendStack(PyFrameObject *, int, int);
1329
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1293
diff changeset
75
1746
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1329
diff changeset
76 /* Conversions between "fast locals" and locals in dictionary */
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1329
diff changeset
77
24752
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24232
diff changeset
78 PyAPI_FUNC(void) PyFrame_LocalsToFast(PyFrameObject *, int);
c1eb668525e1 Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents: 24232
diff changeset
79 PyAPI_FUNC(void) PyFrame_FastToLocals(PyFrameObject *);
1746
1940892d2fe3 Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents: 1329
diff changeset
80
45341
65ae68c7aca3 Implemented Martin's suggestion to clear the free lists during the garbage collection of the highest generation.
Christian Heimes <christian@cheimes.de>
parents: 38766
diff changeset
81 PyAPI_FUNC(int) PyFrame_ClearFreeList(void);
65ae68c7aca3 Implemented Martin's suggestion to clear the free lists during the garbage collection of the highest generation.
Christian Heimes <christian@cheimes.de>
parents: 38766
diff changeset
82
53931
9ef683d41c9b Issue 5954, PyFrame_GetLineNumber:
Jeffrey Yasskin <jyasskin@gmail.com>
parents: 45341
diff changeset
83 /* Return the line of code the frame is currently executing. */
9ef683d41c9b Issue 5954, PyFrame_GetLineNumber:
Jeffrey Yasskin <jyasskin@gmail.com>
parents: 45341
diff changeset
84 PyAPI_FUNC(int) PyFrame_GetLineNumber(PyFrameObject *);
9ef683d41c9b Issue 5954, PyFrame_GetLineNumber:
Jeffrey Yasskin <jyasskin@gmail.com>
parents: 45341
diff changeset
85
1329
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1293
diff changeset
86 #ifdef __cplusplus
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1293
diff changeset
87 }
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1293
diff changeset
88 #endif
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1293
diff changeset
89 #endif /* !Py_FRAMEOBJECT_H */