/home/mdboom/Work/builds/cpython/Include/internal/pycore_genobject.h
Line | Count | Source |
1 | #ifndef Py_INTERNAL_GENOBJECT_H |
2 | #define Py_INTERNAL_GENOBJECT_H |
3 | #ifdef __cplusplus |
4 | extern "C" { |
5 | #endif |
6 | |
7 | #ifndef Py_BUILD_CORE |
8 | # error "this header requires Py_BUILD_CORE define" |
9 | #endif |
10 | |
11 | extern PyObject *_PyGen_yf(PyGenObject *); |
12 | extern PyObject *_PyCoro_GetAwaitableIter(PyObject *o); |
13 | extern PyObject *_PyAsyncGenValueWrapperNew(PyObject *); |
14 | |
15 | /* runtime lifecycle */ |
16 | |
17 | extern void _PyAsyncGen_Fini(PyInterpreterState *); |
18 | |
19 | |
20 | /* other API */ |
21 | |
22 | #ifndef WITH_FREELISTS |
23 | // without freelists |
24 | # define _PyAsyncGen_MAXFREELIST 0 |
25 | #endif |
26 | |
27 | #ifndef _PyAsyncGen_MAXFREELIST |
28 | # define _PyAsyncGen_MAXFREELIST 80 |
29 | #endif |
30 | |
31 | struct _Py_async_gen_state { |
32 | #if _PyAsyncGen_MAXFREELIST > 0 |
33 | /* Freelists boost performance 6-10%; they also reduce memory |
34 | fragmentation, as _PyAsyncGenWrappedValue and PyAsyncGenASend |
35 | are short-living objects that are instantiated for every |
36 | __anext__() call. */ |
37 | struct _PyAsyncGenWrappedValue* value_freelist[_PyAsyncGen_MAXFREELIST]; |
38 | int value_numfree; |
39 | |
40 | struct PyAsyncGenASend* asend_freelist[_PyAsyncGen_MAXFREELIST]; |
41 | int asend_numfree; |
42 | #endif |
43 | }; |
44 | |
45 | |
46 | #ifdef __cplusplus |
47 | } |
48 | #endif |
49 | #endif /* !Py_INTERNAL_GENOBJECT_H */ |