Mercurial > cpython-lru_cache-weakref
annotate Include/genobject.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 | 51bb7b1ae765 |
| children |
| rev | line source |
|---|---|
|
32175
8ee5a56b8031
Patch #957398: Add public API for Generator Object/Type.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff
changeset
|
1 |
|
8ee5a56b8031
Patch #957398: Add public API for Generator Object/Type.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff
changeset
|
2 /* Generator object interface */ |
|
8ee5a56b8031
Patch #957398: Add public API for Generator Object/Type.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff
changeset
|
3 |
|
8ee5a56b8031
Patch #957398: Add public API for Generator Object/Type.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff
changeset
|
4 #ifndef Py_GENOBJECT_H |
|
8ee5a56b8031
Patch #957398: Add public API for Generator Object/Type.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff
changeset
|
5 #define Py_GENOBJECT_H |
|
8ee5a56b8031
Patch #957398: Add public API for Generator Object/Type.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff
changeset
|
6 #ifdef __cplusplus |
|
8ee5a56b8031
Patch #957398: Add public API for Generator Object/Type.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff
changeset
|
7 extern "C" { |
|
8ee5a56b8031
Patch #957398: Add public API for Generator Object/Type.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff
changeset
|
8 #endif |
|
8ee5a56b8031
Patch #957398: Add public API for Generator Object/Type.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff
changeset
|
9 |
|
32421
485d2ef43419
Patch #966493: Cleanup generator/eval_frame exposure.
Martin v. Löwis <martin@v.loewis.de>
parents:
32175
diff
changeset
|
10 struct _frame; /* Avoid including frameobject.h */ |
|
485d2ef43419
Patch #966493: Cleanup generator/eval_frame exposure.
Martin v. Löwis <martin@v.loewis.de>
parents:
32175
diff
changeset
|
11 |
|
32175
8ee5a56b8031
Patch #957398: Add public API for Generator Object/Type.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff
changeset
|
12 typedef struct { |
|
8ee5a56b8031
Patch #957398: Add public API for Generator Object/Type.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff
changeset
|
13 PyObject_HEAD |
|
8ee5a56b8031
Patch #957398: Add public API for Generator Object/Type.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff
changeset
|
14 /* The gi_ prefix is intended to remind of generator-iterator. */ |
|
8ee5a56b8031
Patch #957398: Add public API for Generator Object/Type.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff
changeset
|
15 |
|
37642
22f2c92a1da7
Don't set gi_frame to Py_None, use NULL instead, eliminating some insane
Phillip J. Eby <pje@telecommunity.com>
parents:
37564
diff
changeset
|
16 /* Note: gi_frame can be NULL if the generator is "finished" */ |
|
32421
485d2ef43419
Patch #966493: Cleanup generator/eval_frame exposure.
Martin v. Löwis <martin@v.loewis.de>
parents:
32175
diff
changeset
|
17 struct _frame *gi_frame; |
|
32175
8ee5a56b8031
Patch #957398: Add public API for Generator Object/Type.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff
changeset
|
18 |
|
8ee5a56b8031
Patch #957398: Add public API for Generator Object/Type.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff
changeset
|
19 /* True if generator is being executed. */ |
|
8ee5a56b8031
Patch #957398: Add public API for Generator Object/Type.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff
changeset
|
20 int gi_running; |
|
44976
51bb7b1ae765
#1473257: add generator.gi_code attribute that refers to
Georg Brandl <georg@python.org>
parents:
44350
diff
changeset
|
21 |
|
51bb7b1ae765
#1473257: add generator.gi_code attribute that refers to
Georg Brandl <georg@python.org>
parents:
44350
diff
changeset
|
22 /* The code object backing the generator */ |
|
51bb7b1ae765
#1473257: add generator.gi_code attribute that refers to
Georg Brandl <georg@python.org>
parents:
44350
diff
changeset
|
23 PyObject *gi_code; |
|
32175
8ee5a56b8031
Patch #957398: Add public API for Generator Object/Type.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff
changeset
|
24 |
|
8ee5a56b8031
Patch #957398: Add public API for Generator Object/Type.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff
changeset
|
25 /* List of weak reference. */ |
|
8ee5a56b8031
Patch #957398: Add public API for Generator Object/Type.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff
changeset
|
26 PyObject *gi_weakreflist; |
|
8ee5a56b8031
Patch #957398: Add public API for Generator Object/Type.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff
changeset
|
27 } PyGenObject; |
|
8ee5a56b8031
Patch #957398: Add public API for Generator Object/Type.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff
changeset
|
28 |
|
8ee5a56b8031
Patch #957398: Add public API for Generator Object/Type.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff
changeset
|
29 PyAPI_DATA(PyTypeObject) PyGen_Type; |
|
8ee5a56b8031
Patch #957398: Add public API for Generator Object/Type.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff
changeset
|
30 |
|
8ee5a56b8031
Patch #957398: Add public API for Generator Object/Type.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff
changeset
|
31 #define PyGen_Check(op) PyObject_TypeCheck(op, &PyGen_Type) |
|
44350
26384b8180c7
#1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT. Macros for b/w compatibility are available.
Christian Heimes <christian@cheimes.de>
parents:
42333
diff
changeset
|
32 #define PyGen_CheckExact(op) (Py_TYPE(op) == &PyGen_Type) |
|
32175
8ee5a56b8031
Patch #957398: Add public API for Generator Object/Type.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff
changeset
|
33 |
|
32421
485d2ef43419
Patch #966493: Cleanup generator/eval_frame exposure.
Martin v. Löwis <martin@v.loewis.de>
parents:
32175
diff
changeset
|
34 PyAPI_FUNC(PyObject *) PyGen_New(struct _frame *); |
|
37564
c782cf6b516e
SF Patch #1463867: Improved generator finalization to allow generators
Phillip J. Eby <pje@telecommunity.com>
parents:
32421
diff
changeset
|
35 PyAPI_FUNC(int) PyGen_NeedsFinalizing(PyGenObject *); |
|
32175
8ee5a56b8031
Patch #957398: Add public API for Generator Object/Type.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff
changeset
|
36 |
|
8ee5a56b8031
Patch #957398: Add public API for Generator Object/Type.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff
changeset
|
37 #ifdef __cplusplus |
|
8ee5a56b8031
Patch #957398: Add public API for Generator Object/Type.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff
changeset
|
38 } |
|
8ee5a56b8031
Patch #957398: Add public API for Generator Object/Type.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff
changeset
|
39 #endif |
|
8ee5a56b8031
Patch #957398: Add public API for Generator Object/Type.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff
changeset
|
40 #endif /* !Py_GENOBJECT_H */ |
