File indexing completed on 2025-11-19 09:50:45
0001 #ifndef Py_INTERNAL_CONTEXT_H
0002 #define Py_INTERNAL_CONTEXT_H
0003
0004 #ifndef Py_BUILD_CORE
0005 # error "this header requires Py_BUILD_CORE define"
0006 #endif
0007
0008 #include "pycore_freelist.h" // _PyFreeListState
0009 #include "pycore_hamt.h" // PyHamtObject
0010
0011
0012 extern PyTypeObject _PyContextTokenMissing_Type;
0013
0014
0015
0016 PyStatus _PyContext_Init(PyInterpreterState *);
0017
0018
0019
0020
0021 typedef struct {
0022 PyObject_HEAD
0023 } _PyContextTokenMissing;
0024
0025 struct _pycontextobject {
0026 PyObject_HEAD
0027 PyContext *ctx_prev;
0028 PyHamtObject *ctx_vars;
0029 PyObject *ctx_weakreflist;
0030 int ctx_entered;
0031 };
0032
0033
0034 struct _pycontextvarobject {
0035 PyObject_HEAD
0036 PyObject *var_name;
0037 PyObject *var_default;
0038 #ifndef Py_GIL_DISABLED
0039 PyObject *var_cached;
0040 uint64_t var_cached_tsid;
0041 uint64_t var_cached_tsver;
0042 #endif
0043 Py_hash_t var_hash;
0044 };
0045
0046
0047 struct _pycontexttokenobject {
0048 PyObject_HEAD
0049 PyContext *tok_ctx;
0050 PyContextVar *tok_var;
0051 PyObject *tok_oldval;
0052 int tok_used;
0053 };
0054
0055
0056
0057
0058 PyAPI_FUNC(PyObject*) _PyContext_NewHamtForTests(void);
0059
0060
0061 #endif