3#ifndef PY_SSIZE_T_CLEAN
4#define PY_SSIZE_T_CLEAN
6#if defined(CYTHON_LIMITED_API) && 0
8 #if CYTHON_LIMITED_API+0 > 0x03030000
9 #define Py_LIMITED_API CYTHON_LIMITED_API
11 #define Py_LIMITED_API 0x03030000
18 #error Python headers needed to compile C extensions, please install development version of Python.
19#elif PY_VERSION_HEX < 0x02070000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
20 #error Cython requires Python 2.7+ or Python 3.3+.
22#if defined(CYTHON_LIMITED_API) && CYTHON_LIMITED_API
23#define __PYX_EXTRA_ABI_MODULE_NAME "limited"
25#define __PYX_EXTRA_ABI_MODULE_NAME ""
27#define CYTHON_ABI "3_0_11" __PYX_EXTRA_ABI_MODULE_NAME
28#define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI
29#define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "."
30#define CYTHON_HEX_VERSION 0x03000BF0
31#define CYTHON_FUTURE_DIVISION 1
34 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
36#if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS)
48 #define DL_IMPORT(t) t
51 #define DL_EXPORT(t) t
55 #define HAVE_LONG_LONG
58 #define PY_LONG_LONG LONG_LONG
61 #define Py_HUGE_VAL HUGE_VAL
63#define __PYX_LIMITED_VERSION_HEX PY_VERSION_HEX
64#if defined(GRAALVM_PYTHON)
67 #define CYTHON_COMPILING_IN_PYPY 0
68 #define CYTHON_COMPILING_IN_CPYTHON 0
69 #define CYTHON_COMPILING_IN_LIMITED_API 0
70 #define CYTHON_COMPILING_IN_GRAAL 1
71 #define CYTHON_COMPILING_IN_NOGIL 0
72 #undef CYTHON_USE_TYPE_SLOTS
73 #define CYTHON_USE_TYPE_SLOTS 0
74 #undef CYTHON_USE_TYPE_SPECS
75 #define CYTHON_USE_TYPE_SPECS 0
76 #undef CYTHON_USE_PYTYPE_LOOKUP
77 #define CYTHON_USE_PYTYPE_LOOKUP 0
78 #if PY_VERSION_HEX < 0x03050000
79 #undef CYTHON_USE_ASYNC_SLOTS
80 #define CYTHON_USE_ASYNC_SLOTS 0
81 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
82 #define CYTHON_USE_ASYNC_SLOTS 1
84 #undef CYTHON_USE_PYLIST_INTERNALS
85 #define CYTHON_USE_PYLIST_INTERNALS 0
86 #undef CYTHON_USE_UNICODE_INTERNALS
87 #define CYTHON_USE_UNICODE_INTERNALS 0
88 #undef CYTHON_USE_UNICODE_WRITER
89 #define CYTHON_USE_UNICODE_WRITER 0
90 #undef CYTHON_USE_PYLONG_INTERNALS
91 #define CYTHON_USE_PYLONG_INTERNALS 0
92 #undef CYTHON_AVOID_BORROWED_REFS
93 #define CYTHON_AVOID_BORROWED_REFS 1
94 #undef CYTHON_ASSUME_SAFE_MACROS
95 #define CYTHON_ASSUME_SAFE_MACROS 0
96 #undef CYTHON_UNPACK_METHODS
97 #define CYTHON_UNPACK_METHODS 0
98 #undef CYTHON_FAST_THREAD_STATE
99 #define CYTHON_FAST_THREAD_STATE 0
100 #undef CYTHON_FAST_GIL
101 #define CYTHON_FAST_GIL 0
102 #undef CYTHON_METH_FASTCALL
103 #define CYTHON_METH_FASTCALL 0
104 #undef CYTHON_FAST_PYCALL
105 #define CYTHON_FAST_PYCALL 0
106 #ifndef CYTHON_PEP487_INIT_SUBCLASS
107 #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3)
109 #undef CYTHON_PEP489_MULTI_PHASE_INIT
110 #define CYTHON_PEP489_MULTI_PHASE_INIT 1
111 #undef CYTHON_USE_MODULE_STATE
112 #define CYTHON_USE_MODULE_STATE 0
113 #undef CYTHON_USE_TP_FINALIZE
114 #define CYTHON_USE_TP_FINALIZE 0
115 #undef CYTHON_USE_DICT_VERSIONS
116 #define CYTHON_USE_DICT_VERSIONS 0
117 #undef CYTHON_USE_EXC_INFO_STACK
118 #define CYTHON_USE_EXC_INFO_STACK 0
119 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
120 #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
122 #undef CYTHON_USE_FREELISTS
123 #define CYTHON_USE_FREELISTS 0
124#elif defined(PYPY_VERSION)
125 #define CYTHON_COMPILING_IN_PYPY 1
126 #define CYTHON_COMPILING_IN_CPYTHON 0
127 #define CYTHON_COMPILING_IN_LIMITED_API 0
128 #define CYTHON_COMPILING_IN_GRAAL 0
129 #define CYTHON_COMPILING_IN_NOGIL 0
130 #undef CYTHON_USE_TYPE_SLOTS
131 #define CYTHON_USE_TYPE_SLOTS 0
132 #ifndef CYTHON_USE_TYPE_SPECS
133 #define CYTHON_USE_TYPE_SPECS 0
135 #undef CYTHON_USE_PYTYPE_LOOKUP
136 #define CYTHON_USE_PYTYPE_LOOKUP 0
137 #if PY_VERSION_HEX < 0x03050000
138 #undef CYTHON_USE_ASYNC_SLOTS
139 #define CYTHON_USE_ASYNC_SLOTS 0
140 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
141 #define CYTHON_USE_ASYNC_SLOTS 1
143 #undef CYTHON_USE_PYLIST_INTERNALS
144 #define CYTHON_USE_PYLIST_INTERNALS 0
145 #undef CYTHON_USE_UNICODE_INTERNALS
146 #define CYTHON_USE_UNICODE_INTERNALS 0
147 #undef CYTHON_USE_UNICODE_WRITER
148 #define CYTHON_USE_UNICODE_WRITER 0
149 #undef CYTHON_USE_PYLONG_INTERNALS
150 #define CYTHON_USE_PYLONG_INTERNALS 0
151 #undef CYTHON_AVOID_BORROWED_REFS
152 #define CYTHON_AVOID_BORROWED_REFS 1
153 #undef CYTHON_ASSUME_SAFE_MACROS
154 #define CYTHON_ASSUME_SAFE_MACROS 0
155 #undef CYTHON_UNPACK_METHODS
156 #define CYTHON_UNPACK_METHODS 0
157 #undef CYTHON_FAST_THREAD_STATE
158 #define CYTHON_FAST_THREAD_STATE 0
159 #undef CYTHON_FAST_GIL
160 #define CYTHON_FAST_GIL 0
161 #undef CYTHON_METH_FASTCALL
162 #define CYTHON_METH_FASTCALL 0
163 #undef CYTHON_FAST_PYCALL
164 #define CYTHON_FAST_PYCALL 0
165 #ifndef CYTHON_PEP487_INIT_SUBCLASS
166 #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3)
168 #if PY_VERSION_HEX < 0x03090000
169 #undef CYTHON_PEP489_MULTI_PHASE_INIT
170 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
171 #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT)
172 #define CYTHON_PEP489_MULTI_PHASE_INIT 1
174 #undef CYTHON_USE_MODULE_STATE
175 #define CYTHON_USE_MODULE_STATE 0
176 #undef CYTHON_USE_TP_FINALIZE
177 #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1 && PYPY_VERSION_NUM >= 0x07030C00)
178 #undef CYTHON_USE_DICT_VERSIONS
179 #define CYTHON_USE_DICT_VERSIONS 0
180 #undef CYTHON_USE_EXC_INFO_STACK
181 #define CYTHON_USE_EXC_INFO_STACK 0
182 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
183 #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
185 #undef CYTHON_USE_FREELISTS
186 #define CYTHON_USE_FREELISTS 0
187#elif defined(CYTHON_LIMITED_API)
188 #ifdef Py_LIMITED_API
189 #undef __PYX_LIMITED_VERSION_HEX
190 #define __PYX_LIMITED_VERSION_HEX Py_LIMITED_API
192 #define CYTHON_COMPILING_IN_PYPY 0
193 #define CYTHON_COMPILING_IN_CPYTHON 0
194 #define CYTHON_COMPILING_IN_LIMITED_API 1
195 #define CYTHON_COMPILING_IN_GRAAL 0
196 #define CYTHON_COMPILING_IN_NOGIL 0
197 #undef CYTHON_CLINE_IN_TRACEBACK
198 #define CYTHON_CLINE_IN_TRACEBACK 0
199 #undef CYTHON_USE_TYPE_SLOTS
200 #define CYTHON_USE_TYPE_SLOTS 0
201 #undef CYTHON_USE_TYPE_SPECS
202 #define CYTHON_USE_TYPE_SPECS 1
203 #undef CYTHON_USE_PYTYPE_LOOKUP
204 #define CYTHON_USE_PYTYPE_LOOKUP 0
205 #undef CYTHON_USE_ASYNC_SLOTS
206 #define CYTHON_USE_ASYNC_SLOTS 0
207 #undef CYTHON_USE_PYLIST_INTERNALS
208 #define CYTHON_USE_PYLIST_INTERNALS 0
209 #undef CYTHON_USE_UNICODE_INTERNALS
210 #define CYTHON_USE_UNICODE_INTERNALS 0
211 #ifndef CYTHON_USE_UNICODE_WRITER
212 #define CYTHON_USE_UNICODE_WRITER 0
214 #undef CYTHON_USE_PYLONG_INTERNALS
215 #define CYTHON_USE_PYLONG_INTERNALS 0
216 #ifndef CYTHON_AVOID_BORROWED_REFS
217 #define CYTHON_AVOID_BORROWED_REFS 0
219 #undef CYTHON_ASSUME_SAFE_MACROS
220 #define CYTHON_ASSUME_SAFE_MACROS 0
221 #undef CYTHON_UNPACK_METHODS
222 #define CYTHON_UNPACK_METHODS 0
223 #undef CYTHON_FAST_THREAD_STATE
224 #define CYTHON_FAST_THREAD_STATE 0
225 #undef CYTHON_FAST_GIL
226 #define CYTHON_FAST_GIL 0
227 #undef CYTHON_METH_FASTCALL
228 #define CYTHON_METH_FASTCALL 0
229 #undef CYTHON_FAST_PYCALL
230 #define CYTHON_FAST_PYCALL 0
231 #ifndef CYTHON_PEP487_INIT_SUBCLASS
232 #define CYTHON_PEP487_INIT_SUBCLASS 1
234 #undef CYTHON_PEP489_MULTI_PHASE_INIT
235 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
236 #undef CYTHON_USE_MODULE_STATE
237 #define CYTHON_USE_MODULE_STATE 1
238 #ifndef CYTHON_USE_TP_FINALIZE
239 #define CYTHON_USE_TP_FINALIZE 0
241 #undef CYTHON_USE_DICT_VERSIONS
242 #define CYTHON_USE_DICT_VERSIONS 0
243 #undef CYTHON_USE_EXC_INFO_STACK
244 #define CYTHON_USE_EXC_INFO_STACK 0
245 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
246 #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
248 #undef CYTHON_USE_FREELISTS
249 #define CYTHON_USE_FREELISTS 0
250#elif defined(Py_GIL_DISABLED) || defined(Py_NOGIL)
251 #define CYTHON_COMPILING_IN_PYPY 0
252 #define CYTHON_COMPILING_IN_CPYTHON 0
253 #define CYTHON_COMPILING_IN_LIMITED_API 0
254 #define CYTHON_COMPILING_IN_GRAAL 0
255 #define CYTHON_COMPILING_IN_NOGIL 1
256 #ifndef CYTHON_USE_TYPE_SLOTS
257 #define CYTHON_USE_TYPE_SLOTS 1
259 #ifndef CYTHON_USE_TYPE_SPECS
260 #define CYTHON_USE_TYPE_SPECS 0
262 #undef CYTHON_USE_PYTYPE_LOOKUP
263 #define CYTHON_USE_PYTYPE_LOOKUP 0
264 #ifndef CYTHON_USE_ASYNC_SLOTS
265 #define CYTHON_USE_ASYNC_SLOTS 1
267 #ifndef CYTHON_USE_PYLONG_INTERNALS
268 #define CYTHON_USE_PYLONG_INTERNALS 0
270 #undef CYTHON_USE_PYLIST_INTERNALS
271 #define CYTHON_USE_PYLIST_INTERNALS 0
272 #ifndef CYTHON_USE_UNICODE_INTERNALS
273 #define CYTHON_USE_UNICODE_INTERNALS 1
275 #undef CYTHON_USE_UNICODE_WRITER
276 #define CYTHON_USE_UNICODE_WRITER 0
277 #ifndef CYTHON_AVOID_BORROWED_REFS
278 #define CYTHON_AVOID_BORROWED_REFS 0
280 #ifndef CYTHON_ASSUME_SAFE_MACROS
281 #define CYTHON_ASSUME_SAFE_MACROS 1
283 #ifndef CYTHON_UNPACK_METHODS
284 #define CYTHON_UNPACK_METHODS 1
286 #undef CYTHON_FAST_THREAD_STATE
287 #define CYTHON_FAST_THREAD_STATE 0
288 #undef CYTHON_FAST_GIL
289 #define CYTHON_FAST_GIL 0
290 #ifndef CYTHON_METH_FASTCALL
291 #define CYTHON_METH_FASTCALL 1
293 #undef CYTHON_FAST_PYCALL
294 #define CYTHON_FAST_PYCALL 0
295 #ifndef CYTHON_PEP487_INIT_SUBCLASS
296 #define CYTHON_PEP487_INIT_SUBCLASS 1
298 #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
299 #define CYTHON_PEP489_MULTI_PHASE_INIT 1
301 #ifndef CYTHON_USE_MODULE_STATE
302 #define CYTHON_USE_MODULE_STATE 0
304 #ifndef CYTHON_USE_TP_FINALIZE
305 #define CYTHON_USE_TP_FINALIZE 1
307 #undef CYTHON_USE_DICT_VERSIONS
308 #define CYTHON_USE_DICT_VERSIONS 0
309 #undef CYTHON_USE_EXC_INFO_STACK
310 #define CYTHON_USE_EXC_INFO_STACK 0
311 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
312 #define CYTHON_UPDATE_DESCRIPTOR_DOC 1
314 #ifndef CYTHON_USE_FREELISTS
315 #define CYTHON_USE_FREELISTS 0
318 #define CYTHON_COMPILING_IN_PYPY 0
319 #define CYTHON_COMPILING_IN_CPYTHON 1
320 #define CYTHON_COMPILING_IN_LIMITED_API 0
321 #define CYTHON_COMPILING_IN_GRAAL 0
322 #define CYTHON_COMPILING_IN_NOGIL 0
323 #ifndef CYTHON_USE_TYPE_SLOTS
324 #define CYTHON_USE_TYPE_SLOTS 1
326 #ifndef CYTHON_USE_TYPE_SPECS
327 #define CYTHON_USE_TYPE_SPECS 0
329 #ifndef CYTHON_USE_PYTYPE_LOOKUP
330 #define CYTHON_USE_PYTYPE_LOOKUP 1
332 #if PY_MAJOR_VERSION < 3
333 #undef CYTHON_USE_ASYNC_SLOTS
334 #define CYTHON_USE_ASYNC_SLOTS 0
335 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
336 #define CYTHON_USE_ASYNC_SLOTS 1
338 #ifndef CYTHON_USE_PYLONG_INTERNALS
339 #define CYTHON_USE_PYLONG_INTERNALS 1
341 #ifndef CYTHON_USE_PYLIST_INTERNALS
342 #define CYTHON_USE_PYLIST_INTERNALS 1
344 #ifndef CYTHON_USE_UNICODE_INTERNALS
345 #define CYTHON_USE_UNICODE_INTERNALS 1
347 #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2
348 #undef CYTHON_USE_UNICODE_WRITER
349 #define CYTHON_USE_UNICODE_WRITER 0
350 #elif !defined(CYTHON_USE_UNICODE_WRITER)
351 #define CYTHON_USE_UNICODE_WRITER 1
353 #ifndef CYTHON_AVOID_BORROWED_REFS
354 #define CYTHON_AVOID_BORROWED_REFS 0
356 #ifndef CYTHON_ASSUME_SAFE_MACROS
357 #define CYTHON_ASSUME_SAFE_MACROS 1
359 #ifndef CYTHON_UNPACK_METHODS
360 #define CYTHON_UNPACK_METHODS 1
362 #ifndef CYTHON_FAST_THREAD_STATE
363 #define CYTHON_FAST_THREAD_STATE 1
365 #ifndef CYTHON_FAST_GIL
366 #define CYTHON_FAST_GIL (PY_MAJOR_VERSION < 3 || PY_VERSION_HEX >= 0x03060000 && PY_VERSION_HEX < 0x030C00A6)
368 #ifndef CYTHON_METH_FASTCALL
369 #define CYTHON_METH_FASTCALL (PY_VERSION_HEX >= 0x030700A1)
371 #ifndef CYTHON_FAST_PYCALL
372 #define CYTHON_FAST_PYCALL 1
374 #ifndef CYTHON_PEP487_INIT_SUBCLASS
375 #define CYTHON_PEP487_INIT_SUBCLASS 1
377 #if PY_VERSION_HEX < 0x03050000
378 #undef CYTHON_PEP489_MULTI_PHASE_INIT
379 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
380 #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT)
381 #define CYTHON_PEP489_MULTI_PHASE_INIT 1
383 #ifndef CYTHON_USE_MODULE_STATE
384 #define CYTHON_USE_MODULE_STATE 0
386 #if PY_VERSION_HEX < 0x030400a1
387 #undef CYTHON_USE_TP_FINALIZE
388 #define CYTHON_USE_TP_FINALIZE 0
389 #elif !defined(CYTHON_USE_TP_FINALIZE)
390 #define CYTHON_USE_TP_FINALIZE 1
392 #if PY_VERSION_HEX < 0x030600B1
393 #undef CYTHON_USE_DICT_VERSIONS
394 #define CYTHON_USE_DICT_VERSIONS 0
395 #elif !defined(CYTHON_USE_DICT_VERSIONS)
396 #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX < 0x030C00A5)
398 #if PY_VERSION_HEX < 0x030700A3
399 #undef CYTHON_USE_EXC_INFO_STACK
400 #define CYTHON_USE_EXC_INFO_STACK 0
401 #elif !defined(CYTHON_USE_EXC_INFO_STACK)
402 #define CYTHON_USE_EXC_INFO_STACK 1
404 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
405 #define CYTHON_UPDATE_DESCRIPTOR_DOC 1
407 #ifndef CYTHON_USE_FREELISTS
408 #define CYTHON_USE_FREELISTS 1
411#if !defined(CYTHON_FAST_PYCCALL)
412#define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
414#if !defined(CYTHON_VECTORCALL)
415#define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL && PY_VERSION_HEX >= 0x030800B1)
417#define CYTHON_BACKPORT_VECTORCALL (CYTHON_METH_FASTCALL && PY_VERSION_HEX < 0x030800B1)
418#if CYTHON_USE_PYLONG_INTERNALS
419 #if PY_MAJOR_VERSION < 3
420 #include "longintrepr.h"
426 enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P ==
sizeof(
void*)) };
429#ifndef __has_attribute
430 #define __has_attribute(x) 0
432#ifndef __has_cpp_attribute
433 #define __has_cpp_attribute(x) 0
435#ifndef CYTHON_RESTRICT
436 #if defined(__GNUC__)
437 #define CYTHON_RESTRICT __restrict__
438 #elif defined(_MSC_VER) && _MSC_VER >= 1400
439 #define CYTHON_RESTRICT __restrict
440 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
441 #define CYTHON_RESTRICT restrict
443 #define CYTHON_RESTRICT
447 #if defined(__cplusplus)
450 #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
451 #if __has_cpp_attribute(maybe_unused)
452 #define CYTHON_UNUSED [[maybe_unused]]
458# if defined(__GNUC__)
459# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
460# define CYTHON_UNUSED __attribute__ ((__unused__))
462# define CYTHON_UNUSED
464# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
465# define CYTHON_UNUSED __attribute__ ((__unused__))
467# define CYTHON_UNUSED
470#ifndef CYTHON_UNUSED_VAR
471# if defined(__cplusplus)
472 template<
class T>
void CYTHON_UNUSED_VAR(
const T& ) { }
474# define CYTHON_UNUSED_VAR(x) (void)(x)
477#ifndef CYTHON_MAYBE_UNUSED_VAR
478 #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x)
480#ifndef CYTHON_NCP_UNUSED
481# if CYTHON_COMPILING_IN_CPYTHON
482# define CYTHON_NCP_UNUSED
484# define CYTHON_NCP_UNUSED CYTHON_UNUSED
487#ifndef CYTHON_USE_CPP_STD_MOVE
488 #if defined(__cplusplus) && (\
489 __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600))
490 #define CYTHON_USE_CPP_STD_MOVE 1
492 #define CYTHON_USE_CPP_STD_MOVE 0
495#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
497 #ifndef _MSC_STDINT_H_
499 typedef unsigned char uint8_t;
500 typedef unsigned short uint16_t;
501 typedef unsigned int uint32_t;
503 typedef unsigned __int8 uint8_t;
504 typedef unsigned __int16 uint16_t;
505 typedef unsigned __int32 uint32_t;
510 typedef unsigned long long __pyx_uintptr_t;
512 typedef unsigned int __pyx_uintptr_t;
516 typedef unsigned __int64 __pyx_uintptr_t;
518 typedef unsigned __int32 __pyx_uintptr_t;
523 typedef uintptr_t __pyx_uintptr_t;
525#ifndef CYTHON_FALLTHROUGH
526 #if defined(__cplusplus)
529 #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
530 #if __has_cpp_attribute(fallthrough)
531 #define CYTHON_FALLTHROUGH [[fallthrough]]
534 #ifndef CYTHON_FALLTHROUGH
535 #if __has_cpp_attribute(clang::fallthrough)
536 #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
537 #elif __has_cpp_attribute(gnu::fallthrough)
538 #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
542 #ifndef CYTHON_FALLTHROUGH
543 #if __has_attribute(fallthrough)
544 #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
546 #define CYTHON_FALLTHROUGH
549 #if defined(__clang__) && defined(__apple_build_version__)
550 #if __apple_build_version__ < 7000000
551 #undef CYTHON_FALLTHROUGH
552 #define CYTHON_FALLTHROUGH
557 template <
typename T>
558 struct __PYX_IS_UNSIGNED_IMPL {
static const bool value = T(0) < T(-1);};
559 #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL<type>::value)
561 #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0)
563#if CYTHON_COMPILING_IN_PYPY == 1
564 #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x030A0000)
566 #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000)
568#define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer))
571 #error "Cython files generated with the C++ option must be compiled with a C++ compiler."
574 #if defined(__clang__)
575 #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
577 #define CYTHON_INLINE inline
581void __Pyx_call_destructor(T& x) {
585class __Pyx_FakeReference {
587 __Pyx_FakeReference() : ptr(NULL) { }
588 __Pyx_FakeReference(
const T& ref) : ptr(const_cast<T*>(&ref)) { }
589 T *operator->() {
return ptr; }
590 T *operator&() {
return ptr; }
591 operator T&() {
return *ptr; }
592 template<
typename U>
bool operator ==(
const U& other)
const {
return *ptr == other; }
593 template<
typename U>
bool operator !=(
const U& other)
const {
return *ptr != other; }
594 template<
typename U>
bool operator==(
const __Pyx_FakeReference<U>& other)
const {
return *ptr == *other.ptr; }
595 template<
typename U>
bool operator!=(
const __Pyx_FakeReference<U>& other)
const {
return *ptr != *other.ptr; }
600#define __PYX_BUILD_PY_SSIZE_T "n"
601#define CYTHON_FORMAT_SSIZE_T "z"
602#if PY_MAJOR_VERSION < 3
603 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
604 #define __Pyx_DefaultClassType PyClass_Type
605 #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
606 PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
608 #define __Pyx_BUILTIN_MODULE_NAME "builtins"
609 #define __Pyx_DefaultClassType PyType_Type
610#if CYTHON_COMPILING_IN_LIMITED_API
611 static CYTHON_INLINE PyObject* __Pyx_PyCode_New(
int a,
int p,
int k,
int l,
int s,
int f,
612 PyObject *code, PyObject *c, PyObject* n, PyObject *v,
613 PyObject *fv, PyObject *cell, PyObject* fn,
614 PyObject *name,
int fline, PyObject *lnos) {
615 PyObject *exception_table = NULL;
616 PyObject *types_module=NULL, *code_type=NULL, *result=NULL;
617 #if __PYX_LIMITED_VERSION_HEX < 0x030B0000
618 PyObject *version_info;
619 PyObject *py_minor_version = NULL;
621 long minor_version = 0;
622 PyObject *type, *value, *traceback;
623 PyErr_Fetch(&type, &value, &traceback);
624 #if __PYX_LIMITED_VERSION_HEX >= 0x030B0000
627 if (!(version_info = PySys_GetObject(
"version_info")))
goto end;
628 if (!(py_minor_version = PySequence_GetItem(version_info, 1)))
goto end;
629 minor_version = PyLong_AsLong(py_minor_version);
630 Py_DECREF(py_minor_version);
631 if (minor_version == -1 && PyErr_Occurred())
goto end;
633 if (!(types_module = PyImport_ImportModule(
"types")))
goto end;
634 if (!(code_type = PyObject_GetAttrString(types_module,
"CodeType")))
goto end;
635 if (minor_version <= 7) {
637 result = PyObject_CallFunction(code_type,
"iiiiiOOOOOOiOO", a, k, l, s, f, code,
638 c, n, v, fn, name, fline, lnos, fv, cell);
639 }
else if (minor_version <= 10) {
640 result = PyObject_CallFunction(code_type,
"iiiiiiOOOOOOiOO", a,p, k, l, s, f, code,
641 c, n, v, fn, name, fline, lnos, fv, cell);
643 if (!(exception_table = PyBytes_FromStringAndSize(NULL, 0)))
goto end;
644 result = PyObject_CallFunction(code_type,
"iiiiiiOOOOOOOiOO", a,p, k, l, s, f, code,
645 c, n, v, fn, name, name, fline, lnos, exception_table, fv, cell);
648 Py_XDECREF(code_type);
649 Py_XDECREF(exception_table);
650 Py_XDECREF(types_module);
652 PyErr_Restore(type, value, traceback);
657 #define CO_OPTIMIZED 0x0001
660 #define CO_NEWLOCALS 0x0002
663 #define CO_VARARGS 0x0004
665 #ifndef CO_VARKEYWORDS
666 #define CO_VARKEYWORDS 0x0008
668 #ifndef CO_ASYNC_GENERATOR
669 #define CO_ASYNC_GENERATOR 0x0200
672 #define CO_GENERATOR 0x0020
675 #define CO_COROUTINE 0x0080
677#elif PY_VERSION_HEX >= 0x030B0000
678 static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(
int a,
int p,
int k,
int l,
int s,
int f,
679 PyObject *code, PyObject *c, PyObject* n, PyObject *v,
680 PyObject *fv, PyObject *cell, PyObject* fn,
681 PyObject *name,
int fline, PyObject *lnos) {
682 PyCodeObject *result;
683 PyObject *empty_bytes = PyBytes_FromStringAndSize(
"", 0);
684 if (!empty_bytes)
return NULL;
686 #if PY_VERSION_HEX >= 0x030C0000
687 PyUnstable_Code_NewWithPosOnlyArgs
689 PyCode_NewWithPosOnlyArgs
691 (a, p, k, l, s, f, code, c, n, v, fv, cell, fn,
name,
name, fline, lnos, empty_bytes);
692 Py_DECREF(empty_bytes);
695#elif PY_VERSION_HEX >= 0x030800B2 && !CYTHON_COMPILING_IN_PYPY
696 #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
697 PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
699 #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
700 PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
703#if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE)
704 #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type)
706 #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type))
708#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is)
709 #define __Pyx_Py_Is(x, y) Py_Is(x, y)
711 #define __Pyx_Py_Is(x, y) ((x) == (y))
713#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone)
714 #define __Pyx_Py_IsNone(ob) Py_IsNone(ob)
716 #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None)
718#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue)
719 #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob)
721 #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True)
723#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse)
724 #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob)
726 #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False)
728#define __Pyx_NoneAsNull(obj) (__Pyx_Py_IsNone(obj) ? NULL : (obj))
729#if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY
730 #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o)
732 #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o)
735 #define CO_COROUTINE 0x80
737#ifndef CO_ASYNC_GENERATOR
738 #define CO_ASYNC_GENERATOR 0x200
740#ifndef Py_TPFLAGS_CHECKTYPES
741 #define Py_TPFLAGS_CHECKTYPES 0
743#ifndef Py_TPFLAGS_HAVE_INDEX
744 #define Py_TPFLAGS_HAVE_INDEX 0
746#ifndef Py_TPFLAGS_HAVE_NEWBUFFER
747 #define Py_TPFLAGS_HAVE_NEWBUFFER 0
749#ifndef Py_TPFLAGS_HAVE_FINALIZE
750 #define Py_TPFLAGS_HAVE_FINALIZE 0
752#ifndef Py_TPFLAGS_SEQUENCE
753 #define Py_TPFLAGS_SEQUENCE 0
755#ifndef Py_TPFLAGS_MAPPING
756 #define Py_TPFLAGS_MAPPING 0
758#ifndef METH_STACKLESS
759 #define METH_STACKLESS 0
761#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
762 #ifndef METH_FASTCALL
763 #define METH_FASTCALL 0x80
765 typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *
const *args, Py_ssize_t nargs);
766 typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *
const *args,
767 Py_ssize_t nargs, PyObject *kwnames);
769 #if PY_VERSION_HEX >= 0x030d00A4
770 # define __Pyx_PyCFunctionFast PyCFunctionFast
771 # define __Pyx_PyCFunctionFastWithKeywords PyCFunctionFastWithKeywords
773 # define __Pyx_PyCFunctionFast _PyCFunctionFast
774 # define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
777#if CYTHON_METH_FASTCALL
778 #define __Pyx_METH_FASTCALL METH_FASTCALL
779 #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast
780 #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords
782 #define __Pyx_METH_FASTCALL METH_VARARGS
783 #define __Pyx_PyCFunction_FastCall PyCFunction
784 #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords
787 #define __pyx_vectorcallfunc vectorcallfunc
788 #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET
789 #define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n))
790#elif CYTHON_BACKPORT_VECTORCALL
791 typedef PyObject *(*__pyx_vectorcallfunc)(PyObject *callable, PyObject *
const *args,
792 size_t nargsf, PyObject *kwnames);
793 #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET ((size_t)1 << (8 * sizeof(size_t) - 1))
794 #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(((size_t)(n)) & ~__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET))
796 #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0
797 #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n))
799#if PY_MAJOR_VERSION >= 0x030900B1
800#define __Pyx_PyCFunction_CheckExact(func) PyCFunction_CheckExact(func)
802#define __Pyx_PyCFunction_CheckExact(func) PyCFunction_Check(func)
804#define __Pyx_CyOrPyCFunction_Check(func) PyCFunction_Check(func)
805#if CYTHON_COMPILING_IN_CPYTHON
806#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) (((PyCFunctionObject*)(func))->m_ml->ml_meth)
807#elif !CYTHON_COMPILING_IN_LIMITED_API
808#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) PyCFunction_GET_FUNCTION(func)
810#if CYTHON_COMPILING_IN_CPYTHON
811#define __Pyx_CyOrPyCFunction_GET_FLAGS(func) (((PyCFunctionObject*)(func))->m_ml->ml_flags)
812static CYTHON_INLINE PyObject* __Pyx_CyOrPyCFunction_GET_SELF(PyObject *func) {
813 return (__Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_STATIC) ? NULL : ((PyCFunctionObject*)func)->m_self;
816static CYTHON_INLINE
int __Pyx__IsSameCFunction(PyObject *func,
void *cfunc) {
817#if CYTHON_COMPILING_IN_LIMITED_API
818 return PyCFunction_Check(func) && PyCFunction_GetFunction(func) == (PyCFunction) cfunc;
820 return PyCFunction_Check(func) && PyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc;
823#define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCFunction(func, cfunc)
824#if __PYX_LIMITED_VERSION_HEX < 0x030900B1
825 #define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b))
826 typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *
const *, size_t, PyObject *);
828 #define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b)
829 #define __Pyx_PyCMethod PyCMethod
832 #define METH_METHOD 0x200
834#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
835 #define PyObject_Malloc(s) PyMem_Malloc(s)
836 #define PyObject_Free(p) PyMem_Free(p)
837 #define PyObject_Realloc(p) PyMem_Realloc(p)
839#if CYTHON_COMPILING_IN_LIMITED_API
840 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
841 #define __Pyx_PyFrame_SetLineNumber(frame, lineno)
843 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
844 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
846#if CYTHON_COMPILING_IN_LIMITED_API
847 #define __Pyx_PyThreadState_Current PyThreadState_Get()
848#elif !CYTHON_FAST_THREAD_STATE
849 #define __Pyx_PyThreadState_Current PyThreadState_GET()
850#elif PY_VERSION_HEX >= 0x030d00A1
851 #define __Pyx_PyThreadState_Current PyThreadState_GetUnchecked()
852#elif PY_VERSION_HEX >= 0x03060000
853 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
854#elif PY_VERSION_HEX >= 0x03000000
855 #define __Pyx_PyThreadState_Current PyThreadState_GET()
857 #define __Pyx_PyThreadState_Current _PyThreadState_Current
859#if CYTHON_COMPILING_IN_LIMITED_API
860static CYTHON_INLINE
void *__Pyx_PyModule_GetState(PyObject *op)
863 result = PyModule_GetState(op);
865 Py_FatalError(
"Couldn't find the module state");
869#define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE(obj), name, func_ctype)
870#if CYTHON_COMPILING_IN_LIMITED_API
871 #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name))
873 #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name)
875#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
877#define Py_tss_NEEDS_INIT 0
879static CYTHON_INLINE
int PyThread_tss_create(Py_tss_t *key) {
880 *key = PyThread_create_key();
883static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(
void) {
884 Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(
sizeof(Py_tss_t));
885 *key = Py_tss_NEEDS_INIT;
888static CYTHON_INLINE
void PyThread_tss_free(Py_tss_t *key) {
891static CYTHON_INLINE
int PyThread_tss_is_created(Py_tss_t *key) {
892 return *key != Py_tss_NEEDS_INIT;
894static CYTHON_INLINE
void PyThread_tss_delete(Py_tss_t *key) {
895 PyThread_delete_key(*key);
896 *key = Py_tss_NEEDS_INIT;
898static CYTHON_INLINE
int PyThread_tss_set(Py_tss_t *key,
void *value) {
899 return PyThread_set_key_value(*key, value);
901static CYTHON_INLINE
void * PyThread_tss_get(Py_tss_t *key) {
902 return PyThread_get_key_value(*key);
905#if PY_MAJOR_VERSION < 3
906 #if CYTHON_COMPILING_IN_PYPY
907 #if PYPY_VERSION_NUM < 0x07030600
908 #if defined(__cplusplus) && __cplusplus >= 201402L
909 [[deprecated(
"`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")]]
910 #elif defined(__GNUC__) || defined(__clang__)
911 __attribute__ ((__deprecated__(
"`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")))
912 #elif defined(_MSC_VER)
913 __declspec(deprecated(
"`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6"))
915 static CYTHON_INLINE
int PyGILState_Check(
void) {
921 static CYTHON_INLINE
int PyGILState_Check(
void) {
922 PyThreadState * tstate = _PyThreadState_Current;
923 return tstate && (tstate == PyGILState_GetThisThreadState());
927#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000 || defined(_PyDict_NewPresized)
928#define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
930#define __Pyx_PyDict_NewPresized(n) PyDict_New()
932#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
933 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
934 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
936 #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
937 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
939#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030600B4 && PY_VERSION_HEX < 0x030d0000 && CYTHON_USE_UNICODE_INTERNALS
940#define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
941static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) {
942 PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name);
943 if (res == NULL) PyErr_Clear();
946#elif PY_MAJOR_VERSION >= 3 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000)
947#define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError
948#define __Pyx_PyDict_GetItemStr PyDict_GetItem
950static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) {
951#if CYTHON_COMPILING_IN_PYPY
952 return PyDict_GetItem(dict, name);
955 PyDictObject *mp = (PyDictObject*) dict;
956 long hash = ((PyStringObject *) name)->ob_shash;
958 ep = (mp->ma_lookup)(mp, name, hash);
965#define __Pyx_PyDict_GetItemStr PyDict_GetItem
967#if CYTHON_USE_TYPE_SLOTS
968 #define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags)
969 #define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0)
970 #define __Pyx_PyObject_GetIterNextFunc(obj) (Py_TYPE(obj)->tp_iternext)
972 #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp))
973 #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature)
974 #define __Pyx_PyObject_GetIterNextFunc(obj) PyIter_Next
976#if CYTHON_COMPILING_IN_LIMITED_API
977 #define __Pyx_SetItemOnTypeDict(tp, k, v) PyObject_GenericSetAttr((PyObject*)tp, k, v)
979 #define __Pyx_SetItemOnTypeDict(tp, k, v) PyDict_SetItem(tp->tp_dict, k, v)
981#if CYTHON_USE_TYPE_SPECS && PY_VERSION_HEX >= 0x03080000
982#define __Pyx_PyHeapTypeObject_GC_Del(obj) {\
983 PyTypeObject *type = Py_TYPE((PyObject*)obj);\
984 assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\
985 PyObject_GC_Del(obj);\
989#define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj)
991#if CYTHON_COMPILING_IN_LIMITED_API
992 #define CYTHON_PEP393_ENABLED 1
993 #define __Pyx_PyUnicode_READY(op) (0)
994 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GetLength(u)
995 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i)
996 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111U)
997 #define __Pyx_PyUnicode_KIND(u) ((void)u, (0))
998 #define __Pyx_PyUnicode_DATA(u) ((void*)u)
999 #define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i))
1000 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u))
1001#elif PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
1002 #define CYTHON_PEP393_ENABLED 1
1003 #if PY_VERSION_HEX >= 0x030C0000
1004 #define __Pyx_PyUnicode_READY(op) (0)
1006 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
1007 0 : _PyUnicode_Ready((PyObject *)(op)))
1009 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
1010 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
1011 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
1012 #define __Pyx_PyUnicode_KIND(u) ((int)PyUnicode_KIND(u))
1013 #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
1014 #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
1015 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, (Py_UCS4) ch)
1016 #if PY_VERSION_HEX >= 0x030C0000
1017 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u))
1019 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
1020 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
1022 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
1026 #define CYTHON_PEP393_ENABLED 0
1027 #define PyUnicode_1BYTE_KIND 1
1028 #define PyUnicode_2BYTE_KIND 2
1029 #define PyUnicode_4BYTE_KIND 4
1030 #define __Pyx_PyUnicode_READY(op) (0)
1031 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
1032 #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
1033 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535U : 1114111U)
1034 #define __Pyx_PyUnicode_KIND(u) ((int)sizeof(Py_UNICODE))
1035 #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
1036 #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
1037 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = (Py_UNICODE) ch)
1038 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
1040#if CYTHON_COMPILING_IN_PYPY
1041 #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
1042 #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
1044 #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
1045 #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
1046 PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
1048#if CYTHON_COMPILING_IN_PYPY
1049 #if !defined(PyUnicode_DecodeUnicodeEscape)
1050 #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors)
1052 #if !defined(PyUnicode_Contains) || (PY_MAJOR_VERSION == 2 && PYPY_VERSION_NUM < 0x07030500)
1053 #undef PyUnicode_Contains
1054 #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
1056 #if !defined(PyByteArray_Check)
1057 #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
1059 #if !defined(PyObject_Format)
1060 #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
1063#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
1064#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
1065#if PY_MAJOR_VERSION >= 3
1066 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
1068 #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
1070#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
1071 #define PyObject_ASCII(o) PyObject_Repr(o)
1073#if PY_MAJOR_VERSION >= 3
1074 #define PyBaseString_Type PyUnicode_Type
1075 #define PyStringObject PyUnicodeObject
1076 #define PyString_Type PyUnicode_Type
1077 #define PyString_Check PyUnicode_Check
1078 #define PyString_CheckExact PyUnicode_CheckExact
1079#ifndef PyObject_Unicode
1080 #define PyObject_Unicode PyObject_Str
1083#if PY_MAJOR_VERSION >= 3
1084 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
1085 #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
1087 #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
1088 #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
1090#if CYTHON_COMPILING_IN_CPYTHON
1091 #define __Pyx_PySequence_ListKeepNew(obj)\
1092 (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj))
1094 #define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj)
1096#ifndef PySet_CheckExact
1097 #define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type)
1099#if PY_VERSION_HEX >= 0x030900A4
1100 #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
1101 #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
1103 #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
1104 #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
1106#if CYTHON_ASSUME_SAFE_MACROS
1107 #define __Pyx_PySequence_ITEM(o, i) PySequence_ITEM(o, i)
1108 #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
1109 #define __Pyx_PyTuple_SET_ITEM(o, i, v) (PyTuple_SET_ITEM(o, i, v), (0))
1110 #define __Pyx_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0))
1111 #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_GET_SIZE(o)
1112 #define __Pyx_PyList_GET_SIZE(o) PyList_GET_SIZE(o)
1113 #define __Pyx_PySet_GET_SIZE(o) PySet_GET_SIZE(o)
1114 #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_GET_SIZE(o)
1115 #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_GET_SIZE(o)
1117 #define __Pyx_PySequence_ITEM(o, i) PySequence_GetItem(o, i)
1118 #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
1119 #define __Pyx_PyTuple_SET_ITEM(o, i, v) PyTuple_SetItem(o, i, v)
1120 #define __Pyx_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v)
1121 #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_Size(o)
1122 #define __Pyx_PyList_GET_SIZE(o) PyList_Size(o)
1123 #define __Pyx_PySet_GET_SIZE(o) PySet_Size(o)
1124 #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_Size(o)
1125 #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_Size(o)
1127#if __PYX_LIMITED_VERSION_HEX >= 0x030d00A1
1128 #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name)
1130 static CYTHON_INLINE PyObject *__Pyx_PyImport_AddModuleRef(
const char *name) {
1131 PyObject *
module = PyImport_AddModule(name);
1136#if PY_MAJOR_VERSION >= 3
1137 #define PyIntObject PyLongObject
1138 #define PyInt_Type PyLong_Type
1139 #define PyInt_Check(op) PyLong_Check(op)
1140 #define PyInt_CheckExact(op) PyLong_CheckExact(op)
1141 #define __Pyx_Py3Int_Check(op) PyLong_Check(op)
1142 #define __Pyx_Py3Int_CheckExact(op) PyLong_CheckExact(op)
1143 #define PyInt_FromString PyLong_FromString
1144 #define PyInt_FromUnicode PyLong_FromUnicode
1145 #define PyInt_FromLong PyLong_FromLong
1146 #define PyInt_FromSize_t PyLong_FromSize_t
1147 #define PyInt_FromSsize_t PyLong_FromSsize_t
1148 #define PyInt_AsLong PyLong_AsLong
1149 #define PyInt_AS_LONG PyLong_AS_LONG
1150 #define PyInt_AsSsize_t PyLong_AsSsize_t
1151 #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
1152 #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
1153 #define PyNumber_Int PyNumber_Long
1155 #define __Pyx_Py3Int_Check(op) (PyLong_Check(op) || PyInt_Check(op))
1156 #define __Pyx_Py3Int_CheckExact(op) (PyLong_CheckExact(op) || PyInt_CheckExact(op))
1158#if PY_MAJOR_VERSION >= 3
1159 #define PyBoolObject PyLongObject
1161#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
1162 #ifndef PyUnicode_InternFromString
1163 #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
1166#if PY_VERSION_HEX < 0x030200A4
1167 typedef long Py_hash_t;
1168 #define __Pyx_PyInt_FromHash_t PyInt_FromLong
1169 #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t
1171 #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
1172 #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t
1174#if CYTHON_USE_ASYNC_SLOTS
1175 #if PY_VERSION_HEX >= 0x030500B1
1176 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
1177 #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
1179 #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
1182 #define __Pyx_PyType_AsAsync(obj) NULL
1184#ifndef __Pyx_PyAsyncMethodsStruct
1189 } __Pyx_PyAsyncMethodsStruct;
1192#if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)
1193 #if !defined(_USE_MATH_DEFINES)
1194 #define _USE_MATH_DEFINES
1199#define __PYX_NAN() ((float) NAN)
1201static CYTHON_INLINE
float __PYX_NAN() {
1203 memset(&value, 0xFF,
sizeof(value));
1207#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
1208#define __Pyx_truncl trunc
1210#define __Pyx_truncl truncl
1213#define __PYX_MARK_ERR_POS(f_index, lineno) \
1214 { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
1215#define __PYX_ERR(f_index, lineno, Ln_error) \
1216 { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
1218#ifdef CYTHON_EXTERN_C
1219 #undef __PYX_EXTERN_C
1220 #define __PYX_EXTERN_C CYTHON_EXTERN_C
1221#elif defined(__PYX_EXTERN_C)
1223 #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.")
1225 #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.
1228 #define __PYX_EXTERN_C extern "C++"
1231#define __PYX_HAVE__eventhooks
1232#define __PYX_HAVE_API__eventhooks
1238#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
1239#define CYTHON_WITHOUT_ASSERTIONS
1242typedef struct {PyObject **p;
const char *s;
const Py_ssize_t n;
const char* encoding;
1243 const char is_unicode;
const char is_str;
const char intern; } __Pyx_StringTabEntry;
1245#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
1246#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
1247#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
1248#define __PYX_DEFAULT_STRING_ENCODING ""
1249#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
1250#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
1251#define __Pyx_uchar_cast(c) ((unsigned char)c)
1252#define __Pyx_long_cast(x) ((long)x)
1253#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
1254 (sizeof(type) < sizeof(Py_ssize_t)) ||\
1255 (sizeof(type) > sizeof(Py_ssize_t) &&\
1256 likely(v < (type)PY_SSIZE_T_MAX ||\
1257 v == (type)PY_SSIZE_T_MAX) &&\
1258 (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
1259 v == (type)PY_SSIZE_T_MIN))) ||\
1260 (sizeof(type) == sizeof(Py_ssize_t) &&\
1261 (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
1262 v == (type)PY_SSIZE_T_MAX))) )
1263static CYTHON_INLINE
int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
1264 return (
size_t) i < (size_t) limit;
1266#if defined (__cplusplus) && __cplusplus >= 201103L
1268 #define __Pyx_sst_abs(value) std::abs(value)
1269#elif SIZEOF_INT >= SIZEOF_SIZE_T
1270 #define __Pyx_sst_abs(value) abs(value)
1271#elif SIZEOF_LONG >= SIZEOF_SIZE_T
1272 #define __Pyx_sst_abs(value) labs(value)
1273#elif defined (_MSC_VER)
1274 #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
1275#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
1276 #define __Pyx_sst_abs(value) llabs(value)
1277#elif defined (__GNUC__)
1278 #define __Pyx_sst_abs(value) __builtin_llabs(value)
1280 #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
1282static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(
const char *s);
1283static CYTHON_INLINE
const char* __Pyx_PyObject_AsString(PyObject*);
1284static CYTHON_INLINE
const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
1285static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(
const char*);
1286#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
1287#define __Pyx_PyBytes_FromString PyBytes_FromString
1288#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
1289static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(
const char*);
1290#if PY_MAJOR_VERSION < 3
1291 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
1292 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
1294 #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
1295 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
1297#define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
1298#define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
1299#define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
1300#define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
1301#define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
1302#define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
1303#define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
1304#define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
1305#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
1306#define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
1307#define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
1308#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
1309#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
1310#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
1311#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
1312#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
1313#define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o)
1314#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
1315#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
1316#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
1317static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(
long b);
1318static CYTHON_INLINE
int __Pyx_PyObject_IsTrue(PyObject*);
1319static CYTHON_INLINE
int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
1320static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
1321#define __Pyx_PySequence_Tuple(obj)\
1322 (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
1323static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
1324static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(
size_t);
1325static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*);
1326#if CYTHON_ASSUME_SAFE_MACROS
1327#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
1329#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
1331#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
1332#if PY_MAJOR_VERSION >= 3
1333#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
1335#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
1337#if CYTHON_USE_PYLONG_INTERNALS
1338 #if PY_VERSION_HEX >= 0x030C00A7
1339 #ifndef _PyLong_SIGN_MASK
1340 #define _PyLong_SIGN_MASK 3
1342 #ifndef _PyLong_NON_SIZE_BITS
1343 #define _PyLong_NON_SIZE_BITS 3
1345 #define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK)
1346 #define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0)
1347 #define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x))
1348 #define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1)
1349 #define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0)
1350 #define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0])
1351 #define __Pyx_PyLong_DigitCount(x) ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS))
1352 #define __Pyx_PyLong_SignedDigitCount(x)\
1353 ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x))
1354 #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue)
1355 #define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x)
1356 #define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x)
1358 #define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS))
1359 #define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0])
1361 typedef Py_ssize_t __Pyx_compact_pylong;
1362 typedef size_t __Pyx_compact_upylong;
1364 #define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0)
1365 #define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0)
1366 #define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0)
1367 #define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0)
1368 #define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0])
1369 #define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x))
1370 #define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x)
1371 #define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1)
1372 #define __Pyx_PyLong_CompactValue(x)\
1373 ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0]))
1374 typedef sdigit __Pyx_compact_pylong;
1375 typedef digit __Pyx_compact_upylong;
1377 #if PY_VERSION_HEX >= 0x030C00A5
1378 #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit)
1380 #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit)
1383#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
1385static int __Pyx_sys_getdefaultencoding_not_ascii;
1386static int __Pyx_init_sys_getdefaultencoding_params(
void) {
1388 PyObject* default_encoding = NULL;
1389 PyObject* ascii_chars_u = NULL;
1390 PyObject* ascii_chars_b = NULL;
1391 const char* default_encoding_c;
1392 sys = PyImport_ImportModule(
"sys");
1394 default_encoding = PyObject_CallMethod(sys, (
char*)
"getdefaultencoding", NULL);
1396 if (!default_encoding)
goto bad;
1397 default_encoding_c = PyBytes_AsString(default_encoding);
1398 if (!default_encoding_c)
goto bad;
1399 if (strcmp(default_encoding_c,
"ascii") == 0) {
1400 __Pyx_sys_getdefaultencoding_not_ascii = 0;
1402 char ascii_chars[128];
1404 for (c = 0; c < 128; c++) {
1405 ascii_chars[c] = (char) c;
1407 __Pyx_sys_getdefaultencoding_not_ascii = 1;
1408 ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
1409 if (!ascii_chars_u)
goto bad;
1410 ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
1411 if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
1414 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
1415 default_encoding_c);
1418 Py_DECREF(ascii_chars_u);
1419 Py_DECREF(ascii_chars_b);
1421 Py_DECREF(default_encoding);
1424 Py_XDECREF(default_encoding);
1425 Py_XDECREF(ascii_chars_u);
1426 Py_XDECREF(ascii_chars_b);
1430#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
1431#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
1433#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
1434#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
1436static char* __PYX_DEFAULT_STRING_ENCODING;
1437static int __Pyx_init_sys_getdefaultencoding_params(
void) {
1439 PyObject* default_encoding = NULL;
1440 char* default_encoding_c;
1441 sys = PyImport_ImportModule(
"sys");
1443 default_encoding = PyObject_CallMethod(sys, (
char*) (
const char*)
"getdefaultencoding", NULL);
1445 if (!default_encoding)
goto bad;
1446 default_encoding_c = PyBytes_AsString(default_encoding);
1447 if (!default_encoding_c)
goto bad;
1448 __PYX_DEFAULT_STRING_ENCODING = (
char*) malloc(strlen(default_encoding_c) + 1);
1449 if (!__PYX_DEFAULT_STRING_ENCODING)
goto bad;
1450 strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
1451 Py_DECREF(default_encoding);
1454 Py_XDECREF(default_encoding);
1462#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
1463 #define likely(x) __builtin_expect(!!(x), 1)
1464 #define unlikely(x) __builtin_expect(!!(x), 0)
1466 #define likely(x) (x)
1467 #define unlikely(x) (x)
1469static CYTHON_INLINE
void __Pyx_pretend_to_initialize(
void* ptr) { (void)ptr; }
1471#if !CYTHON_USE_MODULE_STATE
1472static PyObject *__pyx_m = NULL;
1474static int __pyx_lineno;
1475static int __pyx_clineno = 0;
1476static const char * __pyx_cfilenm = __FILE__;
1477static const char *__pyx_filename;
1481static const char *__pyx_f[] = {
1486#ifndef __PYX_FORCE_INIT_THREADS
1487 #define __PYX_FORCE_INIT_THREADS 0
1499#ifndef CYTHON_REFNANNY
1500 #define CYTHON_REFNANNY 0
1504 void (*INCREF)(
void*, PyObject*, Py_ssize_t);
1505 void (*DECREF)(
void*, PyObject*, Py_ssize_t);
1506 void (*GOTREF)(
void*, PyObject*, Py_ssize_t);
1507 void (*GIVEREF)(
void*, PyObject*, Py_ssize_t);
1508 void* (*SetupContext)(
const char*, Py_ssize_t,
const char*);
1509 void (*FinishContext)(
void**);
1510 } __Pyx_RefNannyAPIStruct;
1511 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1512 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(
const char *modname);
1513 #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1515 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1517 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1518 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\
1519 PyGILState_Release(__pyx_gilstate_save);\
1521 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\
1523 #define __Pyx_RefNannyFinishContextNogil() {\
1524 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1525 __Pyx_RefNannyFinishContext();\
1526 PyGILState_Release(__pyx_gilstate_save);\
1529 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1530 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__))
1531 #define __Pyx_RefNannyFinishContextNogil() __Pyx_RefNannyFinishContext()
1533 #define __Pyx_RefNannyFinishContextNogil() {\
1534 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1535 __Pyx_RefNannyFinishContext();\
1536 PyGILState_Release(__pyx_gilstate_save);\
1538 #define __Pyx_RefNannyFinishContext()\
1539 __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1540 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
1541 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
1542 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
1543 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
1544 #define __Pyx_XINCREF(r) do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0)
1545 #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0)
1546 #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0)
1547 #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0)
1549 #define __Pyx_RefNannyDeclarations
1550 #define __Pyx_RefNannySetupContext(name, acquire_gil)
1551 #define __Pyx_RefNannyFinishContextNogil()
1552 #define __Pyx_RefNannyFinishContext()
1553 #define __Pyx_INCREF(r) Py_INCREF(r)
1554 #define __Pyx_DECREF(r) Py_DECREF(r)
1555 #define __Pyx_GOTREF(r)
1556 #define __Pyx_GIVEREF(r)
1557 #define __Pyx_XINCREF(r) Py_XINCREF(r)
1558 #define __Pyx_XDECREF(r) Py_XDECREF(r)
1559 #define __Pyx_XGOTREF(r)
1560 #define __Pyx_XGIVEREF(r)
1562#define __Pyx_Py_XDECREF_SET(r, v) do {\
1563 PyObject *tmp = (PyObject *) r;\
1564 r = v; Py_XDECREF(tmp);\
1566#define __Pyx_XDECREF_SET(r, v) do {\
1567 PyObject *tmp = (PyObject *) r;\
1568 r = v; __Pyx_XDECREF(tmp);\
1570#define __Pyx_DECREF_SET(r, v) do {\
1571 PyObject *tmp = (PyObject *) r;\
1572 r = v; __Pyx_DECREF(tmp);\
1574#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1575#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1578#if CYTHON_USE_TYPE_SLOTS
1579static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1581#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1588static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list,
int level);
1591static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
1594#if CYTHON_FAST_PYCALL
1595#if !CYTHON_VECTORCALL
1596#define __Pyx_PyFunction_FastCall(func, args, nargs)\
1597 __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1598static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1600#define __Pyx_BUILD_ASSERT_EXPR(cond)\
1601 (sizeof(char [1 - 2*!(cond)]) - 1)
1602#ifndef Py_MEMBER_SIZE
1603#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1605#if !CYTHON_VECTORCALL
1606#if PY_VERSION_HEX >= 0x03080000
1607 #include "frameobject.h"
1608#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API
1609 #ifndef Py_BUILD_CORE
1610 #define Py_BUILD_CORE 1
1612 #include "internal/pycore_frame.h"
1614 #define __Pxy_PyFrame_Initialize_Offsets()
1615 #define __Pyx_PyFrame_GetLocalsplus(frame) ((frame)->f_localsplus)
1617 static size_t __pyx_pyframe_localsplus_offset = 0;
1618 #include "frameobject.h"
1619 #define __Pxy_PyFrame_Initialize_Offsets()\
1620 ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1621 (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1622 #define __Pyx_PyFrame_GetLocalsplus(frame)\
1623 (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1629#if CYTHON_COMPILING_IN_CPYTHON
1630static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1632#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1636#if CYTHON_COMPILING_IN_CPYTHON
1637static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1641#define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL)
1642static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args,
size_t nargs, PyObject *kwargs);
1645#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1646#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
1647#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
1648#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1649 (version_var) = __PYX_GET_DICT_VERSION(dict);\
1650 (cache_var) = (value);
1651#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1652 static PY_UINT64_T __pyx_dict_version = 0;\
1653 static PyObject *__pyx_dict_cached_value = NULL;\
1654 if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1655 (VAR) = __pyx_dict_cached_value;\
1657 (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1658 __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1661static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1662static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1663static CYTHON_INLINE
int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1665#define __PYX_GET_DICT_VERSION(dict) (0)
1666#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1667#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
1671#if CYTHON_FAST_THREAD_STATE
1672#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1673static CYTHON_INLINE
int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1675#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
1679#if CYTHON_FAST_THREAD_STATE
1680#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
1681#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
1682#if PY_VERSION_HEX >= 0x030C00A6
1683#define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL)
1684#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL)
1686#define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL)
1687#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type)
1690#define __Pyx_PyThreadState_declare
1691#define __Pyx_PyThreadState_assign
1692#define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL)
1693#define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred()
1697#if CYTHON_FAST_THREAD_STATE
1698#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1699#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1700#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1701#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1702#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1703static CYTHON_INLINE
void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1704static CYTHON_INLINE
void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1705#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6
1706#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1708#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1711#define __Pyx_PyErr_Clear() PyErr_Clear()
1712#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1713#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1714#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1715#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
1716#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
1717#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1718#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1722static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
1725#ifdef CYTHON_CLINE_IN_TRACEBACK
1726#define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1728static int __Pyx_CLineForTraceback(PyThreadState *tstate,
int c_line);
1732#if !CYTHON_COMPILING_IN_LIMITED_API
1734 PyCodeObject* code_object;
1736} __Pyx_CodeObjectCacheEntry;
1737struct __Pyx_CodeObjectCache {
1740 __Pyx_CodeObjectCacheEntry* entries;
1742static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1743static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries,
int count,
int code_line);
1744static PyCodeObject *__pyx_find_code_object(
int code_line);
1745static void __pyx_insert_code_object(
int code_line, PyCodeObject* code_object);
1749static void __Pyx_AddTraceback(
const char *funcname,
int c_line,
1750 int py_line,
const char *filename);
1753#if CYTHON_COMPILING_IN_LIMITED_API
1754typedef PyObject *__Pyx_TypeName;
1755#define __Pyx_FMT_TYPENAME "%U"
1756static __Pyx_TypeName __Pyx_PyType_GetName(PyTypeObject* tp);
1757#define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj)
1759typedef const char *__Pyx_TypeName;
1760#define __Pyx_FMT_TYPENAME "%.200s"
1761#define __Pyx_PyType_GetName(tp) ((tp)->tp_name)
1762#define __Pyx_DECREF_TypeName(obj)
1766#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
1767#define __Pyx_HAS_GCC_DIAGNOSTIC
1771static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(
long value);
1774static CYTHON_INLINE
long __Pyx_PyInt_As_long(PyObject *);
1777static CYTHON_INLINE
int __Pyx_PyInt_As_int(PyObject *);
1780#if CYTHON_COMPILING_IN_CPYTHON
1781#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1782#define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2)
1783static CYTHON_INLINE
int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1784static CYTHON_INLINE
int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b);
1785static CYTHON_INLINE
int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1786static CYTHON_INLINE
int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1788#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1789#define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2))
1790#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1791#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1793#define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2)
1794#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1797static unsigned long __Pyx_get_runtime_version(
void);
1798static int __Pyx_check_binary_version(
unsigned long ct_version,
unsigned long rt_version,
int allow_newer);
1801static int __Pyx_ExportFunction(
const char *name,
void (*f)(
void),
const char *sig);
1804static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1812#define __Pyx_MODULE_NAME "eventhooks"
1813extern int __pyx_module_is_main_eventhooks;
1814int __pyx_module_is_main_eventhooks = 0;
1819static const char __pyx_k_[] =
".";
1820static const char __pyx_k__2[] =
"?";
1821static const char __pyx_k_loop[] =
"loop";
1822static const char __pyx_k_main[] =
"__main__";
1823static const char __pyx_k_name[] =
"__name__";
1824static const char __pyx_k_test[] =
"__test__";
1825static const char __pyx_k_import[] =
"__import__";
1826static const char __pyx_k_cyclus_events[] =
"cyclus.events";
1827static const char __pyx_k_cline_in_traceback[] =
"cline_in_traceback";
1828static const char __pyx_k_The_event_handling_module_in_cyc[] =
"The event handling module in cyclus.";
1835 PyObject *__pyx_cython_runtime;
1836 PyObject *__pyx_empty_tuple;
1837 PyObject *__pyx_empty_bytes;
1838 PyObject *__pyx_empty_unicode;
1839 #ifdef __Pyx_CyFunction_USED
1840 PyTypeObject *__pyx_CyFunctionType;
1842 #ifdef __Pyx_FusedFunction_USED
1843 PyTypeObject *__pyx_FusedFunctionType;
1845 #ifdef __Pyx_Generator_USED
1846 PyTypeObject *__pyx_GeneratorType;
1848 #ifdef __Pyx_IterableCoroutine_USED
1849 PyTypeObject *__pyx_IterableCoroutineType;
1851 #ifdef __Pyx_Coroutine_USED
1852 PyTypeObject *__pyx_CoroutineAwaitType;
1854 #ifdef __Pyx_Coroutine_USED
1855 PyTypeObject *__pyx_CoroutineType;
1857 #if CYTHON_USE_MODULE_STATE
1859 PyObject *__pyx_kp_u_;
1860 PyObject *__pyx_n_s__2;
1861 PyObject *__pyx_n_s_cline_in_traceback;
1862 PyObject *__pyx_n_s_cyclus_events;
1863 PyObject *__pyx_n_s_import;
1864 PyObject *__pyx_n_s_loop;
1865 PyObject *__pyx_n_s_main;
1866 PyObject *__pyx_n_s_name;
1867 PyObject *__pyx_n_s_test;
1870#if CYTHON_USE_MODULE_STATE
1873 extern struct PyModuleDef __pyx_moduledef;
1876static struct PyModuleDef __pyx_moduledef;
1879#define __pyx_mstate(o) ((__pyx_mstate *)__Pyx_PyModule_GetState(o))
1881#define __pyx_mstate_global (__pyx_mstate(PyState_FindModule(&__pyx_moduledef)))
1883#define __pyx_m (PyState_FindModule(&__pyx_moduledef))
1885static __pyx_mstate __pyx_mstate_global_static =
1891static __pyx_mstate *__pyx_mstate_global = &__pyx_mstate_global_static;
1894#if CYTHON_USE_MODULE_STATE
1895static int __pyx_m_clear(PyObject *m) {
1896 __pyx_mstate *clear_module_state = __pyx_mstate(m);
1897 if (!clear_module_state)
return 0;
1898 Py_CLEAR(clear_module_state->__pyx_d);
1899 Py_CLEAR(clear_module_state->__pyx_b);
1900 Py_CLEAR(clear_module_state->__pyx_cython_runtime);
1901 Py_CLEAR(clear_module_state->__pyx_empty_tuple);
1902 Py_CLEAR(clear_module_state->__pyx_empty_bytes);
1903 Py_CLEAR(clear_module_state->__pyx_empty_unicode);
1904 #ifdef __Pyx_CyFunction_USED
1905 Py_CLEAR(clear_module_state->__pyx_CyFunctionType);
1907 #ifdef __Pyx_FusedFunction_USED
1908 Py_CLEAR(clear_module_state->__pyx_FusedFunctionType);
1910 Py_CLEAR(clear_module_state->__pyx_kp_u_);
1911 Py_CLEAR(clear_module_state->__pyx_n_s__2);
1912 Py_CLEAR(clear_module_state->__pyx_n_s_cline_in_traceback);
1913 Py_CLEAR(clear_module_state->__pyx_n_s_cyclus_events);
1914 Py_CLEAR(clear_module_state->__pyx_n_s_import);
1915 Py_CLEAR(clear_module_state->__pyx_n_s_loop);
1916 Py_CLEAR(clear_module_state->__pyx_n_s_main);
1917 Py_CLEAR(clear_module_state->__pyx_n_s_name);
1918 Py_CLEAR(clear_module_state->__pyx_n_s_test);
1923#if CYTHON_USE_MODULE_STATE
1924static int __pyx_m_traverse(PyObject *m, visitproc visit,
void *arg) {
1925 __pyx_mstate *traverse_module_state = __pyx_mstate(m);
1926 if (!traverse_module_state)
return 0;
1927 Py_VISIT(traverse_module_state->__pyx_d);
1928 Py_VISIT(traverse_module_state->__pyx_b);
1929 Py_VISIT(traverse_module_state->__pyx_cython_runtime);
1930 Py_VISIT(traverse_module_state->__pyx_empty_tuple);
1931 Py_VISIT(traverse_module_state->__pyx_empty_bytes);
1932 Py_VISIT(traverse_module_state->__pyx_empty_unicode);
1933 #ifdef __Pyx_CyFunction_USED
1934 Py_VISIT(traverse_module_state->__pyx_CyFunctionType);
1936 #ifdef __Pyx_FusedFunction_USED
1937 Py_VISIT(traverse_module_state->__pyx_FusedFunctionType);
1939 Py_VISIT(traverse_module_state->__pyx_kp_u_);
1940 Py_VISIT(traverse_module_state->__pyx_n_s__2);
1941 Py_VISIT(traverse_module_state->__pyx_n_s_cline_in_traceback);
1942 Py_VISIT(traverse_module_state->__pyx_n_s_cyclus_events);
1943 Py_VISIT(traverse_module_state->__pyx_n_s_import);
1944 Py_VISIT(traverse_module_state->__pyx_n_s_loop);
1945 Py_VISIT(traverse_module_state->__pyx_n_s_main);
1946 Py_VISIT(traverse_module_state->__pyx_n_s_name);
1947 Py_VISIT(traverse_module_state->__pyx_n_s_test);
1952#define __pyx_d __pyx_mstate_global->__pyx_d
1953#define __pyx_b __pyx_mstate_global->__pyx_b
1954#define __pyx_cython_runtime __pyx_mstate_global->__pyx_cython_runtime
1955#define __pyx_empty_tuple __pyx_mstate_global->__pyx_empty_tuple
1956#define __pyx_empty_bytes __pyx_mstate_global->__pyx_empty_bytes
1957#define __pyx_empty_unicode __pyx_mstate_global->__pyx_empty_unicode
1958#ifdef __Pyx_CyFunction_USED
1959#define __pyx_CyFunctionType __pyx_mstate_global->__pyx_CyFunctionType
1961#ifdef __Pyx_FusedFunction_USED
1962#define __pyx_FusedFunctionType __pyx_mstate_global->__pyx_FusedFunctionType
1964#ifdef __Pyx_Generator_USED
1965#define __pyx_GeneratorType __pyx_mstate_global->__pyx_GeneratorType
1967#ifdef __Pyx_IterableCoroutine_USED
1968#define __pyx_IterableCoroutineType __pyx_mstate_global->__pyx_IterableCoroutineType
1970#ifdef __Pyx_Coroutine_USED
1971#define __pyx_CoroutineAwaitType __pyx_mstate_global->__pyx_CoroutineAwaitType
1973#ifdef __Pyx_Coroutine_USED
1974#define __pyx_CoroutineType __pyx_mstate_global->__pyx_CoroutineType
1976#if CYTHON_USE_MODULE_STATE
1978#define __pyx_kp_u_ __pyx_mstate_global->__pyx_kp_u_
1979#define __pyx_n_s__2 __pyx_mstate_global->__pyx_n_s__2
1980#define __pyx_n_s_cline_in_traceback __pyx_mstate_global->__pyx_n_s_cline_in_traceback
1981#define __pyx_n_s_cyclus_events __pyx_mstate_global->__pyx_n_s_cyclus_events
1982#define __pyx_n_s_import __pyx_mstate_global->__pyx_n_s_import
1983#define __pyx_n_s_loop __pyx_mstate_global->__pyx_n_s_loop
1984#define __pyx_n_s_main __pyx_mstate_global->__pyx_n_s_main
1985#define __pyx_n_s_name __pyx_mstate_global->__pyx_n_s_name
1986#define __pyx_n_s_test __pyx_mstate_global->__pyx_n_s_test
1998 PyObject *__pyx_v_loop = NULL;
1999 __Pyx_RefNannyDeclarations
2000 PyObject *__pyx_t_1 = NULL;
2001 PyObject *__pyx_t_2 = NULL;
2002 PyObject *__pyx_t_3 = NULL;
2003 unsigned int __pyx_t_4;
2004 int __pyx_lineno = 0;
2005 const char *__pyx_filename = NULL;
2006 int __pyx_clineno = 0;
2007 __Pyx_RefNannySetupContext(
"eventloophook", 1);
2016 __pyx_t_1 = PyList_New(1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5, __pyx_L1_error)
2017 __Pyx_GOTREF(__pyx_t_1);
2018 __Pyx_INCREF(__pyx_n_s_loop);
2019 __Pyx_GIVEREF(__pyx_n_s_loop);
2020 if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_loop)) __PYX_ERR(0, 5, __pyx_L1_error);
2021 __pyx_t_2 = __Pyx_Import(__pyx_n_s_cyclus_events, __pyx_t_1, 0);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5, __pyx_L1_error)
2022 __Pyx_GOTREF(__pyx_t_2);
2023 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2024 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_loop);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5, __pyx_L1_error)
2025 __Pyx_GOTREF(__pyx_t_1);
2026 __Pyx_INCREF(__pyx_t_1);
2027 __pyx_v_loop = __pyx_t_1;
2028 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2029 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2038 __Pyx_INCREF(__pyx_v_loop);
2039 __pyx_t_1 = __pyx_v_loop; __pyx_t_3 = NULL;
2041 #if CYTHON_UNPACK_METHODS
2042 if (unlikely(PyMethod_Check(__pyx_t_1))) {
2043 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
2044 if (likely(__pyx_t_3)) {
2045 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
2046 __Pyx_INCREF(__pyx_t_3);
2047 __Pyx_INCREF(function);
2048 __Pyx_DECREF_SET(__pyx_t_1, function);
2054 PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
2055 __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
2056 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
2057 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __pyx_L1_error)
2058 __Pyx_GOTREF(__pyx_t_2);
2059 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2061 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2074 __Pyx_XDECREF(__pyx_t_1);
2075 __Pyx_XDECREF(__pyx_t_2);
2076 __Pyx_XDECREF(__pyx_t_3);
2077 __Pyx_AddTraceback(
"eventhooks.eventloophook", __pyx_clineno, __pyx_lineno, __pyx_filename);
2079 __Pyx_XDECREF(__pyx_v_loop);
2080 __Pyx_RefNannyFinishContext();
2083static PyMethodDef __pyx_methods[] = {
2086#ifndef CYTHON_SMALL_CODE
2087#if defined(__clang__)
2088 #define CYTHON_SMALL_CODE
2089#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
2090 #define CYTHON_SMALL_CODE __attribute__((cold))
2092 #define CYTHON_SMALL_CODE
2097static int __Pyx_CreateStringTabAndInitStrings(
void) {
2098 __Pyx_StringTabEntry __pyx_string_tab[] = {
2099 {&__pyx_kp_u_, __pyx_k_,
sizeof(__pyx_k_), 0, 1, 0, 0},
2100 {&__pyx_n_s__2, __pyx_k__2,
sizeof(__pyx_k__2), 0, 0, 1, 1},
2101 {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback,
sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
2102 {&__pyx_n_s_cyclus_events, __pyx_k_cyclus_events,
sizeof(__pyx_k_cyclus_events), 0, 0, 1, 1},
2103 {&__pyx_n_s_import, __pyx_k_import,
sizeof(__pyx_k_import), 0, 0, 1, 1},
2104 {&__pyx_n_s_loop, __pyx_k_loop,
sizeof(__pyx_k_loop), 0, 0, 1, 1},
2105 {&__pyx_n_s_main, __pyx_k_main,
sizeof(__pyx_k_main), 0, 0, 1, 1},
2106 {&__pyx_n_s_name, __pyx_k_name,
sizeof(__pyx_k_name), 0, 0, 1, 1},
2107 {&__pyx_n_s_test, __pyx_k_test,
sizeof(__pyx_k_test), 0, 0, 1, 1},
2108 {0, 0, 0, 0, 0, 0, 0}
2110 return __Pyx_InitStrings(__pyx_string_tab);
2113static CYTHON_SMALL_CODE
int __Pyx_InitCachedBuiltins(
void) {
2118static CYTHON_SMALL_CODE
int __Pyx_InitCachedConstants(
void) {
2119 __Pyx_RefNannyDeclarations
2120 __Pyx_RefNannySetupContext(
"__Pyx_InitCachedConstants", 0);
2121 __Pyx_RefNannyFinishContext();
2126static CYTHON_SMALL_CODE
int __Pyx_InitConstants(
void) {
2127 if (__Pyx_CreateStringTabAndInitStrings() < 0) __PYX_ERR(0, 1, __pyx_L1_error);
2134static CYTHON_SMALL_CODE
int __Pyx_InitGlobals(
void) {
2139static CYTHON_SMALL_CODE
int __Pyx_modinit_global_init_code(
void);
2140static CYTHON_SMALL_CODE
int __Pyx_modinit_variable_export_code(
void);
2141static CYTHON_SMALL_CODE
int __Pyx_modinit_function_export_code(
void);
2142static CYTHON_SMALL_CODE
int __Pyx_modinit_type_init_code(
void);
2143static CYTHON_SMALL_CODE
int __Pyx_modinit_type_import_code(
void);
2144static CYTHON_SMALL_CODE
int __Pyx_modinit_variable_import_code(
void);
2145static CYTHON_SMALL_CODE
int __Pyx_modinit_function_import_code(
void);
2147static int __Pyx_modinit_global_init_code(
void) {
2148 __Pyx_RefNannyDeclarations
2149 __Pyx_RefNannySetupContext(
"__Pyx_modinit_global_init_code", 0);
2151 __Pyx_RefNannyFinishContext();
2155static int __Pyx_modinit_variable_export_code(
void) {
2156 __Pyx_RefNannyDeclarations
2157 __Pyx_RefNannySetupContext(
"__Pyx_modinit_variable_export_code", 0);
2159 __Pyx_RefNannyFinishContext();
2163static int __Pyx_modinit_function_export_code(
void) {
2164 __Pyx_RefNannyDeclarations
2165 int __pyx_lineno = 0;
2166 const char *__pyx_filename = NULL;
2167 int __pyx_clineno = 0;
2168 __Pyx_RefNannySetupContext(
"__Pyx_modinit_function_export_code", 0);
2170 if (__Pyx_ExportFunction(
"eventloophook", (
void (*)(
void))
CyclusEventLoopHook,
"void (void)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2171 __Pyx_RefNannyFinishContext();
2174 __Pyx_RefNannyFinishContext();
2178static int __Pyx_modinit_type_init_code(
void) {
2179 __Pyx_RefNannyDeclarations
2180 __Pyx_RefNannySetupContext(
"__Pyx_modinit_type_init_code", 0);
2182 __Pyx_RefNannyFinishContext();
2186static int __Pyx_modinit_type_import_code(
void) {
2187 __Pyx_RefNannyDeclarations
2188 __Pyx_RefNannySetupContext(
"__Pyx_modinit_type_import_code", 0);
2190 __Pyx_RefNannyFinishContext();
2194static int __Pyx_modinit_variable_import_code(
void) {
2195 __Pyx_RefNannyDeclarations
2196 __Pyx_RefNannySetupContext(
"__Pyx_modinit_variable_import_code", 0);
2198 __Pyx_RefNannyFinishContext();
2202static int __Pyx_modinit_function_import_code(
void) {
2203 __Pyx_RefNannyDeclarations
2204 __Pyx_RefNannySetupContext(
"__Pyx_modinit_function_import_code", 0);
2206 __Pyx_RefNannyFinishContext();
2211#if PY_MAJOR_VERSION >= 3
2212#if CYTHON_PEP489_MULTI_PHASE_INIT
2213static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def);
2214static int __pyx_pymod_exec_eventhooks(PyObject* module);
2215static PyModuleDef_Slot __pyx_moduledef_slots[] = {
2216 {Py_mod_create, (
void*)__pyx_pymod_create},
2217 {Py_mod_exec, (
void*)__pyx_pymod_exec_eventhooks},
2224 struct PyModuleDef __pyx_moduledef =
2226 static struct PyModuleDef __pyx_moduledef =
2229 PyModuleDef_HEAD_INIT,
2231 __pyx_k_The_event_handling_module_in_cyc,
2232 #if CYTHON_PEP489_MULTI_PHASE_INIT
2234 #elif CYTHON_USE_MODULE_STATE
2235 sizeof(__pyx_mstate),
2240 #
if CYTHON_PEP489_MULTI_PHASE_INIT
2241 __pyx_moduledef_slots,
2245 #
if CYTHON_USE_MODULE_STATE
2260#ifndef CYTHON_NO_PYINIT_EXPORT
2261#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
2262#elif PY_MAJOR_VERSION < 3
2264#define __Pyx_PyMODINIT_FUNC extern "C" void
2266#define __Pyx_PyMODINIT_FUNC void
2270#define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
2272#define __Pyx_PyMODINIT_FUNC PyObject *
2277#if PY_MAJOR_VERSION < 3
2281__Pyx_PyMODINIT_FUNC PyInit_eventhooks(
void) CYTHON_SMALL_CODE;
2282__Pyx_PyMODINIT_FUNC PyInit_eventhooks(
void)
2283#if CYTHON_PEP489_MULTI_PHASE_INIT
2285 return PyModuleDef_Init(&__pyx_moduledef);
2287static CYTHON_SMALL_CODE
int __Pyx_check_single_interpreter(
void) {
2288 #if PY_VERSION_HEX >= 0x030700A1
2289 static PY_INT64_T main_interpreter_id = -1;
2290 PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
2291 if (main_interpreter_id == -1) {
2292 main_interpreter_id = current_id;
2293 return (unlikely(current_id == -1)) ? -1 : 0;
2294 }
else if (unlikely(main_interpreter_id != current_id))
2296 static PyInterpreterState *main_interpreter = NULL;
2297 PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
2298 if (!main_interpreter) {
2299 main_interpreter = current_interpreter;
2300 }
else if (unlikely(main_interpreter != current_interpreter))
2305 "Interpreter change detected - this module can only be loaded into one interpreter per process.");
2310#if CYTHON_COMPILING_IN_LIMITED_API
2311static CYTHON_SMALL_CODE
int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *module,
const char* from_name,
const char* to_name,
int allow_none)
2313static CYTHON_SMALL_CODE
int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict,
const char* from_name,
const char* to_name,
int allow_none)
2316 PyObject *value = PyObject_GetAttrString(spec, from_name);
2318 if (likely(value)) {
2319 if (allow_none || value != Py_None) {
2320#if CYTHON_COMPILING_IN_LIMITED_API
2321 result = PyModule_AddObject(module, to_name, value);
2323 result = PyDict_SetItemString(moddict, to_name, value);
2327 }
else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
2334static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) {
2335 PyObject *
module = NULL, *moddict, *modname;
2336 CYTHON_UNUSED_VAR(def);
2337 if (__Pyx_check_single_interpreter())
2340 return __Pyx_NewRef(__pyx_m);
2341 modname = PyObject_GetAttrString(spec,
"name");
2342 if (unlikely(!modname))
goto bad;
2343 module = PyModule_NewObject(modname);
2345 if (unlikely(!module))
goto bad;
2346#if CYTHON_COMPILING_IN_LIMITED_API
2349 moddict = PyModule_GetDict(module);
2350 if (unlikely(!moddict))
goto bad;
2352 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict,
"loader",
"__loader__", 1) < 0))
goto bad;
2353 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict,
"origin",
"__file__", 1) < 0))
goto bad;
2354 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict,
"parent",
"__package__", 1) < 0))
goto bad;
2355 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict,
"submodule_search_locations",
"__path__", 0) < 0))
goto bad;
2363static CYTHON_SMALL_CODE
int __pyx_pymod_exec_eventhooks(PyObject *__pyx_pyinit_module)
2367 int stringtab_initialized = 0;
2368 #if CYTHON_USE_MODULE_STATE
2369 int pystate_addmodule_run = 0;
2371 PyObject *__pyx_t_1 = NULL;
2372 PyObject *__pyx_t_2 = NULL;
2373 int __pyx_lineno = 0;
2374 const char *__pyx_filename = NULL;
2375 int __pyx_clineno = 0;
2376 __Pyx_RefNannyDeclarations
2377 #if CYTHON_PEP489_MULTI_PHASE_INIT
2379 if (__pyx_m == __pyx_pyinit_module)
return 0;
2380 PyErr_SetString(PyExc_RuntimeError,
"Module 'eventhooks' has already been imported. Re-initialisation is not supported.");
2383 #elif PY_MAJOR_VERSION >= 3
2384 if (__pyx_m)
return __Pyx_NewRef(__pyx_m);
2387 #if CYTHON_PEP489_MULTI_PHASE_INIT
2388 __pyx_m = __pyx_pyinit_module;
2391 #if PY_MAJOR_VERSION < 3
2392 __pyx_m = Py_InitModule4(
"eventhooks", __pyx_methods, __pyx_k_The_event_handling_module_in_cyc, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
2393 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
2394 #elif CYTHON_USE_MODULE_STATE
2395 __pyx_t_1 = PyModule_Create(&__pyx_moduledef);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
2397 int add_module_result = PyState_AddModule(__pyx_t_1, &__pyx_moduledef);
2399 if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
2400 pystate_addmodule_run = 1;
2403 __pyx_m = PyModule_Create(&__pyx_moduledef);
2404 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
2407 CYTHON_UNUSED_VAR(__pyx_t_1);
2408 __pyx_d = PyModule_GetDict(__pyx_m);
if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
2410 __pyx_b = __Pyx_PyImport_AddModuleRef(__Pyx_BUILTIN_MODULE_NAME);
if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
2411 __pyx_cython_runtime = __Pyx_PyImport_AddModuleRef((
const char *)
"cython_runtime");
if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
2412 if (PyObject_SetAttrString(__pyx_m,
"__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2414__Pyx_RefNanny = __Pyx_RefNannyImportAPI(
"refnanny");
2415if (!__Pyx_RefNanny) {
2417 __Pyx_RefNanny = __Pyx_RefNannyImportAPI(
"Cython.Runtime.refnanny");
2418 if (!__Pyx_RefNanny)
2419 Py_FatalError(
"failed to import 'refnanny' module");
2422 __Pyx_RefNannySetupContext(
"__Pyx_PyMODINIT_FUNC PyInit_eventhooks(void)", 0);
2423 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)
2424 #ifdef __Pxy_PyFrame_Initialize_Offsets
2425 __Pxy_PyFrame_Initialize_Offsets();
2427 __pyx_empty_tuple = PyTuple_New(0);
if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
2428 __pyx_empty_bytes = PyBytes_FromStringAndSize(
"", 0);
if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
2429 __pyx_empty_unicode = PyUnicode_FromStringAndSize(
"", 0);
if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
2430 #ifdef __Pyx_CyFunction_USED
2431 if (__pyx_CyFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2433 #ifdef __Pyx_FusedFunction_USED
2434 if (__pyx_FusedFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2436 #ifdef __Pyx_Coroutine_USED
2437 if (__pyx_Coroutine_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2439 #ifdef __Pyx_Generator_USED
2440 if (__pyx_Generator_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2442 #ifdef __Pyx_AsyncGen_USED
2443 if (__pyx_AsyncGen_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2445 #ifdef __Pyx_StopAsyncIteration_USED
2446 if (__pyx_StopAsyncIteration_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2450 #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
2451 PyEval_InitThreads();
2454 if (__Pyx_InitConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2455 stringtab_initialized = 1;
2456 if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2457 #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
2458 if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2460 if (__pyx_module_is_main_eventhooks) {
2461 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2463 #if PY_MAJOR_VERSION >= 3
2465 PyObject *modules = PyImport_GetModuleDict();
if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
2466 if (!PyDict_GetItemString(modules,
"eventhooks")) {
2467 if (unlikely((PyDict_SetItemString(modules,
"eventhooks", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
2472 if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2474 if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2476 (void)__Pyx_modinit_global_init_code();
2477 (void)__Pyx_modinit_variable_export_code();
2478 if (unlikely((__Pyx_modinit_function_export_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
2479 (void)__Pyx_modinit_type_init_code();
2480 (void)__Pyx_modinit_type_import_code();
2481 (void)__Pyx_modinit_variable_import_code();
2482 (void)__Pyx_modinit_function_import_code();
2484 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
2485 if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2493 __pyx_t_2 = __Pyx_PyDict_NewPresized(0);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error)
2494 __Pyx_GOTREF(__pyx_t_2);
2495 if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2496 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2502 __Pyx_XDECREF(__pyx_t_2);
2504 if (__pyx_d && stringtab_initialized) {
2505 __Pyx_AddTraceback(
"init eventhooks", __pyx_clineno, __pyx_lineno, __pyx_filename);
2507 #if !CYTHON_USE_MODULE_STATE
2511 if (pystate_addmodule_run) {
2512 PyObject *tp, *value, *tb;
2513 PyErr_Fetch(&tp, &value, &tb);
2514 PyState_RemoveModule(&__pyx_moduledef);
2515 PyErr_Restore(tp, value, tb);
2518 }
else if (!PyErr_Occurred()) {
2519 PyErr_SetString(PyExc_ImportError,
"init eventhooks");
2522 __Pyx_RefNannyFinishContext();
2523 #if CYTHON_PEP489_MULTI_PHASE_INIT
2524 return (__pyx_m != NULL) ? 0 : -1;
2525 #elif PY_MAJOR_VERSION >= 3
2536#pragma warning( push )
2541#pragma warning( disable : 4127 )
2551static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(
const char *modname) {
2552 PyObject *m = NULL, *p = NULL;
2554 m = PyImport_ImportModule(modname);
2556 p = PyObject_GetAttrString(m,
"RefNannyAPI");
2558 r = PyLong_AsVoidPtr(p);
2562 return (__Pyx_RefNannyAPIStruct *)r;
2567#if CYTHON_USE_TYPE_SLOTS
2568static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
2569 PyTypeObject* tp = Py_TYPE(obj);
2570 if (likely(tp->tp_getattro))
2571 return tp->tp_getattro(obj, attr_name);
2572#if PY_MAJOR_VERSION < 3
2573 if (likely(tp->tp_getattr))
2574 return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
2576 return PyObject_GetAttr(obj, attr_name);
2581static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list,
int level) {
2582 PyObject *
module = 0;
2583 PyObject *empty_dict = 0;
2584 PyObject *empty_list = 0;
2585 #if PY_MAJOR_VERSION < 3
2586 PyObject *py_import;
2587 py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
2588 if (unlikely(!py_import))
2591 empty_list = PyList_New(0);
2592 if (unlikely(!empty_list))
2594 from_list = empty_list;
2597 empty_dict = PyDict_New();
2598 if (unlikely(!empty_dict))
2601 #if PY_MAJOR_VERSION >= 3
2603 if (strchr(__Pyx_MODULE_NAME,
'.') != NULL) {
2604 module = PyImport_ImportModuleLevelObject(
2605 name, __pyx_d, empty_dict, from_list, 1);
2606 if (unlikely(!module)) {
2607 if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError)))
2616 #if PY_MAJOR_VERSION < 3
2617 PyObject *py_level = PyInt_FromLong(level);
2618 if (unlikely(!py_level))
2620 module = PyObject_CallFunctionObjArgs(py_import,
2621 name, __pyx_d, empty_dict, from_list, py_level, (PyObject *)NULL);
2622 Py_DECREF(py_level);
2624 module = PyImport_ImportModuleLevelObject(
2625 name, __pyx_d, empty_dict, from_list, level);
2630 Py_XDECREF(empty_dict);
2631 Py_XDECREF(empty_list);
2632 #if PY_MAJOR_VERSION < 3
2633 Py_XDECREF(py_import);
2639static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
2640 PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
2641 if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
2642 const char* module_name_str = 0;
2643 PyObject* module_name = 0;
2644 PyObject* module_dot = 0;
2645 PyObject* full_name = 0;
2647 module_name_str = PyModule_GetName(module);
2648 if (unlikely(!module_name_str)) {
goto modbad; }
2649 module_name = PyUnicode_FromString(module_name_str);
2650 if (unlikely(!module_name)) {
goto modbad; }
2651 module_dot = PyUnicode_Concat(module_name, __pyx_kp_u_);
2652 if (unlikely(!module_dot)) {
goto modbad; }
2653 full_name = PyUnicode_Concat(module_dot, name);
2654 if (unlikely(!full_name)) {
goto modbad; }
2655 #if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400)
2657 PyObject *modules = PyImport_GetModuleDict();
2658 if (unlikely(!modules))
2660 value = PyObject_GetItem(modules, full_name);
2663 value = PyImport_GetModule(full_name);
2666 Py_XDECREF(full_name);
2667 Py_XDECREF(module_dot);
2668 Py_XDECREF(module_name);
2670 if (unlikely(!value)) {
2671 PyErr_Format(PyExc_ImportError,
2672 #
if PY_MAJOR_VERSION < 3
2673 "cannot import name %.230s", PyString_AS_STRING(name));
2675 "cannot import name %S",
name);
2682#if CYTHON_FAST_PYCALL && !CYTHON_VECTORCALL
2683static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
2684 PyObject *globals) {
2686 PyThreadState *tstate = __Pyx_PyThreadState_Current;
2687 PyObject **fastlocals;
2690 assert(globals != NULL);
2695 assert(tstate != NULL);
2696 f = PyFrame_New(tstate, co, globals, NULL);
2700 fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
2701 for (i = 0; i < na; i++) {
2703 fastlocals[i] = *args++;
2705 result = PyEval_EvalFrameEx(f,0);
2706 ++tstate->recursion_depth;
2708 --tstate->recursion_depth;
2711static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
2712 PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
2713 PyObject *globals = PyFunction_GET_GLOBALS(func);
2714 PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
2716#if PY_MAJOR_VERSION >= 3
2719 PyObject *kwtuple, **k;
2724 assert(kwargs == NULL || PyDict_Check(kwargs));
2725 nk = kwargs ? PyDict_Size(kwargs) : 0;
2726 #if PY_MAJOR_VERSION < 3
2727 if (unlikely(Py_EnterRecursiveCall((
char*)
" while calling a Python object"))) {
2731 if (unlikely(Py_EnterRecursiveCall(
" while calling a Python object"))) {
2736#
if PY_MAJOR_VERSION >= 3
2737 co->co_kwonlyargcount == 0 &&
2739 likely(kwargs == NULL || nk == 0) &&
2740 co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
2741 if (argdefs == NULL && co->co_argcount == nargs) {
2742 result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
2745 else if (nargs == 0 && argdefs != NULL
2746 && co->co_argcount == Py_SIZE(argdefs)) {
2749 args = &PyTuple_GET_ITEM(argdefs, 0);
2750 result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
2754 if (kwargs != NULL) {
2756 kwtuple = PyTuple_New(2 * nk);
2757 if (kwtuple == NULL) {
2761 k = &PyTuple_GET_ITEM(kwtuple, 0);
2763 while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
2774 closure = PyFunction_GET_CLOSURE(func);
2775#if PY_MAJOR_VERSION >= 3
2776 kwdefs = PyFunction_GET_KW_DEFAULTS(func);
2778 if (argdefs != NULL) {
2779 d = &PyTuple_GET_ITEM(argdefs, 0);
2780 nd = Py_SIZE(argdefs);
2786#if PY_MAJOR_VERSION >= 3
2787 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
2790 d, (
int)nd, kwdefs, closure);
2792 result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
2795 d, (
int)nd, closure);
2797 Py_XDECREF(kwtuple);
2799 Py_LeaveRecursiveCall();
2805#if CYTHON_COMPILING_IN_CPYTHON
2806static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
2808 ternaryfunc call = Py_TYPE(func)->tp_call;
2809 if (unlikely(!call))
2810 return PyObject_Call(func, arg, kw);
2811 #if PY_MAJOR_VERSION < 3
2812 if (unlikely(Py_EnterRecursiveCall((
char*)
" while calling a Python object")))
2815 if (unlikely(Py_EnterRecursiveCall(
" while calling a Python object")))
2818 result = (*call)(func, arg, kw);
2819 Py_LeaveRecursiveCall();
2820 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
2823 "NULL result without error in PyObject_Call");
2830#if CYTHON_COMPILING_IN_CPYTHON
2831static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
2832 PyObject *self, *result;
2834 cfunc = __Pyx_CyOrPyCFunction_GET_FUNCTION(func);
2835 self = __Pyx_CyOrPyCFunction_GET_SELF(func);
2836 #if PY_MAJOR_VERSION < 3
2837 if (unlikely(Py_EnterRecursiveCall((
char*)
" while calling a Python object")))
2840 if (unlikely(Py_EnterRecursiveCall(
" while calling a Python object")))
2843 result = cfunc(self, arg);
2844 Py_LeaveRecursiveCall();
2845 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
2848 "NULL result without error in PyObject_Call");
2855#if PY_VERSION_HEX < 0x03090000 || CYTHON_COMPILING_IN_LIMITED_API
2856static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject **args,
size_t nargs, PyObject *kwargs) {
2857 PyObject *argstuple;
2858 PyObject *result = 0;
2860 argstuple = PyTuple_New((Py_ssize_t)nargs);
2861 if (unlikely(!argstuple))
return NULL;
2862 for (i = 0; i < nargs; i++) {
2864 if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) < 0)
goto bad;
2866 result = __Pyx_PyObject_Call(func, argstuple, kwargs);
2868 Py_DECREF(argstuple);
2872static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args,
size_t _nargs, PyObject *kwargs) {
2873 Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs);
2874#if CYTHON_COMPILING_IN_CPYTHON
2875 if (nargs == 0 && kwargs == NULL) {
2876 if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_NOARGS))
2877 return __Pyx_PyObject_CallMethO(func, NULL);
2879 else if (nargs == 1 && kwargs == NULL) {
2880 if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_O))
2881 return __Pyx_PyObject_CallMethO(func, args[0]);
2884 #if PY_VERSION_HEX < 0x030800B1
2885 #if CYTHON_FAST_PYCCALL
2886 if (PyCFunction_Check(func)) {
2888 return _PyCFunction_FastCallDict(func, args, nargs, kwargs);
2890 return _PyCFunction_FastCallKeywords(func, args, nargs, NULL);
2893 #if PY_VERSION_HEX >= 0x030700A1
2894 if (!kwargs && __Pyx_IS_TYPE(func, &PyMethodDescr_Type)) {
2895 return _PyMethodDescr_FastCallKeywords(func, args, nargs, NULL);
2899 #if CYTHON_FAST_PYCALL
2900 if (PyFunction_Check(func)) {
2901 return __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs);
2905 if (kwargs == NULL) {
2906 #if CYTHON_VECTORCALL
2907 #if PY_VERSION_HEX < 0x03090000
2908 vectorcallfunc f = _PyVectorcall_Function(func);
2910 vectorcallfunc f = PyVectorcall_Function(func);
2913 return f(func, args, (
size_t)nargs, NULL);
2915 #elif defined(__Pyx_CyFunction_USED) && CYTHON_BACKPORT_VECTORCALL
2916 if (__Pyx_CyFunction_CheckExact(func)) {
2917 __pyx_vectorcallfunc f = __Pyx_CyFunction_func_vectorcall(func);
2918 if (f)
return f(func, args, (
size_t)nargs, NULL);
2923 return __Pyx_PyObject_Call(func, __pyx_empty_tuple, kwargs);
2925 #if PY_VERSION_HEX >= 0x03090000 && !CYTHON_COMPILING_IN_LIMITED_API
2926 return PyObject_VectorcallDict(func, args, (
size_t)nargs, kwargs);
2928 return __Pyx_PyObject_FastCall_fallback(func, args, (
size_t)nargs, kwargs);
2933#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
2934static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
2935 PyObject *dict = Py_TYPE(obj)->tp_dict;
2936 return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
2938static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
2939 PyObject **dictptr = NULL;
2940 Py_ssize_t
offset = Py_TYPE(obj)->tp_dictoffset;
2942#if CYTHON_COMPILING_IN_CPYTHON
2943 dictptr = (likely(offset > 0)) ? (PyObject **) ((
char *)obj + offset) : _PyObject_GetDictPtr(obj);
2945 dictptr = _PyObject_GetDictPtr(obj);
2948 return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
2950static CYTHON_INLINE
int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
2951 PyObject *dict = Py_TYPE(obj)->tp_dict;
2952 if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
2954 return obj_dict_version == __Pyx_get_object_dict_version(obj);
2959#if CYTHON_FAST_THREAD_STATE
2960static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
2962 n = PyTuple_GET_SIZE(tuple);
2963#if PY_MAJOR_VERSION >= 3
2964 for (i=0; i<n; i++) {
2965 if (exc_type == PyTuple_GET_ITEM(tuple, i))
return 1;
2968 for (i=0; i<n; i++) {
2969 if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i)))
return 1;
2973static CYTHON_INLINE
int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
2976#if PY_VERSION_HEX >= 0x030C00A6
2977 PyObject *current_exception = tstate->current_exception;
2978 if (unlikely(!current_exception))
return 0;
2979 exc_type = (PyObject*) Py_TYPE(current_exception);
2980 if (exc_type == err)
return 1;
2982 exc_type = tstate->curexc_type;
2983 if (exc_type == err)
return 1;
2984 if (unlikely(!exc_type))
return 0;
2986 #if CYTHON_AVOID_BORROWED_REFS
2987 Py_INCREF(exc_type);
2989 if (unlikely(PyTuple_Check(err))) {
2990 result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
2992 result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
2994 #if CYTHON_AVOID_BORROWED_REFS
2995 Py_DECREF(exc_type);
3002#if CYTHON_FAST_THREAD_STATE
3003static CYTHON_INLINE
void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
3004#if PY_VERSION_HEX >= 0x030C00A6
3005 PyObject *tmp_value;
3006 assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value)));
3008 #if CYTHON_COMPILING_IN_CPYTHON
3009 if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb))
3011 PyException_SetTraceback(value, tb);
3013 tmp_value = tstate->current_exception;
3014 tstate->current_exception = value;
3015 Py_XDECREF(tmp_value);
3019 PyObject *tmp_type, *tmp_value, *tmp_tb;
3020 tmp_type = tstate->curexc_type;
3021 tmp_value = tstate->curexc_value;
3022 tmp_tb = tstate->curexc_traceback;
3023 tstate->curexc_type = type;
3024 tstate->curexc_value = value;
3025 tstate->curexc_traceback = tb;
3026 Py_XDECREF(tmp_type);
3027 Py_XDECREF(tmp_value);
3031static CYTHON_INLINE
void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
3032#if PY_VERSION_HEX >= 0x030C00A6
3033 PyObject* exc_value;
3034 exc_value = tstate->current_exception;
3035 tstate->current_exception = 0;
3040 *type = (PyObject*) Py_TYPE(exc_value);
3042 #if CYTHON_COMPILING_IN_CPYTHON
3043 *tb = ((PyBaseExceptionObject*) exc_value)->traceback;
3046 *tb = PyException_GetTraceback(exc_value);
3050 *type = tstate->curexc_type;
3051 *value = tstate->curexc_value;
3052 *tb = tstate->curexc_traceback;
3053 tstate->curexc_type = 0;
3054 tstate->curexc_value = 0;
3055 tstate->curexc_traceback = 0;
3061#if __PYX_LIMITED_VERSION_HEX < 0x030d00A1
3062static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(
void) {
3063 __Pyx_PyThreadState_declare
3064 __Pyx_PyThreadState_assign
3065 if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
3066 __Pyx_PyErr_Clear();
3069static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
3071#if __PYX_LIMITED_VERSION_HEX >= 0x030d00A1
3072 (void) PyObject_GetOptionalAttr(obj, attr_name, &result);
3075#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
3076 PyTypeObject* tp = Py_TYPE(obj);
3077 if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
3078 return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
3081 result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
3082 if (unlikely(!result)) {
3083 __Pyx_PyObject_GetAttrStr_ClearAttributeError();
3090#ifndef CYTHON_CLINE_IN_TRACEBACK
3091static int __Pyx_CLineForTraceback(PyThreadState *tstate,
int c_line) {
3092 PyObject *use_cline;
3093 PyObject *ptype, *pvalue, *ptraceback;
3094#if CYTHON_COMPILING_IN_CPYTHON
3095 PyObject **cython_runtime_dict;
3097 CYTHON_MAYBE_UNUSED_VAR(tstate);
3098 if (unlikely(!__pyx_cython_runtime)) {
3101 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
3102#if CYTHON_COMPILING_IN_CPYTHON
3103 cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
3104 if (likely(cython_runtime_dict)) {
3105 __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
3106 use_cline, *cython_runtime_dict,
3107 __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
3111 PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStrNoError(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
3112 if (use_cline_obj) {
3113 use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
3114 Py_DECREF(use_cline_obj);
3122 (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
3124 else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
3127 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
3133#if !CYTHON_COMPILING_IN_LIMITED_API
3134static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries,
int count,
int code_line) {
3135 int start = 0, mid = 0,
end = count - 1;
3136 if (end >= 0 && code_line > entries[end].code_line) {
3139 while (start < end) {
3140 mid = start + (
end - start) / 2;
3141 if (code_line < entries[mid].code_line) {
3143 }
else if (code_line > entries[mid].code_line) {
3149 if (code_line <= entries[mid].code_line) {
3155static PyCodeObject *__pyx_find_code_object(
int code_line) {
3156 PyCodeObject* code_object;
3158 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
3161 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
3162 if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
3165 code_object = __pyx_code_cache.entries[pos].code_object;
3166 Py_INCREF(code_object);
3169static void __pyx_insert_code_object(
int code_line, PyCodeObject* code_object) {
3171 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
3172 if (unlikely(!code_line)) {
3175 if (unlikely(!entries)) {
3176 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*
sizeof(__Pyx_CodeObjectCacheEntry));
3177 if (likely(entries)) {
3178 __pyx_code_cache.entries = entries;
3179 __pyx_code_cache.max_count = 64;
3180 __pyx_code_cache.count = 1;
3181 entries[0].code_line = code_line;
3182 entries[0].code_object = code_object;
3183 Py_INCREF(code_object);
3187 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
3188 if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
3189 PyCodeObject* tmp = entries[pos].code_object;
3190 entries[pos].code_object = code_object;
3194 if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
3195 int new_max = __pyx_code_cache.max_count + 64;
3196 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
3197 __pyx_code_cache.entries, ((
size_t)new_max) *
sizeof(__Pyx_CodeObjectCacheEntry));
3198 if (unlikely(!entries)) {
3201 __pyx_code_cache.entries = entries;
3202 __pyx_code_cache.max_count = new_max;
3204 for (i=__pyx_code_cache.count; i>pos; i--) {
3205 entries[i] = entries[i-1];
3207 entries[pos].code_line = code_line;
3208 entries[pos].code_object = code_object;
3209 __pyx_code_cache.count++;
3210 Py_INCREF(code_object);
3216#include "frameobject.h"
3217#include "traceback.h"
3218#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API
3219 #ifndef Py_BUILD_CORE
3220 #define Py_BUILD_CORE 1
3222 #include "internal/pycore_frame.h"
3224#if CYTHON_COMPILING_IN_LIMITED_API
3225static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict,
3226 PyObject *firstlineno, PyObject *name) {
3227 PyObject *replace = NULL;
3228 if (unlikely(PyDict_SetItemString(scratch_dict,
"co_firstlineno", firstlineno)))
return NULL;
3229 if (unlikely(PyDict_SetItemString(scratch_dict,
"co_name", name)))
return NULL;
3230 replace = PyObject_GetAttrString(code,
"replace");
3231 if (likely(replace)) {
3233 result = PyObject_Call(replace, __pyx_empty_tuple, scratch_dict);
3238 #if __PYX_LIMITED_VERSION_HEX < 0x030780000
3240 PyObject *compiled = NULL, *result = NULL;
3241 if (unlikely(PyDict_SetItemString(scratch_dict,
"code", code)))
return NULL;
3242 if (unlikely(PyDict_SetItemString(scratch_dict,
"type", (PyObject*)(&PyType_Type))))
return NULL;
3243 compiled = Py_CompileString(
3244 "out = type(code)(\n"
3245 " code.co_argcount, code.co_kwonlyargcount, code.co_nlocals, code.co_stacksize,\n"
3246 " code.co_flags, code.co_code, code.co_consts, code.co_names,\n"
3247 " code.co_varnames, code.co_filename, co_name, co_firstlineno,\n"
3248 " code.co_lnotab)\n",
"<dummy>", Py_file_input);
3249 if (!compiled)
return NULL;
3250 result = PyEval_EvalCode(compiled, scratch_dict, scratch_dict);
3251 Py_DECREF(compiled);
3252 if (!result) PyErr_Print();
3254 result = PyDict_GetItemString(scratch_dict,
"out");
3255 if (result) Py_INCREF(result);
3262static void __Pyx_AddTraceback(
const char *funcname,
int c_line,
3263 int py_line,
const char *filename) {
3264 PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL;
3265 PyObject *replace = NULL, *getframe = NULL, *frame = NULL;
3266 PyObject *exc_type, *exc_value, *exc_traceback;
3269 (void) __pyx_cfilenm;
3270 (void) __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line);
3272 PyErr_Fetch(&exc_type, &exc_value, &exc_traceback);
3273 code_object = Py_CompileString(
"_getframe()", filename, Py_eval_input);
3274 if (unlikely(!code_object))
goto bad;
3275 py_py_line = PyLong_FromLong(py_line);
3276 if (unlikely(!py_py_line))
goto bad;
3277 py_funcname = PyUnicode_FromString(funcname);
3278 if (unlikely(!py_funcname))
goto bad;
3279 dict = PyDict_New();
3280 if (unlikely(!dict))
goto bad;
3282 PyObject *old_code_object = code_object;
3283 code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname);
3284 Py_DECREF(old_code_object);
3286 if (unlikely(!code_object))
goto bad;
3287 getframe = PySys_GetObject(
"_getframe");
3288 if (unlikely(!getframe))
goto bad;
3289 if (unlikely(PyDict_SetItemString(dict,
"_getframe", getframe)))
goto bad;
3290 frame = PyEval_EvalCode(code_object, dict, dict);
3291 if (unlikely(!frame) || frame == Py_None)
goto bad;
3294 PyErr_Restore(exc_type, exc_value, exc_traceback);
3295 Py_XDECREF(code_object);
3296 Py_XDECREF(py_py_line);
3297 Py_XDECREF(py_funcname);
3299 Py_XDECREF(replace);
3302 (
struct _frame*)frame);
3307static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
3308 const char *funcname,
int c_line,
3309 int py_line,
const char *filename) {
3310 PyCodeObject *py_code = NULL;
3311 PyObject *py_funcname = NULL;
3312 #if PY_MAJOR_VERSION < 3
3313 PyObject *py_srcfile = NULL;
3314 py_srcfile = PyString_FromString(filename);
3315 if (!py_srcfile)
goto bad;
3318 #if PY_MAJOR_VERSION < 3
3319 py_funcname = PyString_FromFormat(
"%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
3320 if (!py_funcname)
goto bad;
3322 py_funcname = PyUnicode_FromFormat(
"%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
3323 if (!py_funcname)
goto bad;
3324 funcname = PyUnicode_AsUTF8(py_funcname);
3325 if (!funcname)
goto bad;
3329 #if PY_MAJOR_VERSION < 3
3330 py_funcname = PyString_FromString(funcname);
3331 if (!py_funcname)
goto bad;
3334 #if PY_MAJOR_VERSION < 3
3335 py_code = __Pyx_PyCode_New(
3353 Py_DECREF(py_srcfile);
3355 py_code = PyCode_NewEmpty(filename, funcname, py_line);
3357 Py_XDECREF(py_funcname);
3360 Py_XDECREF(py_funcname);
3361 #if PY_MAJOR_VERSION < 3
3362 Py_XDECREF(py_srcfile);
3366static void __Pyx_AddTraceback(
const char *funcname,
int c_line,
3367 int py_line,
const char *filename) {
3368 PyCodeObject *py_code = 0;
3369 PyFrameObject *py_frame = 0;
3370 PyThreadState *tstate = __Pyx_PyThreadState_Current;
3371 PyObject *ptype, *pvalue, *ptraceback;
3373 c_line = __Pyx_CLineForTraceback(tstate, c_line);
3375 py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
3377 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
3378 py_code = __Pyx_CreateCodeObjectForTraceback(
3379 funcname, c_line, py_line, filename);
3385 Py_XDECREF(ptraceback);
3388 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
3389 __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
3391 py_frame = PyFrame_New(
3397 if (!py_frame)
goto bad;
3398 __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
3399 PyTraceBack_Here(py_frame);
3401 Py_XDECREF(py_code);
3402 Py_XDECREF(py_frame);
3407#if CYTHON_COMPILING_IN_LIMITED_API
3408static __Pyx_TypeName
3409__Pyx_PyType_GetName(PyTypeObject* tp)
3411 PyObject *
name = __Pyx_PyObject_GetAttrStr((PyObject *)tp,
3413 if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) {
3416 name = __Pyx_NewRef(__pyx_n_s__2);
3423static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(
long value) {
3424#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
3425#pragma GCC diagnostic push
3426#pragma GCC diagnostic ignored "-Wconversion"
3428 const long neg_one = (long) -1, const_zero = (
long) 0;
3429#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
3430#pragma GCC diagnostic pop
3432 const int is_unsigned = neg_one > const_zero;
3434 if (
sizeof(
long) <
sizeof(long)) {
3435 return PyInt_FromLong((
long) value);
3436 }
else if (
sizeof(
long) <=
sizeof(
unsigned long)) {
3437 return PyLong_FromUnsignedLong((
unsigned long) value);
3438#ifdef HAVE_LONG_LONG
3439 }
else if (
sizeof(
long) <=
sizeof(
unsigned PY_LONG_LONG)) {
3440 return PyLong_FromUnsignedLongLong((
unsigned PY_LONG_LONG) value);
3444 if (
sizeof(
long) <=
sizeof(
long)) {
3445 return PyInt_FromLong((
long) value);
3446#ifdef HAVE_LONG_LONG
3447 }
else if (
sizeof(
long) <=
sizeof(PY_LONG_LONG)) {
3448 return PyLong_FromLongLong((PY_LONG_LONG) value);
3453 unsigned char *bytes = (
unsigned char *)&value;
3454#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
3456 return PyLong_FromUnsignedNativeBytes(bytes,
sizeof(value), -1);
3458 return PyLong_FromNativeBytes(bytes,
sizeof(value), -1);
3460#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
3461 int one = 1;
int little = (int)*(
unsigned char *)&one;
3462 return _PyLong_FromByteArray(bytes,
sizeof(
long),
3463 little, !is_unsigned);
3465 int one = 1;
int little = (int)*(
unsigned char *)&one;
3466 PyObject *from_bytes, *result = NULL;
3467 PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL;
3468 from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type,
"from_bytes");
3469 if (!from_bytes)
return NULL;
3470 py_bytes = PyBytes_FromStringAndSize((
char*)bytes,
sizeof(
long));
3471 if (!py_bytes)
goto limited_bad;
3472 order_str = PyUnicode_FromString(little ?
"little" :
"big");
3473 if (!order_str)
goto limited_bad;
3474 arg_tuple = PyTuple_Pack(2, py_bytes, order_str);
3475 if (!arg_tuple)
goto limited_bad;
3477 kwds = PyDict_New();
3478 if (!kwds)
goto limited_bad;
3479 if (PyDict_SetItemString(kwds,
"signed", __Pyx_NewRef(Py_True)))
goto limited_bad;
3481 result = PyObject_Call(from_bytes, arg_tuple, kwds);
3484 Py_XDECREF(arg_tuple);
3485 Py_XDECREF(order_str);
3486 Py_XDECREF(py_bytes);
3487 Py_XDECREF(from_bytes);
3494#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
3495 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
3496#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
3497 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
3498#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
3500 func_type value = func_value;\
3501 if (sizeof(target_type) < sizeof(func_type)) {\
3502 if (unlikely(value != (func_type) (target_type) value)) {\
3503 func_type zero = 0;\
3504 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
3505 return (target_type) -1;\
3506 if (is_unsigned && unlikely(value < zero))\
3507 goto raise_neg_overflow;\
3509 goto raise_overflow;\
3512 return (target_type) value;\
3516static CYTHON_INLINE
long __Pyx_PyInt_As_long(PyObject *x) {
3517#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
3518#pragma GCC diagnostic push
3519#pragma GCC diagnostic ignored "-Wconversion"
3521 const long neg_one = (long) -1, const_zero = (
long) 0;
3522#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
3523#pragma GCC diagnostic pop
3525 const int is_unsigned = neg_one > const_zero;
3526#if PY_MAJOR_VERSION < 3
3527 if (likely(PyInt_Check(x))) {
3528 if ((
sizeof(
long) <
sizeof(
long))) {
3529 __PYX_VERIFY_RETURN_INT(
long,
long, PyInt_AS_LONG(x))
3531 long val = PyInt_AS_LONG(x);
3532 if (is_unsigned && unlikely(val < 0)) {
3533 goto raise_neg_overflow;
3539 if (unlikely(!PyLong_Check(x))) {
3541 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
3542 if (!tmp)
return (
long) -1;
3543 val = __Pyx_PyInt_As_long(tmp);
3548#if CYTHON_USE_PYLONG_INTERNALS
3549 if (unlikely(__Pyx_PyLong_IsNeg(x))) {
3550 goto raise_neg_overflow;
3551 }
else if (__Pyx_PyLong_IsCompact(x)) {
3552 __PYX_VERIFY_RETURN_INT(
long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
3554 const digit* digits = __Pyx_PyLong_Digits(x);
3555 assert(__Pyx_PyLong_DigitCount(x) > 1);
3556 switch (__Pyx_PyLong_DigitCount(x)) {
3558 if ((8 *
sizeof(
long) > 1 * PyLong_SHIFT)) {
3559 if ((8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT)) {
3560 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
3561 }
else if ((8 *
sizeof(
long) >= 2 * PyLong_SHIFT)) {
3562 return (
long) (((((long)digits[1]) << PyLong_SHIFT) | (
long)digits[0]));
3567 if ((8 *
sizeof(
long) > 2 * PyLong_SHIFT)) {
3568 if ((8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT)) {
3569 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
3570 }
else if ((8 *
sizeof(
long) >= 3 * PyLong_SHIFT)) {
3571 return (
long) (((((((long)digits[2]) << PyLong_SHIFT) | (
long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
3576 if ((8 *
sizeof(
long) > 3 * PyLong_SHIFT)) {
3577 if ((8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT)) {
3578 __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])))
3579 }
else if ((8 *
sizeof(
long) >= 4 * PyLong_SHIFT)) {
3580 return (
long) (((((((((long)digits[3]) << PyLong_SHIFT) | (
long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (
long)digits[0]));
3587#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
3588 if (unlikely(Py_SIZE(x) < 0)) {
3589 goto raise_neg_overflow;
3593 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
3594 if (unlikely(result < 0))
3596 if (unlikely(result == 1))
3597 goto raise_neg_overflow;
3600 if ((
sizeof(
long) <=
sizeof(
unsigned long))) {
3601 __PYX_VERIFY_RETURN_INT_EXC(
long,
unsigned long, PyLong_AsUnsignedLong(x))
3602#ifdef HAVE_LONG_LONG
3603 }
else if ((
sizeof(
long) <=
sizeof(
unsigned PY_LONG_LONG))) {
3604 __PYX_VERIFY_RETURN_INT_EXC(
long,
unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
3608#if CYTHON_USE_PYLONG_INTERNALS
3609 if (__Pyx_PyLong_IsCompact(x)) {
3610 __PYX_VERIFY_RETURN_INT(
long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
3612 const digit* digits = __Pyx_PyLong_Digits(x);
3613 assert(__Pyx_PyLong_DigitCount(x) > 1);
3614 switch (__Pyx_PyLong_SignedDigitCount(x)) {
3616 if ((8 *
sizeof(
long) - 1 > 1 * PyLong_SHIFT)) {
3617 if ((8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT)) {
3618 __PYX_VERIFY_RETURN_INT(
long,
long, -(
long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
3619 }
else if ((8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT)) {
3620 return (
long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
3625 if ((8 *
sizeof(
long) > 1 * PyLong_SHIFT)) {
3626 if ((8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT)) {
3627 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
3628 }
else if ((8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT)) {
3629 return (
long) ((((((long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
3634 if ((8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT)) {
3635 if ((8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT)) {
3636 __PYX_VERIFY_RETURN_INT(
long,
long, -(
long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
3637 }
else if ((8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT)) {
3638 return (
long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (
long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
3643 if ((8 *
sizeof(
long) > 2 * PyLong_SHIFT)) {
3644 if ((8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT)) {
3645 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
3646 }
else if ((8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT)) {
3647 return (
long) ((((((((long)digits[2]) << PyLong_SHIFT) | (
long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
3652 if ((8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT)) {
3653 if ((8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT)) {
3654 __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])))
3655 }
else if ((8 *
sizeof(
long) - 1 > 4 * PyLong_SHIFT)) {
3656 return (
long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (
long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
3661 if ((8 *
sizeof(
long) > 3 * PyLong_SHIFT)) {
3662 if ((8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT)) {
3663 __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])))
3664 }
else if ((8 *
sizeof(
long) - 1 > 4 * PyLong_SHIFT)) {
3665 return (
long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (
long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
3672 if ((
sizeof(
long) <=
sizeof(long))) {
3673 __PYX_VERIFY_RETURN_INT_EXC(
long,
long, PyLong_AsLong(x))
3674#ifdef HAVE_LONG_LONG
3675 }
else if ((
sizeof(
long) <=
sizeof(PY_LONG_LONG))) {
3676 __PYX_VERIFY_RETURN_INT_EXC(
long, PY_LONG_LONG, PyLong_AsLongLong(x))
3683#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
3684 Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
3685 x, &val,
sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
3686 if (unlikely(bytes_copied == -1)) {
3687 }
else if (unlikely(bytes_copied > (Py_ssize_t)
sizeof(val))) {
3688 goto raise_overflow;
3692#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
3693 int one = 1;
int is_little = (int)*(
unsigned char *)&one;
3694 unsigned char *bytes = (
unsigned char *)&val;
3695 ret = _PyLong_AsByteArray((PyLongObject *)x,
3697 is_little, !is_unsigned);
3700 PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
3701 int bits, remaining_bits, is_negative = 0;
3702 int chunk_size = (
sizeof(long) < 8) ? 30 : 62;
3703 if (likely(PyLong_CheckExact(x))) {
3704 v = __Pyx_NewRef(x);
3706 v = PyNumber_Long(x);
3707 if (unlikely(!v))
return (
long) -1;
3708 assert(PyLong_CheckExact(v));
3711 int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
3712 if (unlikely(result < 0)) {
3716 is_negative = result == 1;
3718 if (is_unsigned && unlikely(is_negative)) {
3720 goto raise_neg_overflow;
3721 }
else if (is_negative) {
3722 stepval = PyNumber_Invert(v);
3724 if (unlikely(!stepval))
3731 mask = PyLong_FromLong((1L << chunk_size) - 1);
if (unlikely(!mask))
goto done;
3732 shift = PyLong_FromLong(chunk_size);
if (unlikely(!shift))
goto done;
3733 for (bits = 0; bits < (int)
sizeof(
long) * 8 - chunk_size; bits += chunk_size) {
3734 PyObject *tmp, *digit;
3736 digit = PyNumber_And(stepval, mask);
3737 if (unlikely(!digit))
goto done;
3738 idigit = PyLong_AsLong(digit);
3740 if (unlikely(idigit < 0))
goto done;
3741 val |= ((long) idigit) << bits;
3742 tmp = PyNumber_Rshift(stepval, shift);
3743 if (unlikely(!tmp))
goto done;
3744 Py_DECREF(stepval); stepval = tmp;
3746 Py_DECREF(shift); shift = NULL;
3747 Py_DECREF(mask); mask = NULL;
3749 long idigit = PyLong_AsLong(stepval);
3750 if (unlikely(idigit < 0))
goto done;
3751 remaining_bits = ((int)
sizeof(
long) * 8) - bits - (is_unsigned ? 0 : 1);
3752 if (unlikely(idigit >= (1L << remaining_bits)))
3753 goto raise_overflow;
3754 val |= ((long) idigit) << bits;
3757 if (unlikely(val & (((
long) 1) << (
sizeof(
long) * 8 - 1))))
3758 goto raise_overflow;
3766 Py_XDECREF(stepval);
3773 PyErr_SetString(PyExc_OverflowError,
3774 "value too large to convert to long");
3777 PyErr_SetString(PyExc_OverflowError,
3778 "can't convert negative value to long");
3783static CYTHON_INLINE
int __Pyx_PyInt_As_int(PyObject *x) {
3784#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
3785#pragma GCC diagnostic push
3786#pragma GCC diagnostic ignored "-Wconversion"
3788 const int neg_one = (int) -1, const_zero = (
int) 0;
3789#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
3790#pragma GCC diagnostic pop
3792 const int is_unsigned = neg_one > const_zero;
3793#if PY_MAJOR_VERSION < 3
3794 if (likely(PyInt_Check(x))) {
3795 if ((
sizeof(
int) <
sizeof(
long))) {
3796 __PYX_VERIFY_RETURN_INT(
int,
long, PyInt_AS_LONG(x))
3798 long val = PyInt_AS_LONG(x);
3799 if (is_unsigned && unlikely(val < 0)) {
3800 goto raise_neg_overflow;
3806 if (unlikely(!PyLong_Check(x))) {
3808 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
3809 if (!tmp)
return (
int) -1;
3810 val = __Pyx_PyInt_As_int(tmp);
3815#if CYTHON_USE_PYLONG_INTERNALS
3816 if (unlikely(__Pyx_PyLong_IsNeg(x))) {
3817 goto raise_neg_overflow;
3818 }
else if (__Pyx_PyLong_IsCompact(x)) {
3819 __PYX_VERIFY_RETURN_INT(
int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
3821 const digit* digits = __Pyx_PyLong_Digits(x);
3822 assert(__Pyx_PyLong_DigitCount(x) > 1);
3823 switch (__Pyx_PyLong_DigitCount(x)) {
3825 if ((8 *
sizeof(
int) > 1 * PyLong_SHIFT)) {
3826 if ((8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT)) {
3827 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
3828 }
else if ((8 *
sizeof(
int) >= 2 * PyLong_SHIFT)) {
3829 return (
int) (((((int)digits[1]) << PyLong_SHIFT) | (
int)digits[0]));
3834 if ((8 *
sizeof(
int) > 2 * PyLong_SHIFT)) {
3835 if ((8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT)) {
3836 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
3837 }
else if ((8 *
sizeof(
int) >= 3 * PyLong_SHIFT)) {
3838 return (
int) (((((((int)digits[2]) << PyLong_SHIFT) | (
int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
3843 if ((8 *
sizeof(
int) > 3 * PyLong_SHIFT)) {
3844 if ((8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT)) {
3845 __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])))
3846 }
else if ((8 *
sizeof(
int) >= 4 * PyLong_SHIFT)) {
3847 return (
int) (((((((((int)digits[3]) << PyLong_SHIFT) | (
int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (
int)digits[0]));
3854#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
3855 if (unlikely(Py_SIZE(x) < 0)) {
3856 goto raise_neg_overflow;
3860 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
3861 if (unlikely(result < 0))
3863 if (unlikely(result == 1))
3864 goto raise_neg_overflow;
3867 if ((
sizeof(
int) <=
sizeof(
unsigned long))) {
3868 __PYX_VERIFY_RETURN_INT_EXC(
int,
unsigned long, PyLong_AsUnsignedLong(x))
3869#ifdef HAVE_LONG_LONG
3870 }
else if ((
sizeof(
int) <=
sizeof(
unsigned PY_LONG_LONG))) {
3871 __PYX_VERIFY_RETURN_INT_EXC(
int,
unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
3875#if CYTHON_USE_PYLONG_INTERNALS
3876 if (__Pyx_PyLong_IsCompact(x)) {
3877 __PYX_VERIFY_RETURN_INT(
int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
3879 const digit* digits = __Pyx_PyLong_Digits(x);
3880 assert(__Pyx_PyLong_DigitCount(x) > 1);
3881 switch (__Pyx_PyLong_SignedDigitCount(x)) {
3883 if ((8 *
sizeof(
int) - 1 > 1 * PyLong_SHIFT)) {
3884 if ((8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT)) {
3885 __PYX_VERIFY_RETURN_INT(
int,
long, -(
long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
3886 }
else if ((8 *
sizeof(
int) - 1 > 2 * PyLong_SHIFT)) {
3887 return (
int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
3892 if ((8 *
sizeof(
int) > 1 * PyLong_SHIFT)) {
3893 if ((8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT)) {
3894 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
3895 }
else if ((8 *
sizeof(
int) - 1 > 2 * PyLong_SHIFT)) {
3896 return (
int) ((((((int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
3901 if ((8 *
sizeof(
int) - 1 > 2 * PyLong_SHIFT)) {
3902 if ((8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT)) {
3903 __PYX_VERIFY_RETURN_INT(
int,
long, -(
long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
3904 }
else if ((8 *
sizeof(
int) - 1 > 3 * PyLong_SHIFT)) {
3905 return (
int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (
int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
3910 if ((8 *
sizeof(
int) > 2 * PyLong_SHIFT)) {
3911 if ((8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT)) {
3912 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
3913 }
else if ((8 *
sizeof(
int) - 1 > 3 * PyLong_SHIFT)) {
3914 return (
int) ((((((((int)digits[2]) << PyLong_SHIFT) | (
int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
3919 if ((8 *
sizeof(
int) - 1 > 3 * PyLong_SHIFT)) {
3920 if ((8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT)) {
3921 __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])))
3922 }
else if ((8 *
sizeof(
int) - 1 > 4 * PyLong_SHIFT)) {
3923 return (
int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (
int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
3928 if ((8 *
sizeof(
int) > 3 * PyLong_SHIFT)) {
3929 if ((8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT)) {
3930 __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])))
3931 }
else if ((8 *
sizeof(
int) - 1 > 4 * PyLong_SHIFT)) {
3932 return (
int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (
int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
3939 if ((
sizeof(
int) <=
sizeof(long))) {
3940 __PYX_VERIFY_RETURN_INT_EXC(
int,
long, PyLong_AsLong(x))
3941#ifdef HAVE_LONG_LONG
3942 }
else if ((
sizeof(
int) <=
sizeof(PY_LONG_LONG))) {
3943 __PYX_VERIFY_RETURN_INT_EXC(
int, PY_LONG_LONG, PyLong_AsLongLong(x))
3950#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
3951 Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
3952 x, &val,
sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
3953 if (unlikely(bytes_copied == -1)) {
3954 }
else if (unlikely(bytes_copied > (Py_ssize_t)
sizeof(val))) {
3955 goto raise_overflow;
3959#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
3960 int one = 1;
int is_little = (int)*(
unsigned char *)&one;
3961 unsigned char *bytes = (
unsigned char *)&val;
3962 ret = _PyLong_AsByteArray((PyLongObject *)x,
3964 is_little, !is_unsigned);
3967 PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
3968 int bits, remaining_bits, is_negative = 0;
3969 int chunk_size = (
sizeof(long) < 8) ? 30 : 62;
3970 if (likely(PyLong_CheckExact(x))) {
3971 v = __Pyx_NewRef(x);
3973 v = PyNumber_Long(x);
3974 if (unlikely(!v))
return (
int) -1;
3975 assert(PyLong_CheckExact(v));
3978 int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
3979 if (unlikely(result < 0)) {
3983 is_negative = result == 1;
3985 if (is_unsigned && unlikely(is_negative)) {
3987 goto raise_neg_overflow;
3988 }
else if (is_negative) {
3989 stepval = PyNumber_Invert(v);
3991 if (unlikely(!stepval))
3998 mask = PyLong_FromLong((1L << chunk_size) - 1);
if (unlikely(!mask))
goto done;
3999 shift = PyLong_FromLong(chunk_size);
if (unlikely(!shift))
goto done;
4000 for (bits = 0; bits < (int)
sizeof(
int) * 8 - chunk_size; bits += chunk_size) {
4001 PyObject *tmp, *digit;
4003 digit = PyNumber_And(stepval, mask);
4004 if (unlikely(!digit))
goto done;
4005 idigit = PyLong_AsLong(digit);
4007 if (unlikely(idigit < 0))
goto done;
4008 val |= ((int) idigit) << bits;
4009 tmp = PyNumber_Rshift(stepval, shift);
4010 if (unlikely(!tmp))
goto done;
4011 Py_DECREF(stepval); stepval = tmp;
4013 Py_DECREF(shift); shift = NULL;
4014 Py_DECREF(mask); mask = NULL;
4016 long idigit = PyLong_AsLong(stepval);
4017 if (unlikely(idigit < 0))
goto done;
4018 remaining_bits = ((int)
sizeof(
int) * 8) - bits - (is_unsigned ? 0 : 1);
4019 if (unlikely(idigit >= (1L << remaining_bits)))
4020 goto raise_overflow;
4021 val |= ((int) idigit) << bits;
4024 if (unlikely(val & (((
int) 1) << (
sizeof(
int) * 8 - 1))))
4025 goto raise_overflow;
4033 Py_XDECREF(stepval);
4040 PyErr_SetString(PyExc_OverflowError,
4041 "value too large to convert to int");
4044 PyErr_SetString(PyExc_OverflowError,
4045 "can't convert negative value to int");
4050#if CYTHON_COMPILING_IN_CPYTHON
4051static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
4053 a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*);
4057 return b == &PyBaseObject_Type;
4059static CYTHON_INLINE
int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
4061 if (a == b)
return 1;
4065 n = PyTuple_GET_SIZE(mro);
4066 for (i = 0; i < n; i++) {
4067 if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
4072 return __Pyx_InBases(a, b);
4074static CYTHON_INLINE
int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) {
4076 if (cls == a || cls == b)
return 1;
4080 n = PyTuple_GET_SIZE(mro);
4081 for (i = 0; i < n; i++) {
4082 PyObject *base = PyTuple_GET_ITEM(mro, i);
4083 if (base == (PyObject *)a || base == (PyObject *)b)
4088 return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b);
4090#if PY_MAJOR_VERSION == 2
4091static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
4092 PyObject *exception, *value, *tb;
4094 __Pyx_PyThreadState_declare
4095 __Pyx_PyThreadState_assign
4096 __Pyx_ErrFetch(&exception, &value, &tb);
4097 res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
4098 if (unlikely(res == -1)) {
4099 PyErr_WriteUnraisable(err);
4103 res = PyObject_IsSubclass(err, exc_type2);
4104 if (unlikely(res == -1)) {
4105 PyErr_WriteUnraisable(err);
4109 __Pyx_ErrRestore(exception, value, tb);
4113static CYTHON_INLINE
int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
4115 return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2);
4117 return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
4121static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
4123 assert(PyExceptionClass_Check(exc_type));
4124 n = PyTuple_GET_SIZE(tuple);
4125#if PY_MAJOR_VERSION >= 3
4126 for (i=0; i<n; i++) {
4127 if (exc_type == PyTuple_GET_ITEM(tuple, i))
return 1;
4130 for (i=0; i<n; i++) {
4131 PyObject *t = PyTuple_GET_ITEM(tuple, i);
4132 #if PY_MAJOR_VERSION < 3
4133 if (likely(exc_type == t))
return 1;
4135 if (likely(PyExceptionClass_Check(t))) {
4136 if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t))
return 1;
4142static CYTHON_INLINE
int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
4143 if (likely(err == exc_type))
return 1;
4144 if (likely(PyExceptionClass_Check(err))) {
4145 if (likely(PyExceptionClass_Check(exc_type))) {
4146 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
4147 }
else if (likely(PyTuple_Check(exc_type))) {
4148 return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
4152 return PyErr_GivenExceptionMatches(err, exc_type);
4154static CYTHON_INLINE
int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
4155 assert(PyExceptionClass_Check(exc_type1));
4156 assert(PyExceptionClass_Check(exc_type2));
4157 if (likely(err == exc_type1 || err == exc_type2))
return 1;
4158 if (likely(PyExceptionClass_Check(err))) {
4159 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
4161 return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
4166static unsigned long __Pyx_get_runtime_version(
void) {
4167#if __PYX_LIMITED_VERSION_HEX >= 0x030B00A4
4168 return Py_Version & ~0xFFUL;
4170 const char* rt_version = Py_GetVersion();
4171 unsigned long version = 0;
4172 unsigned long factor = 0x01000000UL;
4173 unsigned int digit = 0;
4176 while (
'0' <= rt_version[i] && rt_version[i] <=
'9') {
4177 digit = digit * 10 + (
unsigned int) (rt_version[i] -
'0');
4180 version += factor * digit;
4181 if (rt_version[i] !=
'.')
4190static int __Pyx_check_binary_version(
unsigned long ct_version,
unsigned long rt_version,
int allow_newer) {
4191 const unsigned long MAJOR_MINOR = 0xFFFF0000UL;
4192 if ((rt_version & MAJOR_MINOR) == (ct_version & MAJOR_MINOR))
4194 if (likely(allow_newer && (rt_version & MAJOR_MINOR) > (ct_version & MAJOR_MINOR)))
4198 PyOS_snprintf(message,
sizeof(message),
4199 "compile time Python version %d.%d "
4200 "of module '%.100s' "
4202 "runtime version %d.%d",
4203 (
int) (ct_version >> 24), (
int) ((ct_version >> 16) & 0xFF),
4205 (allow_newer) ?
"was newer than" :
"does not match",
4206 (int) (rt_version >> 24), (int) ((rt_version >> 16) & 0xFF)
4208 return PyErr_WarnEx(NULL, message, 1);
4213static int __Pyx_ExportFunction(
const char *name,
void (*f)(
void),
const char *sig) {
4220 d = PyObject_GetAttrString(__pyx_m, (
char *)
"__pyx_capi__");
4227 if (PyModule_AddObject(__pyx_m, (
char *)
"__pyx_capi__", d) < 0)
4231 cobj = PyCapsule_New(tmp.p, sig, 0);
4234 if (PyDict_SetItemString(d, name, cobj) < 0)
4246#if PY_MAJOR_VERSION >= 3
4247static int __Pyx_InitString(__Pyx_StringTabEntry t, PyObject **str) {
4248 if (t.is_unicode | t.is_str) {
4250 *str = PyUnicode_InternFromString(t.s);
4251 }
else if (t.encoding) {
4252 *str = PyUnicode_Decode(t.s, t.n - 1, t.encoding, NULL);
4254 *str = PyUnicode_FromStringAndSize(t.s, t.n - 1);
4257 *str = PyBytes_FromStringAndSize(t.s, t.n - 1);
4261 if (PyObject_Hash(*str) == -1)
4266static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
4268 #if PY_MAJOR_VERSION >= 3
4269 __Pyx_InitString(*t, t->p);
4271 if (t->is_unicode) {
4272 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
4273 }
else if (t->intern) {
4274 *t->p = PyString_InternFromString(t->s);
4276 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
4280 if (PyObject_Hash(*t->p) == -1)
4289static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(
const char *s) {
4290 size_t len = strlen(s);
4291 if (unlikely(len > (
size_t) PY_SSIZE_T_MAX)) {
4292 PyErr_SetString(PyExc_OverflowError,
"byte string is too long");
4295 return (Py_ssize_t) len;
4297static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(
const char* c_str) {
4298 Py_ssize_t len = __Pyx_ssize_strlen(c_str);
4299 if (unlikely(len < 0))
return NULL;
4300 return __Pyx_PyUnicode_FromStringAndSize(c_str, len);
4302static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(
const char* c_str) {
4303 Py_ssize_t len = __Pyx_ssize_strlen(c_str);
4304 if (unlikely(len < 0))
return NULL;
4305 return PyByteArray_FromStringAndSize(c_str, len);
4307static CYTHON_INLINE
const char* __Pyx_PyObject_AsString(PyObject* o) {
4309 return __Pyx_PyObject_AsStringAndSize(o, &ignore);
4311#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
4312#if !CYTHON_PEP393_ENABLED
4313static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
4315 PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
4316 if (!defenc)
return NULL;
4317 defenc_c = PyBytes_AS_STRING(defenc);
4318#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
4320 char*
end = defenc_c + PyBytes_GET_SIZE(defenc);
4322 for (c = defenc_c; c <
end; c++) {
4323 if ((
unsigned char) (*c) >= 128) {
4324 PyUnicode_AsASCIIString(o);
4330 *length = PyBytes_GET_SIZE(defenc);
4334static CYTHON_INLINE
const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
4335 if (unlikely(__Pyx_PyUnicode_READY(o) == -1))
return NULL;
4336#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
4337 if (likely(PyUnicode_IS_ASCII(o))) {
4338 *length = PyUnicode_GET_LENGTH(o);
4339 return PyUnicode_AsUTF8(o);
4341 PyUnicode_AsASCIIString(o);
4345 return PyUnicode_AsUTF8AndSize(o, length);
4350static CYTHON_INLINE
const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
4351#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
4353#
if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
4354 __Pyx_sys_getdefaultencoding_not_ascii &&
4356 PyUnicode_Check(o)) {
4357 return __Pyx_PyUnicode_AsStringAndSize(o, length);
4360#if (!CYTHON_COMPILING_IN_PYPY && !CYTHON_COMPILING_IN_LIMITED_API) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
4361 if (PyByteArray_Check(o)) {
4362 *length = PyByteArray_GET_SIZE(o);
4363 return PyByteArray_AS_STRING(o);
4368 int r = PyBytes_AsStringAndSize(o, &result, length);
4369 if (unlikely(r < 0)) {
4376static CYTHON_INLINE
int __Pyx_PyObject_IsTrue(PyObject* x) {
4377 int is_true = x == Py_True;
4378 if (is_true | (x == Py_False) | (x == Py_None))
return is_true;
4379 else return PyObject_IsTrue(x);
4381static CYTHON_INLINE
int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
4383 if (unlikely(!x))
return -1;
4384 retval = __Pyx_PyObject_IsTrue(x);
4388static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result,
const char* type_name) {
4389 __Pyx_TypeName result_type_name = __Pyx_PyType_GetName(Py_TYPE(result));
4390#if PY_MAJOR_VERSION >= 3
4391 if (PyLong_Check(result)) {
4392 if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
4393 "__int__ returned non-int (type " __Pyx_FMT_TYPENAME
"). "
4394 "The ability to return an instance of a strict subclass of int is deprecated, "
4395 "and may be removed in a future version of Python.",
4396 result_type_name)) {
4397 __Pyx_DECREF_TypeName(result_type_name);
4401 __Pyx_DECREF_TypeName(result_type_name);
4405 PyErr_Format(PyExc_TypeError,
4406 "__%.4s__ returned non-%.4s (type " __Pyx_FMT_TYPENAME
")",
4407 type_name, type_name, result_type_name);
4408 __Pyx_DECREF_TypeName(result_type_name);
4412static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
4413#if CYTHON_USE_TYPE_SLOTS
4416 const char *
name = NULL;
4417 PyObject *res = NULL;
4418#if PY_MAJOR_VERSION < 3
4419 if (likely(PyInt_Check(x) || PyLong_Check(x)))
4421 if (likely(PyLong_Check(x)))
4423 return __Pyx_NewRef(x);
4424#if CYTHON_USE_TYPE_SLOTS
4425 m = Py_TYPE(x)->tp_as_number;
4426 #if PY_MAJOR_VERSION < 3
4427 if (m && m->nb_int) {
4431 else if (m && m->nb_long) {
4433 res = m->nb_long(x);
4436 if (likely(m && m->nb_int)) {
4442 if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
4443 res = PyNumber_Int(x);
4447#if PY_MAJOR_VERSION < 3
4448 if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
4450 if (unlikely(!PyLong_CheckExact(res))) {
4452 return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
4455 else if (!PyErr_Occurred()) {
4456 PyErr_SetString(PyExc_TypeError,
4457 "an integer is required");
4461static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
4464#if PY_MAJOR_VERSION < 3
4465 if (likely(PyInt_CheckExact(b))) {
4466 if (
sizeof(Py_ssize_t) >=
sizeof(
long))
4467 return PyInt_AS_LONG(b);
4469 return PyInt_AsSsize_t(b);
4472 if (likely(PyLong_CheckExact(b))) {
4473 #if CYTHON_USE_PYLONG_INTERNALS
4474 if (likely(__Pyx_PyLong_IsCompact(b))) {
4475 return __Pyx_PyLong_CompactValue(b);
4477 const digit* digits = __Pyx_PyLong_Digits(b);
4478 const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b);
4481 if (8 *
sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
4482 return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0]));
4486 if (8 *
sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
4487 return -(Py_ssize_t) (((((
size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
4491 if (8 *
sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
4492 return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (
size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
4496 if (8 *
sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
4497 return -(Py_ssize_t) (((((((
size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0]));
4501 if (8 *
sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
4502 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]));
4506 if (8 *
sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
4507 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]));
4513 return PyLong_AsSsize_t(b);
4515 x = PyNumber_Index(b);
4517 ival = PyInt_AsSsize_t(x);
4521static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) {
4522 if (
sizeof(Py_hash_t) ==
sizeof(Py_ssize_t)) {
4523 return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o);
4524#if PY_MAJOR_VERSION < 3
4525 }
else if (likely(PyInt_CheckExact(o))) {
4526 return PyInt_AS_LONG(o);
4531 x = PyNumber_Index(o);
4533 ival = PyInt_AsLong(x);
4538static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(
long b) {
4539 return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
4541static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(
size_t ival) {
4542 return PyInt_FromSize_t(ival);
4548#pragma warning( pop )
PyMODINIT_FUNC initeventhooks(void)
__PYX_EXTERN_C void CyclusEventLoopHook(void)
bool operator==(const CapacityConstraint< T > &lhs, const CapacityConstraint< T > &rhs)
CapacityConstraint-CapacityConstraint equality operator.
enable_if< has_const_iterator< T >::value, typenameT::const_iterator >::type end(const T &c)
std::string name(int nuc)
int offset(int dz, int da, int ds=0)
A helper function to compute nuclide id offsets from z-, a-, and s- deltas.
unsigned int hash(std::string s)
double b(int nuc)
Computes the scattering length [cm] from the coherent and incoherent components.