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