Where Online Learning is simpler!
The C and C++ Include Header Files
/usr/include/python3.12/internal/pycore_runtime_init.h
$ cat -n /usr/include/python3.12/internal/pycore_runtime_init.h 1 #ifndef Py_INTERNAL_RUNTIME_INIT_H 2 #define Py_INTERNAL_RUNTIME_INIT_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 #include "pycore_long.h" 12 #include "pycore_object.h" 13 #include "pycore_parser.h" 14 #include "pycore_pymem_init.h" 15 #include "pycore_obmalloc_init.h" 16 17 18 extern PyTypeObject _PyExc_MemoryError; 19 20 21 /* The static initializers defined here should only be used 22 in the runtime init code (in pystate.c and pylifecycle.c). */ 23 24 25 #define _PyRuntimeState_INIT(runtime) \ 26 { \ 27 .allocators = { \ 28 .standard = _pymem_allocators_standard_INIT(runtime), \ 29 .debug = _pymem_allocators_debug_INIT, \ 30 .obj_arena = _pymem_allocators_obj_arena_INIT, \ 31 }, \ 32 .obmalloc = _obmalloc_global_state_INIT, \ 33 .pyhash_state = pyhash_state_INIT, \ 34 .signals = _signals_RUNTIME_INIT, \ 35 .interpreters = { \ 36 /* This prevents interpreters from getting created \ 37 until _PyInterpreterState_Enable() is called. */ \ 38 .next_id = -1, \ 39 }, \ 40 /* A TSS key must be initialized with Py_tss_NEEDS_INIT \ 41 in accordance with the specification. */ \ 42 .autoTSSkey = Py_tss_NEEDS_INIT, \ 43 .parser = _parser_runtime_state_INIT, \ 44 .ceval = { \ 45 .perf = _PyEval_RUNTIME_PERF_INIT, \ 46 }, \ 47 .gilstate = { \ 48 .check_enabled = 1, \ 49 }, \ 50 .fileutils = { \ 51 .force_ascii = -1, \ 52 }, \ 53 .faulthandler = _faulthandler_runtime_state_INIT, \ 54 .tracemalloc = _tracemalloc_runtime_state_INIT, \ 55 .float_state = { \ 56 .float_format = _py_float_format_unknown, \ 57 .double_format = _py_float_format_unknown, \ 58 }, \ 59 .types = { \ 60 .next_version_tag = 1, \ 61 }, \ 62 .static_objects = { \ 63 .singletons = { \ 64 .small_ints = _Py_small_ints_INIT, \ 65 .bytes_empty = _PyBytes_SIMPLE_INIT(0, 0), \ 66 .bytes_characters = _Py_bytes_characters_INIT, \ 67 .strings = { \ 68 .literals = _Py_str_literals_INIT, \ 69 .identifiers = _Py_str_identifiers_INIT, \ 70 .ascii = _Py_str_ascii_INIT, \ 71 .latin1 = _Py_str_latin1_INIT, \ 72 }, \ 73 .tuple_empty = { \ 74 .ob_base = _PyVarObject_HEAD_INIT(&PyTuple_Type, 0) \ 75 }, \ 76 .hamt_bitmap_node_empty = { \ 77 .ob_base = _PyVarObject_HEAD_INIT(&_PyHamt_BitmapNode_Type, 0) \ 78 }, \ 79 .context_token_missing = { \ 80 .ob_base = _PyObject_HEAD_INIT(&_PyContextTokenMissing_Type) \ 81 }, \ 82 }, \ 83 }, \ 84 ._main_interpreter = _PyInterpreterState_INIT(runtime._main_interpreter), \ 85 } 86 87 #define _PyInterpreterState_INIT(INTERP) \ 88 { \ 89 .id_refcount = -1, \ 90 .imports = IMPORTS_INIT, \ 91 .obmalloc = _obmalloc_state_INIT(INTERP.obmalloc), \ 92 .ceval = { \ 93 .recursion_limit = Py_DEFAULT_RECURSION_LIMIT, \ 94 }, \ 95 .gc = { \ 96 .enabled = 1, \ 97 .generations = { \ 98 /* .head is set in _PyGC_InitState(). */ \ 99 { .threshold = 700, }, \ 100 { .threshold = 10, }, \ 101 { .threshold = 10, }, \ 102 }, \ 103 }, \ 104 .object_state = _py_object_state_INIT(INTERP), \ 105 .dtoa = _dtoa_state_INIT(&(INTERP)), \ 106 .dict_state = _dict_state_INIT, \ 107 .func_state = { \ 108 .next_version = 1, \ 109 }, \ 110 .types = { \ 111 .next_version_tag = _Py_TYPE_BASE_VERSION_TAG, \ 112 }, \ 113 .static_objects = { \ 114 .singletons = { \ 115 ._not_used = 1, \ 116 .hamt_empty = { \ 117 .ob_base = _PyObject_HEAD_INIT(&_PyHamt_Type) \ 118 .h_root = (PyHamtNode*)&_Py_SINGLETON(hamt_bitmap_node_empty), \ 119 }, \ 120 .last_resort_memory_error = { \ 121 _PyObject_HEAD_INIT(&_PyExc_MemoryError) \ 122 .args = (PyObject*)&_Py_SINGLETON(tuple_empty) \ 123 }, \ 124 }, \ 125 }, \ 126 ._initial_thread = _PyThreadState_INIT, \ 127 } 128 129 #define _PyThreadState_INIT \ 130 { \ 131 .py_recursion_limit = Py_DEFAULT_RECURSION_LIMIT, \ 132 .context_ver = 1, \ 133 } 134 135 #ifdef Py_TRACE_REFS 136 # define _py_object_state_INIT(INTERP) \ 137 { \ 138 .refchain = {&INTERP.object_state.refchain, &INTERP.object_state.refchain}, \ 139 } 140 #else 141 # define _py_object_state_INIT(INTERP) \ 142 { 0 } 143 #endif 144 145 146 // global objects 147 148 #define _PyBytes_SIMPLE_INIT(CH, LEN) \ 149 { \ 150 _PyVarObject_HEAD_INIT(&PyBytes_Type, (LEN)) \ 151 .ob_shash = -1, \ 152 .ob_sval = { (CH) }, \ 153 } 154 #define _PyBytes_CHAR_INIT(CH) \ 155 { \ 156 _PyBytes_SIMPLE_INIT((CH), 1) \ 157 } 158 159 #define _PyUnicode_ASCII_BASE_INIT(LITERAL, ASCII) \ 160 { \ 161 .ob_base = _PyObject_HEAD_INIT(&PyUnicode_Type) \ 162 .length = sizeof(LITERAL) - 1, \ 163 .hash = -1, \ 164 .state = { \ 165 .kind = 1, \ 166 .compact = 1, \ 167 .ascii = (ASCII), \ 168 .statically_allocated = 1, \ 169 }, \ 170 } 171 #define _PyASCIIObject_INIT(LITERAL) \ 172 { \ 173 ._ascii = _PyUnicode_ASCII_BASE_INIT((LITERAL), 1), \ 174 ._data = (LITERAL) \ 175 } 176 #define INIT_STR(NAME, LITERAL) \ 177 ._py_ ## NAME = _PyASCIIObject_INIT(LITERAL) 178 #define INIT_ID(NAME) \ 179 ._py_ ## NAME = _PyASCIIObject_INIT(#NAME) 180 #define _PyUnicode_LATIN1_INIT(LITERAL, UTF8) \ 181 { \ 182 ._latin1 = { \ 183 ._base = _PyUnicode_ASCII_BASE_INIT((LITERAL), 0), \ 184 .utf8 = (UTF8), \ 185 .utf8_length = sizeof(UTF8) - 1, \ 186 }, \ 187 ._data = (LITERAL), \ 188 } 189 190 #include "pycore_runtime_init_generated.h" 191 192 #ifdef __cplusplus 193 } 194 #endif 195 #endif /* !Py_INTERNAL_RUNTIME_INIT_H */
Contact us
|
About us
|
Term of use
|
Copyright © 2000-2025 MyWebUniversity.com ™