/home/mdboom/Work/builds/cpython/Include/internal/pycore_context.h
Line | Count | Source |
1 | #ifndef Py_INTERNAL_CONTEXT_H |
2 | #define Py_INTERNAL_CONTEXT_H |
3 | |
4 | #ifndef Py_BUILD_CORE |
5 | # error "this header requires Py_BUILD_CORE define" |
6 | #endif |
7 | |
8 | #include "pycore_hamt.h" /* PyHamtObject */ |
9 | |
10 | |
11 | extern PyTypeObject _PyContextTokenMissing_Type; |
12 | |
13 | /* runtime lifecycle */ |
14 | |
15 | PyStatus _PyContext_Init(PyInterpreterState *); |
16 | void _PyContext_Fini(PyInterpreterState *); |
17 | |
18 | |
19 | /* other API */ |
20 | |
21 | #ifndef WITH_FREELISTS |
22 | // without freelists |
23 | # define PyContext_MAXFREELIST 0 |
24 | #endif |
25 | |
26 | #ifndef PyContext_MAXFREELIST |
27 | # define PyContext_MAXFREELIST 255 |
28 | #endif |
29 | |
30 | struct _Py_context_state { |
31 | #if PyContext_MAXFREELIST > 0 |
32 | // List of free PyContext objects |
33 | PyContext *freelist; |
34 | int numfree; |
35 | #endif |
36 | }; |
37 | |
38 | struct _pycontextobject { |
39 | PyObject_HEAD |
40 | PyContext *ctx_prev; |
41 | PyHamtObject *ctx_vars; |
42 | PyObject *ctx_weakreflist; |
43 | int ctx_entered; |
44 | }; |
45 | |
46 | |
47 | struct _pycontextvarobject { |
48 | PyObject_HEAD |
49 | PyObject *var_name; |
50 | PyObject *var_default; |
51 | PyObject *var_cached; |
52 | uint64_t var_cached_tsid; |
53 | uint64_t var_cached_tsver; |
54 | Py_hash_t var_hash; |
55 | }; |
56 | |
57 | |
58 | struct _pycontexttokenobject { |
59 | PyObject_HEAD |
60 | PyContext *tok_ctx; |
61 | PyContextVar *tok_var; |
62 | PyObject *tok_oldval; |
63 | int tok_used; |
64 | }; |
65 | |
66 | |
67 | #endif /* !Py_INTERNAL_CONTEXT_H */ |