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__pymodule 495 #define __PYX_HAVE_API__pymodule 514 #ifdef PYREX_WITHOUT_ASSERTIONS 515 #define CYTHON_WITHOUT_ASSERTIONS 518 typedef struct {PyObject **p;
const char *s;
const Py_ssize_t n;
const char* encoding;
519 const char is_unicode;
const char is_str;
const char intern; } __Pyx_StringTabEntry;
521 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 522 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0 523 #define __PYX_DEFAULT_STRING_ENCODING "" 524 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString 525 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize 526 #define __Pyx_uchar_cast(c) ((unsigned char)c) 527 #define __Pyx_long_cast(x) ((long)x) 528 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ 529 (sizeof(type) < sizeof(Py_ssize_t)) ||\ 530 (sizeof(type) > sizeof(Py_ssize_t) &&\ 531 likely(v < (type)PY_SSIZE_T_MAX ||\ 532 v == (type)PY_SSIZE_T_MAX) &&\ 533 (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ 534 v == (type)PY_SSIZE_T_MIN))) ||\ 535 (sizeof(type) == sizeof(Py_ssize_t) &&\ 536 (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ 537 v == (type)PY_SSIZE_T_MAX))) ) 538 #if defined (__cplusplus) && __cplusplus >= 201103L 540 #define __Pyx_sst_abs(value) std::abs(value) 541 #elif SIZEOF_INT >= SIZEOF_SIZE_T 542 #define __Pyx_sst_abs(value) abs(value) 543 #elif SIZEOF_LONG >= SIZEOF_SIZE_T 544 #define __Pyx_sst_abs(value) labs(value) 545 #elif defined (_MSC_VER) && defined (_M_X64) 546 #define __Pyx_sst_abs(value) _abs64(value) 547 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 548 #define __Pyx_sst_abs(value) llabs(value) 549 #elif defined (__GNUC__) 550 #define __Pyx_sst_abs(value) __builtin_llabs(value) 552 #define __Pyx_sst_abs(value) ((value<0) ? -value : value) 554 static CYTHON_INLINE
const char* __Pyx_PyObject_AsString(PyObject*);
555 static CYTHON_INLINE
const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
556 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s)) 557 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) 558 #define __Pyx_PyBytes_FromString PyBytes_FromString 559 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize 560 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(
const char*);
561 #if PY_MAJOR_VERSION < 3 562 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString 563 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize 565 #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString 566 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize 568 #define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s)) 569 #define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) 570 #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) 571 #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) 572 #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) 573 #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) 574 #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) 575 #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) 576 #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) 577 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) 578 #if PY_MAJOR_VERSION < 3 579 static CYTHON_INLINE
size_t __Pyx_Py_UNICODE_strlen(
const Py_UNICODE *u)
581 const Py_UNICODE *u_end = u;
583 return (
size_t)(u_end - u - 1);
586 #define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen 588 #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) 589 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode 590 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode 591 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) 592 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) 593 #define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False)) 594 static CYTHON_INLINE
int __Pyx_PyObject_IsTrue(PyObject*);
595 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
596 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
597 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(
size_t);
598 #if CYTHON_ASSUME_SAFE_MACROS 599 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) 601 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) 603 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) 604 #if PY_MAJOR_VERSION >= 3 605 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) 607 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) 609 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x)) 610 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 611 static int __Pyx_sys_getdefaultencoding_not_ascii;
612 static int __Pyx_init_sys_getdefaultencoding_params(
void) {
614 PyObject* default_encoding = NULL;
615 PyObject* ascii_chars_u = NULL;
616 PyObject* ascii_chars_b = NULL;
617 const char* default_encoding_c;
618 sys = PyImport_ImportModule(
"sys");
620 default_encoding = PyObject_CallMethod(sys, (
char*)
"getdefaultencoding", NULL);
622 if (!default_encoding)
goto bad;
623 default_encoding_c = PyBytes_AsString(default_encoding);
624 if (!default_encoding_c)
goto bad;
625 if (strcmp(default_encoding_c,
"ascii") == 0) {
626 __Pyx_sys_getdefaultencoding_not_ascii = 0;
628 char ascii_chars[128];
630 for (c = 0; c < 128; c++) {
633 __Pyx_sys_getdefaultencoding_not_ascii = 1;
634 ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
635 if (!ascii_chars_u)
goto bad;
636 ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
637 if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
640 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
644 Py_DECREF(ascii_chars_u);
645 Py_DECREF(ascii_chars_b);
647 Py_DECREF(default_encoding);
650 Py_XDECREF(default_encoding);
651 Py_XDECREF(ascii_chars_u);
652 Py_XDECREF(ascii_chars_b);
656 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 657 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) 659 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) 660 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 661 static char* __PYX_DEFAULT_STRING_ENCODING;
662 static int __Pyx_init_sys_getdefaultencoding_params(
void) {
664 PyObject* default_encoding = NULL;
665 char* default_encoding_c;
666 sys = PyImport_ImportModule(
"sys");
668 default_encoding = PyObject_CallMethod(sys, (
char*) (
const char*)
"getdefaultencoding", NULL);
670 if (!default_encoding)
goto bad;
671 default_encoding_c = PyBytes_AsString(default_encoding);
672 if (!default_encoding_c)
goto bad;
673 __PYX_DEFAULT_STRING_ENCODING = (
char*) malloc(strlen(default_encoding_c));
674 if (!__PYX_DEFAULT_STRING_ENCODING)
goto bad;
675 strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
676 Py_DECREF(default_encoding);
679 Py_XDECREF(default_encoding);
687 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) 688 #define likely(x) __builtin_expect(!!(x), 1) 689 #define unlikely(x) __builtin_expect(!!(x), 0) 691 #define likely(x) (x) 692 #define unlikely(x) (x) 694 static CYTHON_INLINE
void __Pyx_pretend_to_initialize(
void* ptr) { (void)ptr; }
696 static PyObject *__pyx_m;
697 static PyObject *__pyx_d;
698 static PyObject *__pyx_b;
699 static PyObject *__pyx_cython_runtime;
700 static PyObject *__pyx_empty_tuple;
701 static PyObject *__pyx_empty_bytes;
702 static PyObject *__pyx_empty_unicode;
703 static int __pyx_lineno;
704 static int __pyx_clineno = 0;
705 static const char * __pyx_cfilenm= __FILE__;
706 static const char *__pyx_filename;
709 static const char *__pyx_f[] = {
755 #ifndef CYTHON_REFNANNY 756 #define CYTHON_REFNANNY 0 760 void (*INCREF)(
void*, PyObject*, int);
761 void (*DECREF)(
void*, PyObject*, int);
762 void (*GOTREF)(
void*, PyObject*, int);
763 void (*GIVEREF)(
void*, PyObject*, int);
764 void* (*SetupContext)(
const char*, int,
const char*);
765 void (*FinishContext)(
void**);
766 } __Pyx_RefNannyAPIStruct;
767 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
768 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(
const char *modname);
769 #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; 771 #define __Pyx_RefNannySetupContext(name, acquire_gil)\ 773 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ 774 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ 775 PyGILState_Release(__pyx_gilstate_save);\ 777 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ 780 #define __Pyx_RefNannySetupContext(name, acquire_gil)\ 781 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) 783 #define __Pyx_RefNannyFinishContext()\ 784 __Pyx_RefNanny->FinishContext(&__pyx_refnanny) 785 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) 786 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) 787 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) 788 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) 789 #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) 790 #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) 791 #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) 792 #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) 794 #define __Pyx_RefNannyDeclarations 795 #define __Pyx_RefNannySetupContext(name, acquire_gil) 796 #define __Pyx_RefNannyFinishContext() 797 #define __Pyx_INCREF(r) Py_INCREF(r) 798 #define __Pyx_DECREF(r) Py_DECREF(r) 799 #define __Pyx_GOTREF(r) 800 #define __Pyx_GIVEREF(r) 801 #define __Pyx_XINCREF(r) Py_XINCREF(r) 802 #define __Pyx_XDECREF(r) Py_XDECREF(r) 803 #define __Pyx_XGOTREF(r) 804 #define __Pyx_XGIVEREF(r) 806 #define __Pyx_XDECREF_SET(r, v) do {\ 807 PyObject *tmp = (PyObject *) r;\ 808 r = v; __Pyx_XDECREF(tmp);\ 810 #define __Pyx_DECREF_SET(r, v) do {\ 811 PyObject *tmp = (PyObject *) r;\ 812 r = v; __Pyx_DECREF(tmp);\ 814 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) 815 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) 818 #if CYTHON_USE_TYPE_SLOTS 819 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
820 PyTypeObject* tp = Py_TYPE(obj);
821 if (likely(tp->tp_getattro))
822 return tp->tp_getattro(obj, attr_name);
823 #if PY_MAJOR_VERSION < 3 824 if (likely(tp->tp_getattr))
825 return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
827 return PyObject_GetAttr(obj, attr_name);
830 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) 834 static PyObject *__Pyx_GetBuiltinName(PyObject *
name);
837 #if CYTHON_FAST_PYCCALL 838 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
840 #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) 844 #if CYTHON_FAST_PYCALL 845 #define __Pyx_PyFunction_FastCall(func, args, nargs)\ 846 __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) 847 #if 1 || PY_VERSION_HEX < 0x030600B1 848 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args,
int nargs, PyObject *kwargs);
850 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) 855 #if CYTHON_COMPILING_IN_CPYTHON 856 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
858 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) 862 #if CYTHON_COMPILING_IN_CPYTHON 863 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
867 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
870 #if CYTHON_COMPILING_IN_CPYTHON 871 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
873 #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL) 877 #if CYTHON_FAST_THREAD_STATE 878 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; 879 #define __Pyx_PyThreadState_assign __pyx_tstate = PyThreadState_GET(); 881 #define __Pyx_PyThreadState_declare 882 #define __Pyx_PyThreadState_assign 886 #if CYTHON_FAST_THREAD_STATE 887 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) 888 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) 889 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) 890 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) 891 static CYTHON_INLINE
void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
892 static CYTHON_INLINE
void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
894 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) 895 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) 896 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) 897 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) 901 static void __Pyx_WriteUnraisable(
const char *
name,
int clineno,
902 int lineno,
const char *filename,
903 int full_traceback,
int nogil);
906 static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *
name);
909 #if CYTHON_FAST_THREAD_STATE 910 #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) 911 static CYTHON_INLINE
void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
912 #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb) 913 static CYTHON_INLINE
void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
915 #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb) 916 #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) 920 #if CYTHON_FAST_THREAD_STATE 921 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) 922 static CYTHON_INLINE
int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
924 #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) 928 #if CYTHON_FAST_THREAD_STATE 929 #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) 930 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
932 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
936 static CYTHON_INLINE
void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
939 static CYTHON_INLINE
void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
942 static CYTHON_INLINE
int __Pyx_IterFinish(
void);
945 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
951 static CYTHON_INLINE
int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2,
int equals);
954 static CYTHON_INLINE
int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2,
int equals);
957 static PyObject *__Pyx_Import(PyObject *
name, PyObject *from_list,
int level);
960 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject*
name);
963 static int __Pyx_CLineForTraceback(
int c_line);
967 PyCodeObject* code_object;
969 } __Pyx_CodeObjectCacheEntry;
970 struct __Pyx_CodeObjectCache {
973 __Pyx_CodeObjectCacheEntry* entries;
975 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
976 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries,
int count,
int code_line);
977 static PyCodeObject *__pyx_find_code_object(
int code_line);
978 static void __pyx_insert_code_object(
int code_line, PyCodeObject* code_object);
981 static void __Pyx_AddTraceback(
const char *funcname,
int c_line,
982 int py_line,
const char *filename);
985 #ifndef __Pyx_CppExn2PyErr 990 static void __Pyx_CppExn2PyErr() {
992 if (PyErr_Occurred())
996 }
catch (
const std::bad_alloc& exn) {
997 PyErr_SetString(PyExc_MemoryError, exn.what());
998 }
catch (
const std::bad_cast& exn) {
999 PyErr_SetString(PyExc_TypeError, exn.what());
1000 }
catch (
const std::bad_typeid& exn) {
1001 PyErr_SetString(PyExc_TypeError, exn.what());
1002 }
catch (
const std::domain_error& exn) {
1003 PyErr_SetString(PyExc_ValueError, exn.what());
1004 }
catch (
const std::invalid_argument& exn) {
1005 PyErr_SetString(PyExc_ValueError, exn.what());
1006 }
catch (
const std::ios_base::failure& exn) {
1007 PyErr_SetString(PyExc_IOError, exn.what());
1008 }
catch (
const std::out_of_range& exn) {
1009 PyErr_SetString(PyExc_IndexError, exn.what());
1010 }
catch (
const std::overflow_error& exn) {
1011 PyErr_SetString(PyExc_OverflowError, exn.what());
1012 }
catch (
const std::range_error& exn) {
1013 PyErr_SetString(PyExc_ArithmeticError, exn.what());
1014 }
catch (
const std::underflow_error& exn) {
1015 PyErr_SetString(PyExc_ArithmeticError, exn.what());
1016 }
catch (
const std::exception& exn) {
1017 PyErr_SetString(PyExc_RuntimeError, exn.what());
1021 PyErr_SetString(PyExc_RuntimeError,
"Unknown exception");
1027 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(
int value);
1030 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(
long value);
1033 static CYTHON_INLINE
long __Pyx_PyInt_As_long(PyObject *);
1036 static CYTHON_INLINE
int __Pyx_PyInt_As_int(PyObject *);
1039 static int __Pyx_check_binary_version(
void);
1042 static int __Pyx_ExportFunction(
const char *
name,
void (*f)(
void),
const char *sig);
1045 #if !defined(__Pyx_PyIdentifier_FromString) 1046 #if PY_MAJOR_VERSION < 3 1047 #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) 1049 #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) 1054 static PyObject *__Pyx_ImportModule(
const char *
name);
1057 static PyTypeObject *__Pyx_ImportType(
const char *module_name,
const char *class_name,
size_t size,
int strict);
1060 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1080 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
1089 static std::string __pyx_f_8pymodule_str_py_to_cpp(PyObject *);
1090 static PyObject *__pyx_f_8pymodule_std_string_to_py(
std::string);
1097 static CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_std__in_string(
std::string const &);
1098 static CYTHON_INLINE PyObject *__pyx_convert_PyUnicode_string_to_py_std__in_string(
std::string const &);
1099 static CYTHON_INLINE PyObject *__pyx_convert_PyStr_string_to_py_std__in_string(
std::string const &);
1100 static CYTHON_INLINE PyObject *__pyx_convert_PyBytes_string_to_py_std__in_string(
std::string const &);
1101 static CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_std__in_string(
std::string const &);
1102 #define __Pyx_MODULE_NAME "pymodule" 1103 int __pyx_module_is_main_pymodule = 0;
1106 static PyObject *__pyx_builtin_ImportError;
1107 static const char __pyx_k_[] =
"*";
1108 static const char __pyx_k_py[] =
"<py>";
1109 static const char __pyx_k_ts[] =
"ts";
1110 static const char __pyx_k_Inst[] =
"Inst";
1111 static const char __pyx_k_file[] =
"__file__";
1112 static const char __pyx_k_main[] =
"__main__";
1113 static const char __pyx_k_test[] =
"__test__";
1114 static const char __pyx_k_Region[] =
"Region";
1115 static const char __pyx_k_cyclib[] =
"cyclib";
1116 static const char __pyx_k_decode[] =
"decode";
1117 static const char __pyx_k_encode[] =
"encode";
1118 static const char __pyx_k_import[] =
"__import__";
1119 static const char __pyx_k_Facility[] =
"Facility";
1120 static const char __pyx_k_del_agent[] =
"_del_agent";
1121 static const char __pyx_k_importlib[] =
"importlib";
1122 static const char __pyx_k_cyclus_lib[] =
"cyclus.lib";
1123 static const char __pyx_k_ImportError[] =
"ImportError";
1124 static const char __pyx_k_import_module[] =
"import_module";
1125 static const char __pyx_k_make_py_agent[] =
"make_py_agent";
1126 static const char __pyx_k_call_listeners[] =
"call_listeners";
1127 static const char __pyx_k_init_from_agent[] =
"init_from_agent";
1128 static const char __pyx_k_clear_agent_refs[] =
"_clear_agent_refs";
1129 static const char __pyx_k_capsule_any_to_py[] =
"capsule_any_to_py";
1130 static const char __pyx_k_cyclus_typesystem[] =
"cyclus.typesystem";
1131 static const char __pyx_k_cline_in_traceback[] =
"cline_in_traceback";
1132 static const char __pyx_k_capsule_agent_to_py[] =
"capsule_agent_to_py";
1133 static const char __pyx_k_Cyclus_Python_module_loading_too[] =
"Cyclus Python module loading tools.";
1134 static PyObject *__pyx_n_s_;
1135 static PyObject *__pyx_n_u_Facility;
1136 static PyObject *__pyx_n_s_ImportError;
1137 static PyObject *__pyx_n_u_Inst;
1138 static PyObject *__pyx_n_u_Region;
1139 static PyObject *__pyx_n_s_call_listeners;
1140 static PyObject *__pyx_n_s_capsule_agent_to_py;
1141 static PyObject *__pyx_n_s_capsule_any_to_py;
1142 static PyObject *__pyx_n_s_clear_agent_refs;
1143 static PyObject *__pyx_n_s_cline_in_traceback;
1144 static PyObject *__pyx_n_s_cyclib;
1145 static PyObject *__pyx_n_s_cyclus_lib;
1146 static PyObject *__pyx_n_s_cyclus_typesystem;
1147 static PyObject *__pyx_n_s_decode;
1148 static PyObject *__pyx_n_s_del_agent;
1149 static PyObject *__pyx_n_s_encode;
1150 static PyObject *__pyx_n_s_file;
1151 static PyObject *__pyx_n_s_import;
1152 static PyObject *__pyx_n_s_import_module;
1153 static PyObject *__pyx_n_s_importlib;
1154 static PyObject *__pyx_n_s_init_from_agent;
1155 static PyObject *__pyx_n_s_main;
1156 static PyObject *__pyx_n_s_make_py_agent;
1157 static PyObject *__pyx_kp_u_py;
1158 static PyObject *__pyx_n_s_test;
1159 static PyObject *__pyx_n_s_ts;
1169 static PyObject *__pyx_f_8pymodule_std_string_to_py(
std::string __pyx_v_x) {
1170 PyObject *__pyx_v_pyx = NULL;
1171 PyObject *__pyx_r = NULL;
1172 __Pyx_RefNannyDeclarations
1173 PyObject *__pyx_t_1 = NULL;
1174 PyObject *__pyx_t_2 = NULL;
1175 PyObject *__pyx_t_3 = NULL;
1176 __Pyx_RefNannySetupContext(
"std_string_to_py", 0);
1185 __pyx_t_1 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_x);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error)
1186 __Pyx_GOTREF(__pyx_t_1);
1187 __pyx_v_pyx = __pyx_t_1;
1197 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_pyx, __pyx_n_s_decode);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error)
1198 __Pyx_GOTREF(__pyx_t_2);
1200 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
1201 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
1202 if (likely(__pyx_t_3)) {
1203 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_2);
1204 __Pyx_INCREF(__pyx_t_3);
1205 __Pyx_INCREF(
function);
1206 __Pyx_DECREF_SET(__pyx_t_2,
function);
1210 __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)
1211 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1213 __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)
1215 __Pyx_GOTREF(__pyx_t_1);
1216 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1217 __Pyx_DECREF_SET(__pyx_v_pyx, __pyx_t_1);
1227 __Pyx_XDECREF(__pyx_r);
1228 __Pyx_INCREF(__pyx_v_pyx);
1229 __pyx_r = __pyx_v_pyx;
1242 __Pyx_XDECREF(__pyx_t_1);
1243 __Pyx_XDECREF(__pyx_t_2);
1244 __Pyx_XDECREF(__pyx_t_3);
1245 __Pyx_AddTraceback(
"pymodule.std_string_to_py", __pyx_clineno, __pyx_lineno, __pyx_filename);
1248 __Pyx_XDECREF(__pyx_v_pyx);
1249 __Pyx_XGIVEREF(__pyx_r);
1250 __Pyx_RefNannyFinishContext();
1262 static std::string __pyx_f_8pymodule_str_py_to_cpp(PyObject *__pyx_v_x) {
1265 __Pyx_RefNannyDeclarations
1266 PyObject *__pyx_t_1 = NULL;
1267 PyObject *__pyx_t_2 = NULL;
1268 PyObject *__pyx_t_3 = NULL;
1269 char const *__pyx_t_4;
1271 __Pyx_RefNannySetupContext(
"str_py_to_cpp", 0);
1272 __Pyx_INCREF(__pyx_v_x);
1281 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_x, __pyx_n_s_encode);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 21, __pyx_L1_error)
1282 __Pyx_GOTREF(__pyx_t_2);
1284 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
1285 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
1286 if (likely(__pyx_t_3)) {
1287 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_2);
1288 __Pyx_INCREF(__pyx_t_3);
1289 __Pyx_INCREF(
function);
1290 __Pyx_DECREF_SET(__pyx_t_2,
function);
1294 __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 21, __pyx_L1_error)
1295 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1297 __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 21, __pyx_L1_error)
1299 __Pyx_GOTREF(__pyx_t_1);
1300 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1301 __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
1311 __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_v_x);
if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 22, __pyx_L1_error)
1313 __pyx_t_5 =
std::string(((
char const *)__pyx_t_4));
1315 __Pyx_CppExn2PyErr();
1316 __PYX_ERR(0, 22, __pyx_L1_error)
1318 __pyx_v_s = __pyx_t_5;
1327 __pyx_r = __pyx_v_s;
1340 __Pyx_XDECREF(__pyx_t_1);
1341 __Pyx_XDECREF(__pyx_t_2);
1342 __Pyx_XDECREF(__pyx_t_3);
1343 __Pyx_WriteUnraisable(
"pymodule.str_py_to_cpp", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
1344 __Pyx_pretend_to_initialize(&__pyx_r);
1346 __Pyx_XDECREF(__pyx_v_x);
1347 __Pyx_RefNannyFinishContext();
1360 PyObject *__pyx_v_lib = NULL;
1361 PyObject *__pyx_v_mod = NULL;
1364 __Pyx_RefNannyDeclarations
1365 PyObject *__pyx_t_1 = NULL;
1366 PyObject *__pyx_t_2 = NULL;
1367 PyObject *__pyx_t_3 = NULL;
1368 PyObject *__pyx_t_4 = NULL;
1369 PyObject *__pyx_t_5 = NULL;
1370 PyObject *__pyx_t_6 = NULL;
1371 PyObject *__pyx_t_7 = NULL;
1374 __Pyx_RefNannySetupContext(
"py_find_module", 0);
1383 __pyx_t_1 = __pyx_f_8pymodule_std_string_to_py(__pyx_v_cpp_lib);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 28, __pyx_L1_error)
1384 __Pyx_GOTREF(__pyx_t_1);
1385 __pyx_v_lib = __pyx_t_1;
1396 __Pyx_PyThreadState_declare
1397 __Pyx_PyThreadState_assign
1398 __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
1399 __Pyx_XGOTREF(__pyx_t_2);
1400 __Pyx_XGOTREF(__pyx_t_3);
1401 __Pyx_XGOTREF(__pyx_t_4);
1411 __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_import_module);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 30, __pyx_L3_error)
1412 __Pyx_GOTREF(__pyx_t_5);
1414 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
1415 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
1416 if (likely(__pyx_t_6)) {
1417 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_5);
1418 __Pyx_INCREF(__pyx_t_6);
1419 __Pyx_INCREF(
function);
1420 __Pyx_DECREF_SET(__pyx_t_5,
function);
1424 __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_lib);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 30, __pyx_L3_error)
1425 __Pyx_GOTREF(__pyx_t_1);
1427 #if CYTHON_FAST_PYCALL 1428 if (PyFunction_Check(__pyx_t_5)) {
1429 PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_lib};
1430 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 30, __pyx_L3_error)
1431 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
1432 __Pyx_GOTREF(__pyx_t_1);
1435 #if CYTHON_FAST_PYCCALL 1436 if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
1437 PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_lib};
1438 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 30, __pyx_L3_error)
1439 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
1440 __Pyx_GOTREF(__pyx_t_1);
1444 __pyx_t_7 = PyTuple_New(1+1);
if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 30, __pyx_L3_error)
1445 __Pyx_GOTREF(__pyx_t_7);
1446 __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
1447 __Pyx_INCREF(__pyx_v_lib);
1448 __Pyx_GIVEREF(__pyx_v_lib);
1449 PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_lib);
1450 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 30, __pyx_L3_error)
1451 __Pyx_GOTREF(__pyx_t_1);
1452 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
1455 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
1456 __pyx_v_mod = __pyx_t_1;
1467 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
1468 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
1469 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
1470 goto __pyx_L8_try_end;
1472 __Pyx_PyThreadState_assign
1473 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
1474 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
1475 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
1476 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
1485 __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ImportError);
1487 __Pyx_AddTraceback(
"pymodule.py_find_module", __pyx_clineno, __pyx_lineno, __pyx_filename);
1488 if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_5, &__pyx_t_7) < 0) __PYX_ERR(0, 31, __pyx_L5_except_error)
1489 __Pyx_GOTREF(__pyx_t_1);
1490 __Pyx_GOTREF(__pyx_t_5);
1491 __Pyx_GOTREF(__pyx_t_7);
1503 __Pyx_CppExn2PyErr();
1504 __PYX_ERR(0, 32, __pyx_L5_except_error)
1506 __pyx_r = __pyx_t_9;
1507 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1508 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
1509 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
1510 goto __pyx_L6_except_return;
1512 goto __pyx_L5_except_error;
1513 __pyx_L5_except_error:;
1522 __Pyx_PyThreadState_assign
1523 __Pyx_XGIVEREF(__pyx_t_2);
1524 __Pyx_XGIVEREF(__pyx_t_3);
1525 __Pyx_XGIVEREF(__pyx_t_4);
1526 __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
1527 goto __pyx_L1_error;
1528 __pyx_L6_except_return:;
1529 __Pyx_PyThreadState_assign
1530 __Pyx_XGIVEREF(__pyx_t_2);
1531 __Pyx_XGIVEREF(__pyx_t_3);
1532 __Pyx_XGIVEREF(__pyx_t_4);
1533 __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
1545 __pyx_t_8 = PyErr_CheckSignals();
if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(0, 33, __pyx_L1_error)
1554 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_mod, __pyx_n_s_file);
if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 34, __pyx_L1_error)
1555 __Pyx_GOTREF(__pyx_t_7);
1556 __pyx_t_5 = PyNumber_Add(__pyx_kp_u_py, __pyx_t_7);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 34, __pyx_L1_error)
1557 __Pyx_GOTREF(__pyx_t_5);
1558 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
1559 __pyx_v_rtn = __pyx_f_8pymodule_str_py_to_cpp(__pyx_t_5);
1560 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
1569 __pyx_r = __pyx_v_rtn;
1582 __Pyx_XDECREF(__pyx_t_1);
1583 __Pyx_XDECREF(__pyx_t_5);
1584 __Pyx_XDECREF(__pyx_t_6);
1585 __Pyx_XDECREF(__pyx_t_7);
1586 __Pyx_AddTraceback(
"pymodule.py_find_module", __pyx_clineno, __pyx_lineno, __pyx_filename);
1587 __Pyx_pretend_to_initialize(&__pyx_r);
1589 __Pyx_XDECREF(__pyx_v_lib);
1590 __Pyx_XDECREF(__pyx_v_mod);
1591 __Pyx_RefNannyFinishContext();
1604 PyObject *__pyx_v_libname = NULL;
1605 PyObject *__pyx_v_agentname = NULL;
1606 PyObject *__pyx_v_ctx = NULL;
1607 PyObject *__pyx_v_a = NULL;
1608 PyObject *__pyx_v_kind = NULL;
1609 void *__pyx_v_avoid;
1612 __Pyx_RefNannyDeclarations
1613 PyObject *__pyx_t_1 = NULL;
1614 PyObject *__pyx_t_2 = NULL;
1615 PyObject *__pyx_t_3 = NULL;
1617 PyObject *__pyx_t_5 = NULL;
1618 PyObject *(*__pyx_t_6)(PyObject *);
1621 __pyx_t_8pymodule_agent_ptr __pyx_t_9;
1622 __Pyx_RefNannySetupContext(
"make_py_agent", 0);
1631 __pyx_t_1 = __pyx_f_8pymodule_std_string_to_py(__pyx_v_cpp_lib);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error)
1632 __Pyx_GOTREF(__pyx_t_1);
1633 __pyx_v_libname = __pyx_t_1;
1643 __pyx_t_1 = __pyx_f_8pymodule_std_string_to_py(__pyx_v_cpp_agent);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 43, __pyx_L1_error)
1644 __Pyx_GOTREF(__pyx_t_1);
1645 __pyx_v_agentname = __pyx_t_1;
1655 __pyx_t_1 = PyCapsule_New(__pyx_v_cpp_ctx, ((
char *)((
char *)
"ctx")), NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error)
1656 __Pyx_GOTREF(__pyx_t_1);
1657 __pyx_v_ctx = __pyx_t_1;
1667 __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_cyclib);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error)
1668 __Pyx_GOTREF(__pyx_t_2);
1669 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_make_py_agent);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 45, __pyx_L1_error)
1670 __Pyx_GOTREF(__pyx_t_3);
1671 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1674 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
1675 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
1676 if (likely(__pyx_t_2)) {
1677 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_3);
1678 __Pyx_INCREF(__pyx_t_2);
1679 __Pyx_INCREF(
function);
1680 __Pyx_DECREF_SET(__pyx_t_3,
function);
1684 #if CYTHON_FAST_PYCALL 1685 if (PyFunction_Check(__pyx_t_3)) {
1686 PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_v_libname, __pyx_v_agentname, __pyx_v_ctx};
1687 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error)
1688 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
1689 __Pyx_GOTREF(__pyx_t_1);
1692 #if CYTHON_FAST_PYCCALL 1693 if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
1694 PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_v_libname, __pyx_v_agentname, __pyx_v_ctx};
1695 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error)
1696 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
1697 __Pyx_GOTREF(__pyx_t_1);
1701 __pyx_t_5 = PyTuple_New(3+__pyx_t_4);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 45, __pyx_L1_error)
1702 __Pyx_GOTREF(__pyx_t_5);
1704 __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL;
1706 __Pyx_INCREF(__pyx_v_libname);
1707 __Pyx_GIVEREF(__pyx_v_libname);
1708 PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_libname);
1709 __Pyx_INCREF(__pyx_v_agentname);
1710 __Pyx_GIVEREF(__pyx_v_agentname);
1711 PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_agentname);
1712 __Pyx_INCREF(__pyx_v_ctx);
1713 __Pyx_GIVEREF(__pyx_v_ctx);
1714 PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_ctx);
1715 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error)
1716 __Pyx_GOTREF(__pyx_t_1);
1717 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
1719 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1720 if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
1721 PyObject* sequence = __pyx_t_1;
1722 #if !CYTHON_COMPILING_IN_PYPY 1723 Py_ssize_t size = Py_SIZE(sequence);
1725 Py_ssize_t size = PySequence_Size(sequence);
1727 if (unlikely(size != 2)) {
1728 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
1729 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
1730 __PYX_ERR(0, 45, __pyx_L1_error)
1732 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS 1733 if (likely(PyTuple_CheckExact(sequence))) {
1734 __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
1735 __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
1737 __pyx_t_3 = PyList_GET_ITEM(sequence, 0);
1738 __pyx_t_5 = PyList_GET_ITEM(sequence, 1);
1740 __Pyx_INCREF(__pyx_t_3);
1741 __Pyx_INCREF(__pyx_t_5);
1743 __pyx_t_3 = PySequence_ITEM(sequence, 0);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 45, __pyx_L1_error)
1744 __Pyx_GOTREF(__pyx_t_3);
1745 __pyx_t_5 = PySequence_ITEM(sequence, 1);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 45, __pyx_L1_error)
1746 __Pyx_GOTREF(__pyx_t_5);
1748 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1750 Py_ssize_t index = -1;
1751 __pyx_t_2 = PyObject_GetIter(__pyx_t_1);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error)
1752 __Pyx_GOTREF(__pyx_t_2);
1753 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1754 __pyx_t_6 = Py_TYPE(__pyx_t_2)->tp_iternext;
1755 index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_2);
if (unlikely(!__pyx_t_3))
goto __pyx_L3_unpacking_failed;
1756 __Pyx_GOTREF(__pyx_t_3);
1757 index = 1; __pyx_t_5 = __pyx_t_6(__pyx_t_2);
if (unlikely(!__pyx_t_5))
goto __pyx_L3_unpacking_failed;
1758 __Pyx_GOTREF(__pyx_t_5);
1759 if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_2), 2) < 0) __PYX_ERR(0, 45, __pyx_L1_error)
1761 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1762 goto __pyx_L4_unpacking_done;
1763 __pyx_L3_unpacking_failed:;
1764 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1766 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
1767 __PYX_ERR(0, 45, __pyx_L1_error)
1768 __pyx_L4_unpacking_done:;
1770 __pyx_v_a = __pyx_t_3;
1772 __pyx_v_kind = __pyx_t_5;
1782 __pyx_t_7 = PyCapsule_GetPointer(__pyx_v_a, ((
char *)((
char *)
"agent")));
if (unlikely(__pyx_t_7 == NULL && PyErr_Occurred())) __PYX_ERR(0, 46, __pyx_L1_error)
1783 __pyx_v_avoid = __pyx_t_7;
1792 __pyx_t_8 = (__Pyx_PyUnicode_Equals(__pyx_v_kind, __pyx_n_u_Region, Py_EQ));
if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 48, __pyx_L1_error)
1803 __pyx_t_9 =
dynamic_cast<__pyx_t_8pymodule_agent_ptr
>(
reinterpret_cast<__pyx_t_8pymodule_region_ptr
>(__pyx_v_avoid));
1805 __Pyx_CppExn2PyErr();
1806 __PYX_ERR(0, 49, __pyx_L1_error)
1808 __pyx_v_rtn = __pyx_t_9;
1827 __pyx_t_8 = (__Pyx_PyUnicode_Equals(__pyx_v_kind, __pyx_n_u_Inst, Py_EQ));
if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 50, __pyx_L1_error)
1838 __pyx_t_9 =
dynamic_cast<__pyx_t_8pymodule_agent_ptr
>(
reinterpret_cast<__pyx_t_8pymodule_institution_ptr
>(__pyx_v_avoid));
1840 __Pyx_CppExn2PyErr();
1841 __PYX_ERR(0, 51, __pyx_L1_error)
1843 __pyx_v_rtn = __pyx_t_9;
1862 __pyx_t_8 = (__Pyx_PyUnicode_Equals(__pyx_v_kind, __pyx_n_u_Facility, Py_EQ));
if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 52, __pyx_L1_error)
1873 __pyx_t_9 =
dynamic_cast<__pyx_t_8pymodule_agent_ptr
>(
reinterpret_cast<__pyx_t_8pymodule_facility_ptr
>(__pyx_v_avoid));
1875 __Pyx_CppExn2PyErr();
1876 __PYX_ERR(0, 53, __pyx_L1_error)
1878 __pyx_v_rtn = __pyx_t_9;
1899 __pyx_t_9 =
dynamic_cast<__pyx_t_8pymodule_agent_ptr
>(
reinterpret_cast<__pyx_t_8pymodule_agent_ptr
>(__pyx_v_avoid));
1901 __Pyx_CppExn2PyErr();
1902 __PYX_ERR(0, 55, __pyx_L1_error)
1904 __pyx_v_rtn = __pyx_t_9;
1915 __pyx_t_4 = PyErr_CheckSignals();
if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(0, 56, __pyx_L1_error)
1924 __pyx_r = __pyx_v_rtn;
1937 __Pyx_XDECREF(__pyx_t_1);
1938 __Pyx_XDECREF(__pyx_t_2);
1939 __Pyx_XDECREF(__pyx_t_3);
1940 __Pyx_XDECREF(__pyx_t_5);
1941 __Pyx_AddTraceback(
"pymodule.make_py_agent", __pyx_clineno, __pyx_lineno, __pyx_filename);
1944 __Pyx_XDECREF(__pyx_v_libname);
1945 __Pyx_XDECREF(__pyx_v_agentname);
1946 __Pyx_XDECREF(__pyx_v_ctx);
1947 __Pyx_XDECREF(__pyx_v_a);
1948 __Pyx_XDECREF(__pyx_v_kind);
1949 __Pyx_RefNannyFinishContext();
1962 PyObject *__pyx_v_ctx = NULL;
1963 PyObject *__pyx_v_src = NULL;
1964 PyObject *__pyx_v_dst = NULL;
1965 PyObject *__pyx_v_py_src = NULL;
1966 PyObject *__pyx_v_py_dst = NULL;
1967 __Pyx_RefNannyDeclarations
1968 PyObject *__pyx_t_1 = NULL;
1969 PyObject *__pyx_t_2 = NULL;
1970 PyObject *__pyx_t_3 = NULL;
1972 PyObject *__pyx_t_5 = NULL;
1973 __Pyx_RefNannySetupContext(
"init_from_py_agent", 0);
1982 __pyx_t_1 = PyCapsule_New(__pyx_v_cpp_ctx, ((
char *)((
char *)
"ctx")), NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 66, __pyx_L1_error)
1983 __Pyx_GOTREF(__pyx_t_1);
1984 __pyx_v_ctx = __pyx_t_1;
1994 __pyx_t_1 = PyCapsule_New(__pyx_v_cpp_src, ((
char *)((
char *)
"agent")), NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error)
1995 __Pyx_GOTREF(__pyx_t_1);
1996 __pyx_v_src = __pyx_t_1;
2006 __pyx_t_1 = PyCapsule_New(__pyx_v_cpp_dst, ((
char *)((
char *)
"agent")), NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error)
2007 __Pyx_GOTREF(__pyx_t_1);
2008 __pyx_v_dst = __pyx_t_1;
2018 __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_cyclib);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __pyx_L1_error)
2019 __Pyx_GOTREF(__pyx_t_2);
2020 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_capsule_agent_to_py);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 69, __pyx_L1_error)
2021 __Pyx_GOTREF(__pyx_t_3);
2022 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2025 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
2026 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
2027 if (likely(__pyx_t_2)) {
2028 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_3);
2029 __Pyx_INCREF(__pyx_t_2);
2030 __Pyx_INCREF(
function);
2031 __Pyx_DECREF_SET(__pyx_t_3,
function);
2035 #if CYTHON_FAST_PYCALL 2036 if (PyFunction_Check(__pyx_t_3)) {
2037 PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_src, __pyx_v_ctx};
2038 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error)
2039 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
2040 __Pyx_GOTREF(__pyx_t_1);
2043 #if CYTHON_FAST_PYCCALL 2044 if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
2045 PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_src, __pyx_v_ctx};
2046 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error)
2047 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
2048 __Pyx_GOTREF(__pyx_t_1);
2052 __pyx_t_5 = PyTuple_New(2+__pyx_t_4);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 69, __pyx_L1_error)
2053 __Pyx_GOTREF(__pyx_t_5);
2055 __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL;
2057 __Pyx_INCREF(__pyx_v_src);
2058 __Pyx_GIVEREF(__pyx_v_src);
2059 PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_src);
2060 __Pyx_INCREF(__pyx_v_ctx);
2061 __Pyx_GIVEREF(__pyx_v_ctx);
2062 PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_ctx);
2063 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error)
2064 __Pyx_GOTREF(__pyx_t_1);
2065 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2067 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2068 __pyx_v_py_src = __pyx_t_1;
2078 __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_cyclib);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 70, __pyx_L1_error)
2079 __Pyx_GOTREF(__pyx_t_3);
2080 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_capsule_agent_to_py);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 70, __pyx_L1_error)
2081 __Pyx_GOTREF(__pyx_t_5);
2082 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2085 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
2086 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
2087 if (likely(__pyx_t_3)) {
2088 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_5);
2089 __Pyx_INCREF(__pyx_t_3);
2090 __Pyx_INCREF(
function);
2091 __Pyx_DECREF_SET(__pyx_t_5,
function);
2095 #if CYTHON_FAST_PYCALL 2096 if (PyFunction_Check(__pyx_t_5)) {
2097 PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_dst, __pyx_v_ctx};
2098 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error)
2099 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
2100 __Pyx_GOTREF(__pyx_t_1);
2103 #if CYTHON_FAST_PYCCALL 2104 if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
2105 PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_dst, __pyx_v_ctx};
2106 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error)
2107 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
2108 __Pyx_GOTREF(__pyx_t_1);
2112 __pyx_t_2 = PyTuple_New(2+__pyx_t_4);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 70, __pyx_L1_error)
2113 __Pyx_GOTREF(__pyx_t_2);
2115 __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = NULL;
2117 __Pyx_INCREF(__pyx_v_dst);
2118 __Pyx_GIVEREF(__pyx_v_dst);
2119 PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_4, __pyx_v_dst);
2120 __Pyx_INCREF(__pyx_v_ctx);
2121 __Pyx_GIVEREF(__pyx_v_ctx);
2122 PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_4, __pyx_v_ctx);
2123 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_2, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error)
2124 __Pyx_GOTREF(__pyx_t_1);
2125 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2127 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2128 __pyx_v_py_dst = __pyx_t_1;
2138 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_py_dst, __pyx_n_s_init_from_agent);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 71, __pyx_L1_error)
2139 __Pyx_GOTREF(__pyx_t_5);
2141 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
2142 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
2143 if (likely(__pyx_t_2)) {
2144 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_5);
2145 __Pyx_INCREF(__pyx_t_2);
2146 __Pyx_INCREF(
function);
2147 __Pyx_DECREF_SET(__pyx_t_5,
function);
2151 __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_py_src);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 71, __pyx_L1_error)
2152 __Pyx_GOTREF(__pyx_t_1);
2154 #if CYTHON_FAST_PYCALL 2155 if (PyFunction_Check(__pyx_t_5)) {
2156 PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_py_src};
2157 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 71, __pyx_L1_error)
2158 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
2159 __Pyx_GOTREF(__pyx_t_1);
2162 #if CYTHON_FAST_PYCCALL 2163 if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
2164 PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_py_src};
2165 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 71, __pyx_L1_error)
2166 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
2167 __Pyx_GOTREF(__pyx_t_1);
2171 __pyx_t_3 = PyTuple_New(1+1);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 71, __pyx_L1_error)
2172 __Pyx_GOTREF(__pyx_t_3);
2173 __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __pyx_t_2 = NULL;
2174 __Pyx_INCREF(__pyx_v_py_src);
2175 __Pyx_GIVEREF(__pyx_v_py_src);
2176 PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_py_src);
2177 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 71, __pyx_L1_error)
2178 __Pyx_GOTREF(__pyx_t_1);
2179 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2182 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2183 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2192 __pyx_t_4 = PyErr_CheckSignals();
if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(0, 72, __pyx_L1_error)
2205 __Pyx_XDECREF(__pyx_t_1);
2206 __Pyx_XDECREF(__pyx_t_2);
2207 __Pyx_XDECREF(__pyx_t_3);
2208 __Pyx_XDECREF(__pyx_t_5);
2209 __Pyx_AddTraceback(
"pymodule.init_from_py_agent", __pyx_clineno, __pyx_lineno, __pyx_filename);
2211 __Pyx_XDECREF(__pyx_v_ctx);
2212 __Pyx_XDECREF(__pyx_v_src);
2213 __Pyx_XDECREF(__pyx_v_dst);
2214 __Pyx_XDECREF(__pyx_v_py_src);
2215 __Pyx_XDECREF(__pyx_v_py_dst);
2216 __Pyx_RefNannyFinishContext();
2228 __Pyx_RefNannyDeclarations
2229 PyObject *__pyx_t_1 = NULL;
2230 PyObject *__pyx_t_2 = NULL;
2231 PyObject *__pyx_t_3 = NULL;
2233 __Pyx_RefNannySetupContext(
"clear_pyagent_refs", 0);
2242 __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_cyclib);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 77, __pyx_L1_error)
2243 __Pyx_GOTREF(__pyx_t_2);
2244 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_clear_agent_refs);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 77, __pyx_L1_error)
2245 __Pyx_GOTREF(__pyx_t_3);
2246 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2248 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
2249 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
2250 if (likely(__pyx_t_2)) {
2251 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_3);
2252 __Pyx_INCREF(__pyx_t_2);
2253 __Pyx_INCREF(
function);
2254 __Pyx_DECREF_SET(__pyx_t_3,
function);
2258 __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 77, __pyx_L1_error)
2259 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2261 __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 77, __pyx_L1_error)
2263 __Pyx_GOTREF(__pyx_t_1);
2264 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2265 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2274 __pyx_t_4 = PyErr_CheckSignals();
if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(0, 78, __pyx_L1_error)
2287 __Pyx_XDECREF(__pyx_t_1);
2288 __Pyx_XDECREF(__pyx_t_2);
2289 __Pyx_XDECREF(__pyx_t_3);
2290 __Pyx_AddTraceback(
"pymodule.clear_pyagent_refs", __pyx_clineno, __pyx_lineno, __pyx_filename);
2292 __Pyx_RefNannyFinishContext();
2304 __Pyx_RefNannyDeclarations
2305 PyObject *__pyx_t_1 = NULL;
2306 PyObject *__pyx_t_2 = NULL;
2307 PyObject *__pyx_t_3 = NULL;
2308 PyObject *__pyx_t_4 = NULL;
2309 PyObject *__pyx_t_5 = NULL;
2311 __Pyx_RefNannySetupContext(
"py_del_agent", 0);
2320 __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_cyclib);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __pyx_L1_error)
2321 __Pyx_GOTREF(__pyx_t_2);
2322 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_del_agent);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 83, __pyx_L1_error)
2323 __Pyx_GOTREF(__pyx_t_3);
2324 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2325 __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_i);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __pyx_L1_error)
2326 __Pyx_GOTREF(__pyx_t_2);
2328 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
2329 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
2330 if (likely(__pyx_t_4)) {
2331 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_3);
2332 __Pyx_INCREF(__pyx_t_4);
2333 __Pyx_INCREF(
function);
2334 __Pyx_DECREF_SET(__pyx_t_3,
function);
2338 __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L1_error)
2339 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2340 __Pyx_GOTREF(__pyx_t_1);
2342 #if CYTHON_FAST_PYCALL 2343 if (PyFunction_Check(__pyx_t_3)) {
2344 PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_2};
2345 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L1_error)
2346 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
2347 __Pyx_GOTREF(__pyx_t_1);
2348 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2351 #if CYTHON_FAST_PYCCALL 2352 if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
2353 PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_2};
2354 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L1_error)
2355 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
2356 __Pyx_GOTREF(__pyx_t_1);
2357 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2361 __pyx_t_5 = PyTuple_New(1+1);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 83, __pyx_L1_error)
2362 __Pyx_GOTREF(__pyx_t_5);
2363 __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
2364 __Pyx_GIVEREF(__pyx_t_2);
2365 PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_2);
2367 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L1_error)
2368 __Pyx_GOTREF(__pyx_t_1);
2369 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2372 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2373 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2382 __pyx_t_6 = PyErr_CheckSignals();
if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(0, 84, __pyx_L1_error)
2395 __Pyx_XDECREF(__pyx_t_1);
2396 __Pyx_XDECREF(__pyx_t_2);
2397 __Pyx_XDECREF(__pyx_t_3);
2398 __Pyx_XDECREF(__pyx_t_4);
2399 __Pyx_XDECREF(__pyx_t_5);
2400 __Pyx_AddTraceback(
"pymodule.py_del_agent", __pyx_clineno, __pyx_lineno, __pyx_filename);
2402 __Pyx_RefNannyFinishContext();
2414 PyObject *__pyx_v_ctx = NULL;
2415 PyObject *__pyx_v_agent = NULL;
2416 PyObject *__pyx_v_value = NULL;
2417 PyObject *__pyx_v_py_tsname = NULL;
2418 PyObject *__pyx_v_py_agent = NULL;
2419 PyObject *__pyx_v_py_value = NULL;
2420 __Pyx_RefNannyDeclarations
2421 PyObject *__pyx_t_1 = NULL;
2422 PyObject *__pyx_t_2 = NULL;
2423 PyObject *__pyx_t_3 = NULL;
2425 PyObject *__pyx_t_5 = NULL;
2426 PyObject *__pyx_t_6 = NULL;
2427 __Pyx_RefNannySetupContext(
"py_call_listeners", 0);
2436 __pyx_t_1 = PyCapsule_New(__pyx_v_cpp_ctx, ((
char *)((
char *)
"ctx")), NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error)
2437 __Pyx_GOTREF(__pyx_t_1);
2438 __pyx_v_ctx = __pyx_t_1;
2448 __pyx_t_1 = PyCapsule_New(__pyx_v_cpp_agent, ((
char *)((
char *)
"agent")), NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 92, __pyx_L1_error)
2449 __Pyx_GOTREF(__pyx_t_1);
2450 __pyx_v_agent = __pyx_t_1;
2460 __pyx_t_1 = PyCapsule_New((&__pyx_v_cpp_value), ((
char *)((
char *)
"value")), NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 93, __pyx_L1_error)
2461 __Pyx_GOTREF(__pyx_t_1);
2462 __pyx_v_value = __pyx_t_1;
2472 __pyx_t_1 = __pyx_f_8pymodule_std_string_to_py(__pyx_v_cpp_tsname);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 94, __pyx_L1_error)
2473 __Pyx_GOTREF(__pyx_t_1);
2474 __pyx_v_py_tsname = __pyx_t_1;
2484 __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_cyclib);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 95, __pyx_L1_error)
2485 __Pyx_GOTREF(__pyx_t_2);
2486 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_capsule_agent_to_py);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 95, __pyx_L1_error)
2487 __Pyx_GOTREF(__pyx_t_3);
2488 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2491 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
2492 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
2493 if (likely(__pyx_t_2)) {
2494 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_3);
2495 __Pyx_INCREF(__pyx_t_2);
2496 __Pyx_INCREF(
function);
2497 __Pyx_DECREF_SET(__pyx_t_3,
function);
2501 #if CYTHON_FAST_PYCALL 2502 if (PyFunction_Check(__pyx_t_3)) {
2503 PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_agent, __pyx_v_ctx};
2504 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 95, __pyx_L1_error)
2505 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
2506 __Pyx_GOTREF(__pyx_t_1);
2509 #if CYTHON_FAST_PYCCALL 2510 if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
2511 PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_agent, __pyx_v_ctx};
2512 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 95, __pyx_L1_error)
2513 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
2514 __Pyx_GOTREF(__pyx_t_1);
2518 __pyx_t_5 = PyTuple_New(2+__pyx_t_4);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 95, __pyx_L1_error)
2519 __Pyx_GOTREF(__pyx_t_5);
2521 __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL;
2523 __Pyx_INCREF(__pyx_v_agent);
2524 __Pyx_GIVEREF(__pyx_v_agent);
2525 PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_agent);
2526 __Pyx_INCREF(__pyx_v_ctx);
2527 __Pyx_GIVEREF(__pyx_v_ctx);
2528 PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_ctx);
2529 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 95, __pyx_L1_error)
2530 __Pyx_GOTREF(__pyx_t_1);
2531 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2533 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2534 __pyx_v_py_agent = __pyx_t_1;
2544 __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_ts);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 96, __pyx_L1_error)
2545 __Pyx_GOTREF(__pyx_t_3);
2546 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_capsule_any_to_py);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 96, __pyx_L1_error)
2547 __Pyx_GOTREF(__pyx_t_5);
2548 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2550 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
2551 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
2552 if (likely(__pyx_t_3)) {
2553 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_5);
2554 __Pyx_INCREF(__pyx_t_3);
2555 __Pyx_INCREF(
function);
2556 __Pyx_DECREF_SET(__pyx_t_5,
function);
2560 __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_value);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error)
2561 __Pyx_GOTREF(__pyx_t_1);
2563 #if CYTHON_FAST_PYCALL 2564 if (PyFunction_Check(__pyx_t_5)) {
2565 PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_value};
2566 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error)
2567 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
2568 __Pyx_GOTREF(__pyx_t_1);
2571 #if CYTHON_FAST_PYCCALL 2572 if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
2573 PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_value};
2574 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error)
2575 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
2576 __Pyx_GOTREF(__pyx_t_1);
2580 __pyx_t_2 = PyTuple_New(1+1);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 96, __pyx_L1_error)
2581 __Pyx_GOTREF(__pyx_t_2);
2582 __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = NULL;
2583 __Pyx_INCREF(__pyx_v_value);
2584 __Pyx_GIVEREF(__pyx_v_value);
2585 PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_value);
2586 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_2, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error)
2587 __Pyx_GOTREF(__pyx_t_1);
2588 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2591 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2592 __pyx_v_py_value = __pyx_t_1;
2601 __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_cyclib);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 97, __pyx_L1_error)
2602 __Pyx_GOTREF(__pyx_t_5);
2603 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_call_listeners);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 97, __pyx_L1_error)
2604 __Pyx_GOTREF(__pyx_t_2);
2605 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2606 __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_time);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 97, __pyx_L1_error)
2607 __Pyx_GOTREF(__pyx_t_5);
2610 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
2611 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
2612 if (likely(__pyx_t_3)) {
2613 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_2);
2614 __Pyx_INCREF(__pyx_t_3);
2615 __Pyx_INCREF(
function);
2616 __Pyx_DECREF_SET(__pyx_t_2,
function);
2620 #if CYTHON_FAST_PYCALL 2621 if (PyFunction_Check(__pyx_t_2)) {
2622 PyObject *__pyx_temp[5] = {__pyx_t_3, __pyx_v_py_tsname, __pyx_v_py_agent, __pyx_t_5, __pyx_v_py_value};
2623 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error)
2624 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
2625 __Pyx_GOTREF(__pyx_t_1);
2626 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2629 #if CYTHON_FAST_PYCCALL 2630 if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
2631 PyObject *__pyx_temp[5] = {__pyx_t_3, __pyx_v_py_tsname, __pyx_v_py_agent, __pyx_t_5, __pyx_v_py_value};
2632 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error)
2633 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
2634 __Pyx_GOTREF(__pyx_t_1);
2635 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2639 __pyx_t_6 = PyTuple_New(4+__pyx_t_4);
if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 97, __pyx_L1_error)
2640 __Pyx_GOTREF(__pyx_t_6);
2642 __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __pyx_t_3 = NULL;
2644 __Pyx_INCREF(__pyx_v_py_tsname);
2645 __Pyx_GIVEREF(__pyx_v_py_tsname);
2646 PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_4, __pyx_v_py_tsname);
2647 __Pyx_INCREF(__pyx_v_py_agent);
2648 __Pyx_GIVEREF(__pyx_v_py_agent);
2649 PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_4, __pyx_v_py_agent);
2650 __Pyx_GIVEREF(__pyx_t_5);
2651 PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_4, __pyx_t_5);
2652 __Pyx_INCREF(__pyx_v_py_value);
2653 __Pyx_GIVEREF(__pyx_v_py_value);
2654 PyTuple_SET_ITEM(__pyx_t_6, 3+__pyx_t_4, __pyx_v_py_value);
2656 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error)
2657 __Pyx_GOTREF(__pyx_t_1);
2658 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2660 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2661 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2668 __pyx_t_4 = PyErr_CheckSignals();
if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(0, 98, __pyx_L1_error)
2681 __Pyx_XDECREF(__pyx_t_1);
2682 __Pyx_XDECREF(__pyx_t_2);
2683 __Pyx_XDECREF(__pyx_t_3);
2684 __Pyx_XDECREF(__pyx_t_5);
2685 __Pyx_XDECREF(__pyx_t_6);
2686 __Pyx_AddTraceback(
"pymodule.py_call_listeners", __pyx_clineno, __pyx_lineno, __pyx_filename);
2688 __Pyx_XDECREF(__pyx_v_ctx);
2689 __Pyx_XDECREF(__pyx_v_agent);
2690 __Pyx_XDECREF(__pyx_v_value);
2691 __Pyx_XDECREF(__pyx_v_py_tsname);
2692 __Pyx_XDECREF(__pyx_v_py_agent);
2693 __Pyx_XDECREF(__pyx_v_py_value);
2694 __Pyx_RefNannyFinishContext();
2705 static CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_std__in_string(
std::string const &__pyx_v_s) {
2706 PyObject *__pyx_r = NULL;
2707 __Pyx_RefNannyDeclarations
2708 PyObject *__pyx_t_1 = NULL;
2709 __Pyx_RefNannySetupContext(
"__pyx_convert_PyObject_string_to_py_std__in_string", 0);
2718 __Pyx_XDECREF(__pyx_r);
2719 __pyx_t_1 = __Pyx_PyObject_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size());
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 32, __pyx_L1_error)
2720 __Pyx_GOTREF(__pyx_t_1);
2721 __pyx_r = __pyx_t_1;
2735 __Pyx_XDECREF(__pyx_t_1);
2736 __Pyx_AddTraceback(
"string.to_py.__pyx_convert_PyObject_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
2739 __Pyx_XGIVEREF(__pyx_r);
2740 __Pyx_RefNannyFinishContext();
2752 static CYTHON_INLINE PyObject *__pyx_convert_PyUnicode_string_to_py_std__in_string(
std::string const &__pyx_v_s) {
2753 PyObject *__pyx_r = NULL;
2754 __Pyx_RefNannyDeclarations
2755 PyObject *__pyx_t_1 = NULL;
2756 __Pyx_RefNannySetupContext(
"__pyx_convert_PyUnicode_string_to_py_std__in_string", 0);
2765 __Pyx_XDECREF(__pyx_r);
2766 __pyx_t_1 = __Pyx_PyUnicode_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size());
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 38, __pyx_L1_error)
2767 __Pyx_GOTREF(__pyx_t_1);
2768 __pyx_r = __pyx_t_1;
2782 __Pyx_XDECREF(__pyx_t_1);
2783 __Pyx_AddTraceback(
"string.to_py.__pyx_convert_PyUnicode_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
2786 __Pyx_XGIVEREF(__pyx_r);
2787 __Pyx_RefNannyFinishContext();
2799 static CYTHON_INLINE PyObject *__pyx_convert_PyStr_string_to_py_std__in_string(
std::string const &__pyx_v_s) {
2800 PyObject *__pyx_r = NULL;
2801 __Pyx_RefNannyDeclarations
2802 PyObject *__pyx_t_1 = NULL;
2803 __Pyx_RefNannySetupContext(
"__pyx_convert_PyStr_string_to_py_std__in_string", 0);
2812 __Pyx_XDECREF(__pyx_r);
2813 __pyx_t_1 = __Pyx_PyStr_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size());
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 44, __pyx_L1_error)
2814 __Pyx_GOTREF(__pyx_t_1);
2815 __pyx_r = __pyx_t_1;
2829 __Pyx_XDECREF(__pyx_t_1);
2830 __Pyx_AddTraceback(
"string.to_py.__pyx_convert_PyStr_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
2833 __Pyx_XGIVEREF(__pyx_r);
2834 __Pyx_RefNannyFinishContext();
2846 static CYTHON_INLINE PyObject *__pyx_convert_PyBytes_string_to_py_std__in_string(
std::string const &__pyx_v_s) {
2847 PyObject *__pyx_r = NULL;
2848 __Pyx_RefNannyDeclarations
2849 PyObject *__pyx_t_1 = NULL;
2850 __Pyx_RefNannySetupContext(
"__pyx_convert_PyBytes_string_to_py_std__in_string", 0);
2859 __Pyx_XDECREF(__pyx_r);
2860 __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size());
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 50, __pyx_L1_error)
2861 __Pyx_GOTREF(__pyx_t_1);
2862 __pyx_r = __pyx_t_1;
2876 __Pyx_XDECREF(__pyx_t_1);
2877 __Pyx_AddTraceback(
"string.to_py.__pyx_convert_PyBytes_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
2880 __Pyx_XGIVEREF(__pyx_r);
2881 __Pyx_RefNannyFinishContext();
2893 static CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_std__in_string(
std::string const &__pyx_v_s) {
2894 PyObject *__pyx_r = NULL;
2895 __Pyx_RefNannyDeclarations
2896 PyObject *__pyx_t_1 = NULL;
2897 __Pyx_RefNannySetupContext(
"__pyx_convert_PyByteArray_string_to_py_std__in_string", 0);
2905 __Pyx_XDECREF(__pyx_r);
2906 __pyx_t_1 = __Pyx_PyByteArray_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size());
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 56, __pyx_L1_error)
2907 __Pyx_GOTREF(__pyx_t_1);
2908 __pyx_r = __pyx_t_1;
2922 __Pyx_XDECREF(__pyx_t_1);
2923 __Pyx_AddTraceback(
"string.to_py.__pyx_convert_PyByteArray_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
2926 __Pyx_XGIVEREF(__pyx_r);
2927 __Pyx_RefNannyFinishContext();
2931 static PyMethodDef __pyx_methods[] = {
2935 #if PY_MAJOR_VERSION >= 3 2936 static struct PyModuleDef __pyx_moduledef = {
2937 #if PY_VERSION_HEX < 0x03020000 2938 { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
2940 PyModuleDef_HEAD_INIT,
2943 __pyx_k_Cyclus_Python_module_loading_too,
2953 static __Pyx_StringTabEntry __pyx_string_tab[] = {
2954 {&__pyx_n_s_, __pyx_k_,
sizeof(__pyx_k_), 0, 0, 1, 1},
2955 {&__pyx_n_u_Facility, __pyx_k_Facility,
sizeof(__pyx_k_Facility), 0, 1, 0, 1},
2956 {&__pyx_n_s_ImportError, __pyx_k_ImportError,
sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
2957 {&__pyx_n_u_Inst, __pyx_k_Inst,
sizeof(__pyx_k_Inst), 0, 1, 0, 1},
2958 {&__pyx_n_u_Region, __pyx_k_Region,
sizeof(__pyx_k_Region), 0, 1, 0, 1},
2959 {&__pyx_n_s_call_listeners, __pyx_k_call_listeners,
sizeof(__pyx_k_call_listeners), 0, 0, 1, 1},
2960 {&__pyx_n_s_capsule_agent_to_py, __pyx_k_capsule_agent_to_py,
sizeof(__pyx_k_capsule_agent_to_py), 0, 0, 1, 1},
2961 {&__pyx_n_s_capsule_any_to_py, __pyx_k_capsule_any_to_py,
sizeof(__pyx_k_capsule_any_to_py), 0, 0, 1, 1},
2962 {&__pyx_n_s_clear_agent_refs, __pyx_k_clear_agent_refs,
sizeof(__pyx_k_clear_agent_refs), 0, 0, 1, 1},
2963 {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback,
sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
2964 {&__pyx_n_s_cyclib, __pyx_k_cyclib,
sizeof(__pyx_k_cyclib), 0, 0, 1, 1},
2965 {&__pyx_n_s_cyclus_lib, __pyx_k_cyclus_lib,
sizeof(__pyx_k_cyclus_lib), 0, 0, 1, 1},
2966 {&__pyx_n_s_cyclus_typesystem, __pyx_k_cyclus_typesystem,
sizeof(__pyx_k_cyclus_typesystem), 0, 0, 1, 1},
2967 {&__pyx_n_s_decode, __pyx_k_decode,
sizeof(__pyx_k_decode), 0, 0, 1, 1},
2968 {&__pyx_n_s_del_agent, __pyx_k_del_agent,
sizeof(__pyx_k_del_agent), 0, 0, 1, 1},
2969 {&__pyx_n_s_encode, __pyx_k_encode,
sizeof(__pyx_k_encode), 0, 0, 1, 1},
2970 {&__pyx_n_s_file, __pyx_k_file,
sizeof(__pyx_k_file), 0, 0, 1, 1},
2971 {&__pyx_n_s_import, __pyx_k_import,
sizeof(__pyx_k_import), 0, 0, 1, 1},
2972 {&__pyx_n_s_import_module, __pyx_k_import_module,
sizeof(__pyx_k_import_module), 0, 0, 1, 1},
2973 {&__pyx_n_s_importlib, __pyx_k_importlib,
sizeof(__pyx_k_importlib), 0, 0, 1, 1},
2974 {&__pyx_n_s_init_from_agent, __pyx_k_init_from_agent,
sizeof(__pyx_k_init_from_agent), 0, 0, 1, 1},
2975 {&__pyx_n_s_main, __pyx_k_main,
sizeof(__pyx_k_main), 0, 0, 1, 1},
2976 {&__pyx_n_s_make_py_agent, __pyx_k_make_py_agent,
sizeof(__pyx_k_make_py_agent), 0, 0, 1, 1},
2977 {&__pyx_kp_u_py, __pyx_k_py,
sizeof(__pyx_k_py), 0, 1, 0, 0},
2978 {&__pyx_n_s_test, __pyx_k_test,
sizeof(__pyx_k_test), 0, 0, 1, 1},
2979 {&__pyx_n_s_ts, __pyx_k_ts,
sizeof(__pyx_k_ts), 0, 0, 1, 1},
2980 {0, 0, 0, 0, 0, 0, 0}
2982 static int __Pyx_InitCachedBuiltins(
void) {
2983 __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError);
if (!__pyx_builtin_ImportError) __PYX_ERR(0, 31, __pyx_L1_error)
2989 static int __Pyx_InitCachedConstants(
void) {
2990 __Pyx_RefNannyDeclarations
2991 __Pyx_RefNannySetupContext(
"__Pyx_InitCachedConstants", 0);
2992 __Pyx_RefNannyFinishContext();
2996 static int __Pyx_InitGlobals(
void) {
2997 if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
3003 #if PY_MAJOR_VERSION < 3 3007 PyMODINIT_FUNC PyInit_pymodule(
void);
3008 PyMODINIT_FUNC PyInit_pymodule(
void)
3011 PyObject *__pyx_t_1 = NULL;
3012 PyObject *__pyx_t_2 = NULL;
3013 __Pyx_RefNannyDeclarations
3015 __Pyx_RefNanny = __Pyx_RefNannyImportAPI(
"refnanny");
3016 if (!__Pyx_RefNanny) {
3018 __Pyx_RefNanny = __Pyx_RefNannyImportAPI(
"Cython.Runtime.refnanny");
3019 if (!__Pyx_RefNanny)
3020 Py_FatalError(
"failed to import 'refnanny' module");
3023 __Pyx_RefNannySetupContext(
"PyMODINIT_FUNC PyInit_pymodule(void)", 0);
3024 if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3025 __pyx_empty_tuple = PyTuple_New(0);
if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
3026 __pyx_empty_bytes = PyBytes_FromStringAndSize(
"", 0);
if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
3027 __pyx_empty_unicode = PyUnicode_FromStringAndSize(
"", 0);
if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
3028 #ifdef __Pyx_CyFunction_USED 3029 if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3031 #ifdef __Pyx_FusedFunction_USED 3032 if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3034 #ifdef __Pyx_Coroutine_USED 3035 if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3037 #ifdef __Pyx_Generator_USED 3038 if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3040 #ifdef __Pyx_StopAsyncIteration_USED 3041 if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3045 #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS 3047 PyEval_InitThreads();
3051 #if PY_MAJOR_VERSION < 3 3052 __pyx_m = Py_InitModule4(
"pymodule", __pyx_methods, __pyx_k_Cyclus_Python_module_loading_too, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
3054 __pyx_m = PyModule_Create(&__pyx_moduledef);
3056 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
3057 __pyx_d = PyModule_GetDict(__pyx_m);
if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
3059 __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME);
if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
3060 __pyx_cython_runtime = PyImport_AddModule((
char *)
"cython_runtime");
if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
3061 #if CYTHON_COMPILING_IN_PYPY 3064 if (PyObject_SetAttrString(__pyx_m,
"__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
3066 if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3067 #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) 3068 if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3070 if (__pyx_module_is_main_pymodule) {
3071 if (PyObject_SetAttrString(__pyx_m,
"__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3073 #if PY_MAJOR_VERSION >= 3 3075 PyObject *modules = PyImport_GetModuleDict();
if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
3076 if (!PyDict_GetItemString(modules,
"pymodule")) {
3077 if (unlikely(PyDict_SetItemString(modules,
"pymodule", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
3082 if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3084 if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3088 if (__Pyx_ExportFunction(
"str_py_to_cpp", (
void (*)(
void))__pyx_f_8pymodule_str_py_to_cpp,
"std::string (PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3089 if (__Pyx_ExportFunction(
"std_string_to_py", (
void (*)(
void))__pyx_f_8pymodule_std_string_to_py,
"PyObject *(std::string)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3090 if (__Pyx_ExportFunction(
"py_find_module", (
void (*)(
void))
CyclusPyFindModule,
"std::string (std::string)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3091 if (__Pyx_ExportFunction(
"make_py_agent", (
void (*)(
void))
CyclusMakePyAgent,
"cyclus::Agent *(std::string, std::string, void *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3092 if (__Pyx_ExportFunction(
"init_from_py_agent", (
void (*)(
void))
CyclusInitFromPyAgent,
"void (cyclus::Agent *, cyclus::Agent *, void *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3093 if (__Pyx_ExportFunction(
"clear_pyagent_refs", (
void (*)(
void))
CyclusClearPyAgentRefs,
"void (void)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3094 if (__Pyx_ExportFunction(
"py_del_agent", (
void (*)(
void))
CyclusPyDelAgent,
"void (int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3095 if (__Pyx_ExportFunction(
"py_call_listeners", (
void (*)(
void))
CyclusPyCallListeners,
"void (std::string, cyclus::Agent *, void *, int, boost::spirit::hold_any)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3098 __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME,
"type",
3099 #
if CYTHON_COMPILING_IN_PYPY
3100 sizeof(PyTypeObject),
3102 sizeof(PyHeapTypeObject),
3104 0);
if (unlikely(!__pyx_ptype_7cpython_4type_type)) __PYX_ERR(2, 9, __pyx_L1_error)
3108 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) 3109 if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3119 __pyx_t_1 = PyList_New(1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error)
3120 __Pyx_GOTREF(__pyx_t_1);
3121 __Pyx_INCREF(__pyx_n_s_import_module);
3122 __Pyx_GIVEREF(__pyx_n_s_import_module);
3123 PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_import_module);
3124 __pyx_t_2 = __Pyx_Import(__pyx_n_s_importlib, __pyx_t_1, 0);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 8, __pyx_L1_error)
3125 __Pyx_GOTREF(__pyx_t_2);
3126 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3127 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_import_module);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error)
3128 __Pyx_GOTREF(__pyx_t_1);
3129 if (PyDict_SetItem(__pyx_d, __pyx_n_s_import_module, __pyx_t_1) < 0) __PYX_ERR(0, 8, __pyx_L1_error)
3130 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3131 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3140 __pyx_t_2 = PyList_New(1);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 10, __pyx_L1_error)
3141 __Pyx_GOTREF(__pyx_t_2);
3142 __Pyx_INCREF(__pyx_n_s_);
3143 __Pyx_GIVEREF(__pyx_n_s_);
3144 PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_);
3145 __pyx_t_1 = __Pyx_Import(__pyx_n_s_cyclus_lib, __pyx_t_2, 0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 10, __pyx_L1_error)
3146 __Pyx_GOTREF(__pyx_t_1);
3147 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3148 if (PyDict_SetItem(__pyx_d, __pyx_n_s_cyclib, __pyx_t_1) < 0) __PYX_ERR(0, 10, __pyx_L1_error)
3149 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3158 __pyx_t_1 = PyList_New(1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error)
3159 __Pyx_GOTREF(__pyx_t_1);
3160 __Pyx_INCREF(__pyx_n_s_);
3161 __Pyx_GIVEREF(__pyx_n_s_);
3162 PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_);
3163 __pyx_t_2 = __Pyx_Import(__pyx_n_s_cyclus_typesystem, __pyx_t_1, 0);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 11, __pyx_L1_error)
3164 __Pyx_GOTREF(__pyx_t_2);
3165 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3166 if (PyDict_SetItem(__pyx_d, __pyx_n_s_ts, __pyx_t_2) < 0) __PYX_ERR(0, 11, __pyx_L1_error)
3167 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3174 __pyx_t_2 = PyDict_New();
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error)
3175 __Pyx_GOTREF(__pyx_t_2);
3176 if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3177 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3191 __Pyx_XDECREF(__pyx_t_1);
3192 __Pyx_XDECREF(__pyx_t_2);
3195 __Pyx_AddTraceback(
"init pymodule", 0, __pyx_lineno, __pyx_filename);
3197 Py_DECREF(__pyx_m); __pyx_m = 0;
3198 }
else if (!PyErr_Occurred()) {
3199 PyErr_SetString(PyExc_ImportError,
"init pymodule");
3202 __Pyx_RefNannyFinishContext();
3203 #if PY_MAJOR_VERSION < 3 3213 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(
const char *modname) {
3214 PyObject *m = NULL, *p = NULL;
3216 m = PyImport_ImportModule((
char *)modname);
3218 p = PyObject_GetAttrString(m, (
char *)
"RefNannyAPI");
3220 r = PyLong_AsVoidPtr(p);
3224 return (__Pyx_RefNannyAPIStruct *)r;
3229 static PyObject *__Pyx_GetBuiltinName(PyObject *
name) {
3230 PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
3231 if (unlikely(!result)) {
3232 PyErr_Format(PyExc_NameError,
3233 #
if PY_MAJOR_VERSION >= 3
3234 "name '%U' is not defined", name);
3236 "name '%.200s' is not defined", PyString_AS_STRING(name));
3243 #if CYTHON_FAST_PYCCALL 3244 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
3245 PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
3246 PyCFunction meth = PyCFunction_GET_FUNCTION(func);
3247 PyObject *
self = PyCFunction_GET_SELF(func);
3248 int flags = PyCFunction_GET_FLAGS(func);
3249 assert(PyCFunction_Check(func));
3250 assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS)));
3252 assert(nargs == 0 || args != NULL);
3256 assert(!PyErr_Occurred());
3257 if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
3258 return (*((__Pyx_PyCFunctionFastWithKeywords)meth)) (
self, args, nargs, NULL);
3260 return (*((__Pyx_PyCFunctionFast)meth)) (
self, args, nargs);
3266 #if CYTHON_FAST_PYCALL 3267 #include "frameobject.h" 3268 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
3269 PyObject *globals) {
3271 PyThreadState *tstate = PyThreadState_GET();
3272 PyObject **fastlocals;
3275 assert(globals != NULL);
3280 assert(tstate != NULL);
3281 f = PyFrame_New(tstate, co, globals, NULL);
3285 fastlocals = f->f_localsplus;
3286 for (i = 0; i < na; i++) {
3288 fastlocals[i] = *args++;
3290 result = PyEval_EvalFrameEx(f,0);
3291 ++tstate->recursion_depth;
3293 --tstate->recursion_depth;
3296 #if 1 || PY_VERSION_HEX < 0x030600B1 3297 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args,
int nargs, PyObject *kwargs) {
3298 PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
3299 PyObject *globals = PyFunction_GET_GLOBALS(func);
3300 PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
3302 #if PY_MAJOR_VERSION >= 3 3305 PyObject *kwtuple, **k;
3310 assert(kwargs == NULL || PyDict_Check(kwargs));
3311 nk = kwargs ? PyDict_Size(kwargs) : 0;
3312 if (Py_EnterRecursiveCall((
char*)
" while calling a Python object")) {
3316 #
if PY_MAJOR_VERSION >= 3
3317 co->co_kwonlyargcount == 0 &&
3319 likely(kwargs == NULL || nk == 0) &&
3320 co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
3321 if (argdefs == NULL && co->co_argcount == nargs) {
3322 result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
3325 else if (nargs == 0 && argdefs != NULL
3326 && co->co_argcount == Py_SIZE(argdefs)) {
3329 args = &PyTuple_GET_ITEM(argdefs, 0);
3330 result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
3334 if (kwargs != NULL) {
3336 kwtuple = PyTuple_New(2 * nk);
3337 if (kwtuple == NULL) {
3341 k = &PyTuple_GET_ITEM(kwtuple, 0);
3343 while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
3354 closure = PyFunction_GET_CLOSURE(func);
3355 #if PY_MAJOR_VERSION >= 3 3356 kwdefs = PyFunction_GET_KW_DEFAULTS(func);
3358 if (argdefs != NULL) {
3359 d = &PyTuple_GET_ITEM(argdefs, 0);
3360 nd = Py_SIZE(argdefs);
3366 #if PY_MAJOR_VERSION >= 3 3367 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
3370 d, (
int)nd, kwdefs, closure);
3372 result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
3375 d, (
int)nd, closure);
3377 Py_XDECREF(kwtuple);
3379 Py_LeaveRecursiveCall();
3386 #if CYTHON_COMPILING_IN_CPYTHON 3387 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
3389 ternaryfunc call = func->ob_type->tp_call;
3390 if (unlikely(!call))
3391 return PyObject_Call(func, arg, kw);
3392 if (unlikely(Py_EnterRecursiveCall((
char*)
" while calling a Python object")))
3394 result = (*call)(func, arg, kw);
3395 Py_LeaveRecursiveCall();
3396 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
3399 "NULL result without error in PyObject_Call");
3406 #if CYTHON_COMPILING_IN_CPYTHON 3407 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
3408 PyObject *
self, *result;
3410 cfunc = PyCFunction_GET_FUNCTION(func);
3411 self = PyCFunction_GET_SELF(func);
3412 if (unlikely(Py_EnterRecursiveCall((
char*)
" while calling a Python object")))
3414 result = cfunc(
self, arg);
3415 Py_LeaveRecursiveCall();
3416 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
3419 "NULL result without error in PyObject_Call");
3426 #if CYTHON_COMPILING_IN_CPYTHON 3427 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
3429 PyObject *args = PyTuple_New(1);
3430 if (unlikely(!args))
return NULL;
3432 PyTuple_SET_ITEM(args, 0, arg);
3433 result = __Pyx_PyObject_Call(func, args, NULL);
3437 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
3438 #if CYTHON_FAST_PYCALL 3439 if (PyFunction_Check(func)) {
3440 return __Pyx_PyFunction_FastCall(func, &arg, 1);
3443 if (likely(PyCFunction_Check(func))) {
3444 if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
3445 return __Pyx_PyObject_CallMethO(func, arg);
3446 #if CYTHON_FAST_PYCCALL 3447 }
else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
3448 return __Pyx_PyCFunction_FastCall(func, &arg, 1);
3452 return __Pyx__PyObject_CallOneArg(func, arg);
3455 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
3457 PyObject *args = PyTuple_Pack(1, arg);
3458 if (unlikely(!args))
return NULL;
3459 result = __Pyx_PyObject_Call(func, args, NULL);
3466 #if CYTHON_COMPILING_IN_CPYTHON 3467 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
3468 #if CYTHON_FAST_PYCALL 3469 if (PyFunction_Check(func)) {
3470 return __Pyx_PyFunction_FastCall(func, NULL, 0);
3473 #ifdef __Pyx_CyFunction_USED 3474 if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
3476 if (likely(PyCFunction_Check(func))) {
3478 if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
3479 return __Pyx_PyObject_CallMethO(func, NULL);
3482 return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
3487 #if CYTHON_FAST_THREAD_STATE 3488 static CYTHON_INLINE
void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
3489 PyObject *tmp_type, *tmp_value, *tmp_tb;
3490 tmp_type = tstate->curexc_type;
3491 tmp_value = tstate->curexc_value;
3492 tmp_tb = tstate->curexc_traceback;
3493 tstate->curexc_type = type;
3494 tstate->curexc_value = value;
3495 tstate->curexc_traceback = tb;
3496 Py_XDECREF(tmp_type);
3497 Py_XDECREF(tmp_value);
3500 static CYTHON_INLINE
void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
3501 *type = tstate->curexc_type;
3502 *value = tstate->curexc_value;
3503 *tb = tstate->curexc_traceback;
3504 tstate->curexc_type = 0;
3505 tstate->curexc_value = 0;
3506 tstate->curexc_traceback = 0;
3511 static void __Pyx_WriteUnraisable(
const char *
name, CYTHON_UNUSED
int clineno,
3512 CYTHON_UNUSED
int lineno, CYTHON_UNUSED
const char *filename,
3513 int full_traceback, CYTHON_UNUSED
int nogil) {
3514 PyObject *old_exc, *old_val, *old_tb;
3516 __Pyx_PyThreadState_declare
3518 PyGILState_STATE state;
3520 state = PyGILState_Ensure();
3522 else state = (PyGILState_STATE)-1;
3525 __Pyx_PyThreadState_assign
3526 __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
3527 if (full_traceback) {
3528 Py_XINCREF(old_exc);
3529 Py_XINCREF(old_val);
3531 __Pyx_ErrRestore(old_exc, old_val, old_tb);
3534 #if PY_MAJOR_VERSION < 3 3535 ctx = PyString_FromString(name);
3537 ctx = PyUnicode_FromString(name);
3539 __Pyx_ErrRestore(old_exc, old_val, old_tb);
3541 PyErr_WriteUnraisable(Py_None);
3543 PyErr_WriteUnraisable(ctx);
3548 PyGILState_Release(state);
3553 static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
3555 #if !CYTHON_AVOID_BORROWED_REFS 3556 result = PyDict_GetItem(__pyx_d, name);
3557 if (likely(result)) {
3561 result = PyObject_GetItem(__pyx_d, name);
3565 result = __Pyx_GetBuiltinName(name);
3571 #if CYTHON_FAST_THREAD_STATE 3572 static CYTHON_INLINE
void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
3573 *type = tstate->exc_type;
3574 *value = tstate->exc_value;
3575 *tb = tstate->exc_traceback;
3580 static CYTHON_INLINE
void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
3581 PyObject *tmp_type, *tmp_value, *tmp_tb;
3582 tmp_type = tstate->exc_type;
3583 tmp_value = tstate->exc_value;
3584 tmp_tb = tstate->exc_traceback;
3585 tstate->exc_type = type;
3586 tstate->exc_value = value;
3587 tstate->exc_traceback = tb;
3588 Py_XDECREF(tmp_type);
3589 Py_XDECREF(tmp_value);
3595 #if CYTHON_FAST_THREAD_STATE 3596 static CYTHON_INLINE
int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
3597 PyObject *exc_type = tstate->curexc_type;
3598 if (exc_type == err)
return 1;
3599 if (unlikely(!exc_type))
return 0;
3600 return PyErr_GivenExceptionMatches(exc_type, err);
3605 #if CYTHON_FAST_THREAD_STATE 3606 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
3608 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
3610 PyObject *local_type, *local_value, *local_tb;
3611 #if CYTHON_FAST_THREAD_STATE 3612 PyObject *tmp_type, *tmp_value, *tmp_tb;
3613 local_type = tstate->curexc_type;
3614 local_value = tstate->curexc_value;
3615 local_tb = tstate->curexc_traceback;
3616 tstate->curexc_type = 0;
3617 tstate->curexc_value = 0;
3618 tstate->curexc_traceback = 0;
3620 PyErr_Fetch(&local_type, &local_value, &local_tb);
3622 PyErr_NormalizeException(&local_type, &local_value, &local_tb);
3623 #if CYTHON_FAST_THREAD_STATE 3624 if (unlikely(tstate->curexc_type))
3626 if (unlikely(PyErr_Occurred()))
3629 #if PY_MAJOR_VERSION >= 3 3631 if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
3635 Py_XINCREF(local_tb);
3636 Py_XINCREF(local_type);
3637 Py_XINCREF(local_value);
3639 *value = local_value;
3641 #if CYTHON_FAST_THREAD_STATE 3642 tmp_type = tstate->exc_type;
3643 tmp_value = tstate->exc_value;
3644 tmp_tb = tstate->exc_traceback;
3645 tstate->exc_type = local_type;
3646 tstate->exc_value = local_value;
3647 tstate->exc_traceback = local_tb;
3648 Py_XDECREF(tmp_type);
3649 Py_XDECREF(tmp_value);
3652 PyErr_SetExcInfo(local_type, local_value, local_tb);
3659 Py_XDECREF(local_type);
3660 Py_XDECREF(local_value);
3661 Py_XDECREF(local_tb);
3666 static CYTHON_INLINE
void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
3667 PyErr_Format(PyExc_ValueError,
3668 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T
"d)", expected);
3672 static CYTHON_INLINE
void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
3673 PyErr_Format(PyExc_ValueError,
3674 "need more than %" CYTHON_FORMAT_SSIZE_T
"d value%.1s to unpack",
3675 index, (index == 1) ?
"" :
"s");
3679 static CYTHON_INLINE
int __Pyx_IterFinish(
void) {
3680 #if CYTHON_FAST_THREAD_STATE 3681 PyThreadState *tstate = PyThreadState_GET();
3682 PyObject* exc_type = tstate->curexc_type;
3683 if (unlikely(exc_type)) {
3684 if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) {
3685 PyObject *exc_value, *exc_tb;
3686 exc_value = tstate->curexc_value;
3687 exc_tb = tstate->curexc_traceback;
3688 tstate->curexc_type = 0;
3689 tstate->curexc_value = 0;
3690 tstate->curexc_traceback = 0;
3691 Py_DECREF(exc_type);
3692 Py_XDECREF(exc_value);
3701 if (unlikely(PyErr_Occurred())) {
3702 if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
3714 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
3715 if (unlikely(retval)) {
3717 __Pyx_RaiseTooManyValuesError(expected);
3720 return __Pyx_IterFinish();
3726 static CYTHON_INLINE
int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2,
int equals) {
3727 #if CYTHON_COMPILING_IN_PYPY 3728 return PyObject_RichCompareBool(s1, s2, equals);
3731 return (equals == Py_EQ);
3732 }
else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
3733 const char *ps1, *ps2;
3734 Py_ssize_t length = PyBytes_GET_SIZE(s1);
3735 if (length != PyBytes_GET_SIZE(s2))
3736 return (equals == Py_NE);
3737 ps1 = PyBytes_AS_STRING(s1);
3738 ps2 = PyBytes_AS_STRING(s2);
3739 if (ps1[0] != ps2[0]) {
3740 return (equals == Py_NE);
3741 }
else if (length == 1) {
3742 return (equals == Py_EQ);
3745 #if CYTHON_USE_UNICODE_INTERNALS 3746 Py_hash_t hash1, hash2;
3747 hash1 = ((PyBytesObject*)s1)->ob_shash;
3748 hash2 = ((PyBytesObject*)s2)->ob_shash;
3749 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
3750 return (equals == Py_NE);
3753 result = memcmp(ps1, ps2, (
size_t)length);
3754 return (equals == Py_EQ) ? (result == 0) : (result != 0);
3756 }
else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
3757 return (equals == Py_NE);
3758 }
else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
3759 return (equals == Py_NE);
3762 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
3765 result = __Pyx_PyObject_IsTrue(py_result);
3766 Py_DECREF(py_result);
3773 static CYTHON_INLINE
int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2,
int equals) {
3774 #if CYTHON_COMPILING_IN_PYPY 3775 return PyObject_RichCompareBool(s1, s2, equals);
3777 #if PY_MAJOR_VERSION < 3 3778 PyObject* owned_ref = NULL;
3780 int s1_is_unicode, s2_is_unicode;
3784 s1_is_unicode = PyUnicode_CheckExact(s1);
3785 s2_is_unicode = PyUnicode_CheckExact(s2);
3786 #if PY_MAJOR_VERSION < 3 3787 if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
3788 owned_ref = PyUnicode_FromObject(s2);
3789 if (unlikely(!owned_ref))
3793 }
else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
3794 owned_ref = PyUnicode_FromObject(s1);
3795 if (unlikely(!owned_ref))
3799 }
else if (((!s2_is_unicode) & (!s1_is_unicode))) {
3800 return __Pyx_PyBytes_Equals(s1, s2, equals);
3803 if (s1_is_unicode & s2_is_unicode) {
3806 void *data1, *data2;
3807 if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
3809 length = __Pyx_PyUnicode_GET_LENGTH(s1);
3810 if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
3813 #if CYTHON_USE_UNICODE_INTERNALS 3815 Py_hash_t hash1, hash2;
3816 #if CYTHON_PEP393_ENABLED 3817 hash1 = ((PyASCIIObject*)s1)->hash;
3818 hash2 = ((PyASCIIObject*)s2)->hash;
3820 hash1 = ((PyUnicodeObject*)s1)->hash;
3821 hash2 = ((PyUnicodeObject*)s2)->hash;
3823 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
3828 kind = __Pyx_PyUnicode_KIND(s1);
3829 if (kind != __Pyx_PyUnicode_KIND(s2)) {
3832 data1 = __Pyx_PyUnicode_DATA(s1);
3833 data2 = __Pyx_PyUnicode_DATA(s2);
3834 if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
3836 }
else if (length == 1) {
3839 int result = memcmp(data1, data2, (
size_t)(length * kind));
3840 #if PY_MAJOR_VERSION < 3 3841 Py_XDECREF(owned_ref);
3843 return (equals == Py_EQ) ? (result == 0) : (result != 0);
3845 }
else if ((s1 == Py_None) & s2_is_unicode) {
3847 }
else if ((s2 == Py_None) & s1_is_unicode) {
3851 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
3854 result = __Pyx_PyObject_IsTrue(py_result);
3855 Py_DECREF(py_result);
3859 #if PY_MAJOR_VERSION < 3 3860 Py_XDECREF(owned_ref);
3862 return (equals == Py_EQ);
3864 #if PY_MAJOR_VERSION < 3 3865 Py_XDECREF(owned_ref);
3867 return (equals == Py_NE);
3872 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list,
int level) {
3873 PyObject *empty_list = 0;
3874 PyObject *module = 0;
3875 PyObject *global_dict = 0;
3876 PyObject *empty_dict = 0;
3878 #if PY_VERSION_HEX < 0x03030000 3879 PyObject *py_import;
3880 py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
3887 empty_list = PyList_New(0);
3892 global_dict = PyModule_GetDict(__pyx_m);
3895 empty_dict = PyDict_New();
3899 #if PY_MAJOR_VERSION >= 3 3901 if (strchr(__Pyx_MODULE_NAME,
'.')) {
3902 #if PY_VERSION_HEX < 0x03030000 3903 PyObject *py_level = PyInt_FromLong(1);
3906 module = PyObject_CallFunctionObjArgs(py_import,
3907 name, global_dict, empty_dict, list, py_level, NULL);
3908 Py_DECREF(py_level);
3910 module = PyImport_ImportModuleLevelObject(
3911 name, global_dict, empty_dict, list, 1);
3914 if (!PyErr_ExceptionMatches(PyExc_ImportError))
3923 #if PY_VERSION_HEX < 0x03030000 3924 PyObject *py_level = PyInt_FromLong(level);
3927 module = PyObject_CallFunctionObjArgs(py_import,
3928 name, global_dict, empty_dict, list, py_level, NULL);
3929 Py_DECREF(py_level);
3931 module = PyImport_ImportModuleLevelObject(
3932 name, global_dict, empty_dict, list, level);
3937 #if PY_VERSION_HEX < 0x03030000 3938 Py_XDECREF(py_import);
3940 Py_XDECREF(empty_list);
3941 Py_XDECREF(empty_dict);
3946 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
3947 PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
3948 if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
3949 PyErr_Format(PyExc_ImportError,
3950 #
if PY_MAJOR_VERSION < 3
3951 "cannot import name %.230s", PyString_AS_STRING(name));
3953 "cannot import name %S",
name);
3960 static int __Pyx_CLineForTraceback(
int c_line) {
3961 #ifdef CYTHON_CLINE_IN_TRACEBACK 3962 return ((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0;
3964 PyObject *use_cline;
3965 #if CYTHON_COMPILING_IN_CPYTHON 3966 PyObject **cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
3967 if (likely(cython_runtime_dict)) {
3968 use_cline = PyDict_GetItem(*cython_runtime_dict, __pyx_n_s_cline_in_traceback);
3972 PyObject *ptype, *pvalue, *ptraceback;
3973 PyObject *use_cline_obj;
3974 PyErr_Fetch(&ptype, &pvalue, &ptraceback);
3975 use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
3976 if (use_cline_obj) {
3977 use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
3978 Py_DECREF(use_cline_obj);
3982 PyErr_Restore(ptype, pvalue, ptraceback);
3986 PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
3988 else if (PyObject_Not(use_cline) != 0) {
3996 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries,
int count,
int code_line) {
3997 int start = 0, mid = 0,
end = count - 1;
3998 if (
end >= 0 && code_line > entries[
end].code_line) {
4001 while (start <
end) {
4002 mid = start + (
end - start) / 2;
4003 if (code_line < entries[mid].code_line) {
4005 }
else if (code_line > entries[mid].code_line) {
4011 if (code_line <= entries[mid].code_line) {
4017 static PyCodeObject *__pyx_find_code_object(
int code_line) {
4018 PyCodeObject* code_object;
4020 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
4023 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
4024 if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
4027 code_object = __pyx_code_cache.entries[pos].code_object;
4028 Py_INCREF(code_object);
4031 static void __pyx_insert_code_object(
int code_line, PyCodeObject* code_object) {
4033 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
4034 if (unlikely(!code_line)) {
4037 if (unlikely(!entries)) {
4038 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*
sizeof(__Pyx_CodeObjectCacheEntry));
4039 if (likely(entries)) {
4040 __pyx_code_cache.entries = entries;
4041 __pyx_code_cache.max_count = 64;
4042 __pyx_code_cache.count = 1;
4043 entries[0].code_line = code_line;
4044 entries[0].code_object = code_object;
4045 Py_INCREF(code_object);
4049 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
4050 if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
4051 PyCodeObject* tmp = entries[pos].code_object;
4052 entries[pos].code_object = code_object;
4056 if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
4057 int new_max = __pyx_code_cache.max_count + 64;
4058 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
4059 __pyx_code_cache.entries, (
size_t)new_max*
sizeof(__Pyx_CodeObjectCacheEntry));
4060 if (unlikely(!entries)) {
4063 __pyx_code_cache.entries = entries;
4064 __pyx_code_cache.max_count = new_max;
4066 for (i=__pyx_code_cache.count; i>pos; i--) {
4067 entries[i] = entries[i-1];
4069 entries[pos].code_line = code_line;
4070 entries[pos].code_object = code_object;
4071 __pyx_code_cache.count++;
4072 Py_INCREF(code_object);
4076 #include "compile.h" 4077 #include "frameobject.h" 4078 #include "traceback.h" 4079 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
4080 const char *funcname,
int c_line,
4081 int py_line,
const char *filename) {
4082 PyCodeObject *py_code = 0;
4083 PyObject *py_srcfile = 0;
4084 PyObject *py_funcname = 0;
4085 #if PY_MAJOR_VERSION < 3 4086 py_srcfile = PyString_FromString(filename);
4088 py_srcfile = PyUnicode_FromString(filename);
4090 if (!py_srcfile)
goto bad;
4092 #if PY_MAJOR_VERSION < 3 4093 py_funcname = PyString_FromFormat(
"%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
4095 py_funcname = PyUnicode_FromFormat(
"%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
4099 #if PY_MAJOR_VERSION < 3 4100 py_funcname = PyString_FromString(funcname);
4102 py_funcname = PyUnicode_FromString(funcname);
4105 if (!py_funcname)
goto bad;
4106 py_code = __Pyx_PyCode_New(
4123 Py_DECREF(py_srcfile);
4124 Py_DECREF(py_funcname);
4127 Py_XDECREF(py_srcfile);
4128 Py_XDECREF(py_funcname);
4131 static void __Pyx_AddTraceback(
const char *funcname,
int c_line,
4132 int py_line,
const char *filename) {
4133 PyCodeObject *py_code = 0;
4134 PyFrameObject *py_frame = 0;
4136 c_line = __Pyx_CLineForTraceback(c_line);
4138 py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
4140 py_code = __Pyx_CreateCodeObjectForTraceback(
4141 funcname, c_line, py_line, filename);
4142 if (!py_code)
goto bad;
4143 __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
4145 py_frame = PyFrame_New(
4146 PyThreadState_GET(),
4151 if (!py_frame)
goto bad;
4152 __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
4153 PyTraceBack_Here(py_frame);
4155 Py_XDECREF(py_code);
4156 Py_XDECREF(py_frame);
4160 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(
int value) {
4161 const int neg_one = (int) -1, const_zero = (
int) 0;
4162 const int is_unsigned = neg_one > const_zero;
4164 if (
sizeof(
int) <
sizeof(long)) {
4165 return PyInt_FromLong((
long) value);
4166 }
else if (
sizeof(
int) <=
sizeof(
unsigned long)) {
4167 return PyLong_FromUnsignedLong((
unsigned long) value);
4168 #ifdef HAVE_LONG_LONG 4169 }
else if (
sizeof(
int) <=
sizeof(
unsigned PY_LONG_LONG)) {
4170 return PyLong_FromUnsignedLongLong((
unsigned PY_LONG_LONG) value);
4174 if (
sizeof(
int) <=
sizeof(
long)) {
4175 return PyInt_FromLong((
long) value);
4176 #ifdef HAVE_LONG_LONG 4177 }
else if (
sizeof(
int) <=
sizeof(PY_LONG_LONG)) {
4178 return PyLong_FromLongLong((PY_LONG_LONG) value);
4183 int one = 1;
int little = (int)*(
unsigned char *)&one;
4184 unsigned char *bytes = (
unsigned char *)&value;
4185 return _PyLong_FromByteArray(bytes,
sizeof(
int),
4186 little, !is_unsigned);
4191 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(
long value) {
4192 const long neg_one = (long) -1, const_zero = (
long) 0;
4193 const int is_unsigned = neg_one > const_zero;
4195 if (
sizeof(
long) <
sizeof(long)) {
4196 return PyInt_FromLong((
long) value);
4197 }
else if (
sizeof(
long) <=
sizeof(
unsigned long)) {
4198 return PyLong_FromUnsignedLong((
unsigned long) value);
4199 #ifdef HAVE_LONG_LONG 4200 }
else if (
sizeof(
long) <=
sizeof(
unsigned PY_LONG_LONG)) {
4201 return PyLong_FromUnsignedLongLong((
unsigned PY_LONG_LONG) value);
4205 if (
sizeof(
long) <=
sizeof(
long)) {
4206 return PyInt_FromLong((
long) value);
4207 #ifdef HAVE_LONG_LONG 4208 }
else if (
sizeof(
long) <=
sizeof(PY_LONG_LONG)) {
4209 return PyLong_FromLongLong((PY_LONG_LONG) value);
4214 int one = 1;
int little = (int)*(
unsigned char *)&one;
4215 unsigned char *bytes = (
unsigned char *)&value;
4216 return _PyLong_FromByteArray(bytes,
sizeof(
long),
4217 little, !is_unsigned);
4222 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ 4223 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) 4224 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ 4225 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) 4226 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ 4228 func_type value = func_value;\ 4229 if (sizeof(target_type) < sizeof(func_type)) {\ 4230 if (unlikely(value != (func_type) (target_type) value)) {\ 4231 func_type zero = 0;\ 4232 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ 4233 return (target_type) -1;\ 4234 if (is_unsigned && unlikely(value < zero))\ 4235 goto raise_neg_overflow;\ 4237 goto raise_overflow;\ 4240 return (target_type) value;\ 4244 static CYTHON_INLINE
long __Pyx_PyInt_As_long(PyObject *x) {
4245 const long neg_one = (long) -1, const_zero = (
long) 0;
4246 const int is_unsigned = neg_one > const_zero;
4247 #if PY_MAJOR_VERSION < 3 4248 if (likely(PyInt_Check(x))) {
4249 if (
sizeof(
long) <
sizeof(long)) {
4250 __PYX_VERIFY_RETURN_INT(
long,
long, PyInt_AS_LONG(x))
4252 long val = PyInt_AS_LONG(x);
4253 if (is_unsigned && unlikely(val < 0)) {
4254 goto raise_neg_overflow;
4260 if (likely(PyLong_Check(x))) {
4262 #if CYTHON_USE_PYLONG_INTERNALS 4263 const digit*
digits = ((PyLongObject*)x)->ob_digit;
4264 switch (Py_SIZE(x)) {
4265 case 0:
return (
long) 0;
4266 case 1: __PYX_VERIFY_RETURN_INT(
long, digit, digits[0])
4268 if (8 *
sizeof(
long) > 1 * PyLong_SHIFT) {
4269 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
4270 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
4271 }
else if (8 *
sizeof(
long) >= 2 * PyLong_SHIFT) {
4272 return (
long) (((((long)digits[1]) << PyLong_SHIFT) | (
long)digits[0]));
4277 if (8 *
sizeof(
long) > 2 * PyLong_SHIFT) {
4278 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
4279 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
4280 }
else if (8 *
sizeof(
long) >= 3 * PyLong_SHIFT) {
4281 return (
long) (((((((long)digits[2]) << PyLong_SHIFT) | (
long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
4286 if (8 *
sizeof(
long) > 3 * PyLong_SHIFT) {
4287 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
4288 __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])))
4289 }
else if (8 *
sizeof(
long) >= 4 * PyLong_SHIFT) {
4290 return (
long) (((((((((long)digits[3]) << PyLong_SHIFT) | (
long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (
long)digits[0]));
4296 #if CYTHON_COMPILING_IN_CPYTHON 4297 if (unlikely(Py_SIZE(x) < 0)) {
4298 goto raise_neg_overflow;
4302 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
4303 if (unlikely(result < 0))
4305 if (unlikely(result == 1))
4306 goto raise_neg_overflow;
4309 if (
sizeof(
long) <=
sizeof(
unsigned long)) {
4310 __PYX_VERIFY_RETURN_INT_EXC(
long,
unsigned long, PyLong_AsUnsignedLong(x))
4311 #ifdef HAVE_LONG_LONG 4312 }
else if (
sizeof(
long) <=
sizeof(
unsigned PY_LONG_LONG)) {
4313 __PYX_VERIFY_RETURN_INT_EXC(
long,
unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
4317 #if CYTHON_USE_PYLONG_INTERNALS 4318 const digit*
digits = ((PyLongObject*)x)->ob_digit;
4319 switch (Py_SIZE(x)) {
4320 case 0:
return (
long) 0;
4321 case -1: __PYX_VERIFY_RETURN_INT(
long, sdigit, (sdigit) (-(sdigit)digits[0]))
4322 case 1: __PYX_VERIFY_RETURN_INT(
long, digit, +digits[0])
4324 if (8 *
sizeof(
long) - 1 > 1 * PyLong_SHIFT) {
4325 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
4326 __PYX_VERIFY_RETURN_INT(
long,
long, -(
long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
4327 }
else if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
4328 return (
long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
4333 if (8 *
sizeof(
long) > 1 * PyLong_SHIFT) {
4334 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
4335 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
4336 }
else if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
4337 return (
long) ((((((long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
4342 if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
4343 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
4344 __PYX_VERIFY_RETURN_INT(
long,
long, -(
long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
4345 }
else if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
4346 return (
long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (
long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
4351 if (8 *
sizeof(
long) > 2 * PyLong_SHIFT) {
4352 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
4353 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
4354 }
else if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
4355 return (
long) ((((((((long)digits[2]) << PyLong_SHIFT) | (
long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
4360 if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
4361 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
4362 __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])))
4363 }
else if (8 *
sizeof(
long) - 1 > 4 * PyLong_SHIFT) {
4364 return (
long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (
long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
4369 if (8 *
sizeof(
long) > 3 * PyLong_SHIFT) {
4370 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
4371 __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])))
4372 }
else if (8 *
sizeof(
long) - 1 > 4 * PyLong_SHIFT) {
4373 return (
long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (
long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
4379 if (
sizeof(
long) <=
sizeof(long)) {
4380 __PYX_VERIFY_RETURN_INT_EXC(
long,
long, PyLong_AsLong(x))
4381 #ifdef HAVE_LONG_LONG 4382 }
else if (
sizeof(
long) <=
sizeof(PY_LONG_LONG)) {
4383 __PYX_VERIFY_RETURN_INT_EXC(
long, PY_LONG_LONG, PyLong_AsLongLong(x))
4388 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) 4389 PyErr_SetString(PyExc_RuntimeError,
4390 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
4393 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
4394 #if PY_MAJOR_VERSION < 3 4395 if (likely(v) && !PyLong_Check(v)) {
4397 v = PyNumber_Long(tmp);
4402 int one = 1;
int is_little = (int)*(
unsigned char *)&one;
4403 unsigned char *bytes = (
unsigned char *)&val;
4404 int ret = _PyLong_AsByteArray((PyLongObject *)v,
4406 is_little, !is_unsigned);
4416 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
4417 if (!tmp)
return (
long) -1;
4418 val = __Pyx_PyInt_As_long(tmp);
4423 PyErr_SetString(PyExc_OverflowError,
4424 "value too large to convert to long");
4427 PyErr_SetString(PyExc_OverflowError,
4428 "can't convert negative value to long");
4433 static CYTHON_INLINE
int __Pyx_PyInt_As_int(PyObject *x) {
4434 const int neg_one = (int) -1, const_zero = (
int) 0;
4435 const int is_unsigned = neg_one > const_zero;
4436 #if PY_MAJOR_VERSION < 3 4437 if (likely(PyInt_Check(x))) {
4438 if (
sizeof(
int) <
sizeof(long)) {
4439 __PYX_VERIFY_RETURN_INT(
int,
long, PyInt_AS_LONG(x))
4441 long val = PyInt_AS_LONG(x);
4442 if (is_unsigned && unlikely(val < 0)) {
4443 goto raise_neg_overflow;
4449 if (likely(PyLong_Check(x))) {
4451 #if CYTHON_USE_PYLONG_INTERNALS 4452 const digit*
digits = ((PyLongObject*)x)->ob_digit;
4453 switch (Py_SIZE(x)) {
4454 case 0:
return (
int) 0;
4455 case 1: __PYX_VERIFY_RETURN_INT(
int, digit, digits[0])
4457 if (8 *
sizeof(
int) > 1 * PyLong_SHIFT) {
4458 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
4459 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
4460 }
else if (8 *
sizeof(
int) >= 2 * PyLong_SHIFT) {
4461 return (
int) (((((int)digits[1]) << PyLong_SHIFT) | (
int)digits[0]));
4466 if (8 *
sizeof(
int) > 2 * PyLong_SHIFT) {
4467 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
4468 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
4469 }
else if (8 *
sizeof(
int) >= 3 * PyLong_SHIFT) {
4470 return (
int) (((((((int)digits[2]) << PyLong_SHIFT) | (
int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
4475 if (8 *
sizeof(
int) > 3 * PyLong_SHIFT) {
4476 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
4477 __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])))
4478 }
else if (8 *
sizeof(
int) >= 4 * PyLong_SHIFT) {
4479 return (
int) (((((((((int)digits[3]) << PyLong_SHIFT) | (
int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (
int)digits[0]));
4485 #if CYTHON_COMPILING_IN_CPYTHON 4486 if (unlikely(Py_SIZE(x) < 0)) {
4487 goto raise_neg_overflow;
4491 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
4492 if (unlikely(result < 0))
4494 if (unlikely(result == 1))
4495 goto raise_neg_overflow;
4498 if (
sizeof(
int) <=
sizeof(
unsigned long)) {
4499 __PYX_VERIFY_RETURN_INT_EXC(
int,
unsigned long, PyLong_AsUnsignedLong(x))
4500 #ifdef HAVE_LONG_LONG 4501 }
else if (
sizeof(
int) <=
sizeof(
unsigned PY_LONG_LONG)) {
4502 __PYX_VERIFY_RETURN_INT_EXC(
int,
unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
4506 #if CYTHON_USE_PYLONG_INTERNALS 4507 const digit*
digits = ((PyLongObject*)x)->ob_digit;
4508 switch (Py_SIZE(x)) {
4509 case 0:
return (
int) 0;
4510 case -1: __PYX_VERIFY_RETURN_INT(
int, sdigit, (sdigit) (-(sdigit)digits[0]))
4511 case 1: __PYX_VERIFY_RETURN_INT(
int, digit, +digits[0])
4513 if (8 *
sizeof(
int) - 1 > 1 * PyLong_SHIFT) {
4514 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
4515 __PYX_VERIFY_RETURN_INT(
int,
long, -(
long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
4516 }
else if (8 *
sizeof(
int) - 1 > 2 * PyLong_SHIFT) {
4517 return (
int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
4522 if (8 *
sizeof(
int) > 1 * PyLong_SHIFT) {
4523 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
4524 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
4525 }
else if (8 *
sizeof(
int) - 1 > 2 * PyLong_SHIFT) {
4526 return (
int) ((((((int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
4531 if (8 *
sizeof(
int) - 1 > 2 * PyLong_SHIFT) {
4532 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
4533 __PYX_VERIFY_RETURN_INT(
int,
long, -(
long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
4534 }
else if (8 *
sizeof(
int) - 1 > 3 * PyLong_SHIFT) {
4535 return (
int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (
int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
4540 if (8 *
sizeof(
int) > 2 * PyLong_SHIFT) {
4541 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
4542 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
4543 }
else if (8 *
sizeof(
int) - 1 > 3 * PyLong_SHIFT) {
4544 return (
int) ((((((((int)digits[2]) << PyLong_SHIFT) | (
int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
4549 if (8 *
sizeof(
int) - 1 > 3 * PyLong_SHIFT) {
4550 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
4551 __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])))
4552 }
else if (8 *
sizeof(
int) - 1 > 4 * PyLong_SHIFT) {
4553 return (
int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (
int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
4558 if (8 *
sizeof(
int) > 3 * PyLong_SHIFT) {
4559 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
4560 __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])))
4561 }
else if (8 *
sizeof(
int) - 1 > 4 * PyLong_SHIFT) {
4562 return (
int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (
int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
4568 if (
sizeof(
int) <=
sizeof(long)) {
4569 __PYX_VERIFY_RETURN_INT_EXC(
int,
long, PyLong_AsLong(x))
4570 #ifdef HAVE_LONG_LONG 4571 }
else if (
sizeof(
int) <=
sizeof(PY_LONG_LONG)) {
4572 __PYX_VERIFY_RETURN_INT_EXC(
int, PY_LONG_LONG, PyLong_AsLongLong(x))
4577 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) 4578 PyErr_SetString(PyExc_RuntimeError,
4579 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
4582 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
4583 #if PY_MAJOR_VERSION < 3 4584 if (likely(v) && !PyLong_Check(v)) {
4586 v = PyNumber_Long(tmp);
4591 int one = 1;
int is_little = (int)*(
unsigned char *)&one;
4592 unsigned char *bytes = (
unsigned char *)&val;
4593 int ret = _PyLong_AsByteArray((PyLongObject *)v,
4595 is_little, !is_unsigned);
4605 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
4606 if (!tmp)
return (
int) -1;
4607 val = __Pyx_PyInt_As_int(tmp);
4612 PyErr_SetString(PyExc_OverflowError,
4613 "value too large to convert to int");
4616 PyErr_SetString(PyExc_OverflowError,
4617 "can't convert negative value to int");
4622 static int __Pyx_check_binary_version(
void) {
4623 char ctversion[4], rtversion[4];
4624 PyOS_snprintf(ctversion, 4,
"%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
4625 PyOS_snprintf(rtversion, 4,
"%s", Py_GetVersion());
4626 if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
4628 PyOS_snprintf(message,
sizeof(message),
4629 "compiletime version %s of module '%.100s' " 4630 "does not match runtime version %s",
4631 ctversion, __Pyx_MODULE_NAME, rtversion);
4632 return PyErr_WarnEx(NULL, message, 1);
4638 static int __Pyx_ExportFunction(
const char *name,
void (*f)(
void),
const char *sig) {
4645 d = PyObject_GetAttrString(__pyx_m, (
char *)
"__pyx_capi__");
4652 if (PyModule_AddObject(__pyx_m, (
char *)
"__pyx_capi__", d) < 0)
4656 #if PY_VERSION_HEX >= 0x02070000 4657 cobj = PyCapsule_New(tmp.p, sig, 0);
4659 cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (
void *)sig, 0);
4663 if (PyDict_SetItemString(d, name, cobj) < 0)
4675 #ifndef __PYX_HAVE_RT_ImportModule 4676 #define __PYX_HAVE_RT_ImportModule 4677 static PyObject *__Pyx_ImportModule(
const char *name) {
4678 PyObject *py_name = 0;
4679 PyObject *py_module = 0;
4680 py_name = __Pyx_PyIdentifier_FromString(name);
4683 py_module = PyImport_Import(py_name);
4687 Py_XDECREF(py_name);
4693 #ifndef __PYX_HAVE_RT_ImportType 4694 #define __PYX_HAVE_RT_ImportType 4695 static PyTypeObject *__Pyx_ImportType(
const char *module_name,
const char *class_name,
4696 size_t size,
int strict)
4698 PyObject *py_module = 0;
4699 PyObject *result = 0;
4700 PyObject *py_name = 0;
4702 Py_ssize_t basicsize;
4703 #ifdef Py_LIMITED_API 4704 PyObject *py_basicsize;
4706 py_module = __Pyx_ImportModule(module_name);
4709 py_name = __Pyx_PyIdentifier_FromString(class_name);
4712 result = PyObject_GetAttr(py_module, py_name);
4715 Py_DECREF(py_module);
4719 if (!PyType_Check(result)) {
4720 PyErr_Format(PyExc_TypeError,
4721 "%.200s.%.200s is not a type object",
4722 module_name, class_name);
4725 #ifndef Py_LIMITED_API 4726 basicsize = ((PyTypeObject *)result)->tp_basicsize;
4728 py_basicsize = PyObject_GetAttrString(result,
"__basicsize__");
4731 basicsize = PyLong_AsSsize_t(py_basicsize);
4732 Py_DECREF(py_basicsize);
4734 if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
4737 if (!strict && (
size_t)basicsize > size) {
4738 PyOS_snprintf(warning,
sizeof(warning),
4739 "%s.%s size changed, may indicate binary incompatibility. Expected %zd, got %zd",
4740 module_name, class_name, basicsize, size);
4741 if (PyErr_WarnEx(NULL, warning, 0) < 0)
goto bad;
4743 else if ((
size_t)basicsize != size) {
4744 PyErr_Format(PyExc_ValueError,
4745 "%.200s.%.200s has the wrong size, try recompiling. Expected %zd, got %zd",
4746 module_name, class_name, basicsize, size);
4749 return (PyTypeObject *)result;
4751 Py_XDECREF(py_module);
4758 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
4760 #if PY_MAJOR_VERSION < 3 4761 if (t->is_unicode) {
4762 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
4763 }
else if (t->intern) {
4764 *t->p = PyString_InternFromString(t->s);
4766 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
4769 if (t->is_unicode | t->is_str) {
4771 *t->p = PyUnicode_InternFromString(t->s);
4772 }
else if (t->encoding) {
4773 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
4775 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
4778 *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
4783 if (PyObject_Hash(*t->p) == -1)
4790 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(
const char* c_str) {
4791 return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
4793 static CYTHON_INLINE
const char* __Pyx_PyObject_AsString(PyObject* o) {
4795 return __Pyx_PyObject_AsStringAndSize(o, &ignore);
4797 static CYTHON_INLINE
const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
4798 #if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) 4800 #
if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
4801 __Pyx_sys_getdefaultencoding_not_ascii &&
4803 PyUnicode_Check(o)) {
4804 #if PY_VERSION_HEX < 0x03030000 4806 PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
4807 if (!defenc)
return NULL;
4808 defenc_c = PyBytes_AS_STRING(defenc);
4809 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 4811 char*
end = defenc_c + PyBytes_GET_SIZE(defenc);
4813 for (c = defenc_c; c <
end; c++) {
4814 if ((
unsigned char) (*c) >= 128) {
4815 PyUnicode_AsASCIIString(o);
4821 *length = PyBytes_GET_SIZE(defenc);
4824 if (__Pyx_PyUnicode_READY(o) == -1)
return NULL;
4825 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 4826 if (PyUnicode_IS_ASCII(o)) {
4827 *length = PyUnicode_GET_LENGTH(o);
4828 return PyUnicode_AsUTF8(o);
4830 PyUnicode_AsASCIIString(o);
4834 return PyUnicode_AsUTF8AndSize(o, length);
4839 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) 4840 if (PyByteArray_Check(o)) {
4841 *length = PyByteArray_GET_SIZE(o);
4842 return PyByteArray_AS_STRING(o);
4847 int r = PyBytes_AsStringAndSize(o, &result, length);
4848 if (unlikely(r < 0)) {
4855 static CYTHON_INLINE
int __Pyx_PyObject_IsTrue(PyObject* x) {
4856 int is_true = x == Py_True;
4857 if (is_true | (x == Py_False) | (x == Py_None))
return is_true;
4858 else return PyObject_IsTrue(x);
4860 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
4861 #if CYTHON_USE_TYPE_SLOTS 4864 const char *name = NULL;
4865 PyObject *res = NULL;
4866 #if PY_MAJOR_VERSION < 3 4867 if (PyInt_Check(x) || PyLong_Check(x))
4869 if (PyLong_Check(x))
4871 return __Pyx_NewRef(x);
4872 #if CYTHON_USE_TYPE_SLOTS 4873 m = Py_TYPE(x)->tp_as_number;
4874 #if PY_MAJOR_VERSION < 3 4875 if (m && m->nb_int) {
4877 res = PyNumber_Int(x);
4879 else if (m && m->nb_long) {
4881 res = PyNumber_Long(x);
4884 if (m && m->nb_int) {
4886 res = PyNumber_Long(x);
4890 res = PyNumber_Int(x);
4893 #if PY_MAJOR_VERSION < 3 4894 if (!PyInt_Check(res) && !PyLong_Check(res)) {
4896 if (!PyLong_Check(res)) {
4898 PyErr_Format(PyExc_TypeError,
4899 "__%.4s__ returned non-%.4s (type %.200s)",
4900 name, name, Py_TYPE(res)->tp_name);
4905 else if (!PyErr_Occurred()) {
4906 PyErr_SetString(PyExc_TypeError,
4907 "an integer is required");
4911 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*
b) {
4914 #if PY_MAJOR_VERSION < 3 4915 if (likely(PyInt_CheckExact(b))) {
4916 if (
sizeof(Py_ssize_t) >=
sizeof(
long))
4917 return PyInt_AS_LONG(b);
4919 return PyInt_AsSsize_t(x);
4922 if (likely(PyLong_CheckExact(b))) {
4923 #if CYTHON_USE_PYLONG_INTERNALS 4924 const digit*
digits = ((PyLongObject*)b)->ob_digit;
4925 const Py_ssize_t size = Py_SIZE(b);
4926 if (likely(__Pyx_sst_abs(size) <= 1)) {
4927 ival = likely(size) ? digits[0] : 0;
4928 if (size == -1) ival = -ival;
4933 if (8 *
sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
4934 return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0]));
4938 if (8 *
sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
4939 return -(Py_ssize_t) (((((
size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
4943 if (8 *
sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
4944 return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (
size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
4948 if (8 *
sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
4949 return -(Py_ssize_t) (((((((
size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0]));
4953 if (8 *
sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
4954 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]));
4958 if (8 *
sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
4959 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]));
4965 return PyLong_AsSsize_t(b);
4967 x = PyNumber_Index(b);
4969 ival = PyInt_AsSsize_t(x);
4973 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(
size_t ival) {
4974 return PyInt_FromSize_t(ival);
PyMODINIT_FUNC initpymodule(void)
double b(int nuc)
Computes the scattering length [cm] from the coherent and incoherent components.
The Region class is the abstract class/interface used by all region agents.
std::string name(int nuc)
__PYX_EXTERN_C void CyclusPyDelAgent(int)
The Facility class is the abstract class/interface used by all facility agents.
def memset(dest, src, size)
zz_group fp
fission product Z number group
__PYX_EXTERN_C void CyclusInitFromPyAgent(cyclus::Agent *, cyclus::Agent *, void *)
__PYX_EXTERN_C void CyclusPyCallListeners(std::string, cyclus::Agent *, void *, int, boost::spirit::hold_any)
__PYX_EXTERN_C cyclus::Agent * CyclusMakePyAgent(std::string, std::string, void *)
static std::string digits
string of digit characters
bool operator==(const CapacityConstraint< T > &lhs, const CapacityConstraint< T > &rhs)
CapacityConstraint-CapacityConstraint equality operator.
The abstract base class used by all types of agents that live and interact in a simulation.
void warning(std::string s)
Prints a warning message.
__PYX_EXTERN_C void CyclusClearPyAgentRefs(void)
__PYX_EXTERN_C std::string CyclusPyFindModule(std::string)
enable_if< has_const_iterator< T >::value, typename T::const_iterator >::type end(const T &c)
The Institution class is the abstract class/interface used by all institution agents.