PyCyBase 0.1.10__cp315-cp315-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. cbase/__infra__.pxd +6 -0
  2. cbase/__init__.pxd +6 -0
  3. cbase/__init__.py +31 -0
  4. cbase/allocator_protocol/__infra__.pxd +65 -0
  5. cbase/allocator_protocol/__init__.pxd +65 -0
  6. cbase/allocator_protocol/__init__.py +45 -0
  7. cbase/allocator_protocol/c_allocator_protocol.c +31874 -0
  8. cbase/allocator_protocol/c_allocator_protocol.cp315-win_amd64.pyd +0 -0
  9. cbase/allocator_protocol/c_allocator_protocol.h +352 -0
  10. cbase/allocator_protocol/c_allocator_protocol.pxd +66 -0
  11. cbase/allocator_protocol/c_allocator_protocol.pyi +144 -0
  12. cbase/allocator_protocol/c_allocator_protocol.pyx +209 -0
  13. cbase/allocator_protocol/c_heap_allocator.c +38225 -0
  14. cbase/allocator_protocol/c_heap_allocator.cp315-win_amd64.pyd +0 -0
  15. cbase/allocator_protocol/c_heap_allocator.h +554 -0
  16. cbase/allocator_protocol/c_heap_allocator.pxd +105 -0
  17. cbase/allocator_protocol/c_heap_allocator.pyi +161 -0
  18. cbase/allocator_protocol/c_heap_allocator.pyx +303 -0
  19. cbase/allocator_protocol/c_nt_shm_allocator.c +33455 -0
  20. cbase/allocator_protocol/c_nt_shm_allocator.cp315-win_amd64.pyd +0 -0
  21. cbase/allocator_protocol/c_nt_shm_allocator.h +1105 -0
  22. cbase/allocator_protocol/c_nt_shm_allocator.pxd +110 -0
  23. cbase/allocator_protocol/c_nt_shm_allocator.pyx +223 -0
  24. cbase/allocator_protocol/c_shm_allocator.h +1270 -0
  25. cbase/allocator_protocol/c_shm_allocator.pxd +150 -0
  26. cbase/allocator_protocol/c_shm_allocator.pyi +299 -0
  27. cbase/allocator_protocol/c_shm_allocator.pyx +445 -0
  28. cbase/allocator_protocol/c_shm_comp.c +4654 -0
  29. cbase/allocator_protocol/c_shm_comp.cp315-win_amd64.pyd +0 -0
  30. cbase/allocator_protocol/c_shm_comp.h +49 -0
  31. cbase/allocator_protocol/c_shm_comp.pxd +46 -0
  32. cbase/allocator_protocol/c_shm_comp.pyx +1 -0
  33. cbase/backports/__infra__.pxd +17 -0
  34. cbase/backports/__init__.pxd +17 -0
  35. cbase/backports/__init__.py +9 -0
  36. cbase/backports/pydict.h +55 -0
  37. cbase/backports/pydict.pxd +5 -0
  38. cbase/backports/pylong.c +9965 -0
  39. cbase/backports/pylong.cp315-win_amd64.pyd +0 -0
  40. cbase/backports/pylong.h +79 -0
  41. cbase/backports/pylong.pxd +23 -0
  42. cbase/backports/pylong.pyx +61 -0
  43. cbase/bytemap/__infra__.pxd +42 -0
  44. cbase/bytemap/__init__.pxd +42 -0
  45. cbase/bytemap/__init__.py +21 -0
  46. cbase/bytemap/c_bytemap.c +52151 -0
  47. cbase/bytemap/c_bytemap.cp315-win_amd64.pyd +0 -0
  48. cbase/bytemap/c_bytemap.h +867 -0
  49. cbase/bytemap/c_bytemap.pxd +370 -0
  50. cbase/bytemap/c_bytemap.pyx +1760 -0
  51. cbase/bytemap/xxh3.h +55 -0
  52. cbase/bytemap/xxhash.c +42 -0
  53. cbase/bytemap/xxhash.h +7487 -0
  54. cbase/config_view.c +7253 -0
  55. cbase/config_view.cp315-win_amd64.pyd +0 -0
  56. cbase/config_view.pyx +85 -0
  57. cbase/env.c +11120 -0
  58. cbase/env.cp315-win_amd64.pyd +0 -0
  59. cbase/env.pxd +8 -0
  60. cbase/env.pyi +48 -0
  61. cbase/env.pyx +46 -0
  62. cbase/includes/cbase/allocator_protocol/c_allocator_protocol.c +31874 -0
  63. cbase/includes/cbase/allocator_protocol/c_allocator_protocol.h +352 -0
  64. cbase/includes/cbase/allocator_protocol/c_heap_allocator.c +38225 -0
  65. cbase/includes/cbase/allocator_protocol/c_heap_allocator.h +554 -0
  66. cbase/includes/cbase/allocator_protocol/c_nt_shm_allocator.c +33455 -0
  67. cbase/includes/cbase/allocator_protocol/c_nt_shm_allocator.h +1105 -0
  68. cbase/includes/cbase/allocator_protocol/c_shm_allocator.h +1270 -0
  69. cbase/includes/cbase/allocator_protocol/c_shm_comp.c +4654 -0
  70. cbase/includes/cbase/allocator_protocol/c_shm_comp.h +49 -0
  71. cbase/includes/cbase/backports/pydict.h +55 -0
  72. cbase/includes/cbase/backports/pylong.c +9965 -0
  73. cbase/includes/cbase/backports/pylong.h +79 -0
  74. cbase/includes/cbase/bytemap/c_bytemap.c +52151 -0
  75. cbase/includes/cbase/bytemap/c_bytemap.h +867 -0
  76. cbase/includes/cbase/bytemap/xxh3.h +55 -0
  77. cbase/includes/cbase/bytemap/xxhash.c +42 -0
  78. cbase/includes/cbase/bytemap/xxhash.h +7487 -0
  79. cbase/includes/cbase/config_view.c +7253 -0
  80. cbase/includes/cbase/env.c +11120 -0
  81. cbase/includes/cbase/int128.h +81 -0
  82. cbase/includes/cbase/intern_string/c_intern_string.c +28138 -0
  83. cbase/includes/cbase/intern_string/c_intern_string.h +614 -0
  84. cbase/includes/cbase/nt/pthread_nt_compat.h +102 -0
  85. cbase/includes/cbase/nt/regex_nt_compat.h +133 -0
  86. cbase/includes/cbase/nt/time_sched_nt_compat.h +32 -0
  87. cbase/int128.h +81 -0
  88. cbase/int128.pxd +15 -0
  89. cbase/intern_string/BENCHMARK.md +157 -0
  90. cbase/intern_string/__infra__.pxd +13 -0
  91. cbase/intern_string/__init__.pxd +13 -0
  92. cbase/intern_string/__init__.py +19 -0
  93. cbase/intern_string/c_intern_string.c +28138 -0
  94. cbase/intern_string/c_intern_string.cp315-win_amd64.pyd +0 -0
  95. cbase/intern_string/c_intern_string.h +614 -0
  96. cbase/intern_string/c_intern_string.pxd +121 -0
  97. cbase/intern_string/c_intern_string.pyi +376 -0
  98. cbase/intern_string/c_intern_string.pyx +765 -0
  99. cbase/nt/pthread_nt_compat.h +102 -0
  100. cbase/nt/regex_nt_compat.h +133 -0
  101. cbase/nt/time_sched_nt_compat.h +32 -0
  102. pycybase-0.1.10.dist-info/METADATA +190 -0
  103. pycybase-0.1.10.dist-info/RECORD +105 -0
  104. pycybase-0.1.10.dist-info/WHEEL +5 -0
  105. pycybase-0.1.10.dist-info/top_level.txt +1 -0
@@ -0,0 +1,4654 @@
1
+ /* Generated by Cython 3.2.9 */
2
+
3
+ /* BEGIN: Cython Metadata
4
+ {
5
+ "distutils": {
6
+ "depends": [
7
+ "D:\\a\\PyCyBase\\PyCyBase\\cbase\\allocator_protocol\\c_shm_comp.h"
8
+ ],
9
+ "extra_compile_args": [
10
+ "/Ox",
11
+ "/std:c17",
12
+ "/experimental:c11atomics"
13
+ ],
14
+ "include_dirs": [
15
+ "D:\\a\\PyCyBase\\PyCyBase"
16
+ ],
17
+ "name": "cbase.allocator_protocol.c_shm_comp",
18
+ "sources": [
19
+ "cbase/allocator_protocol/c_shm_comp.pyx"
20
+ ]
21
+ },
22
+ "module_name": "cbase.allocator_protocol.c_shm_comp"
23
+ }
24
+ END: Cython Metadata */
25
+
26
+ #ifndef PY_SSIZE_T_CLEAN
27
+ #define PY_SSIZE_T_CLEAN
28
+ #endif /* PY_SSIZE_T_CLEAN */
29
+ /* InitLimitedAPI */
30
+ #if defined(Py_LIMITED_API)
31
+ #if !defined(CYTHON_LIMITED_API)
32
+ #define CYTHON_LIMITED_API 1
33
+ #endif
34
+ #elif defined(CYTHON_LIMITED_API)
35
+ #ifdef _MSC_VER
36
+ #pragma message ("Limited API usage is enabled with 'CYTHON_LIMITED_API' but 'Py_LIMITED_API' does not define a Python target version. Consider setting 'Py_LIMITED_API' instead.")
37
+ #else
38
+ #warning Limited API usage is enabled with 'CYTHON_LIMITED_API' but 'Py_LIMITED_API' does not define a Python target version. Consider setting 'Py_LIMITED_API' instead.
39
+ #endif
40
+ #endif
41
+
42
+ #include "Python.h"
43
+ #ifndef Py_PYTHON_H
44
+ #error Python headers needed to compile C extensions, please install development version of Python.
45
+ #elif PY_VERSION_HEX < 0x03080000
46
+ #error Cython requires Python 3.8+.
47
+ #else
48
+ #define __PYX_ABI_VERSION "3_2_9"
49
+ #define CYTHON_HEX_VERSION 0x030209F0
50
+ #define CYTHON_FUTURE_DIVISION 1
51
+ /* CModulePreamble */
52
+ #include <stddef.h>
53
+ #ifndef offsetof
54
+ #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
55
+ #endif
56
+ #if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS)
57
+ #ifndef __stdcall
58
+ #define __stdcall
59
+ #endif
60
+ #ifndef __cdecl
61
+ #define __cdecl
62
+ #endif
63
+ #ifndef __fastcall
64
+ #define __fastcall
65
+ #endif
66
+ #endif
67
+ #ifndef DL_IMPORT
68
+ #define DL_IMPORT(t) t
69
+ #endif
70
+ #ifndef DL_EXPORT
71
+ #define DL_EXPORT(t) t
72
+ #endif
73
+ #define __PYX_COMMA ,
74
+ #ifndef PY_LONG_LONG
75
+ #define PY_LONG_LONG LONG_LONG
76
+ #endif
77
+ #ifndef Py_HUGE_VAL
78
+ #define Py_HUGE_VAL HUGE_VAL
79
+ #endif
80
+ #define __PYX_LIMITED_VERSION_HEX PY_VERSION_HEX
81
+ #if defined(GRAALVM_PYTHON)
82
+ /* For very preliminary testing purposes. Most variables are set the same as PyPy.
83
+ The existence of this section does not imply that anything works or is even tested */
84
+ #define CYTHON_COMPILING_IN_PYPY 0
85
+ #define CYTHON_COMPILING_IN_CPYTHON 0
86
+ #define CYTHON_COMPILING_IN_LIMITED_API 0
87
+ #define CYTHON_COMPILING_IN_GRAAL 1
88
+ #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0
89
+ #undef CYTHON_USE_TYPE_SLOTS
90
+ #define CYTHON_USE_TYPE_SLOTS 0
91
+ #undef CYTHON_USE_TYPE_SPECS
92
+ #define CYTHON_USE_TYPE_SPECS 0
93
+ #undef CYTHON_USE_PYTYPE_LOOKUP
94
+ #define CYTHON_USE_PYTYPE_LOOKUP 0
95
+ #undef CYTHON_USE_PYLIST_INTERNALS
96
+ #define CYTHON_USE_PYLIST_INTERNALS 0
97
+ #undef CYTHON_USE_UNICODE_INTERNALS
98
+ #define CYTHON_USE_UNICODE_INTERNALS 0
99
+ #undef CYTHON_USE_UNICODE_WRITER
100
+ #define CYTHON_USE_UNICODE_WRITER 0
101
+ #undef CYTHON_USE_PYLONG_INTERNALS
102
+ #define CYTHON_USE_PYLONG_INTERNALS 0
103
+ #undef CYTHON_AVOID_BORROWED_REFS
104
+ #define CYTHON_AVOID_BORROWED_REFS 1
105
+ #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
106
+ #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0
107
+ #undef CYTHON_ASSUME_SAFE_MACROS
108
+ #define CYTHON_ASSUME_SAFE_MACROS 0
109
+ #undef CYTHON_ASSUME_SAFE_SIZE
110
+ #define CYTHON_ASSUME_SAFE_SIZE 0
111
+ #undef CYTHON_UNPACK_METHODS
112
+ #define CYTHON_UNPACK_METHODS 0
113
+ #undef CYTHON_FAST_THREAD_STATE
114
+ #define CYTHON_FAST_THREAD_STATE 0
115
+ #undef CYTHON_FAST_GIL
116
+ #define CYTHON_FAST_GIL 0
117
+ #undef CYTHON_METH_FASTCALL
118
+ #define CYTHON_METH_FASTCALL 0
119
+ #undef CYTHON_FAST_PYCALL
120
+ #define CYTHON_FAST_PYCALL 0
121
+ #ifndef CYTHON_PEP487_INIT_SUBCLASS
122
+ #define CYTHON_PEP487_INIT_SUBCLASS 1
123
+ #endif
124
+ #undef CYTHON_PEP489_MULTI_PHASE_INIT
125
+ #define CYTHON_PEP489_MULTI_PHASE_INIT 1
126
+ #undef CYTHON_USE_MODULE_STATE
127
+ #define CYTHON_USE_MODULE_STATE 0
128
+ #undef CYTHON_USE_SYS_MONITORING
129
+ #define CYTHON_USE_SYS_MONITORING 0
130
+ #undef CYTHON_USE_TP_FINALIZE
131
+ #define CYTHON_USE_TP_FINALIZE 0
132
+ #undef CYTHON_USE_AM_SEND
133
+ #define CYTHON_USE_AM_SEND 0
134
+ #undef CYTHON_USE_DICT_VERSIONS
135
+ #define CYTHON_USE_DICT_VERSIONS 0
136
+ #undef CYTHON_USE_EXC_INFO_STACK
137
+ #define CYTHON_USE_EXC_INFO_STACK 1
138
+ #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
139
+ #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
140
+ #endif
141
+ #undef CYTHON_USE_FREELISTS
142
+ #define CYTHON_USE_FREELISTS 0
143
+ #undef CYTHON_IMMORTAL_CONSTANTS
144
+ #define CYTHON_IMMORTAL_CONSTANTS 0
145
+ #elif defined(PYPY_VERSION)
146
+ #define CYTHON_COMPILING_IN_PYPY 1
147
+ #define CYTHON_COMPILING_IN_CPYTHON 0
148
+ #define CYTHON_COMPILING_IN_LIMITED_API 0
149
+ #define CYTHON_COMPILING_IN_GRAAL 0
150
+ #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0
151
+ #undef CYTHON_USE_TYPE_SLOTS
152
+ #define CYTHON_USE_TYPE_SLOTS 1
153
+ #ifndef CYTHON_USE_TYPE_SPECS
154
+ #define CYTHON_USE_TYPE_SPECS 0
155
+ #endif
156
+ #undef CYTHON_USE_PYTYPE_LOOKUP
157
+ #define CYTHON_USE_PYTYPE_LOOKUP 0
158
+ #undef CYTHON_USE_PYLIST_INTERNALS
159
+ #define CYTHON_USE_PYLIST_INTERNALS 0
160
+ #undef CYTHON_USE_UNICODE_INTERNALS
161
+ #define CYTHON_USE_UNICODE_INTERNALS 0
162
+ #undef CYTHON_USE_UNICODE_WRITER
163
+ #define CYTHON_USE_UNICODE_WRITER 0
164
+ #undef CYTHON_USE_PYLONG_INTERNALS
165
+ #define CYTHON_USE_PYLONG_INTERNALS 0
166
+ #undef CYTHON_AVOID_BORROWED_REFS
167
+ #define CYTHON_AVOID_BORROWED_REFS 1
168
+ #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
169
+ #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1
170
+ #undef CYTHON_ASSUME_SAFE_MACROS
171
+ #define CYTHON_ASSUME_SAFE_MACROS 0
172
+ #ifndef CYTHON_ASSUME_SAFE_SIZE
173
+ #define CYTHON_ASSUME_SAFE_SIZE 1
174
+ #endif
175
+ #undef CYTHON_UNPACK_METHODS
176
+ #define CYTHON_UNPACK_METHODS 0
177
+ #undef CYTHON_FAST_THREAD_STATE
178
+ #define CYTHON_FAST_THREAD_STATE 0
179
+ #undef CYTHON_FAST_GIL
180
+ #define CYTHON_FAST_GIL 0
181
+ #undef CYTHON_METH_FASTCALL
182
+ #define CYTHON_METH_FASTCALL 0
183
+ #undef CYTHON_FAST_PYCALL
184
+ #define CYTHON_FAST_PYCALL 0
185
+ #ifndef CYTHON_PEP487_INIT_SUBCLASS
186
+ #define CYTHON_PEP487_INIT_SUBCLASS 1
187
+ #endif
188
+ #if PY_VERSION_HEX < 0x03090000
189
+ #undef CYTHON_PEP489_MULTI_PHASE_INIT
190
+ #define CYTHON_PEP489_MULTI_PHASE_INIT 0
191
+ #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT)
192
+ #define CYTHON_PEP489_MULTI_PHASE_INIT 1
193
+ #endif
194
+ #undef CYTHON_USE_MODULE_STATE
195
+ #define CYTHON_USE_MODULE_STATE 0
196
+ #undef CYTHON_USE_SYS_MONITORING
197
+ #define CYTHON_USE_SYS_MONITORING 0
198
+ #ifndef CYTHON_USE_TP_FINALIZE
199
+ #define CYTHON_USE_TP_FINALIZE (PYPY_VERSION_NUM >= 0x07030C00)
200
+ #endif
201
+ #undef CYTHON_USE_AM_SEND
202
+ #define CYTHON_USE_AM_SEND 0
203
+ #undef CYTHON_USE_DICT_VERSIONS
204
+ #define CYTHON_USE_DICT_VERSIONS 0
205
+ #undef CYTHON_USE_EXC_INFO_STACK
206
+ #define CYTHON_USE_EXC_INFO_STACK 0
207
+ #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
208
+ #define CYTHON_UPDATE_DESCRIPTOR_DOC (PYPY_VERSION_NUM >= 0x07031100)
209
+ #endif
210
+ #undef CYTHON_USE_FREELISTS
211
+ #define CYTHON_USE_FREELISTS 0
212
+ #undef CYTHON_IMMORTAL_CONSTANTS
213
+ #define CYTHON_IMMORTAL_CONSTANTS 0
214
+ #elif defined(CYTHON_LIMITED_API)
215
+ #ifdef Py_LIMITED_API
216
+ #undef __PYX_LIMITED_VERSION_HEX
217
+ #define __PYX_LIMITED_VERSION_HEX Py_LIMITED_API
218
+ #endif
219
+ #define CYTHON_COMPILING_IN_PYPY 0
220
+ #define CYTHON_COMPILING_IN_CPYTHON 0
221
+ #define CYTHON_COMPILING_IN_LIMITED_API 1
222
+ #define CYTHON_COMPILING_IN_GRAAL 0
223
+ #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0
224
+ #undef CYTHON_USE_TYPE_SLOTS
225
+ #define CYTHON_USE_TYPE_SLOTS 0
226
+ #undef CYTHON_USE_TYPE_SPECS
227
+ #define CYTHON_USE_TYPE_SPECS 1
228
+ #undef CYTHON_USE_PYTYPE_LOOKUP
229
+ #define CYTHON_USE_PYTYPE_LOOKUP 0
230
+ #undef CYTHON_USE_PYLIST_INTERNALS
231
+ #define CYTHON_USE_PYLIST_INTERNALS 0
232
+ #undef CYTHON_USE_UNICODE_INTERNALS
233
+ #define CYTHON_USE_UNICODE_INTERNALS 0
234
+ #ifndef CYTHON_USE_UNICODE_WRITER
235
+ #define CYTHON_USE_UNICODE_WRITER 0
236
+ #endif
237
+ #undef CYTHON_USE_PYLONG_INTERNALS
238
+ #define CYTHON_USE_PYLONG_INTERNALS 0
239
+ #ifndef CYTHON_AVOID_BORROWED_REFS
240
+ #define CYTHON_AVOID_BORROWED_REFS 0
241
+ #endif
242
+ #ifndef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
243
+ #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0
244
+ #endif
245
+ #undef CYTHON_ASSUME_SAFE_MACROS
246
+ #define CYTHON_ASSUME_SAFE_MACROS 0
247
+ #undef CYTHON_ASSUME_SAFE_SIZE
248
+ #define CYTHON_ASSUME_SAFE_SIZE 0
249
+ #undef CYTHON_UNPACK_METHODS
250
+ #define CYTHON_UNPACK_METHODS 0
251
+ #undef CYTHON_FAST_THREAD_STATE
252
+ #define CYTHON_FAST_THREAD_STATE 0
253
+ #undef CYTHON_FAST_GIL
254
+ #define CYTHON_FAST_GIL 0
255
+ #undef CYTHON_METH_FASTCALL
256
+ #define CYTHON_METH_FASTCALL (__PYX_LIMITED_VERSION_HEX >= 0x030C0000)
257
+ #undef CYTHON_FAST_PYCALL
258
+ #define CYTHON_FAST_PYCALL 0
259
+ #ifndef CYTHON_PEP487_INIT_SUBCLASS
260
+ #define CYTHON_PEP487_INIT_SUBCLASS 1
261
+ #endif
262
+ #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
263
+ #define CYTHON_PEP489_MULTI_PHASE_INIT 1
264
+ #endif
265
+ #ifndef CYTHON_USE_MODULE_STATE
266
+ #define CYTHON_USE_MODULE_STATE 0
267
+ #endif
268
+ #undef CYTHON_USE_SYS_MONITORING
269
+ #define CYTHON_USE_SYS_MONITORING 0
270
+ #ifndef CYTHON_USE_TP_FINALIZE
271
+ #define CYTHON_USE_TP_FINALIZE 0
272
+ #endif
273
+ #ifndef CYTHON_USE_AM_SEND
274
+ #define CYTHON_USE_AM_SEND (__PYX_LIMITED_VERSION_HEX >= 0x030A0000)
275
+ #endif
276
+ #undef CYTHON_USE_DICT_VERSIONS
277
+ #define CYTHON_USE_DICT_VERSIONS 0
278
+ #undef CYTHON_USE_EXC_INFO_STACK
279
+ #define CYTHON_USE_EXC_INFO_STACK 0
280
+ #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
281
+ #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
282
+ #endif
283
+ #ifndef CYTHON_USE_FREELISTS
284
+ #define CYTHON_USE_FREELISTS 1
285
+ #endif
286
+ #undef CYTHON_IMMORTAL_CONSTANTS
287
+ #define CYTHON_IMMORTAL_CONSTANTS 0
288
+ #else
289
+ #define CYTHON_COMPILING_IN_PYPY 0
290
+ #define CYTHON_COMPILING_IN_CPYTHON 1
291
+ #define CYTHON_COMPILING_IN_LIMITED_API 0
292
+ #define CYTHON_COMPILING_IN_GRAAL 0
293
+ #ifdef Py_GIL_DISABLED
294
+ #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 1
295
+ #else
296
+ #define CYTHON_COMPILING_IN_CPYTHON_FREETHREADING 0
297
+ #endif
298
+ #if PY_VERSION_HEX < 0x030A0000
299
+ #undef CYTHON_USE_TYPE_SLOTS
300
+ #define CYTHON_USE_TYPE_SLOTS 1
301
+ #elif !defined(CYTHON_USE_TYPE_SLOTS)
302
+ #define CYTHON_USE_TYPE_SLOTS 1
303
+ #endif
304
+ #ifndef CYTHON_USE_TYPE_SPECS
305
+ #define CYTHON_USE_TYPE_SPECS 0
306
+ #endif
307
+ #ifndef CYTHON_USE_PYTYPE_LOOKUP
308
+ #define CYTHON_USE_PYTYPE_LOOKUP 1
309
+ #endif
310
+ #ifndef CYTHON_USE_PYLONG_INTERNALS
311
+ #define CYTHON_USE_PYLONG_INTERNALS 1
312
+ #endif
313
+ #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
314
+ #undef CYTHON_USE_PYLIST_INTERNALS
315
+ #define CYTHON_USE_PYLIST_INTERNALS 0
316
+ #elif !defined(CYTHON_USE_PYLIST_INTERNALS)
317
+ #define CYTHON_USE_PYLIST_INTERNALS 1
318
+ #endif
319
+ #ifndef CYTHON_USE_UNICODE_INTERNALS
320
+ #define CYTHON_USE_UNICODE_INTERNALS 1
321
+ #endif
322
+ #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING || PY_VERSION_HEX >= 0x030B00A2
323
+ #undef CYTHON_USE_UNICODE_WRITER
324
+ #define CYTHON_USE_UNICODE_WRITER 0
325
+ #elif !defined(CYTHON_USE_UNICODE_WRITER)
326
+ #define CYTHON_USE_UNICODE_WRITER 1
327
+ #endif
328
+ #ifndef CYTHON_AVOID_BORROWED_REFS
329
+ #define CYTHON_AVOID_BORROWED_REFS 0
330
+ #endif
331
+ #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
332
+ #undef CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
333
+ #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 1
334
+ #elif !defined(CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS)
335
+ #define CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS 0
336
+ #endif
337
+ #ifndef CYTHON_ASSUME_SAFE_MACROS
338
+ #define CYTHON_ASSUME_SAFE_MACROS 1
339
+ #endif
340
+ #ifndef CYTHON_ASSUME_SAFE_SIZE
341
+ #define CYTHON_ASSUME_SAFE_SIZE 1
342
+ #endif
343
+ #ifndef CYTHON_UNPACK_METHODS
344
+ #define CYTHON_UNPACK_METHODS 1
345
+ #endif
346
+ #ifndef CYTHON_FAST_THREAD_STATE
347
+ #define CYTHON_FAST_THREAD_STATE 1
348
+ #endif
349
+ #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
350
+ #undef CYTHON_FAST_GIL
351
+ #define CYTHON_FAST_GIL 0
352
+ #elif !defined(CYTHON_FAST_GIL)
353
+ #define CYTHON_FAST_GIL (PY_VERSION_HEX < 0x030C00A6)
354
+ #endif
355
+ #ifndef CYTHON_METH_FASTCALL
356
+ #define CYTHON_METH_FASTCALL 1
357
+ #endif
358
+ #ifndef CYTHON_FAST_PYCALL
359
+ #define CYTHON_FAST_PYCALL 1
360
+ #endif
361
+ #ifndef CYTHON_PEP487_INIT_SUBCLASS
362
+ #define CYTHON_PEP487_INIT_SUBCLASS 1
363
+ #endif
364
+ #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
365
+ #define CYTHON_PEP489_MULTI_PHASE_INIT 1
366
+ #endif
367
+ #ifndef CYTHON_USE_MODULE_STATE
368
+ #define CYTHON_USE_MODULE_STATE 0
369
+ #endif
370
+ #ifndef CYTHON_USE_SYS_MONITORING
371
+ #define CYTHON_USE_SYS_MONITORING (PY_VERSION_HEX >= 0x030d00B1)
372
+ #endif
373
+ #ifndef CYTHON_USE_TP_FINALIZE
374
+ #define CYTHON_USE_TP_FINALIZE 1
375
+ #endif
376
+ #ifndef CYTHON_USE_AM_SEND
377
+ #define CYTHON_USE_AM_SEND 1
378
+ #endif
379
+ #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
380
+ #undef CYTHON_USE_DICT_VERSIONS
381
+ #define CYTHON_USE_DICT_VERSIONS 0
382
+ #elif !defined(CYTHON_USE_DICT_VERSIONS)
383
+ #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX < 0x030C00A5 && !CYTHON_USE_MODULE_STATE)
384
+ #endif
385
+ #ifndef CYTHON_USE_EXC_INFO_STACK
386
+ #define CYTHON_USE_EXC_INFO_STACK 1
387
+ #endif
388
+ #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
389
+ #define CYTHON_UPDATE_DESCRIPTOR_DOC 1
390
+ #endif
391
+ #ifndef CYTHON_USE_FREELISTS
392
+ #define CYTHON_USE_FREELISTS (!CYTHON_COMPILING_IN_CPYTHON_FREETHREADING)
393
+ #endif
394
+ #if defined(CYTHON_IMMORTAL_CONSTANTS) && PY_VERSION_HEX < 0x030C0000
395
+ #undef CYTHON_IMMORTAL_CONSTANTS
396
+ #define CYTHON_IMMORTAL_CONSTANTS 0 // definitely won't work
397
+ #elif !defined(CYTHON_IMMORTAL_CONSTANTS)
398
+ #define CYTHON_IMMORTAL_CONSTANTS (PY_VERSION_HEX >= 0x030C0000 && !CYTHON_USE_MODULE_STATE && CYTHON_COMPILING_IN_CPYTHON_FREETHREADING)
399
+ #endif
400
+ #endif
401
+ #ifndef CYTHON_COMPRESS_STRINGS
402
+ #define CYTHON_COMPRESS_STRINGS 1
403
+ #endif
404
+ #ifndef CYTHON_FAST_PYCCALL
405
+ #define CYTHON_FAST_PYCCALL CYTHON_FAST_PYCALL
406
+ #endif
407
+ #ifndef CYTHON_VECTORCALL
408
+ #if CYTHON_COMPILING_IN_LIMITED_API
409
+ #define CYTHON_VECTORCALL (__PYX_LIMITED_VERSION_HEX >= 0x030C0000)
410
+ #else
411
+ #define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL)
412
+ #endif
413
+ #endif
414
+ #if CYTHON_USE_PYLONG_INTERNALS
415
+ #undef SHIFT
416
+ #undef BASE
417
+ #undef MASK
418
+ #ifdef SIZEOF_VOID_P
419
+ enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
420
+ #endif
421
+ #endif
422
+ #ifndef __has_attribute
423
+ #define __has_attribute(x) 0
424
+ #endif
425
+ #ifndef __has_cpp_attribute
426
+ #define __has_cpp_attribute(x) 0
427
+ #endif
428
+ #ifndef CYTHON_RESTRICT
429
+ #if defined(__GNUC__)
430
+ #define CYTHON_RESTRICT __restrict__
431
+ #elif defined(_MSC_VER) && _MSC_VER >= 1400
432
+ #define CYTHON_RESTRICT __restrict
433
+ #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
434
+ #define CYTHON_RESTRICT restrict
435
+ #else
436
+ #define CYTHON_RESTRICT
437
+ #endif
438
+ #endif
439
+ #ifndef CYTHON_UNUSED
440
+ #if defined(__cplusplus)
441
+ /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17
442
+ * but leads to warnings with -pedantic, since it is a C++17 feature */
443
+ #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
444
+ #if __has_cpp_attribute(maybe_unused)
445
+ #define CYTHON_UNUSED [[maybe_unused]]
446
+ #endif
447
+ #endif
448
+ #endif
449
+ #endif
450
+ #ifndef CYTHON_UNUSED
451
+ # if defined(__GNUC__)
452
+ # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
453
+ # define CYTHON_UNUSED __attribute__ ((__unused__))
454
+ # else
455
+ # define CYTHON_UNUSED
456
+ # endif
457
+ # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
458
+ # define CYTHON_UNUSED __attribute__ ((__unused__))
459
+ # else
460
+ # define CYTHON_UNUSED
461
+ # endif
462
+ #endif
463
+ #ifndef CYTHON_UNUSED_VAR
464
+ # if defined(__cplusplus)
465
+ template<class T> void CYTHON_UNUSED_VAR( const T& ) { }
466
+ # else
467
+ # define CYTHON_UNUSED_VAR(x) (void)(x)
468
+ # endif
469
+ #endif
470
+ #ifndef CYTHON_MAYBE_UNUSED_VAR
471
+ #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x)
472
+ #endif
473
+ #ifndef CYTHON_NCP_UNUSED
474
+ # if CYTHON_COMPILING_IN_CPYTHON && !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
475
+ # define CYTHON_NCP_UNUSED
476
+ # else
477
+ # define CYTHON_NCP_UNUSED CYTHON_UNUSED
478
+ # endif
479
+ #endif
480
+ #ifndef CYTHON_USE_CPP_STD_MOVE
481
+ #if defined(__cplusplus) && (\
482
+ __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600))
483
+ #define CYTHON_USE_CPP_STD_MOVE 1
484
+ #else
485
+ #define CYTHON_USE_CPP_STD_MOVE 0
486
+ #endif
487
+ #endif
488
+ #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
489
+ #include <stdint.h>
490
+ typedef uintptr_t __pyx_uintptr_t;
491
+ #ifndef CYTHON_FALLTHROUGH
492
+ #if defined(__cplusplus)
493
+ /* for clang __has_cpp_attribute(fallthrough) is true even before C++17
494
+ * but leads to warnings with -pedantic, since it is a C++17 feature */
495
+ #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
496
+ #if __has_cpp_attribute(fallthrough)
497
+ #define CYTHON_FALLTHROUGH [[fallthrough]]
498
+ #endif
499
+ #endif
500
+ #ifndef CYTHON_FALLTHROUGH
501
+ #if __has_cpp_attribute(clang::fallthrough)
502
+ #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
503
+ #elif __has_cpp_attribute(gnu::fallthrough)
504
+ #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
505
+ #endif
506
+ #endif
507
+ #endif
508
+ #ifndef CYTHON_FALLTHROUGH
509
+ #if __has_attribute(fallthrough)
510
+ #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
511
+ #else
512
+ #define CYTHON_FALLTHROUGH
513
+ #endif
514
+ #endif
515
+ #if defined(__clang__) && defined(__apple_build_version__)
516
+ #if __apple_build_version__ < 7000000
517
+ #undef CYTHON_FALLTHROUGH
518
+ #define CYTHON_FALLTHROUGH
519
+ #endif
520
+ #endif
521
+ #endif
522
+ #ifndef Py_UNREACHABLE
523
+ #define Py_UNREACHABLE() assert(0); abort()
524
+ #endif
525
+ #ifdef __cplusplus
526
+ template <typename T>
527
+ struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);};
528
+ #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL<type>::value)
529
+ #else
530
+ #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0)
531
+ #endif
532
+ #if CYTHON_COMPILING_IN_PYPY == 1
533
+ #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX < 0x030A0000)
534
+ #else
535
+ #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX < 0x03090000)
536
+ #endif
537
+ #define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer))
538
+
539
+ /* CInitCode */
540
+ #ifndef CYTHON_INLINE
541
+ #if defined(__clang__)
542
+ #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
543
+ #elif defined(__GNUC__)
544
+ #define CYTHON_INLINE __inline__
545
+ #elif defined(_MSC_VER)
546
+ #define CYTHON_INLINE __inline
547
+ #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
548
+ #define CYTHON_INLINE inline
549
+ #else
550
+ #define CYTHON_INLINE
551
+ #endif
552
+ #endif
553
+
554
+ /* PythonCompatibility */
555
+ #define __PYX_BUILD_PY_SSIZE_T "n"
556
+ #define CYTHON_FORMAT_SSIZE_T "z"
557
+ #define __Pyx_BUILTIN_MODULE_NAME "builtins"
558
+ #define __Pyx_DefaultClassType PyType_Type
559
+ #if CYTHON_COMPILING_IN_LIMITED_API
560
+ #ifndef CO_OPTIMIZED
561
+ static int CO_OPTIMIZED;
562
+ #endif
563
+ #ifndef CO_NEWLOCALS
564
+ static int CO_NEWLOCALS;
565
+ #endif
566
+ #ifndef CO_VARARGS
567
+ static int CO_VARARGS;
568
+ #endif
569
+ #ifndef CO_VARKEYWORDS
570
+ static int CO_VARKEYWORDS;
571
+ #endif
572
+ #ifndef CO_ASYNC_GENERATOR
573
+ static int CO_ASYNC_GENERATOR;
574
+ #endif
575
+ #ifndef CO_GENERATOR
576
+ static int CO_GENERATOR;
577
+ #endif
578
+ #ifndef CO_COROUTINE
579
+ static int CO_COROUTINE;
580
+ #endif
581
+ #else
582
+ #ifndef CO_COROUTINE
583
+ #define CO_COROUTINE 0x80
584
+ #endif
585
+ #ifndef CO_ASYNC_GENERATOR
586
+ #define CO_ASYNC_GENERATOR 0x200
587
+ #endif
588
+ #endif
589
+ static int __Pyx_init_co_variables(void);
590
+ #if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE)
591
+ #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type)
592
+ #else
593
+ #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type))
594
+ #endif
595
+ #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is)
596
+ #define __Pyx_Py_Is(x, y) Py_Is(x, y)
597
+ #else
598
+ #define __Pyx_Py_Is(x, y) ((x) == (y))
599
+ #endif
600
+ #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone)
601
+ #define __Pyx_Py_IsNone(ob) Py_IsNone(ob)
602
+ #else
603
+ #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None)
604
+ #endif
605
+ #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue)
606
+ #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob)
607
+ #else
608
+ #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True)
609
+ #endif
610
+ #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse)
611
+ #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob)
612
+ #else
613
+ #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False)
614
+ #endif
615
+ #define __Pyx_NoneAsNull(obj) (__Pyx_Py_IsNone(obj) ? NULL : (obj))
616
+ #if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY
617
+ #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o)
618
+ #else
619
+ #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o)
620
+ #endif
621
+ #ifndef Py_TPFLAGS_CHECKTYPES
622
+ #define Py_TPFLAGS_CHECKTYPES 0
623
+ #endif
624
+ #ifndef Py_TPFLAGS_HAVE_INDEX
625
+ #define Py_TPFLAGS_HAVE_INDEX 0
626
+ #endif
627
+ #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
628
+ #define Py_TPFLAGS_HAVE_NEWBUFFER 0
629
+ #endif
630
+ #ifndef Py_TPFLAGS_HAVE_FINALIZE
631
+ #define Py_TPFLAGS_HAVE_FINALIZE 0
632
+ #endif
633
+ #ifndef Py_TPFLAGS_SEQUENCE
634
+ #define Py_TPFLAGS_SEQUENCE 0
635
+ #endif
636
+ #ifndef Py_TPFLAGS_MAPPING
637
+ #define Py_TPFLAGS_MAPPING 0
638
+ #endif
639
+ #ifndef Py_TPFLAGS_IMMUTABLETYPE
640
+ #define Py_TPFLAGS_IMMUTABLETYPE (1UL << 8)
641
+ #endif
642
+ #ifndef Py_TPFLAGS_DISALLOW_INSTANTIATION
643
+ #define Py_TPFLAGS_DISALLOW_INSTANTIATION (1UL << 7)
644
+ #endif
645
+ #ifndef METH_STACKLESS
646
+ #define METH_STACKLESS 0
647
+ #endif
648
+ #ifndef METH_FASTCALL
649
+ #ifndef METH_FASTCALL
650
+ #define METH_FASTCALL 0x80
651
+ #endif
652
+ typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
653
+ typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
654
+ Py_ssize_t nargs, PyObject *kwnames);
655
+ #else
656
+ #if PY_VERSION_HEX >= 0x030d00A4
657
+ # define __Pyx_PyCFunctionFast PyCFunctionFast
658
+ # define __Pyx_PyCFunctionFastWithKeywords PyCFunctionFastWithKeywords
659
+ #else
660
+ # define __Pyx_PyCFunctionFast _PyCFunctionFast
661
+ # define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
662
+ #endif
663
+ #endif
664
+ #if CYTHON_METH_FASTCALL
665
+ #define __Pyx_METH_FASTCALL METH_FASTCALL
666
+ #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast
667
+ #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords
668
+ #else
669
+ #define __Pyx_METH_FASTCALL METH_VARARGS
670
+ #define __Pyx_PyCFunction_FastCall PyCFunction
671
+ #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords
672
+ #endif
673
+ #if CYTHON_VECTORCALL
674
+ #define __pyx_vectorcallfunc vectorcallfunc
675
+ #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET
676
+ #define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n))
677
+ #else
678
+ #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0
679
+ #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n))
680
+ #endif
681
+ #if PY_VERSION_HEX >= 0x030900B1
682
+ #define __Pyx_PyCFunction_CheckExact(func) PyCFunction_CheckExact(func)
683
+ #else
684
+ #define __Pyx_PyCFunction_CheckExact(func) PyCFunction_Check(func)
685
+ #endif
686
+ #define __Pyx_CyOrPyCFunction_Check(func) PyCFunction_Check(func)
687
+ #if CYTHON_COMPILING_IN_CPYTHON
688
+ #define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) (((PyCFunctionObject*)(func))->m_ml->ml_meth)
689
+ #elif !CYTHON_COMPILING_IN_LIMITED_API
690
+ #define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) PyCFunction_GET_FUNCTION(func)
691
+ #endif
692
+ #if CYTHON_COMPILING_IN_CPYTHON
693
+ #define __Pyx_CyOrPyCFunction_GET_FLAGS(func) (((PyCFunctionObject*)(func))->m_ml->ml_flags)
694
+ static CYTHON_INLINE PyObject* __Pyx_CyOrPyCFunction_GET_SELF(PyObject *func) {
695
+ return (__Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_STATIC) ? NULL : ((PyCFunctionObject*)func)->m_self;
696
+ }
697
+ #endif
698
+ static CYTHON_INLINE int __Pyx__IsSameCFunction(PyObject *func, void (*cfunc)(void)) {
699
+ #if CYTHON_COMPILING_IN_LIMITED_API
700
+ return PyCFunction_Check(func) && PyCFunction_GetFunction(func) == (PyCFunction) cfunc;
701
+ #else
702
+ return PyCFunction_Check(func) && PyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc;
703
+ #endif
704
+ }
705
+ #define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCFunction(func, cfunc)
706
+ #if PY_VERSION_HEX < 0x03090000 || (CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000)
707
+ #define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b))
708
+ typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *);
709
+ #else
710
+ #define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b)
711
+ #define __Pyx_PyCMethod PyCMethod
712
+ #endif
713
+ #ifndef METH_METHOD
714
+ #define METH_METHOD 0x200
715
+ #endif
716
+ #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
717
+ #define PyObject_Malloc(s) PyMem_Malloc(s)
718
+ #define PyObject_Free(p) PyMem_Free(p)
719
+ #define PyObject_Realloc(p) PyMem_Realloc(p)
720
+ #endif
721
+ #if CYTHON_COMPILING_IN_LIMITED_API
722
+ #define __Pyx_PyFrame_SetLineNumber(frame, lineno)
723
+ #elif CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000
724
+ #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
725
+ #define __Pyx_PyFrame_SetLineNumber(frame, lineno) GraalPyFrame_SetLineNumber((frame), (lineno))
726
+ #elif CYTHON_COMPILING_IN_GRAAL
727
+ #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
728
+ #define __Pyx_PyFrame_SetLineNumber(frame, lineno) _PyFrame_SetLineNumber((frame), (lineno))
729
+ #else
730
+ #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
731
+ #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
732
+ #endif
733
+ #if CYTHON_COMPILING_IN_LIMITED_API
734
+ #define __Pyx_PyThreadState_Current PyThreadState_Get()
735
+ #elif !CYTHON_FAST_THREAD_STATE
736
+ #define __Pyx_PyThreadState_Current PyThreadState_GET()
737
+ #elif PY_VERSION_HEX >= 0x030d00A1
738
+ #define __Pyx_PyThreadState_Current PyThreadState_GetUnchecked()
739
+ #else
740
+ #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
741
+ #endif
742
+ #if CYTHON_USE_MODULE_STATE
743
+ static CYTHON_INLINE void *__Pyx__PyModule_GetState(PyObject *op)
744
+ {
745
+ void *result;
746
+ result = PyModule_GetState(op);
747
+ if (!result)
748
+ Py_FatalError("Couldn't find the module state");
749
+ return result;
750
+ }
751
+ #define __Pyx_PyModule_GetState(o) (__pyx_mstatetype *)__Pyx__PyModule_GetState(o)
752
+ #else
753
+ #define __Pyx_PyModule_GetState(op) ((void)op,__pyx_mstate_global)
754
+ #endif
755
+ #define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE((PyObject *) obj), name, func_ctype)
756
+ #define __Pyx_PyObject_TryGetSlot(obj, name, func_ctype) __Pyx_PyType_TryGetSlot(Py_TYPE(obj), name, func_ctype)
757
+ #define __Pyx_PyObject_GetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_GetSubSlot(Py_TYPE(obj), sub, name, func_ctype)
758
+ #define __Pyx_PyObject_TryGetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_TryGetSubSlot(Py_TYPE(obj), sub, name, func_ctype)
759
+ #if CYTHON_USE_TYPE_SLOTS
760
+ #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name)
761
+ #define __Pyx_PyType_TryGetSlot(type, name, func_ctype) __Pyx_PyType_GetSlot(type, name, func_ctype)
762
+ #define __Pyx_PyType_GetSubSlot(type, sub, name, func_ctype) (((type)->sub) ? ((type)->sub->name) : NULL)
763
+ #define __Pyx_PyType_TryGetSubSlot(type, sub, name, func_ctype) __Pyx_PyType_GetSubSlot(type, sub, name, func_ctype)
764
+ #else
765
+ #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name))
766
+ #define __Pyx_PyType_TryGetSlot(type, name, func_ctype)\
767
+ ((__PYX_LIMITED_VERSION_HEX >= 0x030A0000 ||\
768
+ (PyType_GetFlags(type) & Py_TPFLAGS_HEAPTYPE) || __Pyx_get_runtime_version() >= 0x030A0000) ?\
769
+ __Pyx_PyType_GetSlot(type, name, func_ctype) : NULL)
770
+ #define __Pyx_PyType_GetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_GetSlot(obj, name, func_ctype)
771
+ #define __Pyx_PyType_TryGetSubSlot(obj, sub, name, func_ctype) __Pyx_PyType_TryGetSlot(obj, name, func_ctype)
772
+ #endif
773
+ #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
774
+ #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
775
+ #else
776
+ #define __Pyx_PyDict_NewPresized(n) PyDict_New()
777
+ #endif
778
+ #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
779
+ #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
780
+ #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_UNICODE_INTERNALS
781
+ #define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
782
+ static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) {
783
+ PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name);
784
+ if (res == NULL) PyErr_Clear();
785
+ return res;
786
+ }
787
+ #elif !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000
788
+ #define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError
789
+ #define __Pyx_PyDict_GetItemStr PyDict_GetItem
790
+ #else
791
+ static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) {
792
+ #if CYTHON_COMPILING_IN_PYPY
793
+ return PyDict_GetItem(dict, name);
794
+ #else
795
+ PyDictEntry *ep;
796
+ PyDictObject *mp = (PyDictObject*) dict;
797
+ long hash = ((PyStringObject *) name)->ob_shash;
798
+ assert(hash != -1);
799
+ ep = (mp->ma_lookup)(mp, name, hash);
800
+ if (ep == NULL) {
801
+ return NULL;
802
+ }
803
+ return ep->me_value;
804
+ #endif
805
+ }
806
+ #define __Pyx_PyDict_GetItemStr PyDict_GetItem
807
+ #endif
808
+ #if CYTHON_USE_TYPE_SLOTS
809
+ #define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags)
810
+ #define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0)
811
+ #else
812
+ #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp))
813
+ #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature)
814
+ #endif
815
+ #define __Pyx_PyObject_GetIterNextFunc(iterator) __Pyx_PyObject_GetSlot(iterator, tp_iternext, iternextfunc)
816
+ #if CYTHON_USE_TYPE_SPECS
817
+ #define __Pyx_PyHeapTypeObject_GC_Del(obj) {\
818
+ PyTypeObject *type = Py_TYPE((PyObject*)obj);\
819
+ assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\
820
+ PyObject_GC_Del(obj);\
821
+ Py_DECREF(type);\
822
+ }
823
+ #else
824
+ #define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj)
825
+ #endif
826
+ #if CYTHON_COMPILING_IN_LIMITED_API
827
+ #define __Pyx_PyUnicode_READY(op) (0)
828
+ #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i)
829
+ #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111U)
830
+ #define __Pyx_PyUnicode_KIND(u) ((void)u, (0))
831
+ #define __Pyx_PyUnicode_DATA(u) ((void*)u)
832
+ #define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i))
833
+ #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u))
834
+ #else
835
+ #if PY_VERSION_HEX >= 0x030C0000
836
+ #define __Pyx_PyUnicode_READY(op) (0)
837
+ #else
838
+ #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
839
+ 0 : _PyUnicode_Ready((PyObject *)(op)))
840
+ #endif
841
+ #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
842
+ #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
843
+ #define __Pyx_PyUnicode_KIND(u) ((int)PyUnicode_KIND(u))
844
+ #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
845
+ #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
846
+ #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, (Py_UCS4) ch)
847
+ #if PY_VERSION_HEX >= 0x030C0000
848
+ #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u))
849
+ #else
850
+ #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
851
+ #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
852
+ #else
853
+ #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
854
+ #endif
855
+ #endif
856
+ #endif
857
+ #if CYTHON_COMPILING_IN_PYPY
858
+ #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
859
+ #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
860
+ #else
861
+ #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
862
+ #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
863
+ PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
864
+ #endif
865
+ #if CYTHON_COMPILING_IN_PYPY
866
+ #if !defined(PyUnicode_DecodeUnicodeEscape)
867
+ #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors)
868
+ #endif
869
+ #if !defined(PyUnicode_Contains)
870
+ #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
871
+ #endif
872
+ #if !defined(PyByteArray_Check)
873
+ #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
874
+ #endif
875
+ #if !defined(PyObject_Format)
876
+ #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
877
+ #endif
878
+ #endif
879
+ #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
880
+ #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
881
+ #define __Pyx_PySequence_ListKeepNew(obj)\
882
+ (likely(PyList_CheckExact(obj) && PyUnstable_Object_IsUniquelyReferenced(obj)) ? __Pyx_NewRef(obj) : PySequence_List(obj))
883
+ #elif CYTHON_COMPILING_IN_CPYTHON
884
+ #define __Pyx_PySequence_ListKeepNew(obj)\
885
+ (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj))
886
+ #else
887
+ #define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj)
888
+ #endif
889
+ #ifndef PySet_CheckExact
890
+ #define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type)
891
+ #endif
892
+ #if PY_VERSION_HEX >= 0x030900A4
893
+ #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
894
+ #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
895
+ #else
896
+ #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
897
+ #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
898
+ #endif
899
+ enum __Pyx_ReferenceSharing {
900
+ __Pyx_ReferenceSharing_DefinitelyUnique, // We created it so we know it's unshared - no need to check
901
+ __Pyx_ReferenceSharing_OwnStrongReference,
902
+ __Pyx_ReferenceSharing_FunctionArgument,
903
+ __Pyx_ReferenceSharing_SharedReference, // Never trust it to be unshared because it's a global or similar
904
+ };
905
+ #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && PY_VERSION_HEX >= 0x030E0000
906
+ #define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing)\
907
+ (sharing == __Pyx_ReferenceSharing_DefinitelyUnique ? 1 :\
908
+ (sharing == __Pyx_ReferenceSharing_FunctionArgument ? PyUnstable_Object_IsUniqueReferencedTemporary(o) :\
909
+ (sharing == __Pyx_ReferenceSharing_OwnStrongReference ? PyUnstable_Object_IsUniquelyReferenced(o) : 0)))
910
+ #elif (CYTHON_COMPILING_IN_CPYTHON && !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING) || CYTHON_COMPILING_IN_LIMITED_API
911
+ #define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing) (((void)sharing), Py_REFCNT(o) == 1)
912
+ #else
913
+ #define __Pyx_IS_UNIQUELY_REFERENCED(o, sharing) (((void)o), ((void)sharing), 0)
914
+ #endif
915
+ #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
916
+ #define __Pyx_PyList_GetItemRef(o, i) PyList_GetItemRef(o, i)
917
+ #elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
918
+ #if CYTHON_COMPILING_IN_LIMITED_API || !CYTHON_ASSUME_SAFE_MACROS
919
+ #define __Pyx_PyList_GetItemRef(o, i) (likely((i) >= 0) ? PySequence_GetItem(o, i) : (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
920
+ #else
921
+ #define __Pyx_PyList_GetItemRef(o, i) PySequence_ITEM(o, i)
922
+ #endif
923
+ #elif CYTHON_COMPILING_IN_LIMITED_API || !(CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE)
924
+ #define __Pyx_PyList_GetItemRef(o, i) __Pyx_XNewRef(PyList_GetItem(o, i))
925
+ #else
926
+ #define __Pyx_PyList_GetItemRef(o, i) (likely(__Pyx_is_valid_index(i, PyList_GET_SIZE(o))) ?\
927
+ __Pyx_NewRef(PyList_GET_ITEM(o, i)) : (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
928
+ #endif
929
+ #if CYTHON_AVOID_BORROWED_REFS || CYTHON_COMPILING_IN_LIMITED_API
930
+ #define __Pyx_PyList_GET_ITEM_REF(o, i, unsafe_shared) ((void)(unsafe_shared),\
931
+ __Pyx_PyList_GetItemRef(o, i))
932
+ #elif CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
933
+ #if CYTHON_ASSUME_SAFE_MACROS
934
+ #define __Pyx_PyList_GET_ITEM_REF(o, i, unsafe_shared) (\
935
+ __Pyx_IS_UNIQUELY_REFERENCED(o, unsafe_shared) ?\
936
+ __Pyx_NewRef(PyList_GET_ITEM(o, i)) : __Pyx_PyList_GetItemRef(o, i))
937
+ #else
938
+ #define __Pyx_PyList_GET_ITEM_REF(o, i, unsafe_shared) (\
939
+ __Pyx_IS_UNIQUELY_REFERENCED(o, unsafe_shared) ?\
940
+ __Pyx_XNewRef(PyList_GetItem(o, i)) : __Pyx_PyList_GetItemRef(o, i))
941
+ #endif
942
+ #elif CYTHON_ASSUME_SAFE_MACROS
943
+ #define __Pyx_PyList_GET_ITEM_REF(o, i, unsafe_shared) ((void)(unsafe_shared),\
944
+ __Pyx_NewRef(PyList_GET_ITEM(o, i)))
945
+ #else
946
+ #define __Pyx_PyList_GET_ITEM_REF(o, i, unsafe_shared) ((void)(unsafe_shared),\
947
+ __Pyx_XNewRef(PyList_GetItem(o, i)))
948
+ #endif
949
+ #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
950
+ #define __Pyx_PyDict_GetItemRef(dict, key, result) PyDict_GetItemRef(dict, key, result)
951
+ #elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
952
+ static CYTHON_INLINE int __Pyx_PyDict_GetItemRef(PyObject *dict, PyObject *key, PyObject **result) {
953
+ *result = PyObject_GetItem(dict, key);
954
+ if (*result == NULL) {
955
+ if (PyErr_ExceptionMatches(PyExc_KeyError)) {
956
+ PyErr_Clear();
957
+ return 0;
958
+ }
959
+ return -1;
960
+ }
961
+ return 1;
962
+ }
963
+ #else
964
+ static CYTHON_INLINE int __Pyx_PyDict_GetItemRef(PyObject *dict, PyObject *key, PyObject **result) {
965
+ *result = PyDict_GetItemWithError(dict, key);
966
+ if (*result == NULL) {
967
+ return PyErr_Occurred() ? -1 : 0;
968
+ }
969
+ Py_INCREF(*result);
970
+ return 1;
971
+ }
972
+ #endif
973
+ #if defined(CYTHON_DEBUG_VISIT_CONST) && CYTHON_DEBUG_VISIT_CONST
974
+ #define __Pyx_VISIT_CONST(obj) Py_VISIT(obj)
975
+ #else
976
+ #define __Pyx_VISIT_CONST(obj)
977
+ #endif
978
+ #if CYTHON_ASSUME_SAFE_MACROS
979
+ #define __Pyx_PySequence_ITEM(o, i) PySequence_ITEM(o, i)
980
+ #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
981
+ #define __Pyx_PyTuple_SET_ITEM(o, i, v) (PyTuple_SET_ITEM(o, i, v), (0))
982
+ #define __Pyx_PyTuple_GET_ITEM(o, i) PyTuple_GET_ITEM(o, i)
983
+ #define __Pyx_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0))
984
+ #define __Pyx_PyList_GET_ITEM(o, i) PyList_GET_ITEM(o, i)
985
+ #else
986
+ #define __Pyx_PySequence_ITEM(o, i) PySequence_GetItem(o, i)
987
+ #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
988
+ #define __Pyx_PyTuple_SET_ITEM(o, i, v) PyTuple_SetItem(o, i, v)
989
+ #define __Pyx_PyTuple_GET_ITEM(o, i) PyTuple_GetItem(o, i)
990
+ #define __Pyx_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v)
991
+ #define __Pyx_PyList_GET_ITEM(o, i) PyList_GetItem(o, i)
992
+ #endif
993
+ #if CYTHON_ASSUME_SAFE_SIZE
994
+ #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_GET_SIZE(o)
995
+ #define __Pyx_PyList_GET_SIZE(o) PyList_GET_SIZE(o)
996
+ #define __Pyx_PySet_GET_SIZE(o) PySet_GET_SIZE(o)
997
+ #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_GET_SIZE(o)
998
+ #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_GET_SIZE(o)
999
+ #define __Pyx_PyUnicode_GET_LENGTH(o) PyUnicode_GET_LENGTH(o)
1000
+ #else
1001
+ #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_Size(o)
1002
+ #define __Pyx_PyList_GET_SIZE(o) PyList_Size(o)
1003
+ #define __Pyx_PySet_GET_SIZE(o) PySet_Size(o)
1004
+ #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_Size(o)
1005
+ #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_Size(o)
1006
+ #define __Pyx_PyUnicode_GET_LENGTH(o) PyUnicode_GetLength(o)
1007
+ #endif
1008
+ #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_InternFromString)
1009
+ #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
1010
+ #endif
1011
+ #define __Pyx_PyLong_FromHash_t PyLong_FromSsize_t
1012
+ #define __Pyx_PyLong_AsHash_t __Pyx_PyIndex_AsSsize_t
1013
+ #if __PYX_LIMITED_VERSION_HEX >= 0x030A0000
1014
+ #define __Pyx_PySendResult PySendResult
1015
+ #else
1016
+ typedef enum {
1017
+ PYGEN_RETURN = 0,
1018
+ PYGEN_ERROR = -1,
1019
+ PYGEN_NEXT = 1,
1020
+ } __Pyx_PySendResult;
1021
+ #endif
1022
+ #if CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX < 0x030A00A3
1023
+ typedef __Pyx_PySendResult (*__Pyx_pyiter_sendfunc)(PyObject *iter, PyObject *value, PyObject **result);
1024
+ #else
1025
+ #define __Pyx_pyiter_sendfunc sendfunc
1026
+ #endif
1027
+ #if !CYTHON_USE_AM_SEND
1028
+ #define __PYX_HAS_PY_AM_SEND 0
1029
+ #elif __PYX_LIMITED_VERSION_HEX >= 0x030A0000
1030
+ #define __PYX_HAS_PY_AM_SEND 1
1031
+ #else
1032
+ #define __PYX_HAS_PY_AM_SEND 2 // our own backported implementation
1033
+ #endif
1034
+ #if __PYX_HAS_PY_AM_SEND < 2
1035
+ #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
1036
+ #else
1037
+ typedef struct {
1038
+ unaryfunc am_await;
1039
+ unaryfunc am_aiter;
1040
+ unaryfunc am_anext;
1041
+ __Pyx_pyiter_sendfunc am_send;
1042
+ } __Pyx_PyAsyncMethodsStruct;
1043
+ #define __Pyx_SlotTpAsAsync(s) ((PyAsyncMethods*)(s))
1044
+ #endif
1045
+ #if CYTHON_USE_AM_SEND && PY_VERSION_HEX < 0x030A00F0
1046
+ #define __Pyx_TPFLAGS_HAVE_AM_SEND (1UL << 21)
1047
+ #else
1048
+ #define __Pyx_TPFLAGS_HAVE_AM_SEND (0)
1049
+ #endif
1050
+ #if PY_VERSION_HEX >= 0x03090000
1051
+ #define __Pyx_PyInterpreterState_Get() PyInterpreterState_Get()
1052
+ #else
1053
+ #define __Pyx_PyInterpreterState_Get() PyThreadState_Get()->interp
1054
+ #endif
1055
+ #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030A0000
1056
+ #ifdef __cplusplus
1057
+ extern "C"
1058
+ #endif
1059
+ PyAPI_FUNC(void *) PyMem_Calloc(size_t nelem, size_t elsize);
1060
+ #endif
1061
+ #if CYTHON_COMPILING_IN_LIMITED_API
1062
+ static int __Pyx_init_co_variable(PyObject *inspect, const char* name, int *write_to) {
1063
+ int value;
1064
+ PyObject *py_value = PyObject_GetAttrString(inspect, name);
1065
+ if (!py_value) return 0;
1066
+ value = (int) PyLong_AsLong(py_value);
1067
+ Py_DECREF(py_value);
1068
+ *write_to = value;
1069
+ return value != -1 || !PyErr_Occurred();
1070
+ }
1071
+ static int __Pyx_init_co_variables(void) {
1072
+ PyObject *inspect;
1073
+ int result;
1074
+ inspect = PyImport_ImportModule("inspect");
1075
+ result =
1076
+ #if !defined(CO_OPTIMIZED)
1077
+ __Pyx_init_co_variable(inspect, "CO_OPTIMIZED", &CO_OPTIMIZED) &&
1078
+ #endif
1079
+ #if !defined(CO_NEWLOCALS)
1080
+ __Pyx_init_co_variable(inspect, "CO_NEWLOCALS", &CO_NEWLOCALS) &&
1081
+ #endif
1082
+ #if !defined(CO_VARARGS)
1083
+ __Pyx_init_co_variable(inspect, "CO_VARARGS", &CO_VARARGS) &&
1084
+ #endif
1085
+ #if !defined(CO_VARKEYWORDS)
1086
+ __Pyx_init_co_variable(inspect, "CO_VARKEYWORDS", &CO_VARKEYWORDS) &&
1087
+ #endif
1088
+ #if !defined(CO_ASYNC_GENERATOR)
1089
+ __Pyx_init_co_variable(inspect, "CO_ASYNC_GENERATOR", &CO_ASYNC_GENERATOR) &&
1090
+ #endif
1091
+ #if !defined(CO_GENERATOR)
1092
+ __Pyx_init_co_variable(inspect, "CO_GENERATOR", &CO_GENERATOR) &&
1093
+ #endif
1094
+ #if !defined(CO_COROUTINE)
1095
+ __Pyx_init_co_variable(inspect, "CO_COROUTINE", &CO_COROUTINE) &&
1096
+ #endif
1097
+ 1;
1098
+ Py_DECREF(inspect);
1099
+ return result ? 0 : -1;
1100
+ }
1101
+ #else
1102
+ static int __Pyx_init_co_variables(void) {
1103
+ return 0; // It's a limited API-only feature
1104
+ }
1105
+ #endif
1106
+
1107
+ /* MathInitCode */
1108
+ #if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)
1109
+ #ifndef _USE_MATH_DEFINES
1110
+ #define _USE_MATH_DEFINES
1111
+ #endif
1112
+ #endif
1113
+ #include <math.h>
1114
+ #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
1115
+ #define __Pyx_truncl trunc
1116
+ #else
1117
+ #define __Pyx_truncl truncl
1118
+ #endif
1119
+
1120
+ #ifndef CYTHON_CLINE_IN_TRACEBACK_RUNTIME
1121
+ #define CYTHON_CLINE_IN_TRACEBACK_RUNTIME 0
1122
+ #endif
1123
+ #ifndef CYTHON_CLINE_IN_TRACEBACK
1124
+ #define CYTHON_CLINE_IN_TRACEBACK CYTHON_CLINE_IN_TRACEBACK_RUNTIME
1125
+ #endif
1126
+ #if CYTHON_CLINE_IN_TRACEBACK
1127
+ #define __PYX_MARK_ERR_POS(f_index, lineno) { __pyx_filename = __pyx_f[f_index]; (void) __pyx_filename; __pyx_lineno = lineno; (void) __pyx_lineno; __pyx_clineno = __LINE__; (void) __pyx_clineno; }
1128
+ #else
1129
+ #define __PYX_MARK_ERR_POS(f_index, lineno) { __pyx_filename = __pyx_f[f_index]; (void) __pyx_filename; __pyx_lineno = lineno; (void) __pyx_lineno; (void) __pyx_clineno; }
1130
+ #endif
1131
+ #define __PYX_ERR(f_index, lineno, Ln_error) \
1132
+ { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
1133
+
1134
+ #ifdef CYTHON_EXTERN_C
1135
+ #undef __PYX_EXTERN_C
1136
+ #define __PYX_EXTERN_C CYTHON_EXTERN_C
1137
+ #elif defined(__PYX_EXTERN_C)
1138
+ #ifdef _MSC_VER
1139
+ #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.")
1140
+ #else
1141
+ #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.
1142
+ #endif
1143
+ #else
1144
+ #ifdef __cplusplus
1145
+ #define __PYX_EXTERN_C extern "C"
1146
+ #else
1147
+ #define __PYX_EXTERN_C extern
1148
+ #endif
1149
+ #endif
1150
+
1151
+ #define __PYX_HAVE__cbase__allocator_protocol__c_shm_comp
1152
+ #define __PYX_HAVE_API__cbase__allocator_protocol__c_shm_comp
1153
+ /* Early includes */
1154
+ #include "cbase/allocator_protocol/c_shm_comp.h"
1155
+ #ifdef _OPENMP
1156
+ #include <omp.h>
1157
+ #endif /* _OPENMP */
1158
+
1159
+ #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
1160
+ #define CYTHON_WITHOUT_ASSERTIONS
1161
+ #endif
1162
+
1163
+ #ifdef CYTHON_FREETHREADING_COMPATIBLE
1164
+ #if CYTHON_FREETHREADING_COMPATIBLE
1165
+ #define __Pyx_FREETHREADING_COMPATIBLE Py_MOD_GIL_NOT_USED
1166
+ #else
1167
+ #define __Pyx_FREETHREADING_COMPATIBLE Py_MOD_GIL_USED
1168
+ #endif
1169
+ #else
1170
+ #define __Pyx_FREETHREADING_COMPATIBLE Py_MOD_GIL_USED
1171
+ #endif
1172
+ #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
1173
+ #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
1174
+ #define __PYX_DEFAULT_STRING_ENCODING ""
1175
+ #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
1176
+ #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
1177
+ #define __Pyx_uchar_cast(c) ((unsigned char)c)
1178
+ #define __Pyx_long_cast(x) ((long)x)
1179
+ #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
1180
+ (sizeof(type) < sizeof(Py_ssize_t)) ||\
1181
+ (sizeof(type) > sizeof(Py_ssize_t) &&\
1182
+ likely(v < (type)PY_SSIZE_T_MAX ||\
1183
+ v == (type)PY_SSIZE_T_MAX) &&\
1184
+ (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
1185
+ v == (type)PY_SSIZE_T_MIN))) ||\
1186
+ (sizeof(type) == sizeof(Py_ssize_t) &&\
1187
+ (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
1188
+ v == (type)PY_SSIZE_T_MAX))) )
1189
+ static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
1190
+ return (size_t) i < (size_t) limit;
1191
+ }
1192
+ #if defined (__cplusplus) && __cplusplus >= 201103L
1193
+ #include <cstdlib>
1194
+ #define __Pyx_sst_abs(value) std::abs(value)
1195
+ #elif SIZEOF_INT >= SIZEOF_SIZE_T
1196
+ #define __Pyx_sst_abs(value) abs(value)
1197
+ #elif SIZEOF_LONG >= SIZEOF_SIZE_T
1198
+ #define __Pyx_sst_abs(value) labs(value)
1199
+ #elif defined (_MSC_VER)
1200
+ #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
1201
+ #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
1202
+ #define __Pyx_sst_abs(value) llabs(value)
1203
+ #elif defined (__GNUC__)
1204
+ #define __Pyx_sst_abs(value) __builtin_llabs(value)
1205
+ #else
1206
+ #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
1207
+ #endif
1208
+ static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s);
1209
+ static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
1210
+ static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
1211
+ static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char*);
1212
+ #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
1213
+ #define __Pyx_PyBytes_FromString PyBytes_FromString
1214
+ #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
1215
+ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
1216
+ #if CYTHON_ASSUME_SAFE_MACROS
1217
+ #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
1218
+ #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
1219
+ #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
1220
+ #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
1221
+ #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
1222
+ #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
1223
+ #define __Pyx_PyByteArray_AsString(s) PyByteArray_AS_STRING(s)
1224
+ #else
1225
+ #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AsString(s))
1226
+ #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AsString(s))
1227
+ #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AsString(s))
1228
+ #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AsString(s))
1229
+ #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AsString(s))
1230
+ #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AsString(s))
1231
+ #define __Pyx_PyByteArray_AsString(s) PyByteArray_AsString(s)
1232
+ #endif
1233
+ #define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
1234
+ #define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
1235
+ #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
1236
+ #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
1237
+ #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
1238
+ #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
1239
+ #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
1240
+ #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
1241
+ #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
1242
+ #define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o)
1243
+ #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
1244
+ static CYTHON_INLINE PyObject *__Pyx_NewRef(PyObject *obj) {
1245
+ #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_NewRef)
1246
+ return Py_NewRef(obj);
1247
+ #else
1248
+ Py_INCREF(obj);
1249
+ return obj;
1250
+ #endif
1251
+ }
1252
+ static CYTHON_INLINE PyObject *__Pyx_XNewRef(PyObject *obj) {
1253
+ #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_XNewRef)
1254
+ return Py_XNewRef(obj);
1255
+ #else
1256
+ Py_XINCREF(obj);
1257
+ return obj;
1258
+ #endif
1259
+ }
1260
+ static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b);
1261
+ static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
1262
+ static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
1263
+ static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
1264
+ static CYTHON_INLINE PyObject* __Pyx_PyNumber_Long(PyObject* x);
1265
+ #define __Pyx_PySequence_Tuple(obj)\
1266
+ (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
1267
+ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
1268
+ static CYTHON_INLINE PyObject * __Pyx_PyLong_FromSize_t(size_t);
1269
+ static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*);
1270
+ #if CYTHON_ASSUME_SAFE_MACROS
1271
+ #define __Pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
1272
+ #define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AS_DOUBLE(x)
1273
+ #else
1274
+ #define __Pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
1275
+ #define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AsDouble(x)
1276
+ #endif
1277
+ #define __Pyx_PyFloat_AsFloat(x) ((float) __Pyx_PyFloat_AsDouble(x))
1278
+ #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
1279
+ #if CYTHON_USE_PYLONG_INTERNALS
1280
+ #if PY_VERSION_HEX >= 0x030C00A7
1281
+ #ifndef _PyLong_SIGN_MASK
1282
+ #define _PyLong_SIGN_MASK 3
1283
+ #endif
1284
+ #ifndef _PyLong_NON_SIZE_BITS
1285
+ #define _PyLong_NON_SIZE_BITS 3
1286
+ #endif
1287
+ #define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK)
1288
+ #define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0)
1289
+ #define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x))
1290
+ #define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1)
1291
+ #define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0)
1292
+ #define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0])
1293
+ #define __Pyx_PyLong_DigitCount(x) ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS))
1294
+ #define __Pyx_PyLong_SignedDigitCount(x)\
1295
+ ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x))
1296
+ #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue)
1297
+ #define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x)
1298
+ #define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x)
1299
+ #else
1300
+ #define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS))
1301
+ #define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0])
1302
+ #endif
1303
+ typedef Py_ssize_t __Pyx_compact_pylong;
1304
+ typedef size_t __Pyx_compact_upylong;
1305
+ #else
1306
+ #define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0)
1307
+ #define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0)
1308
+ #define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0)
1309
+ #define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0)
1310
+ #define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0])
1311
+ #define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x))
1312
+ #define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x)
1313
+ #define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1)
1314
+ #define __Pyx_PyLong_CompactValue(x)\
1315
+ ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0]))
1316
+ typedef sdigit __Pyx_compact_pylong;
1317
+ typedef digit __Pyx_compact_upylong;
1318
+ #endif
1319
+ #if PY_VERSION_HEX >= 0x030C00A5
1320
+ #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit)
1321
+ #else
1322
+ #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit)
1323
+ #endif
1324
+ #endif
1325
+ #if __PYX_DEFAULT_STRING_ENCODING_IS_UTF8
1326
+ #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
1327
+ #elif __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
1328
+ #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeASCII(c_str, size, NULL)
1329
+ #else
1330
+ #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
1331
+ #endif
1332
+
1333
+
1334
+ /* Test for GCC > 2.95 */
1335
+ #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
1336
+ #define likely(x) __builtin_expect(!!(x), 1)
1337
+ #define unlikely(x) __builtin_expect(!!(x), 0)
1338
+ #else /* !__GNUC__ or GCC < 2.95 */
1339
+ #define likely(x) (x)
1340
+ #define unlikely(x) (x)
1341
+ #endif /* __GNUC__ */
1342
+ /* PretendToInitialize */
1343
+ #ifdef __cplusplus
1344
+ #if __cplusplus > 201103L
1345
+ #include <type_traits>
1346
+ #endif
1347
+ template <typename T>
1348
+ static void __Pyx_pretend_to_initialize(T* ptr) {
1349
+ #if __cplusplus > 201103L
1350
+ if ((std::is_trivially_default_constructible<T>::value))
1351
+ #endif
1352
+ *ptr = T();
1353
+ (void)ptr;
1354
+ }
1355
+ #else
1356
+ static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
1357
+ #endif
1358
+
1359
+
1360
+ #if !CYTHON_USE_MODULE_STATE
1361
+ static PyObject *__pyx_m = NULL;
1362
+ #endif
1363
+ static int __pyx_lineno;
1364
+ static int __pyx_clineno = 0;
1365
+ static const char * const __pyx_cfilenm = __FILE__;
1366
+ static const char *__pyx_filename;
1367
+
1368
+ /* #### Code section: filename_table ### */
1369
+
1370
+ static const char* const __pyx_f[] = {
1371
+ "cbase/allocator_protocol/c_shm_comp.pyx",
1372
+ };
1373
+ /* #### Code section: utility_code_proto_before_types ### */
1374
+ /* Atomics.proto (used by CodeObjectCache) */
1375
+ #include <pythread.h>
1376
+ #ifndef CYTHON_ATOMICS
1377
+ #define CYTHON_ATOMICS 1
1378
+ #endif
1379
+ #define __PYX_CYTHON_ATOMICS_ENABLED() CYTHON_ATOMICS
1380
+ #define __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
1381
+ #define __pyx_atomic_int_type int
1382
+ #define __pyx_nonatomic_int_type int
1383
+ #if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\
1384
+ (__STDC_VERSION__ >= 201112L) &&\
1385
+ !defined(__STDC_NO_ATOMICS__))
1386
+ #include <stdatomic.h>
1387
+ #elif CYTHON_ATOMICS && (defined(__cplusplus) && (\
1388
+ (__cplusplus >= 201103L) ||\
1389
+ (defined(_MSC_VER) && _MSC_VER >= 1700)))
1390
+ #include <atomic>
1391
+ #endif
1392
+ #if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\
1393
+ (__STDC_VERSION__ >= 201112L) &&\
1394
+ !defined(__STDC_NO_ATOMICS__) &&\
1395
+ ATOMIC_INT_LOCK_FREE == 2)
1396
+ #undef __pyx_atomic_int_type
1397
+ #define __pyx_atomic_int_type atomic_int
1398
+ #define __pyx_atomic_ptr_type atomic_uintptr_t
1399
+ #define __pyx_nonatomic_ptr_type uintptr_t
1400
+ #define __pyx_atomic_incr_relaxed(value) atomic_fetch_add_explicit(value, 1, memory_order_relaxed)
1401
+ #define __pyx_atomic_incr_acq_rel(value) atomic_fetch_add_explicit(value, 1, memory_order_acq_rel)
1402
+ #define __pyx_atomic_decr_acq_rel(value) atomic_fetch_sub_explicit(value, 1, memory_order_acq_rel)
1403
+ #define __pyx_atomic_sub(value, arg) atomic_fetch_sub(value, arg)
1404
+ #define __pyx_atomic_int_cmp_exchange(value, expected, desired) atomic_compare_exchange_strong(value, expected, desired)
1405
+ #define __pyx_atomic_load(value) atomic_load(value)
1406
+ #define __pyx_atomic_store(value, new_value) atomic_store(value, new_value)
1407
+ #define __pyx_atomic_pointer_load_relaxed(value) atomic_load_explicit(value, memory_order_relaxed)
1408
+ #define __pyx_atomic_pointer_load_acquire(value) atomic_load_explicit(value, memory_order_acquire)
1409
+ #define __pyx_atomic_pointer_exchange(value, new_value) atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value)
1410
+ #define __pyx_atomic_pointer_cmp_exchange(value, expected, desired) atomic_compare_exchange_strong(value, expected, desired)
1411
+ #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER)
1412
+ #pragma message ("Using standard C atomics")
1413
+ #elif defined(__PYX_DEBUG_ATOMICS)
1414
+ #warning "Using standard C atomics"
1415
+ #endif
1416
+ #elif CYTHON_ATOMICS && (defined(__cplusplus) && (\
1417
+ (__cplusplus >= 201103L) ||\
1418
+ \
1419
+ (defined(_MSC_VER) && _MSC_VER >= 1700)) &&\
1420
+ ATOMIC_INT_LOCK_FREE == 2)
1421
+ #undef __pyx_atomic_int_type
1422
+ #define __pyx_atomic_int_type std::atomic_int
1423
+ #define __pyx_atomic_ptr_type std::atomic_uintptr_t
1424
+ #define __pyx_nonatomic_ptr_type uintptr_t
1425
+ #define __pyx_atomic_incr_relaxed(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_relaxed)
1426
+ #define __pyx_atomic_incr_acq_rel(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_acq_rel)
1427
+ #define __pyx_atomic_decr_acq_rel(value) std::atomic_fetch_sub_explicit(value, 1, std::memory_order_acq_rel)
1428
+ #define __pyx_atomic_sub(value, arg) std::atomic_fetch_sub(value, arg)
1429
+ #define __pyx_atomic_int_cmp_exchange(value, expected, desired) std::atomic_compare_exchange_strong(value, expected, desired)
1430
+ #define __pyx_atomic_load(value) std::atomic_load(value)
1431
+ #define __pyx_atomic_store(value, new_value) std::atomic_store(value, new_value)
1432
+ #define __pyx_atomic_pointer_load_relaxed(value) std::atomic_load_explicit(value, std::memory_order_relaxed)
1433
+ #define __pyx_atomic_pointer_load_acquire(value) std::atomic_load_explicit(value, std::memory_order_acquire)
1434
+ #define __pyx_atomic_pointer_exchange(value, new_value) std::atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value)
1435
+ #define __pyx_atomic_pointer_cmp_exchange(value, expected, desired) std::atomic_compare_exchange_strong(value, expected, desired)
1436
+ #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER)
1437
+ #pragma message ("Using standard C++ atomics")
1438
+ #elif defined(__PYX_DEBUG_ATOMICS)
1439
+ #warning "Using standard C++ atomics"
1440
+ #endif
1441
+ #elif CYTHON_ATOMICS && (__GNUC__ >= 5 || (__GNUC__ == 4 &&\
1442
+ (__GNUC_MINOR__ > 1 ||\
1443
+ (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ >= 2))))
1444
+ #define __pyx_atomic_ptr_type void*
1445
+ #define __pyx_nonatomic_ptr_type void*
1446
+ #define __pyx_atomic_incr_relaxed(value) __sync_fetch_and_add(value, 1)
1447
+ #define __pyx_atomic_incr_acq_rel(value) __sync_fetch_and_add(value, 1)
1448
+ #define __pyx_atomic_decr_acq_rel(value) __sync_fetch_and_sub(value, 1)
1449
+ #define __pyx_atomic_sub(value, arg) __sync_fetch_and_sub(value, arg)
1450
+ static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) {
1451
+ __pyx_nonatomic_int_type old = __sync_val_compare_and_swap(value, *expected, desired);
1452
+ int result = old == *expected;
1453
+ *expected = old;
1454
+ return result;
1455
+ }
1456
+ #define __pyx_atomic_load(value) __sync_fetch_and_add(value, 0)
1457
+ #define __pyx_atomic_store(value, new_value) __sync_lock_test_and_set(value, new_value)
1458
+ #define __pyx_atomic_pointer_load_relaxed(value) __sync_fetch_and_add(value, 0)
1459
+ #define __pyx_atomic_pointer_load_acquire(value) __sync_fetch_and_add(value, 0)
1460
+ #define __pyx_atomic_pointer_exchange(value, new_value) __sync_lock_test_and_set(value, (__pyx_atomic_ptr_type)new_value)
1461
+ static CYTHON_INLINE int __pyx_atomic_pointer_cmp_exchange(__pyx_atomic_ptr_type* value, __pyx_nonatomic_ptr_type* expected, __pyx_nonatomic_ptr_type desired) {
1462
+ __pyx_nonatomic_ptr_type old = __sync_val_compare_and_swap(value, *expected, desired);
1463
+ int result = old == *expected;
1464
+ *expected = old;
1465
+ return result;
1466
+ }
1467
+ #ifdef __PYX_DEBUG_ATOMICS
1468
+ #warning "Using GNU atomics"
1469
+ #endif
1470
+ #elif CYTHON_ATOMICS && defined(_MSC_VER)
1471
+ #include <intrin.h>
1472
+ #undef __pyx_atomic_int_type
1473
+ #define __pyx_atomic_int_type long
1474
+ #define __pyx_atomic_ptr_type void*
1475
+ #undef __pyx_nonatomic_int_type
1476
+ #define __pyx_nonatomic_int_type long
1477
+ #define __pyx_nonatomic_ptr_type void*
1478
+ #pragma intrinsic (_InterlockedExchangeAdd, _InterlockedExchange, _InterlockedCompareExchange, _InterlockedCompareExchangePointer, _InterlockedExchangePointer)
1479
+ #define __pyx_atomic_incr_relaxed(value) _InterlockedExchangeAdd(value, 1)
1480
+ #define __pyx_atomic_incr_acq_rel(value) _InterlockedExchangeAdd(value, 1)
1481
+ #define __pyx_atomic_decr_acq_rel(value) _InterlockedExchangeAdd(value, -1)
1482
+ #define __pyx_atomic_sub(value, arg) _InterlockedExchangeAdd(value, -arg)
1483
+ static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) {
1484
+ __pyx_nonatomic_int_type old = _InterlockedCompareExchange(value, desired, *expected);
1485
+ int result = old == *expected;
1486
+ *expected = old;
1487
+ return result;
1488
+ }
1489
+ #define __pyx_atomic_load(value) _InterlockedExchangeAdd(value, 0)
1490
+ #define __pyx_atomic_store(value, new_value) _InterlockedExchange(value, new_value)
1491
+ #define __pyx_atomic_pointer_load_relaxed(value) *(void * volatile *)value
1492
+ #define __pyx_atomic_pointer_load_acquire(value) _InterlockedCompareExchangePointer(value, 0, 0)
1493
+ #define __pyx_atomic_pointer_exchange(value, new_value) _InterlockedExchangePointer(value, (__pyx_atomic_ptr_type)new_value)
1494
+ static CYTHON_INLINE int __pyx_atomic_pointer_cmp_exchange(__pyx_atomic_ptr_type* value, __pyx_nonatomic_ptr_type* expected, __pyx_nonatomic_ptr_type desired) {
1495
+ __pyx_atomic_ptr_type old = _InterlockedCompareExchangePointer(value, desired, *expected);
1496
+ int result = old == *expected;
1497
+ *expected = old;
1498
+ return result;
1499
+ }
1500
+ #ifdef __PYX_DEBUG_ATOMICS
1501
+ #pragma message ("Using MSVC atomics")
1502
+ #endif
1503
+ #else
1504
+ #undef CYTHON_ATOMICS
1505
+ #define CYTHON_ATOMICS 0
1506
+ #ifdef __PYX_DEBUG_ATOMICS
1507
+ #warning "Not using atomics"
1508
+ #endif
1509
+ #endif
1510
+
1511
+ /* #### Code section: numeric_typedefs ### */
1512
+ /* #### Code section: complex_type_declarations ### */
1513
+ /* #### Code section: type_declarations ### */
1514
+
1515
+ /*--- Type declarations ---*/
1516
+ /* #### Code section: utility_code_proto ### */
1517
+
1518
+ /* --- Runtime support code (head) --- */
1519
+ /* Refnanny.proto */
1520
+ #ifndef CYTHON_REFNANNY
1521
+ #define CYTHON_REFNANNY 0
1522
+ #endif
1523
+ #if CYTHON_REFNANNY
1524
+ typedef struct {
1525
+ void (*INCREF)(void*, PyObject*, Py_ssize_t);
1526
+ void (*DECREF)(void*, PyObject*, Py_ssize_t);
1527
+ void (*GOTREF)(void*, PyObject*, Py_ssize_t);
1528
+ void (*GIVEREF)(void*, PyObject*, Py_ssize_t);
1529
+ void* (*SetupContext)(const char*, Py_ssize_t, const char*);
1530
+ void (*FinishContext)(void**);
1531
+ } __Pyx_RefNannyAPIStruct;
1532
+ static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1533
+ static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
1534
+ #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1535
+ #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1536
+ if (acquire_gil) {\
1537
+ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1538
+ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\
1539
+ PyGILState_Release(__pyx_gilstate_save);\
1540
+ } else {\
1541
+ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\
1542
+ }
1543
+ #define __Pyx_RefNannyFinishContextNogil() {\
1544
+ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1545
+ __Pyx_RefNannyFinishContext();\
1546
+ PyGILState_Release(__pyx_gilstate_save);\
1547
+ }
1548
+ #define __Pyx_RefNannyFinishContextNogil() {\
1549
+ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1550
+ __Pyx_RefNannyFinishContext();\
1551
+ PyGILState_Release(__pyx_gilstate_save);\
1552
+ }
1553
+ #define __Pyx_RefNannyFinishContext()\
1554
+ __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1555
+ #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
1556
+ #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
1557
+ #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
1558
+ #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
1559
+ #define __Pyx_XINCREF(r) do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0)
1560
+ #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0)
1561
+ #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0)
1562
+ #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0)
1563
+ #else
1564
+ #define __Pyx_RefNannyDeclarations
1565
+ #define __Pyx_RefNannySetupContext(name, acquire_gil)
1566
+ #define __Pyx_RefNannyFinishContextNogil()
1567
+ #define __Pyx_RefNannyFinishContext()
1568
+ #define __Pyx_INCREF(r) Py_INCREF(r)
1569
+ #define __Pyx_DECREF(r) Py_DECREF(r)
1570
+ #define __Pyx_GOTREF(r)
1571
+ #define __Pyx_GIVEREF(r)
1572
+ #define __Pyx_XINCREF(r) Py_XINCREF(r)
1573
+ #define __Pyx_XDECREF(r) Py_XDECREF(r)
1574
+ #define __Pyx_XGOTREF(r)
1575
+ #define __Pyx_XGIVEREF(r)
1576
+ #endif
1577
+ #define __Pyx_Py_XDECREF_SET(r, v) do {\
1578
+ PyObject *tmp = (PyObject *) r;\
1579
+ r = v; Py_XDECREF(tmp);\
1580
+ } while (0)
1581
+ #define __Pyx_XDECREF_SET(r, v) do {\
1582
+ PyObject *tmp = (PyObject *) r;\
1583
+ r = v; __Pyx_XDECREF(tmp);\
1584
+ } while (0)
1585
+ #define __Pyx_DECREF_SET(r, v) do {\
1586
+ PyObject *tmp = (PyObject *) r;\
1587
+ r = v; __Pyx_DECREF(tmp);\
1588
+ } while (0)
1589
+ #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1590
+ #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1591
+
1592
+ /* VoidPtrExport.proto */
1593
+ static int __Pyx_ExportVoidPtr(PyObject *api_dict, const char *name, void *p, const char *sig);
1594
+
1595
+ /* GetApiDict.proto */
1596
+ static PyObject *__Pyx_ApiExport_GetApiDict(void);
1597
+
1598
+ /* IncludeStringH.proto */
1599
+ #include <string.h>
1600
+
1601
+ /* dict_setdefault.proto (used by CLineInTraceback) */
1602
+ static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value);
1603
+
1604
+ /* PyDictVersioning.proto (used by CLineInTraceback) */
1605
+ #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1606
+ #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
1607
+ #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
1608
+ #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1609
+ (version_var) = __PYX_GET_DICT_VERSION(dict);\
1610
+ (cache_var) = (value);
1611
+ #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1612
+ static PY_UINT64_T __pyx_dict_version = 0;\
1613
+ static PyObject *__pyx_dict_cached_value = NULL;\
1614
+ if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1615
+ (VAR) = __Pyx_XNewRef(__pyx_dict_cached_value);\
1616
+ } else {\
1617
+ (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1618
+ __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1619
+ }\
1620
+ }
1621
+ static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1622
+ static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1623
+ static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1624
+ #else
1625
+ #define __PYX_GET_DICT_VERSION(dict) (0)
1626
+ #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1627
+ #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
1628
+ #endif
1629
+
1630
+ /* PyErrExceptionMatches.proto (used by PyObjectGetAttrStrNoError) */
1631
+ #if CYTHON_FAST_THREAD_STATE
1632
+ #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1633
+ static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1634
+ #else
1635
+ #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
1636
+ #endif
1637
+
1638
+ /* PyThreadStateGet.proto (used by PyErrFetchRestore) */
1639
+ #if CYTHON_FAST_THREAD_STATE
1640
+ #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
1641
+ #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
1642
+ #if PY_VERSION_HEX >= 0x030C00A6
1643
+ #define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL)
1644
+ #define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL)
1645
+ #else
1646
+ #define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL)
1647
+ #define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type)
1648
+ #endif
1649
+ #else
1650
+ #define __Pyx_PyThreadState_declare
1651
+ #define __Pyx_PyThreadState_assign
1652
+ #define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL)
1653
+ #define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred()
1654
+ #endif
1655
+
1656
+ /* PyErrFetchRestore.proto (used by PyObjectGetAttrStrNoError) */
1657
+ #if CYTHON_FAST_THREAD_STATE
1658
+ #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1659
+ #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1660
+ #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1661
+ #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1662
+ #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1663
+ static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1664
+ static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1665
+ #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6
1666
+ #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1667
+ #else
1668
+ #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1669
+ #endif
1670
+ #else
1671
+ #define __Pyx_PyErr_Clear() PyErr_Clear()
1672
+ #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1673
+ #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1674
+ #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1675
+ #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
1676
+ #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
1677
+ #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1678
+ #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1679
+ #endif
1680
+
1681
+ /* PyObjectGetAttrStr.proto (used by PyObjectGetAttrStrNoError) */
1682
+ #if CYTHON_USE_TYPE_SLOTS
1683
+ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1684
+ #else
1685
+ #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1686
+ #endif
1687
+
1688
+ /* PyObjectGetAttrStrNoError.proto (used by CLineInTraceback) */
1689
+ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
1690
+
1691
+ /* CLineInTraceback.proto (used by AddTraceback) */
1692
+ #if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME
1693
+ static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1694
+ #else
1695
+ #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1696
+ #endif
1697
+
1698
+ /* CodeObjectCache.proto (used by AddTraceback) */
1699
+ #if CYTHON_COMPILING_IN_LIMITED_API
1700
+ typedef PyObject __Pyx_CachedCodeObjectType;
1701
+ #else
1702
+ typedef PyCodeObject __Pyx_CachedCodeObjectType;
1703
+ #endif
1704
+ typedef struct {
1705
+ __Pyx_CachedCodeObjectType* code_object;
1706
+ int code_line;
1707
+ } __Pyx_CodeObjectCacheEntry;
1708
+ struct __Pyx_CodeObjectCache {
1709
+ int count;
1710
+ int max_count;
1711
+ __Pyx_CodeObjectCacheEntry* entries;
1712
+ #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
1713
+ __pyx_atomic_int_type accessor_count;
1714
+ #endif
1715
+ };
1716
+ static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1717
+ static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line);
1718
+ static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object);
1719
+
1720
+ /* AddTraceback.proto */
1721
+ static void __Pyx_AddTraceback(const char *funcname, int c_line,
1722
+ int py_line, const char *filename);
1723
+
1724
+ /* FormatTypeName.proto */
1725
+ #if CYTHON_COMPILING_IN_LIMITED_API
1726
+ typedef PyObject *__Pyx_TypeName;
1727
+ #define __Pyx_FMT_TYPENAME "%U"
1728
+ #define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj)
1729
+ #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
1730
+ #define __Pyx_PyType_GetFullyQualifiedName PyType_GetFullyQualifiedName
1731
+ #else
1732
+ static __Pyx_TypeName __Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp);
1733
+ #endif
1734
+ #else // !LIMITED_API
1735
+ typedef const char *__Pyx_TypeName;
1736
+ #define __Pyx_FMT_TYPENAME "%.200s"
1737
+ #define __Pyx_PyType_GetFullyQualifiedName(tp) ((tp)->tp_name)
1738
+ #define __Pyx_DECREF_TypeName(obj)
1739
+ #endif
1740
+
1741
+ /* GCCDiagnostics.proto (used by CIntToPy) */
1742
+ #if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
1743
+ #define __Pyx_HAS_GCC_DIAGNOSTIC
1744
+ #endif
1745
+
1746
+ /* PyObjectCall.proto (used by PyObjectFastCall) */
1747
+ #if CYTHON_COMPILING_IN_CPYTHON
1748
+ static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1749
+ #else
1750
+ #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1751
+ #endif
1752
+
1753
+ /* PyObjectCallMethO.proto (used by PyObjectFastCall) */
1754
+ #if CYTHON_COMPILING_IN_CPYTHON
1755
+ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1756
+ #endif
1757
+
1758
+ /* PyObjectFastCall.proto (used by PyObjectVectorCallKwBuilder) */
1759
+ #define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL)
1760
+ static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs);
1761
+
1762
+ /* PyObjectVectorCallKwBuilder.proto (used by CIntToPy) */
1763
+ CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n);
1764
+ #if CYTHON_VECTORCALL
1765
+ #if PY_VERSION_HEX >= 0x03090000
1766
+ #define __Pyx_Object_Vectorcall_CallFromBuilder PyObject_Vectorcall
1767
+ #else
1768
+ #define __Pyx_Object_Vectorcall_CallFromBuilder _PyObject_Vectorcall
1769
+ #endif
1770
+ #define __Pyx_MakeVectorcallBuilderKwds(n) PyTuple_New(n)
1771
+ static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n);
1772
+ static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n);
1773
+ #else
1774
+ #define __Pyx_Object_Vectorcall_CallFromBuilder __Pyx_PyObject_FastCallDict
1775
+ #define __Pyx_MakeVectorcallBuilderKwds(n) __Pyx_PyDict_NewPresized(n)
1776
+ #define __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n) PyDict_SetItem(builder, key, value)
1777
+ #define __Pyx_VectorcallBuilder_AddArgStr(key, value, builder, args, n) PyDict_SetItemString(builder, key, value)
1778
+ #endif
1779
+
1780
+ /* CIntToPy.proto */
1781
+ static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value);
1782
+
1783
+ /* CIntFromPy.proto */
1784
+ static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *);
1785
+
1786
+ /* CIntFromPy.proto */
1787
+ static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *);
1788
+
1789
+ /* FastTypeChecks.proto */
1790
+ #if CYTHON_COMPILING_IN_CPYTHON
1791
+ #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1792
+ #define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2)
1793
+ static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1794
+ static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b);
1795
+ static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1796
+ static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1797
+ #else
1798
+ #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1799
+ #define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2))
1800
+ #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1801
+ static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2) {
1802
+ return PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2);
1803
+ }
1804
+ #endif
1805
+ #define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2)
1806
+ #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1807
+ #ifdef PyExceptionInstance_Check
1808
+ #define __Pyx_PyBaseException_Check(obj) PyExceptionInstance_Check(obj)
1809
+ #else
1810
+ #define __Pyx_PyBaseException_Check(obj) __Pyx_TypeCheck(obj, PyExc_BaseException)
1811
+ #endif
1812
+
1813
+ /* GetRuntimeVersion.proto */
1814
+ #if __PYX_LIMITED_VERSION_HEX < 0x030b0000
1815
+ static unsigned long __Pyx_cached_runtime_version = 0;
1816
+ static void __Pyx_init_runtime_version(void);
1817
+ #else
1818
+ #define __Pyx_init_runtime_version()
1819
+ #endif
1820
+ static unsigned long __Pyx_get_runtime_version(void);
1821
+
1822
+ /* AddModuleRef.proto */
1823
+ #if ((CYTHON_COMPILING_IN_CPYTHON_FREETHREADING ) ||\
1824
+ __PYX_LIMITED_VERSION_HEX < 0x030d0000)
1825
+ static PyObject *__Pyx_PyImport_AddModuleRef(const char *name);
1826
+ #else
1827
+ #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name)
1828
+ #endif
1829
+
1830
+ /* CheckBinaryVersion.proto */
1831
+ static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer);
1832
+
1833
+ /* DecompressString.proto */
1834
+ static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo);
1835
+
1836
+ /* MultiPhaseInitModuleState.proto */
1837
+ #if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE
1838
+ static PyObject *__Pyx_State_FindModule(void*);
1839
+ static int __Pyx_State_AddModule(PyObject* module, void*);
1840
+ static int __Pyx_State_RemoveModule(void*);
1841
+ #elif CYTHON_USE_MODULE_STATE
1842
+ #define __Pyx_State_FindModule PyState_FindModule
1843
+ #define __Pyx_State_AddModule PyState_AddModule
1844
+ #define __Pyx_State_RemoveModule PyState_RemoveModule
1845
+ #endif
1846
+
1847
+ /* #### Code section: module_declarations ### */
1848
+ /* CythonABIVersion.proto */
1849
+ #if CYTHON_COMPILING_IN_LIMITED_API
1850
+ #if CYTHON_METH_FASTCALL
1851
+ #define __PYX_FASTCALL_ABI_SUFFIX "_fastcall"
1852
+ #else
1853
+ #define __PYX_FASTCALL_ABI_SUFFIX
1854
+ #endif
1855
+ #define __PYX_LIMITED_ABI_SUFFIX "limited" __PYX_FASTCALL_ABI_SUFFIX __PYX_AM_SEND_ABI_SUFFIX
1856
+ #else
1857
+ #define __PYX_LIMITED_ABI_SUFFIX
1858
+ #endif
1859
+ #if __PYX_HAS_PY_AM_SEND == 1
1860
+ #define __PYX_AM_SEND_ABI_SUFFIX
1861
+ #elif __PYX_HAS_PY_AM_SEND == 2
1862
+ #define __PYX_AM_SEND_ABI_SUFFIX "amsendbackport"
1863
+ #else
1864
+ #define __PYX_AM_SEND_ABI_SUFFIX "noamsend"
1865
+ #endif
1866
+ #ifndef __PYX_MONITORING_ABI_SUFFIX
1867
+ #define __PYX_MONITORING_ABI_SUFFIX
1868
+ #endif
1869
+ #if CYTHON_USE_TP_FINALIZE
1870
+ #define __PYX_TP_FINALIZE_ABI_SUFFIX
1871
+ #else
1872
+ #define __PYX_TP_FINALIZE_ABI_SUFFIX "nofinalize"
1873
+ #endif
1874
+ #if CYTHON_USE_FREELISTS || !defined(__Pyx_AsyncGen_USED)
1875
+ #define __PYX_FREELISTS_ABI_SUFFIX
1876
+ #else
1877
+ #define __PYX_FREELISTS_ABI_SUFFIX "nofreelists"
1878
+ #endif
1879
+ #define CYTHON_ABI __PYX_ABI_VERSION __PYX_LIMITED_ABI_SUFFIX __PYX_MONITORING_ABI_SUFFIX __PYX_TP_FINALIZE_ABI_SUFFIX __PYX_FREELISTS_ABI_SUFFIX __PYX_AM_SEND_ABI_SUFFIX
1880
+ #define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI
1881
+ #define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "."
1882
+
1883
+
1884
+ /* Module declarations from "cbase.allocator_protocol.c_shm_comp" */
1885
+ static shm_allocator_ctx *__pyx_v_5cbase_18allocator_protocol_10c_shm_comp_C_SHM_COMP;
1886
+ /* #### Code section: typeinfo ### */
1887
+ /* #### Code section: before_global_var ### */
1888
+ #define __Pyx_MODULE_NAME "cbase.allocator_protocol.c_shm_comp"
1889
+ extern int __pyx_module_is_main_cbase__allocator_protocol__c_shm_comp;
1890
+ int __pyx_module_is_main_cbase__allocator_protocol__c_shm_comp = 0;
1891
+
1892
+ /* Implementation of "cbase.allocator_protocol.c_shm_comp" */
1893
+ /* #### Code section: global_var ### */
1894
+ /* #### Code section: string_decls ### */
1895
+ /* #### Code section: decls ### */
1896
+ /* #### Code section: late_includes ### */
1897
+ /* #### Code section: module_state ### */
1898
+ /* SmallCodeConfig */
1899
+ #ifndef CYTHON_SMALL_CODE
1900
+ #if defined(__clang__)
1901
+ #define CYTHON_SMALL_CODE
1902
+ #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
1903
+ #define CYTHON_SMALL_CODE __attribute__((cold))
1904
+ #else
1905
+ #define CYTHON_SMALL_CODE
1906
+ #endif
1907
+ #endif
1908
+
1909
+ typedef struct {
1910
+ PyObject *__pyx_d;
1911
+ PyObject *__pyx_b;
1912
+ PyObject *__pyx_cython_runtime;
1913
+ PyObject *__pyx_empty_tuple;
1914
+ PyObject *__pyx_empty_bytes;
1915
+ PyObject *__pyx_empty_unicode;
1916
+ PyObject *__pyx_string_tab[10];
1917
+ /* #### Code section: module_state_contents ### */
1918
+ /* CodeObjectCache.module_state_decls */
1919
+ struct __Pyx_CodeObjectCache __pyx_code_cache;
1920
+
1921
+ /* #### Code section: module_state_end ### */
1922
+ } __pyx_mstatetype;
1923
+
1924
+ #if CYTHON_USE_MODULE_STATE
1925
+ #ifdef __cplusplus
1926
+ namespace {
1927
+ extern struct PyModuleDef __pyx_moduledef;
1928
+ } /* anonymous namespace */
1929
+ #else
1930
+ static struct PyModuleDef __pyx_moduledef;
1931
+ #endif
1932
+
1933
+ #define __pyx_mstate_global (__Pyx_PyModule_GetState(__Pyx_State_FindModule(&__pyx_moduledef)))
1934
+
1935
+ #define __pyx_m (__Pyx_State_FindModule(&__pyx_moduledef))
1936
+ #else
1937
+ static __pyx_mstatetype __pyx_mstate_global_static =
1938
+ #ifdef __cplusplus
1939
+ {};
1940
+ #else
1941
+ {0};
1942
+ #endif
1943
+ static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_static;
1944
+ #endif
1945
+ /* #### Code section: constant_name_defines ### */
1946
+ #define __pyx_kp_u_ __pyx_string_tab[0]
1947
+ #define __pyx_n_u_cline_in_traceback __pyx_string_tab[1]
1948
+ #define __pyx_n_u_main __pyx_string_tab[2]
1949
+ #define __pyx_n_u_module __pyx_string_tab[3]
1950
+ #define __pyx_n_u_name __pyx_string_tab[4]
1951
+ #define __pyx_n_u_pyx_capi __pyx_string_tab[5]
1952
+ #define __pyx_n_u_qualname __pyx_string_tab[6]
1953
+ #define __pyx_n_u_setdefault __pyx_string_tab[7]
1954
+ #define __pyx_n_u_test __pyx_string_tab[8]
1955
+ #define __pyx_kp_b_shm_allocator_ctx_C_SHM_COMP __pyx_string_tab[9]
1956
+ /* #### Code section: module_state_clear ### */
1957
+ #if CYTHON_USE_MODULE_STATE
1958
+ static CYTHON_SMALL_CODE int __pyx_m_clear(PyObject *m) {
1959
+ __pyx_mstatetype *clear_module_state = __Pyx_PyModule_GetState(m);
1960
+ if (!clear_module_state) return 0;
1961
+ Py_CLEAR(clear_module_state->__pyx_d);
1962
+ Py_CLEAR(clear_module_state->__pyx_b);
1963
+ Py_CLEAR(clear_module_state->__pyx_cython_runtime);
1964
+ Py_CLEAR(clear_module_state->__pyx_empty_tuple);
1965
+ Py_CLEAR(clear_module_state->__pyx_empty_bytes);
1966
+ Py_CLEAR(clear_module_state->__pyx_empty_unicode);
1967
+ #if CYTHON_PEP489_MULTI_PHASE_INIT
1968
+ __Pyx_State_RemoveModule(NULL);
1969
+ #endif
1970
+ for (int i=0; i<10; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); }
1971
+ /* #### Code section: module_state_clear_contents ### */
1972
+ /* #### Code section: module_state_clear_end ### */
1973
+ return 0;
1974
+ }
1975
+ #endif
1976
+ /* #### Code section: module_state_traverse ### */
1977
+ #if CYTHON_USE_MODULE_STATE
1978
+ static CYTHON_SMALL_CODE int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
1979
+ __pyx_mstatetype *traverse_module_state = __Pyx_PyModule_GetState(m);
1980
+ if (!traverse_module_state) return 0;
1981
+ Py_VISIT(traverse_module_state->__pyx_d);
1982
+ Py_VISIT(traverse_module_state->__pyx_b);
1983
+ Py_VISIT(traverse_module_state->__pyx_cython_runtime);
1984
+ __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_tuple);
1985
+ __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_bytes);
1986
+ __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_unicode);
1987
+ for (int i=0; i<10; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); }
1988
+ /* #### Code section: module_state_traverse_contents ### */
1989
+ /* #### Code section: module_state_traverse_end ### */
1990
+ return 0;
1991
+ }
1992
+ #endif
1993
+ /* #### Code section: module_code ### */
1994
+ /* #### Code section: module_exttypes ### */
1995
+
1996
+ static PyMethodDef __pyx_methods[] = {
1997
+ {0, 0, 0, 0}
1998
+ };
1999
+ /* #### Code section: initfunc_declarations ### */
2000
+ static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate); /*proto*/
2001
+ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/
2002
+ static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void); /*proto*/
2003
+ static CYTHON_SMALL_CODE int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/
2004
+ static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
2005
+ static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
2006
+ static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
2007
+ static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
2008
+ static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
2009
+ static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
2010
+ static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
2011
+ static CYTHON_SMALL_CODE int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate); /*proto*/
2012
+ /* #### Code section: init_module ### */
2013
+
2014
+ static int __Pyx_modinit_global_init_code(__pyx_mstatetype *__pyx_mstate) {
2015
+ __Pyx_RefNannyDeclarations
2016
+ CYTHON_UNUSED_VAR(__pyx_mstate);
2017
+ __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
2018
+ /*--- Global init code ---*/
2019
+ __Pyx_RefNannyFinishContext();
2020
+ return 0;
2021
+ }
2022
+
2023
+ static int __Pyx_modinit_variable_export_code(__pyx_mstatetype *__pyx_mstate) {
2024
+ __Pyx_RefNannyDeclarations
2025
+ CYTHON_UNUSED_VAR(__pyx_mstate);
2026
+ PyObject *__pyx_t_1 = NULL;
2027
+ int __pyx_lineno = 0;
2028
+ const char *__pyx_filename = NULL;
2029
+ int __pyx_clineno = 0;
2030
+ __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
2031
+ /*--- Variable export code ---*/
2032
+ {
2033
+ __pyx_t_1 = __Pyx_ApiExport_GetApiDict(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
2034
+ __Pyx_GOTREF(__pyx_t_1);
2035
+ const char * __pyx_export_signature = __Pyx_PyBytes_AsString(__pyx_mstate_global->__pyx_kp_b_shm_allocator_ctx_C_SHM_COMP);
2036
+ #if !CYTHON_ASSUME_SAFE_MACROS
2037
+ if (unlikely(!__pyx_export_signature)) __PYX_ERR(0, 1, __pyx_L1_error)
2038
+ #endif
2039
+ const char * __pyx_export_name = __pyx_export_signature + 20;
2040
+ void *const __pyx_export_pointers[] = {(void *)&__pyx_v_5cbase_18allocator_protocol_10c_shm_comp_C_SHM_COMP, (void *) NULL};
2041
+ void *const *__pyx_export_pointer = __pyx_export_pointers;
2042
+ const char *__pyx_export_current_signature = __pyx_export_signature;
2043
+ while (*__pyx_export_pointer) {
2044
+ if (__Pyx_ExportVoidPtr(__pyx_t_1, __pyx_export_name, *__pyx_export_pointer, __pyx_export_current_signature) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
2045
+ ++__pyx_export_pointer;
2046
+ __pyx_export_name = strchr(__pyx_export_name, '\0') + 1;
2047
+ __pyx_export_signature = strchr(__pyx_export_signature, '\0') + 1;
2048
+ if (*__pyx_export_signature != '\0') __pyx_export_current_signature = __pyx_export_signature;
2049
+ }
2050
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2051
+ }
2052
+ __Pyx_RefNannyFinishContext();
2053
+ return 0;
2054
+ __pyx_L1_error:;
2055
+ __Pyx_XDECREF(__pyx_t_1);
2056
+ __Pyx_RefNannyFinishContext();
2057
+ return -1;
2058
+ }
2059
+
2060
+ static int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate) {
2061
+ __Pyx_RefNannyDeclarations
2062
+ CYTHON_UNUSED_VAR(__pyx_mstate);
2063
+ __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
2064
+ /*--- Function export code ---*/
2065
+ __Pyx_RefNannyFinishContext();
2066
+ return 0;
2067
+ }
2068
+
2069
+ static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) {
2070
+ __Pyx_RefNannyDeclarations
2071
+ CYTHON_UNUSED_VAR(__pyx_mstate);
2072
+ __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
2073
+ /*--- Type init code ---*/
2074
+ __Pyx_RefNannyFinishContext();
2075
+ return 0;
2076
+ }
2077
+
2078
+ static int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate) {
2079
+ __Pyx_RefNannyDeclarations
2080
+ CYTHON_UNUSED_VAR(__pyx_mstate);
2081
+ __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
2082
+ /*--- Type import code ---*/
2083
+ __Pyx_RefNannyFinishContext();
2084
+ return 0;
2085
+ }
2086
+
2087
+ static int __Pyx_modinit_variable_import_code(__pyx_mstatetype *__pyx_mstate) {
2088
+ __Pyx_RefNannyDeclarations
2089
+ CYTHON_UNUSED_VAR(__pyx_mstate);
2090
+ __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
2091
+ /*--- Variable import code ---*/
2092
+ __Pyx_RefNannyFinishContext();
2093
+ return 0;
2094
+ }
2095
+
2096
+ static int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate) {
2097
+ __Pyx_RefNannyDeclarations
2098
+ CYTHON_UNUSED_VAR(__pyx_mstate);
2099
+ __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
2100
+ /*--- Function import code ---*/
2101
+ __Pyx_RefNannyFinishContext();
2102
+ return 0;
2103
+ }
2104
+
2105
+ #if CYTHON_PEP489_MULTI_PHASE_INIT
2106
+ static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
2107
+ static int __pyx_pymod_exec_c_shm_comp(PyObject* module); /*proto*/
2108
+ static PyModuleDef_Slot __pyx_moduledef_slots[] = {
2109
+ {Py_mod_create, (void*)__pyx_pymod_create},
2110
+ {Py_mod_exec, (void*)__pyx_pymod_exec_c_shm_comp},
2111
+ #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
2112
+ {Py_mod_gil, __Pyx_FREETHREADING_COMPATIBLE},
2113
+ #endif
2114
+ #if PY_VERSION_HEX >= 0x030C0000 && CYTHON_USE_MODULE_STATE
2115
+ {Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED},
2116
+ #endif
2117
+ {0, NULL}
2118
+ };
2119
+ #endif
2120
+
2121
+ #ifdef __cplusplus
2122
+ namespace {
2123
+ struct PyModuleDef __pyx_moduledef =
2124
+ #else
2125
+ static struct PyModuleDef __pyx_moduledef =
2126
+ #endif
2127
+ {
2128
+ PyModuleDef_HEAD_INIT,
2129
+ "c_shm_comp",
2130
+ 0, /* m_doc */
2131
+ #if CYTHON_USE_MODULE_STATE
2132
+ sizeof(__pyx_mstatetype), /* m_size */
2133
+ #else
2134
+ (CYTHON_PEP489_MULTI_PHASE_INIT) ? 0 : -1, /* m_size */
2135
+ #endif
2136
+ __pyx_methods /* m_methods */,
2137
+ #if CYTHON_PEP489_MULTI_PHASE_INIT
2138
+ __pyx_moduledef_slots, /* m_slots */
2139
+ #else
2140
+ NULL, /* m_reload */
2141
+ #endif
2142
+ #if CYTHON_USE_MODULE_STATE
2143
+ __pyx_m_traverse, /* m_traverse */
2144
+ __pyx_m_clear, /* m_clear */
2145
+ NULL /* m_free */
2146
+ #else
2147
+ NULL, /* m_traverse */
2148
+ NULL, /* m_clear */
2149
+ NULL /* m_free */
2150
+ #endif
2151
+ };
2152
+ #ifdef __cplusplus
2153
+ } /* anonymous namespace */
2154
+ #endif
2155
+
2156
+ /* PyModInitFuncType */
2157
+ #ifndef CYTHON_NO_PYINIT_EXPORT
2158
+ #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
2159
+ #else
2160
+ #ifdef __cplusplus
2161
+ #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
2162
+ #else
2163
+ #define __Pyx_PyMODINIT_FUNC PyObject *
2164
+ #endif
2165
+ #endif
2166
+
2167
+ __Pyx_PyMODINIT_FUNC PyInit_c_shm_comp(void) CYTHON_SMALL_CODE; /*proto*/
2168
+ __Pyx_PyMODINIT_FUNC PyInit_c_shm_comp(void)
2169
+ #if CYTHON_PEP489_MULTI_PHASE_INIT
2170
+ {
2171
+ return PyModuleDef_Init(&__pyx_moduledef);
2172
+ }
2173
+ /* ModuleCreationPEP489 */
2174
+ #if CYTHON_COMPILING_IN_LIMITED_API && (__PYX_LIMITED_VERSION_HEX < 0x03090000\
2175
+ || ((defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) && __PYX_LIMITED_VERSION_HEX < 0x030A0000))
2176
+ static PY_INT64_T __Pyx_GetCurrentInterpreterId(void) {
2177
+ {
2178
+ PyObject *module = PyImport_ImportModule("_interpreters"); // 3.13+ I think
2179
+ if (!module) {
2180
+ PyErr_Clear(); // just try the 3.8-3.12 version
2181
+ module = PyImport_ImportModule("_xxsubinterpreters");
2182
+ if (!module) goto bad;
2183
+ }
2184
+ PyObject *current = PyObject_CallMethod(module, "get_current", NULL);
2185
+ Py_DECREF(module);
2186
+ if (!current) goto bad;
2187
+ if (PyTuple_Check(current)) {
2188
+ PyObject *new_current = PySequence_GetItem(current, 0);
2189
+ Py_DECREF(current);
2190
+ current = new_current;
2191
+ if (!new_current) goto bad;
2192
+ }
2193
+ long long as_c_int = PyLong_AsLongLong(current);
2194
+ Py_DECREF(current);
2195
+ return as_c_int;
2196
+ }
2197
+ bad:
2198
+ PySys_WriteStderr("__Pyx_GetCurrentInterpreterId failed. Try setting the C define CYTHON_PEP489_MULTI_PHASE_INIT=0\n");
2199
+ return -1;
2200
+ }
2201
+ #endif
2202
+ #if !CYTHON_USE_MODULE_STATE
2203
+ static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
2204
+ static PY_INT64_T main_interpreter_id = -1;
2205
+ #if CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000
2206
+ PY_INT64_T current_id = GraalPyInterpreterState_GetIDFromThreadState(PyThreadState_Get());
2207
+ #elif CYTHON_COMPILING_IN_GRAAL
2208
+ PY_INT64_T current_id = PyInterpreterState_GetIDFromThreadState(PyThreadState_Get());
2209
+ #elif CYTHON_COMPILING_IN_LIMITED_API && (__PYX_LIMITED_VERSION_HEX < 0x03090000\
2210
+ || ((defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) && __PYX_LIMITED_VERSION_HEX < 0x030A0000))
2211
+ PY_INT64_T current_id = __Pyx_GetCurrentInterpreterId();
2212
+ #elif CYTHON_COMPILING_IN_LIMITED_API
2213
+ PY_INT64_T current_id = PyInterpreterState_GetID(PyInterpreterState_Get());
2214
+ #else
2215
+ PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
2216
+ #endif
2217
+ if (unlikely(current_id == -1)) {
2218
+ return -1;
2219
+ }
2220
+ if (main_interpreter_id == -1) {
2221
+ main_interpreter_id = current_id;
2222
+ return 0;
2223
+ } else if (unlikely(main_interpreter_id != current_id)) {
2224
+ PyErr_SetString(
2225
+ PyExc_ImportError,
2226
+ "Interpreter change detected - this module can only be loaded into one interpreter per process.");
2227
+ return -1;
2228
+ }
2229
+ return 0;
2230
+ }
2231
+ #endif
2232
+ static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none)
2233
+ {
2234
+ PyObject *value = PyObject_GetAttrString(spec, from_name);
2235
+ int result = 0;
2236
+ if (likely(value)) {
2237
+ if (allow_none || value != Py_None) {
2238
+ result = PyDict_SetItemString(moddict, to_name, value);
2239
+ }
2240
+ Py_DECREF(value);
2241
+ } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
2242
+ PyErr_Clear();
2243
+ } else {
2244
+ result = -1;
2245
+ }
2246
+ return result;
2247
+ }
2248
+ static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) {
2249
+ PyObject *module = NULL, *moddict, *modname;
2250
+ CYTHON_UNUSED_VAR(def);
2251
+ #if !CYTHON_USE_MODULE_STATE
2252
+ if (__Pyx_check_single_interpreter())
2253
+ return NULL;
2254
+ #endif
2255
+ if (__pyx_m)
2256
+ return __Pyx_NewRef(__pyx_m);
2257
+ modname = PyObject_GetAttrString(spec, "name");
2258
+ if (unlikely(!modname)) goto bad;
2259
+ module = PyModule_NewObject(modname);
2260
+ Py_DECREF(modname);
2261
+ if (unlikely(!module)) goto bad;
2262
+ moddict = PyModule_GetDict(module);
2263
+ if (unlikely(!moddict)) goto bad;
2264
+ if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
2265
+ if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
2266
+ if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
2267
+ if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
2268
+ return module;
2269
+ bad:
2270
+ Py_XDECREF(module);
2271
+ return NULL;
2272
+ }
2273
+
2274
+
2275
+ static CYTHON_SMALL_CODE int __pyx_pymod_exec_c_shm_comp(PyObject *__pyx_pyinit_module)
2276
+ #endif
2277
+ {
2278
+ int stringtab_initialized = 0;
2279
+ #if CYTHON_USE_MODULE_STATE
2280
+ int pystate_addmodule_run = 0;
2281
+ #endif
2282
+ __pyx_mstatetype *__pyx_mstate = NULL;
2283
+ PyObject *__pyx_t_1 = NULL;
2284
+ PyObject *__pyx_t_2 = NULL;
2285
+ int __pyx_lineno = 0;
2286
+ const char *__pyx_filename = NULL;
2287
+ int __pyx_clineno = 0;
2288
+ __Pyx_RefNannyDeclarations
2289
+ #if CYTHON_PEP489_MULTI_PHASE_INIT
2290
+ if (__pyx_m) {
2291
+ if (__pyx_m == __pyx_pyinit_module) return 0;
2292
+ PyErr_SetString(PyExc_RuntimeError, "Module 'c_shm_comp' has already been imported. Re-initialisation is not supported.");
2293
+ return -1;
2294
+ }
2295
+ #else
2296
+ if (__pyx_m) return __Pyx_NewRef(__pyx_m);
2297
+ #endif
2298
+ /*--- Module creation code ---*/
2299
+ #if CYTHON_PEP489_MULTI_PHASE_INIT
2300
+ __pyx_t_1 = __pyx_pyinit_module;
2301
+ Py_INCREF(__pyx_t_1);
2302
+ #else
2303
+ __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
2304
+ #endif
2305
+ #if CYTHON_USE_MODULE_STATE
2306
+ {
2307
+ int add_module_result = __Pyx_State_AddModule(__pyx_t_1, &__pyx_moduledef);
2308
+ __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to "c_shm_comp" pseudovariable */
2309
+ if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
2310
+ pystate_addmodule_run = 1;
2311
+ }
2312
+ #else
2313
+ __pyx_m = __pyx_t_1;
2314
+ #endif
2315
+ #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
2316
+ PyUnstable_Module_SetGIL(__pyx_m, Py_MOD_GIL_USED);
2317
+ #endif
2318
+ __pyx_mstate = __pyx_mstate_global;
2319
+ CYTHON_UNUSED_VAR(__pyx_t_1);
2320
+ __pyx_mstate->__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_mstate->__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
2321
+ Py_INCREF(__pyx_mstate->__pyx_d);
2322
+ __pyx_mstate->__pyx_b = __Pyx_PyImport_AddModuleRef(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_mstate->__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
2323
+ __pyx_mstate->__pyx_cython_runtime = __Pyx_PyImport_AddModuleRef("cython_runtime"); if (unlikely(!__pyx_mstate->__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
2324
+ if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_mstate->__pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2325
+ /* ImportRefnannyAPI */
2326
+ #if CYTHON_REFNANNY
2327
+ __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
2328
+ if (!__Pyx_RefNanny) {
2329
+ PyErr_Clear();
2330
+ __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
2331
+ if (!__Pyx_RefNanny)
2332
+ Py_FatalError("failed to import 'refnanny' module");
2333
+ }
2334
+ #endif
2335
+
2336
+ __Pyx_RefNannySetupContext("PyInit_c_shm_comp", 0);
2337
+ __Pyx_init_runtime_version();
2338
+ if (__Pyx_check_binary_version(__PYX_LIMITED_VERSION_HEX, __Pyx_get_runtime_version(), CYTHON_COMPILING_IN_LIMITED_API) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
2339
+ __pyx_mstate->__pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_mstate->__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
2340
+ __pyx_mstate->__pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
2341
+ __pyx_mstate->__pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
2342
+ /*--- Library function declarations ---*/
2343
+ /*--- Initialize various global constants etc. ---*/
2344
+ if (__Pyx_InitConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
2345
+ stringtab_initialized = 1;
2346
+ if (__Pyx_InitGlobals() < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
2347
+ if (__pyx_module_is_main_cbase__allocator_protocol__c_shm_comp) {
2348
+ if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_name, __pyx_mstate_global->__pyx_n_u_main) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
2349
+ }
2350
+ {
2351
+ PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
2352
+ if (!PyDict_GetItemString(modules, "cbase.allocator_protocol.c_shm_comp")) {
2353
+ if (unlikely((PyDict_SetItemString(modules, "cbase.allocator_protocol.c_shm_comp", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
2354
+ }
2355
+ }
2356
+ /*--- Builtin init code ---*/
2357
+ if (__Pyx_InitCachedBuiltins(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
2358
+ /*--- Constants init code ---*/
2359
+ if (__Pyx_InitCachedConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
2360
+ if (__Pyx_CreateCodeObjects(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
2361
+ /*--- Global type/function init code ---*/
2362
+ (void)__Pyx_modinit_global_init_code(__pyx_mstate);
2363
+ if (unlikely((__Pyx_modinit_variable_export_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
2364
+ (void)__Pyx_modinit_function_export_code(__pyx_mstate);
2365
+ (void)__Pyx_modinit_type_init_code(__pyx_mstate);
2366
+ (void)__Pyx_modinit_type_import_code(__pyx_mstate);
2367
+ (void)__Pyx_modinit_variable_import_code(__pyx_mstate);
2368
+ (void)__Pyx_modinit_function_import_code(__pyx_mstate);
2369
+ /*--- Execution code ---*/
2370
+
2371
+ /* "cbase/allocator_protocol/c_shm_comp.pyx":1
2372
+ * cdef shm_allocator_ctx* C_SHM_COMP = c_shm_allocator_new(AP_SHM_ALLOCATOR_DEFAULT_REGION_SIZE, AP_SHM_ALLOCATOR_PREFIX) # <<<<<<<<<<<<<<
2373
+ */
2374
+ __pyx_v_5cbase_18allocator_protocol_10c_shm_comp_C_SHM_COMP = c_shm_allocator_new(AP_SHM_ALLOCATOR_DEFAULT_REGION_SIZE, AP_SHM_ALLOCATOR_PREFIX);
2375
+ __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error)
2376
+ __Pyx_GOTREF(__pyx_t_2);
2377
+ if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_test, __pyx_t_2) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
2378
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2379
+
2380
+ /*--- Wrapped vars code ---*/
2381
+
2382
+ goto __pyx_L0;
2383
+ __pyx_L1_error:;
2384
+ __Pyx_XDECREF(__pyx_t_2);
2385
+ if (__pyx_m) {
2386
+ if (__pyx_mstate->__pyx_d && stringtab_initialized) {
2387
+ __Pyx_AddTraceback("init cbase.allocator_protocol.c_shm_comp", __pyx_clineno, __pyx_lineno, __pyx_filename);
2388
+ }
2389
+ #if !CYTHON_USE_MODULE_STATE
2390
+ Py_CLEAR(__pyx_m);
2391
+ #else
2392
+ Py_DECREF(__pyx_m);
2393
+ if (pystate_addmodule_run) {
2394
+ PyObject *tp, *value, *tb;
2395
+ PyErr_Fetch(&tp, &value, &tb);
2396
+ PyState_RemoveModule(&__pyx_moduledef);
2397
+ PyErr_Restore(tp, value, tb);
2398
+ }
2399
+ #endif
2400
+ } else if (!PyErr_Occurred()) {
2401
+ PyErr_SetString(PyExc_ImportError, "init cbase.allocator_protocol.c_shm_comp");
2402
+ }
2403
+ __pyx_L0:;
2404
+ __Pyx_RefNannyFinishContext();
2405
+ #if CYTHON_PEP489_MULTI_PHASE_INIT
2406
+ return (__pyx_m != NULL) ? 0 : -1;
2407
+ #else
2408
+ return __pyx_m;
2409
+ #endif
2410
+ }
2411
+ /* #### Code section: pystring_table ### */
2412
+ /* #### Code section: cached_builtins ### */
2413
+
2414
+ static int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate) {
2415
+ CYTHON_UNUSED_VAR(__pyx_mstate);
2416
+ return 0;
2417
+ }
2418
+ /* #### Code section: cached_constants ### */
2419
+
2420
+ static int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate) {
2421
+ __Pyx_RefNannyDeclarations
2422
+ CYTHON_UNUSED_VAR(__pyx_mstate);
2423
+ __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
2424
+ __Pyx_RefNannyFinishContext();
2425
+ return 0;
2426
+ }
2427
+ /* #### Code section: init_constants ### */
2428
+
2429
+ static int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate) {
2430
+ CYTHON_UNUSED_VAR(__pyx_mstate);
2431
+ {
2432
+ const struct { const unsigned int length: 5; } index[] = {{1},{18},{8},{10},{8},{12},{12},{10},{8},{30}};
2433
+ #if (CYTHON_COMPRESS_STRINGS) == 3 && __PYX_LIMITED_VERSION_HEX >= 0x030e0000 /* compression: zstd (101 bytes) */
2434
+ const char* const cstring = "(\265/\375 u\345\002\000\242F\024\026\220Mc@\013 d\357m\276\251D\226\246!h\260.k\314\270\223\210q\020\033E2\001\010\001\265y\364\026\3631\206\267F\372\225t\177\331\204\214.\253\022\303\t\372_\017\346T\3654t\377\312\246\345\265\177\267\260\275\223\250hb\264\273\265\272\305r\010\002\000v\316\322\353\226\001";
2435
+ PyObject *data = __Pyx_DecompressString(cstring, 101, 3);
2436
+ if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error)
2437
+ const char* const bytes = __Pyx_PyBytes_AsString(data);
2438
+ #if !CYTHON_ASSUME_SAFE_MACROS
2439
+ if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) }
2440
+ #endif
2441
+ #elif (CYTHON_COMPRESS_STRINGS) != 0 /* compression: zlib (104 bytes) */
2442
+ const char* const cstring = "x\332%\210A\016\2030\020\003\373\024\316\375D\017\\zAT\352\003,wY\324\250\233\004\310F\242\277'\264>\214\307\276\211\205\244\010\t\276Q\364E\371\000\221m\267\304<U\323\323\022\343\257\227\357\016\341\022N_+\355\377\027\365IgVs\300\2654\226w\004\315\262\320\363\006\361\275\273^z<\357\003\372qx\034\265/-N";
2443
+ PyObject *data = __Pyx_DecompressString(cstring, 104, 1);
2444
+ if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error)
2445
+ const char* const bytes = __Pyx_PyBytes_AsString(data);
2446
+ #if !CYTHON_ASSUME_SAFE_MACROS
2447
+ if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) }
2448
+ #endif
2449
+ #else /* compression: none (117 bytes) */
2450
+ const char* const bytes = "?cline_in_traceback__main____module____name____pyx_capi____qualname__setdefault__test__shm_allocator_ctx *\000C_SHM_COMP";
2451
+ PyObject *data = NULL;
2452
+ CYTHON_UNUSED_VAR(__Pyx_DecompressString);
2453
+ #endif
2454
+ PyObject **stringtab = __pyx_mstate->__pyx_string_tab;
2455
+ Py_ssize_t pos = 0;
2456
+ for (int i = 0; i < 9; i++) {
2457
+ Py_ssize_t bytes_length = index[i].length;
2458
+ PyObject *string = PyUnicode_DecodeUTF8(bytes + pos, bytes_length, NULL);
2459
+ if (likely(string) && i >= 1) PyUnicode_InternInPlace(&string);
2460
+ if (unlikely(!string)) {
2461
+ Py_XDECREF(data);
2462
+ __PYX_ERR(0, 1, __pyx_L1_error)
2463
+ }
2464
+ stringtab[i] = string;
2465
+ pos += bytes_length;
2466
+ }
2467
+ for (int i = 9; i < 10; i++) {
2468
+ Py_ssize_t bytes_length = index[i].length;
2469
+ PyObject *string = PyBytes_FromStringAndSize(bytes + pos, bytes_length);
2470
+ stringtab[i] = string;
2471
+ pos += bytes_length;
2472
+ if (unlikely(!string)) {
2473
+ Py_XDECREF(data);
2474
+ __PYX_ERR(0, 1, __pyx_L1_error)
2475
+ }
2476
+ }
2477
+ Py_XDECREF(data);
2478
+ for (Py_ssize_t i = 0; i < 10; i++) {
2479
+ if (unlikely(PyObject_Hash(stringtab[i]) == -1)) {
2480
+ __PYX_ERR(0, 1, __pyx_L1_error)
2481
+ }
2482
+ }
2483
+ #if CYTHON_IMMORTAL_CONSTANTS
2484
+ {
2485
+ PyObject **table = stringtab + 9;
2486
+ for (Py_ssize_t i=0; i<1; ++i) {
2487
+ #if PY_VERSION_HEX >= 0x030F0000
2488
+ PyUnstable_SetImmortal(table[i]);
2489
+ #elif CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
2490
+ if ((PY_SSIZE_T_MAX <= _Py_IMMORTAL_REFCNT_LOCAL)) break;
2491
+ #if PY_VERSION_HEX < 0x030E0000
2492
+ if (_Py_IsOwnedByCurrentThread(table[i]) && Py_REFCNT(table[i]) == 1)
2493
+ #else
2494
+ if (PyUnstable_Object_IsUniquelyReferenced(table[i]))
2495
+ #endif
2496
+ {
2497
+ Py_SET_REFCNT(table[i], ((Py_ssize_t)_Py_IMMORTAL_REFCNT_LOCAL + 1));
2498
+ }
2499
+ #else
2500
+ if ((PY_SSIZE_T_MAX < _Py_IMMORTAL_INITIAL_REFCNT)) break;
2501
+ Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT);
2502
+ #endif
2503
+ }
2504
+ }
2505
+ #endif
2506
+ }
2507
+ return 0;
2508
+ __pyx_L1_error:;
2509
+ return -1;
2510
+ }
2511
+ /* #### Code section: init_codeobjects ### */
2512
+
2513
+ static int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate) {
2514
+ CYTHON_UNUSED_VAR(__pyx_mstate);
2515
+ return 0;
2516
+ }
2517
+ /* #### Code section: init_globals ### */
2518
+
2519
+ static int __Pyx_InitGlobals(void) {
2520
+ /* PythonCompatibility.init */
2521
+ if (likely(__Pyx_init_co_variables() == 0)); else
2522
+
2523
+ if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)
2524
+
2525
+ return 0;
2526
+ __pyx_L1_error:;
2527
+ return -1;
2528
+ }
2529
+ /* #### Code section: cleanup_globals ### */
2530
+ /* #### Code section: cleanup_module ### */
2531
+ /* #### Code section: main_method ### */
2532
+ /* #### Code section: utility_code_pragmas ### */
2533
+ #ifdef _MSC_VER
2534
+ #pragma warning( push )
2535
+ /* Warning 4127: conditional expression is constant
2536
+ * Cython uses constant conditional expressions to allow in inline functions to be optimized at
2537
+ * compile-time, so this warning is not useful
2538
+ */
2539
+ #pragma warning( disable : 4127 )
2540
+ #endif
2541
+
2542
+
2543
+
2544
+ /* #### Code section: utility_code_def ### */
2545
+
2546
+ /* --- Runtime support code --- */
2547
+ /* Refnanny */
2548
+ #if CYTHON_REFNANNY
2549
+ static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
2550
+ PyObject *m = NULL, *p = NULL;
2551
+ void *r = NULL;
2552
+ m = PyImport_ImportModule(modname);
2553
+ if (!m) goto end;
2554
+ p = PyObject_GetAttrString(m, "RefNannyAPI");
2555
+ if (!p) goto end;
2556
+ r = PyLong_AsVoidPtr(p);
2557
+ end:
2558
+ Py_XDECREF(p);
2559
+ Py_XDECREF(m);
2560
+ return (__Pyx_RefNannyAPIStruct *)r;
2561
+ }
2562
+ #endif
2563
+
2564
+ /* VoidPtrExport */
2565
+ static int __Pyx_ExportVoidPtr(PyObject *api_dict, const char *name, void *p, const char *sig) {
2566
+ PyObject *cobj;
2567
+ cobj = PyCapsule_New(p, sig, 0);
2568
+ if (!cobj)
2569
+ goto bad;
2570
+ if (PyDict_SetItemString(api_dict, name, cobj) < 0)
2571
+ goto bad;
2572
+ Py_DECREF(cobj);
2573
+ return 0;
2574
+ bad:
2575
+ Py_XDECREF(cobj);
2576
+ return -1;
2577
+ }
2578
+
2579
+ /* GetApiDict */
2580
+ static PyObject *__Pyx_ApiExport_GetApiDict(void) {
2581
+ PyObject *d;
2582
+ if (__Pyx_PyDict_GetItemRef(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_capi, &d) == -1)
2583
+ return NULL;
2584
+ if (!d) {
2585
+ d = PyDict_New();
2586
+ if (!d)
2587
+ goto bad;
2588
+ if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_pyx_capi, d) < 0)
2589
+ goto bad;
2590
+ }
2591
+ return d;
2592
+ bad:
2593
+ Py_XDECREF(d);
2594
+ return NULL;
2595
+ }
2596
+
2597
+ /* dict_setdefault (used by CLineInTraceback) */
2598
+ static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value) {
2599
+ PyObject* value;
2600
+ #if __PYX_LIMITED_VERSION_HEX >= 0x030F0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4)
2601
+ PyDict_SetDefaultRef(d, key, default_value, &value);
2602
+ #elif CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX >= 0x030C0000
2603
+ PyObject *args[] = {d, key, default_value};
2604
+ value = PyObject_VectorcallMethod(__pyx_mstate_global->__pyx_n_u_setdefault, args, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
2605
+ #elif CYTHON_COMPILING_IN_LIMITED_API
2606
+ value = PyObject_CallMethodObjArgs(d, __pyx_mstate_global->__pyx_n_u_setdefault, key, default_value, NULL);
2607
+ #else
2608
+ value = PyDict_SetDefault(d, key, default_value);
2609
+ if (unlikely(!value)) return NULL;
2610
+ Py_INCREF(value);
2611
+ #endif
2612
+ return value;
2613
+ }
2614
+
2615
+ /* PyDictVersioning (used by CLineInTraceback) */
2616
+ #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
2617
+ static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
2618
+ PyObject *dict = Py_TYPE(obj)->tp_dict;
2619
+ return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
2620
+ }
2621
+ static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
2622
+ PyObject **dictptr = NULL;
2623
+ Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
2624
+ if (offset) {
2625
+ #if CYTHON_COMPILING_IN_CPYTHON
2626
+ dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
2627
+ #else
2628
+ dictptr = _PyObject_GetDictPtr(obj);
2629
+ #endif
2630
+ }
2631
+ return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
2632
+ }
2633
+ static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
2634
+ PyObject *dict = Py_TYPE(obj)->tp_dict;
2635
+ if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
2636
+ return 0;
2637
+ return obj_dict_version == __Pyx_get_object_dict_version(obj);
2638
+ }
2639
+ #endif
2640
+
2641
+ /* PyErrExceptionMatches (used by PyObjectGetAttrStrNoError) */
2642
+ #if CYTHON_FAST_THREAD_STATE
2643
+ static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
2644
+ Py_ssize_t i, n;
2645
+ n = PyTuple_GET_SIZE(tuple);
2646
+ for (i=0; i<n; i++) {
2647
+ if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
2648
+ }
2649
+ for (i=0; i<n; i++) {
2650
+ if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
2651
+ }
2652
+ return 0;
2653
+ }
2654
+ static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
2655
+ int result;
2656
+ PyObject *exc_type;
2657
+ #if PY_VERSION_HEX >= 0x030C00A6
2658
+ PyObject *current_exception = tstate->current_exception;
2659
+ if (unlikely(!current_exception)) return 0;
2660
+ exc_type = (PyObject*) Py_TYPE(current_exception);
2661
+ if (exc_type == err) return 1;
2662
+ #else
2663
+ exc_type = tstate->curexc_type;
2664
+ if (exc_type == err) return 1;
2665
+ if (unlikely(!exc_type)) return 0;
2666
+ #endif
2667
+ #if CYTHON_AVOID_BORROWED_REFS
2668
+ Py_INCREF(exc_type);
2669
+ #endif
2670
+ if (unlikely(PyTuple_Check(err))) {
2671
+ result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
2672
+ } else {
2673
+ result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
2674
+ }
2675
+ #if CYTHON_AVOID_BORROWED_REFS
2676
+ Py_DECREF(exc_type);
2677
+ #endif
2678
+ return result;
2679
+ }
2680
+ #endif
2681
+
2682
+ /* PyErrFetchRestore (used by PyObjectGetAttrStrNoError) */
2683
+ #if CYTHON_FAST_THREAD_STATE
2684
+ static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
2685
+ #if PY_VERSION_HEX >= 0x030C00A6
2686
+ PyObject *tmp_value;
2687
+ assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value)));
2688
+ if (value) {
2689
+ #if CYTHON_COMPILING_IN_CPYTHON
2690
+ if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb))
2691
+ #endif
2692
+ PyException_SetTraceback(value, tb);
2693
+ }
2694
+ tmp_value = tstate->current_exception;
2695
+ tstate->current_exception = value;
2696
+ Py_XDECREF(tmp_value);
2697
+ Py_XDECREF(type);
2698
+ Py_XDECREF(tb);
2699
+ #else
2700
+ PyObject *tmp_type, *tmp_value, *tmp_tb;
2701
+ tmp_type = tstate->curexc_type;
2702
+ tmp_value = tstate->curexc_value;
2703
+ tmp_tb = tstate->curexc_traceback;
2704
+ tstate->curexc_type = type;
2705
+ tstate->curexc_value = value;
2706
+ tstate->curexc_traceback = tb;
2707
+ Py_XDECREF(tmp_type);
2708
+ Py_XDECREF(tmp_value);
2709
+ Py_XDECREF(tmp_tb);
2710
+ #endif
2711
+ }
2712
+ static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
2713
+ #if PY_VERSION_HEX >= 0x030C00A6
2714
+ PyObject* exc_value;
2715
+ exc_value = tstate->current_exception;
2716
+ tstate->current_exception = 0;
2717
+ *value = exc_value;
2718
+ *type = NULL;
2719
+ *tb = NULL;
2720
+ if (exc_value) {
2721
+ *type = (PyObject*) Py_TYPE(exc_value);
2722
+ Py_INCREF(*type);
2723
+ #if CYTHON_COMPILING_IN_CPYTHON
2724
+ *tb = ((PyBaseExceptionObject*) exc_value)->traceback;
2725
+ Py_XINCREF(*tb);
2726
+ #else
2727
+ *tb = PyException_GetTraceback(exc_value);
2728
+ #endif
2729
+ }
2730
+ #else
2731
+ *type = tstate->curexc_type;
2732
+ *value = tstate->curexc_value;
2733
+ *tb = tstate->curexc_traceback;
2734
+ tstate->curexc_type = 0;
2735
+ tstate->curexc_value = 0;
2736
+ tstate->curexc_traceback = 0;
2737
+ #endif
2738
+ }
2739
+ #endif
2740
+
2741
+ /* PyObjectGetAttrStr (used by PyObjectGetAttrStrNoError) */
2742
+ #if CYTHON_USE_TYPE_SLOTS
2743
+ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
2744
+ PyTypeObject* tp = Py_TYPE(obj);
2745
+ if (likely(tp->tp_getattro))
2746
+ return tp->tp_getattro(obj, attr_name);
2747
+ return PyObject_GetAttr(obj, attr_name);
2748
+ }
2749
+ #endif
2750
+
2751
+ /* PyObjectGetAttrStrNoError (used by CLineInTraceback) */
2752
+ #if __PYX_LIMITED_VERSION_HEX < 0x030d0000
2753
+ static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
2754
+ __Pyx_PyThreadState_declare
2755
+ __Pyx_PyThreadState_assign
2756
+ if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
2757
+ __Pyx_PyErr_Clear();
2758
+ }
2759
+ #endif
2760
+ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
2761
+ PyObject *result;
2762
+ #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
2763
+ (void) PyObject_GetOptionalAttr(obj, attr_name, &result);
2764
+ return result;
2765
+ #else
2766
+ #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS
2767
+ PyTypeObject* tp = Py_TYPE(obj);
2768
+ if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
2769
+ return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
2770
+ }
2771
+ #endif
2772
+ result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
2773
+ if (unlikely(!result)) {
2774
+ __Pyx_PyObject_GetAttrStr_ClearAttributeError();
2775
+ }
2776
+ return result;
2777
+ #endif
2778
+ }
2779
+
2780
+ /* CLineInTraceback (used by AddTraceback) */
2781
+ #if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME
2782
+ #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
2783
+ #define __Pyx_PyProbablyModule_GetDict(o) __Pyx_XNewRef(PyModule_GetDict(o))
2784
+ #elif !CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
2785
+ #define __Pyx_PyProbablyModule_GetDict(o) PyObject_GenericGetDict(o, NULL);
2786
+ #else
2787
+ PyObject* __Pyx_PyProbablyModule_GetDict(PyObject *o) {
2788
+ PyObject **dict_ptr = _PyObject_GetDictPtr(o);
2789
+ return dict_ptr ? __Pyx_XNewRef(*dict_ptr) : NULL;
2790
+ }
2791
+ #endif
2792
+ static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) {
2793
+ PyObject *use_cline = NULL;
2794
+ PyObject *ptype, *pvalue, *ptraceback;
2795
+ PyObject *cython_runtime_dict;
2796
+ CYTHON_MAYBE_UNUSED_VAR(tstate);
2797
+ if (unlikely(!__pyx_mstate_global->__pyx_cython_runtime)) {
2798
+ return c_line;
2799
+ }
2800
+ __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
2801
+ cython_runtime_dict = __Pyx_PyProbablyModule_GetDict(__pyx_mstate_global->__pyx_cython_runtime);
2802
+ if (likely(cython_runtime_dict)) {
2803
+ __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
2804
+ use_cline, cython_runtime_dict,
2805
+ __Pyx_PyDict_SetDefault(cython_runtime_dict, __pyx_mstate_global->__pyx_n_u_cline_in_traceback, Py_False))
2806
+ }
2807
+ if (use_cline == NULL || use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
2808
+ c_line = 0;
2809
+ }
2810
+ Py_XDECREF(use_cline);
2811
+ Py_XDECREF(cython_runtime_dict);
2812
+ __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
2813
+ return c_line;
2814
+ }
2815
+ #endif
2816
+
2817
+ /* CodeObjectCache (used by AddTraceback) */
2818
+ static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
2819
+ int start = 0, mid = 0, end = count - 1;
2820
+ if (end >= 0 && code_line > entries[end].code_line) {
2821
+ return count;
2822
+ }
2823
+ while (start < end) {
2824
+ mid = start + (end - start) / 2;
2825
+ if (code_line < entries[mid].code_line) {
2826
+ end = mid;
2827
+ } else if (code_line > entries[mid].code_line) {
2828
+ start = mid + 1;
2829
+ } else {
2830
+ return mid;
2831
+ }
2832
+ }
2833
+ if (code_line <= entries[mid].code_line) {
2834
+ return mid;
2835
+ } else {
2836
+ return mid + 1;
2837
+ }
2838
+ }
2839
+ static __Pyx_CachedCodeObjectType *__pyx__find_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line) {
2840
+ __Pyx_CachedCodeObjectType* code_object;
2841
+ int pos;
2842
+ if (unlikely(!code_line) || unlikely(!code_cache->entries)) {
2843
+ return NULL;
2844
+ }
2845
+ pos = __pyx_bisect_code_objects(code_cache->entries, code_cache->count, code_line);
2846
+ if (unlikely(pos >= code_cache->count) || unlikely(code_cache->entries[pos].code_line != code_line)) {
2847
+ return NULL;
2848
+ }
2849
+ code_object = code_cache->entries[pos].code_object;
2850
+ Py_INCREF(code_object);
2851
+ return code_object;
2852
+ }
2853
+ static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line) {
2854
+ #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS
2855
+ (void)__pyx__find_code_object;
2856
+ return NULL; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just miss.
2857
+ #else
2858
+ struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache;
2859
+ #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
2860
+ __pyx_nonatomic_int_type old_count = __pyx_atomic_incr_acq_rel(&code_cache->accessor_count);
2861
+ if (old_count < 0) {
2862
+ __pyx_atomic_decr_acq_rel(&code_cache->accessor_count);
2863
+ return NULL;
2864
+ }
2865
+ #endif
2866
+ __Pyx_CachedCodeObjectType *result = __pyx__find_code_object(code_cache, code_line);
2867
+ #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
2868
+ __pyx_atomic_decr_acq_rel(&code_cache->accessor_count);
2869
+ #endif
2870
+ return result;
2871
+ #endif
2872
+ }
2873
+ static void __pyx__insert_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line, __Pyx_CachedCodeObjectType* code_object)
2874
+ {
2875
+ int pos, i;
2876
+ __Pyx_CodeObjectCacheEntry* entries = code_cache->entries;
2877
+ if (unlikely(!code_line)) {
2878
+ return;
2879
+ }
2880
+ if (unlikely(!entries)) {
2881
+ entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
2882
+ if (likely(entries)) {
2883
+ code_cache->entries = entries;
2884
+ code_cache->max_count = 64;
2885
+ code_cache->count = 1;
2886
+ entries[0].code_line = code_line;
2887
+ entries[0].code_object = code_object;
2888
+ Py_INCREF(code_object);
2889
+ }
2890
+ return;
2891
+ }
2892
+ pos = __pyx_bisect_code_objects(code_cache->entries, code_cache->count, code_line);
2893
+ if ((pos < code_cache->count) && unlikely(code_cache->entries[pos].code_line == code_line)) {
2894
+ __Pyx_CachedCodeObjectType* tmp = entries[pos].code_object;
2895
+ entries[pos].code_object = code_object;
2896
+ Py_INCREF(code_object);
2897
+ Py_DECREF(tmp);
2898
+ return;
2899
+ }
2900
+ if (code_cache->count == code_cache->max_count) {
2901
+ int new_max = code_cache->max_count + 64;
2902
+ entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
2903
+ code_cache->entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
2904
+ if (unlikely(!entries)) {
2905
+ return;
2906
+ }
2907
+ code_cache->entries = entries;
2908
+ code_cache->max_count = new_max;
2909
+ }
2910
+ for (i=code_cache->count; i>pos; i--) {
2911
+ entries[i] = entries[i-1];
2912
+ }
2913
+ entries[pos].code_line = code_line;
2914
+ entries[pos].code_object = code_object;
2915
+ code_cache->count++;
2916
+ Py_INCREF(code_object);
2917
+ }
2918
+ static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object) {
2919
+ #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS
2920
+ (void)__pyx__insert_code_object;
2921
+ return; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just fail.
2922
+ #else
2923
+ struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache;
2924
+ #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
2925
+ __pyx_nonatomic_int_type expected = 0;
2926
+ if (!__pyx_atomic_int_cmp_exchange(&code_cache->accessor_count, &expected, INT_MIN)) {
2927
+ return;
2928
+ }
2929
+ #endif
2930
+ __pyx__insert_code_object(code_cache, code_line, code_object);
2931
+ #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
2932
+ __pyx_atomic_sub(&code_cache->accessor_count, INT_MIN);
2933
+ #endif
2934
+ #endif
2935
+ }
2936
+
2937
+ /* AddTraceback */
2938
+ #include "compile.h"
2939
+ #include "frameobject.h"
2940
+ #include "traceback.h"
2941
+ #if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION)
2942
+ #ifndef Py_BUILD_CORE
2943
+ #define Py_BUILD_CORE 1
2944
+ #endif
2945
+ #include "internal/pycore_frame.h"
2946
+ #endif
2947
+ #if CYTHON_COMPILING_IN_LIMITED_API
2948
+ static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict,
2949
+ PyObject *firstlineno, PyObject *name) {
2950
+ PyObject *replace = NULL;
2951
+ if (unlikely(PyDict_SetItemString(scratch_dict, "co_firstlineno", firstlineno))) return NULL;
2952
+ if (unlikely(PyDict_SetItemString(scratch_dict, "co_name", name))) return NULL;
2953
+ replace = PyObject_GetAttrString(code, "replace");
2954
+ if (likely(replace)) {
2955
+ PyObject *result = PyObject_Call(replace, __pyx_mstate_global->__pyx_empty_tuple, scratch_dict);
2956
+ Py_DECREF(replace);
2957
+ return result;
2958
+ }
2959
+ PyErr_Clear();
2960
+ return NULL;
2961
+ }
2962
+ static void __Pyx_AddTraceback(const char *funcname, int c_line,
2963
+ int py_line, const char *filename) {
2964
+ PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL;
2965
+ PyObject *replace = NULL, *getframe = NULL, *frame = NULL;
2966
+ PyObject *exc_type, *exc_value, *exc_traceback;
2967
+ int success = 0;
2968
+ if (c_line) {
2969
+ c_line = __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line);
2970
+ }
2971
+ PyErr_Fetch(&exc_type, &exc_value, &exc_traceback);
2972
+ code_object = __pyx_find_code_object(c_line ? -c_line : py_line);
2973
+ if (!code_object) {
2974
+ code_object = Py_CompileString("_getframe()", filename, Py_eval_input);
2975
+ if (unlikely(!code_object)) goto bad;
2976
+ py_py_line = PyLong_FromLong(py_line);
2977
+ if (unlikely(!py_py_line)) goto bad;
2978
+ if (c_line) {
2979
+ py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
2980
+ } else {
2981
+ py_funcname = PyUnicode_FromString(funcname);
2982
+ }
2983
+ if (unlikely(!py_funcname)) goto bad;
2984
+ dict = PyDict_New();
2985
+ if (unlikely(!dict)) goto bad;
2986
+ {
2987
+ PyObject *old_code_object = code_object;
2988
+ code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname);
2989
+ Py_DECREF(old_code_object);
2990
+ }
2991
+ if (unlikely(!code_object)) goto bad;
2992
+ __pyx_insert_code_object(c_line ? -c_line : py_line, code_object);
2993
+ } else {
2994
+ dict = PyDict_New();
2995
+ }
2996
+ getframe = PySys_GetObject("_getframe");
2997
+ if (unlikely(!getframe)) goto bad;
2998
+ if (unlikely(PyDict_SetItemString(dict, "_getframe", getframe))) goto bad;
2999
+ frame = PyEval_EvalCode(code_object, dict, dict);
3000
+ if (unlikely(!frame) || frame == Py_None) goto bad;
3001
+ success = 1;
3002
+ bad:
3003
+ PyErr_Restore(exc_type, exc_value, exc_traceback);
3004
+ Py_XDECREF(code_object);
3005
+ Py_XDECREF(py_py_line);
3006
+ Py_XDECREF(py_funcname);
3007
+ Py_XDECREF(dict);
3008
+ Py_XDECREF(replace);
3009
+ if (success) {
3010
+ PyTraceBack_Here(
3011
+ (struct _frame*)frame);
3012
+ }
3013
+ Py_XDECREF(frame);
3014
+ }
3015
+ #else
3016
+ static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
3017
+ const char *funcname, int c_line,
3018
+ int py_line, const char *filename) {
3019
+ PyCodeObject *py_code = NULL;
3020
+ PyObject *py_funcname = NULL;
3021
+ if (c_line) {
3022
+ py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
3023
+ if (!py_funcname) goto bad;
3024
+ funcname = PyUnicode_AsUTF8(py_funcname);
3025
+ if (!funcname) goto bad;
3026
+ }
3027
+ py_code = PyCode_NewEmpty(filename, funcname, py_line);
3028
+ Py_XDECREF(py_funcname);
3029
+ return py_code;
3030
+ bad:
3031
+ Py_XDECREF(py_funcname);
3032
+ return NULL;
3033
+ }
3034
+ static void __Pyx_AddTraceback(const char *funcname, int c_line,
3035
+ int py_line, const char *filename) {
3036
+ PyCodeObject *py_code = 0;
3037
+ PyFrameObject *py_frame = 0;
3038
+ PyThreadState *tstate = __Pyx_PyThreadState_Current;
3039
+ PyObject *ptype, *pvalue, *ptraceback;
3040
+ if (c_line) {
3041
+ c_line = __Pyx_CLineForTraceback(tstate, c_line);
3042
+ }
3043
+ py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
3044
+ if (!py_code) {
3045
+ __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
3046
+ py_code = __Pyx_CreateCodeObjectForTraceback(
3047
+ funcname, c_line, py_line, filename);
3048
+ if (!py_code) {
3049
+ /* If the code object creation fails, then we should clear the
3050
+ fetched exception references and propagate the new exception */
3051
+ Py_XDECREF(ptype);
3052
+ Py_XDECREF(pvalue);
3053
+ Py_XDECREF(ptraceback);
3054
+ goto bad;
3055
+ }
3056
+ __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
3057
+ __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
3058
+ }
3059
+ py_frame = PyFrame_New(
3060
+ tstate, /*PyThreadState *tstate,*/
3061
+ py_code, /*PyCodeObject *code,*/
3062
+ __pyx_mstate_global->__pyx_d, /*PyObject *globals,*/
3063
+ 0 /*PyObject *locals*/
3064
+ );
3065
+ if (!py_frame) goto bad;
3066
+ __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
3067
+ PyTraceBack_Here(py_frame);
3068
+ bad:
3069
+ Py_XDECREF(py_code);
3070
+ Py_XDECREF(py_frame);
3071
+ }
3072
+ #endif
3073
+
3074
+ /* FormatTypeName */
3075
+ #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030d0000
3076
+ static __Pyx_TypeName
3077
+ __Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp)
3078
+ {
3079
+ PyObject *module = NULL, *name = NULL, *result = NULL;
3080
+ #if __PYX_LIMITED_VERSION_HEX < 0x030b0000
3081
+ name = __Pyx_PyObject_GetAttrStr((PyObject *)tp,
3082
+ __pyx_mstate_global->__pyx_n_u_qualname);
3083
+ #else
3084
+ name = PyType_GetQualName(tp);
3085
+ #endif
3086
+ if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) goto bad;
3087
+ module = __Pyx_PyObject_GetAttrStr((PyObject *)tp,
3088
+ __pyx_mstate_global->__pyx_n_u_module);
3089
+ if (unlikely(module == NULL) || unlikely(!PyUnicode_Check(module))) goto bad;
3090
+ if (PyUnicode_CompareWithASCIIString(module, "builtins") == 0) {
3091
+ result = name;
3092
+ name = NULL;
3093
+ goto done;
3094
+ }
3095
+ result = PyUnicode_FromFormat("%U.%U", module, name);
3096
+ if (unlikely(result == NULL)) goto bad;
3097
+ done:
3098
+ Py_XDECREF(name);
3099
+ Py_XDECREF(module);
3100
+ return result;
3101
+ bad:
3102
+ PyErr_Clear();
3103
+ if (name) {
3104
+ result = name;
3105
+ name = NULL;
3106
+ } else {
3107
+ result = __Pyx_NewRef(__pyx_mstate_global->__pyx_kp_u_);
3108
+ }
3109
+ goto done;
3110
+ }
3111
+ #endif
3112
+
3113
+ /* PyObjectCall (used by PyObjectFastCall) */
3114
+ #if CYTHON_COMPILING_IN_CPYTHON
3115
+ static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
3116
+ PyObject *result;
3117
+ ternaryfunc call = Py_TYPE(func)->tp_call;
3118
+ if (unlikely(!call))
3119
+ return PyObject_Call(func, arg, kw);
3120
+ if (unlikely(Py_EnterRecursiveCall(" while calling a Python object")))
3121
+ return NULL;
3122
+ result = (*call)(func, arg, kw);
3123
+ Py_LeaveRecursiveCall();
3124
+ if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
3125
+ PyErr_SetString(
3126
+ PyExc_SystemError,
3127
+ "NULL result without error in PyObject_Call");
3128
+ }
3129
+ return result;
3130
+ }
3131
+ #endif
3132
+
3133
+ /* PyObjectCallMethO (used by PyObjectFastCall) */
3134
+ #if CYTHON_COMPILING_IN_CPYTHON
3135
+ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
3136
+ PyObject *self, *result;
3137
+ PyCFunction cfunc;
3138
+ cfunc = __Pyx_CyOrPyCFunction_GET_FUNCTION(func);
3139
+ self = __Pyx_CyOrPyCFunction_GET_SELF(func);
3140
+ if (unlikely(Py_EnterRecursiveCall(" while calling a Python object")))
3141
+ return NULL;
3142
+ result = cfunc(self, arg);
3143
+ Py_LeaveRecursiveCall();
3144
+ if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
3145
+ PyErr_SetString(
3146
+ PyExc_SystemError,
3147
+ "NULL result without error in PyObject_Call");
3148
+ }
3149
+ return result;
3150
+ }
3151
+ #endif
3152
+
3153
+ /* PyObjectFastCall (used by PyObjectVectorCallKwBuilder) */
3154
+ #if PY_VERSION_HEX < 0x03090000 || CYTHON_COMPILING_IN_LIMITED_API
3155
+ static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs) {
3156
+ PyObject *argstuple;
3157
+ PyObject *result = 0;
3158
+ size_t i;
3159
+ argstuple = PyTuple_New((Py_ssize_t)nargs);
3160
+ if (unlikely(!argstuple)) return NULL;
3161
+ for (i = 0; i < nargs; i++) {
3162
+ Py_INCREF(args[i]);
3163
+ if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) != (0)) goto bad;
3164
+ }
3165
+ result = __Pyx_PyObject_Call(func, argstuple, kwargs);
3166
+ bad:
3167
+ Py_DECREF(argstuple);
3168
+ return result;
3169
+ }
3170
+ #endif
3171
+ #if CYTHON_VECTORCALL && !CYTHON_COMPILING_IN_LIMITED_API
3172
+ #if PY_VERSION_HEX < 0x03090000
3173
+ #define __Pyx_PyVectorcall_Function(callable) _PyVectorcall_Function(callable)
3174
+ #elif CYTHON_COMPILING_IN_CPYTHON
3175
+ static CYTHON_INLINE vectorcallfunc __Pyx_PyVectorcall_Function(PyObject *callable) {
3176
+ PyTypeObject *tp = Py_TYPE(callable);
3177
+ #if defined(__Pyx_CyFunction_USED) && CYTHON_METH_FASTCALL
3178
+ if (__Pyx_CyFunction_CheckExact(callable)) {
3179
+ return __Pyx_CyFunction_func_vectorcall(callable);
3180
+ }
3181
+ #endif
3182
+ if (!PyType_HasFeature(tp, Py_TPFLAGS_HAVE_VECTORCALL)) {
3183
+ return NULL;
3184
+ }
3185
+ assert(PyCallable_Check(callable));
3186
+ Py_ssize_t offset = tp->tp_vectorcall_offset;
3187
+ assert(offset > 0);
3188
+ vectorcallfunc ptr;
3189
+ memcpy(&ptr, (char *) callable + offset, sizeof(ptr));
3190
+ return ptr;
3191
+ }
3192
+ #else
3193
+ #define __Pyx_PyVectorcall_Function(callable) PyVectorcall_Function(callable)
3194
+ #endif
3195
+ #endif
3196
+ static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject *const *args, size_t _nargs, PyObject *kwargs) {
3197
+ Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs);
3198
+ #if CYTHON_COMPILING_IN_CPYTHON
3199
+ if (nargs == 0 && kwargs == NULL) {
3200
+ if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_NOARGS))
3201
+ return __Pyx_PyObject_CallMethO(func, NULL);
3202
+ }
3203
+ else if (nargs == 1 && kwargs == NULL) {
3204
+ if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_O))
3205
+ return __Pyx_PyObject_CallMethO(func, args[0]);
3206
+ }
3207
+ #endif
3208
+ if (kwargs == NULL) {
3209
+ #if CYTHON_VECTORCALL
3210
+ #if CYTHON_COMPILING_IN_LIMITED_API
3211
+ return PyObject_Vectorcall(func, args, _nargs, NULL);
3212
+ #else
3213
+ vectorcallfunc f = __Pyx_PyVectorcall_Function(func);
3214
+ if (f) {
3215
+ return f(func, args, _nargs, NULL);
3216
+ }
3217
+ #endif
3218
+ #endif
3219
+ }
3220
+ if (nargs == 0) {
3221
+ return __Pyx_PyObject_Call(func, __pyx_mstate_global->__pyx_empty_tuple, kwargs);
3222
+ }
3223
+ #if PY_VERSION_HEX >= 0x03090000 && !CYTHON_COMPILING_IN_LIMITED_API
3224
+ return PyObject_VectorcallDict(func, args, (size_t)nargs, kwargs);
3225
+ #else
3226
+ return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs);
3227
+ #endif
3228
+ }
3229
+
3230
+ /* PyObjectVectorCallKwBuilder (used by CIntToPy) */
3231
+ #if CYTHON_VECTORCALL
3232
+ static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) {
3233
+ (void)__Pyx_PyObject_FastCallDict;
3234
+ Py_INCREF(key);
3235
+ if (__Pyx_PyTuple_SET_ITEM(builder, n, key) != (0)) return -1;
3236
+ args[n] = value;
3237
+ return 0;
3238
+ }
3239
+ CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) {
3240
+ (void)__Pyx_VectorcallBuilder_AddArgStr;
3241
+ if (unlikely(!PyUnicode_Check(key))) {
3242
+ PyErr_SetString(PyExc_TypeError, "keywords must be strings");
3243
+ return -1;
3244
+ }
3245
+ return __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n);
3246
+ }
3247
+ static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n) {
3248
+ PyObject *pyKey = PyUnicode_FromString(key);
3249
+ if (!pyKey) return -1;
3250
+ return __Pyx_VectorcallBuilder_AddArg(pyKey, value, builder, args, n);
3251
+ }
3252
+ #else // CYTHON_VECTORCALL
3253
+ CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, CYTHON_UNUSED PyObject **args, CYTHON_UNUSED int n) {
3254
+ if (unlikely(!PyUnicode_Check(key))) {
3255
+ PyErr_SetString(PyExc_TypeError, "keywords must be strings");
3256
+ return -1;
3257
+ }
3258
+ return PyDict_SetItem(builder, key, value);
3259
+ }
3260
+ #endif
3261
+
3262
+ /* CIntToPy */
3263
+ static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value) {
3264
+ #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
3265
+ #pragma GCC diagnostic push
3266
+ #pragma GCC diagnostic ignored "-Wconversion"
3267
+ #endif
3268
+ const long neg_one = (long) -1, const_zero = (long) 0;
3269
+ #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
3270
+ #pragma GCC diagnostic pop
3271
+ #endif
3272
+ const int is_unsigned = neg_one > const_zero;
3273
+ if (is_unsigned) {
3274
+ if (sizeof(long) < sizeof(long)) {
3275
+ return PyLong_FromLong((long) value);
3276
+ } else if (sizeof(long) <= sizeof(unsigned long)) {
3277
+ return PyLong_FromUnsignedLong((unsigned long) value);
3278
+ #if !CYTHON_COMPILING_IN_PYPY
3279
+ } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
3280
+ return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
3281
+ #endif
3282
+ }
3283
+ } else {
3284
+ if (sizeof(long) <= sizeof(long)) {
3285
+ return PyLong_FromLong((long) value);
3286
+ } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
3287
+ return PyLong_FromLongLong((PY_LONG_LONG) value);
3288
+ }
3289
+ }
3290
+ {
3291
+ unsigned char *bytes = (unsigned char *)&value;
3292
+ #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
3293
+ if (is_unsigned) {
3294
+ return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
3295
+ } else {
3296
+ return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
3297
+ }
3298
+ #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
3299
+ int one = 1; int little = (int)*(unsigned char *)&one;
3300
+ return _PyLong_FromByteArray(bytes, sizeof(long),
3301
+ little, !is_unsigned);
3302
+ #else
3303
+ int one = 1; int little = (int)*(unsigned char *)&one;
3304
+ PyObject *from_bytes, *result = NULL, *kwds = NULL;
3305
+ PyObject *py_bytes = NULL, *order_str = NULL;
3306
+ from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
3307
+ if (!from_bytes) return NULL;
3308
+ py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long));
3309
+ if (!py_bytes) goto limited_bad;
3310
+ order_str = PyUnicode_FromString(little ? "little" : "big");
3311
+ if (!order_str) goto limited_bad;
3312
+ {
3313
+ PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
3314
+ if (!is_unsigned) {
3315
+ kwds = __Pyx_MakeVectorcallBuilderKwds(1);
3316
+ if (!kwds) goto limited_bad;
3317
+ if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
3318
+ }
3319
+ result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
3320
+ }
3321
+ limited_bad:
3322
+ Py_XDECREF(kwds);
3323
+ Py_XDECREF(order_str);
3324
+ Py_XDECREF(py_bytes);
3325
+ Py_XDECREF(from_bytes);
3326
+ return result;
3327
+ #endif
3328
+ }
3329
+ }
3330
+
3331
+ /* CIntFromPyVerify (used by CIntFromPy) */
3332
+ #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
3333
+ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
3334
+ #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
3335
+ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
3336
+ #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
3337
+ {\
3338
+ func_type value = func_value;\
3339
+ if (sizeof(target_type) < sizeof(func_type)) {\
3340
+ if (unlikely(value != (func_type) (target_type) value)) {\
3341
+ func_type zero = 0;\
3342
+ if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
3343
+ return (target_type) -1;\
3344
+ if (is_unsigned && unlikely(value < zero))\
3345
+ goto raise_neg_overflow;\
3346
+ else\
3347
+ goto raise_overflow;\
3348
+ }\
3349
+ }\
3350
+ return (target_type) value;\
3351
+ }
3352
+
3353
+ /* CIntFromPy */
3354
+ static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *x) {
3355
+ #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
3356
+ #pragma GCC diagnostic push
3357
+ #pragma GCC diagnostic ignored "-Wconversion"
3358
+ #endif
3359
+ const long neg_one = (long) -1, const_zero = (long) 0;
3360
+ #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
3361
+ #pragma GCC diagnostic pop
3362
+ #endif
3363
+ const int is_unsigned = neg_one > const_zero;
3364
+ if (unlikely(!PyLong_Check(x))) {
3365
+ long val;
3366
+ PyObject *tmp = __Pyx_PyNumber_Long(x);
3367
+ if (!tmp) return (long) -1;
3368
+ val = __Pyx_PyLong_As_long(tmp);
3369
+ Py_DECREF(tmp);
3370
+ return val;
3371
+ }
3372
+ if (is_unsigned) {
3373
+ #if CYTHON_USE_PYLONG_INTERNALS
3374
+ if (unlikely(__Pyx_PyLong_IsNeg(x))) {
3375
+ goto raise_neg_overflow;
3376
+ } else if (__Pyx_PyLong_IsCompact(x)) {
3377
+ __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
3378
+ } else {
3379
+ const digit* digits = __Pyx_PyLong_Digits(x);
3380
+ assert(__Pyx_PyLong_DigitCount(x) > 1);
3381
+ switch (__Pyx_PyLong_DigitCount(x)) {
3382
+ case 2:
3383
+ if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
3384
+ if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
3385
+ __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3386
+ } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) {
3387
+ return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
3388
+ }
3389
+ }
3390
+ break;
3391
+ case 3:
3392
+ if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
3393
+ if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
3394
+ __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3395
+ } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) {
3396
+ return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
3397
+ }
3398
+ }
3399
+ break;
3400
+ case 4:
3401
+ if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
3402
+ if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
3403
+ __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3404
+ } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) {
3405
+ return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
3406
+ }
3407
+ }
3408
+ break;
3409
+ }
3410
+ }
3411
+ #endif
3412
+ #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
3413
+ if (unlikely(Py_SIZE(x) < 0)) {
3414
+ goto raise_neg_overflow;
3415
+ }
3416
+ #else
3417
+ {
3418
+ int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
3419
+ if (unlikely(result < 0))
3420
+ return (long) -1;
3421
+ if (unlikely(result == 1))
3422
+ goto raise_neg_overflow;
3423
+ }
3424
+ #endif
3425
+ if ((sizeof(long) <= sizeof(unsigned long))) {
3426
+ __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
3427
+ } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) {
3428
+ __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
3429
+ }
3430
+ } else {
3431
+ #if CYTHON_USE_PYLONG_INTERNALS
3432
+ if (__Pyx_PyLong_IsCompact(x)) {
3433
+ __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
3434
+ } else {
3435
+ const digit* digits = __Pyx_PyLong_Digits(x);
3436
+ assert(__Pyx_PyLong_DigitCount(x) > 1);
3437
+ switch (__Pyx_PyLong_SignedDigitCount(x)) {
3438
+ case -2:
3439
+ if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) {
3440
+ if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
3441
+ __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3442
+ } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
3443
+ return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
3444
+ }
3445
+ }
3446
+ break;
3447
+ case 2:
3448
+ if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
3449
+ if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
3450
+ __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3451
+ } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
3452
+ return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
3453
+ }
3454
+ }
3455
+ break;
3456
+ case -3:
3457
+ if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
3458
+ if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
3459
+ __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3460
+ } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
3461
+ return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
3462
+ }
3463
+ }
3464
+ break;
3465
+ case 3:
3466
+ if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
3467
+ if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
3468
+ __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3469
+ } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
3470
+ return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
3471
+ }
3472
+ }
3473
+ break;
3474
+ case -4:
3475
+ if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
3476
+ if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
3477
+ __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3478
+ } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
3479
+ return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
3480
+ }
3481
+ }
3482
+ break;
3483
+ case 4:
3484
+ if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
3485
+ if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
3486
+ __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3487
+ } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
3488
+ return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
3489
+ }
3490
+ }
3491
+ break;
3492
+ }
3493
+ }
3494
+ #endif
3495
+ if ((sizeof(long) <= sizeof(long))) {
3496
+ __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
3497
+ } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) {
3498
+ __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
3499
+ }
3500
+ }
3501
+ {
3502
+ long val;
3503
+ int ret = -1;
3504
+ #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
3505
+ Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
3506
+ x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
3507
+ if (unlikely(bytes_copied == -1)) {
3508
+ } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
3509
+ goto raise_overflow;
3510
+ } else {
3511
+ ret = 0;
3512
+ }
3513
+ #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
3514
+ int one = 1; int is_little = (int)*(unsigned char *)&one;
3515
+ unsigned char *bytes = (unsigned char *)&val;
3516
+ ret = _PyLong_AsByteArray((PyLongObject *)x,
3517
+ bytes, sizeof(val),
3518
+ is_little, !is_unsigned);
3519
+ #else
3520
+ PyObject *v;
3521
+ PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
3522
+ int bits, remaining_bits, is_negative = 0;
3523
+ int chunk_size = (sizeof(long) < 8) ? 30 : 62;
3524
+ if (likely(PyLong_CheckExact(x))) {
3525
+ v = __Pyx_NewRef(x);
3526
+ } else {
3527
+ v = PyNumber_Long(x);
3528
+ if (unlikely(!v)) return (long) -1;
3529
+ assert(PyLong_CheckExact(v));
3530
+ }
3531
+ {
3532
+ int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
3533
+ if (unlikely(result < 0)) {
3534
+ Py_DECREF(v);
3535
+ return (long) -1;
3536
+ }
3537
+ is_negative = result == 1;
3538
+ }
3539
+ if (is_unsigned && unlikely(is_negative)) {
3540
+ Py_DECREF(v);
3541
+ goto raise_neg_overflow;
3542
+ } else if (is_negative) {
3543
+ stepval = PyNumber_Invert(v);
3544
+ Py_DECREF(v);
3545
+ if (unlikely(!stepval))
3546
+ return (long) -1;
3547
+ } else {
3548
+ stepval = v;
3549
+ }
3550
+ v = NULL;
3551
+ val = (long) 0;
3552
+ mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
3553
+ shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
3554
+ for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) {
3555
+ PyObject *tmp, *digit;
3556
+ long idigit;
3557
+ digit = PyNumber_And(stepval, mask);
3558
+ if (unlikely(!digit)) goto done;
3559
+ idigit = PyLong_AsLong(digit);
3560
+ Py_DECREF(digit);
3561
+ if (unlikely(idigit < 0)) goto done;
3562
+ val |= ((long) idigit) << bits;
3563
+ tmp = PyNumber_Rshift(stepval, shift);
3564
+ if (unlikely(!tmp)) goto done;
3565
+ Py_DECREF(stepval); stepval = tmp;
3566
+ }
3567
+ Py_DECREF(shift); shift = NULL;
3568
+ Py_DECREF(mask); mask = NULL;
3569
+ {
3570
+ long idigit = PyLong_AsLong(stepval);
3571
+ if (unlikely(idigit < 0)) goto done;
3572
+ remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1);
3573
+ if (unlikely(idigit >= (1L << remaining_bits)))
3574
+ goto raise_overflow;
3575
+ val |= ((long) idigit) << bits;
3576
+ }
3577
+ if (!is_unsigned) {
3578
+ if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1))))
3579
+ goto raise_overflow;
3580
+ if (is_negative)
3581
+ val = ~val;
3582
+ }
3583
+ ret = 0;
3584
+ done:
3585
+ Py_XDECREF(shift);
3586
+ Py_XDECREF(mask);
3587
+ Py_XDECREF(stepval);
3588
+ #endif
3589
+ if (unlikely(ret))
3590
+ return (long) -1;
3591
+ return val;
3592
+ }
3593
+ raise_overflow:
3594
+ PyErr_SetString(PyExc_OverflowError,
3595
+ "value too large to convert to long");
3596
+ return (long) -1;
3597
+ raise_neg_overflow:
3598
+ PyErr_SetString(PyExc_OverflowError,
3599
+ "can't convert negative value to long");
3600
+ return (long) -1;
3601
+ }
3602
+
3603
+ /* CIntFromPy */
3604
+ static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *x) {
3605
+ #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
3606
+ #pragma GCC diagnostic push
3607
+ #pragma GCC diagnostic ignored "-Wconversion"
3608
+ #endif
3609
+ const int neg_one = (int) -1, const_zero = (int) 0;
3610
+ #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
3611
+ #pragma GCC diagnostic pop
3612
+ #endif
3613
+ const int is_unsigned = neg_one > const_zero;
3614
+ if (unlikely(!PyLong_Check(x))) {
3615
+ int val;
3616
+ PyObject *tmp = __Pyx_PyNumber_Long(x);
3617
+ if (!tmp) return (int) -1;
3618
+ val = __Pyx_PyLong_As_int(tmp);
3619
+ Py_DECREF(tmp);
3620
+ return val;
3621
+ }
3622
+ if (is_unsigned) {
3623
+ #if CYTHON_USE_PYLONG_INTERNALS
3624
+ if (unlikely(__Pyx_PyLong_IsNeg(x))) {
3625
+ goto raise_neg_overflow;
3626
+ } else if (__Pyx_PyLong_IsCompact(x)) {
3627
+ __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
3628
+ } else {
3629
+ const digit* digits = __Pyx_PyLong_Digits(x);
3630
+ assert(__Pyx_PyLong_DigitCount(x) > 1);
3631
+ switch (__Pyx_PyLong_DigitCount(x)) {
3632
+ case 2:
3633
+ if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
3634
+ if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
3635
+ __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3636
+ } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) {
3637
+ return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
3638
+ }
3639
+ }
3640
+ break;
3641
+ case 3:
3642
+ if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
3643
+ if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
3644
+ __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3645
+ } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) {
3646
+ return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
3647
+ }
3648
+ }
3649
+ break;
3650
+ case 4:
3651
+ if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
3652
+ if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
3653
+ __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3654
+ } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) {
3655
+ return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
3656
+ }
3657
+ }
3658
+ break;
3659
+ }
3660
+ }
3661
+ #endif
3662
+ #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
3663
+ if (unlikely(Py_SIZE(x) < 0)) {
3664
+ goto raise_neg_overflow;
3665
+ }
3666
+ #else
3667
+ {
3668
+ int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
3669
+ if (unlikely(result < 0))
3670
+ return (int) -1;
3671
+ if (unlikely(result == 1))
3672
+ goto raise_neg_overflow;
3673
+ }
3674
+ #endif
3675
+ if ((sizeof(int) <= sizeof(unsigned long))) {
3676
+ __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
3677
+ } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) {
3678
+ __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
3679
+ }
3680
+ } else {
3681
+ #if CYTHON_USE_PYLONG_INTERNALS
3682
+ if (__Pyx_PyLong_IsCompact(x)) {
3683
+ __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
3684
+ } else {
3685
+ const digit* digits = __Pyx_PyLong_Digits(x);
3686
+ assert(__Pyx_PyLong_DigitCount(x) > 1);
3687
+ switch (__Pyx_PyLong_SignedDigitCount(x)) {
3688
+ case -2:
3689
+ if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) {
3690
+ if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
3691
+ __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3692
+ } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
3693
+ return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
3694
+ }
3695
+ }
3696
+ break;
3697
+ case 2:
3698
+ if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
3699
+ if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
3700
+ __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3701
+ } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
3702
+ return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
3703
+ }
3704
+ }
3705
+ break;
3706
+ case -3:
3707
+ if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
3708
+ if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
3709
+ __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3710
+ } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
3711
+ return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
3712
+ }
3713
+ }
3714
+ break;
3715
+ case 3:
3716
+ if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
3717
+ if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
3718
+ __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3719
+ } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
3720
+ return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
3721
+ }
3722
+ }
3723
+ break;
3724
+ case -4:
3725
+ if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
3726
+ if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
3727
+ __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3728
+ } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
3729
+ return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
3730
+ }
3731
+ }
3732
+ break;
3733
+ case 4:
3734
+ if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
3735
+ if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
3736
+ __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3737
+ } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
3738
+ return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
3739
+ }
3740
+ }
3741
+ break;
3742
+ }
3743
+ }
3744
+ #endif
3745
+ if ((sizeof(int) <= sizeof(long))) {
3746
+ __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
3747
+ } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) {
3748
+ __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
3749
+ }
3750
+ }
3751
+ {
3752
+ int val;
3753
+ int ret = -1;
3754
+ #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
3755
+ Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
3756
+ x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
3757
+ if (unlikely(bytes_copied == -1)) {
3758
+ } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
3759
+ goto raise_overflow;
3760
+ } else {
3761
+ ret = 0;
3762
+ }
3763
+ #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
3764
+ int one = 1; int is_little = (int)*(unsigned char *)&one;
3765
+ unsigned char *bytes = (unsigned char *)&val;
3766
+ ret = _PyLong_AsByteArray((PyLongObject *)x,
3767
+ bytes, sizeof(val),
3768
+ is_little, !is_unsigned);
3769
+ #else
3770
+ PyObject *v;
3771
+ PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
3772
+ int bits, remaining_bits, is_negative = 0;
3773
+ int chunk_size = (sizeof(long) < 8) ? 30 : 62;
3774
+ if (likely(PyLong_CheckExact(x))) {
3775
+ v = __Pyx_NewRef(x);
3776
+ } else {
3777
+ v = PyNumber_Long(x);
3778
+ if (unlikely(!v)) return (int) -1;
3779
+ assert(PyLong_CheckExact(v));
3780
+ }
3781
+ {
3782
+ int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
3783
+ if (unlikely(result < 0)) {
3784
+ Py_DECREF(v);
3785
+ return (int) -1;
3786
+ }
3787
+ is_negative = result == 1;
3788
+ }
3789
+ if (is_unsigned && unlikely(is_negative)) {
3790
+ Py_DECREF(v);
3791
+ goto raise_neg_overflow;
3792
+ } else if (is_negative) {
3793
+ stepval = PyNumber_Invert(v);
3794
+ Py_DECREF(v);
3795
+ if (unlikely(!stepval))
3796
+ return (int) -1;
3797
+ } else {
3798
+ stepval = v;
3799
+ }
3800
+ v = NULL;
3801
+ val = (int) 0;
3802
+ mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
3803
+ shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
3804
+ for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) {
3805
+ PyObject *tmp, *digit;
3806
+ long idigit;
3807
+ digit = PyNumber_And(stepval, mask);
3808
+ if (unlikely(!digit)) goto done;
3809
+ idigit = PyLong_AsLong(digit);
3810
+ Py_DECREF(digit);
3811
+ if (unlikely(idigit < 0)) goto done;
3812
+ val |= ((int) idigit) << bits;
3813
+ tmp = PyNumber_Rshift(stepval, shift);
3814
+ if (unlikely(!tmp)) goto done;
3815
+ Py_DECREF(stepval); stepval = tmp;
3816
+ }
3817
+ Py_DECREF(shift); shift = NULL;
3818
+ Py_DECREF(mask); mask = NULL;
3819
+ {
3820
+ long idigit = PyLong_AsLong(stepval);
3821
+ if (unlikely(idigit < 0)) goto done;
3822
+ remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1);
3823
+ if (unlikely(idigit >= (1L << remaining_bits)))
3824
+ goto raise_overflow;
3825
+ val |= ((int) idigit) << bits;
3826
+ }
3827
+ if (!is_unsigned) {
3828
+ if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1))))
3829
+ goto raise_overflow;
3830
+ if (is_negative)
3831
+ val = ~val;
3832
+ }
3833
+ ret = 0;
3834
+ done:
3835
+ Py_XDECREF(shift);
3836
+ Py_XDECREF(mask);
3837
+ Py_XDECREF(stepval);
3838
+ #endif
3839
+ if (unlikely(ret))
3840
+ return (int) -1;
3841
+ return val;
3842
+ }
3843
+ raise_overflow:
3844
+ PyErr_SetString(PyExc_OverflowError,
3845
+ "value too large to convert to int");
3846
+ return (int) -1;
3847
+ raise_neg_overflow:
3848
+ PyErr_SetString(PyExc_OverflowError,
3849
+ "can't convert negative value to int");
3850
+ return (int) -1;
3851
+ }
3852
+
3853
+ /* FastTypeChecks */
3854
+ #if CYTHON_COMPILING_IN_CPYTHON
3855
+ static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
3856
+ while (a) {
3857
+ a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*);
3858
+ if (a == b)
3859
+ return 1;
3860
+ }
3861
+ return b == &PyBaseObject_Type;
3862
+ }
3863
+ static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
3864
+ PyObject *mro;
3865
+ if (a == b) return 1;
3866
+ mro = a->tp_mro;
3867
+ if (likely(mro)) {
3868
+ Py_ssize_t i, n;
3869
+ n = PyTuple_GET_SIZE(mro);
3870
+ for (i = 0; i < n; i++) {
3871
+ if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
3872
+ return 1;
3873
+ }
3874
+ return 0;
3875
+ }
3876
+ return __Pyx_InBases(a, b);
3877
+ }
3878
+ static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) {
3879
+ PyObject *mro;
3880
+ if (cls == a || cls == b) return 1;
3881
+ mro = cls->tp_mro;
3882
+ if (likely(mro)) {
3883
+ Py_ssize_t i, n;
3884
+ n = PyTuple_GET_SIZE(mro);
3885
+ for (i = 0; i < n; i++) {
3886
+ PyObject *base = PyTuple_GET_ITEM(mro, i);
3887
+ if (base == (PyObject *)a || base == (PyObject *)b)
3888
+ return 1;
3889
+ }
3890
+ return 0;
3891
+ }
3892
+ return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b);
3893
+ }
3894
+ static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
3895
+ if (exc_type1) {
3896
+ return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2);
3897
+ } else {
3898
+ return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
3899
+ }
3900
+ }
3901
+ static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
3902
+ Py_ssize_t i, n;
3903
+ assert(PyExceptionClass_Check(exc_type));
3904
+ n = PyTuple_GET_SIZE(tuple);
3905
+ for (i=0; i<n; i++) {
3906
+ if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
3907
+ }
3908
+ for (i=0; i<n; i++) {
3909
+ PyObject *t = PyTuple_GET_ITEM(tuple, i);
3910
+ if (likely(PyExceptionClass_Check(t))) {
3911
+ if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
3912
+ } else {
3913
+ }
3914
+ }
3915
+ return 0;
3916
+ }
3917
+ static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
3918
+ if (likely(err == exc_type)) return 1;
3919
+ if (likely(PyExceptionClass_Check(err))) {
3920
+ if (likely(PyExceptionClass_Check(exc_type))) {
3921
+ return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
3922
+ } else if (likely(PyTuple_Check(exc_type))) {
3923
+ return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
3924
+ } else {
3925
+ }
3926
+ }
3927
+ return PyErr_GivenExceptionMatches(err, exc_type);
3928
+ }
3929
+ static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
3930
+ assert(PyExceptionClass_Check(exc_type1));
3931
+ assert(PyExceptionClass_Check(exc_type2));
3932
+ if (likely(err == exc_type1 || err == exc_type2)) return 1;
3933
+ if (likely(PyExceptionClass_Check(err))) {
3934
+ return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
3935
+ }
3936
+ return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
3937
+ }
3938
+ #endif
3939
+
3940
+ /* GetRuntimeVersion */
3941
+ #if __PYX_LIMITED_VERSION_HEX < 0x030b0000
3942
+ void __Pyx_init_runtime_version(void) {
3943
+ if (__Pyx_cached_runtime_version == 0) {
3944
+ const char* rt_version = Py_GetVersion();
3945
+ unsigned long version = 0;
3946
+ unsigned long factor = 0x01000000UL;
3947
+ unsigned int digit = 0;
3948
+ int i = 0;
3949
+ while (factor) {
3950
+ while ('0' <= rt_version[i] && rt_version[i] <= '9') {
3951
+ digit = digit * 10 + (unsigned int) (rt_version[i] - '0');
3952
+ ++i;
3953
+ }
3954
+ version += factor * digit;
3955
+ if (rt_version[i] != '.')
3956
+ break;
3957
+ digit = 0;
3958
+ factor >>= 8;
3959
+ ++i;
3960
+ }
3961
+ __Pyx_cached_runtime_version = version;
3962
+ }
3963
+ }
3964
+ #endif
3965
+ static unsigned long __Pyx_get_runtime_version(void) {
3966
+ #if __PYX_LIMITED_VERSION_HEX >= 0x030b0000
3967
+ return Py_Version & ~0xFFUL;
3968
+ #else
3969
+ return __Pyx_cached_runtime_version;
3970
+ #endif
3971
+ }
3972
+
3973
+ /* AddModuleRef */
3974
+ #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
3975
+ static PyObject *__Pyx_PyImport_AddModuleObjectRef(PyObject *name) {
3976
+ PyObject *module_dict = PyImport_GetModuleDict();
3977
+ PyObject *m;
3978
+ if (PyMapping_GetOptionalItem(module_dict, name, &m) < 0) {
3979
+ return NULL;
3980
+ }
3981
+ if (m != NULL && PyModule_Check(m)) {
3982
+ return m;
3983
+ }
3984
+ Py_XDECREF(m);
3985
+ m = PyModule_NewObject(name);
3986
+ if (m == NULL)
3987
+ return NULL;
3988
+ if (PyDict_CheckExact(module_dict)) {
3989
+ PyObject *new_m;
3990
+ (void)PyDict_SetDefaultRef(module_dict, name, m, &new_m);
3991
+ Py_DECREF(m);
3992
+ return new_m;
3993
+ } else {
3994
+ if (PyObject_SetItem(module_dict, name, m) != 0) {
3995
+ Py_DECREF(m);
3996
+ return NULL;
3997
+ }
3998
+ return m;
3999
+ }
4000
+ }
4001
+ static PyObject *__Pyx_PyImport_AddModuleRef(const char *name) {
4002
+ PyObject *py_name = PyUnicode_FromString(name);
4003
+ if (!py_name) return NULL;
4004
+ PyObject *module = __Pyx_PyImport_AddModuleObjectRef(py_name);
4005
+ Py_DECREF(py_name);
4006
+ return module;
4007
+ }
4008
+ #elif __PYX_LIMITED_VERSION_HEX >= 0x030d0000
4009
+ #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name)
4010
+ #else
4011
+ static PyObject *__Pyx_PyImport_AddModuleRef(const char *name) {
4012
+ PyObject *module = PyImport_AddModule(name);
4013
+ Py_XINCREF(module);
4014
+ return module;
4015
+ }
4016
+ #endif
4017
+
4018
+ /* CheckBinaryVersion */
4019
+ static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer) {
4020
+ const unsigned long MAJOR_MINOR = 0xFFFF0000UL;
4021
+ if ((rt_version & MAJOR_MINOR) == (ct_version & MAJOR_MINOR))
4022
+ return 0;
4023
+ if (likely(allow_newer && (rt_version & MAJOR_MINOR) > (ct_version & MAJOR_MINOR)))
4024
+ return 1;
4025
+ {
4026
+ char message[200];
4027
+ PyOS_snprintf(message, sizeof(message),
4028
+ "compile time Python version %d.%d "
4029
+ "of module '%.100s' "
4030
+ "%s "
4031
+ "runtime version %d.%d",
4032
+ (int) (ct_version >> 24), (int) ((ct_version >> 16) & 0xFF),
4033
+ __Pyx_MODULE_NAME,
4034
+ (allow_newer) ? "was newer than" : "does not match",
4035
+ (int) (rt_version >> 24), (int) ((rt_version >> 16) & 0xFF)
4036
+ );
4037
+ return PyErr_WarnEx(NULL, message, 1);
4038
+ }
4039
+ }
4040
+
4041
+ /* DecompressString */
4042
+ static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo) {
4043
+ PyObject *module = NULL, *decompress, *compressed_bytes, *decompressed;
4044
+ const char* module_name = algo == 3 ? "compression.zstd" : algo == 2 ? "bz2" : "zlib";
4045
+ PyObject *methodname = PyUnicode_FromString("decompress");
4046
+ if (unlikely(!methodname)) return NULL;
4047
+ #if __PYX_LIMITED_VERSION_HEX >= 0x030e0000
4048
+ if (algo == 3) {
4049
+ PyObject *fromlist = Py_BuildValue("[O]", methodname);
4050
+ if (unlikely(!fromlist)) goto bad;
4051
+ module = PyImport_ImportModuleLevel("compression.zstd", NULL, NULL, fromlist, 0);
4052
+ Py_DECREF(fromlist);
4053
+ } else
4054
+ #endif
4055
+ module = PyImport_ImportModule(module_name);
4056
+ if (unlikely(!module)) goto import_failed;
4057
+ decompress = PyObject_GetAttr(module, methodname);
4058
+ if (unlikely(!decompress)) goto import_failed;
4059
+ {
4060
+ #ifdef __cplusplus
4061
+ char *memview_bytes = const_cast<char*>(s);
4062
+ #else
4063
+ #if defined(__clang__)
4064
+ #pragma clang diagnostic push
4065
+ #pragma clang diagnostic ignored "-Wcast-qual"
4066
+ #elif !defined(__INTEL_COMPILER) && defined(__GNUC__)
4067
+ #pragma GCC diagnostic push
4068
+ #pragma GCC diagnostic ignored "-Wcast-qual"
4069
+ #endif
4070
+ char *memview_bytes = (char*) s;
4071
+ #if defined(__clang__)
4072
+ #pragma clang diagnostic pop
4073
+ #elif !defined(__INTEL_COMPILER) && defined(__GNUC__)
4074
+ #pragma GCC diagnostic pop
4075
+ #endif
4076
+ #endif
4077
+ #if CYTHON_COMPILING_IN_LIMITED_API && !defined(PyBUF_READ)
4078
+ int memview_flags = 0x100;
4079
+ #else
4080
+ int memview_flags = PyBUF_READ;
4081
+ #endif
4082
+ compressed_bytes = PyMemoryView_FromMemory(memview_bytes, length, memview_flags);
4083
+ }
4084
+ if (unlikely(!compressed_bytes)) {
4085
+ Py_DECREF(decompress);
4086
+ goto bad;
4087
+ }
4088
+ decompressed = PyObject_CallFunctionObjArgs(decompress, compressed_bytes, NULL);
4089
+ Py_DECREF(compressed_bytes);
4090
+ Py_DECREF(decompress);
4091
+ Py_DECREF(module);
4092
+ Py_DECREF(methodname);
4093
+ return decompressed;
4094
+ import_failed:
4095
+ PyErr_Format(PyExc_ImportError,
4096
+ "Failed to import '%.20s.decompress' - cannot initialise module strings. "
4097
+ "String compression was configured with the C macro 'CYTHON_COMPRESS_STRINGS=%d'.",
4098
+ module_name, algo);
4099
+ bad:
4100
+ Py_XDECREF(module);
4101
+ Py_DECREF(methodname);
4102
+ return NULL;
4103
+ }
4104
+
4105
+ #include <string.h>
4106
+ static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s) {
4107
+ size_t len = strlen(s);
4108
+ if (unlikely(len > (size_t) PY_SSIZE_T_MAX)) {
4109
+ PyErr_SetString(PyExc_OverflowError, "byte string is too long");
4110
+ return -1;
4111
+ }
4112
+ return (Py_ssize_t) len;
4113
+ }
4114
+ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
4115
+ Py_ssize_t len = __Pyx_ssize_strlen(c_str);
4116
+ if (unlikely(len < 0)) return NULL;
4117
+ return __Pyx_PyUnicode_FromStringAndSize(c_str, len);
4118
+ }
4119
+ static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char* c_str) {
4120
+ Py_ssize_t len = __Pyx_ssize_strlen(c_str);
4121
+ if (unlikely(len < 0)) return NULL;
4122
+ return PyByteArray_FromStringAndSize(c_str, len);
4123
+ }
4124
+ static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
4125
+ Py_ssize_t ignore;
4126
+ return __Pyx_PyObject_AsStringAndSize(o, &ignore);
4127
+ }
4128
+ #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_UTF8
4129
+ static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
4130
+ if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
4131
+ #if CYTHON_COMPILING_IN_LIMITED_API
4132
+ {
4133
+ const char* result;
4134
+ Py_ssize_t unicode_length;
4135
+ CYTHON_MAYBE_UNUSED_VAR(unicode_length); // only for __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
4136
+ #if __PYX_LIMITED_VERSION_HEX < 0x030A0000
4137
+ if (unlikely(PyArg_Parse(o, "s#", &result, length) < 0)) return NULL;
4138
+ #else
4139
+ result = PyUnicode_AsUTF8AndSize(o, length);
4140
+ #endif
4141
+ #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
4142
+ unicode_length = PyUnicode_GetLength(o);
4143
+ if (unlikely(unicode_length < 0)) return NULL;
4144
+ if (unlikely(unicode_length != *length)) {
4145
+ PyUnicode_AsASCIIString(o);
4146
+ return NULL;
4147
+ }
4148
+ #endif
4149
+ return result;
4150
+ }
4151
+ #else
4152
+ #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
4153
+ if (likely(PyUnicode_IS_ASCII(o))) {
4154
+ *length = PyUnicode_GET_LENGTH(o);
4155
+ return PyUnicode_AsUTF8(o);
4156
+ } else {
4157
+ PyUnicode_AsASCIIString(o);
4158
+ return NULL;
4159
+ }
4160
+ #else
4161
+ return PyUnicode_AsUTF8AndSize(o, length);
4162
+ #endif
4163
+ #endif
4164
+ }
4165
+ #endif
4166
+ static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
4167
+ #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_UTF8
4168
+ if (PyUnicode_Check(o)) {
4169
+ return __Pyx_PyUnicode_AsStringAndSize(o, length);
4170
+ } else
4171
+ #endif
4172
+ if (PyByteArray_Check(o)) {
4173
+ #if (CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS) || (CYTHON_COMPILING_IN_PYPY && (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)))
4174
+ *length = PyByteArray_GET_SIZE(o);
4175
+ return PyByteArray_AS_STRING(o);
4176
+ #else
4177
+ *length = PyByteArray_Size(o);
4178
+ if (*length == -1) return NULL;
4179
+ return PyByteArray_AsString(o);
4180
+ #endif
4181
+ } else
4182
+ {
4183
+ char* result;
4184
+ int r = PyBytes_AsStringAndSize(o, &result, length);
4185
+ if (unlikely(r < 0)) {
4186
+ return NULL;
4187
+ } else {
4188
+ return result;
4189
+ }
4190
+ }
4191
+ }
4192
+ static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
4193
+ int is_true = x == Py_True;
4194
+ if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
4195
+ else return PyObject_IsTrue(x);
4196
+ }
4197
+ static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
4198
+ int retval;
4199
+ if (unlikely(!x)) return -1;
4200
+ retval = __Pyx_PyObject_IsTrue(x);
4201
+ Py_DECREF(x);
4202
+ return retval;
4203
+ }
4204
+ static PyObject* __Pyx_PyNumber_LongWrongResultType(PyObject* result) {
4205
+ __Pyx_TypeName result_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(result));
4206
+ if (PyLong_Check(result)) {
4207
+ if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
4208
+ "__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). "
4209
+ "The ability to return an instance of a strict subclass of int is deprecated, "
4210
+ "and may be removed in a future version of Python.",
4211
+ result_type_name)) {
4212
+ __Pyx_DECREF_TypeName(result_type_name);
4213
+ Py_DECREF(result);
4214
+ return NULL;
4215
+ }
4216
+ __Pyx_DECREF_TypeName(result_type_name);
4217
+ return result;
4218
+ }
4219
+ PyErr_Format(PyExc_TypeError,
4220
+ "__int__ returned non-int (type " __Pyx_FMT_TYPENAME ")",
4221
+ result_type_name);
4222
+ __Pyx_DECREF_TypeName(result_type_name);
4223
+ Py_DECREF(result);
4224
+ return NULL;
4225
+ }
4226
+ static CYTHON_INLINE PyObject* __Pyx_PyNumber_Long(PyObject* x) {
4227
+ #if CYTHON_USE_TYPE_SLOTS
4228
+ PyNumberMethods *m;
4229
+ #endif
4230
+ PyObject *res = NULL;
4231
+ if (likely(PyLong_Check(x)))
4232
+ return __Pyx_NewRef(x);
4233
+ #if CYTHON_USE_TYPE_SLOTS
4234
+ m = Py_TYPE(x)->tp_as_number;
4235
+ if (likely(m && m->nb_int)) {
4236
+ res = m->nb_int(x);
4237
+ }
4238
+ #else
4239
+ if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
4240
+ res = PyNumber_Long(x);
4241
+ }
4242
+ #endif
4243
+ if (likely(res)) {
4244
+ if (unlikely(!PyLong_CheckExact(res))) {
4245
+ return __Pyx_PyNumber_LongWrongResultType(res);
4246
+ }
4247
+ }
4248
+ else if (!PyErr_Occurred()) {
4249
+ PyErr_SetString(PyExc_TypeError,
4250
+ "an integer is required");
4251
+ }
4252
+ return res;
4253
+ }
4254
+ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
4255
+ Py_ssize_t ival;
4256
+ PyObject *x;
4257
+ if (likely(PyLong_CheckExact(b))) {
4258
+ #if CYTHON_USE_PYLONG_INTERNALS
4259
+ if (likely(__Pyx_PyLong_IsCompact(b))) {
4260
+ return __Pyx_PyLong_CompactValue(b);
4261
+ } else {
4262
+ const digit* digits = __Pyx_PyLong_Digits(b);
4263
+ const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b);
4264
+ switch (size) {
4265
+ case 2:
4266
+ if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
4267
+ return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
4268
+ }
4269
+ break;
4270
+ case -2:
4271
+ if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
4272
+ return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
4273
+ }
4274
+ break;
4275
+ case 3:
4276
+ if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
4277
+ return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
4278
+ }
4279
+ break;
4280
+ case -3:
4281
+ if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
4282
+ return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
4283
+ }
4284
+ break;
4285
+ case 4:
4286
+ if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
4287
+ return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
4288
+ }
4289
+ break;
4290
+ case -4:
4291
+ if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
4292
+ return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
4293
+ }
4294
+ break;
4295
+ }
4296
+ }
4297
+ #endif
4298
+ return PyLong_AsSsize_t(b);
4299
+ }
4300
+ x = PyNumber_Index(b);
4301
+ if (!x) return -1;
4302
+ ival = PyLong_AsSsize_t(x);
4303
+ Py_DECREF(x);
4304
+ return ival;
4305
+ }
4306
+ static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) {
4307
+ if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) {
4308
+ return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o);
4309
+ } else {
4310
+ Py_ssize_t ival;
4311
+ PyObject *x;
4312
+ x = PyNumber_Index(o);
4313
+ if (!x) return -1;
4314
+ ival = PyLong_AsLong(x);
4315
+ Py_DECREF(x);
4316
+ return ival;
4317
+ }
4318
+ }
4319
+ static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b) {
4320
+ CYTHON_UNUSED_VAR(b);
4321
+ return __Pyx_NewRef(Py_None);
4322
+ }
4323
+ static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
4324
+ return __Pyx_NewRef(b ? Py_True: Py_False);
4325
+ }
4326
+ static CYTHON_INLINE PyObject * __Pyx_PyLong_FromSize_t(size_t ival) {
4327
+ return PyLong_FromSize_t(ival);
4328
+ }
4329
+
4330
+
4331
+ /* MultiPhaseInitModuleState */
4332
+ #if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE
4333
+ #ifndef CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
4334
+ #if (CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX >= 0x030C0000)
4335
+ #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 1
4336
+ #else
4337
+ #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 0
4338
+ #endif
4339
+ #endif
4340
+ #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE && !CYTHON_ATOMICS
4341
+ #error "Module state with PEP489 requires atomics. Currently that's one of\
4342
+ C11, C++11, gcc atomic intrinsics or MSVC atomic intrinsics"
4343
+ #endif
4344
+ #if !CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
4345
+ #define __Pyx_ModuleStateLookup_Lock()
4346
+ #define __Pyx_ModuleStateLookup_Unlock()
4347
+ #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d0000
4348
+ static PyMutex __Pyx_ModuleStateLookup_mutex = {0};
4349
+ #define __Pyx_ModuleStateLookup_Lock() PyMutex_Lock(&__Pyx_ModuleStateLookup_mutex)
4350
+ #define __Pyx_ModuleStateLookup_Unlock() PyMutex_Unlock(&__Pyx_ModuleStateLookup_mutex)
4351
+ #elif defined(__cplusplus) && __cplusplus >= 201103L
4352
+ #include <mutex>
4353
+ static std::mutex __Pyx_ModuleStateLookup_mutex;
4354
+ #define __Pyx_ModuleStateLookup_Lock() __Pyx_ModuleStateLookup_mutex.lock()
4355
+ #define __Pyx_ModuleStateLookup_Unlock() __Pyx_ModuleStateLookup_mutex.unlock()
4356
+ #elif defined(__STDC_VERSION__) && (__STDC_VERSION__ > 201112L) && !defined(__STDC_NO_THREADS__)
4357
+ #include <threads.h>
4358
+ static mtx_t __Pyx_ModuleStateLookup_mutex;
4359
+ static once_flag __Pyx_ModuleStateLookup_mutex_once_flag = ONCE_FLAG_INIT;
4360
+ static void __Pyx_ModuleStateLookup_initialize_mutex(void) {
4361
+ mtx_init(&__Pyx_ModuleStateLookup_mutex, mtx_plain);
4362
+ }
4363
+ #define __Pyx_ModuleStateLookup_Lock()\
4364
+ call_once(&__Pyx_ModuleStateLookup_mutex_once_flag, __Pyx_ModuleStateLookup_initialize_mutex);\
4365
+ mtx_lock(&__Pyx_ModuleStateLookup_mutex)
4366
+ #define __Pyx_ModuleStateLookup_Unlock() mtx_unlock(&__Pyx_ModuleStateLookup_mutex)
4367
+ #elif defined(HAVE_PTHREAD_H)
4368
+ #include <pthread.h>
4369
+ static pthread_mutex_t __Pyx_ModuleStateLookup_mutex = PTHREAD_MUTEX_INITIALIZER;
4370
+ #define __Pyx_ModuleStateLookup_Lock() pthread_mutex_lock(&__Pyx_ModuleStateLookup_mutex)
4371
+ #define __Pyx_ModuleStateLookup_Unlock() pthread_mutex_unlock(&__Pyx_ModuleStateLookup_mutex)
4372
+ #elif defined(_WIN32)
4373
+ #include <Windows.h> // synchapi.h on its own doesn't work
4374
+ static SRWLOCK __Pyx_ModuleStateLookup_mutex = SRWLOCK_INIT;
4375
+ #define __Pyx_ModuleStateLookup_Lock() AcquireSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex)
4376
+ #define __Pyx_ModuleStateLookup_Unlock() ReleaseSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex)
4377
+ #else
4378
+ #error "No suitable lock available for CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE.\
4379
+ Requires C standard >= C11, or C++ standard >= C++11,\
4380
+ or pthreads, or the Windows 32 API, or Python >= 3.13."
4381
+ #endif
4382
+ typedef struct {
4383
+ int64_t id;
4384
+ PyObject *module;
4385
+ } __Pyx_InterpreterIdAndModule;
4386
+ typedef struct {
4387
+ char interpreter_id_as_index;
4388
+ Py_ssize_t count;
4389
+ Py_ssize_t allocated;
4390
+ __Pyx_InterpreterIdAndModule table[1];
4391
+ } __Pyx_ModuleStateLookupData;
4392
+ #define __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE 32
4393
+ #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
4394
+ static __pyx_atomic_int_type __Pyx_ModuleStateLookup_read_counter = 0;
4395
+ #endif
4396
+ #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
4397
+ static __pyx_atomic_ptr_type __Pyx_ModuleStateLookup_data = 0;
4398
+ #else
4399
+ static __Pyx_ModuleStateLookupData* __Pyx_ModuleStateLookup_data = NULL;
4400
+ #endif
4401
+ static __Pyx_InterpreterIdAndModule* __Pyx_State_FindModuleStateLookupTableLowerBound(
4402
+ __Pyx_InterpreterIdAndModule* table,
4403
+ Py_ssize_t count,
4404
+ int64_t interpreterId) {
4405
+ __Pyx_InterpreterIdAndModule* begin = table;
4406
+ __Pyx_InterpreterIdAndModule* end = begin + count;
4407
+ if (begin->id == interpreterId) {
4408
+ return begin;
4409
+ }
4410
+ while ((end - begin) > __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) {
4411
+ __Pyx_InterpreterIdAndModule* halfway = begin + (end - begin)/2;
4412
+ if (halfway->id == interpreterId) {
4413
+ return halfway;
4414
+ }
4415
+ if (halfway->id < interpreterId) {
4416
+ begin = halfway;
4417
+ } else {
4418
+ end = halfway;
4419
+ }
4420
+ }
4421
+ for (; begin < end; ++begin) {
4422
+ if (begin->id >= interpreterId) return begin;
4423
+ }
4424
+ return begin;
4425
+ }
4426
+ static PyObject *__Pyx_State_FindModule(CYTHON_UNUSED void* dummy) {
4427
+ int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get());
4428
+ if (interpreter_id == -1) return NULL;
4429
+ #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
4430
+ __Pyx_ModuleStateLookupData* data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data);
4431
+ {
4432
+ __pyx_atomic_incr_acq_rel(&__Pyx_ModuleStateLookup_read_counter);
4433
+ if (likely(data)) {
4434
+ __Pyx_ModuleStateLookupData* new_data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_acquire(&__Pyx_ModuleStateLookup_data);
4435
+ if (likely(data == new_data)) {
4436
+ goto read_finished;
4437
+ }
4438
+ }
4439
+ __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter);
4440
+ __Pyx_ModuleStateLookup_Lock();
4441
+ __pyx_atomic_incr_relaxed(&__Pyx_ModuleStateLookup_read_counter);
4442
+ data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data);
4443
+ __Pyx_ModuleStateLookup_Unlock();
4444
+ }
4445
+ read_finished:;
4446
+ #else
4447
+ __Pyx_ModuleStateLookupData* data = __Pyx_ModuleStateLookup_data;
4448
+ #endif
4449
+ __Pyx_InterpreterIdAndModule* found = NULL;
4450
+ if (unlikely(!data)) goto end;
4451
+ if (data->interpreter_id_as_index) {
4452
+ if (interpreter_id < data->count) {
4453
+ found = data->table+interpreter_id;
4454
+ }
4455
+ } else {
4456
+ found = __Pyx_State_FindModuleStateLookupTableLowerBound(
4457
+ data->table, data->count, interpreter_id);
4458
+ }
4459
+ end:
4460
+ {
4461
+ PyObject *result=NULL;
4462
+ if (found && found->id == interpreter_id) {
4463
+ result = found->module;
4464
+ }
4465
+ #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
4466
+ __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter);
4467
+ #endif
4468
+ return result;
4469
+ }
4470
+ }
4471
+ #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
4472
+ static void __Pyx_ModuleStateLookup_wait_until_no_readers(void) {
4473
+ while (__pyx_atomic_load(&__Pyx_ModuleStateLookup_read_counter) != 0);
4474
+ }
4475
+ #else
4476
+ #define __Pyx_ModuleStateLookup_wait_until_no_readers()
4477
+ #endif
4478
+ static int __Pyx_State_AddModuleInterpIdAsIndex(__Pyx_ModuleStateLookupData **old_data, PyObject* module, int64_t interpreter_id) {
4479
+ Py_ssize_t to_allocate = (*old_data)->allocated;
4480
+ while (to_allocate <= interpreter_id) {
4481
+ if (to_allocate == 0) to_allocate = 1;
4482
+ else to_allocate *= 2;
4483
+ }
4484
+ __Pyx_ModuleStateLookupData *new_data = *old_data;
4485
+ if (to_allocate != (*old_data)->allocated) {
4486
+ new_data = (__Pyx_ModuleStateLookupData *)realloc(
4487
+ *old_data,
4488
+ sizeof(__Pyx_ModuleStateLookupData)+(to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule));
4489
+ if (!new_data) {
4490
+ PyErr_NoMemory();
4491
+ return -1;
4492
+ }
4493
+ for (Py_ssize_t i = new_data->allocated; i < to_allocate; ++i) {
4494
+ new_data->table[i].id = i;
4495
+ new_data->table[i].module = NULL;
4496
+ }
4497
+ new_data->allocated = to_allocate;
4498
+ }
4499
+ new_data->table[interpreter_id].module = module;
4500
+ if (new_data->count < interpreter_id+1) {
4501
+ new_data->count = interpreter_id+1;
4502
+ }
4503
+ *old_data = new_data;
4504
+ return 0;
4505
+ }
4506
+ static void __Pyx_State_ConvertFromInterpIdAsIndex(__Pyx_ModuleStateLookupData *data) {
4507
+ __Pyx_InterpreterIdAndModule *read = data->table;
4508
+ __Pyx_InterpreterIdAndModule *write = data->table;
4509
+ __Pyx_InterpreterIdAndModule *end = read + data->count;
4510
+ for (; read<end; ++read) {
4511
+ if (read->module) {
4512
+ write->id = read->id;
4513
+ write->module = read->module;
4514
+ ++write;
4515
+ }
4516
+ }
4517
+ data->count = write - data->table;
4518
+ for (; write<end; ++write) {
4519
+ write->id = 0;
4520
+ write->module = NULL;
4521
+ }
4522
+ data->interpreter_id_as_index = 0;
4523
+ }
4524
+ static int __Pyx_State_AddModule(PyObject* module, CYTHON_UNUSED void* dummy) {
4525
+ int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get());
4526
+ if (interpreter_id == -1) return -1;
4527
+ int result = 0;
4528
+ __Pyx_ModuleStateLookup_Lock();
4529
+ #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
4530
+ __Pyx_ModuleStateLookupData *old_data = (__Pyx_ModuleStateLookupData *)
4531
+ __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0);
4532
+ #else
4533
+ __Pyx_ModuleStateLookupData *old_data = __Pyx_ModuleStateLookup_data;
4534
+ #endif
4535
+ __Pyx_ModuleStateLookupData *new_data = old_data;
4536
+ if (!new_data) {
4537
+ new_data = (__Pyx_ModuleStateLookupData *)calloc(1, sizeof(__Pyx_ModuleStateLookupData));
4538
+ if (!new_data) {
4539
+ result = -1;
4540
+ PyErr_NoMemory();
4541
+ goto end;
4542
+ }
4543
+ new_data->allocated = 1;
4544
+ new_data->interpreter_id_as_index = 1;
4545
+ }
4546
+ __Pyx_ModuleStateLookup_wait_until_no_readers();
4547
+ if (new_data->interpreter_id_as_index) {
4548
+ if (interpreter_id < __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) {
4549
+ result = __Pyx_State_AddModuleInterpIdAsIndex(&new_data, module, interpreter_id);
4550
+ goto end;
4551
+ }
4552
+ __Pyx_State_ConvertFromInterpIdAsIndex(new_data);
4553
+ }
4554
+ {
4555
+ Py_ssize_t insert_at = 0;
4556
+ {
4557
+ __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound(
4558
+ new_data->table, new_data->count, interpreter_id);
4559
+ assert(lower_bound);
4560
+ insert_at = lower_bound - new_data->table;
4561
+ if (unlikely(insert_at < new_data->count && lower_bound->id == interpreter_id)) {
4562
+ lower_bound->module = module;
4563
+ goto end; // already in table, nothing more to do
4564
+ }
4565
+ }
4566
+ if (new_data->count+1 >= new_data->allocated) {
4567
+ Py_ssize_t to_allocate = (new_data->count+1)*2;
4568
+ new_data =
4569
+ (__Pyx_ModuleStateLookupData*)realloc(
4570
+ new_data,
4571
+ sizeof(__Pyx_ModuleStateLookupData) +
4572
+ (to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule));
4573
+ if (!new_data) {
4574
+ result = -1;
4575
+ new_data = old_data;
4576
+ PyErr_NoMemory();
4577
+ goto end;
4578
+ }
4579
+ new_data->allocated = to_allocate;
4580
+ }
4581
+ ++new_data->count;
4582
+ int64_t last_id = interpreter_id;
4583
+ PyObject *last_module = module;
4584
+ for (Py_ssize_t i=insert_at; i<new_data->count; ++i) {
4585
+ int64_t current_id = new_data->table[i].id;
4586
+ new_data->table[i].id = last_id;
4587
+ last_id = current_id;
4588
+ PyObject *current_module = new_data->table[i].module;
4589
+ new_data->table[i].module = last_module;
4590
+ last_module = current_module;
4591
+ }
4592
+ }
4593
+ end:
4594
+ #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
4595
+ __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, new_data);
4596
+ #else
4597
+ __Pyx_ModuleStateLookup_data = new_data;
4598
+ #endif
4599
+ __Pyx_ModuleStateLookup_Unlock();
4600
+ return result;
4601
+ }
4602
+ static int __Pyx_State_RemoveModule(CYTHON_UNUSED void* dummy) {
4603
+ int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get());
4604
+ if (interpreter_id == -1) return -1;
4605
+ __Pyx_ModuleStateLookup_Lock();
4606
+ #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
4607
+ __Pyx_ModuleStateLookupData *data = (__Pyx_ModuleStateLookupData *)
4608
+ __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0);
4609
+ #else
4610
+ __Pyx_ModuleStateLookupData *data = __Pyx_ModuleStateLookup_data;
4611
+ #endif
4612
+ if (data->interpreter_id_as_index) {
4613
+ if (interpreter_id < data->count) {
4614
+ data->table[interpreter_id].module = NULL;
4615
+ }
4616
+ goto done;
4617
+ }
4618
+ {
4619
+ __Pyx_ModuleStateLookup_wait_until_no_readers();
4620
+ __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound(
4621
+ data->table, data->count, interpreter_id);
4622
+ if (!lower_bound) goto done;
4623
+ if (lower_bound->id != interpreter_id) goto done;
4624
+ __Pyx_InterpreterIdAndModule *end = data->table+data->count;
4625
+ for (;lower_bound<end-1; ++lower_bound) {
4626
+ lower_bound->id = (lower_bound+1)->id;
4627
+ lower_bound->module = (lower_bound+1)->module;
4628
+ }
4629
+ }
4630
+ --data->count;
4631
+ if (data->count == 0) {
4632
+ free(data);
4633
+ data = NULL;
4634
+ }
4635
+ done:
4636
+ #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
4637
+ __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, data);
4638
+ #else
4639
+ __Pyx_ModuleStateLookup_data = data;
4640
+ #endif
4641
+ __Pyx_ModuleStateLookup_Unlock();
4642
+ return 0;
4643
+ }
4644
+ #endif
4645
+
4646
+ /* #### Code section: utility_code_pragmas_end ### */
4647
+ #ifdef _MSC_VER
4648
+ #pragma warning( pop )
4649
+ #endif
4650
+
4651
+
4652
+
4653
+ /* #### Code section: end ### */
4654
+ #endif /* Py_PYTHON_H */