Mercurial > cpython-lru_cache-weakref
annotate Include/genobject.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 | cfbf6aa5c9e3 |
| children | c89febab4648 |
| 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 |
|
66664
62b61abd02b8
Merge branches/pep-0384.
Martin v. Löwis <martin@v.loewis.de>
parents:
44999
diff
changeset
|
4 #ifndef Py_LIMITED_API |
|
32175
8ee5a56b8031
Patch #957398: Add public API for Generator Object/Type.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff
changeset
|
5 #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
|
6 #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
|
7 #ifdef __cplusplus |
|
8ee5a56b8031
Patch #957398: Add public API for Generator Object/Type.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff
changeset
|
8 extern "C" { |
|
8ee5a56b8031
Patch #957398: Add public API for Generator Object/Type.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff
changeset
|
9 #endif |
|
8ee5a56b8031
Patch #957398: Add public API for Generator Object/Type.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff
changeset
|
10 |
|
32421
485d2ef43419
Patch #966493: Cleanup generator/eval_frame exposure.
Martin v. Löwis <martin@v.loewis.de>
parents:
32175
diff
changeset
|
11 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
|
12 |
|
32175
8ee5a56b8031
Patch #957398: Add public API for Generator Object/Type.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff
changeset
|
13 typedef struct { |
| 74378 | 14 PyObject_HEAD |
| 15 /* The gi_ prefix is intended to remind of generator-iterator. */ | |
|
32175
8ee5a56b8031
Patch #957398: Add public API for Generator Object/Type.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff
changeset
|
16 |
| 74378 | 17 /* Note: gi_frame can be NULL if the generator is "finished" */ |
| 18 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
|
19 |
| 74378 | 20 /* True if generator is being executed. */ |
|
75522
713db33a4ebc
Fix regression after c8d1df9ac987
Antoine Pitrou <solipsis@pitrou.net>
parents:
74378
diff
changeset
|
21 char gi_running; |
|
75714
72556ff86828
perform yield from delegation by repeating YIELD_FROM opcode (closes #14230)
Benjamin Peterson <benjamin@python.org>
parents:
75522
diff
changeset
|
22 |
| 74378 | 23 /* The code object backing the generator */ |
| 24 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
|
25 |
| 74378 | 26 /* List of weak reference. */ |
| 27 PyObject *gi_weakreflist; | |
|
32175
8ee5a56b8031
Patch #957398: Add public API for Generator Object/Type.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff
changeset
|
28 } PyGenObject; |
|
8ee5a56b8031
Patch #957398: Add public API for Generator Object/Type.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff
changeset
|
29 |
|
8ee5a56b8031
Patch #957398: Add public API for Generator Object/Type.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff
changeset
|
30 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
|
31 |
|
8ee5a56b8031
Patch #957398: Add public API for Generator Object/Type.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff
changeset
|
32 #define PyGen_Check(op) PyObject_TypeCheck(op, &PyGen_Type) |
|
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
|
33 #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
|
34 |
|
32421
485d2ef43419
Patch #966493: Cleanup generator/eval_frame exposure.
Martin v. Löwis <martin@v.loewis.de>
parents:
32175
diff
changeset
|
35 PyAPI_FUNC(PyObject *) PyGen_New(struct _frame *); |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
32421
diff
changeset
|
36 PyAPI_FUNC(int) PyGen_NeedsFinalizing(PyGenObject *); |
|
77476
cfbf6aa5c9e3
Issue #13783: the PEP 380 implementation no longer expands the public C API
Nick Coghlan <ncoghlan@gmail.com>
parents:
75714
diff
changeset
|
37 PyAPI_FUNC(int) _PyGen_FetchStopIterationValue(PyObject **); |
|
75714
72556ff86828
perform yield from delegation by repeating YIELD_FROM opcode (closes #14230)
Benjamin Peterson <benjamin@python.org>
parents:
75522
diff
changeset
|
38 PyObject *_PyGen_Send(PyGenObject *, PyObject *); |
|
32175
8ee5a56b8031
Patch #957398: Add public API for Generator Object/Type.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff
changeset
|
39 |
|
8ee5a56b8031
Patch #957398: Add public API for Generator Object/Type.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff
changeset
|
40 #ifdef __cplusplus |
|
8ee5a56b8031
Patch #957398: Add public API for Generator Object/Type.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff
changeset
|
41 } |
|
8ee5a56b8031
Patch #957398: Add public API for Generator Object/Type.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff
changeset
|
42 #endif |
|
8ee5a56b8031
Patch #957398: Add public API for Generator Object/Type.
Martin v. Löwis <martin@v.loewis.de>
parents:
diff
changeset
|
43 #endif /* !Py_GENOBJECT_H */ |
|
66664
62b61abd02b8
Merge branches/pep-0384.
Martin v. Löwis <martin@v.loewis.de>
parents:
44999
diff
changeset
|
44 #endif /* Py_LIMITED_API */ |
