3 #define PY_SSIZE_T_CLEAN 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+. 10 #define CYTHON_ABI "0_26_1" 13 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) 15 #if !defined(WIN32) && !defined(MS_WINDOWS) 27 #define DL_IMPORT(t) t 30 #define DL_EXPORT(t) t 33 #ifndef HAVE_LONG_LONG 34 #if PY_VERSION_HEX >= 0x03030000 || (PY_MAJOR_VERSION == 2 && PY_VERSION_HEX >= 0x02070000) 35 #define HAVE_LONG_LONG 39 #define PY_LONG_LONG LONG_LONG 42 #define Py_HUGE_VAL HUGE_VAL 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 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 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 95 #ifndef CYTHON_ASSUME_SAFE_MACROS 96 #define CYTHON_ASSUME_SAFE_MACROS 1 98 #ifndef CYTHON_UNPACK_METHODS 99 #define CYTHON_UNPACK_METHODS 1 101 #undef CYTHON_FAST_THREAD_STATE 102 #define CYTHON_FAST_THREAD_STATE 0 103 #undef CYTHON_FAST_PYCALL 104 #define CYTHON_FAST_PYCALL 0 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 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 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 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 130 #ifndef CYTHON_USE_PYLIST_INTERNALS 131 #define CYTHON_USE_PYLIST_INTERNALS 1 133 #ifndef CYTHON_USE_UNICODE_INTERNALS 134 #define CYTHON_USE_UNICODE_INTERNALS 1 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 142 #ifndef CYTHON_AVOID_BORROWED_REFS 143 #define CYTHON_AVOID_BORROWED_REFS 0 145 #ifndef CYTHON_ASSUME_SAFE_MACROS 146 #define CYTHON_ASSUME_SAFE_MACROS 1 148 #ifndef CYTHON_UNPACK_METHODS 149 #define CYTHON_UNPACK_METHODS 1 151 #ifndef CYTHON_FAST_THREAD_STATE 152 #define CYTHON_FAST_THREAD_STATE 1 154 #ifndef CYTHON_FAST_PYCALL 155 #define CYTHON_FAST_PYCALL 1 158 #if !defined(CYTHON_FAST_PYCCALL) 159 #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) 161 #if CYTHON_USE_PYLONG_INTERNALS 162 #include "longintrepr.h" 167 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) 168 #define Py_OptimizeFlag 0 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 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 183 #ifndef Py_TPFLAGS_CHECKTYPES 184 #define Py_TPFLAGS_CHECKTYPES 0 186 #ifndef Py_TPFLAGS_HAVE_INDEX 187 #define Py_TPFLAGS_HAVE_INDEX 0 189 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER 190 #define Py_TPFLAGS_HAVE_NEWBUFFER 0 192 #ifndef Py_TPFLAGS_HAVE_FINALIZE 193 #define Py_TPFLAGS_HAVE_FINALIZE 0 195 #if PY_VERSION_HEX < 0x030700A0 || !defined(METH_FASTCALL) 196 #ifndef METH_FASTCALL 197 #define METH_FASTCALL 0x80 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);
203 #define __Pyx_PyCFunctionFast _PyCFunctionFast 204 #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords 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))))) 210 #define __Pyx_PyFastCFunction_Check(func) 0 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))) 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)) 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) 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)) 247 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) 248 #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) 250 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check) 251 #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) 253 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) 254 #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) 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) 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) 265 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) 266 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) 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) 273 #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) 275 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII) 276 #define PyObject_ASCII(o) PyObject_Repr(o) 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 285 #if PY_MAJOR_VERSION >= 3 286 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) 287 #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) 289 #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) 290 #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) 292 #ifndef PySet_CheckExact 293 #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) 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 314 #if PY_MAJOR_VERSION >= 3 315 #define PyBoolObject PyLongObject 317 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY 318 #ifndef PyUnicode_InternFromString 319 #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) 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 327 #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t 328 #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t 330 #if PY_MAJOR_VERSION >= 3 331 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) 333 #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) 335 #ifndef __has_attribute 336 #define __has_attribute(x) 0 338 #ifndef __has_cpp_attribute 339 #define __has_cpp_attribute(x) 0 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) 350 } __Pyx_PyAsyncMethodsStruct;
351 #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) 354 #define __Pyx_PyType_AsAsync(obj) NULL 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 364 #define CYTHON_RESTRICT 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__)) 372 # define CYTHON_UNUSED 374 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) 375 # define CYTHON_UNUSED __attribute__ ((__unused__)) 377 # define CYTHON_UNUSED 380 #ifndef CYTHON_MAYBE_UNUSED_VAR 381 # if defined(__cplusplus) 382 template<
class T>
void CYTHON_MAYBE_UNUSED_VAR(
const T& ) { }
384 # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x) 387 #ifndef CYTHON_NCP_UNUSED 388 # if CYTHON_COMPILING_IN_CPYTHON 389 # define CYTHON_NCP_UNUSED 391 # define CYTHON_NCP_UNUSED CYTHON_UNUSED 394 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) 396 #ifndef _MSC_STDINT_H_ 398 typedef unsigned char uint8_t;
399 typedef unsigned int uint32_t;
401 typedef unsigned __int8 uint8_t;
402 typedef unsigned __int32 uint32_t;
408 #ifndef CYTHON_FALLTHROUGH 410 #if __has_cpp_attribute(fallthrough) 411 #define CYTHON_FALLTHROUGH [[fallthrough]] 412 #elif __has_cpp_attribute(clang::fallthrough) 413 #define CYTHON_FALLTHROUGH [[clang::fallthrough]] 416 #ifndef CYTHON_FALLTHROUGH 417 #if __has_attribute(fallthrough) || (defined(__GNUC__) && defined(__attribute__)) 418 #define CYTHON_FALLTHROUGH __attribute__((fallthrough)) 420 #define CYTHON_FALLTHROUGH 426 #error "Cython files generated with the C++ option must be compiled with a C++ compiler." 428 #ifndef CYTHON_INLINE 429 #if defined(__clang__) 430 #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) 432 #define CYTHON_INLINE inline 436 void __Pyx_call_destructor(T& x) {
440 class __Pyx_FakeReference {
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; }
453 #if defined(WIN32) || defined(MS_WINDOWS) 454 #define _USE_MATH_DEFINES 458 #define __PYX_NAN() ((float) NAN) 460 static CYTHON_INLINE
float __PYX_NAN() {
462 memset(&value, 0xFF,
sizeof(value));
466 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) 467 #define __Pyx_truncl trunc 469 #define __Pyx_truncl truncl 473 #define __PYX_ERR(f_index, lineno, Ln_error) \ 475 __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \ 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) 482 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) 483 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) 486 #ifndef __PYX_EXTERN_C 488 #define __PYX_EXTERN_C extern "C" 490 #define __PYX_EXTERN_C extern 494 #define __PYX_HAVE__eventhooks 495 #define __PYX_HAVE_API__eventhooks 504 #ifdef PYREX_WITHOUT_ASSERTIONS 505 #define CYTHON_WITHOUT_ASSERTIONS 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;
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 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) 542 #define __Pyx_sst_abs(value) ((value<0) ? -value : value) 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 555 #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString 556 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize 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)
571 const Py_UNICODE *u_end = u;
573 return (
size_t)(u_end - u - 1);
576 #define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen 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)) 591 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) 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)) 597 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) 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) {
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");
610 default_encoding = PyObject_CallMethod(sys, (
char*)
"getdefaultencoding", NULL);
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;
618 char ascii_chars[128];
620 for (c = 0; c < 128; c++) {
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) {
630 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
634 Py_DECREF(ascii_chars_u);
635 Py_DECREF(ascii_chars_b);
637 Py_DECREF(default_encoding);
640 Py_XDECREF(default_encoding);
641 Py_XDECREF(ascii_chars_u);
642 Py_XDECREF(ascii_chars_b);
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) 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) {
654 PyObject* default_encoding = NULL;
655 char* default_encoding_c;
656 sys = PyImport_ImportModule(
"sys");
658 default_encoding = PyObject_CallMethod(sys, (
char*) (
const char*)
"getdefaultencoding", NULL);
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);
669 Py_XDECREF(default_encoding);
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) 681 #define likely(x) (x) 682 #define unlikely(x) (x) 684 static CYTHON_INLINE
void __Pyx_pretend_to_initialize(
void* ptr) { (void)ptr; }
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;
699 static const char *__pyx_f[] = {
707 #ifndef CYTHON_REFNANNY 708 #define CYTHON_REFNANNY 0 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; 723 #define __Pyx_RefNannySetupContext(name, 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);\ 729 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ 732 #define __Pyx_RefNannySetupContext(name, acquire_gil)\ 733 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) 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) 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) 758 #define __Pyx_XDECREF_SET(r, v) do {\ 759 PyObject *tmp = (PyObject *) r;\ 760 r = v; __Pyx_XDECREF(tmp);\ 762 #define __Pyx_DECREF_SET(r, v) do {\ 763 PyObject *tmp = (PyObject *) r;\ 764 r = v; __Pyx_DECREF(tmp);\ 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) 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));
779 return PyObject_GetAttr(obj, attr_name);
782 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) 786 static PyObject *__Pyx_Import(PyObject *
name, PyObject *from_list,
int level);
789 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject*
name);
792 #if CYTHON_FAST_PYCCALL 793 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
795 #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) 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);
805 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) 810 #if CYTHON_COMPILING_IN_CPYTHON 811 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
813 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) 817 #if CYTHON_COMPILING_IN_CPYTHON 818 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
822 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
825 #if CYTHON_COMPILING_IN_CPYTHON 826 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
828 #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL) 832 static int __Pyx_CLineForTraceback(
int c_line);
836 PyCodeObject* code_object;
838 } __Pyx_CodeObjectCacheEntry;
839 struct __Pyx_CodeObjectCache {
842 __Pyx_CodeObjectCacheEntry* entries;
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);
850 static void __Pyx_AddTraceback(
const char *funcname,
int c_line,
851 int py_line,
const char *filename);
854 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(
long value);
857 static CYTHON_INLINE
long __Pyx_PyInt_As_long(PyObject *);
860 static CYTHON_INLINE
int __Pyx_PyInt_As_int(PyObject *);
863 static int __Pyx_check_binary_version(
void);
866 static int __Pyx_ExportFunction(
const char *
name,
void (*f)(
void),
const char *sig);
869 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
874 #define __Pyx_MODULE_NAME "eventhooks" 875 int __pyx_module_is_main_eventhooks = 0;
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;
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);
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;
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);
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;
952 __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __pyx_L1_error)
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;
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);
974 __Pyx_XDECREF(__pyx_v_loop);
975 __Pyx_RefNannyFinishContext();
978 static PyMethodDef __pyx_methods[] = {
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 },
987 PyModuleDef_HEAD_INIT,
990 __pyx_k_The_event_handling_module_in_cyc,
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}
1009 static int __Pyx_InitCachedBuiltins(
void) {
1013 static int __Pyx_InitCachedConstants(
void) {
1014 __Pyx_RefNannyDeclarations
1015 __Pyx_RefNannySetupContext(
"__Pyx_InitCachedConstants", 0);
1016 __Pyx_RefNannyFinishContext();
1020 static int __Pyx_InitGlobals(
void) {
1021 if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
1027 #if PY_MAJOR_VERSION < 3 1031 PyMODINIT_FUNC PyInit_eventhooks(
void);
1032 PyMODINIT_FUNC PyInit_eventhooks(
void)
1035 PyObject *__pyx_t_1 = NULL;
1036 __Pyx_RefNannyDeclarations
1038 __Pyx_RefNanny = __Pyx_RefNannyImportAPI(
"refnanny");
1039 if (!__Pyx_RefNanny) {
1041 __Pyx_RefNanny = __Pyx_RefNannyImportAPI(
"Cython.Runtime.refnanny");
1042 if (!__Pyx_RefNanny)
1043 Py_FatalError(
"failed to import 'refnanny' module");
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)
1054 #ifdef __Pyx_FusedFunction_USED 1055 if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
1057 #ifdef __Pyx_Coroutine_USED 1058 if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
1060 #ifdef __Pyx_Generator_USED 1061 if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
1063 #ifdef __Pyx_StopAsyncIteration_USED 1064 if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
1068 #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS 1070 PyEval_InitThreads();
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);
1077 __pyx_m = PyModule_Create(&__pyx_moduledef);
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)
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 1087 if (PyObject_SetAttrString(__pyx_m,
"__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
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)
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)
1096 #if PY_MAJOR_VERSION >= 3 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)
1105 if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
1107 if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
1111 if (__Pyx_ExportFunction(
"eventloophook", (
void (*)(
void))
CyclusEventLoopHook,
"void (void)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
1117 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) 1118 if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
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;
1135 __Pyx_XDECREF(__pyx_t_1);
1138 __Pyx_AddTraceback(
"init eventhooks", 0, __pyx_lineno, __pyx_filename);
1140 Py_DECREF(__pyx_m); __pyx_m = 0;
1141 }
else if (!PyErr_Occurred()) {
1142 PyErr_SetString(PyExc_ImportError,
"init eventhooks");
1145 __Pyx_RefNannyFinishContext();
1146 #if PY_MAJOR_VERSION < 3 1156 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(
const char *modname) {
1157 PyObject *m = NULL, *p = NULL;
1159 m = PyImport_ImportModule((
char *)modname);
1161 p = PyObject_GetAttrString(m, (
char *)
"RefNannyAPI");
1163 r = PyLong_AsVoidPtr(p);
1167 return (__Pyx_RefNannyAPIStruct *)r;
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;
1178 #if PY_VERSION_HEX < 0x03030000 1179 PyObject *py_import;
1180 py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
1187 empty_list = PyList_New(0);
1192 global_dict = PyModule_GetDict(__pyx_m);
1195 empty_dict = PyDict_New();
1199 #if PY_MAJOR_VERSION >= 3 1201 if (strchr(__Pyx_MODULE_NAME,
'.')) {
1202 #if PY_VERSION_HEX < 0x03030000 1203 PyObject *py_level = PyInt_FromLong(1);
1206 module = PyObject_CallFunctionObjArgs(py_import,
1207 name, global_dict, empty_dict, list, py_level, NULL);
1208 Py_DECREF(py_level);
1210 module = PyImport_ImportModuleLevelObject(
1211 name, global_dict, empty_dict, list, 1);
1214 if (!PyErr_ExceptionMatches(PyExc_ImportError))
1223 #if PY_VERSION_HEX < 0x03030000 1224 PyObject *py_level = PyInt_FromLong(level);
1227 module = PyObject_CallFunctionObjArgs(py_import,
1228 name, global_dict, empty_dict, list, py_level, NULL);
1229 Py_DECREF(py_level);
1231 module = PyImport_ImportModuleLevelObject(
1232 name, global_dict, empty_dict, list, level);
1237 #if PY_VERSION_HEX < 0x03030000 1238 Py_XDECREF(py_import);
1240 Py_XDECREF(empty_list);
1241 Py_XDECREF(empty_dict);
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));
1253 "cannot import name %S",
name);
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)));
1269 assert(nargs == 0 || args != NULL);
1273 assert(!PyErr_Occurred());
1274 if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
1275 return (*((__Pyx_PyCFunctionFastWithKeywords)meth)) (
self, args, nargs, NULL);
1277 return (*((__Pyx_PyCFunctionFast)meth)) (
self, args, nargs);
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) {
1288 PyThreadState *tstate = PyThreadState_GET();
1289 PyObject **fastlocals;
1292 assert(globals != NULL);
1297 assert(tstate != NULL);
1298 f = PyFrame_New(tstate, co, globals, NULL);
1302 fastlocals = f->f_localsplus;
1303 for (i = 0; i < na; i++) {
1305 fastlocals[i] = *args++;
1307 result = PyEval_EvalFrameEx(f,0);
1308 ++tstate->recursion_depth;
1310 --tstate->recursion_depth;
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);
1319 #if PY_MAJOR_VERSION >= 3 1322 PyObject *kwtuple, **k;
1327 assert(kwargs == NULL || PyDict_Check(kwargs));
1328 nk = kwargs ? PyDict_Size(kwargs) : 0;
1329 if (Py_EnterRecursiveCall((
char*)
" while calling a Python object")) {
1333 #
if PY_MAJOR_VERSION >= 3
1334 co->co_kwonlyargcount == 0 &&
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);
1342 else if (nargs == 0 && argdefs != NULL
1343 && co->co_argcount == Py_SIZE(argdefs)) {
1346 args = &PyTuple_GET_ITEM(argdefs, 0);
1347 result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
1351 if (kwargs != NULL) {
1353 kwtuple = PyTuple_New(2 * nk);
1354 if (kwtuple == NULL) {
1358 k = &PyTuple_GET_ITEM(kwtuple, 0);
1360 while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
1371 closure = PyFunction_GET_CLOSURE(func);
1372 #if PY_MAJOR_VERSION >= 3 1373 kwdefs = PyFunction_GET_KW_DEFAULTS(func);
1375 if (argdefs != NULL) {
1376 d = &PyTuple_GET_ITEM(argdefs, 0);
1377 nd = Py_SIZE(argdefs);
1383 #if PY_MAJOR_VERSION >= 3 1384 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
1387 d, (
int)nd, kwdefs, closure);
1389 result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
1392 d, (
int)nd, closure);
1394 Py_XDECREF(kwtuple);
1396 Py_LeaveRecursiveCall();
1403 #if CYTHON_COMPILING_IN_CPYTHON 1404 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
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")))
1411 result = (*call)(func, arg, kw);
1412 Py_LeaveRecursiveCall();
1413 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
1416 "NULL result without error in PyObject_Call");
1423 #if CYTHON_COMPILING_IN_CPYTHON 1424 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
1425 PyObject *
self, *result;
1427 cfunc = PyCFunction_GET_FUNCTION(func);
1428 self = PyCFunction_GET_SELF(func);
1429 if (unlikely(Py_EnterRecursiveCall((
char*)
" while calling a Python object")))
1431 result = cfunc(
self, arg);
1432 Py_LeaveRecursiveCall();
1433 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
1436 "NULL result without error in PyObject_Call");
1443 #if CYTHON_COMPILING_IN_CPYTHON 1444 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
1446 PyObject *args = PyTuple_New(1);
1447 if (unlikely(!args))
return NULL;
1449 PyTuple_SET_ITEM(args, 0, arg);
1450 result = __Pyx_PyObject_Call(func, args, NULL);
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);
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);
1469 return __Pyx__PyObject_CallOneArg(func, arg);
1472 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
1474 PyObject *args = PyTuple_Pack(1, arg);
1475 if (unlikely(!args))
return NULL;
1476 result = __Pyx_PyObject_Call(func, args, NULL);
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);
1490 #ifdef __Pyx_CyFunction_USED 1491 if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
1493 if (likely(PyCFunction_Check(func))) {
1495 if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
1496 return __Pyx_PyObject_CallMethO(func, NULL);
1499 return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
1504 static int __Pyx_CLineForTraceback(
int c_line) {
1505 #ifdef CYTHON_CLINE_IN_TRACEBACK 1506 return ((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0;
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);
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);
1526 PyErr_Restore(ptype, pvalue, ptraceback);
1530 PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
1532 else if (PyObject_Not(use_cline) != 0) {
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) {
1545 while (start <
end) {
1546 mid = start + (
end - start) / 2;
1547 if (code_line < entries[mid].code_line) {
1549 }
else if (code_line > entries[mid].code_line) {
1555 if (code_line <= entries[mid].code_line) {
1561 static PyCodeObject *__pyx_find_code_object(
int code_line) {
1562 PyCodeObject* code_object;
1564 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
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)) {
1571 code_object = __pyx_code_cache.entries[pos].code_object;
1572 Py_INCREF(code_object);
1575 static void __pyx_insert_code_object(
int code_line, PyCodeObject* code_object) {
1577 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
1578 if (unlikely(!code_line)) {
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);
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;
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)) {
1607 __pyx_code_cache.entries = entries;
1608 __pyx_code_cache.max_count = new_max;
1610 for (i=__pyx_code_cache.count; i>pos; i--) {
1611 entries[i] = entries[i-1];
1613 entries[pos].code_line = code_line;
1614 entries[pos].code_object = code_object;
1615 __pyx_code_cache.count++;
1616 Py_INCREF(code_object);
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);
1632 py_srcfile = PyUnicode_FromString(filename);
1634 if (!py_srcfile)
goto bad;
1636 #if PY_MAJOR_VERSION < 3 1637 py_funcname = PyString_FromFormat(
"%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
1639 py_funcname = PyUnicode_FromFormat(
"%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
1643 #if PY_MAJOR_VERSION < 3 1644 py_funcname = PyString_FromString(funcname);
1646 py_funcname = PyUnicode_FromString(funcname);
1649 if (!py_funcname)
goto bad;
1650 py_code = __Pyx_PyCode_New(
1667 Py_DECREF(py_srcfile);
1668 Py_DECREF(py_funcname);
1671 Py_XDECREF(py_srcfile);
1672 Py_XDECREF(py_funcname);
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;
1680 c_line = __Pyx_CLineForTraceback(c_line);
1682 py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
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);
1689 py_frame = PyFrame_New(
1690 PyThreadState_GET(),
1695 if (!py_frame)
goto bad;
1696 __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
1697 PyTraceBack_Here(py_frame);
1699 Py_XDECREF(py_code);
1700 Py_XDECREF(py_frame);
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;
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);
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);
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);
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)\ 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;\ 1750 goto raise_overflow;\ 1753 return (target_type) value;\ 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))
1765 long val = PyInt_AS_LONG(x);
1766 if (is_unsigned && unlikely(val < 0)) {
1767 goto raise_neg_overflow;
1773 if (likely(PyLong_Check(x))) {
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])
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]));
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]));
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]));
1809 #if CYTHON_COMPILING_IN_CPYTHON 1810 if (unlikely(Py_SIZE(x) < 0)) {
1811 goto raise_neg_overflow;
1815 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
1816 if (unlikely(result < 0))
1818 if (unlikely(result == 1))
1819 goto raise_neg_overflow;
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))
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])
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])));
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])));
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])));
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])));
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])));
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])));
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))
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");
1906 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
1907 #if PY_MAJOR_VERSION < 3 1908 if (likely(v) && !PyLong_Check(v)) {
1910 v = PyNumber_Long(tmp);
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,
1919 is_little, !is_unsigned);
1929 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
1930 if (!tmp)
return (
long) -1;
1931 val = __Pyx_PyInt_As_long(tmp);
1936 PyErr_SetString(PyExc_OverflowError,
1937 "value too large to convert to long");
1940 PyErr_SetString(PyExc_OverflowError,
1941 "can't convert negative value to long");
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))
1954 long val = PyInt_AS_LONG(x);
1955 if (is_unsigned && unlikely(val < 0)) {
1956 goto raise_neg_overflow;
1962 if (likely(PyLong_Check(x))) {
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])
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]));
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]));
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]));
1998 #if CYTHON_COMPILING_IN_CPYTHON 1999 if (unlikely(Py_SIZE(x) < 0)) {
2000 goto raise_neg_overflow;
2004 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
2005 if (unlikely(result < 0))
2007 if (unlikely(result == 1))
2008 goto raise_neg_overflow;
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))
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])
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])));
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])));
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])));
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])));
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])));
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])));
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))
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");
2095 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
2096 #if PY_MAJOR_VERSION < 3 2097 if (likely(v) && !PyLong_Check(v)) {
2099 v = PyNumber_Long(tmp);
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,
2108 is_little, !is_unsigned);
2118 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
2119 if (!tmp)
return (
int) -1;
2120 val = __Pyx_PyInt_As_int(tmp);
2125 PyErr_SetString(PyExc_OverflowError,
2126 "value too large to convert to int");
2129 PyErr_SetString(PyExc_OverflowError,
2130 "can't convert negative value to int");
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]) {
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);
2151 static int __Pyx_ExportFunction(
const char *
name,
void (*f)(
void),
const char *sig) {
2158 d = PyObject_GetAttrString(__pyx_m, (
char *)
"__pyx_capi__");
2165 if (PyModule_AddObject(__pyx_m, (
char *)
"__pyx_capi__", d) < 0)
2169 #if PY_VERSION_HEX >= 0x02070000 2170 cobj = PyCapsule_New(tmp.p, sig, 0);
2172 cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (
void *)sig, 0);
2176 if (PyDict_SetItemString(d, name, cobj) < 0)
2188 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
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);
2196 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
2199 if (t->is_unicode | t->is_str) {
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);
2205 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
2208 *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
2213 if (PyObject_Hash(*t->p) == -1)
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));
2223 static CYTHON_INLINE
const char* __Pyx_PyObject_AsString(PyObject* o) {
2225 return __Pyx_PyObject_AsStringAndSize(o, &ignore);
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) 2230 #
if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
2231 __Pyx_sys_getdefaultencoding_not_ascii &&
2233 PyUnicode_Check(o)) {
2234 #if PY_VERSION_HEX < 0x03030000 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 2241 char*
end = defenc_c + PyBytes_GET_SIZE(defenc);
2243 for (c = defenc_c; c <
end; c++) {
2244 if ((
unsigned char) (*c) >= 128) {
2245 PyUnicode_AsASCIIString(o);
2251 *length = PyBytes_GET_SIZE(defenc);
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);
2260 PyUnicode_AsASCIIString(o);
2264 return PyUnicode_AsUTF8AndSize(o, length);
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);
2277 int r = PyBytes_AsStringAndSize(o, &result, length);
2278 if (unlikely(r < 0)) {
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);
2290 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
2291 #if CYTHON_USE_TYPE_SLOTS 2294 const char *name = NULL;
2295 PyObject *res = NULL;
2296 #if PY_MAJOR_VERSION < 3 2297 if (PyInt_Check(x) || PyLong_Check(x))
2299 if (PyLong_Check(x))
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) {
2307 res = PyNumber_Int(x);
2309 else if (m && m->nb_long) {
2311 res = PyNumber_Long(x);
2314 if (m && m->nb_int) {
2316 res = PyNumber_Long(x);
2320 res = PyNumber_Int(x);
2323 #if PY_MAJOR_VERSION < 3 2324 if (!PyInt_Check(res) && !PyLong_Check(res)) {
2326 if (!PyLong_Check(res)) {
2328 PyErr_Format(PyExc_TypeError,
2329 "__%.4s__ returned non-%.4s (type %.200s)",
2330 name, name, Py_TYPE(res)->tp_name);
2335 else if (!PyErr_Occurred()) {
2336 PyErr_SetString(PyExc_TypeError,
2337 "an integer is required");
2341 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*
b) {
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);
2349 return PyInt_AsSsize_t(x);
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;
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]));
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]));
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]));
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]));
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]));
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]));
2395 return PyLong_AsSsize_t(b);
2397 x = PyNumber_Index(b);
2399 ival = PyInt_AsSsize_t(x);
2403 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(
size_t ival) {
2404 return PyInt_FromSize_t(ival);
double b(int nuc)
Computes the scattering length [cm] from the coherent and incoherent components.
std::string name(int nuc)
def memset(dest, src, size)
__PYX_EXTERN_C void CyclusEventLoopHook(void)
zz_group fp
fission product Z number group
PyMODINIT_FUNC initeventhooks(void)
static std::string digits
string of digit characters
bool operator==(const CapacityConstraint< T > &lhs, const CapacityConstraint< T > &rhs)
CapacityConstraint-CapacityConstraint equality operator.
enable_if< has_const_iterator< T >::value, typename T::const_iterator >::type end(const T &c)