| 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_structs.h" |
| 9 |
|
| 10 |
extern PyTypeObject _PyContextTokenMissing_Type; |
| 11 |
|
| 12 |
/* runtime lifecycle */ |
| 13 |
|
| 14 |
PyStatus _PyContext_Init(PyInterpreterState *); |
| 15 |
|
| 16 |
|
| 17 |
/* other API */ |
| 18 |
|
| 19 |
typedef struct { |
| 20 |
PyObject_HEAD |
| 21 |
} _PyContextTokenMissing; |
| 22 |
|
| 23 |
struct _pycontextobject { |
| 24 |
PyObject_HEAD |
| 25 |
PyContext *ctx_prev; |
| 26 |
PyHamtObject *ctx_vars; |
| 27 |
PyObject *ctx_weakreflist; |
| 28 |
int ctx_entered; |
| 29 |
}; |
| 30 |
|
| 31 |
|
| 32 |
struct _pycontextvarobject { |
| 33 |
PyObject_HEAD |
| 34 |
PyObject *var_name; |
| 35 |
PyObject *var_default; |
| 36 |
#ifndef Py_GIL_DISABLED |
| 37 |
PyObject *var_cached; |
| 38 |
uint64_t var_cached_tsid; |
| 39 |
uint64_t var_cached_tsver; |
| 40 |
#endif |
| 41 |
Py_hash_t var_hash; |
| 42 |
}; |
| 43 |
|
| 44 |
|
| 45 |
struct _pycontexttokenobject { |
| 46 |
PyObject_HEAD |
| 47 |
PyContext *tok_ctx; |
| 48 |
PyContextVar *tok_var; |
| 49 |
PyObject *tok_oldval; |
| 50 |
int tok_used; |
| 51 |
}; |
| 52 |
|
| 53 |
|
| 54 |
// _testinternalcapi.hamt() used by tests. |
| 55 |
// Export for '_testcapi' shared extension |
| 56 |
PyAPI_FUNC(PyObject*) _PyContext_NewHamtForTests(void); |
| 57 |
|
| 58 |
|
| 59 |
#endif /* !Py_INTERNAL_CONTEXT_H */ |