File indexing completed on 2025-03-13 09:20:57
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_hamt.h" /* PyHamtObject */
0009
0010
0011 extern PyTypeObject _PyContextTokenMissing_Type;
0012
0013
0014
0015 PyStatus _PyContext_Init(PyInterpreterState *);
0016 void _PyContext_Fini(PyInterpreterState *);
0017
0018
0019
0020
0021 typedef struct {
0022 PyObject_HEAD
0023 } _PyContextTokenMissing;
0024
0025 #ifndef WITH_FREELISTS
0026
0027 # define PyContext_MAXFREELIST 0
0028 #endif
0029
0030 #ifndef PyContext_MAXFREELIST
0031 # define PyContext_MAXFREELIST 255
0032 #endif
0033
0034 struct _Py_context_state {
0035 #if PyContext_MAXFREELIST > 0
0036
0037 PyContext *freelist;
0038 int numfree;
0039 #endif
0040 };
0041
0042 struct _pycontextobject {
0043 PyObject_HEAD
0044 PyContext *ctx_prev;
0045 PyHamtObject *ctx_vars;
0046 PyObject *ctx_weakreflist;
0047 int ctx_entered;
0048 };
0049
0050
0051 struct _pycontextvarobject {
0052 PyObject_HEAD
0053 PyObject *var_name;
0054 PyObject *var_default;
0055 PyObject *var_cached;
0056 uint64_t var_cached_tsid;
0057 uint64_t var_cached_tsver;
0058 Py_hash_t var_hash;
0059 };
0060
0061
0062 struct _pycontexttokenobject {
0063 PyObject_HEAD
0064 PyContext *tok_ctx;
0065 PyContextVar *tok_var;
0066 PyObject *tok_oldval;
0067 int tok_used;
0068 };
0069
0070
0071 #endif