CYCLUS
Loading...
Searching...
No Matches
eventhooks.cc
Go to the documentation of this file.
1/* Generated by Cython 3.0.11 */
2
3#ifndef PY_SSIZE_T_CLEAN
4#define PY_SSIZE_T_CLEAN
5#endif /* PY_SSIZE_T_CLEAN */
6#if defined(CYTHON_LIMITED_API) && 0
7 #ifndef Py_LIMITED_API
8 #if CYTHON_LIMITED_API+0 > 0x03030000
9 #define Py_LIMITED_API CYTHON_LIMITED_API
10 #else
11 #define Py_LIMITED_API 0x03030000
12 #endif
13 #endif
14#endif
15
16#include "Python.h"
17#ifndef Py_PYTHON_H
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+.
21#else
22#if defined(CYTHON_LIMITED_API) && CYTHON_LIMITED_API
23#define __PYX_EXTRA_ABI_MODULE_NAME "limited"
24#else
25#define __PYX_EXTRA_ABI_MODULE_NAME ""
26#endif
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
32#include <stddef.h>
33#ifndef offsetof
34 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
35#endif
36#if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS)
37 #ifndef __stdcall
38 #define __stdcall
39 #endif
40 #ifndef __cdecl
41 #define __cdecl
42 #endif
43 #ifndef __fastcall
44 #define __fastcall
45 #endif
46#endif
47#ifndef DL_IMPORT
48 #define DL_IMPORT(t) t
49#endif
50#ifndef DL_EXPORT
51 #define DL_EXPORT(t) t
52#endif
53#define __PYX_COMMA ,
54#ifndef HAVE_LONG_LONG
55 #define HAVE_LONG_LONG
56#endif
57#ifndef PY_LONG_LONG
58 #define PY_LONG_LONG LONG_LONG
59#endif
60#ifndef Py_HUGE_VAL
61 #define Py_HUGE_VAL HUGE_VAL
62#endif
63#define __PYX_LIMITED_VERSION_HEX PY_VERSION_HEX
64#if defined(GRAALVM_PYTHON)
65 /* For very preliminary testing purposes. Most variables are set the same as PyPy.
66 The existence of this section does not imply that anything works or is even tested */
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
83 #endif
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)
108 #endif
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
121 #endif
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
134 #endif
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
142 #endif
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)
167 #endif
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
173 #endif
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
184 #endif
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
191 #endif
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
213 #endif
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
218 #endif
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
233 #endif
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
240 #endif
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
247 #endif
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
258 #endif
259 #ifndef CYTHON_USE_TYPE_SPECS
260 #define CYTHON_USE_TYPE_SPECS 0
261 #endif
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
266 #endif
267 #ifndef CYTHON_USE_PYLONG_INTERNALS
268 #define CYTHON_USE_PYLONG_INTERNALS 0
269 #endif
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
274 #endif
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
279 #endif
280 #ifndef CYTHON_ASSUME_SAFE_MACROS
281 #define CYTHON_ASSUME_SAFE_MACROS 1
282 #endif
283 #ifndef CYTHON_UNPACK_METHODS
284 #define CYTHON_UNPACK_METHODS 1
285 #endif
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
292 #endif
293 #undef CYTHON_FAST_PYCALL
294 #define CYTHON_FAST_PYCALL 0
295 #ifndef CYTHON_PEP487_INIT_SUBCLASS
296 #define CYTHON_PEP487_INIT_SUBCLASS 1
297 #endif
298 #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
299 #define CYTHON_PEP489_MULTI_PHASE_INIT 1
300 #endif
301 #ifndef CYTHON_USE_MODULE_STATE
302 #define CYTHON_USE_MODULE_STATE 0
303 #endif
304 #ifndef CYTHON_USE_TP_FINALIZE
305 #define CYTHON_USE_TP_FINALIZE 1
306 #endif
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
313 #endif
314 #ifndef CYTHON_USE_FREELISTS
315 #define CYTHON_USE_FREELISTS 0
316 #endif
317#else
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
325 #endif
326 #ifndef CYTHON_USE_TYPE_SPECS
327 #define CYTHON_USE_TYPE_SPECS 0
328 #endif
329 #ifndef CYTHON_USE_PYTYPE_LOOKUP
330 #define CYTHON_USE_PYTYPE_LOOKUP 1
331 #endif
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
337 #endif
338 #ifndef CYTHON_USE_PYLONG_INTERNALS
339 #define CYTHON_USE_PYLONG_INTERNALS 1
340 #endif
341 #ifndef CYTHON_USE_PYLIST_INTERNALS
342 #define CYTHON_USE_PYLIST_INTERNALS 1
343 #endif
344 #ifndef CYTHON_USE_UNICODE_INTERNALS
345 #define CYTHON_USE_UNICODE_INTERNALS 1
346 #endif
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
352 #endif
353 #ifndef CYTHON_AVOID_BORROWED_REFS
354 #define CYTHON_AVOID_BORROWED_REFS 0
355 #endif
356 #ifndef CYTHON_ASSUME_SAFE_MACROS
357 #define CYTHON_ASSUME_SAFE_MACROS 1
358 #endif
359 #ifndef CYTHON_UNPACK_METHODS
360 #define CYTHON_UNPACK_METHODS 1
361 #endif
362 #ifndef CYTHON_FAST_THREAD_STATE
363 #define CYTHON_FAST_THREAD_STATE 1
364 #endif
365 #ifndef CYTHON_FAST_GIL
366 #define CYTHON_FAST_GIL (PY_MAJOR_VERSION < 3 || PY_VERSION_HEX >= 0x03060000 && PY_VERSION_HEX < 0x030C00A6)
367 #endif
368 #ifndef CYTHON_METH_FASTCALL
369 #define CYTHON_METH_FASTCALL (PY_VERSION_HEX >= 0x030700A1)
370 #endif
371 #ifndef CYTHON_FAST_PYCALL
372 #define CYTHON_FAST_PYCALL 1
373 #endif
374 #ifndef CYTHON_PEP487_INIT_SUBCLASS
375 #define CYTHON_PEP487_INIT_SUBCLASS 1
376 #endif
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
382 #endif
383 #ifndef CYTHON_USE_MODULE_STATE
384 #define CYTHON_USE_MODULE_STATE 0
385 #endif
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
391 #endif
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)
397 #endif
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
403 #endif
404 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
405 #define CYTHON_UPDATE_DESCRIPTOR_DOC 1
406 #endif
407 #ifndef CYTHON_USE_FREELISTS
408 #define CYTHON_USE_FREELISTS 1
409 #endif
410#endif
411#if !defined(CYTHON_FAST_PYCCALL)
412#define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
413#endif
414#if !defined(CYTHON_VECTORCALL)
415#define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL && PY_VERSION_HEX >= 0x030800B1)
416#endif
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"
421 #endif
422 #undef SHIFT
423 #undef BASE
424 #undef MASK
425 #ifdef SIZEOF_VOID_P
426 enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
427 #endif
428#endif
429#ifndef __has_attribute
430 #define __has_attribute(x) 0
431#endif
432#ifndef __has_cpp_attribute
433 #define __has_cpp_attribute(x) 0
434#endif
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
442 #else
443 #define CYTHON_RESTRICT
444 #endif
445#endif
446#ifndef CYTHON_UNUSED
447 #if defined(__cplusplus)
448 /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17
449 * but leads to warnings with -pedantic, since it is a C++17 feature */
450 #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
451 #if __has_cpp_attribute(maybe_unused)
452 #define CYTHON_UNUSED [[maybe_unused]]
453 #endif
454 #endif
455 #endif
456#endif
457#ifndef CYTHON_UNUSED
458# if defined(__GNUC__)
459# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
460# define CYTHON_UNUSED __attribute__ ((__unused__))
461# else
462# define CYTHON_UNUSED
463# endif
464# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
465# define CYTHON_UNUSED __attribute__ ((__unused__))
466# else
467# define CYTHON_UNUSED
468# endif
469#endif
470#ifndef CYTHON_UNUSED_VAR
471# if defined(__cplusplus)
472 template<class T> void CYTHON_UNUSED_VAR( const T& ) { }
473# else
474# define CYTHON_UNUSED_VAR(x) (void)(x)
475# endif
476#endif
477#ifndef CYTHON_MAYBE_UNUSED_VAR
478 #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x)
479#endif
480#ifndef CYTHON_NCP_UNUSED
481# if CYTHON_COMPILING_IN_CPYTHON
482# define CYTHON_NCP_UNUSED
483# else
484# define CYTHON_NCP_UNUSED CYTHON_UNUSED
485# endif
486#endif
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
491 #else
492 #define CYTHON_USE_CPP_STD_MOVE 0
493 #endif
494#endif
495#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
496#ifdef _MSC_VER
497 #ifndef _MSC_STDINT_H_
498 #if _MSC_VER < 1300
499 typedef unsigned char uint8_t;
500 typedef unsigned short uint16_t;
501 typedef unsigned int uint32_t;
502 #else
503 typedef unsigned __int8 uint8_t;
504 typedef unsigned __int16 uint16_t;
505 typedef unsigned __int32 uint32_t;
506 #endif
507 #endif
508 #if _MSC_VER < 1300
509 #ifdef _WIN64
510 typedef unsigned long long __pyx_uintptr_t;
511 #else
512 typedef unsigned int __pyx_uintptr_t;
513 #endif
514 #else
515 #ifdef _WIN64
516 typedef unsigned __int64 __pyx_uintptr_t;
517 #else
518 typedef unsigned __int32 __pyx_uintptr_t;
519 #endif
520 #endif
521#else
522 #include <stdint.h>
523 typedef uintptr_t __pyx_uintptr_t;
524#endif
525#ifndef CYTHON_FALLTHROUGH
526 #if defined(__cplusplus)
527 /* for clang __has_cpp_attribute(fallthrough) is true even before C++17
528 * but leads to warnings with -pedantic, since it is a C++17 feature */
529 #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
530 #if __has_cpp_attribute(fallthrough)
531 #define CYTHON_FALLTHROUGH [[fallthrough]]
532 #endif
533 #endif
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]]
539 #endif
540 #endif
541 #endif
542 #ifndef CYTHON_FALLTHROUGH
543 #if __has_attribute(fallthrough)
544 #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
545 #else
546 #define CYTHON_FALLTHROUGH
547 #endif
548 #endif
549 #if defined(__clang__) && defined(__apple_build_version__)
550 #if __apple_build_version__ < 7000000
551 #undef CYTHON_FALLTHROUGH
552 #define CYTHON_FALLTHROUGH
553 #endif
554 #endif
555#endif
556#ifdef __cplusplus
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)
560#else
561 #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0)
562#endif
563#if CYTHON_COMPILING_IN_PYPY == 1
564 #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x030A0000)
565#else
566 #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000)
567#endif
568#define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer))
569
570#ifndef __cplusplus
571 #error "Cython files generated with the C++ option must be compiled with a C++ compiler."
572#endif
573#ifndef CYTHON_INLINE
574 #if defined(__clang__)
575 #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
576 #else
577 #define CYTHON_INLINE inline
578 #endif
579#endif
580template<typename T>
581void __Pyx_call_destructor(T& x) {
582 x.~T();
583}
584template<typename T>
585class __Pyx_FakeReference {
586 public:
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; }
596 private:
597 T *ptr;
598};
599
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)
607#else
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;
620 #endif
621 long minor_version = 0;
622 PyObject *type, *value, *traceback;
623 PyErr_Fetch(&type, &value, &traceback);
624 #if __PYX_LIMITED_VERSION_HEX >= 0x030B0000
625 minor_version = 11;
626 #else
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;
632 #endif
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) {
636 (void)p;
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);
642 } else {
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);
646 }
647 end:
648 Py_XDECREF(code_type);
649 Py_XDECREF(exception_table);
650 Py_XDECREF(types_module);
651 if (type) {
652 PyErr_Restore(type, value, traceback);
653 }
654 return result;
655 }
656 #ifndef CO_OPTIMIZED
657 #define CO_OPTIMIZED 0x0001
658 #endif
659 #ifndef CO_NEWLOCALS
660 #define CO_NEWLOCALS 0x0002
661 #endif
662 #ifndef CO_VARARGS
663 #define CO_VARARGS 0x0004
664 #endif
665 #ifndef CO_VARKEYWORDS
666 #define CO_VARKEYWORDS 0x0008
667 #endif
668 #ifndef CO_ASYNC_GENERATOR
669 #define CO_ASYNC_GENERATOR 0x0200
670 #endif
671 #ifndef CO_GENERATOR
672 #define CO_GENERATOR 0x0020
673 #endif
674 #ifndef CO_COROUTINE
675 #define CO_COROUTINE 0x0080
676 #endif
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;
685 result =
686 #if PY_VERSION_HEX >= 0x030C0000
687 PyUnstable_Code_NewWithPosOnlyArgs
688 #else
689 PyCode_NewWithPosOnlyArgs
690 #endif
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);
693 return result;
694 }
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)
698#else
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)
701#endif
702#endif
703#if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE)
704 #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type)
705#else
706 #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type))
707#endif
708#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is)
709 #define __Pyx_Py_Is(x, y) Py_Is(x, y)
710#else
711 #define __Pyx_Py_Is(x, y) ((x) == (y))
712#endif
713#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone)
714 #define __Pyx_Py_IsNone(ob) Py_IsNone(ob)
715#else
716 #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None)
717#endif
718#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue)
719 #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob)
720#else
721 #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True)
722#endif
723#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse)
724 #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob)
725#else
726 #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False)
727#endif
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)
731#else
732 #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o)
733#endif
734#ifndef CO_COROUTINE
735 #define CO_COROUTINE 0x80
736#endif
737#ifndef CO_ASYNC_GENERATOR
738 #define CO_ASYNC_GENERATOR 0x200
739#endif
740#ifndef Py_TPFLAGS_CHECKTYPES
741 #define Py_TPFLAGS_CHECKTYPES 0
742#endif
743#ifndef Py_TPFLAGS_HAVE_INDEX
744 #define Py_TPFLAGS_HAVE_INDEX 0
745#endif
746#ifndef Py_TPFLAGS_HAVE_NEWBUFFER
747 #define Py_TPFLAGS_HAVE_NEWBUFFER 0
748#endif
749#ifndef Py_TPFLAGS_HAVE_FINALIZE
750 #define Py_TPFLAGS_HAVE_FINALIZE 0
751#endif
752#ifndef Py_TPFLAGS_SEQUENCE
753 #define Py_TPFLAGS_SEQUENCE 0
754#endif
755#ifndef Py_TPFLAGS_MAPPING
756 #define Py_TPFLAGS_MAPPING 0
757#endif
758#ifndef METH_STACKLESS
759 #define METH_STACKLESS 0
760#endif
761#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
762 #ifndef METH_FASTCALL
763 #define METH_FASTCALL 0x80
764 #endif
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);
768#else
769 #if PY_VERSION_HEX >= 0x030d00A4
770 # define __Pyx_PyCFunctionFast PyCFunctionFast
771 # define __Pyx_PyCFunctionFastWithKeywords PyCFunctionFastWithKeywords
772 #else
773 # define __Pyx_PyCFunctionFast _PyCFunctionFast
774 # define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
775 #endif
776#endif
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
781#else
782 #define __Pyx_METH_FASTCALL METH_VARARGS
783 #define __Pyx_PyCFunction_FastCall PyCFunction
784 #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords
785#endif
786#if CYTHON_VECTORCALL
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))
795#else
796 #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0
797 #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n))
798#endif
799#if PY_MAJOR_VERSION >= 0x030900B1
800#define __Pyx_PyCFunction_CheckExact(func) PyCFunction_CheckExact(func)
801#else
802#define __Pyx_PyCFunction_CheckExact(func) PyCFunction_Check(func)
803#endif
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)
809#endif
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;
814}
815#endif
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;
819#else
820 return PyCFunction_Check(func) && PyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc;
821#endif
822}
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 *);
827#else
828 #define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b)
829 #define __Pyx_PyCMethod PyCMethod
830#endif
831#ifndef METH_METHOD
832 #define METH_METHOD 0x200
833#endif
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)
838#endif
839#if CYTHON_COMPILING_IN_LIMITED_API
840 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
841 #define __Pyx_PyFrame_SetLineNumber(frame, lineno)
842#else
843 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
844 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
845#endif
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()
856#else
857 #define __Pyx_PyThreadState_Current _PyThreadState_Current
858#endif
859#if CYTHON_COMPILING_IN_LIMITED_API
860static CYTHON_INLINE void *__Pyx_PyModule_GetState(PyObject *op)
861{
862 void *result;
863 result = PyModule_GetState(op);
864 if (!result)
865 Py_FatalError("Couldn't find the module state");
866 return result;
867}
868#endif
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))
872#else
873 #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name)
874#endif
875#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
876#include "pythread.h"
877#define Py_tss_NEEDS_INIT 0
878typedef int Py_tss_t;
879static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
880 *key = PyThread_create_key();
881 return 0;
882}
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;
886 return key;
887}
888static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
889 PyObject_Free(key);
890}
891static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
892 return *key != Py_tss_NEEDS_INIT;
893}
894static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
895 PyThread_delete_key(*key);
896 *key = Py_tss_NEEDS_INIT;
897}
898static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
899 return PyThread_set_key_value(*key, value);
900}
901static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
902 return PyThread_get_key_value(*key);
903}
904#endif
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"))
914 #endif
915 static CYTHON_INLINE int PyGILState_Check(void) {
916 return 0;
917 }
918 #else // PYPY_VERSION_NUM < 0x07030600
919 #endif // PYPY_VERSION_NUM < 0x07030600
920 #else
921 static CYTHON_INLINE int PyGILState_Check(void) {
922 PyThreadState * tstate = _PyThreadState_Current;
923 return tstate && (tstate == PyGILState_GetThisThreadState());
924 }
925 #endif
926#endif
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))
929#else
930#define __Pyx_PyDict_NewPresized(n) PyDict_New()
931#endif
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)
935#else
936 #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
937 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
938#endif
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();
944 return res;
945}
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
949#else
950static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) {
951#if CYTHON_COMPILING_IN_PYPY
952 return PyDict_GetItem(dict, name);
953#else
954 PyDictEntry *ep;
955 PyDictObject *mp = (PyDictObject*) dict;
956 long hash = ((PyStringObject *) name)->ob_shash;
957 assert(hash != -1);
958 ep = (mp->ma_lookup)(mp, name, hash);
959 if (ep == NULL) {
960 return NULL;
961 }
962 return ep->me_value;
963#endif
964}
965#define __Pyx_PyDict_GetItemStr PyDict_GetItem
966#endif
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)
971#else
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
975#endif
976#if CYTHON_COMPILING_IN_LIMITED_API
977 #define __Pyx_SetItemOnTypeDict(tp, k, v) PyObject_GenericSetAttr((PyObject*)tp, k, v)
978#else
979 #define __Pyx_SetItemOnTypeDict(tp, k, v) PyDict_SetItem(tp->tp_dict, k, v)
980#endif
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);\
986 Py_DECREF(type);\
987}
988#else
989#define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj)
990#endif
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)
1005 #else
1006 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
1007 0 : _PyUnicode_Ready((PyObject *)(op)))
1008 #endif
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))
1018 #else
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))
1021 #else
1022 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
1023 #endif
1024 #endif
1025#else
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))
1039#endif
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)
1043#else
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))
1047#endif
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)
1051 #endif
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)
1055 #endif
1056 #if !defined(PyByteArray_Check)
1057 #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
1058 #endif
1059 #if !defined(PyObject_Format)
1060 #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
1061 #endif
1062#endif
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)
1067#else
1068 #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
1069#endif
1070#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
1071 #define PyObject_ASCII(o) PyObject_Repr(o)
1072#endif
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
1081#endif
1082#endif
1083#if PY_MAJOR_VERSION >= 3
1084 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
1085 #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
1086#else
1087 #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
1088 #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
1089#endif
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))
1093#else
1094 #define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj)
1095#endif
1096#ifndef PySet_CheckExact
1097 #define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type)
1098#endif
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)
1102#else
1103 #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
1104 #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
1105#endif
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)
1116#else
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)
1126#endif
1127#if __PYX_LIMITED_VERSION_HEX >= 0x030d00A1
1128 #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name)
1129#else
1130 static CYTHON_INLINE PyObject *__Pyx_PyImport_AddModuleRef(const char *name) {
1131 PyObject *module = PyImport_AddModule(name);
1132 Py_XINCREF(module);
1133 return module;
1134 }
1135#endif
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
1154#else
1155 #define __Pyx_Py3Int_Check(op) (PyLong_Check(op) || PyInt_Check(op))
1156 #define __Pyx_Py3Int_CheckExact(op) (PyLong_CheckExact(op) || PyInt_CheckExact(op))
1157#endif
1158#if PY_MAJOR_VERSION >= 3
1159 #define PyBoolObject PyLongObject
1160#endif
1161#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
1162 #ifndef PyUnicode_InternFromString
1163 #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
1164 #endif
1165#endif
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
1170#else
1171 #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
1172 #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t
1173#endif
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)
1178 #else
1179 #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
1180 #endif
1181#else
1182 #define __Pyx_PyType_AsAsync(obj) NULL
1183#endif
1184#ifndef __Pyx_PyAsyncMethodsStruct
1185 typedef struct {
1186 unaryfunc am_await;
1187 unaryfunc am_aiter;
1188 unaryfunc am_anext;
1189 } __Pyx_PyAsyncMethodsStruct;
1190#endif
1191
1192#if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)
1193 #if !defined(_USE_MATH_DEFINES)
1194 #define _USE_MATH_DEFINES
1195 #endif
1196#endif
1197#include <math.h>
1198#ifdef NAN
1199#define __PYX_NAN() ((float) NAN)
1200#else
1201static CYTHON_INLINE float __PYX_NAN() {
1202 float value;
1203 memset(&value, 0xFF, sizeof(value));
1204 return value;
1205}
1206#endif
1207#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
1208#define __Pyx_truncl trunc
1209#else
1210#define __Pyx_truncl truncl
1211#endif
1212
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; }
1217
1218#ifdef CYTHON_EXTERN_C
1219 #undef __PYX_EXTERN_C
1220 #define __PYX_EXTERN_C CYTHON_EXTERN_C
1221#elif defined(__PYX_EXTERN_C)
1222 #ifdef _MSC_VER
1223 #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.")
1224 #else
1225 #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.
1226 #endif
1227#else
1228 #define __PYX_EXTERN_C extern "C++"
1229#endif
1230
1231#define __PYX_HAVE__eventhooks
1232#define __PYX_HAVE_API__eventhooks
1233/* Early includes */
1234#ifdef _OPENMP
1235#include <omp.h>
1236#endif /* _OPENMP */
1237
1238#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
1239#define CYTHON_WITHOUT_ASSERTIONS
1240#endif
1241
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;
1244
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;
1265}
1266#if defined (__cplusplus) && __cplusplus >= 201103L
1267 #include <cstdlib>
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)
1279#else
1280 #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
1281#endif
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
1293#else
1294 #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
1295 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
1296#endif
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))
1328#else
1329#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
1330#endif
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))
1334#else
1335#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
1336#endif
1337#if CYTHON_USE_PYLONG_INTERNALS
1338 #if PY_VERSION_HEX >= 0x030C00A7
1339 #ifndef _PyLong_SIGN_MASK
1340 #define _PyLong_SIGN_MASK 3
1341 #endif
1342 #ifndef _PyLong_NON_SIZE_BITS
1343 #define _PyLong_NON_SIZE_BITS 3
1344 #endif
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)
1357 #else
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])
1360 #endif
1361 typedef Py_ssize_t __Pyx_compact_pylong;
1362 typedef size_t __Pyx_compact_upylong;
1363 #else
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;
1376 #endif
1377 #if PY_VERSION_HEX >= 0x030C00A5
1378 #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit)
1379 #else
1380 #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit)
1381 #endif
1382#endif
1383#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
1384#include <string.h>
1385static int __Pyx_sys_getdefaultencoding_not_ascii;
1386static int __Pyx_init_sys_getdefaultencoding_params(void) {
1387 PyObject* sys;
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");
1393 if (!sys) goto bad;
1394 default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
1395 Py_DECREF(sys);
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;
1401 } else {
1402 char ascii_chars[128];
1403 int c;
1404 for (c = 0; c < 128; c++) {
1405 ascii_chars[c] = (char) c;
1406 }
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) {
1412 PyErr_Format(
1413 PyExc_ValueError,
1414 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
1415 default_encoding_c);
1416 goto bad;
1417 }
1418 Py_DECREF(ascii_chars_u);
1419 Py_DECREF(ascii_chars_b);
1420 }
1421 Py_DECREF(default_encoding);
1422 return 0;
1423bad:
1424 Py_XDECREF(default_encoding);
1425 Py_XDECREF(ascii_chars_u);
1426 Py_XDECREF(ascii_chars_b);
1427 return -1;
1428}
1429#endif
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)
1432#else
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
1435#include <string.h>
1436static char* __PYX_DEFAULT_STRING_ENCODING;
1437static int __Pyx_init_sys_getdefaultencoding_params(void) {
1438 PyObject* sys;
1439 PyObject* default_encoding = NULL;
1440 char* default_encoding_c;
1441 sys = PyImport_ImportModule("sys");
1442 if (!sys) goto bad;
1443 default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
1444 Py_DECREF(sys);
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);
1452 return 0;
1453bad:
1454 Py_XDECREF(default_encoding);
1455 return -1;
1456}
1457#endif
1458#endif
1459
1460
1461/* Test for GCC > 2.95 */
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)
1465#else /* !__GNUC__ or GCC < 2.95 */
1466 #define likely(x) (x)
1467 #define unlikely(x) (x)
1468#endif /* __GNUC__ */
1469static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
1470
1471#if !CYTHON_USE_MODULE_STATE
1472static PyObject *__pyx_m = NULL;
1473#endif
1474static int __pyx_lineno;
1475static int __pyx_clineno = 0;
1476static const char * __pyx_cfilenm = __FILE__;
1477static const char *__pyx_filename;
1478
1479/* #### Code section: filename_table ### */
1480
1481static const char *__pyx_f[] = {
1482 "eventhooks.pyx",
1483};
1484/* #### Code section: utility_code_proto_before_types ### */
1485/* ForceInitThreads.proto */
1486#ifndef __PYX_FORCE_INIT_THREADS
1487 #define __PYX_FORCE_INIT_THREADS 0
1488#endif
1489
1490/* #### Code section: numeric_typedefs ### */
1491/* #### Code section: complex_type_declarations ### */
1492/* #### Code section: type_declarations ### */
1493
1494/*--- Type declarations ---*/
1495/* #### Code section: utility_code_proto ### */
1496
1497/* --- Runtime support code (head) --- */
1498/* Refnanny.proto */
1499#ifndef CYTHON_REFNANNY
1500 #define CYTHON_REFNANNY 0
1501#endif
1502#if CYTHON_REFNANNY
1503 typedef struct {
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;
1514#ifdef WITH_THREAD
1515 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1516 if (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);\
1520 } else {\
1521 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\
1522 }
1523 #define __Pyx_RefNannyFinishContextNogil() {\
1524 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1525 __Pyx_RefNannyFinishContext();\
1526 PyGILState_Release(__pyx_gilstate_save);\
1527 }
1528#else
1529 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1530 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__))
1531 #define __Pyx_RefNannyFinishContextNogil() __Pyx_RefNannyFinishContext()
1532#endif
1533 #define __Pyx_RefNannyFinishContextNogil() {\
1534 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1535 __Pyx_RefNannyFinishContext();\
1536 PyGILState_Release(__pyx_gilstate_save);\
1537 }
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)
1548#else
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)
1561#endif
1562#define __Pyx_Py_XDECREF_SET(r, v) do {\
1563 PyObject *tmp = (PyObject *) r;\
1564 r = v; Py_XDECREF(tmp);\
1565 } while (0)
1566#define __Pyx_XDECREF_SET(r, v) do {\
1567 PyObject *tmp = (PyObject *) r;\
1568 r = v; __Pyx_XDECREF(tmp);\
1569 } while (0)
1570#define __Pyx_DECREF_SET(r, v) do {\
1571 PyObject *tmp = (PyObject *) r;\
1572 r = v; __Pyx_DECREF(tmp);\
1573 } while (0)
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)
1576
1577/* PyObjectGetAttrStr.proto */
1578#if CYTHON_USE_TYPE_SLOTS
1579static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1580#else
1581#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1582#endif
1583
1584/* IncludeStringH.proto */
1585#include <string.h>
1586
1587/* Import.proto */
1588static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1589
1590/* ImportFrom.proto */
1591static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
1592
1593/* PyFunctionFastCall.proto */
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);
1599#endif
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)
1604#endif
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
1611 #endif
1612 #include "internal/pycore_frame.h"
1613#endif
1614 #define __Pxy_PyFrame_Initialize_Offsets()
1615 #define __Pyx_PyFrame_GetLocalsplus(frame) ((frame)->f_localsplus)
1616#else
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))
1624#endif
1625#endif
1626#endif
1627
1628/* PyObjectCall.proto */
1629#if CYTHON_COMPILING_IN_CPYTHON
1630static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1631#else
1632#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1633#endif
1634
1635/* PyObjectCallMethO.proto */
1636#if CYTHON_COMPILING_IN_CPYTHON
1637static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1638#endif
1639
1640/* PyObjectFastCall.proto */
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);
1643
1644/* PyDictVersioning.proto */
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;\
1656 } else {\
1657 (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1658 __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1659 }\
1660}
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);
1664#else
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);
1668#endif
1669
1670/* PyErrExceptionMatches.proto */
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);
1674#else
1675#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
1676#endif
1677
1678/* PyThreadStateGet.proto */
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)
1685#else
1686#define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL)
1687#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type)
1688#endif
1689#else
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()
1694#endif
1695
1696/* PyErrFetchRestore.proto */
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))
1707#else
1708#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1709#endif
1710#else
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)
1719#endif
1720
1721/* PyObjectGetAttrStrNoError.proto */
1722static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
1723
1724/* CLineInTraceback.proto */
1725#ifdef CYTHON_CLINE_IN_TRACEBACK
1726#define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1727#else
1728static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1729#endif
1730
1731/* CodeObjectCache.proto */
1732#if !CYTHON_COMPILING_IN_LIMITED_API
1733typedef struct {
1734 PyCodeObject* code_object;
1735 int code_line;
1736} __Pyx_CodeObjectCacheEntry;
1737struct __Pyx_CodeObjectCache {
1738 int count;
1739 int max_count;
1740 __Pyx_CodeObjectCacheEntry* entries;
1741};
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);
1746#endif
1747
1748/* AddTraceback.proto */
1749static void __Pyx_AddTraceback(const char *funcname, int c_line,
1750 int py_line, const char *filename);
1751
1752/* FormatTypeName.proto */
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)
1758#else
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)
1763#endif
1764
1765/* GCCDiagnostics.proto */
1766#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
1767#define __Pyx_HAS_GCC_DIAGNOSTIC
1768#endif
1769
1770/* CIntToPy.proto */
1771static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1772
1773/* CIntFromPy.proto */
1774static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
1775
1776/* CIntFromPy.proto */
1777static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
1778
1779/* FastTypeChecks.proto */
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);
1787#else
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))
1792#endif
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)
1795
1796/* CheckBinaryVersion.proto */
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);
1799
1800/* FunctionExport.proto */
1801static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig);
1802
1803/* InitStrings.proto */
1804static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1805
1806/* #### Code section: module_declarations ### */
1807
1808/* Module declarations from "eventhooks" */
1809__PYX_EXTERN_C void CyclusEventLoopHook(void); /*proto*/
1810/* #### Code section: typeinfo ### */
1811/* #### Code section: before_global_var ### */
1812#define __Pyx_MODULE_NAME "eventhooks"
1813extern int __pyx_module_is_main_eventhooks;
1814int __pyx_module_is_main_eventhooks = 0;
1815
1816/* Implementation of "eventhooks" */
1817/* #### Code section: global_var ### */
1818/* #### Code section: string_decls ### */
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.";
1829/* #### Code section: decls ### */
1830/* #### Code section: late_includes ### */
1831/* #### Code section: module_state ### */
1832typedef struct {
1833 PyObject *__pyx_d;
1834 PyObject *__pyx_b;
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;
1841 #endif
1842 #ifdef __Pyx_FusedFunction_USED
1843 PyTypeObject *__pyx_FusedFunctionType;
1844 #endif
1845 #ifdef __Pyx_Generator_USED
1846 PyTypeObject *__pyx_GeneratorType;
1847 #endif
1848 #ifdef __Pyx_IterableCoroutine_USED
1849 PyTypeObject *__pyx_IterableCoroutineType;
1850 #endif
1851 #ifdef __Pyx_Coroutine_USED
1852 PyTypeObject *__pyx_CoroutineAwaitType;
1853 #endif
1854 #ifdef __Pyx_Coroutine_USED
1855 PyTypeObject *__pyx_CoroutineType;
1856 #endif
1857 #if CYTHON_USE_MODULE_STATE
1858 #endif
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;
1868} __pyx_mstate;
1869
1870#if CYTHON_USE_MODULE_STATE
1871#ifdef __cplusplus
1872namespace {
1873 extern struct PyModuleDef __pyx_moduledef;
1874} /* anonymous namespace */
1875#else
1876static struct PyModuleDef __pyx_moduledef;
1877#endif
1878
1879#define __pyx_mstate(o) ((__pyx_mstate *)__Pyx_PyModule_GetState(o))
1880
1881#define __pyx_mstate_global (__pyx_mstate(PyState_FindModule(&__pyx_moduledef)))
1882
1883#define __pyx_m (PyState_FindModule(&__pyx_moduledef))
1884#else
1885static __pyx_mstate __pyx_mstate_global_static =
1886#ifdef __cplusplus
1887 {};
1888#else
1889 {0};
1890#endif
1891static __pyx_mstate *__pyx_mstate_global = &__pyx_mstate_global_static;
1892#endif
1893/* #### Code section: module_state_clear ### */
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);
1906 #endif
1907 #ifdef __Pyx_FusedFunction_USED
1908 Py_CLEAR(clear_module_state->__pyx_FusedFunctionType);
1909 #endif
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);
1919 return 0;
1920}
1921#endif
1922/* #### Code section: module_state_traverse ### */
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);
1935 #endif
1936 #ifdef __Pyx_FusedFunction_USED
1937 Py_VISIT(traverse_module_state->__pyx_FusedFunctionType);
1938 #endif
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);
1948 return 0;
1949}
1950#endif
1951/* #### Code section: module_state_defines ### */
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
1960#endif
1961#ifdef __Pyx_FusedFunction_USED
1962#define __pyx_FusedFunctionType __pyx_mstate_global->__pyx_FusedFunctionType
1963#endif
1964#ifdef __Pyx_Generator_USED
1965#define __pyx_GeneratorType __pyx_mstate_global->__pyx_GeneratorType
1966#endif
1967#ifdef __Pyx_IterableCoroutine_USED
1968#define __pyx_IterableCoroutineType __pyx_mstate_global->__pyx_IterableCoroutineType
1969#endif
1970#ifdef __Pyx_Coroutine_USED
1971#define __pyx_CoroutineAwaitType __pyx_mstate_global->__pyx_CoroutineAwaitType
1972#endif
1973#ifdef __Pyx_Coroutine_USED
1974#define __pyx_CoroutineType __pyx_mstate_global->__pyx_CoroutineType
1975#endif
1976#if CYTHON_USE_MODULE_STATE
1977#endif
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
1987/* #### Code section: module_code ### */
1988
1989/* "eventhooks.pyx":4
1990 * from __future__ import print_function, unicode_literals
1991 *
1992 * cdef public api void eventloophook "CyclusEventLoopHook" () except *: # <<<<<<<<<<<<<<
1993 * from cyclus.events import loop
1994 * loop()
1995 */
1996
1997void CyclusEventLoopHook(void) {
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);
2008
2009 /* "eventhooks.pyx":5
2010 *
2011 * cdef public api void eventloophook "CyclusEventLoopHook" () except *:
2012 * from cyclus.events import loop # <<<<<<<<<<<<<<
2013 * loop()
2014 *
2015 */
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;
2030
2031 /* "eventhooks.pyx":6
2032 * cdef public api void eventloophook "CyclusEventLoopHook" () except *:
2033 * from cyclus.events import loop
2034 * loop() # <<<<<<<<<<<<<<
2035 *
2036 *
2037 */
2038 __Pyx_INCREF(__pyx_v_loop);
2039 __pyx_t_1 = __pyx_v_loop; __pyx_t_3 = NULL;
2040 __pyx_t_4 = 0;
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);
2049 __pyx_t_4 = 1;
2050 }
2051 }
2052 #endif
2053 {
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;
2060 }
2061 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2062
2063 /* "eventhooks.pyx":4
2064 * from __future__ import print_function, unicode_literals
2065 *
2066 * cdef public api void eventloophook "CyclusEventLoopHook" () except *: # <<<<<<<<<<<<<<
2067 * from cyclus.events import loop
2068 * loop()
2069 */
2070
2071 /* function exit code */
2072 goto __pyx_L0;
2073 __pyx_L1_error:;
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);
2078 __pyx_L0:;
2079 __Pyx_XDECREF(__pyx_v_loop);
2080 __Pyx_RefNannyFinishContext();
2081}
2082
2083static PyMethodDef __pyx_methods[] = {
2084 {0, 0, 0, 0}
2085};
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))
2091#else
2092 #define CYTHON_SMALL_CODE
2093#endif
2094#endif
2095/* #### Code section: pystring_table ### */
2096
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}
2109 };
2110 return __Pyx_InitStrings(__pyx_string_tab);
2111}
2112/* #### Code section: cached_builtins ### */
2113static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
2114 return 0;
2115}
2116/* #### Code section: cached_constants ### */
2117
2118static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
2119 __Pyx_RefNannyDeclarations
2120 __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
2121 __Pyx_RefNannyFinishContext();
2122 return 0;
2123}
2124/* #### Code section: init_constants ### */
2125
2126static CYTHON_SMALL_CODE int __Pyx_InitConstants(void) {
2127 if (__Pyx_CreateStringTabAndInitStrings() < 0) __PYX_ERR(0, 1, __pyx_L1_error);
2128 return 0;
2129 __pyx_L1_error:;
2130 return -1;
2131}
2132/* #### Code section: init_globals ### */
2133
2134static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
2135 return 0;
2136}
2137/* #### Code section: init_module ### */
2138
2139static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
2140static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
2141static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
2142static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
2143static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
2144static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
2145static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
2146
2147static int __Pyx_modinit_global_init_code(void) {
2148 __Pyx_RefNannyDeclarations
2149 __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
2150 /*--- Global init code ---*/
2151 __Pyx_RefNannyFinishContext();
2152 return 0;
2153}
2154
2155static int __Pyx_modinit_variable_export_code(void) {
2156 __Pyx_RefNannyDeclarations
2157 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
2158 /*--- Variable export code ---*/
2159 __Pyx_RefNannyFinishContext();
2160 return 0;
2161}
2162
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);
2169 /*--- Function export code ---*/
2170 if (__Pyx_ExportFunction("eventloophook", (void (*)(void))CyclusEventLoopHook, "void (void)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2171 __Pyx_RefNannyFinishContext();
2172 return 0;
2173 __pyx_L1_error:;
2174 __Pyx_RefNannyFinishContext();
2175 return -1;
2176}
2177
2178static int __Pyx_modinit_type_init_code(void) {
2179 __Pyx_RefNannyDeclarations
2180 __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
2181 /*--- Type init code ---*/
2182 __Pyx_RefNannyFinishContext();
2183 return 0;
2184}
2185
2186static int __Pyx_modinit_type_import_code(void) {
2187 __Pyx_RefNannyDeclarations
2188 __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
2189 /*--- Type import code ---*/
2190 __Pyx_RefNannyFinishContext();
2191 return 0;
2192}
2193
2194static int __Pyx_modinit_variable_import_code(void) {
2195 __Pyx_RefNannyDeclarations
2196 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
2197 /*--- Variable import code ---*/
2198 __Pyx_RefNannyFinishContext();
2199 return 0;
2200}
2201
2202static int __Pyx_modinit_function_import_code(void) {
2203 __Pyx_RefNannyDeclarations
2204 __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
2205 /*--- Function import code ---*/
2206 __Pyx_RefNannyFinishContext();
2207 return 0;
2208}
2209
2210
2211#if PY_MAJOR_VERSION >= 3
2212#if CYTHON_PEP489_MULTI_PHASE_INIT
2213static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
2214static int __pyx_pymod_exec_eventhooks(PyObject* module); /*proto*/
2215static PyModuleDef_Slot __pyx_moduledef_slots[] = {
2216 {Py_mod_create, (void*)__pyx_pymod_create},
2217 {Py_mod_exec, (void*)__pyx_pymod_exec_eventhooks},
2218 {0, NULL}
2219};
2220#endif
2221
2222#ifdef __cplusplus
2223namespace {
2224 struct PyModuleDef __pyx_moduledef =
2225 #else
2226 static struct PyModuleDef __pyx_moduledef =
2227 #endif
2228 {
2229 PyModuleDef_HEAD_INIT,
2230 "eventhooks",
2231 __pyx_k_The_event_handling_module_in_cyc, /* m_doc */
2232 #if CYTHON_PEP489_MULTI_PHASE_INIT
2233 0, /* m_size */
2234 #elif CYTHON_USE_MODULE_STATE
2235 sizeof(__pyx_mstate), /* m_size */
2236 #else
2237 -1, /* m_size */
2238 #endif
2239 __pyx_methods /* m_methods */,
2240 #if CYTHON_PEP489_MULTI_PHASE_INIT
2241 __pyx_moduledef_slots, /* m_slots */
2242 #else
2243 NULL, /* m_reload */
2244 #endif
2245 #if CYTHON_USE_MODULE_STATE
2246 __pyx_m_traverse, /* m_traverse */
2247 __pyx_m_clear, /* m_clear */
2248 NULL /* m_free */
2249 #else
2250 NULL, /* m_traverse */
2251 NULL, /* m_clear */
2252 NULL /* m_free */
2253 #endif
2254 };
2255 #ifdef __cplusplus
2256} /* anonymous namespace */
2257#endif
2258#endif
2259
2260#ifndef CYTHON_NO_PYINIT_EXPORT
2261#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
2262#elif PY_MAJOR_VERSION < 3
2263#ifdef __cplusplus
2264#define __Pyx_PyMODINIT_FUNC extern "C" void
2265#else
2266#define __Pyx_PyMODINIT_FUNC void
2267#endif
2268#else
2269#ifdef __cplusplus
2270#define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
2271#else
2272#define __Pyx_PyMODINIT_FUNC PyObject *
2273#endif
2274#endif
2275
2276
2277#if PY_MAJOR_VERSION < 3
2278__Pyx_PyMODINIT_FUNC initeventhooks(void) CYTHON_SMALL_CODE; /*proto*/
2279__Pyx_PyMODINIT_FUNC initeventhooks(void)
2280#else
2281__Pyx_PyMODINIT_FUNC PyInit_eventhooks(void) CYTHON_SMALL_CODE; /*proto*/
2282__Pyx_PyMODINIT_FUNC PyInit_eventhooks(void)
2283#if CYTHON_PEP489_MULTI_PHASE_INIT
2284{
2285 return PyModuleDef_Init(&__pyx_moduledef);
2286}
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))
2295 #else
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))
2301 #endif
2302 {
2303 PyErr_SetString(
2304 PyExc_ImportError,
2305 "Interpreter change detected - this module can only be loaded into one interpreter per process.");
2306 return -1;
2307 }
2308 return 0;
2309}
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)
2312#else
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)
2314#endif
2315{
2316 PyObject *value = PyObject_GetAttrString(spec, from_name);
2317 int result = 0;
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);
2322#else
2323 result = PyDict_SetItemString(moddict, to_name, value);
2324#endif
2325 }
2326 Py_DECREF(value);
2327 } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
2328 PyErr_Clear();
2329 } else {
2330 result = -1;
2331 }
2332 return result;
2333}
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())
2338 return NULL;
2339 if (__pyx_m)
2340 return __Pyx_NewRef(__pyx_m);
2341 modname = PyObject_GetAttrString(spec, "name");
2342 if (unlikely(!modname)) goto bad;
2343 module = PyModule_NewObject(modname);
2344 Py_DECREF(modname);
2345 if (unlikely(!module)) goto bad;
2346#if CYTHON_COMPILING_IN_LIMITED_API
2347 moddict = module;
2348#else
2349 moddict = PyModule_GetDict(module);
2350 if (unlikely(!moddict)) goto bad;
2351#endif
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;
2356 return module;
2357bad:
2358 Py_XDECREF(module);
2359 return NULL;
2360}
2361
2362
2363static CYTHON_SMALL_CODE int __pyx_pymod_exec_eventhooks(PyObject *__pyx_pyinit_module)
2364#endif
2365#endif
2366{
2367 int stringtab_initialized = 0;
2368 #if CYTHON_USE_MODULE_STATE
2369 int pystate_addmodule_run = 0;
2370 #endif
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
2378 if (__pyx_m) {
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.");
2381 return -1;
2382 }
2383 #elif PY_MAJOR_VERSION >= 3
2384 if (__pyx_m) return __Pyx_NewRef(__pyx_m);
2385 #endif
2386 /*--- Module creation code ---*/
2387 #if CYTHON_PEP489_MULTI_PHASE_INIT
2388 __pyx_m = __pyx_pyinit_module;
2389 Py_INCREF(__pyx_m);
2390 #else
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)
2396 {
2397 int add_module_result = PyState_AddModule(__pyx_t_1, &__pyx_moduledef);
2398 __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to "eventhooks" pseudovariable */
2399 if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
2400 pystate_addmodule_run = 1;
2401 }
2402 #else
2403 __pyx_m = PyModule_Create(&__pyx_moduledef);
2404 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
2405 #endif
2406 #endif
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)
2409 Py_INCREF(__pyx_d);
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)
2413 #if CYTHON_REFNANNY
2414__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
2415if (!__Pyx_RefNanny) {
2416 PyErr_Clear();
2417 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
2418 if (!__Pyx_RefNanny)
2419 Py_FatalError("failed to import 'refnanny' module");
2420}
2421#endif
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();
2426 #endif
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)
2432 #endif
2433 #ifdef __Pyx_FusedFunction_USED
2434 if (__pyx_FusedFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2435 #endif
2436 #ifdef __Pyx_Coroutine_USED
2437 if (__pyx_Coroutine_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2438 #endif
2439 #ifdef __Pyx_Generator_USED
2440 if (__pyx_Generator_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2441 #endif
2442 #ifdef __Pyx_AsyncGen_USED
2443 if (__pyx_AsyncGen_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2444 #endif
2445 #ifdef __Pyx_StopAsyncIteration_USED
2446 if (__pyx_StopAsyncIteration_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2447 #endif
2448 /*--- Library function declarations ---*/
2449 /*--- Threads initialization code ---*/
2450 #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
2451 PyEval_InitThreads();
2452 #endif
2453 /*--- Initialize various global constants etc. ---*/
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)
2459 #endif
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)
2462 }
2463 #if PY_MAJOR_VERSION >= 3
2464 {
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)
2468 }
2469 }
2470 #endif
2471 /*--- Builtin init code ---*/
2472 if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2473 /*--- Constants init code ---*/
2474 if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2475 /*--- Global type/function init code ---*/
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();
2483 /*--- Execution code ---*/
2484 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
2485 if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2486 #endif
2487
2488 /* "eventhooks.pyx":1
2489 * """The event handling module in cyclus.""" # <<<<<<<<<<<<<<
2490 * from __future__ import print_function, unicode_literals
2491 *
2492 */
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;
2497
2498 /*--- Wrapped vars code ---*/
2499
2500 goto __pyx_L0;
2501 __pyx_L1_error:;
2502 __Pyx_XDECREF(__pyx_t_2);
2503 if (__pyx_m) {
2504 if (__pyx_d && stringtab_initialized) {
2505 __Pyx_AddTraceback("init eventhooks", __pyx_clineno, __pyx_lineno, __pyx_filename);
2506 }
2507 #if !CYTHON_USE_MODULE_STATE
2508 Py_CLEAR(__pyx_m);
2509 #else
2510 Py_DECREF(__pyx_m);
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);
2516 }
2517 #endif
2518 } else if (!PyErr_Occurred()) {
2519 PyErr_SetString(PyExc_ImportError, "init eventhooks");
2520 }
2521 __pyx_L0:;
2522 __Pyx_RefNannyFinishContext();
2523 #if CYTHON_PEP489_MULTI_PHASE_INIT
2524 return (__pyx_m != NULL) ? 0 : -1;
2525 #elif PY_MAJOR_VERSION >= 3
2526 return __pyx_m;
2527 #else
2528 return;
2529 #endif
2530}
2531/* #### Code section: cleanup_globals ### */
2532/* #### Code section: cleanup_module ### */
2533/* #### Code section: main_method ### */
2534/* #### Code section: utility_code_pragmas ### */
2535#ifdef _MSC_VER
2536#pragma warning( push )
2537/* Warning 4127: conditional expression is constant
2538 * Cython uses constant conditional expressions to allow in inline functions to be optimized at
2539 * compile-time, so this warning is not useful
2540 */
2541#pragma warning( disable : 4127 )
2542#endif
2543
2544
2545
2546/* #### Code section: utility_code_def ### */
2547
2548/* --- Runtime support code --- */
2549/* Refnanny */
2550#if CYTHON_REFNANNY
2551static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
2552 PyObject *m = NULL, *p = NULL;
2553 void *r = NULL;
2554 m = PyImport_ImportModule(modname);
2555 if (!m) goto end;
2556 p = PyObject_GetAttrString(m, "RefNannyAPI");
2557 if (!p) goto end;
2558 r = PyLong_AsVoidPtr(p);
2559end:
2560 Py_XDECREF(p);
2561 Py_XDECREF(m);
2562 return (__Pyx_RefNannyAPIStruct *)r;
2563}
2564#endif
2565
2566/* PyObjectGetAttrStr */
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));
2575#endif
2576 return PyObject_GetAttr(obj, attr_name);
2577}
2578#endif
2579
2580/* Import */
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))
2589 goto bad;
2590 if (!from_list) {
2591 empty_list = PyList_New(0);
2592 if (unlikely(!empty_list))
2593 goto bad;
2594 from_list = empty_list;
2595 }
2596 #endif
2597 empty_dict = PyDict_New();
2598 if (unlikely(!empty_dict))
2599 goto bad;
2600 {
2601 #if PY_MAJOR_VERSION >= 3
2602 if (level == -1) {
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)))
2608 goto bad;
2609 PyErr_Clear();
2610 }
2611 }
2612 level = 0;
2613 }
2614 #endif
2615 if (!module) {
2616 #if PY_MAJOR_VERSION < 3
2617 PyObject *py_level = PyInt_FromLong(level);
2618 if (unlikely(!py_level))
2619 goto bad;
2620 module = PyObject_CallFunctionObjArgs(py_import,
2621 name, __pyx_d, empty_dict, from_list, py_level, (PyObject *)NULL);
2622 Py_DECREF(py_level);
2623 #else
2624 module = PyImport_ImportModuleLevelObject(
2625 name, __pyx_d, empty_dict, from_list, level);
2626 #endif
2627 }
2628 }
2629bad:
2630 Py_XDECREF(empty_dict);
2631 Py_XDECREF(empty_list);
2632 #if PY_MAJOR_VERSION < 3
2633 Py_XDECREF(py_import);
2634 #endif
2635 return module;
2636}
2637
2638/* ImportFrom */
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;
2646 PyErr_Clear();
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)
2656 {
2657 PyObject *modules = PyImport_GetModuleDict();
2658 if (unlikely(!modules))
2659 goto modbad;
2660 value = PyObject_GetItem(modules, full_name);
2661 }
2662 #else
2663 value = PyImport_GetModule(full_name);
2664 #endif
2665 modbad:
2666 Py_XDECREF(full_name);
2667 Py_XDECREF(module_dot);
2668 Py_XDECREF(module_name);
2669 }
2670 if (unlikely(!value)) {
2671 PyErr_Format(PyExc_ImportError,
2672 #if PY_MAJOR_VERSION < 3
2673 "cannot import name %.230s", PyString_AS_STRING(name));
2674 #else
2675 "cannot import name %S", name);
2676 #endif
2677 }
2678 return value;
2679}
2680
2681/* PyFunctionFastCall */
2682#if CYTHON_FAST_PYCALL && !CYTHON_VECTORCALL
2683static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
2684 PyObject *globals) {
2685 PyFrameObject *f;
2686 PyThreadState *tstate = __Pyx_PyThreadState_Current;
2687 PyObject **fastlocals;
2688 Py_ssize_t i;
2689 PyObject *result;
2690 assert(globals != NULL);
2691 /* XXX Perhaps we should create a specialized
2692 PyFrame_New() that doesn't take locals, but does
2693 take builtins without sanity checking them.
2694 */
2695 assert(tstate != NULL);
2696 f = PyFrame_New(tstate, co, globals, NULL);
2697 if (f == NULL) {
2698 return NULL;
2699 }
2700 fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
2701 for (i = 0; i < na; i++) {
2702 Py_INCREF(*args);
2703 fastlocals[i] = *args++;
2704 }
2705 result = PyEval_EvalFrameEx(f,0);
2706 ++tstate->recursion_depth;
2707 Py_DECREF(f);
2708 --tstate->recursion_depth;
2709 return result;
2710}
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);
2715 PyObject *closure;
2716#if PY_MAJOR_VERSION >= 3
2717 PyObject *kwdefs;
2718#endif
2719 PyObject *kwtuple, **k;
2720 PyObject **d;
2721 Py_ssize_t nd;
2722 Py_ssize_t nk;
2723 PyObject *result;
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"))) {
2728 return NULL;
2729 }
2730 #else
2731 if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) {
2732 return NULL;
2733 }
2734 #endif
2735 if (
2736#if PY_MAJOR_VERSION >= 3
2737 co->co_kwonlyargcount == 0 &&
2738#endif
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);
2743 goto done;
2744 }
2745 else if (nargs == 0 && argdefs != NULL
2746 && co->co_argcount == Py_SIZE(argdefs)) {
2747 /* function called with no arguments, but all parameters have
2748 a default value: use default values as arguments .*/
2749 args = &PyTuple_GET_ITEM(argdefs, 0);
2750 result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
2751 goto done;
2752 }
2753 }
2754 if (kwargs != NULL) {
2755 Py_ssize_t pos, i;
2756 kwtuple = PyTuple_New(2 * nk);
2757 if (kwtuple == NULL) {
2758 result = NULL;
2759 goto done;
2760 }
2761 k = &PyTuple_GET_ITEM(kwtuple, 0);
2762 pos = i = 0;
2763 while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
2764 Py_INCREF(k[i]);
2765 Py_INCREF(k[i+1]);
2766 i += 2;
2767 }
2768 nk = i / 2;
2769 }
2770 else {
2771 kwtuple = NULL;
2772 k = NULL;
2773 }
2774 closure = PyFunction_GET_CLOSURE(func);
2775#if PY_MAJOR_VERSION >= 3
2776 kwdefs = PyFunction_GET_KW_DEFAULTS(func);
2777#endif
2778 if (argdefs != NULL) {
2779 d = &PyTuple_GET_ITEM(argdefs, 0);
2780 nd = Py_SIZE(argdefs);
2781 }
2782 else {
2783 d = NULL;
2784 nd = 0;
2785 }
2786#if PY_MAJOR_VERSION >= 3
2787 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
2788 args, (int)nargs,
2789 k, (int)nk,
2790 d, (int)nd, kwdefs, closure);
2791#else
2792 result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
2793 args, (int)nargs,
2794 k, (int)nk,
2795 d, (int)nd, closure);
2796#endif
2797 Py_XDECREF(kwtuple);
2798done:
2799 Py_LeaveRecursiveCall();
2800 return result;
2801}
2802#endif
2803
2804/* PyObjectCall */
2805#if CYTHON_COMPILING_IN_CPYTHON
2806static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
2807 PyObject *result;
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")))
2813 return NULL;
2814 #else
2815 if (unlikely(Py_EnterRecursiveCall(" while calling a Python object")))
2816 return NULL;
2817 #endif
2818 result = (*call)(func, arg, kw);
2819 Py_LeaveRecursiveCall();
2820 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
2821 PyErr_SetString(
2822 PyExc_SystemError,
2823 "NULL result without error in PyObject_Call");
2824 }
2825 return result;
2826}
2827#endif
2828
2829/* PyObjectCallMethO */
2830#if CYTHON_COMPILING_IN_CPYTHON
2831static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
2832 PyObject *self, *result;
2833 PyCFunction cfunc;
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")))
2838 return NULL;
2839 #else
2840 if (unlikely(Py_EnterRecursiveCall(" while calling a Python object")))
2841 return NULL;
2842 #endif
2843 result = cfunc(self, arg);
2844 Py_LeaveRecursiveCall();
2845 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
2846 PyErr_SetString(
2847 PyExc_SystemError,
2848 "NULL result without error in PyObject_Call");
2849 }
2850 return result;
2851}
2852#endif
2853
2854/* PyObjectFastCall */
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;
2859 size_t i;
2860 argstuple = PyTuple_New((Py_ssize_t)nargs);
2861 if (unlikely(!argstuple)) return NULL;
2862 for (i = 0; i < nargs; i++) {
2863 Py_INCREF(args[i]);
2864 if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) < 0) goto bad;
2865 }
2866 result = __Pyx_PyObject_Call(func, argstuple, kwargs);
2867 bad:
2868 Py_DECREF(argstuple);
2869 return result;
2870}
2871#endif
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);
2878 }
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]);
2882 }
2883#endif
2884 #if PY_VERSION_HEX < 0x030800B1
2885 #if CYTHON_FAST_PYCCALL
2886 if (PyCFunction_Check(func)) {
2887 if (kwargs) {
2888 return _PyCFunction_FastCallDict(func, args, nargs, kwargs);
2889 } else {
2890 return _PyCFunction_FastCallKeywords(func, args, nargs, NULL);
2891 }
2892 }
2893 #if PY_VERSION_HEX >= 0x030700A1
2894 if (!kwargs && __Pyx_IS_TYPE(func, &PyMethodDescr_Type)) {
2895 return _PyMethodDescr_FastCallKeywords(func, args, nargs, NULL);
2896 }
2897 #endif
2898 #endif
2899 #if CYTHON_FAST_PYCALL
2900 if (PyFunction_Check(func)) {
2901 return __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs);
2902 }
2903 #endif
2904 #endif
2905 if (kwargs == NULL) {
2906 #if CYTHON_VECTORCALL
2907 #if PY_VERSION_HEX < 0x03090000
2908 vectorcallfunc f = _PyVectorcall_Function(func);
2909 #else
2910 vectorcallfunc f = PyVectorcall_Function(func);
2911 #endif
2912 if (f) {
2913 return f(func, args, (size_t)nargs, NULL);
2914 }
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);
2919 }
2920 #endif
2921 }
2922 if (nargs == 0) {
2923 return __Pyx_PyObject_Call(func, __pyx_empty_tuple, kwargs);
2924 }
2925 #if PY_VERSION_HEX >= 0x03090000 && !CYTHON_COMPILING_IN_LIMITED_API
2926 return PyObject_VectorcallDict(func, args, (size_t)nargs, kwargs);
2927 #else
2928 return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs);
2929 #endif
2930}
2931
2932/* PyDictVersioning */
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;
2937}
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;
2941 if (offset) {
2942#if CYTHON_COMPILING_IN_CPYTHON
2943 dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
2944#else
2945 dictptr = _PyObject_GetDictPtr(obj);
2946#endif
2947 }
2948 return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
2949}
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)))
2953 return 0;
2954 return obj_dict_version == __Pyx_get_object_dict_version(obj);
2955}
2956#endif
2957
2958/* PyErrExceptionMatches */
2959#if CYTHON_FAST_THREAD_STATE
2960static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
2961 Py_ssize_t i, n;
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;
2966 }
2967#endif
2968 for (i=0; i<n; i++) {
2969 if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
2970 }
2971 return 0;
2972}
2973static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
2974 int result;
2975 PyObject *exc_type;
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;
2981#else
2982 exc_type = tstate->curexc_type;
2983 if (exc_type == err) return 1;
2984 if (unlikely(!exc_type)) return 0;
2985#endif
2986 #if CYTHON_AVOID_BORROWED_REFS
2987 Py_INCREF(exc_type);
2988 #endif
2989 if (unlikely(PyTuple_Check(err))) {
2990 result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
2991 } else {
2992 result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
2993 }
2994 #if CYTHON_AVOID_BORROWED_REFS
2995 Py_DECREF(exc_type);
2996 #endif
2997 return result;
2998}
2999#endif
3000
3001/* PyErrFetchRestore */
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)));
3007 if (value) {
3008 #if CYTHON_COMPILING_IN_CPYTHON
3009 if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb))
3010 #endif
3011 PyException_SetTraceback(value, tb);
3012 }
3013 tmp_value = tstate->current_exception;
3014 tstate->current_exception = value;
3015 Py_XDECREF(tmp_value);
3016 Py_XDECREF(type);
3017 Py_XDECREF(tb);
3018#else
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);
3028 Py_XDECREF(tmp_tb);
3029#endif
3030}
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;
3036 *value = exc_value;
3037 *type = NULL;
3038 *tb = NULL;
3039 if (exc_value) {
3040 *type = (PyObject*) Py_TYPE(exc_value);
3041 Py_INCREF(*type);
3042 #if CYTHON_COMPILING_IN_CPYTHON
3043 *tb = ((PyBaseExceptionObject*) exc_value)->traceback;
3044 Py_XINCREF(*tb);
3045 #else
3046 *tb = PyException_GetTraceback(exc_value);
3047 #endif
3048 }
3049#else
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;
3056#endif
3057}
3058#endif
3059
3060/* PyObjectGetAttrStrNoError */
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();
3067}
3068#endif
3069static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
3070 PyObject *result;
3071#if __PYX_LIMITED_VERSION_HEX >= 0x030d00A1
3072 (void) PyObject_GetOptionalAttr(obj, attr_name, &result);
3073 return result;
3074#else
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);
3079 }
3080#endif
3081 result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
3082 if (unlikely(!result)) {
3083 __Pyx_PyObject_GetAttrStr_ClearAttributeError();
3084 }
3085 return result;
3086#endif
3087}
3088
3089/* CLineInTraceback */
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;
3096#endif
3097 CYTHON_MAYBE_UNUSED_VAR(tstate);
3098 if (unlikely(!__pyx_cython_runtime)) {
3099 return c_line;
3100 }
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))
3108 } else
3109#endif
3110 {
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);
3115 } else {
3116 PyErr_Clear();
3117 use_cline = NULL;
3118 }
3119 }
3120 if (!use_cline) {
3121 c_line = 0;
3122 (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
3123 }
3124 else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
3125 c_line = 0;
3126 }
3127 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
3128 return c_line;
3129}
3130#endif
3131
3132/* CodeObjectCache */
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) {
3137 return count;
3138 }
3139 while (start < end) {
3140 mid = start + (end - start) / 2;
3141 if (code_line < entries[mid].code_line) {
3142 end = mid;
3143 } else if (code_line > entries[mid].code_line) {
3144 start = mid + 1;
3145 } else {
3146 return mid;
3147 }
3148 }
3149 if (code_line <= entries[mid].code_line) {
3150 return mid;
3151 } else {
3152 return mid + 1;
3153 }
3154}
3155static PyCodeObject *__pyx_find_code_object(int code_line) {
3156 PyCodeObject* code_object;
3157 int pos;
3158 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
3159 return NULL;
3160 }
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)) {
3163 return NULL;
3164 }
3165 code_object = __pyx_code_cache.entries[pos].code_object;
3166 Py_INCREF(code_object);
3167 return code_object;
3168}
3169static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
3170 int pos, i;
3171 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
3172 if (unlikely(!code_line)) {
3173 return;
3174 }
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);
3184 }
3185 return;
3186 }
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;
3191 Py_DECREF(tmp);
3192 return;
3193 }
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)) {
3199 return;
3200 }
3201 __pyx_code_cache.entries = entries;
3202 __pyx_code_cache.max_count = new_max;
3203 }
3204 for (i=__pyx_code_cache.count; i>pos; i--) {
3205 entries[i] = entries[i-1];
3206 }
3207 entries[pos].code_line = code_line;
3208 entries[pos].code_object = code_object;
3209 __pyx_code_cache.count++;
3210 Py_INCREF(code_object);
3211}
3212#endif
3213
3214/* AddTraceback */
3215#include "compile.h"
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
3221 #endif
3222 #include "internal/pycore_frame.h"
3223#endif
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)) {
3232 PyObject *result;
3233 result = PyObject_Call(replace, __pyx_empty_tuple, scratch_dict);
3234 Py_DECREF(replace);
3235 return result;
3236 }
3237 PyErr_Clear();
3238 #if __PYX_LIMITED_VERSION_HEX < 0x030780000
3239 {
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();
3253 Py_DECREF(result);
3254 result = PyDict_GetItemString(scratch_dict, "out");
3255 if (result) Py_INCREF(result);
3256 return result;
3257 }
3258 #else
3259 return NULL;
3260 #endif
3261}
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;
3267 int success = 0;
3268 if (c_line) {
3269 (void) __pyx_cfilenm;
3270 (void) __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line);
3271 }
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;
3281 {
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);
3285 }
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;
3292 success = 1;
3293 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);
3298 Py_XDECREF(dict);
3299 Py_XDECREF(replace);
3300 if (success) {
3301 PyTraceBack_Here(
3302 (struct _frame*)frame);
3303 }
3304 Py_XDECREF(frame);
3305}
3306#else
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;
3316 #endif
3317 if (c_line) {
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;
3321 #else
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;
3326 #endif
3327 }
3328 else {
3329 #if PY_MAJOR_VERSION < 3
3330 py_funcname = PyString_FromString(funcname);
3331 if (!py_funcname) goto bad;
3332 #endif
3333 }
3334 #if PY_MAJOR_VERSION < 3
3335 py_code = __Pyx_PyCode_New(
3336 0,
3337 0,
3338 0,
3339 0,
3340 0,
3341 0,
3342 __pyx_empty_bytes, /*PyObject *code,*/
3343 __pyx_empty_tuple, /*PyObject *consts,*/
3344 __pyx_empty_tuple, /*PyObject *names,*/
3345 __pyx_empty_tuple, /*PyObject *varnames,*/
3346 __pyx_empty_tuple, /*PyObject *freevars,*/
3347 __pyx_empty_tuple, /*PyObject *cellvars,*/
3348 py_srcfile, /*PyObject *filename,*/
3349 py_funcname, /*PyObject *name,*/
3350 py_line,
3351 __pyx_empty_bytes /*PyObject *lnotab*/
3352 );
3353 Py_DECREF(py_srcfile);
3354 #else
3355 py_code = PyCode_NewEmpty(filename, funcname, py_line);
3356 #endif
3357 Py_XDECREF(py_funcname);
3358 return py_code;
3359bad:
3360 Py_XDECREF(py_funcname);
3361 #if PY_MAJOR_VERSION < 3
3362 Py_XDECREF(py_srcfile);
3363 #endif
3364 return NULL;
3365}
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;
3372 if (c_line) {
3373 c_line = __Pyx_CLineForTraceback(tstate, c_line);
3374 }
3375 py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
3376 if (!py_code) {
3377 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
3378 py_code = __Pyx_CreateCodeObjectForTraceback(
3379 funcname, c_line, py_line, filename);
3380 if (!py_code) {
3381 /* If the code object creation fails, then we should clear the
3382 fetched exception references and propagate the new exception */
3383 Py_XDECREF(ptype);
3384 Py_XDECREF(pvalue);
3385 Py_XDECREF(ptraceback);
3386 goto bad;
3387 }
3388 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
3389 __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
3390 }
3391 py_frame = PyFrame_New(
3392 tstate, /*PyThreadState *tstate,*/
3393 py_code, /*PyCodeObject *code,*/
3394 __pyx_d, /*PyObject *globals,*/
3395 0 /*PyObject *locals*/
3396 );
3397 if (!py_frame) goto bad;
3398 __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
3399 PyTraceBack_Here(py_frame);
3400bad:
3401 Py_XDECREF(py_code);
3402 Py_XDECREF(py_frame);
3403}
3404#endif
3405
3406/* FormatTypeName */
3407#if CYTHON_COMPILING_IN_LIMITED_API
3408static __Pyx_TypeName
3409__Pyx_PyType_GetName(PyTypeObject* tp)
3410{
3411 PyObject *name = __Pyx_PyObject_GetAttrStr((PyObject *)tp,
3412 __pyx_n_s_name);
3413 if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) {
3414 PyErr_Clear();
3415 Py_XDECREF(name);
3416 name = __Pyx_NewRef(__pyx_n_s__2);
3417 }
3418 return name;
3419}
3420#endif
3421
3422/* CIntToPy */
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"
3427#endif
3428 const long neg_one = (long) -1, const_zero = (long) 0;
3429#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
3430#pragma GCC diagnostic pop
3431#endif
3432 const int is_unsigned = neg_one > const_zero;
3433 if (is_unsigned) {
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);
3441#endif
3442 }
3443 } else {
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);
3449#endif
3450 }
3451 }
3452 {
3453 unsigned char *bytes = (unsigned char *)&value;
3454#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
3455 if (is_unsigned) {
3456 return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
3457 } else {
3458 return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
3459 }
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);
3464#else
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;
3476 if (!is_unsigned) {
3477 kwds = PyDict_New();
3478 if (!kwds) goto limited_bad;
3479 if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad;
3480 }
3481 result = PyObject_Call(from_bytes, arg_tuple, kwds);
3482 limited_bad:
3483 Py_XDECREF(kwds);
3484 Py_XDECREF(arg_tuple);
3485 Py_XDECREF(order_str);
3486 Py_XDECREF(py_bytes);
3487 Py_XDECREF(from_bytes);
3488 return result;
3489#endif
3490 }
3491}
3492
3493/* CIntFromPyVerify */
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)\
3499 {\
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;\
3508 else\
3509 goto raise_overflow;\
3510 }\
3511 }\
3512 return (target_type) value;\
3513 }
3514
3515/* CIntFromPy */
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"
3520#endif
3521 const long neg_one = (long) -1, const_zero = (long) 0;
3522#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
3523#pragma GCC diagnostic pop
3524#endif
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))
3530 } else {
3531 long val = PyInt_AS_LONG(x);
3532 if (is_unsigned && unlikely(val < 0)) {
3533 goto raise_neg_overflow;
3534 }
3535 return (long) val;
3536 }
3537 }
3538#endif
3539 if (unlikely(!PyLong_Check(x))) {
3540 long val;
3541 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
3542 if (!tmp) return (long) -1;
3543 val = __Pyx_PyInt_As_long(tmp);
3544 Py_DECREF(tmp);
3545 return val;
3546 }
3547 if (is_unsigned) {
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))
3553 } else {
3554 const digit* digits = __Pyx_PyLong_Digits(x);
3555 assert(__Pyx_PyLong_DigitCount(x) > 1);
3556 switch (__Pyx_PyLong_DigitCount(x)) {
3557 case 2:
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]));
3563 }
3564 }
3565 break;
3566 case 3:
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]));
3572 }
3573 }
3574 break;
3575 case 4:
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]));
3581 }
3582 }
3583 break;
3584 }
3585 }
3586#endif
3587#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
3588 if (unlikely(Py_SIZE(x) < 0)) {
3589 goto raise_neg_overflow;
3590 }
3591#else
3592 {
3593 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
3594 if (unlikely(result < 0))
3595 return (long) -1;
3596 if (unlikely(result == 1))
3597 goto raise_neg_overflow;
3598 }
3599#endif
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))
3605#endif
3606 }
3607 } else {
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))
3611 } else {
3612 const digit* digits = __Pyx_PyLong_Digits(x);
3613 assert(__Pyx_PyLong_DigitCount(x) > 1);
3614 switch (__Pyx_PyLong_SignedDigitCount(x)) {
3615 case -2:
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])));
3621 }
3622 }
3623 break;
3624 case 2:
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])));
3630 }
3631 }
3632 break;
3633 case -3:
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])));
3639 }
3640 }
3641 break;
3642 case 3:
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])));
3648 }
3649 }
3650 break;
3651 case -4:
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])));
3657 }
3658 }
3659 break;
3660 case 4:
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])));
3666 }
3667 }
3668 break;
3669 }
3670 }
3671#endif
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))
3677#endif
3678 }
3679 }
3680 {
3681 long val;
3682 int ret = -1;
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;
3689 } else {
3690 ret = 0;
3691 }
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,
3696 bytes, sizeof(val),
3697 is_little, !is_unsigned);
3698#else
3699 PyObject *v;
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);
3705 } else {
3706 v = PyNumber_Long(x);
3707 if (unlikely(!v)) return (long) -1;
3708 assert(PyLong_CheckExact(v));
3709 }
3710 {
3711 int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
3712 if (unlikely(result < 0)) {
3713 Py_DECREF(v);
3714 return (long) -1;
3715 }
3716 is_negative = result == 1;
3717 }
3718 if (is_unsigned && unlikely(is_negative)) {
3719 Py_DECREF(v);
3720 goto raise_neg_overflow;
3721 } else if (is_negative) {
3722 stepval = PyNumber_Invert(v);
3723 Py_DECREF(v);
3724 if (unlikely(!stepval))
3725 return (long) -1;
3726 } else {
3727 stepval = v;
3728 }
3729 v = NULL;
3730 val = (long) 0;
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;
3735 long idigit;
3736 digit = PyNumber_And(stepval, mask);
3737 if (unlikely(!digit)) goto done;
3738 idigit = PyLong_AsLong(digit);
3739 Py_DECREF(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;
3745 }
3746 Py_DECREF(shift); shift = NULL;
3747 Py_DECREF(mask); mask = NULL;
3748 {
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;
3755 }
3756 if (!is_unsigned) {
3757 if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1))))
3758 goto raise_overflow;
3759 if (is_negative)
3760 val = ~val;
3761 }
3762 ret = 0;
3763 done:
3764 Py_XDECREF(shift);
3765 Py_XDECREF(mask);
3766 Py_XDECREF(stepval);
3767#endif
3768 if (unlikely(ret))
3769 return (long) -1;
3770 return val;
3771 }
3772raise_overflow:
3773 PyErr_SetString(PyExc_OverflowError,
3774 "value too large to convert to long");
3775 return (long) -1;
3776raise_neg_overflow:
3777 PyErr_SetString(PyExc_OverflowError,
3778 "can't convert negative value to long");
3779 return (long) -1;
3780}
3781
3782/* CIntFromPy */
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"
3787#endif
3788 const int neg_one = (int) -1, const_zero = (int) 0;
3789#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
3790#pragma GCC diagnostic pop
3791#endif
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))
3797 } else {
3798 long val = PyInt_AS_LONG(x);
3799 if (is_unsigned && unlikely(val < 0)) {
3800 goto raise_neg_overflow;
3801 }
3802 return (int) val;
3803 }
3804 }
3805#endif
3806 if (unlikely(!PyLong_Check(x))) {
3807 int val;
3808 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
3809 if (!tmp) return (int) -1;
3810 val = __Pyx_PyInt_As_int(tmp);
3811 Py_DECREF(tmp);
3812 return val;
3813 }
3814 if (is_unsigned) {
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))
3820 } else {
3821 const digit* digits = __Pyx_PyLong_Digits(x);
3822 assert(__Pyx_PyLong_DigitCount(x) > 1);
3823 switch (__Pyx_PyLong_DigitCount(x)) {
3824 case 2:
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]));
3830 }
3831 }
3832 break;
3833 case 3:
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]));
3839 }
3840 }
3841 break;
3842 case 4:
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]));
3848 }
3849 }
3850 break;
3851 }
3852 }
3853#endif
3854#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
3855 if (unlikely(Py_SIZE(x) < 0)) {
3856 goto raise_neg_overflow;
3857 }
3858#else
3859 {
3860 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
3861 if (unlikely(result < 0))
3862 return (int) -1;
3863 if (unlikely(result == 1))
3864 goto raise_neg_overflow;
3865 }
3866#endif
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))
3872#endif
3873 }
3874 } else {
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))
3878 } else {
3879 const digit* digits = __Pyx_PyLong_Digits(x);
3880 assert(__Pyx_PyLong_DigitCount(x) > 1);
3881 switch (__Pyx_PyLong_SignedDigitCount(x)) {
3882 case -2:
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])));
3888 }
3889 }
3890 break;
3891 case 2:
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])));
3897 }
3898 }
3899 break;
3900 case -3:
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])));
3906 }
3907 }
3908 break;
3909 case 3:
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])));
3915 }
3916 }
3917 break;
3918 case -4:
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])));
3924 }
3925 }
3926 break;
3927 case 4:
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])));
3933 }
3934 }
3935 break;
3936 }
3937 }
3938#endif
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))
3944#endif
3945 }
3946 }
3947 {
3948 int val;
3949 int ret = -1;
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;
3956 } else {
3957 ret = 0;
3958 }
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,
3963 bytes, sizeof(val),
3964 is_little, !is_unsigned);
3965#else
3966 PyObject *v;
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);
3972 } else {
3973 v = PyNumber_Long(x);
3974 if (unlikely(!v)) return (int) -1;
3975 assert(PyLong_CheckExact(v));
3976 }
3977 {
3978 int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
3979 if (unlikely(result < 0)) {
3980 Py_DECREF(v);
3981 return (int) -1;
3982 }
3983 is_negative = result == 1;
3984 }
3985 if (is_unsigned && unlikely(is_negative)) {
3986 Py_DECREF(v);
3987 goto raise_neg_overflow;
3988 } else if (is_negative) {
3989 stepval = PyNumber_Invert(v);
3990 Py_DECREF(v);
3991 if (unlikely(!stepval))
3992 return (int) -1;
3993 } else {
3994 stepval = v;
3995 }
3996 v = NULL;
3997 val = (int) 0;
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;
4002 long idigit;
4003 digit = PyNumber_And(stepval, mask);
4004 if (unlikely(!digit)) goto done;
4005 idigit = PyLong_AsLong(digit);
4006 Py_DECREF(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;
4012 }
4013 Py_DECREF(shift); shift = NULL;
4014 Py_DECREF(mask); mask = NULL;
4015 {
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;
4022 }
4023 if (!is_unsigned) {
4024 if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1))))
4025 goto raise_overflow;
4026 if (is_negative)
4027 val = ~val;
4028 }
4029 ret = 0;
4030 done:
4031 Py_XDECREF(shift);
4032 Py_XDECREF(mask);
4033 Py_XDECREF(stepval);
4034#endif
4035 if (unlikely(ret))
4036 return (int) -1;
4037 return val;
4038 }
4039raise_overflow:
4040 PyErr_SetString(PyExc_OverflowError,
4041 "value too large to convert to int");
4042 return (int) -1;
4043raise_neg_overflow:
4044 PyErr_SetString(PyExc_OverflowError,
4045 "can't convert negative value to int");
4046 return (int) -1;
4047}
4048
4049/* FastTypeChecks */
4050#if CYTHON_COMPILING_IN_CPYTHON
4051static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
4052 while (a) {
4053 a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*);
4054 if (a == b)
4055 return 1;
4056 }
4057 return b == &PyBaseObject_Type;
4058}
4059static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
4060 PyObject *mro;
4061 if (a == b) return 1;
4062 mro = a->tp_mro;
4063 if (likely(mro)) {
4064 Py_ssize_t i, n;
4065 n = PyTuple_GET_SIZE(mro);
4066 for (i = 0; i < n; i++) {
4067 if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
4068 return 1;
4069 }
4070 return 0;
4071 }
4072 return __Pyx_InBases(a, b);
4073}
4074static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) {
4075 PyObject *mro;
4076 if (cls == a || cls == b) return 1;
4077 mro = cls->tp_mro;
4078 if (likely(mro)) {
4079 Py_ssize_t i, n;
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)
4084 return 1;
4085 }
4086 return 0;
4087 }
4088 return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b);
4089}
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;
4093 int res;
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);
4100 res = 0;
4101 }
4102 if (!res) {
4103 res = PyObject_IsSubclass(err, exc_type2);
4104 if (unlikely(res == -1)) {
4105 PyErr_WriteUnraisable(err);
4106 res = 0;
4107 }
4108 }
4109 __Pyx_ErrRestore(exception, value, tb);
4110 return res;
4111}
4112#else
4113static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
4114 if (exc_type1) {
4115 return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2);
4116 } else {
4117 return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
4118 }
4119}
4120#endif
4121static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
4122 Py_ssize_t i, n;
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;
4128 }
4129#endif
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;
4134 #endif
4135 if (likely(PyExceptionClass_Check(t))) {
4136 if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
4137 } else {
4138 }
4139 }
4140 return 0;
4141}
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);
4149 } else {
4150 }
4151 }
4152 return PyErr_GivenExceptionMatches(err, exc_type);
4153}
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);
4160 }
4161 return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
4162}
4163#endif
4164
4165/* CheckBinaryVersion */
4166static unsigned long __Pyx_get_runtime_version(void) {
4167#if __PYX_LIMITED_VERSION_HEX >= 0x030B00A4
4168 return Py_Version & ~0xFFUL;
4169#else
4170 const char* rt_version = Py_GetVersion();
4171 unsigned long version = 0;
4172 unsigned long factor = 0x01000000UL;
4173 unsigned int digit = 0;
4174 int i = 0;
4175 while (factor) {
4176 while ('0' <= rt_version[i] && rt_version[i] <= '9') {
4177 digit = digit * 10 + (unsigned int) (rt_version[i] - '0');
4178 ++i;
4179 }
4180 version += factor * digit;
4181 if (rt_version[i] != '.')
4182 break;
4183 digit = 0;
4184 factor >>= 8;
4185 ++i;
4186 }
4187 return version;
4188#endif
4189}
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))
4193 return 0;
4194 if (likely(allow_newer && (rt_version & MAJOR_MINOR) > (ct_version & MAJOR_MINOR)))
4195 return 1;
4196 {
4197 char message[200];
4198 PyOS_snprintf(message, sizeof(message),
4199 "compile time Python version %d.%d "
4200 "of module '%.100s' "
4201 "%s "
4202 "runtime version %d.%d",
4203 (int) (ct_version >> 24), (int) ((ct_version >> 16) & 0xFF),
4204 __Pyx_MODULE_NAME,
4205 (allow_newer) ? "was newer than" : "does not match",
4206 (int) (rt_version >> 24), (int) ((rt_version >> 16) & 0xFF)
4207 );
4208 return PyErr_WarnEx(NULL, message, 1);
4209 }
4210}
4211
4212/* FunctionExport */
4213static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) {
4214 PyObject *d = 0;
4215 PyObject *cobj = 0;
4216 union {
4217 void (*fp)(void);
4218 void *p;
4219 } tmp;
4220 d = PyObject_GetAttrString(__pyx_m, (char *)"__pyx_capi__");
4221 if (!d) {
4222 PyErr_Clear();
4223 d = PyDict_New();
4224 if (!d)
4225 goto bad;
4226 Py_INCREF(d);
4227 if (PyModule_AddObject(__pyx_m, (char *)"__pyx_capi__", d) < 0)
4228 goto bad;
4229 }
4230 tmp.fp = f;
4231 cobj = PyCapsule_New(tmp.p, sig, 0);
4232 if (!cobj)
4233 goto bad;
4234 if (PyDict_SetItemString(d, name, cobj) < 0)
4235 goto bad;
4236 Py_DECREF(cobj);
4237 Py_DECREF(d);
4238 return 0;
4239bad:
4240 Py_XDECREF(cobj);
4241 Py_XDECREF(d);
4242 return -1;
4243}
4244
4245/* InitStrings */
4246#if PY_MAJOR_VERSION >= 3
4247static int __Pyx_InitString(__Pyx_StringTabEntry t, PyObject **str) {
4248 if (t.is_unicode | t.is_str) {
4249 if (t.intern) {
4250 *str = PyUnicode_InternFromString(t.s);
4251 } else if (t.encoding) {
4252 *str = PyUnicode_Decode(t.s, t.n - 1, t.encoding, NULL);
4253 } else {
4254 *str = PyUnicode_FromStringAndSize(t.s, t.n - 1);
4255 }
4256 } else {
4257 *str = PyBytes_FromStringAndSize(t.s, t.n - 1);
4258 }
4259 if (!*str)
4260 return -1;
4261 if (PyObject_Hash(*str) == -1)
4262 return -1;
4263 return 0;
4264}
4265#endif
4266static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
4267 while (t->p) {
4268 #if PY_MAJOR_VERSION >= 3
4269 __Pyx_InitString(*t, t->p);
4270 #else
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);
4275 } else {
4276 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
4277 }
4278 if (!*t->p)
4279 return -1;
4280 if (PyObject_Hash(*t->p) == -1)
4281 return -1;
4282 #endif
4283 ++t;
4284 }
4285 return 0;
4286}
4287
4288#include <string.h>
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");
4293 return -1;
4294 }
4295 return (Py_ssize_t) len;
4296}
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);
4301}
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);
4306}
4307static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
4308 Py_ssize_t ignore;
4309 return __Pyx_PyObject_AsStringAndSize(o, &ignore);
4310}
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) {
4314 char* defenc_c;
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
4319 {
4320 char* end = defenc_c + PyBytes_GET_SIZE(defenc);
4321 char* c;
4322 for (c = defenc_c; c < end; c++) {
4323 if ((unsigned char) (*c) >= 128) {
4324 PyUnicode_AsASCIIString(o);
4325 return NULL;
4326 }
4327 }
4328 }
4329#endif
4330 *length = PyBytes_GET_SIZE(defenc);
4331 return defenc_c;
4332}
4333#else
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);
4340 } else {
4341 PyUnicode_AsASCIIString(o);
4342 return NULL;
4343 }
4344#else
4345 return PyUnicode_AsUTF8AndSize(o, length);
4346#endif
4347}
4348#endif
4349#endif
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
4352 if (
4353#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
4354 __Pyx_sys_getdefaultencoding_not_ascii &&
4355#endif
4356 PyUnicode_Check(o)) {
4357 return __Pyx_PyUnicode_AsStringAndSize(o, length);
4358 } else
4359#endif
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);
4364 } else
4365#endif
4366 {
4367 char* result;
4368 int r = PyBytes_AsStringAndSize(o, &result, length);
4369 if (unlikely(r < 0)) {
4370 return NULL;
4371 } else {
4372 return result;
4373 }
4374 }
4375}
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);
4380}
4381static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
4382 int retval;
4383 if (unlikely(!x)) return -1;
4384 retval = __Pyx_PyObject_IsTrue(x);
4385 Py_DECREF(x);
4386 return retval;
4387}
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);
4398 Py_DECREF(result);
4399 return NULL;
4400 }
4401 __Pyx_DECREF_TypeName(result_type_name);
4402 return result;
4403 }
4404#endif
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);
4409 Py_DECREF(result);
4410 return NULL;
4411}
4412static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
4413#if CYTHON_USE_TYPE_SLOTS
4414 PyNumberMethods *m;
4415#endif
4416 const char *name = NULL;
4417 PyObject *res = NULL;
4418#if PY_MAJOR_VERSION < 3
4419 if (likely(PyInt_Check(x) || PyLong_Check(x)))
4420#else
4421 if (likely(PyLong_Check(x)))
4422#endif
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) {
4428 name = "int";
4429 res = m->nb_int(x);
4430 }
4431 else if (m && m->nb_long) {
4432 name = "long";
4433 res = m->nb_long(x);
4434 }
4435 #else
4436 if (likely(m && m->nb_int)) {
4437 name = "int";
4438 res = m->nb_int(x);
4439 }
4440 #endif
4441#else
4442 if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
4443 res = PyNumber_Int(x);
4444 }
4445#endif
4446 if (likely(res)) {
4447#if PY_MAJOR_VERSION < 3
4448 if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
4449#else
4450 if (unlikely(!PyLong_CheckExact(res))) {
4451#endif
4452 return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
4453 }
4454 }
4455 else if (!PyErr_Occurred()) {
4456 PyErr_SetString(PyExc_TypeError,
4457 "an integer is required");
4458 }
4459 return res;
4460}
4461static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
4462 Py_ssize_t ival;
4463 PyObject *x;
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);
4468 else
4469 return PyInt_AsSsize_t(b);
4470 }
4471#endif
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);
4476 } else {
4477 const digit* digits = __Pyx_PyLong_Digits(b);
4478 const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b);
4479 switch (size) {
4480 case 2:
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]));
4483 }
4484 break;
4485 case -2:
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]));
4488 }
4489 break;
4490 case 3:
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]));
4493 }
4494 break;
4495 case -3:
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]));
4498 }
4499 break;
4500 case 4:
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]));
4503 }
4504 break;
4505 case -4:
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]));
4508 }
4509 break;
4510 }
4511 }
4512 #endif
4513 return PyLong_AsSsize_t(b);
4514 }
4515 x = PyNumber_Index(b);
4516 if (!x) return -1;
4517 ival = PyInt_AsSsize_t(x);
4518 Py_DECREF(x);
4519 return ival;
4520}
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);
4527#endif
4528 } else {
4529 Py_ssize_t ival;
4530 PyObject *x;
4531 x = PyNumber_Index(o);
4532 if (!x) return -1;
4533 ival = PyInt_AsLong(x);
4534 Py_DECREF(x);
4535 return ival;
4536 }
4537}
4538static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
4539 return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
4540}
4541static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
4542 return PyInt_FromSize_t(ival);
4543}
4544
4545
4546/* #### Code section: utility_code_pragmas_end ### */
4547#ifdef _MSC_VER
4548#pragma warning( pop )
4549#endif
4550
4551
4552
4553/* #### Code section: end ### */
4554#endif /* Py_PYTHON_H */
#define __PYX_EXTERN_C
PyMODINIT_FUNC initeventhooks(void)
__PYX_EXTERN_C void CyclusEventLoopHook(void)
bool operator==(const CapacityConstraint< T > &lhs, const CapacityConstraint< T > &rhs)
CapacityConstraint-CapacityConstraint equality operator.
memset(dest, src, size)
enable_if< has_const_iterator< T >::value, typenameT::const_iterator >::type end(const T &c)
std::string name(int nuc)
Definition pyne.cc:2940
int offset(int dz, int da, int ds=0)
A helper function to compute nuclide id offsets from z-, a-, and s- deltas.
Definition pyne.h:1455
unsigned int hash(std::string s)
Definition pyne.cc:6323
double b(int nuc)
Computes the scattering length [cm] from the coherent and incoherent components.
Definition pyne.cc:11180