Mercurial > cpython-lru_cache-weakref
annotate Include/frameobject.h @ 79691:05c8928362ee
Merge __next__ method link fixes with 3.3.
| author | Ezio Melotti <ezio.melotti@gmail.com> |
|---|---|
| date | Fri, 12 Oct 2012 13:46:37 +0300 |
| parents | d63a80abfbec |
| children | 2ca476e20f39 |
| rev | line source |
|---|---|
| 145 | 1 |
| 86 | 2 /* Frame object interface */ |
| 3 | |
|
66664
62b61abd02b8
Merge branches/pep-0384.
Martin v. Löwis <martin@v.loewis.de>
parents:
55372
diff
changeset
|
4 #ifndef Py_LIMITED_API |
|
13444
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
5 #ifndef Py_FRAMEOBJECT_H |
|
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
6 #define Py_FRAMEOBJECT_H |
|
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
7 #ifdef __cplusplus |
|
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
8 extern "C" { |
|
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
9 #endif |
|
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
10 |
| 86 | 11 typedef struct { |
|
74356
d64ac9ab4cd0
Implement PEP 380 - 'yield from' (closes #11682)
Nick Coghlan <ncoghlan@gmail.com>
parents:
66664
diff
changeset
|
12 int b_type; /* what kind of block this is */ |
|
d64ac9ab4cd0
Implement PEP 380 - 'yield from' (closes #11682)
Nick Coghlan <ncoghlan@gmail.com>
parents:
66664
diff
changeset
|
13 int b_handler; /* where to jump to find handler */ |
|
d64ac9ab4cd0
Implement PEP 380 - 'yield from' (closes #11682)
Nick Coghlan <ncoghlan@gmail.com>
parents:
66664
diff
changeset
|
14 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
|
15 } PyTryBlock; |
| 86 | 16 |
| 17 typedef struct _frame { | |
|
19575
7edc2fce1f88
Make frames a PyVarObject instead of a PyObject.
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents:
18237
diff
changeset
|
18 PyObject_VAR_HEAD |
|
74356
d64ac9ab4cd0
Implement PEP 380 - 'yield from' (closes #11682)
Nick Coghlan <ncoghlan@gmail.com>
parents:
66664
diff
changeset
|
19 struct _frame *f_back; /* previous frame, or NULL */ |
|
d64ac9ab4cd0
Implement PEP 380 - 'yield from' (closes #11682)
Nick Coghlan <ncoghlan@gmail.com>
parents:
66664
diff
changeset
|
20 PyCodeObject *f_code; /* code segment */ |
|
d64ac9ab4cd0
Implement PEP 380 - 'yield from' (closes #11682)
Nick Coghlan <ncoghlan@gmail.com>
parents:
66664
diff
changeset
|
21 PyObject *f_builtins; /* builtin symbol table (PyDictObject) */ |
|
d64ac9ab4cd0
Implement PEP 380 - 'yield from' (closes #11682)
Nick Coghlan <ncoghlan@gmail.com>
parents:
66664
diff
changeset
|
22 PyObject *f_globals; /* global symbol table (PyDictObject) */ |
|
d64ac9ab4cd0
Implement PEP 380 - 'yield from' (closes #11682)
Nick Coghlan <ncoghlan@gmail.com>
parents:
66664
diff
changeset
|
23 PyObject *f_locals; /* local symbol table (any mapping) */ |
|
d64ac9ab4cd0
Implement PEP 380 - 'yield from' (closes #11682)
Nick Coghlan <ncoghlan@gmail.com>
parents:
66664
diff
changeset
|
24 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
|
25 /* 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
|
26 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
|
27 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
|
28 PyObject **f_stacktop; |
|
74356
d64ac9ab4cd0
Implement PEP 380 - 'yield from' (closes #11682)
Nick Coghlan <ncoghlan@gmail.com>
parents:
66664
diff
changeset
|
29 PyObject *f_trace; /* Trace function */ |
|
38453
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
32463
diff
changeset
|
30 |
|
74356
d64ac9ab4cd0
Implement PEP 380 - 'yield from' (closes #11682)
Nick Coghlan <ncoghlan@gmail.com>
parents:
66664
diff
changeset
|
31 /* In a generator, we need to be able to swap between the exception |
|
d64ac9ab4cd0
Implement PEP 380 - 'yield from' (closes #11682)
Nick Coghlan <ncoghlan@gmail.com>
parents:
66664
diff
changeset
|
32 state inside the generator and the exception state of the calling |
|
d64ac9ab4cd0
Implement PEP 380 - 'yield from' (closes #11682)
Nick Coghlan <ncoghlan@gmail.com>
parents:
66664
diff
changeset
|
33 frame (which shouldn't be impacted when the generator "yields" |
|
d64ac9ab4cd0
Implement PEP 380 - 'yield from' (closes #11682)
Nick Coghlan <ncoghlan@gmail.com>
parents:
66664
diff
changeset
|
34 from an except handler). |
|
d64ac9ab4cd0
Implement PEP 380 - 'yield from' (closes #11682)
Nick Coghlan <ncoghlan@gmail.com>
parents:
66664
diff
changeset
|
35 These three fields exist exactly for that, and are unused for |
|
d64ac9ab4cd0
Implement PEP 380 - 'yield from' (closes #11682)
Nick Coghlan <ncoghlan@gmail.com>
parents:
66664
diff
changeset
|
36 non-generator frames. See the SAVE_EXC_STATE and SWAP_EXC_STATE |
|
d64ac9ab4cd0
Implement PEP 380 - 'yield from' (closes #11682)
Nick Coghlan <ncoghlan@gmail.com>
parents:
66664
diff
changeset
|
37 macros in ceval.c for details of their use. */ |
|
13444
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
38 PyObject *f_exc_type, *f_exc_value, *f_exc_traceback; |
|
38453
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
32463
diff
changeset
|
39 |
|
13444
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
40 PyThreadState *f_tstate; |
|
74356
d64ac9ab4cd0
Implement PEP 380 - 'yield from' (closes #11682)
Nick Coghlan <ncoghlan@gmail.com>
parents:
66664
diff
changeset
|
41 int f_lasti; /* Last instruction if called */ |
|
55372
79718ee03986
Merged revisions 72487-72488,72879 via svnmerge from
Alexandre Vassalotti <alexandre@peadrop.com>
parents:
47594
diff
changeset
|
42 /* Call PyFrame_GetLineNumber() instead of reading this field |
|
79718ee03986
Merged revisions 72487-72488,72879 via svnmerge from
Alexandre Vassalotti <alexandre@peadrop.com>
parents:
47594
diff
changeset
|
43 directly. As of 2.3 f_lineno is only valid when tracing is |
|
79718ee03986
Merged revisions 72487-72488,72879 via svnmerge from
Alexandre Vassalotti <alexandre@peadrop.com>
parents:
47594
diff
changeset
|
44 active (i.e. when f_trace is set). At other times we use |
|
79718ee03986
Merged revisions 72487-72488,72879 via svnmerge from
Alexandre Vassalotti <alexandre@peadrop.com>
parents:
47594
diff
changeset
|
45 PyCode_Addr2Line to calculate the line from the current |
|
79718ee03986
Merged revisions 72487-72488,72879 via svnmerge from
Alexandre Vassalotti <alexandre@peadrop.com>
parents:
47594
diff
changeset
|
46 bytecode index. */ |
|
74356
d64ac9ab4cd0
Implement PEP 380 - 'yield from' (closes #11682)
Nick Coghlan <ncoghlan@gmail.com>
parents:
66664
diff
changeset
|
47 int f_lineno; /* Current line number */ |
|
d64ac9ab4cd0
Implement PEP 380 - 'yield from' (closes #11682)
Nick Coghlan <ncoghlan@gmail.com>
parents:
66664
diff
changeset
|
48 int f_iblock; /* index in f_blockstack */ |
|
13444
5709ddba423c
ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents:
13256
diff
changeset
|
49 PyTryBlock f_blockstack[CO_MAXBLOCKS]; /* for try and loop blocks */ |
|
74356
d64ac9ab4cd0
Implement PEP 380 - 'yield from' (closes #11682)
Nick Coghlan <ncoghlan@gmail.com>
parents:
66664
diff
changeset
|
50 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
|
51 } PyFrameObject; |
| 86 | 52 |
| 53 | |
| 54 /* Standard object interface */ | |
| 55 | |
|
24752
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
24232
diff
changeset
|
56 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
|
57 |
|
44351
86a2679dca46
#1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT.
Christian Heimes <christian@cheimes.de>
parents:
42334
diff
changeset
|
58 #define PyFrame_Check(op) (Py_TYPE(op) == &PyFrame_Type) |
| 86 | 59 |
|
24752
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
24232
diff
changeset
|
60 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
|
61 PyObject *, PyObject *); |
| 86 | 62 |
| 63 | |
| 64 /* The rest of the interface is specific for frame objects */ | |
| 65 | |
| 66 /* Block management functions */ | |
| 67 | |
|
24752
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
24232
diff
changeset
|
68 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
|
69 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
|
70 |
|
e4c6a0dd5c2b
* bltinmodule.c: added built-in function cmp(a, b)
Guido van Rossum <guido@python.org>
parents:
790
diff
changeset
|
71 /* Extend the value stack */ |
|
e4c6a0dd5c2b
* bltinmodule.c: added built-in function cmp(a, b)
Guido van Rossum <guido@python.org>
parents:
790
diff
changeset
|
72 |
|
24752
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
24232
diff
changeset
|
73 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
|
74 |
|
1746
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1329
diff
changeset
|
75 /* 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
|
76 |
|
24752
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
24232
diff
changeset
|
77 PyAPI_FUNC(void) PyFrame_LocalsToFast(PyFrameObject *, int); |
|
c1eb668525e1
Excise DL_EXPORT from Include.
Mark Hammond <mhammond@skippinet.com.au>
parents:
24232
diff
changeset
|
78 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
|
79 |
|
45371
7c4c46342137
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60845 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44351
diff
changeset
|
80 PyAPI_FUNC(int) PyFrame_ClearFreeList(void); |
|
7c4c46342137
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60845 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44351
diff
changeset
|
81 |
|
77577
d63a80abfbec
Issue #14785: Add sys._debugmallocstats() to help debug low-level memory allocation issues
David Malcolm <dmalcolm@redhat.com>
parents:
75714
diff
changeset
|
82 PyAPI_FUNC(void) _PyFrame_DebugMallocStats(FILE *out); |
|
d63a80abfbec
Issue #14785: Add sys._debugmallocstats() to help debug low-level memory allocation issues
David Malcolm <dmalcolm@redhat.com>
parents:
75714
diff
changeset
|
83 |
|
55372
79718ee03986
Merged revisions 72487-72488,72879 via svnmerge from
Alexandre Vassalotti <alexandre@peadrop.com>
parents:
47594
diff
changeset
|
84 /* Return the line of code the frame is currently executing. */ |
|
79718ee03986
Merged revisions 72487-72488,72879 via svnmerge from
Alexandre Vassalotti <alexandre@peadrop.com>
parents:
47594
diff
changeset
|
85 PyAPI_FUNC(int) PyFrame_GetLineNumber(PyFrameObject *); |
|
79718ee03986
Merged revisions 72487-72488,72879 via svnmerge from
Alexandre Vassalotti <alexandre@peadrop.com>
parents:
47594
diff
changeset
|
86 |
|
1329
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1293
diff
changeset
|
87 #ifdef __cplusplus |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1293
diff
changeset
|
88 } |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1293
diff
changeset
|
89 #endif |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1293
diff
changeset
|
90 #endif /* !Py_FRAMEOBJECT_H */ |
|
66664
62b61abd02b8
Merge branches/pep-0384.
Martin v. Löwis <martin@v.loewis.de>
parents:
55372
diff
changeset
|
91 #endif /* Py_LIMITED_API */ |
