Mercurial > cpython-lru_cache-weakref
annotate Include/frameobject.h @ 58925:eecf1bef052d 2.6
Merged revisions 78207 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r78207 | ezio.melotti | 2010-02-17 01:26:09 +0200 (Wed, 17 Feb 2010) | 1 line
#7930: fix stripid
........
| author | Ezio Melotti <ezio.melotti@gmail.com> |
|---|---|
| date | Tue, 16 Feb 2010 23:29:44 +0000 |
| parents | 65ae68c7aca3 |
| children | 9ef683d41c9b |
| rev | line source |
|---|---|
| 145 | 1 |
| 86 | 2 /* Frame object interface */ |
| 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 | 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 | 15 |
| 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 | 29 |
| 30 /* If an exception is raised in this frame, the next three are used to | |
| 31 * record the exception info (if any) originally in the thread state. See | |
| 32 * comments before set_exc_info() -- it's not obvious. | |
| 33 * Invariant: if _type is NULL, then so are _value and _traceback. | |
| 34 * Desired invariant: all three are NULL, or all three are non-NULL. That | |
| 35 * one isn't currently true, but "should be". | |
| 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 | 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 */ |
|
25207
1e46da1e6522
A slight change to SET_LINENO-less tracing.
Michael W. Hudson <mwh@python.net>
parents:
24752
diff
changeset
|
41 /* As of 2.3 f_lineno is only valid when tracing is active (i.e. when |
|
1e46da1e6522
A slight change to SET_LINENO-less tracing.
Michael W. Hudson <mwh@python.net>
parents:
24752
diff
changeset
|
42 f_trace is set) -- at other times use PyCode_Addr2Line instead. */ |
|
13444
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
43 int f_lineno; /* Current line number */ |
|
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
44 int f_iblock; /* index in f_blockstack */ |
|
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
45 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
|
46 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
|
47 } PyFrameObject; |
| 86 | 48 |
| 49 | |
| 50 /* Standard object interface */ | |
| 51 | |
|
24752
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
24232
diff
changeset
|
52 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
|
53 |
|
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2098
diff
changeset
|
54 #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
|
55 #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
|
56 ((f)->f_builtins != (f)->f_tstate->interp->builtins) |
| 86 | 57 |
|
24752
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
24232
diff
changeset
|
58 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
|
59 PyObject *, PyObject *); |
| 86 | 60 |
| 61 | |
| 62 /* The rest of the interface is specific for frame objects */ | |
| 63 | |
| 64 /* Block management functions */ | |
| 65 | |
|
24752
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
24232
diff
changeset
|
66 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
|
67 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
|
68 |
|
e4c6a0dd5c2b
* bltinmodule.c: added built-in function cmp(a, b)
Guido van Rossum <guido@python.org>
parents:
790
diff
changeset
|
69 /* Extend the value stack */ |
|
e4c6a0dd5c2b
* bltinmodule.c: added built-in function cmp(a, b)
Guido van Rossum <guido@python.org>
parents:
790
diff
changeset
|
70 |
|
24752
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
24232
diff
changeset
|
71 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
|
72 |
|
1746
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1329
diff
changeset
|
73 /* 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
|
74 |
|
24752
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
24232
diff
changeset
|
75 PyAPI_FUNC(void) PyFrame_LocalsToFast(PyFrameObject *, int); |
|
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
24232
diff
changeset
|
76 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
|
77 |
|
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
|
78 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
|
79 |
|
1329
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1293
diff
changeset
|
80 #ifdef __cplusplus |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1293
diff
changeset
|
81 } |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1293
diff
changeset
|
82 #endif |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1293
diff
changeset
|
83 #endif /* !Py_FRAMEOBJECT_H */ |
