CYCLUS
eventhooks.cc
Go to the documentation of this file.
1 /* Generated by Cython 0.26.1 */
2 
3 #define PY_SSIZE_T_CLEAN
4 #include "Python.h"
5 #ifndef Py_PYTHON_H
6  #error Python headers needed to compile C extensions, please install development version of Python.
7 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000)
8  #error Cython requires Python 2.6+ or Python 3.2+.
9 #else
10 #define CYTHON_ABI "0_26_1"
11 #include <stddef.h>
12 #ifndef offsetof
13  #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
14 #endif
15 #if !defined(WIN32) && !defined(MS_WINDOWS)
16  #ifndef __stdcall
17  #define __stdcall
18  #endif
19  #ifndef __cdecl
20  #define __cdecl
21  #endif
22  #ifndef __fastcall
23  #define __fastcall
24  #endif
25 #endif
26 #ifndef DL_IMPORT
27  #define DL_IMPORT(t) t
28 #endif
29 #ifndef DL_EXPORT
30  #define DL_EXPORT(t) t
31 #endif
32 #define __PYX_COMMA ,
33 #ifndef HAVE_LONG_LONG
34  #if PY_VERSION_HEX >= 0x03030000 || (PY_MAJOR_VERSION == 2 && PY_VERSION_HEX >= 0x02070000)
35  #define HAVE_LONG_LONG
36  #endif
37 #endif
38 #ifndef PY_LONG_LONG
39  #define PY_LONG_LONG LONG_LONG
40 #endif
41 #ifndef Py_HUGE_VAL
42  #define Py_HUGE_VAL HUGE_VAL
43 #endif
44 #ifdef PYPY_VERSION
45  #define CYTHON_COMPILING_IN_PYPY 1
46  #define CYTHON_COMPILING_IN_PYSTON 0
47  #define CYTHON_COMPILING_IN_CPYTHON 0
48  #undef CYTHON_USE_TYPE_SLOTS
49  #define CYTHON_USE_TYPE_SLOTS 0
50  #undef CYTHON_USE_PYTYPE_LOOKUP
51  #define CYTHON_USE_PYTYPE_LOOKUP 0
52  #undef CYTHON_USE_ASYNC_SLOTS
53  #define CYTHON_USE_ASYNC_SLOTS 0
54  #undef CYTHON_USE_PYLIST_INTERNALS
55  #define CYTHON_USE_PYLIST_INTERNALS 0
56  #undef CYTHON_USE_UNICODE_INTERNALS
57  #define CYTHON_USE_UNICODE_INTERNALS 0
58  #undef CYTHON_USE_UNICODE_WRITER
59  #define CYTHON_USE_UNICODE_WRITER 0
60  #undef CYTHON_USE_PYLONG_INTERNALS
61  #define CYTHON_USE_PYLONG_INTERNALS 0
62  #undef CYTHON_AVOID_BORROWED_REFS
63  #define CYTHON_AVOID_BORROWED_REFS 1
64  #undef CYTHON_ASSUME_SAFE_MACROS
65  #define CYTHON_ASSUME_SAFE_MACROS 0
66  #undef CYTHON_UNPACK_METHODS
67  #define CYTHON_UNPACK_METHODS 0
68  #undef CYTHON_FAST_THREAD_STATE
69  #define CYTHON_FAST_THREAD_STATE 0
70  #undef CYTHON_FAST_PYCALL
71  #define CYTHON_FAST_PYCALL 0
72 #elif defined(PYSTON_VERSION)
73  #define CYTHON_COMPILING_IN_PYPY 0
74  #define CYTHON_COMPILING_IN_PYSTON 1
75  #define CYTHON_COMPILING_IN_CPYTHON 0
76  #ifndef CYTHON_USE_TYPE_SLOTS
77  #define CYTHON_USE_TYPE_SLOTS 1
78  #endif
79  #undef CYTHON_USE_PYTYPE_LOOKUP
80  #define CYTHON_USE_PYTYPE_LOOKUP 0
81  #undef CYTHON_USE_ASYNC_SLOTS
82  #define CYTHON_USE_ASYNC_SLOTS 0
83  #undef CYTHON_USE_PYLIST_INTERNALS
84  #define CYTHON_USE_PYLIST_INTERNALS 0
85  #ifndef CYTHON_USE_UNICODE_INTERNALS
86  #define CYTHON_USE_UNICODE_INTERNALS 1
87  #endif
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  #ifndef CYTHON_AVOID_BORROWED_REFS
93  #define CYTHON_AVOID_BORROWED_REFS 0
94  #endif
95  #ifndef CYTHON_ASSUME_SAFE_MACROS
96  #define CYTHON_ASSUME_SAFE_MACROS 1
97  #endif
98  #ifndef CYTHON_UNPACK_METHODS
99  #define CYTHON_UNPACK_METHODS 1
100  #endif
101  #undef CYTHON_FAST_THREAD_STATE
102  #define CYTHON_FAST_THREAD_STATE 0
103  #undef CYTHON_FAST_PYCALL
104  #define CYTHON_FAST_PYCALL 0
105 #else
106  #define CYTHON_COMPILING_IN_PYPY 0
107  #define CYTHON_COMPILING_IN_PYSTON 0
108  #define CYTHON_COMPILING_IN_CPYTHON 1
109  #ifndef CYTHON_USE_TYPE_SLOTS
110  #define CYTHON_USE_TYPE_SLOTS 1
111  #endif
112  #if PY_VERSION_HEX < 0x02070000
113  #undef CYTHON_USE_PYTYPE_LOOKUP
114  #define CYTHON_USE_PYTYPE_LOOKUP 0
115  #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
116  #define CYTHON_USE_PYTYPE_LOOKUP 1
117  #endif
118  #if PY_MAJOR_VERSION < 3
119  #undef CYTHON_USE_ASYNC_SLOTS
120  #define CYTHON_USE_ASYNC_SLOTS 0
121  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
122  #define CYTHON_USE_ASYNC_SLOTS 1
123  #endif
124  #if PY_VERSION_HEX < 0x02070000
125  #undef CYTHON_USE_PYLONG_INTERNALS
126  #define CYTHON_USE_PYLONG_INTERNALS 0
127  #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
128  #define CYTHON_USE_PYLONG_INTERNALS 1
129  #endif
130  #ifndef CYTHON_USE_PYLIST_INTERNALS
131  #define CYTHON_USE_PYLIST_INTERNALS 1
132  #endif
133  #ifndef CYTHON_USE_UNICODE_INTERNALS
134  #define CYTHON_USE_UNICODE_INTERNALS 1
135  #endif
136  #if PY_VERSION_HEX < 0x030300F0
137  #undef CYTHON_USE_UNICODE_WRITER
138  #define CYTHON_USE_UNICODE_WRITER 0
139  #elif !defined(CYTHON_USE_UNICODE_WRITER)
140  #define CYTHON_USE_UNICODE_WRITER 1
141  #endif
142  #ifndef CYTHON_AVOID_BORROWED_REFS
143  #define CYTHON_AVOID_BORROWED_REFS 0
144  #endif
145  #ifndef CYTHON_ASSUME_SAFE_MACROS
146  #define CYTHON_ASSUME_SAFE_MACROS 1
147  #endif
148  #ifndef CYTHON_UNPACK_METHODS
149  #define CYTHON_UNPACK_METHODS 1
150  #endif
151  #ifndef CYTHON_FAST_THREAD_STATE
152  #define CYTHON_FAST_THREAD_STATE 1
153  #endif
154  #ifndef CYTHON_FAST_PYCALL
155  #define CYTHON_FAST_PYCALL 1
156  #endif
157 #endif
158 #if !defined(CYTHON_FAST_PYCCALL)
159 #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
160 #endif
161 #if CYTHON_USE_PYLONG_INTERNALS
162  #include "longintrepr.h"
163  #undef SHIFT
164  #undef BASE
165  #undef MASK
166 #endif
167 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
168  #define Py_OptimizeFlag 0
169 #endif
170 #define __PYX_BUILD_PY_SSIZE_T "n"
171 #define CYTHON_FORMAT_SSIZE_T "z"
172 #if PY_MAJOR_VERSION < 3
173  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
174  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
175  PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
176  #define __Pyx_DefaultClassType PyClass_Type
177 #else
178  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
179  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
180  PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
181  #define __Pyx_DefaultClassType PyType_Type
182 #endif
183 #ifndef Py_TPFLAGS_CHECKTYPES
184  #define Py_TPFLAGS_CHECKTYPES 0
185 #endif
186 #ifndef Py_TPFLAGS_HAVE_INDEX
187  #define Py_TPFLAGS_HAVE_INDEX 0
188 #endif
189 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
190  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
191 #endif
192 #ifndef Py_TPFLAGS_HAVE_FINALIZE
193  #define Py_TPFLAGS_HAVE_FINALIZE 0
194 #endif
195 #if PY_VERSION_HEX < 0x030700A0 || !defined(METH_FASTCALL)
196  #ifndef METH_FASTCALL
197  #define METH_FASTCALL 0x80
198  #endif
199  typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject **args, Py_ssize_t nargs);
200  typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject **args,
201  Py_ssize_t nargs, PyObject *kwnames);
202 #else
203  #define __Pyx_PyCFunctionFast _PyCFunctionFast
204  #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
205 #endif
206 #if CYTHON_FAST_PYCCALL
207 #define __Pyx_PyFastCFunction_Check(func)\
208  ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS)))))
209 #else
210 #define __Pyx_PyFastCFunction_Check(func) 0
211 #endif
212 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
213  #define CYTHON_PEP393_ENABLED 1
214  #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
215  0 : _PyUnicode_Ready((PyObject *)(op)))
216  #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
217  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
218  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
219  #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
220  #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
221  #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
222  #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
223  #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
224 #else
225  #define CYTHON_PEP393_ENABLED 0
226  #define PyUnicode_1BYTE_KIND 1
227  #define PyUnicode_2BYTE_KIND 2
228  #define PyUnicode_4BYTE_KIND 4
229  #define __Pyx_PyUnicode_READY(op) (0)
230  #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
231  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
232  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
233  #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
234  #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
235  #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
236  #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
237  #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
238 #endif
239 #if CYTHON_COMPILING_IN_PYPY
240  #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
241  #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
242 #else
243  #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
244  #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
245  PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
246 #endif
247 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
248  #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
249 #endif
250 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
251  #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
252 #endif
253 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
254  #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
255 #endif
256 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
257  #define PyObject_Malloc(s) PyMem_Malloc(s)
258  #define PyObject_Free(p) PyMem_Free(p)
259  #define PyObject_Realloc(p) PyMem_Realloc(p)
260 #endif
261 #if CYTHON_COMPILING_IN_PYSTON
262  #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
263  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
264 #else
265  #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
266  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
267 #endif
268 #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
269 #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
270 #if PY_MAJOR_VERSION >= 3
271  #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
272 #else
273  #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
274 #endif
275 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
276  #define PyObject_ASCII(o) PyObject_Repr(o)
277 #endif
278 #if PY_MAJOR_VERSION >= 3
279  #define PyBaseString_Type PyUnicode_Type
280  #define PyStringObject PyUnicodeObject
281  #define PyString_Type PyUnicode_Type
282  #define PyString_Check PyUnicode_Check
283  #define PyString_CheckExact PyUnicode_CheckExact
284 #endif
285 #if PY_MAJOR_VERSION >= 3
286  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
287  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
288 #else
289  #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
290  #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
291 #endif
292 #ifndef PySet_CheckExact
293  #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
294 #endif
295 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
296 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
297 #if PY_MAJOR_VERSION >= 3
298  #define PyIntObject PyLongObject
299  #define PyInt_Type PyLong_Type
300  #define PyInt_Check(op) PyLong_Check(op)
301  #define PyInt_CheckExact(op) PyLong_CheckExact(op)
302  #define PyInt_FromString PyLong_FromString
303  #define PyInt_FromUnicode PyLong_FromUnicode
304  #define PyInt_FromLong PyLong_FromLong
305  #define PyInt_FromSize_t PyLong_FromSize_t
306  #define PyInt_FromSsize_t PyLong_FromSsize_t
307  #define PyInt_AsLong PyLong_AsLong
308  #define PyInt_AS_LONG PyLong_AS_LONG
309  #define PyInt_AsSsize_t PyLong_AsSsize_t
310  #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
311  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
312  #define PyNumber_Int PyNumber_Long
313 #endif
314 #if PY_MAJOR_VERSION >= 3
315  #define PyBoolObject PyLongObject
316 #endif
317 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
318  #ifndef PyUnicode_InternFromString
319  #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
320  #endif
321 #endif
322 #if PY_VERSION_HEX < 0x030200A4
323  typedef long Py_hash_t;
324  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
325  #define __Pyx_PyInt_AsHash_t PyInt_AsLong
326 #else
327  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
328  #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
329 #endif
330 #if PY_MAJOR_VERSION >= 3
331  #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
332 #else
333  #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
334 #endif
335 #ifndef __has_attribute
336  #define __has_attribute(x) 0
337 #endif
338 #ifndef __has_cpp_attribute
339  #define __has_cpp_attribute(x) 0
340 #endif
341 #if CYTHON_USE_ASYNC_SLOTS
342  #if PY_VERSION_HEX >= 0x030500B1
343  #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
344  #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
345  #else
346  typedef struct {
347  unaryfunc am_await;
348  unaryfunc am_aiter;
349  unaryfunc am_anext;
350  } __Pyx_PyAsyncMethodsStruct;
351  #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
352  #endif
353 #else
354  #define __Pyx_PyType_AsAsync(obj) NULL
355 #endif
356 #ifndef CYTHON_RESTRICT
357  #if defined(__GNUC__)
358  #define CYTHON_RESTRICT __restrict__
359  #elif defined(_MSC_VER) && _MSC_VER >= 1400
360  #define CYTHON_RESTRICT __restrict
361  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
362  #define CYTHON_RESTRICT restrict
363  #else
364  #define CYTHON_RESTRICT
365  #endif
366 #endif
367 #ifndef CYTHON_UNUSED
368 # if defined(__GNUC__)
369 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
370 # define CYTHON_UNUSED __attribute__ ((__unused__))
371 # else
372 # define CYTHON_UNUSED
373 # endif
374 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
375 # define CYTHON_UNUSED __attribute__ ((__unused__))
376 # else
377 # define CYTHON_UNUSED
378 # endif
379 #endif
380 #ifndef CYTHON_MAYBE_UNUSED_VAR
381 # if defined(__cplusplus)
382  template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
383 # else
384 # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
385 # endif
386 #endif
387 #ifndef CYTHON_NCP_UNUSED
388 # if CYTHON_COMPILING_IN_CPYTHON
389 # define CYTHON_NCP_UNUSED
390 # else
391 # define CYTHON_NCP_UNUSED CYTHON_UNUSED
392 # endif
393 #endif
394 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
395 #ifdef _MSC_VER
396  #ifndef _MSC_STDINT_H_
397  #if _MSC_VER < 1300
398  typedef unsigned char uint8_t;
399  typedef unsigned int uint32_t;
400  #else
401  typedef unsigned __int8 uint8_t;
402  typedef unsigned __int32 uint32_t;
403  #endif
404  #endif
405 #else
406  #include <stdint.h>
407 #endif
408 #ifndef CYTHON_FALLTHROUGH
409  #ifdef __cplusplus
410  #if __has_cpp_attribute(fallthrough)
411  #define CYTHON_FALLTHROUGH [[fallthrough]]
412  #elif __has_cpp_attribute(clang::fallthrough)
413  #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
414  #endif
415  #endif
416  #ifndef CYTHON_FALLTHROUGH
417  #if __has_attribute(fallthrough) || (defined(__GNUC__) && defined(__attribute__))
418  #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
419  #else
420  #define CYTHON_FALLTHROUGH
421  #endif
422  #endif
423 #endif
424 
425 #ifndef __cplusplus
426  #error "Cython files generated with the C++ option must be compiled with a C++ compiler."
427 #endif
428 #ifndef CYTHON_INLINE
429  #if defined(__clang__)
430  #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
431  #else
432  #define CYTHON_INLINE inline
433  #endif
434 #endif
435 template<typename T>
436 void __Pyx_call_destructor(T& x) {
437  x.~T();
438 }
439 template<typename T>
440 class __Pyx_FakeReference {
441  public:
442  __Pyx_FakeReference() : ptr(NULL) { }
443  __Pyx_FakeReference(const T& ref) : ptr(const_cast<T*>(&ref)) { }
444  T *operator->() { return ptr; }
445  T *operator&() { return ptr; }
446  operator T&() { return *ptr; }
447  template<typename U> bool operator ==(U other) { return *ptr == other; }
448  template<typename U> bool operator !=(U other) { return *ptr != other; }
449  private:
450  T *ptr;
451 };
452 
453 #if defined(WIN32) || defined(MS_WINDOWS)
454  #define _USE_MATH_DEFINES
455 #endif
456 #include <math.h>
457 #ifdef NAN
458 #define __PYX_NAN() ((float) NAN)
459 #else
460 static CYTHON_INLINE float __PYX_NAN() {
461  float value;
462  memset(&value, 0xFF, sizeof(value));
463  return value;
464 }
465 #endif
466 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
467 #define __Pyx_truncl trunc
468 #else
469 #define __Pyx_truncl truncl
470 #endif
471 
472 
473 #define __PYX_ERR(f_index, lineno, Ln_error) \
474 { \
475  __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \
476 }
477 
478 #if PY_MAJOR_VERSION >= 3
479  #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
480  #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
481 #else
482  #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
483  #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
484 #endif
485 
486 #ifndef __PYX_EXTERN_C
487  #ifdef __cplusplus
488  #define __PYX_EXTERN_C extern "C"
489  #else
490  #define __PYX_EXTERN_C extern
491  #endif
492 #endif
493 
494 #define __PYX_HAVE__eventhooks
495 #define __PYX_HAVE_API__eventhooks
496 #include "ios"
497 #include "new"
498 #include "stdexcept"
499 #include "typeinfo"
500 #ifdef _OPENMP
501 #include <omp.h>
502 #endif /* _OPENMP */
503 
504 #ifdef PYREX_WITHOUT_ASSERTIONS
505 #define CYTHON_WITHOUT_ASSERTIONS
506 #endif
507 
508 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
509  const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
510 
511 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
512 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
513 #define __PYX_DEFAULT_STRING_ENCODING ""
514 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
515 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
516 #define __Pyx_uchar_cast(c) ((unsigned char)c)
517 #define __Pyx_long_cast(x) ((long)x)
518 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
519  (sizeof(type) < sizeof(Py_ssize_t)) ||\
520  (sizeof(type) > sizeof(Py_ssize_t) &&\
521  likely(v < (type)PY_SSIZE_T_MAX ||\
522  v == (type)PY_SSIZE_T_MAX) &&\
523  (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
524  v == (type)PY_SSIZE_T_MIN))) ||\
525  (sizeof(type) == sizeof(Py_ssize_t) &&\
526  (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
527  v == (type)PY_SSIZE_T_MAX))) )
528 #if defined (__cplusplus) && __cplusplus >= 201103L
529  #include <cstdlib>
530  #define __Pyx_sst_abs(value) std::abs(value)
531 #elif SIZEOF_INT >= SIZEOF_SIZE_T
532  #define __Pyx_sst_abs(value) abs(value)
533 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
534  #define __Pyx_sst_abs(value) labs(value)
535 #elif defined (_MSC_VER) && defined (_M_X64)
536  #define __Pyx_sst_abs(value) _abs64(value)
537 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
538  #define __Pyx_sst_abs(value) llabs(value)
539 #elif defined (__GNUC__)
540  #define __Pyx_sst_abs(value) __builtin_llabs(value)
541 #else
542  #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
543 #endif
544 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
545 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
546 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
547 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
548 #define __Pyx_PyBytes_FromString PyBytes_FromString
549 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
550 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
551 #if PY_MAJOR_VERSION < 3
552  #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
553  #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
554 #else
555  #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
556  #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
557 #endif
558 #define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s))
559 #define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
560 #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
561 #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
562 #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
563 #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
564 #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
565 #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
566 #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
567 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
568 #if PY_MAJOR_VERSION < 3
569 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
570 {
571  const Py_UNICODE *u_end = u;
572  while (*u_end++) ;
573  return (size_t)(u_end - u - 1);
574 }
575 #else
576 #define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
577 #endif
578 #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
579 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
580 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
581 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
582 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
583 #define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False))
584 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
585 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
586 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
587 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
588 #if CYTHON_ASSUME_SAFE_MACROS
589 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
590 #else
591 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
592 #endif
593 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
594 #if PY_MAJOR_VERSION >= 3
595 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
596 #else
597 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
598 #endif
599 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
600 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
601 static int __Pyx_sys_getdefaultencoding_not_ascii;
602 static int __Pyx_init_sys_getdefaultencoding_params(void) {
603  PyObject* sys;
604  PyObject* default_encoding = NULL;
605  PyObject* ascii_chars_u = NULL;
606  PyObject* ascii_chars_b = NULL;
607  const char* default_encoding_c;
608  sys = PyImport_ImportModule("sys");
609  if (!sys) goto bad;
610  default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
611  Py_DECREF(sys);
612  if (!default_encoding) goto bad;
613  default_encoding_c = PyBytes_AsString(default_encoding);
614  if (!default_encoding_c) goto bad;
615  if (strcmp(default_encoding_c, "ascii") == 0) {
616  __Pyx_sys_getdefaultencoding_not_ascii = 0;
617  } else {
618  char ascii_chars[128];
619  int c;
620  for (c = 0; c < 128; c++) {
621  ascii_chars[c] = c;
622  }
623  __Pyx_sys_getdefaultencoding_not_ascii = 1;
624  ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
625  if (!ascii_chars_u) goto bad;
626  ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
627  if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
628  PyErr_Format(
629  PyExc_ValueError,
630  "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
631  default_encoding_c);
632  goto bad;
633  }
634  Py_DECREF(ascii_chars_u);
635  Py_DECREF(ascii_chars_b);
636  }
637  Py_DECREF(default_encoding);
638  return 0;
639 bad:
640  Py_XDECREF(default_encoding);
641  Py_XDECREF(ascii_chars_u);
642  Py_XDECREF(ascii_chars_b);
643  return -1;
644 }
645 #endif
646 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
647 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
648 #else
649 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
650 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
651 static char* __PYX_DEFAULT_STRING_ENCODING;
652 static int __Pyx_init_sys_getdefaultencoding_params(void) {
653  PyObject* sys;
654  PyObject* default_encoding = NULL;
655  char* default_encoding_c;
656  sys = PyImport_ImportModule("sys");
657  if (!sys) goto bad;
658  default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
659  Py_DECREF(sys);
660  if (!default_encoding) goto bad;
661  default_encoding_c = PyBytes_AsString(default_encoding);
662  if (!default_encoding_c) goto bad;
663  __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
664  if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
665  strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
666  Py_DECREF(default_encoding);
667  return 0;
668 bad:
669  Py_XDECREF(default_encoding);
670  return -1;
671 }
672 #endif
673 #endif
674 
675 
676 /* Test for GCC > 2.95 */
677 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
678  #define likely(x) __builtin_expect(!!(x), 1)
679  #define unlikely(x) __builtin_expect(!!(x), 0)
680 #else /* !__GNUC__ or GCC < 2.95 */
681  #define likely(x) (x)
682  #define unlikely(x) (x)
683 #endif /* __GNUC__ */
684 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
685 
686 static PyObject *__pyx_m;
687 static PyObject *__pyx_d;
688 static PyObject *__pyx_b;
689 static PyObject *__pyx_cython_runtime;
690 static PyObject *__pyx_empty_tuple;
691 static PyObject *__pyx_empty_bytes;
692 static PyObject *__pyx_empty_unicode;
693 static int __pyx_lineno;
694 static int __pyx_clineno = 0;
695 static const char * __pyx_cfilenm= __FILE__;
696 static const char *__pyx_filename;
697 
698 
699 static const char *__pyx_f[] = {
700  "eventhooks.pyx",
701 };
702 
703 /*--- Type declarations ---*/
704 
705 /* --- Runtime support code (head) --- */
706 /* Refnanny.proto */
707 #ifndef CYTHON_REFNANNY
708  #define CYTHON_REFNANNY 0
709 #endif
710 #if CYTHON_REFNANNY
711  typedef struct {
712  void (*INCREF)(void*, PyObject*, int);
713  void (*DECREF)(void*, PyObject*, int);
714  void (*GOTREF)(void*, PyObject*, int);
715  void (*GIVEREF)(void*, PyObject*, int);
716  void* (*SetupContext)(const char*, int, const char*);
717  void (*FinishContext)(void**);
718  } __Pyx_RefNannyAPIStruct;
719  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
720  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
721  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
722 #ifdef WITH_THREAD
723  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
724  if (acquire_gil) {\
725  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
726  __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
727  PyGILState_Release(__pyx_gilstate_save);\
728  } else {\
729  __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
730  }
731 #else
732  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
733  __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
734 #endif
735  #define __Pyx_RefNannyFinishContext()\
736  __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
737  #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
738  #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
739  #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
740  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
741  #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
742  #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
743  #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
744  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
745 #else
746  #define __Pyx_RefNannyDeclarations
747  #define __Pyx_RefNannySetupContext(name, acquire_gil)
748  #define __Pyx_RefNannyFinishContext()
749  #define __Pyx_INCREF(r) Py_INCREF(r)
750  #define __Pyx_DECREF(r) Py_DECREF(r)
751  #define __Pyx_GOTREF(r)
752  #define __Pyx_GIVEREF(r)
753  #define __Pyx_XINCREF(r) Py_XINCREF(r)
754  #define __Pyx_XDECREF(r) Py_XDECREF(r)
755  #define __Pyx_XGOTREF(r)
756  #define __Pyx_XGIVEREF(r)
757 #endif
758 #define __Pyx_XDECREF_SET(r, v) do {\
759  PyObject *tmp = (PyObject *) r;\
760  r = v; __Pyx_XDECREF(tmp);\
761  } while (0)
762 #define __Pyx_DECREF_SET(r, v) do {\
763  PyObject *tmp = (PyObject *) r;\
764  r = v; __Pyx_DECREF(tmp);\
765  } while (0)
766 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
767 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
768 
769 /* PyObjectGetAttrStr.proto */
770 #if CYTHON_USE_TYPE_SLOTS
771 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
772  PyTypeObject* tp = Py_TYPE(obj);
773  if (likely(tp->tp_getattro))
774  return tp->tp_getattro(obj, attr_name);
775 #if PY_MAJOR_VERSION < 3
776  if (likely(tp->tp_getattr))
777  return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
778 #endif
779  return PyObject_GetAttr(obj, attr_name);
780 }
781 #else
782 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
783 #endif
784 
785 /* Import.proto */
786 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
787 
788 /* ImportFrom.proto */
789 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
790 
791 /* PyCFunctionFastCall.proto */
792 #if CYTHON_FAST_PYCCALL
793 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
794 #else
795 #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
796 #endif
797 
798 /* PyFunctionFastCall.proto */
799 #if CYTHON_FAST_PYCALL
800 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
801  __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
802 #if 1 || PY_VERSION_HEX < 0x030600B1
803 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs);
804 #else
805 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
806 #endif
807 #endif
808 
809 /* PyObjectCall.proto */
810 #if CYTHON_COMPILING_IN_CPYTHON
811 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
812 #else
813 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
814 #endif
815 
816 /* PyObjectCallMethO.proto */
817 #if CYTHON_COMPILING_IN_CPYTHON
818 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
819 #endif
820 
821 /* PyObjectCallOneArg.proto */
822 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
823 
824 /* PyObjectCallNoArg.proto */
825 #if CYTHON_COMPILING_IN_CPYTHON
826 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
827 #else
828 #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
829 #endif
830 
831 /* CLineInTraceback.proto */
832 static int __Pyx_CLineForTraceback(int c_line);
833 
834 /* CodeObjectCache.proto */
835 typedef struct {
836  PyCodeObject* code_object;
837  int code_line;
838 } __Pyx_CodeObjectCacheEntry;
839 struct __Pyx_CodeObjectCache {
840  int count;
841  int max_count;
842  __Pyx_CodeObjectCacheEntry* entries;
843 };
844 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
845 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
846 static PyCodeObject *__pyx_find_code_object(int code_line);
847 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
848 
849 /* AddTraceback.proto */
850 static void __Pyx_AddTraceback(const char *funcname, int c_line,
851  int py_line, const char *filename);
852 
853 /* CIntToPy.proto */
854 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
855 
856 /* CIntFromPy.proto */
857 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
858 
859 /* CIntFromPy.proto */
860 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
861 
862 /* CheckBinaryVersion.proto */
863 static int __Pyx_check_binary_version(void);
864 
865 /* FunctionExport.proto */
866 static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig);
867 
868 /* InitStrings.proto */
869 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
870 
871 
872 /* Module declarations from 'eventhooks' */
873 __PYX_EXTERN_C void CyclusEventLoopHook(void); /*proto*/
874 #define __Pyx_MODULE_NAME "eventhooks"
875 int __pyx_module_is_main_eventhooks = 0;
876 
877 /* Implementation of 'eventhooks' */
878 static const char __pyx_k_loop[] = "loop";
879 static const char __pyx_k_main[] = "__main__";
880 static const char __pyx_k_test[] = "__test__";
881 static const char __pyx_k_import[] = "__import__";
882 static const char __pyx_k_cyclus_events[] = "cyclus.events";
883 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
884 static const char __pyx_k_The_event_handling_module_in_cyc[] = "The event handling module in cyclus.";
885 static PyObject *__pyx_n_s_cline_in_traceback;
886 static PyObject *__pyx_n_s_cyclus_events;
887 static PyObject *__pyx_n_s_import;
888 static PyObject *__pyx_n_s_loop;
889 static PyObject *__pyx_n_s_main;
890 static PyObject *__pyx_n_s_test;
891 
892 /* "eventhooks.pyx":4
893  * from __future__ import print_function, unicode_literals
894  *
895  * cdef public void eventloophook "CyclusEventLoopHook" () except +: # <<<<<<<<<<<<<<
896  * from cyclus.events import loop
897  * loop()
898  */
899 
900 void CyclusEventLoopHook(void) {
901  PyObject *__pyx_v_loop = NULL;
902  __Pyx_RefNannyDeclarations
903  PyObject *__pyx_t_1 = NULL;
904  PyObject *__pyx_t_2 = NULL;
905  PyObject *__pyx_t_3 = NULL;
906  __Pyx_RefNannySetupContext("eventloophook", 0);
907 
908  /* "eventhooks.pyx":5
909  *
910  * cdef public void eventloophook "CyclusEventLoopHook" () except +:
911  * from cyclus.events import loop # <<<<<<<<<<<<<<
912  * loop()
913  *
914  */
915  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5, __pyx_L1_error)
916  __Pyx_GOTREF(__pyx_t_1);
917  __Pyx_INCREF(__pyx_n_s_loop);
918  __Pyx_GIVEREF(__pyx_n_s_loop);
919  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_loop);
920  __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)
921  __Pyx_GOTREF(__pyx_t_2);
922  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
923  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_loop); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5, __pyx_L1_error)
924  __Pyx_GOTREF(__pyx_t_1);
925  __Pyx_INCREF(__pyx_t_1);
926  __pyx_v_loop = __pyx_t_1;
927  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
928  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
929 
930  /* "eventhooks.pyx":6
931  * cdef public void eventloophook "CyclusEventLoopHook" () except +:
932  * from cyclus.events import loop
933  * loop() # <<<<<<<<<<<<<<
934  *
935  *
936  */
937  __Pyx_INCREF(__pyx_v_loop);
938  __pyx_t_1 = __pyx_v_loop; __pyx_t_3 = NULL;
939  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
940  __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
941  if (likely(__pyx_t_3)) {
942  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
943  __Pyx_INCREF(__pyx_t_3);
944  __Pyx_INCREF(function);
945  __Pyx_DECREF_SET(__pyx_t_1, function);
946  }
947  }
948  if (__pyx_t_3) {
949  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __pyx_L1_error)
950  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
951  } else {
952  __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __pyx_L1_error)
953  }
954  __Pyx_GOTREF(__pyx_t_2);
955  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
956  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
957 
958  /* "eventhooks.pyx":4
959  * from __future__ import print_function, unicode_literals
960  *
961  * cdef public void eventloophook "CyclusEventLoopHook" () except +: # <<<<<<<<<<<<<<
962  * from cyclus.events import loop
963  * loop()
964  */
965 
966  /* function exit code */
967  goto __pyx_L0;
968  __pyx_L1_error:;
969  __Pyx_XDECREF(__pyx_t_1);
970  __Pyx_XDECREF(__pyx_t_2);
971  __Pyx_XDECREF(__pyx_t_3);
972  __Pyx_AddTraceback("eventhooks.eventloophook", __pyx_clineno, __pyx_lineno, __pyx_filename);
973  __pyx_L0:;
974  __Pyx_XDECREF(__pyx_v_loop);
975  __Pyx_RefNannyFinishContext();
976 }
977 
978 static PyMethodDef __pyx_methods[] = {
979  {0, 0, 0, 0}
980 };
981 
982 #if PY_MAJOR_VERSION >= 3
983 static struct PyModuleDef __pyx_moduledef = {
984  #if PY_VERSION_HEX < 0x03020000
985  { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
986  #else
987  PyModuleDef_HEAD_INIT,
988  #endif
989  "eventhooks",
990  __pyx_k_The_event_handling_module_in_cyc, /* m_doc */
991  -1, /* m_size */
992  __pyx_methods /* m_methods */,
993  NULL, /* m_reload */
994  NULL, /* m_traverse */
995  NULL, /* m_clear */
996  NULL /* m_free */
997 };
998 #endif
999 
1000 static __Pyx_StringTabEntry __pyx_string_tab[] = {
1001  {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
1002  {&__pyx_n_s_cyclus_events, __pyx_k_cyclus_events, sizeof(__pyx_k_cyclus_events), 0, 0, 1, 1},
1003  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
1004  {&__pyx_n_s_loop, __pyx_k_loop, sizeof(__pyx_k_loop), 0, 0, 1, 1},
1005  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
1006  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
1007  {0, 0, 0, 0, 0, 0, 0}
1008 };
1009 static int __Pyx_InitCachedBuiltins(void) {
1010  return 0;
1011 }
1012 
1013 static int __Pyx_InitCachedConstants(void) {
1014  __Pyx_RefNannyDeclarations
1015  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
1016  __Pyx_RefNannyFinishContext();
1017  return 0;
1018 }
1019 
1020 static int __Pyx_InitGlobals(void) {
1021  if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
1022  return 0;
1023  __pyx_L1_error:;
1024  return -1;
1025 }
1026 
1027 #if PY_MAJOR_VERSION < 3
1028 PyMODINIT_FUNC initeventhooks(void); /*proto*/
1029 PyMODINIT_FUNC initeventhooks(void)
1030 #else
1031 PyMODINIT_FUNC PyInit_eventhooks(void); /*proto*/
1032 PyMODINIT_FUNC PyInit_eventhooks(void)
1033 #endif
1034 {
1035  PyObject *__pyx_t_1 = NULL;
1036  __Pyx_RefNannyDeclarations
1037  #if CYTHON_REFNANNY
1038  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
1039  if (!__Pyx_RefNanny) {
1040  PyErr_Clear();
1041  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
1042  if (!__Pyx_RefNanny)
1043  Py_FatalError("failed to import 'refnanny' module");
1044  }
1045  #endif
1046  __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_eventhooks(void)", 0);
1047  if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
1048  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
1049  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
1050  __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
1051  #ifdef __Pyx_CyFunction_USED
1052  if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
1053  #endif
1054  #ifdef __Pyx_FusedFunction_USED
1055  if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
1056  #endif
1057  #ifdef __Pyx_Coroutine_USED
1058  if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
1059  #endif
1060  #ifdef __Pyx_Generator_USED
1061  if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
1062  #endif
1063  #ifdef __Pyx_StopAsyncIteration_USED
1064  if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
1065  #endif
1066  /*--- Library function declarations ---*/
1067  /*--- Threads initialization code ---*/
1068  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
1069  #ifdef WITH_THREAD /* Python build with threading support? */
1070  PyEval_InitThreads();
1071  #endif
1072  #endif
1073  /*--- Module creation code ---*/
1074  #if PY_MAJOR_VERSION < 3
1075  __pyx_m = Py_InitModule4("eventhooks", __pyx_methods, __pyx_k_The_event_handling_module_in_cyc, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
1076  #else
1077  __pyx_m = PyModule_Create(&__pyx_moduledef);
1078  #endif
1079  if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
1080  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
1081  Py_INCREF(__pyx_d);
1082  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
1083  __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
1084  #if CYTHON_COMPILING_IN_PYPY
1085  Py_INCREF(__pyx_b);
1086  #endif
1087  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
1088  /*--- Initialize various global constants etc. ---*/
1089  if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
1090  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
1091  if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
1092  #endif
1093  if (__pyx_module_is_main_eventhooks) {
1094  if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
1095  }
1096  #if PY_MAJOR_VERSION >= 3
1097  {
1098  PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
1099  if (!PyDict_GetItemString(modules, "eventhooks")) {
1100  if (unlikely(PyDict_SetItemString(modules, "eventhooks", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
1101  }
1102  }
1103  #endif
1104  /*--- Builtin init code ---*/
1105  if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
1106  /*--- Constants init code ---*/
1107  if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
1108  /*--- Global init code ---*/
1109  /*--- Variable export code ---*/
1110  /*--- Function export code ---*/
1111  if (__Pyx_ExportFunction("eventloophook", (void (*)(void))CyclusEventLoopHook, "void (void)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
1112  /*--- Type init code ---*/
1113  /*--- Type import code ---*/
1114  /*--- Variable import code ---*/
1115  /*--- Function import code ---*/
1116  /*--- Execution code ---*/
1117  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
1118  if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
1119  #endif
1120 
1121  /* "eventhooks.pyx":1
1122  * """The event handling module in cyclus.""" # <<<<<<<<<<<<<<
1123  * from __future__ import print_function, unicode_literals
1124  *
1125  */
1126  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
1127  __Pyx_GOTREF(__pyx_t_1);
1128  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
1129  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1130 
1131  /*--- Wrapped vars code ---*/
1132 
1133  goto __pyx_L0;
1134  __pyx_L1_error:;
1135  __Pyx_XDECREF(__pyx_t_1);
1136  if (__pyx_m) {
1137  if (__pyx_d) {
1138  __Pyx_AddTraceback("init eventhooks", 0, __pyx_lineno, __pyx_filename);
1139  }
1140  Py_DECREF(__pyx_m); __pyx_m = 0;
1141  } else if (!PyErr_Occurred()) {
1142  PyErr_SetString(PyExc_ImportError, "init eventhooks");
1143  }
1144  __pyx_L0:;
1145  __Pyx_RefNannyFinishContext();
1146  #if PY_MAJOR_VERSION < 3
1147  return;
1148  #else
1149  return __pyx_m;
1150  #endif
1151 }
1152 
1153 /* --- Runtime support code --- */
1154 /* Refnanny */
1155 #if CYTHON_REFNANNY
1156 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
1157  PyObject *m = NULL, *p = NULL;
1158  void *r = NULL;
1159  m = PyImport_ImportModule((char *)modname);
1160  if (!m) goto end;
1161  p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
1162  if (!p) goto end;
1163  r = PyLong_AsVoidPtr(p);
1164 end:
1165  Py_XDECREF(p);
1166  Py_XDECREF(m);
1167  return (__Pyx_RefNannyAPIStruct *)r;
1168 }
1169 #endif
1170 
1171 /* Import */
1172 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
1173  PyObject *empty_list = 0;
1174  PyObject *module = 0;
1175  PyObject *global_dict = 0;
1176  PyObject *empty_dict = 0;
1177  PyObject *list;
1178  #if PY_VERSION_HEX < 0x03030000
1179  PyObject *py_import;
1180  py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
1181  if (!py_import)
1182  goto bad;
1183  #endif
1184  if (from_list)
1185  list = from_list;
1186  else {
1187  empty_list = PyList_New(0);
1188  if (!empty_list)
1189  goto bad;
1190  list = empty_list;
1191  }
1192  global_dict = PyModule_GetDict(__pyx_m);
1193  if (!global_dict)
1194  goto bad;
1195  empty_dict = PyDict_New();
1196  if (!empty_dict)
1197  goto bad;
1198  {
1199  #if PY_MAJOR_VERSION >= 3
1200  if (level == -1) {
1201  if (strchr(__Pyx_MODULE_NAME, '.')) {
1202  #if PY_VERSION_HEX < 0x03030000
1203  PyObject *py_level = PyInt_FromLong(1);
1204  if (!py_level)
1205  goto bad;
1206  module = PyObject_CallFunctionObjArgs(py_import,
1207  name, global_dict, empty_dict, list, py_level, NULL);
1208  Py_DECREF(py_level);
1209  #else
1210  module = PyImport_ImportModuleLevelObject(
1211  name, global_dict, empty_dict, list, 1);
1212  #endif
1213  if (!module) {
1214  if (!PyErr_ExceptionMatches(PyExc_ImportError))
1215  goto bad;
1216  PyErr_Clear();
1217  }
1218  }
1219  level = 0;
1220  }
1221  #endif
1222  if (!module) {
1223  #if PY_VERSION_HEX < 0x03030000
1224  PyObject *py_level = PyInt_FromLong(level);
1225  if (!py_level)
1226  goto bad;
1227  module = PyObject_CallFunctionObjArgs(py_import,
1228  name, global_dict, empty_dict, list, py_level, NULL);
1229  Py_DECREF(py_level);
1230  #else
1231  module = PyImport_ImportModuleLevelObject(
1232  name, global_dict, empty_dict, list, level);
1233  #endif
1234  }
1235  }
1236 bad:
1237  #if PY_VERSION_HEX < 0x03030000
1238  Py_XDECREF(py_import);
1239  #endif
1240  Py_XDECREF(empty_list);
1241  Py_XDECREF(empty_dict);
1242  return module;
1243 }
1244 
1245 /* ImportFrom */
1246 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
1247  PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
1248  if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
1249  PyErr_Format(PyExc_ImportError,
1250  #if PY_MAJOR_VERSION < 3
1251  "cannot import name %.230s", PyString_AS_STRING(name));
1252  #else
1253  "cannot import name %S", name);
1254  #endif
1255  }
1256  return value;
1257 }
1258 
1259 /* PyCFunctionFastCall */
1260 #if CYTHON_FAST_PYCCALL
1261 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
1262  PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
1263  PyCFunction meth = PyCFunction_GET_FUNCTION(func);
1264  PyObject *self = PyCFunction_GET_SELF(func);
1265  int flags = PyCFunction_GET_FLAGS(func);
1266  assert(PyCFunction_Check(func));
1267  assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS)));
1268  assert(nargs >= 0);
1269  assert(nargs == 0 || args != NULL);
1270  /* _PyCFunction_FastCallDict() must not be called with an exception set,
1271  because it may clear it (directly or indirectly) and so the
1272  caller loses its exception */
1273  assert(!PyErr_Occurred());
1274  if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
1275  return (*((__Pyx_PyCFunctionFastWithKeywords)meth)) (self, args, nargs, NULL);
1276  } else {
1277  return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs);
1278  }
1279 }
1280 #endif
1281 
1282 /* PyFunctionFastCall */
1283 #if CYTHON_FAST_PYCALL
1284 #include "frameobject.h"
1285 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
1286  PyObject *globals) {
1287  PyFrameObject *f;
1288  PyThreadState *tstate = PyThreadState_GET();
1289  PyObject **fastlocals;
1290  Py_ssize_t i;
1291  PyObject *result;
1292  assert(globals != NULL);
1293  /* XXX Perhaps we should create a specialized
1294  PyFrame_New() that doesn't take locals, but does
1295  take builtins without sanity checking them.
1296  */
1297  assert(tstate != NULL);
1298  f = PyFrame_New(tstate, co, globals, NULL);
1299  if (f == NULL) {
1300  return NULL;
1301  }
1302  fastlocals = f->f_localsplus;
1303  for (i = 0; i < na; i++) {
1304  Py_INCREF(*args);
1305  fastlocals[i] = *args++;
1306  }
1307  result = PyEval_EvalFrameEx(f,0);
1308  ++tstate->recursion_depth;
1309  Py_DECREF(f);
1310  --tstate->recursion_depth;
1311  return result;
1312 }
1313 #if 1 || PY_VERSION_HEX < 0x030600B1
1314 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) {
1315  PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
1316  PyObject *globals = PyFunction_GET_GLOBALS(func);
1317  PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
1318  PyObject *closure;
1319 #if PY_MAJOR_VERSION >= 3
1320  PyObject *kwdefs;
1321 #endif
1322  PyObject *kwtuple, **k;
1323  PyObject **d;
1324  Py_ssize_t nd;
1325  Py_ssize_t nk;
1326  PyObject *result;
1327  assert(kwargs == NULL || PyDict_Check(kwargs));
1328  nk = kwargs ? PyDict_Size(kwargs) : 0;
1329  if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
1330  return NULL;
1331  }
1332  if (
1333 #if PY_MAJOR_VERSION >= 3
1334  co->co_kwonlyargcount == 0 &&
1335 #endif
1336  likely(kwargs == NULL || nk == 0) &&
1337  co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
1338  if (argdefs == NULL && co->co_argcount == nargs) {
1339  result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
1340  goto done;
1341  }
1342  else if (nargs == 0 && argdefs != NULL
1343  && co->co_argcount == Py_SIZE(argdefs)) {
1344  /* function called with no arguments, but all parameters have
1345  a default value: use default values as arguments .*/
1346  args = &PyTuple_GET_ITEM(argdefs, 0);
1347  result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
1348  goto done;
1349  }
1350  }
1351  if (kwargs != NULL) {
1352  Py_ssize_t pos, i;
1353  kwtuple = PyTuple_New(2 * nk);
1354  if (kwtuple == NULL) {
1355  result = NULL;
1356  goto done;
1357  }
1358  k = &PyTuple_GET_ITEM(kwtuple, 0);
1359  pos = i = 0;
1360  while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
1361  Py_INCREF(k[i]);
1362  Py_INCREF(k[i+1]);
1363  i += 2;
1364  }
1365  nk = i / 2;
1366  }
1367  else {
1368  kwtuple = NULL;
1369  k = NULL;
1370  }
1371  closure = PyFunction_GET_CLOSURE(func);
1372 #if PY_MAJOR_VERSION >= 3
1373  kwdefs = PyFunction_GET_KW_DEFAULTS(func);
1374 #endif
1375  if (argdefs != NULL) {
1376  d = &PyTuple_GET_ITEM(argdefs, 0);
1377  nd = Py_SIZE(argdefs);
1378  }
1379  else {
1380  d = NULL;
1381  nd = 0;
1382  }
1383 #if PY_MAJOR_VERSION >= 3
1384  result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
1385  args, nargs,
1386  k, (int)nk,
1387  d, (int)nd, kwdefs, closure);
1388 #else
1389  result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
1390  args, nargs,
1391  k, (int)nk,
1392  d, (int)nd, closure);
1393 #endif
1394  Py_XDECREF(kwtuple);
1395 done:
1396  Py_LeaveRecursiveCall();
1397  return result;
1398 }
1399 #endif
1400 #endif
1401 
1402 /* PyObjectCall */
1403 #if CYTHON_COMPILING_IN_CPYTHON
1404 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
1405  PyObject *result;
1406  ternaryfunc call = func->ob_type->tp_call;
1407  if (unlikely(!call))
1408  return PyObject_Call(func, arg, kw);
1409  if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
1410  return NULL;
1411  result = (*call)(func, arg, kw);
1412  Py_LeaveRecursiveCall();
1413  if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
1414  PyErr_SetString(
1415  PyExc_SystemError,
1416  "NULL result without error in PyObject_Call");
1417  }
1418  return result;
1419 }
1420 #endif
1421 
1422 /* PyObjectCallMethO */
1423 #if CYTHON_COMPILING_IN_CPYTHON
1424 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
1425  PyObject *self, *result;
1426  PyCFunction cfunc;
1427  cfunc = PyCFunction_GET_FUNCTION(func);
1428  self = PyCFunction_GET_SELF(func);
1429  if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
1430  return NULL;
1431  result = cfunc(self, arg);
1432  Py_LeaveRecursiveCall();
1433  if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
1434  PyErr_SetString(
1435  PyExc_SystemError,
1436  "NULL result without error in PyObject_Call");
1437  }
1438  return result;
1439 }
1440 #endif
1441 
1442 /* PyObjectCallOneArg */
1443 #if CYTHON_COMPILING_IN_CPYTHON
1444 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
1445  PyObject *result;
1446  PyObject *args = PyTuple_New(1);
1447  if (unlikely(!args)) return NULL;
1448  Py_INCREF(arg);
1449  PyTuple_SET_ITEM(args, 0, arg);
1450  result = __Pyx_PyObject_Call(func, args, NULL);
1451  Py_DECREF(args);
1452  return result;
1453 }
1454 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
1455 #if CYTHON_FAST_PYCALL
1456  if (PyFunction_Check(func)) {
1457  return __Pyx_PyFunction_FastCall(func, &arg, 1);
1458  }
1459 #endif
1460  if (likely(PyCFunction_Check(func))) {
1461  if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
1462  return __Pyx_PyObject_CallMethO(func, arg);
1463 #if CYTHON_FAST_PYCCALL
1464  } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
1465  return __Pyx_PyCFunction_FastCall(func, &arg, 1);
1466 #endif
1467  }
1468  }
1469  return __Pyx__PyObject_CallOneArg(func, arg);
1470 }
1471 #else
1472 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
1473  PyObject *result;
1474  PyObject *args = PyTuple_Pack(1, arg);
1475  if (unlikely(!args)) return NULL;
1476  result = __Pyx_PyObject_Call(func, args, NULL);
1477  Py_DECREF(args);
1478  return result;
1479 }
1480 #endif
1481 
1482 /* PyObjectCallNoArg */
1483 #if CYTHON_COMPILING_IN_CPYTHON
1484 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
1485 #if CYTHON_FAST_PYCALL
1486  if (PyFunction_Check(func)) {
1487  return __Pyx_PyFunction_FastCall(func, NULL, 0);
1488  }
1489 #endif
1490 #ifdef __Pyx_CyFunction_USED
1491  if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
1492 #else
1493  if (likely(PyCFunction_Check(func))) {
1494 #endif
1495  if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
1496  return __Pyx_PyObject_CallMethO(func, NULL);
1497  }
1498  }
1499  return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
1500 }
1501 #endif
1502 
1503 /* CLineInTraceback */
1504  static int __Pyx_CLineForTraceback(int c_line) {
1505 #ifdef CYTHON_CLINE_IN_TRACEBACK
1506  return ((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0;
1507 #else
1508  PyObject *use_cline;
1509 #if CYTHON_COMPILING_IN_CPYTHON
1510  PyObject **cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
1511  if (likely(cython_runtime_dict)) {
1512  use_cline = PyDict_GetItem(*cython_runtime_dict, __pyx_n_s_cline_in_traceback);
1513  } else
1514 #endif
1515  {
1516  PyObject *ptype, *pvalue, *ptraceback;
1517  PyObject *use_cline_obj;
1518  PyErr_Fetch(&ptype, &pvalue, &ptraceback);
1519  use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
1520  if (use_cline_obj) {
1521  use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
1522  Py_DECREF(use_cline_obj);
1523  } else {
1524  use_cline = NULL;
1525  }
1526  PyErr_Restore(ptype, pvalue, ptraceback);
1527  }
1528  if (!use_cline) {
1529  c_line = 0;
1530  PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
1531  }
1532  else if (PyObject_Not(use_cline) != 0) {
1533  c_line = 0;
1534  }
1535  return c_line;
1536 #endif
1537 }
1538 
1539 /* CodeObjectCache */
1540  static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
1541  int start = 0, mid = 0, end = count - 1;
1542  if (end >= 0 && code_line > entries[end].code_line) {
1543  return count;
1544  }
1545  while (start < end) {
1546  mid = start + (end - start) / 2;
1547  if (code_line < entries[mid].code_line) {
1548  end = mid;
1549  } else if (code_line > entries[mid].code_line) {
1550  start = mid + 1;
1551  } else {
1552  return mid;
1553  }
1554  }
1555  if (code_line <= entries[mid].code_line) {
1556  return mid;
1557  } else {
1558  return mid + 1;
1559  }
1560 }
1561 static PyCodeObject *__pyx_find_code_object(int code_line) {
1562  PyCodeObject* code_object;
1563  int pos;
1564  if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
1565  return NULL;
1566  }
1567  pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
1568  if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
1569  return NULL;
1570  }
1571  code_object = __pyx_code_cache.entries[pos].code_object;
1572  Py_INCREF(code_object);
1573  return code_object;
1574 }
1575 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
1576  int pos, i;
1577  __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
1578  if (unlikely(!code_line)) {
1579  return;
1580  }
1581  if (unlikely(!entries)) {
1582  entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
1583  if (likely(entries)) {
1584  __pyx_code_cache.entries = entries;
1585  __pyx_code_cache.max_count = 64;
1586  __pyx_code_cache.count = 1;
1587  entries[0].code_line = code_line;
1588  entries[0].code_object = code_object;
1589  Py_INCREF(code_object);
1590  }
1591  return;
1592  }
1593  pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
1594  if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
1595  PyCodeObject* tmp = entries[pos].code_object;
1596  entries[pos].code_object = code_object;
1597  Py_DECREF(tmp);
1598  return;
1599  }
1600  if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
1601  int new_max = __pyx_code_cache.max_count + 64;
1602  entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
1603  __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
1604  if (unlikely(!entries)) {
1605  return;
1606  }
1607  __pyx_code_cache.entries = entries;
1608  __pyx_code_cache.max_count = new_max;
1609  }
1610  for (i=__pyx_code_cache.count; i>pos; i--) {
1611  entries[i] = entries[i-1];
1612  }
1613  entries[pos].code_line = code_line;
1614  entries[pos].code_object = code_object;
1615  __pyx_code_cache.count++;
1616  Py_INCREF(code_object);
1617 }
1618 
1619 /* AddTraceback */
1620  #include "compile.h"
1621 #include "frameobject.h"
1622 #include "traceback.h"
1623 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
1624  const char *funcname, int c_line,
1625  int py_line, const char *filename) {
1626  PyCodeObject *py_code = 0;
1627  PyObject *py_srcfile = 0;
1628  PyObject *py_funcname = 0;
1629  #if PY_MAJOR_VERSION < 3
1630  py_srcfile = PyString_FromString(filename);
1631  #else
1632  py_srcfile = PyUnicode_FromString(filename);
1633  #endif
1634  if (!py_srcfile) goto bad;
1635  if (c_line) {
1636  #if PY_MAJOR_VERSION < 3
1637  py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
1638  #else
1639  py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
1640  #endif
1641  }
1642  else {
1643  #if PY_MAJOR_VERSION < 3
1644  py_funcname = PyString_FromString(funcname);
1645  #else
1646  py_funcname = PyUnicode_FromString(funcname);
1647  #endif
1648  }
1649  if (!py_funcname) goto bad;
1650  py_code = __Pyx_PyCode_New(
1651  0,
1652  0,
1653  0,
1654  0,
1655  0,
1656  __pyx_empty_bytes, /*PyObject *code,*/
1657  __pyx_empty_tuple, /*PyObject *consts,*/
1658  __pyx_empty_tuple, /*PyObject *names,*/
1659  __pyx_empty_tuple, /*PyObject *varnames,*/
1660  __pyx_empty_tuple, /*PyObject *freevars,*/
1661  __pyx_empty_tuple, /*PyObject *cellvars,*/
1662  py_srcfile, /*PyObject *filename,*/
1663  py_funcname, /*PyObject *name,*/
1664  py_line,
1665  __pyx_empty_bytes /*PyObject *lnotab*/
1666  );
1667  Py_DECREF(py_srcfile);
1668  Py_DECREF(py_funcname);
1669  return py_code;
1670 bad:
1671  Py_XDECREF(py_srcfile);
1672  Py_XDECREF(py_funcname);
1673  return NULL;
1674 }
1675 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1676  int py_line, const char *filename) {
1677  PyCodeObject *py_code = 0;
1678  PyFrameObject *py_frame = 0;
1679  if (c_line) {
1680  c_line = __Pyx_CLineForTraceback(c_line);
1681  }
1682  py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
1683  if (!py_code) {
1684  py_code = __Pyx_CreateCodeObjectForTraceback(
1685  funcname, c_line, py_line, filename);
1686  if (!py_code) goto bad;
1687  __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
1688  }
1689  py_frame = PyFrame_New(
1690  PyThreadState_GET(), /*PyThreadState *tstate,*/
1691  py_code, /*PyCodeObject *code,*/
1692  __pyx_d, /*PyObject *globals,*/
1693  0 /*PyObject *locals*/
1694  );
1695  if (!py_frame) goto bad;
1696  __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
1697  PyTraceBack_Here(py_frame);
1698 bad:
1699  Py_XDECREF(py_code);
1700  Py_XDECREF(py_frame);
1701 }
1702 
1703 /* CIntToPy */
1704  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
1705  const long neg_one = (long) -1, const_zero = (long) 0;
1706  const int is_unsigned = neg_one > const_zero;
1707  if (is_unsigned) {
1708  if (sizeof(long) < sizeof(long)) {
1709  return PyInt_FromLong((long) value);
1710  } else if (sizeof(long) <= sizeof(unsigned long)) {
1711  return PyLong_FromUnsignedLong((unsigned long) value);
1712 #ifdef HAVE_LONG_LONG
1713  } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
1714  return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
1715 #endif
1716  }
1717  } else {
1718  if (sizeof(long) <= sizeof(long)) {
1719  return PyInt_FromLong((long) value);
1720 #ifdef HAVE_LONG_LONG
1721  } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
1722  return PyLong_FromLongLong((PY_LONG_LONG) value);
1723 #endif
1724  }
1725  }
1726  {
1727  int one = 1; int little = (int)*(unsigned char *)&one;
1728  unsigned char *bytes = (unsigned char *)&value;
1729  return _PyLong_FromByteArray(bytes, sizeof(long),
1730  little, !is_unsigned);
1731  }
1732 }
1733 
1734 /* CIntFromPyVerify */
1735  #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
1736  __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
1737 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
1738  __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
1739 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
1740  {\
1741  func_type value = func_value;\
1742  if (sizeof(target_type) < sizeof(func_type)) {\
1743  if (unlikely(value != (func_type) (target_type) value)) {\
1744  func_type zero = 0;\
1745  if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
1746  return (target_type) -1;\
1747  if (is_unsigned && unlikely(value < zero))\
1748  goto raise_neg_overflow;\
1749  else\
1750  goto raise_overflow;\
1751  }\
1752  }\
1753  return (target_type) value;\
1754  }
1755 
1756 /* CIntFromPy */
1757  static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
1758  const long neg_one = (long) -1, const_zero = (long) 0;
1759  const int is_unsigned = neg_one > const_zero;
1760 #if PY_MAJOR_VERSION < 3
1761  if (likely(PyInt_Check(x))) {
1762  if (sizeof(long) < sizeof(long)) {
1763  __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
1764  } else {
1765  long val = PyInt_AS_LONG(x);
1766  if (is_unsigned && unlikely(val < 0)) {
1767  goto raise_neg_overflow;
1768  }
1769  return (long) val;
1770  }
1771  } else
1772 #endif
1773  if (likely(PyLong_Check(x))) {
1774  if (is_unsigned) {
1775 #if CYTHON_USE_PYLONG_INTERNALS
1776  const digit* digits = ((PyLongObject*)x)->ob_digit;
1777  switch (Py_SIZE(x)) {
1778  case 0: return (long) 0;
1779  case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
1780  case 2:
1781  if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
1782  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
1783  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
1784  } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
1785  return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
1786  }
1787  }
1788  break;
1789  case 3:
1790  if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
1791  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
1792  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
1793  } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
1794  return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
1795  }
1796  }
1797  break;
1798  case 4:
1799  if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
1800  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
1801  __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])))
1802  } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
1803  return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
1804  }
1805  }
1806  break;
1807  }
1808 #endif
1809 #if CYTHON_COMPILING_IN_CPYTHON
1810  if (unlikely(Py_SIZE(x) < 0)) {
1811  goto raise_neg_overflow;
1812  }
1813 #else
1814  {
1815  int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
1816  if (unlikely(result < 0))
1817  return (long) -1;
1818  if (unlikely(result == 1))
1819  goto raise_neg_overflow;
1820  }
1821 #endif
1822  if (sizeof(long) <= sizeof(unsigned long)) {
1823  __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
1824 #ifdef HAVE_LONG_LONG
1825  } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
1826  __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
1827 #endif
1828  }
1829  } else {
1830 #if CYTHON_USE_PYLONG_INTERNALS
1831  const digit* digits = ((PyLongObject*)x)->ob_digit;
1832  switch (Py_SIZE(x)) {
1833  case 0: return (long) 0;
1834  case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
1835  case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
1836  case -2:
1837  if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
1838  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
1839  __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
1840  } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
1841  return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
1842  }
1843  }
1844  break;
1845  case 2:
1846  if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
1847  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
1848  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
1849  } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
1850  return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
1851  }
1852  }
1853  break;
1854  case -3:
1855  if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
1856  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
1857  __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
1858  } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
1859  return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
1860  }
1861  }
1862  break;
1863  case 3:
1864  if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
1865  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
1866  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
1867  } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
1868  return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
1869  }
1870  }
1871  break;
1872  case -4:
1873  if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
1874  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
1875  __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])))
1876  } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
1877  return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
1878  }
1879  }
1880  break;
1881  case 4:
1882  if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
1883  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
1884  __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])))
1885  } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
1886  return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
1887  }
1888  }
1889  break;
1890  }
1891 #endif
1892  if (sizeof(long) <= sizeof(long)) {
1893  __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
1894 #ifdef HAVE_LONG_LONG
1895  } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
1896  __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
1897 #endif
1898  }
1899  }
1900  {
1901 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
1902  PyErr_SetString(PyExc_RuntimeError,
1903  "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
1904 #else
1905  long val;
1906  PyObject *v = __Pyx_PyNumber_IntOrLong(x);
1907  #if PY_MAJOR_VERSION < 3
1908  if (likely(v) && !PyLong_Check(v)) {
1909  PyObject *tmp = v;
1910  v = PyNumber_Long(tmp);
1911  Py_DECREF(tmp);
1912  }
1913  #endif
1914  if (likely(v)) {
1915  int one = 1; int is_little = (int)*(unsigned char *)&one;
1916  unsigned char *bytes = (unsigned char *)&val;
1917  int ret = _PyLong_AsByteArray((PyLongObject *)v,
1918  bytes, sizeof(val),
1919  is_little, !is_unsigned);
1920  Py_DECREF(v);
1921  if (likely(!ret))
1922  return val;
1923  }
1924 #endif
1925  return (long) -1;
1926  }
1927  } else {
1928  long val;
1929  PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
1930  if (!tmp) return (long) -1;
1931  val = __Pyx_PyInt_As_long(tmp);
1932  Py_DECREF(tmp);
1933  return val;
1934  }
1935 raise_overflow:
1936  PyErr_SetString(PyExc_OverflowError,
1937  "value too large to convert to long");
1938  return (long) -1;
1939 raise_neg_overflow:
1940  PyErr_SetString(PyExc_OverflowError,
1941  "can't convert negative value to long");
1942  return (long) -1;
1943 }
1944 
1945 /* CIntFromPy */
1946  static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
1947  const int neg_one = (int) -1, const_zero = (int) 0;
1948  const int is_unsigned = neg_one > const_zero;
1949 #if PY_MAJOR_VERSION < 3
1950  if (likely(PyInt_Check(x))) {
1951  if (sizeof(int) < sizeof(long)) {
1952  __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
1953  } else {
1954  long val = PyInt_AS_LONG(x);
1955  if (is_unsigned && unlikely(val < 0)) {
1956  goto raise_neg_overflow;
1957  }
1958  return (int) val;
1959  }
1960  } else
1961 #endif
1962  if (likely(PyLong_Check(x))) {
1963  if (is_unsigned) {
1964 #if CYTHON_USE_PYLONG_INTERNALS
1965  const digit* digits = ((PyLongObject*)x)->ob_digit;
1966  switch (Py_SIZE(x)) {
1967  case 0: return (int) 0;
1968  case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
1969  case 2:
1970  if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
1971  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
1972  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
1973  } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
1974  return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
1975  }
1976  }
1977  break;
1978  case 3:
1979  if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
1980  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
1981  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
1982  } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
1983  return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
1984  }
1985  }
1986  break;
1987  case 4:
1988  if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
1989  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
1990  __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])))
1991  } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
1992  return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
1993  }
1994  }
1995  break;
1996  }
1997 #endif
1998 #if CYTHON_COMPILING_IN_CPYTHON
1999  if (unlikely(Py_SIZE(x) < 0)) {
2000  goto raise_neg_overflow;
2001  }
2002 #else
2003  {
2004  int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
2005  if (unlikely(result < 0))
2006  return (int) -1;
2007  if (unlikely(result == 1))
2008  goto raise_neg_overflow;
2009  }
2010 #endif
2011  if (sizeof(int) <= sizeof(unsigned long)) {
2012  __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
2013 #ifdef HAVE_LONG_LONG
2014  } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
2015  __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
2016 #endif
2017  }
2018  } else {
2019 #if CYTHON_USE_PYLONG_INTERNALS
2020  const digit* digits = ((PyLongObject*)x)->ob_digit;
2021  switch (Py_SIZE(x)) {
2022  case 0: return (int) 0;
2023  case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
2024  case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
2025  case -2:
2026  if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
2027  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
2028  __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
2029  } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
2030  return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
2031  }
2032  }
2033  break;
2034  case 2:
2035  if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
2036  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
2037  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
2038  } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
2039  return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
2040  }
2041  }
2042  break;
2043  case -3:
2044  if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
2045  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
2046  __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
2047  } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
2048  return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
2049  }
2050  }
2051  break;
2052  case 3:
2053  if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
2054  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
2055  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
2056  } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
2057  return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
2058  }
2059  }
2060  break;
2061  case -4:
2062  if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
2063  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
2064  __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])))
2065  } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
2066  return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
2067  }
2068  }
2069  break;
2070  case 4:
2071  if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
2072  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
2073  __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])))
2074  } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
2075  return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
2076  }
2077  }
2078  break;
2079  }
2080 #endif
2081  if (sizeof(int) <= sizeof(long)) {
2082  __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
2083 #ifdef HAVE_LONG_LONG
2084  } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
2085  __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
2086 #endif
2087  }
2088  }
2089  {
2090 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
2091  PyErr_SetString(PyExc_RuntimeError,
2092  "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
2093 #else
2094  int val;
2095  PyObject *v = __Pyx_PyNumber_IntOrLong(x);
2096  #if PY_MAJOR_VERSION < 3
2097  if (likely(v) && !PyLong_Check(v)) {
2098  PyObject *tmp = v;
2099  v = PyNumber_Long(tmp);
2100  Py_DECREF(tmp);
2101  }
2102  #endif
2103  if (likely(v)) {
2104  int one = 1; int is_little = (int)*(unsigned char *)&one;
2105  unsigned char *bytes = (unsigned char *)&val;
2106  int ret = _PyLong_AsByteArray((PyLongObject *)v,
2107  bytes, sizeof(val),
2108  is_little, !is_unsigned);
2109  Py_DECREF(v);
2110  if (likely(!ret))
2111  return val;
2112  }
2113 #endif
2114  return (int) -1;
2115  }
2116  } else {
2117  int val;
2118  PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
2119  if (!tmp) return (int) -1;
2120  val = __Pyx_PyInt_As_int(tmp);
2121  Py_DECREF(tmp);
2122  return val;
2123  }
2124 raise_overflow:
2125  PyErr_SetString(PyExc_OverflowError,
2126  "value too large to convert to int");
2127  return (int) -1;
2128 raise_neg_overflow:
2129  PyErr_SetString(PyExc_OverflowError,
2130  "can't convert negative value to int");
2131  return (int) -1;
2132 }
2133 
2134 /* CheckBinaryVersion */
2135  static int __Pyx_check_binary_version(void) {
2136  char ctversion[4], rtversion[4];
2137  PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
2138  PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
2139  if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
2140  char message[200];
2141  PyOS_snprintf(message, sizeof(message),
2142  "compiletime version %s of module '%.100s' "
2143  "does not match runtime version %s",
2144  ctversion, __Pyx_MODULE_NAME, rtversion);
2145  return PyErr_WarnEx(NULL, message, 1);
2146  }
2147  return 0;
2148 }
2149 
2150 /* FunctionExport */
2151  static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) {
2152  PyObject *d = 0;
2153  PyObject *cobj = 0;
2154  union {
2155  void (*fp)(void);
2156  void *p;
2157  } tmp;
2158  d = PyObject_GetAttrString(__pyx_m, (char *)"__pyx_capi__");
2159  if (!d) {
2160  PyErr_Clear();
2161  d = PyDict_New();
2162  if (!d)
2163  goto bad;
2164  Py_INCREF(d);
2165  if (PyModule_AddObject(__pyx_m, (char *)"__pyx_capi__", d) < 0)
2166  goto bad;
2167  }
2168  tmp.fp = f;
2169 #if PY_VERSION_HEX >= 0x02070000
2170  cobj = PyCapsule_New(tmp.p, sig, 0);
2171 #else
2172  cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (void *)sig, 0);
2173 #endif
2174  if (!cobj)
2175  goto bad;
2176  if (PyDict_SetItemString(d, name, cobj) < 0)
2177  goto bad;
2178  Py_DECREF(cobj);
2179  Py_DECREF(d);
2180  return 0;
2181 bad:
2182  Py_XDECREF(cobj);
2183  Py_XDECREF(d);
2184  return -1;
2185 }
2186 
2187 /* InitStrings */
2188  static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
2189  while (t->p) {
2190  #if PY_MAJOR_VERSION < 3
2191  if (t->is_unicode) {
2192  *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
2193  } else if (t->intern) {
2194  *t->p = PyString_InternFromString(t->s);
2195  } else {
2196  *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
2197  }
2198  #else
2199  if (t->is_unicode | t->is_str) {
2200  if (t->intern) {
2201  *t->p = PyUnicode_InternFromString(t->s);
2202  } else if (t->encoding) {
2203  *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
2204  } else {
2205  *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
2206  }
2207  } else {
2208  *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
2209  }
2210  #endif
2211  if (!*t->p)
2212  return -1;
2213  if (PyObject_Hash(*t->p) == -1)
2214  PyErr_Clear();
2215  ++t;
2216  }
2217  return 0;
2218 }
2219 
2220 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
2221  return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
2222 }
2223 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
2224  Py_ssize_t ignore;
2225  return __Pyx_PyObject_AsStringAndSize(o, &ignore);
2226 }
2227 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
2228 #if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
2229  if (
2230 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
2231  __Pyx_sys_getdefaultencoding_not_ascii &&
2232 #endif
2233  PyUnicode_Check(o)) {
2234 #if PY_VERSION_HEX < 0x03030000
2235  char* defenc_c;
2236  PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
2237  if (!defenc) return NULL;
2238  defenc_c = PyBytes_AS_STRING(defenc);
2239 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
2240  {
2241  char* end = defenc_c + PyBytes_GET_SIZE(defenc);
2242  char* c;
2243  for (c = defenc_c; c < end; c++) {
2244  if ((unsigned char) (*c) >= 128) {
2245  PyUnicode_AsASCIIString(o);
2246  return NULL;
2247  }
2248  }
2249  }
2250 #endif
2251  *length = PyBytes_GET_SIZE(defenc);
2252  return defenc_c;
2253 #else
2254  if (__Pyx_PyUnicode_READY(o) == -1) return NULL;
2255 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
2256  if (PyUnicode_IS_ASCII(o)) {
2257  *length = PyUnicode_GET_LENGTH(o);
2258  return PyUnicode_AsUTF8(o);
2259  } else {
2260  PyUnicode_AsASCIIString(o);
2261  return NULL;
2262  }
2263 #else
2264  return PyUnicode_AsUTF8AndSize(o, length);
2265 #endif
2266 #endif
2267  } else
2268 #endif
2269 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
2270  if (PyByteArray_Check(o)) {
2271  *length = PyByteArray_GET_SIZE(o);
2272  return PyByteArray_AS_STRING(o);
2273  } else
2274 #endif
2275  {
2276  char* result;
2277  int r = PyBytes_AsStringAndSize(o, &result, length);
2278  if (unlikely(r < 0)) {
2279  return NULL;
2280  } else {
2281  return result;
2282  }
2283  }
2284 }
2285 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
2286  int is_true = x == Py_True;
2287  if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
2288  else return PyObject_IsTrue(x);
2289 }
2290 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
2291 #if CYTHON_USE_TYPE_SLOTS
2292  PyNumberMethods *m;
2293 #endif
2294  const char *name = NULL;
2295  PyObject *res = NULL;
2296 #if PY_MAJOR_VERSION < 3
2297  if (PyInt_Check(x) || PyLong_Check(x))
2298 #else
2299  if (PyLong_Check(x))
2300 #endif
2301  return __Pyx_NewRef(x);
2302 #if CYTHON_USE_TYPE_SLOTS
2303  m = Py_TYPE(x)->tp_as_number;
2304  #if PY_MAJOR_VERSION < 3
2305  if (m && m->nb_int) {
2306  name = "int";
2307  res = PyNumber_Int(x);
2308  }
2309  else if (m && m->nb_long) {
2310  name = "long";
2311  res = PyNumber_Long(x);
2312  }
2313  #else
2314  if (m && m->nb_int) {
2315  name = "int";
2316  res = PyNumber_Long(x);
2317  }
2318  #endif
2319 #else
2320  res = PyNumber_Int(x);
2321 #endif
2322  if (res) {
2323 #if PY_MAJOR_VERSION < 3
2324  if (!PyInt_Check(res) && !PyLong_Check(res)) {
2325 #else
2326  if (!PyLong_Check(res)) {
2327 #endif
2328  PyErr_Format(PyExc_TypeError,
2329  "__%.4s__ returned non-%.4s (type %.200s)",
2330  name, name, Py_TYPE(res)->tp_name);
2331  Py_DECREF(res);
2332  return NULL;
2333  }
2334  }
2335  else if (!PyErr_Occurred()) {
2336  PyErr_SetString(PyExc_TypeError,
2337  "an integer is required");
2338  }
2339  return res;
2340 }
2341 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
2342  Py_ssize_t ival;
2343  PyObject *x;
2344 #if PY_MAJOR_VERSION < 3
2345  if (likely(PyInt_CheckExact(b))) {
2346  if (sizeof(Py_ssize_t) >= sizeof(long))
2347  return PyInt_AS_LONG(b);
2348  else
2349  return PyInt_AsSsize_t(x);
2350  }
2351 #endif
2352  if (likely(PyLong_CheckExact(b))) {
2353  #if CYTHON_USE_PYLONG_INTERNALS
2354  const digit* digits = ((PyLongObject*)b)->ob_digit;
2355  const Py_ssize_t size = Py_SIZE(b);
2356  if (likely(__Pyx_sst_abs(size) <= 1)) {
2357  ival = likely(size) ? digits[0] : 0;
2358  if (size == -1) ival = -ival;
2359  return ival;
2360  } else {
2361  switch (size) {
2362  case 2:
2363  if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
2364  return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
2365  }
2366  break;
2367  case -2:
2368  if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
2369  return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
2370  }
2371  break;
2372  case 3:
2373  if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
2374  return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
2375  }
2376  break;
2377  case -3:
2378  if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
2379  return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
2380  }
2381  break;
2382  case 4:
2383  if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
2384  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]));
2385  }
2386  break;
2387  case -4:
2388  if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
2389  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]));
2390  }
2391  break;
2392  }
2393  }
2394  #endif
2395  return PyLong_AsSsize_t(b);
2396  }
2397  x = PyNumber_Index(b);
2398  if (!x) return -1;
2399  ival = PyInt_AsSsize_t(x);
2400  Py_DECREF(x);
2401  return ival;
2402 }
2403 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
2404  return PyInt_FromSize_t(ival);
2405 }
2406 
2407 
2408 #endif /* Py_PYTHON_H */
double b(int nuc)
Computes the scattering length [cm] from the coherent and incoherent components.
Definition: pyne.cc:11180
std::string name(int nuc)
Definition: pyne.cc:2940
def memset(dest, src, size)
__PYX_EXTERN_C void CyclusEventLoopHook(void)
zz_group fp
fission product Z number group
Definition: pyne.cc:2663
PyMODINIT_FUNC initeventhooks(void)
static std::string digits
string of digit characters
Definition: pyne.h:124
bool operator==(const CapacityConstraint< T > &lhs, const CapacityConstraint< T > &rhs)
CapacityConstraint-CapacityConstraint equality operator.
#define __PYX_EXTERN_C
Definition: eventhooks.cc.h:13
enable_if< has_const_iterator< T >::value, typename T::const_iterator >::type end(const T &c)