| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
#ifndef PY_SSIZE_T_CLEAN |
| 22 |
#define PY_SSIZE_T_CLEAN |
| 23 |
#endif |
| 24 |
#if defined(CYTHON_LIMITED_API) && 0 |
| 25 |
#ifndef Py_LIMITED_API |
| 26 |
#if CYTHON_LIMITED_API+0 > 0x03030000 |
| 27 |
#define Py_LIMITED_API CYTHON_LIMITED_API |
| 28 |
#else |
| 29 |
#define Py_LIMITED_API 0x03030000 |
| 30 |
#endif |
| 31 |
#endif |
| 32 |
#endif |
| 33 |
|
| 34 |
#include "Python.h" |
| 35 |
#ifndef Py_PYTHON_H |
| 36 |
#error Python headers needed to compile C extensions, please install development version of Python. |
| 37 |
#elif PY_VERSION_HEX < 0x02070000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) |
| 38 |
#error Cython requires Python 2.7+ or Python 3.3+. |
| 39 |
#else |
| 40 |
#if CYTHON_LIMITED_API |
| 41 |
#define __PYX_EXTRA_ABI_MODULE_NAME "limited" |
| 42 |
#else |
| 43 |
#define __PYX_EXTRA_ABI_MODULE_NAME "" |
| 44 |
#endif |
| 45 |
#define CYTHON_ABI "3_0_0" __PYX_EXTRA_ABI_MODULE_NAME |
| 46 |
#define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI |
| 47 |
#define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." |
| 48 |
#define CYTHON_HEX_VERSION 0x030000F0 |
| 49 |
#define CYTHON_FUTURE_DIVISION 1 |
| 50 |
#include <stddef.h> |
| 51 |
#ifndef offsetof |
| 52 |
#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) |
| 53 |
#endif |
| 54 |
#if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS) |
| 55 |
#ifndef __stdcall |
| 56 |
#define __stdcall |
| 57 |
#endif |
| 58 |
#ifndef __cdecl |
| 59 |
#define __cdecl |
| 60 |
#endif |
| 61 |
#ifndef __fastcall |
| 62 |
#define __fastcall |
| 63 |
#endif |
| 64 |
#endif |
| 65 |
#ifndef DL_IMPORT |
| 66 |
#define DL_IMPORT(t) t |
| 67 |
#endif |
| 68 |
#define __PYX_COMMA , |
| 69 |
#ifndef HAVE_LONG_LONG |
| 70 |
#define HAVE_LONG_LONG |
| 71 |
#endif |
| 72 |
#ifndef PY_LONG_LONG |
| 73 |
#define PY_LONG_LONG LONG_LONG |
| 74 |
#endif |
| 75 |
#ifndef Py_HUGE_VAL |
| 76 |
#define Py_HUGE_VAL HUGE_VAL |
| 77 |
#endif |
| 78 |
#define __PYX_LIMITED_VERSION_HEX PY_VERSION_HEX |
| 79 |
#if defined(PYPY_VERSION) |
| 80 |
#define CYTHON_COMPILING_IN_PYPY 1 |
| 81 |
#define CYTHON_COMPILING_IN_CPYTHON 0 |
| 82 |
#define CYTHON_COMPILING_IN_LIMITED_API 0 |
| 83 |
#define CYTHON_COMPILING_IN_GRAAL 0 |
| 84 |
#define CYTHON_COMPILING_IN_NOGIL 0 |
| 85 |
#undef CYTHON_USE_TYPE_SLOTS |
| 86 |
#define CYTHON_USE_TYPE_SLOTS 0 |
| 87 |
#define CYTHON_USE_TYPE_SPECS 1 |
| 88 |
#undef CYTHON_USE_PYTYPE_LOOKUP |
| 89 |
#define CYTHON_USE_PYTYPE_LOOKUP 0 |
| 90 |
#if PY_VERSION_HEX < 0x03050000 |
| 91 |
#undef CYTHON_USE_ASYNC_SLOTS |
| 92 |
#define CYTHON_USE_ASYNC_SLOTS 0 |
| 93 |
#elif !defined(CYTHON_USE_ASYNC_SLOTS) |
| 94 |
#define CYTHON_USE_ASYNC_SLOTS 1 |
| 95 |
#endif |
| 96 |
#undef CYTHON_USE_PYLIST_INTERNALS |
| 97 |
#define CYTHON_USE_PYLIST_INTERNALS 0 |
| 98 |
#undef CYTHON_USE_UNICODE_INTERNALS |
| 99 |
#define CYTHON_USE_UNICODE_INTERNALS 0 |
| 100 |
#undef CYTHON_USE_UNICODE_WRITER |
| 101 |
#define CYTHON_USE_UNICODE_WRITER 0 |
| 102 |
#undef CYTHON_USE_PYLONG_INTERNALS |
| 103 |
#define CYTHON_USE_PYLONG_INTERNALS 0 |
| 104 |
#undef CYTHON_AVOID_BORROWED_REFS |
| 105 |
#define CYTHON_AVOID_BORROWED_REFS 1 |
| 106 |
#undef CYTHON_ASSUME_SAFE_MACROS |
| 107 |
#define CYTHON_ASSUME_SAFE_MACROS 0 |
| 108 |
#undef CYTHON_UNPACK_METHODS |
| 109 |
#define CYTHON_UNPACK_METHODS 0 |
| 110 |
#undef CYTHON_FAST_THREAD_STATE |
| 111 |
#define CYTHON_FAST_THREAD_STATE 0 |
| 112 |
#undef CYTHON_FAST_GIL |
| 113 |
#define CYTHON_FAST_GIL 0 |
| 114 |
#undef CYTHON_METH_FASTCALL |
| 115 |
#define CYTHON_METH_FASTCALL 0 |
| 116 |
#undef CYTHON_FAST_PYCALL |
| 117 |
#define CYTHON_FAST_PYCALL 0 |
| 118 |
#ifndef CYTHON_PEP487_INIT_SUBCLASS |
| 119 |
#define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3) |
| 120 |
#endif |
| 121 |
#if PY_VERSION_HEX < 0x03090000 |
| 122 |
#undef CYTHON_PEP489_MULTI_PHASE_INIT |
| 123 |
#define CYTHON_PEP489_MULTI_PHASE_INIT 0 |
| 124 |
#elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) |
| 125 |
#define CYTHON_PEP489_MULTI_PHASE_INIT 1 |
| 126 |
#endif |
| 127 |
#undef CYTHON_USE_MODULE_STATE |
| 128 |
#define CYTHON_USE_MODULE_STATE 0 |
| 129 |
#undef CYTHON_USE_TP_FINALIZE |
| 130 |
#define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1 && PYPY_VERSION_NUM >= 0x07030C00) |
| 131 |
#undef CYTHON_USE_DICT_VERSIONS |
| 132 |
#define CYTHON_USE_DICT_VERSIONS 0 |
| 133 |
#undef CYTHON_USE_EXC_INFO_STACK |
| 134 |
#define CYTHON_USE_EXC_INFO_STACK 0 |
| 135 |
#ifndef CYTHON_UPDATE_DESCRIPTOR_DOC |
| 136 |
#define CYTHON_UPDATE_DESCRIPTOR_DOC 0 |
| 137 |
#endif |
| 138 |
#elif defined(CYTHON_LIMITED_API) |
| 139 |
#ifdef Py_LIMITED_API |
| 140 |
#undef __PYX_LIMITED_VERSION_HEX |
| 141 |
#define __PYX_LIMITED_VERSION_HEX Py_LIMITED_API |
| 142 |
#endif |
| 143 |
#define CYTHON_COMPILING_IN_PYPY 0 |
| 144 |
#define CYTHON_COMPILING_IN_CPYTHON 0 |
| 145 |
#define CYTHON_COMPILING_IN_LIMITED_API 1 |
| 146 |
#define CYTHON_COMPILING_IN_GRAAL 0 |
| 147 |
#define CYTHON_COMPILING_IN_NOGIL 0 |
| 148 |
#undef CYTHON_CLINE_IN_TRACEBACK |
| 149 |
#define CYTHON_CLINE_IN_TRACEBACK 0 |
| 150 |
#undef CYTHON_USE_TYPE_SLOTS |
| 151 |
#define CYTHON_USE_TYPE_SLOTS 0 |
| 152 |
#undef CYTHON_USE_TYPE_SPECS |
| 153 |
#define CYTHON_USE_TYPE_SPECS 1 |
| 154 |
#undef CYTHON_USE_PYTYPE_LOOKUP |
| 155 |
#define CYTHON_USE_PYTYPE_LOOKUP 0 |
| 156 |
#undef CYTHON_USE_ASYNC_SLOTS |
| 157 |
#define CYTHON_USE_ASYNC_SLOTS 0 |
| 158 |
#undef CYTHON_USE_PYLIST_INTERNALS |
| 159 |
#define CYTHON_USE_PYLIST_INTERNALS 0 |
| 160 |
#undef CYTHON_USE_UNICODE_INTERNALS |
| 161 |
#define CYTHON_USE_UNICODE_INTERNALS 0 |
| 162 |
#ifndef CYTHON_USE_UNICODE_WRITER |
| 163 |
#define CYTHON_USE_UNICODE_WRITER 0 |
| 164 |
#endif |
| 165 |
#undef CYTHON_USE_PYLONG_INTERNALS |
| 166 |
#define CYTHON_USE_PYLONG_INTERNALS 0 |
| 167 |
#ifndef CYTHON_AVOID_BORROWED_REFS |
| 168 |
#define CYTHON_AVOID_BORROWED_REFS 0 |
| 169 |
#endif |
| 170 |
#undef CYTHON_ASSUME_SAFE_MACROS |
| 171 |
#define CYTHON_ASSUME_SAFE_MACROS 0 |
| 172 |
#undef CYTHON_UNPACK_METHODS |
| 173 |
#define CYTHON_UNPACK_METHODS 0 |
| 174 |
#undef CYTHON_FAST_THREAD_STATE |
| 175 |
#define CYTHON_FAST_THREAD_STATE 0 |
| 176 |
#undef CYTHON_FAST_GIL |
| 177 |
#define CYTHON_FAST_GIL 0 |
| 178 |
#undef CYTHON_METH_FASTCALL |
| 179 |
#define CYTHON_METH_FASTCALL 0 |
| 180 |
#undef CYTHON_FAST_PYCALL |
| 181 |
#define CYTHON_FAST_PYCALL 0 |
| 182 |
#ifndef CYTHON_PEP487_INIT_SUBCLASS |
| 183 |
#define CYTHON_PEP487_INIT_SUBCLASS 1 |
| 184 |
#endif |
| 185 |
#undef CYTHON_PEP489_MULTI_PHASE_INIT |
| 186 |
#define CYTHON_PEP489_MULTI_PHASE_INIT 0 |
| 187 |
#undef CYTHON_USE_MODULE_STATE |
| 188 |
#define CYTHON_USE_MODULE_STATE 1 |
| 189 |
#ifndef CYTHON_USE_TP_FINALIZE |
| 190 |
#define CYTHON_USE_TP_FINALIZE 1 |
| 191 |
#endif |
| 192 |
#undef CYTHON_USE_DICT_VERSIONS |
| 193 |
#define CYTHON_USE_DICT_VERSIONS 0 |
| 194 |
#undef CYTHON_USE_EXC_INFO_STACK |
| 195 |
#define CYTHON_USE_EXC_INFO_STACK 0 |
| 196 |
#ifndef CYTHON_UPDATE_DESCRIPTOR_DOC |
| 197 |
#define CYTHON_UPDATE_DESCRIPTOR_DOC 0 |
| 198 |
#endif |
| 199 |
#elif defined(PY_NOGIL) |
| 200 |
#define CYTHON_COMPILING_IN_PYPY 0 |
| 201 |
#define CYTHON_COMPILING_IN_CPYTHON 0 |
| 202 |
#define CYTHON_COMPILING_IN_LIMITED_API 0 |
| 203 |
#define CYTHON_COMPILING_IN_GRAAL 0 |
| 204 |
#define CYTHON_COMPILING_IN_NOGIL 1 |
| 205 |
#ifndef CYTHON_USE_TYPE_SLOTS |
| 206 |
#define CYTHON_USE_TYPE_SLOTS 1 |
| 207 |
#endif |
| 208 |
#undef CYTHON_USE_PYTYPE_LOOKUP |
| 209 |
#define CYTHON_USE_PYTYPE_LOOKUP 0 |
| 210 |
#ifndef CYTHON_USE_ASYNC_SLOTS |
| 211 |
#define CYTHON_USE_ASYNC_SLOTS 1 |
| 212 |
#endif |
| 213 |
#undef CYTHON_USE_PYLIST_INTERNALS |
| 214 |
#define CYTHON_USE_PYLIST_INTERNALS 0 |
| 215 |
#ifndef CYTHON_USE_UNICODE_INTERNALS |
| 216 |
#define CYTHON_USE_UNICODE_INTERNALS 1 |
| 217 |
#endif |
| 218 |
#undef CYTHON_USE_UNICODE_WRITER |
| 219 |
#define CYTHON_USE_UNICODE_WRITER 0 |
| 220 |
#undef CYTHON_USE_PYLONG_INTERNALS |
| 221 |
#define CYTHON_USE_PYLONG_INTERNALS 0 |
| 222 |
#ifndef CYTHON_AVOID_BORROWED_REFS |
| 223 |
#define CYTHON_AVOID_BORROWED_REFS 0 |
| 224 |
#endif |
| 225 |
#ifndef CYTHON_ASSUME_SAFE_MACROS |
| 226 |
#define CYTHON_ASSUME_SAFE_MACROS 1 |
| 227 |
#endif |
| 228 |
#ifndef CYTHON_UNPACK_METHODS |
| 229 |
#define CYTHON_UNPACK_METHODS 1 |
| 230 |
#endif |
| 231 |
#undef CYTHON_FAST_THREAD_STATE |
| 232 |
#define CYTHON_FAST_THREAD_STATE 0 |
| 233 |
#undef CYTHON_FAST_PYCALL |
| 234 |
#define CYTHON_FAST_PYCALL 0 |
| 235 |
#ifndef CYTHON_PEP489_MULTI_PHASE_INIT |
| 236 |
#define CYTHON_PEP489_MULTI_PHASE_INIT 1 |
| 237 |
#endif |
| 238 |
#ifndef CYTHON_USE_TP_FINALIZE |
| 239 |
#define CYTHON_USE_TP_FINALIZE 1 |
| 240 |
#endif |
| 241 |
#undef CYTHON_USE_DICT_VERSIONS |
| 242 |
#define CYTHON_USE_DICT_VERSIONS 0 |
| 243 |
#undef CYTHON_USE_EXC_INFO_STACK |
| 244 |
#define CYTHON_USE_EXC_INFO_STACK 0 |
| 245 |
#else |
| 246 |
#define CYTHON_COMPILING_IN_PYPY 0 |
| 247 |
#define CYTHON_COMPILING_IN_CPYTHON 1 |
| 248 |
#define CYTHON_COMPILING_IN_LIMITED_API 0 |
| 249 |
#define CYTHON_COMPILING_IN_GRAAL 0 |
| 250 |
#define CYTHON_COMPILING_IN_NOGIL 0 |
| 251 |
#ifndef CYTHON_USE_TYPE_SLOTS |
| 252 |
#define CYTHON_USE_TYPE_SLOTS 1 |
| 253 |
#endif |
| 254 |
#define CYTHON_USE_TYPE_SPECS 1 |
| 255 |
#ifndef CYTHON_USE_PYTYPE_LOOKUP |
| 256 |
#define CYTHON_USE_PYTYPE_LOOKUP 1 |
| 257 |
#endif |
| 258 |
#if PY_MAJOR_VERSION < 3 |
| 259 |
#undef CYTHON_USE_ASYNC_SLOTS |
| 260 |
#define CYTHON_USE_ASYNC_SLOTS 0 |
| 261 |
#elif !defined(CYTHON_USE_ASYNC_SLOTS) |
| 262 |
#define CYTHON_USE_ASYNC_SLOTS 1 |
| 263 |
#endif |
| 264 |
#ifndef CYTHON_USE_PYLONG_INTERNALS |
| 265 |
#define CYTHON_USE_PYLONG_INTERNALS 1 |
| 266 |
#endif |
| 267 |
#ifndef CYTHON_USE_PYLIST_INTERNALS |
| 268 |
#define CYTHON_USE_PYLIST_INTERNALS 1 |
| 269 |
#endif |
| 270 |
#ifndef CYTHON_USE_UNICODE_INTERNALS |
| 271 |
#define CYTHON_USE_UNICODE_INTERNALS 1 |
| 272 |
#endif |
| 273 |
#if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2 |
| 274 |
#undef CYTHON_USE_UNICODE_WRITER |
| 275 |
#define CYTHON_USE_UNICODE_WRITER 0 |
| 276 |
#elif !defined(CYTHON_USE_UNICODE_WRITER) |
| 277 |
#define CYTHON_USE_UNICODE_WRITER 1 |
| 278 |
#endif |
| 279 |
#ifndef CYTHON_AVOID_BORROWED_REFS |
| 280 |
#define CYTHON_AVOID_BORROWED_REFS 0 |
| 281 |
#endif |
| 282 |
#ifndef CYTHON_ASSUME_SAFE_MACROS |
| 283 |
#define CYTHON_ASSUME_SAFE_MACROS 1 |
| 284 |
#endif |
| 285 |
#ifndef CYTHON_UNPACK_METHODS |
| 286 |
#define CYTHON_UNPACK_METHODS 1 |
| 287 |
#endif |
| 288 |
#ifndef CYTHON_FAST_THREAD_STATE |
| 289 |
#define CYTHON_FAST_THREAD_STATE 1 |
| 290 |
#endif |
| 291 |
#ifndef CYTHON_FAST_GIL |
| 292 |
#define CYTHON_FAST_GIL (PY_MAJOR_VERSION < 3 || PY_VERSION_HEX >= 0x03060000 && PY_VERSION_HEX < 0x030C00A6) |
| 293 |
#endif |
| 294 |
#ifndef CYTHON_METH_FASTCALL |
| 295 |
#define CYTHON_METH_FASTCALL (PY_VERSION_HEX >= 0x030700A1) |
| 296 |
#endif |
| 297 |
#ifndef CYTHON_FAST_PYCALL |
| 298 |
#define CYTHON_FAST_PYCALL 1 |
| 299 |
#endif |
| 300 |
#ifndef CYTHON_PEP487_INIT_SUBCLASS |
| 301 |
#define CYTHON_PEP487_INIT_SUBCLASS 1 |
| 302 |
#endif |
| 303 |
#if PY_VERSION_HEX < 0x03050000 |
| 304 |
#undef CYTHON_PEP489_MULTI_PHASE_INIT |
| 305 |
#define CYTHON_PEP489_MULTI_PHASE_INIT 0 |
| 306 |
#elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) |
| 307 |
#define CYTHON_PEP489_MULTI_PHASE_INIT 1 |
| 308 |
#endif |
| 309 |
#ifndef CYTHON_USE_MODULE_STATE |
| 310 |
#define CYTHON_USE_MODULE_STATE 0 |
| 311 |
#endif |
| 312 |
#if PY_VERSION_HEX < 0x030400a1 |
| 313 |
#undef CYTHON_USE_TP_FINALIZE |
| 314 |
#define CYTHON_USE_TP_FINALIZE 0 |
| 315 |
#elif !defined(CYTHON_USE_TP_FINALIZE) |
| 316 |
#define CYTHON_USE_TP_FINALIZE 1 |
| 317 |
#endif |
| 318 |
#if PY_VERSION_HEX < 0x030600B1 |
| 319 |
#undef CYTHON_USE_DICT_VERSIONS |
| 320 |
#define CYTHON_USE_DICT_VERSIONS 0 |
| 321 |
#elif !defined(CYTHON_USE_DICT_VERSIONS) |
| 322 |
#define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX < 0x030C00A5) |
| 323 |
#endif |
| 324 |
#if PY_VERSION_HEX < 0x030700A3 |
| 325 |
#undef CYTHON_USE_EXC_INFO_STACK |
| 326 |
#define CYTHON_USE_EXC_INFO_STACK 0 |
| 327 |
#elif !defined(CYTHON_USE_EXC_INFO_STACK) |
| 328 |
#define CYTHON_USE_EXC_INFO_STACK 1 |
| 329 |
#endif |
| 330 |
#ifndef CYTHON_UPDATE_DESCRIPTOR_DOC |
| 331 |
#define CYTHON_UPDATE_DESCRIPTOR_DOC 1 |
| 332 |
#endif |
| 333 |
#endif |
| 334 |
#if !defined(CYTHON_FAST_PYCCALL) |
| 335 |
#define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) |
| 336 |
#endif |
| 337 |
#if !defined(CYTHON_VECTORCALL) |
| 338 |
#define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL && PY_VERSION_HEX >= 0x030800B1) |
| 339 |
#endif |
| 340 |
#define CYTHON_BACKPORT_VECTORCALL (CYTHON_METH_FASTCALL && PY_VERSION_HEX < 0x030800B1) |
| 341 |
#if CYTHON_USE_PYLONG_INTERNALS |
| 342 |
#if PY_MAJOR_VERSION < 3 |
| 343 |
#include "longintrepr.h" |
| 344 |
#endif |
| 345 |
#undef SHIFT |
| 346 |
#undef BASE |
| 347 |
#undef MASK |
| 348 |
#ifdef SIZEOF_VOID_P |
| 349 |
enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) }; |
| 350 |
#endif |
| 351 |
#endif |
| 352 |
#ifndef __has_attribute |
| 353 |
#define __has_attribute(x) 0 |
| 354 |
#endif |
| 355 |
#ifndef __has_cpp_attribute |
| 356 |
#define __has_cpp_attribute(x) 0 |
| 357 |
#endif |
| 358 |
#ifndef CYTHON_RESTRICT |
| 359 |
#if defined(__GNUC__) |
| 360 |
#define CYTHON_RESTRICT __restrict__ |
| 361 |
#elif defined(_MSC_VER) && _MSC_VER >= 1400 |
| 362 |
#define CYTHON_RESTRICT __restrict |
| 363 |
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L |
| 364 |
#define CYTHON_RESTRICT restrict |
| 365 |
#else |
| 366 |
#define CYTHON_RESTRICT |
| 367 |
#endif |
| 368 |
#endif |
| 369 |
#ifndef CYTHON_UNUSED |
| 370 |
#if defined(__cplusplus) |
| 371 |
|
| 372 |
|
| 373 |
#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) |
| 374 |
#if __has_cpp_attribute(maybe_unused) |
| 375 |
#define CYTHON_UNUSED [[maybe_unused]] |
| 376 |
#endif |
| 377 |
#endif |
| 378 |
#endif |
| 379 |
#endif |
| 380 |
#ifndef CYTHON_UNUSED |
| 381 |
# if defined(__GNUC__) |
| 382 |
# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) |
| 383 |
# define CYTHON_UNUSED __attribute__ ((__unused__)) |
| 384 |
# else |
| 385 |
# define CYTHON_UNUSED |
| 386 |
# endif |
| 387 |
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) |
| 388 |
# define CYTHON_UNUSED __attribute__ ((__unused__)) |
| 389 |
# else |
| 390 |
# define CYTHON_UNUSED |
| 391 |
# endif |
| 392 |
#endif |
| 393 |
#ifndef CYTHON_UNUSED_VAR |
| 394 |
# if defined(__cplusplus) |
| 395 |
template<class T> void CYTHON_UNUSED_VAR( const T& ) { } |
| 396 |
# else |
| 397 |
# define CYTHON_UNUSED_VAR(x) (void)(x) |
| 398 |
# endif |
| 399 |
#endif |
| 400 |
#ifndef CYTHON_MAYBE_UNUSED_VAR |
| 401 |
#define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x) |
| 402 |
#endif |
| 403 |
#ifndef CYTHON_NCP_UNUSED |
| 404 |
# if CYTHON_COMPILING_IN_CPYTHON |
| 405 |
# define CYTHON_NCP_UNUSED |
| 406 |
# else |
| 407 |
# define CYTHON_NCP_UNUSED CYTHON_UNUSED |
| 408 |
# endif |
| 409 |
#endif |
| 410 |
#ifndef CYTHON_USE_CPP_STD_MOVE |
| 411 |
#if defined(__cplusplus) && (\ |
| 412 |
__cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600)) |
| 413 |
#define CYTHON_USE_CPP_STD_MOVE 1 |
| 414 |
#else |
| 415 |
#define CYTHON_USE_CPP_STD_MOVE 0 |
| 416 |
#endif |
| 417 |
#endif |
| 418 |
#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) |
| 419 |
#ifdef _MSC_VER |
| 420 |
#ifndef _MSC_STDINT_H_ |
| 421 |
#if _MSC_VER < 1300 |
| 422 |
typedef unsigned char uint8_t; |
| 423 |
typedef unsigned short uint16_t; |
| 424 |
typedef unsigned int uint32_t; |
| 425 |
#else |
| 426 |
typedef unsigned __int8 uint8_t; |
| 427 |
typedef unsigned __int16 uint16_t; |
| 428 |
typedef unsigned __int32 uint32_t; |
| 429 |
#endif |
| 430 |
#endif |
| 431 |
#if _MSC_VER < 1300 |
| 432 |
#ifdef _WIN64 |
| 433 |
typedef unsigned long long __pyx_uintptr_t; |
| 434 |
#else |
| 435 |
typedef unsigned int __pyx_uintptr_t; |
| 436 |
#endif |
| 437 |
#else |
| 438 |
#ifdef _WIN64 |
| 439 |
typedef unsigned __int64 __pyx_uintptr_t; |
| 440 |
#else |
| 441 |
typedef unsigned __int32 __pyx_uintptr_t; |
| 442 |
#endif |
| 443 |
#endif |
| 444 |
#else |
| 445 |
#include <stdint.h> |
| 446 |
typedef uintptr_t __pyx_uintptr_t; |
| 447 |
#endif |
| 448 |
#ifndef CYTHON_FALLTHROUGH |
| 449 |
#if defined(__cplusplus) |
| 450 |
|
| 451 |
|
| 452 |
#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) |
| 453 |
#if __has_cpp_attribute(fallthrough) |
| 454 |
#define CYTHON_FALLTHROUGH [[fallthrough]] |
| 455 |
#endif |
| 456 |
#endif |
| 457 |
#ifndef CYTHON_FALLTHROUGH |
| 458 |
#if __has_cpp_attribute(clang::fallthrough) |
| 459 |
#define CYTHON_FALLTHROUGH [[clang::fallthrough]] |
| 460 |
#elif __has_cpp_attribute(gnu::fallthrough) |
| 461 |
#define CYTHON_FALLTHROUGH [[gnu::fallthrough]] |
| 462 |
#endif |
| 463 |
#endif |
| 464 |
#endif |
| 465 |
#ifndef CYTHON_FALLTHROUGH |
| 466 |
#if __has_attribute(fallthrough) |
| 467 |
#define CYTHON_FALLTHROUGH __attribute__((fallthrough)) |
| 468 |
#else |
| 469 |
#define CYTHON_FALLTHROUGH |
| 470 |
#endif |
| 471 |
#endif |
| 472 |
#if defined(__clang__) && defined(__apple_build_version__) |
| 473 |
#if __apple_build_version__ < 7000000 |
| 474 |
#undef CYTHON_FALLTHROUGH |
| 475 |
#define CYTHON_FALLTHROUGH |
| 476 |
#endif |
| 477 |
#endif |
| 478 |
#endif |
| 479 |
#ifdef __cplusplus |
| 480 |
template <typename T> |
| 481 |
struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);}; |
| 482 |
#define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL<type>::value) |
| 483 |
#else |
| 484 |
#define __PYX_IS_UNSIGNED(type) (((type)-1) > 0) |
| 485 |
#endif |
| 486 |
#if CYTHON_COMPILING_IN_PYPY == 1 |
| 487 |
#define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x030A0000) |
| 488 |
#else |
| 489 |
#define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000) |
| 490 |
#endif |
| 491 |
#define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer)) |
| 492 |
|
| 493 |
#ifndef CYTHON_INLINE |
| 494 |
#if defined(__clang__) |
| 495 |
#define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) |
| 496 |
#elif defined(__GNUC__) |
| 497 |
#define CYTHON_INLINE __inline__ |
| 498 |
#elif defined(_MSC_VER) |
| 499 |
#define CYTHON_INLINE __inline |
| 500 |
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L |
| 501 |
#define CYTHON_INLINE inline |
| 502 |
#else |
| 503 |
#define CYTHON_INLINE |
| 504 |
#endif |
| 505 |
#endif |
| 506 |
|
| 507 |
#define __PYX_BUILD_PY_SSIZE_T "n" |
| 508 |
#define CYTHON_FORMAT_SSIZE_T "z" |
| 509 |
#if PY_MAJOR_VERSION < 3 |
| 510 |
#define __Pyx_BUILTIN_MODULE_NAME "__builtin__" |
| 511 |
#define __Pyx_DefaultClassType PyClass_Type |
| 512 |
#define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ |
| 513 |
PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) |
| 514 |
#else |
| 515 |
#define __Pyx_BUILTIN_MODULE_NAME "builtins" |
| 516 |
#define __Pyx_DefaultClassType PyType_Type |
| 517 |
#if CYTHON_COMPILING_IN_LIMITED_API |
| 518 |
static CYTHON_INLINE PyObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f, |
| 519 |
PyObject *code, PyObject *c, PyObject* n, PyObject *v, |
| 520 |
PyObject *fv, PyObject *cell, PyObject* fn, |
| 521 |
PyObject *name, int fline, PyObject *lnos) { |
| 522 |
PyObject *exception_table = NULL; |
| 523 |
PyObject *types_module=NULL, *code_type=NULL, *result=NULL; |
| 524 |
PyObject *version_info; |
| 525 |
PyObject *py_minor_version = NULL; |
| 526 |
long minor_version = 0; |
| 527 |
PyObject *type, *value, *traceback; |
| 528 |
PyErr_Fetch(&type, &value, &traceback); |
| 529 |
#if __PYX_LIMITED_VERSION_HEX >= 0x030B0000 |
| 530 |
minor_version = 11; |
| 531 |
#else |
| 532 |
if (!(version_info = PySys_GetObject("version_info"))) goto end; |
| 533 |
if (!(py_minor_version = PySequence_GetItem(version_info, 1))) goto end; |
| 534 |
minor_version = PyLong_AsLong(py_minor_version); |
| 535 |
if (minor_version == -1 && PyErr_Occurred()) goto end; |
| 536 |
#endif |
| 537 |
if (!(types_module = PyImport_ImportModule("types"))) goto end; |
| 538 |
if (!(code_type = PyObject_GetAttrString(types_module, "CodeType"))) goto end; |
| 539 |
if (minor_version <= 7) { |
| 540 |
(void)p; |
| 541 |
result = PyObject_CallFunction(code_type, "iiiiiOOOOOOiOO", a, k, l, s, f, code, |
| 542 |
c, n, v, fn, name, fline, lnos, fv, cell); |
| 543 |
} else if (minor_version <= 10) { |
| 544 |
result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOiOO", a,p, k, l, s, f, code, |
| 545 |
c, n, v, fn, name, fline, lnos, fv, cell); |
| 546 |
} else { |
| 547 |
if (!(exception_table = PyBytes_FromStringAndSize(NULL, 0))) goto end; |
| 548 |
result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOOiOO", a,p, k, l, s, f, code, |
| 549 |
c, n, v, fn, name, name, fline, lnos, exception_table, fv, cell); |
| 550 |
} |
| 551 |
end: |
| 552 |
Py_XDECREF(code_type); |
| 553 |
Py_XDECREF(exception_table); |
| 554 |
Py_XDECREF(types_module); |
| 555 |
Py_XDECREF(py_minor_version); |
| 556 |
if (type) { |
| 557 |
PyErr_Restore(type, value, traceback); |
| 558 |
} |
| 559 |
return result; |
| 560 |
} |
| 561 |
#ifndef CO_OPTIMIZED |
| 562 |
#define CO_OPTIMIZED 0x0001 |
| 563 |
#endif |
| 564 |
#ifndef CO_NEWLOCALS |
| 565 |
#define CO_NEWLOCALS 0x0002 |
| 566 |
#endif |
| 567 |
#ifndef CO_VARARGS |
| 568 |
#define CO_VARARGS 0x0004 |
| 569 |
#endif |
| 570 |
#ifndef CO_VARKEYWORDS |
| 571 |
#define CO_VARKEYWORDS 0x0008 |
| 572 |
#endif |
| 573 |
#ifndef CO_ASYNC_GENERATOR |
| 574 |
#define CO_ASYNC_GENERATOR 0x0200 |
| 575 |
#endif |
| 576 |
#ifndef CO_GENERATOR |
| 577 |
#define CO_GENERATOR 0x0020 |
| 578 |
#endif |
| 579 |
#ifndef CO_COROUTINE |
| 580 |
#define CO_COROUTINE 0x0080 |
| 581 |
#endif |
| 582 |
#elif PY_VERSION_HEX >= 0x030B0000 |
| 583 |
static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f, |
| 584 |
PyObject *code, PyObject *c, PyObject* n, PyObject *v, |
| 585 |
PyObject *fv, PyObject *cell, PyObject* fn, |
| 586 |
PyObject *name, int fline, PyObject *lnos) { |
| 587 |
PyCodeObject *result; |
| 588 |
PyObject *empty_bytes = PyBytes_FromStringAndSize("", 0); |
| 589 |
if (!empty_bytes) return NULL; |
| 590 |
result = |
| 591 |
#if PY_VERSION_HEX >= 0x030C0000 |
| 592 |
PyUnstable_Code_NewWithPosOnlyArgs |
| 593 |
#else |
| 594 |
PyCode_NewWithPosOnlyArgs |
| 595 |
#endif |
| 596 |
(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, name, fline, lnos, empty_bytes); |
| 597 |
Py_DECREF(empty_bytes); |
| 598 |
return result; |
| 599 |
} |
| 600 |
#elif PY_VERSION_HEX >= 0x030800B2 && !CYTHON_COMPILING_IN_PYPY |
| 601 |
#define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ |
| 602 |
PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) |
| 603 |
#else |
| 604 |
#define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ |
| 605 |
PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) |
| 606 |
#endif |
| 607 |
#endif |
| 608 |
#if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE) |
| 609 |
#define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type) |
| 610 |
#else |
| 611 |
#define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type)) |
| 612 |
#endif |
| 613 |
#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is) |
| 614 |
#define __Pyx_Py_Is(x, y) Py_Is(x, y) |
| 615 |
#else |
| 616 |
#define __Pyx_Py_Is(x, y) ((x) == (y)) |
| 617 |
#endif |
| 618 |
#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone) |
| 619 |
#define __Pyx_Py_IsNone(ob) Py_IsNone(ob) |
| 620 |
#else |
| 621 |
#define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None) |
| 622 |
#endif |
| 623 |
#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue) |
| 624 |
#define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob) |
| 625 |
#else |
| 626 |
#define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True) |
| 627 |
#endif |
| 628 |
#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse) |
| 629 |
#define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob) |
| 630 |
#else |
| 631 |
#define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False) |
| 632 |
#endif |
| 633 |
#define __Pyx_NoneAsNull(obj) (__Pyx_Py_IsNone(obj) ? NULL : (obj)) |
| 634 |
#if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY |
| 635 |
#define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o) |
| 636 |
#else |
| 637 |
#define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o) |
| 638 |
#endif |
| 639 |
#ifndef CO_COROUTINE |
| 640 |
#define CO_COROUTINE 0x80 |
| 641 |
#endif |
| 642 |
#ifndef CO_ASYNC_GENERATOR |
| 643 |
#define CO_ASYNC_GENERATOR 0x200 |
| 644 |
#endif |
| 645 |
#ifndef Py_TPFLAGS_CHECKTYPES |
| 646 |
#define Py_TPFLAGS_CHECKTYPES 0 |
| 647 |
#endif |
| 648 |
#ifndef Py_TPFLAGS_HAVE_INDEX |
| 649 |
#define Py_TPFLAGS_HAVE_INDEX 0 |
| 650 |
#endif |
| 651 |
#ifndef Py_TPFLAGS_HAVE_NEWBUFFER |
| 652 |
#define Py_TPFLAGS_HAVE_NEWBUFFER 0 |
| 653 |
#endif |
| 654 |
#ifndef Py_TPFLAGS_HAVE_FINALIZE |
| 655 |
#define Py_TPFLAGS_HAVE_FINALIZE 0 |
| 656 |
#endif |
| 657 |
#ifndef Py_TPFLAGS_SEQUENCE |
| 658 |
#define Py_TPFLAGS_SEQUENCE 0 |
| 659 |
#endif |
| 660 |
#ifndef Py_TPFLAGS_MAPPING |
| 661 |
#define Py_TPFLAGS_MAPPING 0 |
| 662 |
#endif |
| 663 |
#ifndef METH_STACKLESS |
| 664 |
#define METH_STACKLESS 0 |
| 665 |
#endif |
| 666 |
#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL) |
| 667 |
#ifndef METH_FASTCALL |
| 668 |
#define METH_FASTCALL 0x80 |
| 669 |
#endif |
| 670 |
typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs); |
| 671 |
typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args, |
| 672 |
Py_ssize_t nargs, PyObject *kwnames); |
| 673 |
#else |
| 674 |
#define __Pyx_PyCFunctionFast _PyCFunctionFast |
| 675 |
#define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords |
| 676 |
#endif |
| 677 |
#if CYTHON_METH_FASTCALL |
| 678 |
#define __Pyx_METH_FASTCALL METH_FASTCALL |
| 679 |
#define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast |
| 680 |
#define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords |
| 681 |
#else |
| 682 |
#define __Pyx_METH_FASTCALL METH_VARARGS |
| 683 |
#define __Pyx_PyCFunction_FastCall PyCFunction |
| 684 |
#define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords |
| 685 |
#endif |
| 686 |
#if CYTHON_VECTORCALL |
| 687 |
#define __pyx_vectorcallfunc vectorcallfunc |
| 688 |
#define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET |
| 689 |
#define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n)) |
| 690 |
#elif CYTHON_BACKPORT_VECTORCALL |
| 691 |
typedef PyObject *(*__pyx_vectorcallfunc)(PyObject *callable, PyObject *const *args, |
| 692 |
size_t nargsf, PyObject *kwnames); |
| 693 |
#define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET ((size_t)1 << (8 * sizeof(size_t) - 1)) |
| 694 |
#define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(((size_t)(n)) & ~__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)) |
| 695 |
#else |
| 696 |
#define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0 |
| 697 |
#define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n)) |
| 698 |
#endif |
| 699 |
#if __PYX_LIMITED_VERSION_HEX < 0x030900B1 |
| 700 |
#define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b)) |
| 701 |
typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *); |
| 702 |
#else |
| 703 |
#define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b) |
| 704 |
#define __Pyx_PyCMethod PyCMethod |
| 705 |
#endif |
| 706 |
#ifndef METH_METHOD |
| 707 |
#define METH_METHOD 0x200 |
| 708 |
#endif |
| 709 |
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) |
| 710 |
#define PyObject_Malloc(s) PyMem_Malloc(s) |
| 711 |
#define PyObject_Free(p) PyMem_Free(p) |
| 712 |
#define PyObject_Realloc(p) PyMem_Realloc(p) |
| 713 |
#endif |
| 714 |
#if CYTHON_COMPILING_IN_LIMITED_API |
| 715 |
#define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) |
| 716 |
#define __Pyx_PyFrame_SetLineNumber(frame, lineno) |
| 717 |
#else |
| 718 |
#define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) |
| 719 |
#define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) |
| 720 |
#endif |
| 721 |
#if CYTHON_COMPILING_IN_LIMITED_API |
| 722 |
#define __Pyx_PyThreadState_Current PyThreadState_Get() |
| 723 |
#elif !CYTHON_FAST_THREAD_STATE |
| 724 |
#define __Pyx_PyThreadState_Current PyThreadState_GET() |
| 725 |
#elif PY_VERSION_HEX >= 0x03060000 |
| 726 |
#define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() |
| 727 |
#elif PY_VERSION_HEX >= 0x03000000 |
| 728 |
#define __Pyx_PyThreadState_Current PyThreadState_GET() |
| 729 |
#else |
| 730 |
#define __Pyx_PyThreadState_Current _PyThreadState_Current |
| 731 |
#endif |
| 732 |
#if CYTHON_COMPILING_IN_LIMITED_API |
| 733 |
static CYTHON_INLINE void *__Pyx_PyModule_GetState(PyObject *op) |
| 734 |
{ |
| 735 |
void *result; |
| 736 |
result = PyModule_GetState(op); |
| 737 |
if (!result) |
| 738 |
Py_FatalError("Couldn't find the module state"); |
| 739 |
return result; |
| 740 |
} |
| 741 |
#endif |
| 742 |
#define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE(obj), name, func_ctype) |
| 743 |
#if CYTHON_COMPILING_IN_LIMITED_API |
| 744 |
#define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name)) |
| 745 |
#else |
| 746 |
#define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name) |
| 747 |
#endif |
| 748 |
#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT) |
| 749 |
#include "pythread.h" |
| 750 |
#define Py_tss_NEEDS_INIT 0 |
| 751 |
typedef int Py_tss_t; |
| 752 |
static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) { |
| 753 |
*key = PyThread_create_key(); |
| 754 |
return 0; |
| 755 |
} |
| 756 |
static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) { |
| 757 |
Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t)); |
| 758 |
*key = Py_tss_NEEDS_INIT; |
| 759 |
return key; |
| 760 |
} |
| 761 |
static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) { |
| 762 |
PyObject_Free(key); |
| 763 |
} |
| 764 |
static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) { |
| 765 |
return *key != Py_tss_NEEDS_INIT; |
| 766 |
} |
| 767 |
static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) { |
| 768 |
PyThread_delete_key(*key); |
| 769 |
*key = Py_tss_NEEDS_INIT; |
| 770 |
} |
| 771 |
static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) { |
| 772 |
return PyThread_set_key_value(*key, value); |
| 773 |
} |
| 774 |
static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { |
| 775 |
return PyThread_get_key_value(*key); |
| 776 |
} |
| 777 |
#endif |
| 778 |
#if PY_MAJOR_VERSION < 3 |
| 779 |
#if CYTHON_COMPILING_IN_PYPY |
| 780 |
#if PYPY_VERSION_NUM < 0x07030600 |
| 781 |
#if defined(__cplusplus) && __cplusplus >= 201402L |
| 782 |
[[deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")]] |
| 783 |
#elif defined(__GNUC__) || defined(__clang__) |
| 784 |
__attribute__ ((__deprecated__("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6"))) |
| 785 |
#elif defined(_MSC_VER) |
| 786 |
__declspec(deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")) |
| 787 |
#endif |
| 788 |
static CYTHON_INLINE int PyGILState_Check(void) { |
| 789 |
return 0; |
| 790 |
} |
| 791 |
#else |
| 792 |
#endif |
| 793 |
#else |
| 794 |
static CYTHON_INLINE int PyGILState_Check(void) { |
| 795 |
PyThreadState * tstate = _PyThreadState_Current; |
| 796 |
return tstate && (tstate == PyGILState_GetThisThreadState()); |
| 797 |
} |
| 798 |
#endif |
| 799 |
#endif |
| 800 |
#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) |
| 801 |
#define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) |
| 802 |
#else |
| 803 |
#define __Pyx_PyDict_NewPresized(n) PyDict_New() |
| 804 |
#endif |
| 805 |
#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION |
| 806 |
#define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) |
| 807 |
#define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) |
| 808 |
#else |
| 809 |
#define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) |
| 810 |
#define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) |
| 811 |
#endif |
| 812 |
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030600B4 && CYTHON_USE_UNICODE_INTERNALS |
| 813 |
#define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) |
| 814 |
static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) { |
| 815 |
PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name); |
| 816 |
if (res == NULL) PyErr_Clear(); |
| 817 |
return res; |
| 818 |
} |
| 819 |
#elif PY_MAJOR_VERSION >= 3 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000) |
| 820 |
#define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError |
| 821 |
#define __Pyx_PyDict_GetItemStr PyDict_GetItem |
| 822 |
#else |
| 823 |
static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) { |
| 824 |
#if CYTHON_COMPILING_IN_PYPY |
| 825 |
return PyDict_GetItem(dict, name); |
| 826 |
#else |
| 827 |
PyDictEntry *ep; |
| 828 |
PyDictObject *mp = (PyDictObject*) dict; |
| 829 |
long hash = ((PyStringObject *) name)->ob_shash; |
| 830 |
assert(hash != -1); |
| 831 |
ep = (mp->ma_lookup)(mp, name, hash); |
| 832 |
if (ep == NULL) { |
| 833 |
return NULL; |
| 834 |
} |
| 835 |
return ep->me_value; |
| 836 |
#endif |
| 837 |
} |
| 838 |
#define __Pyx_PyDict_GetItemStr PyDict_GetItem |
| 839 |
#endif |
| 840 |
#if CYTHON_USE_TYPE_SLOTS |
| 841 |
#define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags) |
| 842 |
#define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0) |
| 843 |
#define __Pyx_PyObject_GetIterNextFunc(obj) (Py_TYPE(obj)->tp_iternext) |
| 844 |
#else |
| 845 |
#define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp)) |
| 846 |
#define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature) |
| 847 |
#define __Pyx_PyObject_GetIterNextFunc(obj) PyIter_Next |
| 848 |
#endif |
| 849 |
#if CYTHON_USE_TYPE_SPECS && PY_VERSION_HEX >= 0x03080000 |
| 850 |
#define __Pyx_PyHeapTypeObject_GC_Del(obj) {\ |
| 851 |
PyTypeObject *type = Py_TYPE(obj);\ |
| 852 |
assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\ |
| 853 |
PyObject_GC_Del(obj);\ |
| 854 |
Py_DECREF(type);\ |
| 855 |
} |
| 856 |
#else |
| 857 |
#define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj) |
| 858 |
#endif |
| 859 |
#if CYTHON_COMPILING_IN_LIMITED_API |
| 860 |
#define CYTHON_PEP393_ENABLED 1 |
| 861 |
#define __Pyx_PyUnicode_READY(op) (0) |
| 862 |
#define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GetLength(u) |
| 863 |
#define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i) |
| 864 |
#define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111U) |
| 865 |
#define __Pyx_PyUnicode_KIND(u) ((void)u, (0)) |
| 866 |
#define __Pyx_PyUnicode_DATA(u) ((void*)u) |
| 867 |
#define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i)) |
| 868 |
#define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u)) |
| 869 |
#elif PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) |
| 870 |
#define CYTHON_PEP393_ENABLED 1 |
| 871 |
#if PY_VERSION_HEX >= 0x030C0000 |
| 872 |
#define __Pyx_PyUnicode_READY(op) (0) |
| 873 |
#else |
| 874 |
#define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ |
| 875 |
0 : _PyUnicode_Ready((PyObject *)(op))) |
| 876 |
#endif |
| 877 |
#define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) |
| 878 |
#define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) |
| 879 |
#define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) |
| 880 |
#define __Pyx_PyUnicode_KIND(u) ((int)PyUnicode_KIND(u)) |
| 881 |
#define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) |
| 882 |
#define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) |
| 883 |
#define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, (Py_UCS4) ch) |
| 884 |
#if PY_VERSION_HEX >= 0x030C0000 |
| 885 |
#define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) |
| 886 |
#else |
| 887 |
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000 |
| 888 |
#define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length)) |
| 889 |
#else |
| 890 |
#define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) |
| 891 |
#endif |
| 892 |
#endif |
| 893 |
#else |
| 894 |
#define CYTHON_PEP393_ENABLED 0 |
| 895 |
#define PyUnicode_1BYTE_KIND 1 |
| 896 |
#define PyUnicode_2BYTE_KIND 2 |
| 897 |
#define PyUnicode_4BYTE_KIND 4 |
| 898 |
#define __Pyx_PyUnicode_READY(op) (0) |
| 899 |
#define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) |
| 900 |
#define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) |
| 901 |
#define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535U : 1114111U) |
| 902 |
#define __Pyx_PyUnicode_KIND(u) ((int)sizeof(Py_UNICODE)) |
| 903 |
#define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) |
| 904 |
#define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) |
| 905 |
#define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = (Py_UNICODE) ch) |
| 906 |
#define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) |
| 907 |
#endif |
| 908 |
#if CYTHON_COMPILING_IN_PYPY |
| 909 |
#define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) |
| 910 |
#define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) |
| 911 |
#else |
| 912 |
#define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) |
| 913 |
#define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ |
| 914 |
PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) |
| 915 |
#endif |
| 916 |
#if CYTHON_COMPILING_IN_PYPY |
| 917 |
#if !defined(PyUnicode_DecodeUnicodeEscape) |
| 918 |
#define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors) |
| 919 |
#endif |
| 920 |
#if !defined(PyUnicode_Contains) || (PY_MAJOR_VERSION == 2 && PYPY_VERSION_NUM < 0x07030500) |
| 921 |
#undef PyUnicode_Contains |
| 922 |
#define PyUnicode_Contains(u, s) PySequence_Contains(u, s) |
| 923 |
#endif |
| 924 |
#if !defined(PyByteArray_Check) |
| 925 |
#define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) |
| 926 |
#endif |
| 927 |
#if !defined(PyObject_Format) |
| 928 |
#define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) |
| 929 |
#endif |
| 930 |
#endif |
| 931 |
#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) |
| 932 |
#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) |
| 933 |
#if PY_MAJOR_VERSION >= 3 |
| 934 |
#define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) |
| 935 |
#else |
| 936 |
#define __Pyx_PyString_Format(a, b) PyString_Format(a, b) |
| 937 |
#endif |
| 938 |
#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII) |
| 939 |
#define PyObject_ASCII(o) PyObject_Repr(o) |
| 940 |
#endif |
| 941 |
#if PY_MAJOR_VERSION >= 3 |
| 942 |
#define PyBaseString_Type PyUnicode_Type |
| 943 |
#define PyStringObject PyUnicodeObject |
| 944 |
#define PyString_Type PyUnicode_Type |
| 945 |
#define PyString_Check PyUnicode_Check |
| 946 |
#define PyString_CheckExact PyUnicode_CheckExact |
| 947 |
#ifndef PyObject_Unicode |
| 948 |
#define PyObject_Unicode PyObject_Str |
| 949 |
#endif |
| 950 |
#endif |
| 951 |
#if PY_MAJOR_VERSION >= 3 |
| 952 |
#define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) |
| 953 |
#define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) |
| 954 |
#else |
| 955 |
#define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) |
| 956 |
#define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) |
| 957 |
#endif |
| 958 |
#if CYTHON_COMPILING_IN_CPYTHON |
| 959 |
#define __Pyx_PySequence_ListKeepNew(obj)\ |
| 960 |
(likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj)) |
| 961 |
#else |
| 962 |
#define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj) |
| 963 |
#endif |
| 964 |
#ifndef PySet_CheckExact |
| 965 |
#define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type) |
| 966 |
#endif |
| 967 |
#if PY_VERSION_HEX >= 0x030900A4 |
| 968 |
#define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt) |
| 969 |
#define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size) |
| 970 |
#else |
| 971 |
#define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt) |
| 972 |
#define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size) |
| 973 |
#endif |
| 974 |
#if CYTHON_ASSUME_SAFE_MACROS |
| 975 |
#define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) |
| 976 |
#define __Pyx_PyTuple_SET_ITEM(o, i, v) (PyTuple_SET_ITEM(o, i, v), (0)) |
| 977 |
#else |
| 978 |
#define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq) |
| 979 |
#define __Pyx_PyTuple_SET_ITEM(o, i, v) PyTuple_SetItem(o, i, v) |
| 980 |
#endif |
| 981 |
#if CYTHON_COMPILING_IN_LIMITED_API |
| 982 |
#define __Pyx_PySequence_ITEM(o, i) PySequence_GetItem(o, i) |
| 983 |
#else |
| 984 |
#define __Pyx_PySequence_ITEM(o, i) PySequence_ITEM(o, i) |
| 985 |
#endif |
| 986 |
#if PY_MAJOR_VERSION >= 3 |
| 987 |
#define PyIntObject PyLongObject |
| 988 |
#define PyInt_Type PyLong_Type |
| 989 |
#define PyInt_Check(op) PyLong_Check(op) |
| 990 |
#define PyInt_CheckExact(op) PyLong_CheckExact(op) |
| 991 |
#define __Pyx_Py3Int_Check(op) PyLong_Check(op) |
| 992 |
#define __Pyx_Py3Int_CheckExact(op) PyLong_CheckExact(op) |
| 993 |
#define PyInt_FromString PyLong_FromString |
| 994 |
#define PyInt_FromUnicode PyLong_FromUnicode |
| 995 |
#define PyInt_FromLong PyLong_FromLong |
| 996 |
#define PyInt_FromSize_t PyLong_FromSize_t |
| 997 |
#define PyInt_FromSsize_t PyLong_FromSsize_t |
| 998 |
#define PyInt_AsLong PyLong_AsLong |
| 999 |
#define PyInt_AS_LONG PyLong_AS_LONG |
| 1000 |
#define PyInt_AsSsize_t PyLong_AsSsize_t |
| 1001 |
#define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask |
| 1002 |
#define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask |
| 1003 |
#define PyNumber_Int PyNumber_Long |
| 1004 |
#else |
| 1005 |
#define __Pyx_Py3Int_Check(op) (PyLong_Check(op) || PyInt_Check(op)) |
| 1006 |
#define __Pyx_Py3Int_CheckExact(op) (PyLong_CheckExact(op) || PyInt_CheckExact(op)) |
| 1007 |
#endif |
| 1008 |
#if PY_MAJOR_VERSION >= 3 |
| 1009 |
#define PyBoolObject PyLongObject |
| 1010 |
#endif |
| 1011 |
#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY |
| 1012 |
#ifndef PyUnicode_InternFromString |
| 1013 |
#define PyUnicode_InternFromString(s) PyUnicode_FromString(s) |
| 1014 |
#endif |
| 1015 |
#endif |
| 1016 |
#if PY_VERSION_HEX < 0x030200A4 |
| 1017 |
typedef long Py_hash_t; |
| 1018 |
#define __Pyx_PyInt_FromHash_t PyInt_FromLong |
| 1019 |
#define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t |
| 1020 |
#else |
| 1021 |
#define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t |
| 1022 |
#define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t |
| 1023 |
#endif |
| 1024 |
#if CYTHON_USE_ASYNC_SLOTS |
| 1025 |
#if PY_VERSION_HEX >= 0x030500B1 |
| 1026 |
#define __Pyx_PyAsyncMethodsStruct PyAsyncMethods |
| 1027 |
#define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) |
| 1028 |
#else |
| 1029 |
#define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) |
| 1030 |
#endif |
| 1031 |
#else |
| 1032 |
#define __Pyx_PyType_AsAsync(obj) NULL |
| 1033 |
#endif |
| 1034 |
#ifndef __Pyx_PyAsyncMethodsStruct |
| 1035 |
typedef struct { |
| 1036 |
unaryfunc am_await; |
| 1037 |
unaryfunc am_aiter; |
| 1038 |
unaryfunc am_anext; |
| 1039 |
} __Pyx_PyAsyncMethodsStruct; |
| 1040 |
#endif |
| 1041 |
|
| 1042 |
#if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS) |
| 1043 |
#if !defined(_USE_MATH_DEFINES) |
| 1044 |
#define _USE_MATH_DEFINES |
| 1045 |
#endif |
| 1046 |
#endif |
| 1047 |
#include <math.h> |
| 1048 |
#ifdef NAN |
| 1049 |
#define __PYX_NAN() ((float) NAN) |
| 1050 |
#else |
| 1051 |
static CYTHON_INLINE float __PYX_NAN() { |
| 1052 |
float value; |
| 1053 |
memset(&value, 0xFF, sizeof(value)); |
| 1054 |
return value; |
| 1055 |
} |
| 1056 |
#endif |
| 1057 |
#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) |
| 1058 |
#define __Pyx_truncl trunc |
| 1059 |
#else |
| 1060 |
#define __Pyx_truncl truncl |
| 1061 |
#endif |
| 1062 |
|
| 1063 |
#define __PYX_MARK_ERR_POS(f_index, lineno) \ |
| 1064 |
{ __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; } |
| 1065 |
#define __PYX_ERR(f_index, lineno, Ln_error) \ |
| 1066 |
{ __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; } |
| 1067 |
|
| 1068 |
#ifdef CYTHON_EXTERN_C |
| 1069 |
#undef __PYX_EXTERN_C |
| 1070 |
#define __PYX_EXTERN_C CYTHON_EXTERN_C |
| 1071 |
#elif defined(__PYX_EXTERN_C) |
| 1072 |
#ifdef _MSC_VER |
| 1073 |
#pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.") |
| 1074 |
#else |
| 1075 |
#warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead. |
| 1076 |
#endif |
| 1077 |
#else |
| 1078 |
#ifdef __cplusplus |
| 1079 |
#define __PYX_EXTERN_C extern "C" |
| 1080 |
#else |
| 1081 |
#define __PYX_EXTERN_C extern |
| 1082 |
#endif |
| 1083 |
#endif |
| 1084 |
|
| 1085 |
#define __PYX_HAVE__test_func |
| 1086 |
#define __PYX_HAVE_API__test_func |
| 1087 |
|
| 1088 |
#ifdef _OPENMP |
| 1089 |
#include <omp.h> |
| 1090 |
#endif |
| 1091 |
|
| 1092 |
#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS) |
| 1093 |
#define CYTHON_WITHOUT_ASSERTIONS |
| 1094 |
#endif |
| 1095 |
|
| 1096 |
typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding; |
| 1097 |
const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; |
| 1098 |
|
| 1099 |
#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 |
| 1100 |
#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0 |
| 1101 |
#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8) |
| 1102 |
#define __PYX_DEFAULT_STRING_ENCODING "" |
| 1103 |
#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString |
| 1104 |
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize |
| 1105 |
#define __Pyx_uchar_cast(c) ((unsigned char)c) |
| 1106 |
#define __Pyx_long_cast(x) ((long)x) |
| 1107 |
#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ |
| 1108 |
(sizeof(type) < sizeof(Py_ssize_t)) ||\ |
| 1109 |
(sizeof(type) > sizeof(Py_ssize_t) &&\ |
| 1110 |
likely(v < (type)PY_SSIZE_T_MAX ||\ |
| 1111 |
v == (type)PY_SSIZE_T_MAX) &&\ |
| 1112 |
(!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ |
| 1113 |
v == (type)PY_SSIZE_T_MIN))) ||\ |
| 1114 |
(sizeof(type) == sizeof(Py_ssize_t) &&\ |
| 1115 |
(is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ |
| 1116 |
v == (type)PY_SSIZE_T_MAX))) ) |
| 1117 |
static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) { |
| 1118 |
return (size_t) i < (size_t) limit; |
| 1119 |
} |
| 1120 |
#if defined (__cplusplus) && __cplusplus >= 201103L |
| 1121 |
#include <cstdlib> |
| 1122 |
#define __Pyx_sst_abs(value) std::abs(value) |
| 1123 |
#elif SIZEOF_INT >= SIZEOF_SIZE_T |
| 1124 |
#define __Pyx_sst_abs(value) abs(value) |
| 1125 |
#elif SIZEOF_LONG >= SIZEOF_SIZE_T |
| 1126 |
#define __Pyx_sst_abs(value) labs(value) |
| 1127 |
#elif defined (_MSC_VER) |
| 1128 |
#define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value)) |
| 1129 |
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L |
| 1130 |
#define __Pyx_sst_abs(value) llabs(value) |
| 1131 |
#elif defined (__GNUC__) |
| 1132 |
#define __Pyx_sst_abs(value) __builtin_llabs(value) |
| 1133 |
#else |
| 1134 |
#define __Pyx_sst_abs(value) ((value<0) ? -value : value) |
| 1135 |
#endif |
| 1136 |
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*); |
| 1137 |
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); |
| 1138 |
#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s)) |
| 1139 |
#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) |
| 1140 |
#define __Pyx_PyBytes_FromString PyBytes_FromString |
| 1141 |
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize |
| 1142 |
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); |
| 1143 |
#if PY_MAJOR_VERSION < 3 |
| 1144 |
#define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString |
| 1145 |
#define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize |
| 1146 |
#else |
| 1147 |
#define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString |
| 1148 |
#define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize |
| 1149 |
#endif |
| 1150 |
#define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s)) |
| 1151 |
#define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s)) |
| 1152 |
#define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s)) |
| 1153 |
#define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) |
| 1154 |
#define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) |
| 1155 |
#define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) |
| 1156 |
#define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) |
| 1157 |
#define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) |
| 1158 |
#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) |
| 1159 |
#define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) |
| 1160 |
#define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) |
| 1161 |
#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) |
| 1162 |
#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) |
| 1163 |
#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) |
| 1164 |
#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) |
| 1165 |
#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) |
| 1166 |
#if CYTHON_COMPILING_IN_LIMITED_API |
| 1167 |
static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const wchar_t *u) |
| 1168 |
{ |
| 1169 |
const wchar_t *u_end = u; |
| 1170 |
while (*u_end++) ; |
| 1171 |
return (size_t)(u_end - u - 1); |
| 1172 |
} |
| 1173 |
#else |
| 1174 |
static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) |
| 1175 |
{ |
| 1176 |
const Py_UNICODE *u_end = u; |
| 1177 |
while (*u_end++) ; |
| 1178 |
return (size_t)(u_end - u - 1); |
| 1179 |
} |
| 1180 |
#endif |
| 1181 |
#define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o) |
| 1182 |
#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) |
| 1183 |
#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode |
| 1184 |
#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode |
| 1185 |
#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) |
| 1186 |
#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) |
| 1187 |
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b); |
| 1188 |
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); |
| 1189 |
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*); |
| 1190 |
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); |
| 1191 |
#define __Pyx_PySequence_Tuple(obj)\ |
| 1192 |
(likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) |
| 1193 |
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); |
| 1194 |
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); |
| 1195 |
static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); |
| 1196 |
#if CYTHON_ASSUME_SAFE_MACROS |
| 1197 |
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) |
| 1198 |
#else |
| 1199 |
#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) |
| 1200 |
#endif |
| 1201 |
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) |
| 1202 |
#if PY_MAJOR_VERSION >= 3 |
| 1203 |
#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) |
| 1204 |
#else |
| 1205 |
#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) |
| 1206 |
#endif |
| 1207 |
#if CYTHON_USE_PYLONG_INTERNALS |
| 1208 |
#if PY_VERSION_HEX >= 0x030C00A7 |
| 1209 |
#ifndef _PyLong_SIGN_MASK |
| 1210 |
#define _PyLong_SIGN_MASK 3 |
| 1211 |
#endif |
| 1212 |
#ifndef _PyLong_NON_SIZE_BITS |
| 1213 |
#define _PyLong_NON_SIZE_BITS 3 |
| 1214 |
#endif |
| 1215 |
#define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK) |
| 1216 |
#define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0) |
| 1217 |
#define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x)) |
| 1218 |
#define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1) |
| 1219 |
#define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0) |
| 1220 |
#define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0]) |
| 1221 |
#define __Pyx_PyLong_DigitCount(x) ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS)) |
| 1222 |
#define __Pyx_PyLong_SignedDigitCount(x)\ |
| 1223 |
((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x)) |
| 1224 |
#if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue) |
| 1225 |
#define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x) |
| 1226 |
#define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x) |
| 1227 |
#else |
| 1228 |
#define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS)) |
| 1229 |
#define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0]) |
| 1230 |
#endif |
| 1231 |
typedef Py_ssize_t __Pyx_compact_pylong; |
| 1232 |
typedef size_t __Pyx_compact_upylong; |
| 1233 |
#else |
| 1234 |
#define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0) |
| 1235 |
#define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0) |
| 1236 |
#define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0) |
| 1237 |
#define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0) |
| 1238 |
#define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0]) |
| 1239 |
#define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x)) |
| 1240 |
#define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x) |
| 1241 |
#define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1) |
| 1242 |
#define __Pyx_PyLong_CompactValue(x)\ |
| 1243 |
((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0])) |
| 1244 |
typedef sdigit __Pyx_compact_pylong; |
| 1245 |
typedef digit __Pyx_compact_upylong; |
| 1246 |
#endif |
| 1247 |
#if PY_VERSION_HEX >= 0x030C00A5 |
| 1248 |
#define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit) |
| 1249 |
#else |
| 1250 |
#define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit) |
| 1251 |
#endif |
| 1252 |
#endif |
| 1253 |
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII |
| 1254 |
static int __Pyx_sys_getdefaultencoding_not_ascii; |
| 1255 |
static int __Pyx_init_sys_getdefaultencoding_params(void) { |
| 1256 |
PyObject* sys; |
| 1257 |
PyObject* default_encoding = NULL; |
| 1258 |
PyObject* ascii_chars_u = NULL; |
| 1259 |
PyObject* ascii_chars_b = NULL; |
| 1260 |
const char* default_encoding_c; |
| 1261 |
sys = PyImport_ImportModule("sys"); |
| 1262 |
if (!sys) goto bad; |
| 1263 |
default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL); |
| 1264 |
Py_DECREF(sys); |
| 1265 |
if (!default_encoding) goto bad; |
| 1266 |
default_encoding_c = PyBytes_AsString(default_encoding); |
| 1267 |
if (!default_encoding_c) goto bad; |
| 1268 |
if (strcmp(default_encoding_c, "ascii") == 0) { |
| 1269 |
__Pyx_sys_getdefaultencoding_not_ascii = 0; |
| 1270 |
} else { |
| 1271 |
char ascii_chars[128]; |
| 1272 |
int c; |
| 1273 |
for (c = 0; c < 128; c++) { |
| 1274 |
ascii_chars[c] = (char) c; |
| 1275 |
} |
| 1276 |
__Pyx_sys_getdefaultencoding_not_ascii = 1; |
| 1277 |
ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); |
| 1278 |
if (!ascii_chars_u) goto bad; |
| 1279 |
ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); |
| 1280 |
if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { |
| 1281 |
PyErr_Format( |
| 1282 |
PyExc_ValueError, |
| 1283 |
"This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.", |
| 1284 |
default_encoding_c); |
| 1285 |
goto bad; |
| 1286 |
} |
| 1287 |
Py_DECREF(ascii_chars_u); |
| 1288 |
Py_DECREF(ascii_chars_b); |
| 1289 |
} |
| 1290 |
Py_DECREF(default_encoding); |
| 1291 |
return 0; |
| 1292 |
bad: |
| 1293 |
Py_XDECREF(default_encoding); |
| 1294 |
Py_XDECREF(ascii_chars_u); |
| 1295 |
Py_XDECREF(ascii_chars_b); |
| 1296 |
return -1; |
| 1297 |
} |
| 1298 |
#endif |
| 1299 |
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 |
| 1300 |
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) |
| 1301 |
#else |
| 1302 |
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) |
| 1303 |
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT |
| 1304 |
static char* __PYX_DEFAULT_STRING_ENCODING; |
| 1305 |
static int __Pyx_init_sys_getdefaultencoding_params(void) { |
| 1306 |
PyObject* sys; |
| 1307 |
PyObject* default_encoding = NULL; |
| 1308 |
char* default_encoding_c; |
| 1309 |
sys = PyImport_ImportModule("sys"); |
| 1310 |
if (!sys) goto bad; |
| 1311 |
default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); |
| 1312 |
Py_DECREF(sys); |
| 1313 |
if (!default_encoding) goto bad; |
| 1314 |
default_encoding_c = PyBytes_AsString(default_encoding); |
| 1315 |
if (!default_encoding_c) goto bad; |
| 1316 |
__PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1); |
| 1317 |
if (!__PYX_DEFAULT_STRING_ENCODING) goto bad; |
| 1318 |
strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); |
| 1319 |
Py_DECREF(default_encoding); |
| 1320 |
return 0; |
| 1321 |
bad: |
| 1322 |
Py_XDECREF(default_encoding); |
| 1323 |
return -1; |
| 1324 |
} |
| 1325 |
#endif |
| 1326 |
#endif |
| 1327 |
|
| 1328 |
|
| 1329 |
|
| 1330 |
#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) |
| 1331 |
#define likely(x) __builtin_expect(!!(x), 1) |
| 1332 |
#define unlikely(x) __builtin_expect(!!(x), 0) |
| 1333 |
#else |
| 1334 |
#define likely(x) (x) |
| 1335 |
#define unlikely(x) (x) |
| 1336 |
#endif |
| 1337 |
static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } |
| 1338 |
|
| 1339 |
#if !CYTHON_USE_MODULE_STATE |
| 1340 |
static PyObject *__pyx_m = NULL; |
| 1341 |
#endif |
| 1342 |
static int __pyx_lineno; |
| 1343 |
static int __pyx_clineno = 0; |
| 1344 |
static const char * __pyx_cfilenm = __FILE__; |
| 1345 |
static const char *__pyx_filename; |
| 1346 |
|
| 1347 |
|
| 1348 |
|
| 1349 |
static const char *__pyx_f[] = { |
| 1350 |
"test_func.py", |
| 1351 |
}; |
| 1352 |
|
| 1353 |
|
| 1354 |
|
| 1355 |
|
| 1356 |
|
| 1357 |
|
| 1358 |
|
| 1359 |
|
| 1360 |
|
| 1361 |
|
| 1362 |
#ifndef CYTHON_REFNANNY |
| 1363 |
#define CYTHON_REFNANNY 0 |
| 1364 |
#endif |
| 1365 |
#if CYTHON_REFNANNY |
| 1366 |
typedef struct { |
| 1367 |
void (*INCREF)(void*, PyObject*, Py_ssize_t); |
| 1368 |
void (*DECREF)(void*, PyObject*, Py_ssize_t); |
| 1369 |
void (*GOTREF)(void*, PyObject*, Py_ssize_t); |
| 1370 |
void (*GIVEREF)(void*, PyObject*, Py_ssize_t); |
| 1371 |
void* (*SetupContext)(const char*, Py_ssize_t, const char*); |
| 1372 |
void (*FinishContext)(void**); |
| 1373 |
} __Pyx_RefNannyAPIStruct; |
| 1374 |
static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; |
| 1375 |
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); |
| 1376 |
#define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; |
| 1377 |
#ifdef WITH_THREAD |
| 1378 |
#define __Pyx_RefNannySetupContext(name, acquire_gil)\ |
| 1379 |
if (acquire_gil) {\ |
| 1380 |
PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ |
| 1381 |
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ |
| 1382 |
PyGILState_Release(__pyx_gilstate_save);\ |
| 1383 |
} else {\ |
| 1384 |
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ |
| 1385 |
} |
| 1386 |
#define __Pyx_RefNannyFinishContextNogil() {\ |
| 1387 |
PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ |
| 1388 |
__Pyx_RefNannyFinishContext();\ |
| 1389 |
PyGILState_Release(__pyx_gilstate_save);\ |
| 1390 |
} |
| 1391 |
#else |
| 1392 |
#define __Pyx_RefNannySetupContext(name, acquire_gil)\ |
| 1393 |
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__)) |
| 1394 |
#define __Pyx_RefNannyFinishContextNogil() __Pyx_RefNannyFinishContext() |
| 1395 |
#endif |
| 1396 |
#define __Pyx_RefNannyFinishContextNogil() {\ |
| 1397 |
PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ |
| 1398 |
__Pyx_RefNannyFinishContext();\ |
| 1399 |
PyGILState_Release(__pyx_gilstate_save);\ |
| 1400 |
} |
| 1401 |
#define __Pyx_RefNannyFinishContext()\ |
| 1402 |
__Pyx_RefNanny->FinishContext(&__pyx_refnanny) |
| 1403 |
#define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) |
| 1404 |
#define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) |
| 1405 |
#define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) |
| 1406 |
#define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) |
| 1407 |
#define __Pyx_XINCREF(r) do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0) |
| 1408 |
#define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0) |
| 1409 |
#define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0) |
| 1410 |
#define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0) |
| 1411 |
#else |
| 1412 |
#define __Pyx_RefNannyDeclarations |
| 1413 |
#define __Pyx_RefNannySetupContext(name, acquire_gil) |
| 1414 |
#define __Pyx_RefNannyFinishContextNogil() |
| 1415 |
#define __Pyx_RefNannyFinishContext() |
| 1416 |
#define __Pyx_INCREF(r) Py_INCREF(r) |
| 1417 |
#define __Pyx_DECREF(r) Py_DECREF(r) |
| 1418 |
#define __Pyx_GOTREF(r) |
| 1419 |
#define __Pyx_GIVEREF(r) |
| 1420 |
#define __Pyx_XINCREF(r) Py_XINCREF(r) |
| 1421 |
#define __Pyx_XDECREF(r) Py_XDECREF(r) |
| 1422 |
#define __Pyx_XGOTREF(r) |
| 1423 |
#define __Pyx_XGIVEREF(r) |
| 1424 |
#endif |
| 1425 |
#define __Pyx_Py_XDECREF_SET(r, v) do {\ |
| 1426 |
PyObject *tmp = (PyObject *) r;\ |
| 1427 |
r = v; Py_XDECREF(tmp);\ |
| 1428 |
} while (0) |
| 1429 |
#define __Pyx_XDECREF_SET(r, v) do {\ |
| 1430 |
PyObject *tmp = (PyObject *) r;\ |
| 1431 |
r = v; __Pyx_XDECREF(tmp);\ |
| 1432 |
} while (0) |
| 1433 |
#define __Pyx_DECREF_SET(r, v) do {\ |
| 1434 |
PyObject *tmp = (PyObject *) r;\ |
| 1435 |
r = v; __Pyx_DECREF(tmp);\ |
| 1436 |
} while (0) |
| 1437 |
#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) |
| 1438 |
#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) |
| 1439 |
|
| 1440 |
|
| 1441 |
#if CYTHON_COMPILING_IN_CPYTHON |
| 1442 |
static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n); |
| 1443 |
static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n); |
| 1444 |
#endif |
| 1445 |
|
| 1446 |
|
| 1447 |
#include <string.h> |
| 1448 |
|
| 1449 |
|
| 1450 |
static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); |
| 1451 |
|
| 1452 |
|
| 1453 |
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); |
| 1454 |
|
| 1455 |
|
| 1456 |
#if CYTHON_AVOID_BORROWED_REFS |
| 1457 |
#define __Pyx_Arg_VARARGS(args, i) PySequence_GetItem(args, i) |
| 1458 |
#elif CYTHON_ASSUME_SAFE_MACROS |
| 1459 |
#define __Pyx_Arg_VARARGS(args, i) PyTuple_GET_ITEM(args, i) |
| 1460 |
#else |
| 1461 |
#define __Pyx_Arg_VARARGS(args, i) PyTuple_GetItem(args, i) |
| 1462 |
#endif |
| 1463 |
#if CYTHON_AVOID_BORROWED_REFS |
| 1464 |
#define __Pyx_Arg_NewRef_VARARGS(arg) __Pyx_NewRef(arg) |
| 1465 |
#define __Pyx_Arg_XDECREF_VARARGS(arg) Py_XDECREF(arg) |
| 1466 |
#else |
| 1467 |
#define __Pyx_Arg_NewRef_VARARGS(arg) arg // no-op |
| 1468 |
#define __Pyx_Arg_XDECREF_VARARGS(arg) |
| 1469 |
#endif |
| 1470 |
#define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds) |
| 1471 |
#define __Pyx_KwValues_VARARGS(args, nargs) NULL |
| 1472 |
#define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s) |
| 1473 |
#define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw) |
| 1474 |
#if CYTHON_METH_FASTCALL |
| 1475 |
#define __Pyx_Arg_FASTCALL(args, i) args[i] |
| 1476 |
#define __Pyx_NumKwargs_FASTCALL(kwds) PyTuple_GET_SIZE(kwds) |
| 1477 |
#define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs)) |
| 1478 |
static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s); |
| 1479 |
#define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw) |
| 1480 |
#define __Pyx_Arg_NewRef_FASTCALL(arg) arg // no-op, __Pyx_Arg_FASTCALL is direct and this needs |
| 1481 |
#define __Pyx_Arg_XDECREF_FASTCALL(arg) |
| 1482 |
#else |
| 1483 |
#define __Pyx_Arg_FASTCALL __Pyx_Arg_VARARGS |
| 1484 |
#define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS |
| 1485 |
#define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS |
| 1486 |
#define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS |
| 1487 |
#define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS |
| 1488 |
#define __Pyx_Arg_NewRef_FASTCALL(arg) __Pyx_Arg_NewRef_VARARGS(arg) |
| 1489 |
#define __Pyx_Arg_XDECREF_FASTCALL(arg) __Pyx_Arg_XDECREF_VARARGS(arg) |
| 1490 |
#endif |
| 1491 |
#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS |
| 1492 |
#define __Pyx_ArgsSlice_VARARGS(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_VARARGS(args, start), stop - start) |
| 1493 |
#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_FASTCALL(args, start), stop - start) |
| 1494 |
#else |
| 1495 |
#define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop) |
| 1496 |
#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop) |
| 1497 |
#endif |
| 1498 |
|
| 1499 |
|
| 1500 |
#include <structmember.h> |
| 1501 |
|
| 1502 |
|
| 1503 |
#if CYTHON_USE_TYPE_SPECS |
| 1504 |
static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type); |
| 1505 |
#endif |
| 1506 |
|
| 1507 |
|
| 1508 |
static PyObject *__Pyx_FetchSharedCythonABIModule(void); |
| 1509 |
|
| 1510 |
|
| 1511 |
#if !CYTHON_USE_TYPE_SPECS |
| 1512 |
static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); |
| 1513 |
#else |
| 1514 |
static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases); |
| 1515 |
#endif |
| 1516 |
|
| 1517 |
|
| 1518 |
#if CYTHON_COMPILING_IN_LIMITED_API |
| 1519 |
static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { |
| 1520 |
PyObject *typesModule=NULL, *methodType=NULL, *result=NULL; |
| 1521 |
CYTHON_UNUSED_VAR(typ); |
| 1522 |
if (!self) |
| 1523 |
return __Pyx_NewRef(func); |
| 1524 |
typesModule = PyImport_ImportModule("types"); |
| 1525 |
if (!typesModule) return NULL; |
| 1526 |
methodType = PyObject_GetAttrString(typesModule, "MethodType"); |
| 1527 |
Py_DECREF(typesModule); |
| 1528 |
if (!methodType) return NULL; |
| 1529 |
result = PyObject_CallFunctionObjArgs(methodType, func, self, NULL); |
| 1530 |
Py_DECREF(methodType); |
| 1531 |
return result; |
| 1532 |
} |
| 1533 |
#elif PY_MAJOR_VERSION >= 3 |
| 1534 |
static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { |
| 1535 |
CYTHON_UNUSED_VAR(typ); |
| 1536 |
if (!self) |
| 1537 |
return __Pyx_NewRef(func); |
| 1538 |
return PyMethod_New(func, self); |
| 1539 |
} |
| 1540 |
#else |
| 1541 |
#define __Pyx_PyMethod_New PyMethod_New |
| 1542 |
#endif |
| 1543 |
|
| 1544 |
|
| 1545 |
#if CYTHON_USE_TYPE_SLOTS |
| 1546 |
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); |
| 1547 |
#else |
| 1548 |
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) |
| 1549 |
#endif |
| 1550 |
|
| 1551 |
|
| 1552 |
#if CYTHON_METH_FASTCALL |
| 1553 |
static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw); |
| 1554 |
#endif |
| 1555 |
|
| 1556 |
|
| 1557 |
#define __Pyx_CyFunction_USED |
| 1558 |
#define __Pyx_CYFUNCTION_STATICMETHOD 0x01 |
| 1559 |
#define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 |
| 1560 |
#define __Pyx_CYFUNCTION_CCLASS 0x04 |
| 1561 |
#define __Pyx_CYFUNCTION_COROUTINE 0x08 |
| 1562 |
#define __Pyx_CyFunction_GetClosure(f)\ |
| 1563 |
(((__pyx_CyFunctionObject *) (f))->func_closure) |
| 1564 |
#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API |
| 1565 |
#define __Pyx_CyFunction_GetClassObj(f)\ |
| 1566 |
(((__pyx_CyFunctionObject *) (f))->func_classobj) |
| 1567 |
#else |
| 1568 |
#define __Pyx_CyFunction_GetClassObj(f)\ |
| 1569 |
((PyObject*) ((PyCMethodObject *) (f))->mm_class) |
| 1570 |
#endif |
| 1571 |
#define __Pyx_CyFunction_SetClassObj(f, classobj)\ |
| 1572 |
__Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj)) |
| 1573 |
#define __Pyx_CyFunction_Defaults(type, f)\ |
| 1574 |
((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) |
| 1575 |
#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\ |
| 1576 |
((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) |
| 1577 |
typedef struct { |
| 1578 |
#if CYTHON_COMPILING_IN_LIMITED_API |
| 1579 |
PyObject_HEAD; |
| 1580 |
PyObject *func; |
| 1581 |
#elif PY_VERSION_HEX < 0x030900B1 |
| 1582 |
PyCFunctionObject func; |
| 1583 |
#else |
| 1584 |
PyCMethodObject func; |
| 1585 |
#endif |
| 1586 |
#if CYTHON_BACKPORT_VECTORCALL |
| 1587 |
__pyx_vectorcallfunc func_vectorcall; |
| 1588 |
#endif |
| 1589 |
#if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API |
| 1590 |
PyObject *func_weakreflist; |
| 1591 |
#endif |
| 1592 |
PyObject *func_dict; |
| 1593 |
PyObject *func_name; |
| 1594 |
PyObject *func_qualname; |
| 1595 |
PyObject *func_doc; |
| 1596 |
PyObject *func_globals; |
| 1597 |
PyObject *func_code; |
| 1598 |
PyObject *func_closure; |
| 1599 |
#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API |
| 1600 |
PyObject *func_classobj; |
| 1601 |
#endif |
| 1602 |
void *defaults; |
| 1603 |
int defaults_pyobjects; |
| 1604 |
size_t defaults_size; |
| 1605 |
int flags; |
| 1606 |
PyObject *defaults_tuple; |
| 1607 |
PyObject *defaults_kwdict; |
| 1608 |
PyObject *(*defaults_getter)(PyObject *); |
| 1609 |
PyObject *func_annotations; |
| 1610 |
PyObject *func_is_coroutine; |
| 1611 |
} __pyx_CyFunctionObject; |
| 1612 |
#define __Pyx_CyFunction_Check(obj) __Pyx_TypeCheck(obj, __pyx_CyFunctionType) |
| 1613 |
#define __Pyx_IsCyOrPyCFunction(obj) __Pyx_TypeCheck2(obj, __pyx_CyFunctionType, &PyCFunction_Type) |
| 1614 |
#define __Pyx_CyFunction_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_CyFunctionType) |
| 1615 |
static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml, |
| 1616 |
int flags, PyObject* qualname, |
| 1617 |
PyObject *closure, |
| 1618 |
PyObject *module, PyObject *globals, |
| 1619 |
PyObject* code); |
| 1620 |
static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj); |
| 1621 |
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m, |
| 1622 |
size_t size, |
| 1623 |
int pyobjects); |
| 1624 |
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, |
| 1625 |
PyObject *tuple); |
| 1626 |
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, |
| 1627 |
PyObject *dict); |
| 1628 |
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, |
| 1629 |
PyObject *dict); |
| 1630 |
static int __pyx_CyFunction_init(PyObject *module); |
| 1631 |
#if CYTHON_METH_FASTCALL |
| 1632 |
static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); |
| 1633 |
static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); |
| 1634 |
static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); |
| 1635 |
static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); |
| 1636 |
#if CYTHON_BACKPORT_VECTORCALL |
| 1637 |
#define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall) |
| 1638 |
#else |
| 1639 |
#define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall) |
| 1640 |
#endif |
| 1641 |
#endif |
| 1642 |
|
| 1643 |
|
| 1644 |
static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, |
| 1645 |
int flags, PyObject* qualname, |
| 1646 |
PyObject *closure, |
| 1647 |
PyObject *module, PyObject *globals, |
| 1648 |
PyObject* code); |
| 1649 |
|
| 1650 |
|
| 1651 |
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS |
| 1652 |
#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) |
| 1653 |
#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) |
| 1654 |
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ |
| 1655 |
(version_var) = __PYX_GET_DICT_VERSION(dict);\ |
| 1656 |
(cache_var) = (value); |
| 1657 |
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ |
| 1658 |
static PY_UINT64_T __pyx_dict_version = 0;\ |
| 1659 |
static PyObject *__pyx_dict_cached_value = NULL;\ |
| 1660 |
if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ |
| 1661 |
(VAR) = __pyx_dict_cached_value;\ |
| 1662 |
} else {\ |
| 1663 |
(VAR) = __pyx_dict_cached_value = (LOOKUP);\ |
| 1664 |
__pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ |
| 1665 |
}\ |
| 1666 |
} |
| 1667 |
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); |
| 1668 |
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); |
| 1669 |
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); |
| 1670 |
#else |
| 1671 |
#define __PYX_GET_DICT_VERSION(dict) (0) |
| 1672 |
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) |
| 1673 |
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); |
| 1674 |
#endif |
| 1675 |
|
| 1676 |
|
| 1677 |
#if CYTHON_FAST_THREAD_STATE |
| 1678 |
#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) |
| 1679 |
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); |
| 1680 |
#else |
| 1681 |
#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) |
| 1682 |
#endif |
| 1683 |
|
| 1684 |
|
| 1685 |
#if CYTHON_FAST_THREAD_STATE |
| 1686 |
#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; |
| 1687 |
#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; |
| 1688 |
#if PY_VERSION_HEX >= 0x030C00A6 |
| 1689 |
#define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL) |
| 1690 |
#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL) |
| 1691 |
#else |
| 1692 |
#define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL) |
| 1693 |
#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type) |
| 1694 |
#endif |
| 1695 |
#else |
| 1696 |
#define __Pyx_PyThreadState_declare |
| 1697 |
#define __Pyx_PyThreadState_assign |
| 1698 |
#define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL) |
| 1699 |
#define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred() |
| 1700 |
#endif |
| 1701 |
|
| 1702 |
|
| 1703 |
#if CYTHON_FAST_THREAD_STATE |
| 1704 |
#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) |
| 1705 |
#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) |
| 1706 |
#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) |
| 1707 |
#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) |
| 1708 |
#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) |
| 1709 |
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); |
| 1710 |
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); |
| 1711 |
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6 |
| 1712 |
#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) |
| 1713 |
#else |
| 1714 |
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) |
| 1715 |
#endif |
| 1716 |
#else |
| 1717 |
#define __Pyx_PyErr_Clear() PyErr_Clear() |
| 1718 |
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) |
| 1719 |
#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) |
| 1720 |
#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) |
| 1721 |
#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) |
| 1722 |
#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) |
| 1723 |
#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) |
| 1724 |
#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) |
| 1725 |
#endif |
| 1726 |
|
| 1727 |
|
| 1728 |
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); |
| 1729 |
|
| 1730 |
|
| 1731 |
#ifdef CYTHON_CLINE_IN_TRACEBACK |
| 1732 |
#define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) |
| 1733 |
#else |
| 1734 |
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); |
| 1735 |
#endif |
| 1736 |
|
| 1737 |
|
| 1738 |
#if !CYTHON_COMPILING_IN_LIMITED_API |
| 1739 |
typedef struct { |
| 1740 |
PyCodeObject* code_object; |
| 1741 |
int code_line; |
| 1742 |
} __Pyx_CodeObjectCacheEntry; |
| 1743 |
struct __Pyx_CodeObjectCache { |
| 1744 |
int count; |
| 1745 |
int max_count; |
| 1746 |
__Pyx_CodeObjectCacheEntry* entries; |
| 1747 |
}; |
| 1748 |
static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; |
| 1749 |
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); |
| 1750 |
static PyCodeObject *__pyx_find_code_object(int code_line); |
| 1751 |
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); |
| 1752 |
#endif |
| 1753 |
|
| 1754 |
|
| 1755 |
static void __Pyx_AddTraceback(const char *funcname, int c_line, |
| 1756 |
int py_line, const char *filename); |
| 1757 |
|
| 1758 |
|
| 1759 |
#if CYTHON_COMPILING_IN_LIMITED_API |
| 1760 |
typedef PyObject *__Pyx_TypeName; |
| 1761 |
#define __Pyx_FMT_TYPENAME "%U" |
| 1762 |
static __Pyx_TypeName __Pyx_PyType_GetName(PyTypeObject* tp); |
| 1763 |
#define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj) |
| 1764 |
#else |
| 1765 |
typedef const char *__Pyx_TypeName; |
| 1766 |
#define __Pyx_FMT_TYPENAME "%.200s" |
| 1767 |
#define __Pyx_PyType_GetName(tp) ((tp)->tp_name) |
| 1768 |
#define __Pyx_DECREF_TypeName(obj) |
| 1769 |
#endif |
| 1770 |
|
| 1771 |
|
| 1772 |
#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) |
| 1773 |
#define __Pyx_HAS_GCC_DIAGNOSTIC |
| 1774 |
#endif |
| 1775 |
|
| 1776 |
|
| 1777 |
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); |
| 1778 |
|
| 1779 |
|
| 1780 |
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); |
| 1781 |
|
| 1782 |
|
| 1783 |
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); |
| 1784 |
|
| 1785 |
|
| 1786 |
#if CYTHON_COMPILING_IN_CPYTHON |
| 1787 |
#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) |
| 1788 |
#define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2) |
| 1789 |
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); |
| 1790 |
static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b); |
| 1791 |
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); |
| 1792 |
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); |
| 1793 |
#else |
| 1794 |
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) |
| 1795 |
#define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2)) |
| 1796 |
#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) |
| 1797 |
#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2)) |
| 1798 |
#endif |
| 1799 |
#define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2) |
| 1800 |
#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) |
| 1801 |
|
| 1802 |
|
| 1803 |
static int __Pyx_check_binary_version(void); |
| 1804 |
|
| 1805 |
|
| 1806 |
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); |
| 1807 |
|
| 1808 |
|
| 1809 |
|
| 1810 |
|
| 1811 |
|
| 1812 |
|
| 1813 |
#define __Pyx_MODULE_NAME "test_func" |
| 1814 |
extern int __pyx_module_is_main_test_func; |
| 1815 |
int __pyx_module_is_main_test_func = 0; |
| 1816 |
|
| 1817 |
|
| 1818 |
|
| 1819 |
|
| 1820 |
static const char __pyx_k_f[] = "f"; |
| 1821 |
static const char __pyx_k__2[] = "?"; |
| 1822 |
static const char __pyx_k_main[] = "__main__"; |
| 1823 |
static const char __pyx_k_name[] = "__name__"; |
| 1824 |
static const char __pyx_k_test[] = "__test__"; |
| 1825 |
static const char __pyx_k_test_func[] = "test_func"; |
| 1826 |
static const char __pyx_k_is_coroutine[] = "_is_coroutine"; |
| 1827 |
static const char __pyx_k_test_func_py[] = "test_func.py"; |
| 1828 |
static const char __pyx_k_asyncio_coroutines[] = "asyncio.coroutines"; |
| 1829 |
static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; |
| 1830 |
|
| 1831 |
static PyObject *__pyx_pf_9test_func_f(CYTHON_UNUSED PyObject *__pyx_self); |
| 1832 |
|
| 1833 |
|
| 1834 |
typedef struct { |
| 1835 |
PyObject *__pyx_d; |
| 1836 |
PyObject *__pyx_b; |
| 1837 |
PyObject *__pyx_cython_runtime; |
| 1838 |
PyObject *__pyx_empty_tuple; |
| 1839 |
PyObject *__pyx_empty_bytes; |
| 1840 |
PyObject *__pyx_empty_unicode; |
| 1841 |
#ifdef __Pyx_CyFunction_USED |
| 1842 |
PyTypeObject *__pyx_CyFunctionType; |
| 1843 |
#endif |
| 1844 |
#ifdef __Pyx_FusedFunction_USED |
| 1845 |
PyTypeObject *__pyx_FusedFunctionType; |
| 1846 |
#endif |
| 1847 |
#ifdef __Pyx_Generator_USED |
| 1848 |
PyTypeObject *__pyx_GeneratorType; |
| 1849 |
#endif |
| 1850 |
#ifdef __Pyx_IterableCoroutine_USED |
| 1851 |
PyTypeObject *__pyx_IterableCoroutineType; |
| 1852 |
#endif |
| 1853 |
#ifdef __Pyx_Coroutine_USED |
| 1854 |
PyTypeObject *__pyx_CoroutineAwaitType; |
| 1855 |
#endif |
| 1856 |
#ifdef __Pyx_Coroutine_USED |
| 1857 |
PyTypeObject *__pyx_CoroutineType; |
| 1858 |
#endif |
| 1859 |
#if CYTHON_USE_MODULE_STATE |
| 1860 |
#endif |
| 1861 |
PyObject *__pyx_n_s__2; |
| 1862 |
PyObject *__pyx_n_s_asyncio_coroutines; |
| 1863 |
PyObject *__pyx_n_s_cline_in_traceback; |
| 1864 |
PyObject *__pyx_n_s_f; |
| 1865 |
PyObject *__pyx_n_s_is_coroutine; |
| 1866 |
PyObject *__pyx_n_s_main; |
| 1867 |
PyObject *__pyx_n_s_name; |
| 1868 |
PyObject *__pyx_n_s_test; |
| 1869 |
PyObject *__pyx_n_s_test_func; |
| 1870 |
PyObject *__pyx_kp_s_test_func_py; |
| 1871 |
PyObject *__pyx_int_32; |
| 1872 |
PyObject *__pyx_codeobj_; |
| 1873 |
} __pyx_mstate; |
| 1874 |
|
| 1875 |
#if CYTHON_USE_MODULE_STATE |
| 1876 |
#ifdef __cplusplus |
| 1877 |
namespace { |
| 1878 |
extern struct PyModuleDef __pyx_moduledef; |
| 1879 |
} |
| 1880 |
#else |
| 1881 |
static struct PyModuleDef __pyx_moduledef; |
| 1882 |
#endif |
| 1883 |
|
| 1884 |
#define __pyx_mstate(o) ((__pyx_mstate *)__Pyx_PyModule_GetState(o)) |
| 1885 |
|
| 1886 |
#define __pyx_mstate_global (__pyx_mstate(PyState_FindModule(&__pyx_moduledef))) |
| 1887 |
|
| 1888 |
#define __pyx_m (PyState_FindModule(&__pyx_moduledef)) |
| 1889 |
#else |
| 1890 |
static __pyx_mstate __pyx_mstate_global_static = |
| 1891 |
#ifdef __cplusplus |
| 1892 |
{}; |
| 1893 |
#else |
| 1894 |
{0}; |
| 1895 |
#endif |
| 1896 |
static __pyx_mstate *__pyx_mstate_global = &__pyx_mstate_global_static; |
| 1897 |
#endif |
| 1898 |
|
| 1899 |
#if CYTHON_USE_MODULE_STATE |
| 1900 |
static int __pyx_m_clear(PyObject *m) { |
| 1901 |
__pyx_mstate *clear_module_state = __pyx_mstate(m); |
| 1902 |
if (!clear_module_state) return 0; |
| 1903 |
Py_CLEAR(clear_module_state->__pyx_d); |
| 1904 |
Py_CLEAR(clear_module_state->__pyx_b); |
| 1905 |
Py_CLEAR(clear_module_state->__pyx_cython_runtime); |
| 1906 |
Py_CLEAR(clear_module_state->__pyx_empty_tuple); |
| 1907 |
Py_CLEAR(clear_module_state->__pyx_empty_bytes); |
| 1908 |
Py_CLEAR(clear_module_state->__pyx_empty_unicode); |
| 1909 |
#ifdef __Pyx_CyFunction_USED |
| 1910 |
Py_CLEAR(clear_module_state->__pyx_CyFunctionType); |
| 1911 |
#endif |
| 1912 |
#ifdef __Pyx_FusedFunction_USED |
| 1913 |
Py_CLEAR(clear_module_state->__pyx_FusedFunctionType); |
| 1914 |
#endif |
| 1915 |
Py_CLEAR(clear_module_state->__pyx_n_s__2); |
| 1916 |
Py_CLEAR(clear_module_state->__pyx_n_s_asyncio_coroutines); |
| 1917 |
Py_CLEAR(clear_module_state->__pyx_n_s_cline_in_traceback); |
| 1918 |
Py_CLEAR(clear_module_state->__pyx_n_s_f); |
| 1919 |
Py_CLEAR(clear_module_state->__pyx_n_s_is_coroutine); |
| 1920 |
Py_CLEAR(clear_module_state->__pyx_n_s_main); |
| 1921 |
Py_CLEAR(clear_module_state->__pyx_n_s_name); |
| 1922 |
Py_CLEAR(clear_module_state->__pyx_n_s_test); |
| 1923 |
Py_CLEAR(clear_module_state->__pyx_n_s_test_func); |
| 1924 |
Py_CLEAR(clear_module_state->__pyx_kp_s_test_func_py); |
| 1925 |
Py_CLEAR(clear_module_state->__pyx_int_32); |
| 1926 |
Py_CLEAR(clear_module_state->__pyx_codeobj_); |
| 1927 |
return 0; |
| 1928 |
} |
| 1929 |
#endif |
| 1930 |
|
| 1931 |
#if CYTHON_USE_MODULE_STATE |
| 1932 |
static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { |
| 1933 |
__pyx_mstate *traverse_module_state = __pyx_mstate(m); |
| 1934 |
if (!traverse_module_state) return 0; |
| 1935 |
Py_VISIT(traverse_module_state->__pyx_d); |
| 1936 |
Py_VISIT(traverse_module_state->__pyx_b); |
| 1937 |
Py_VISIT(traverse_module_state->__pyx_cython_runtime); |
| 1938 |
Py_VISIT(traverse_module_state->__pyx_empty_tuple); |
| 1939 |
Py_VISIT(traverse_module_state->__pyx_empty_bytes); |
| 1940 |
Py_VISIT(traverse_module_state->__pyx_empty_unicode); |
| 1941 |
#ifdef __Pyx_CyFunction_USED |
| 1942 |
Py_VISIT(traverse_module_state->__pyx_CyFunctionType); |
| 1943 |
#endif |
| 1944 |
#ifdef __Pyx_FusedFunction_USED |
| 1945 |
Py_VISIT(traverse_module_state->__pyx_FusedFunctionType); |
| 1946 |
#endif |
| 1947 |
Py_VISIT(traverse_module_state->__pyx_n_s__2); |
| 1948 |
Py_VISIT(traverse_module_state->__pyx_n_s_asyncio_coroutines); |
| 1949 |
Py_VISIT(traverse_module_state->__pyx_n_s_cline_in_traceback); |
| 1950 |
Py_VISIT(traverse_module_state->__pyx_n_s_f); |
| 1951 |
Py_VISIT(traverse_module_state->__pyx_n_s_is_coroutine); |
| 1952 |
Py_VISIT(traverse_module_state->__pyx_n_s_main); |
| 1953 |
Py_VISIT(traverse_module_state->__pyx_n_s_name); |
| 1954 |
Py_VISIT(traverse_module_state->__pyx_n_s_test); |
| 1955 |
Py_VISIT(traverse_module_state->__pyx_n_s_test_func); |
| 1956 |
Py_VISIT(traverse_module_state->__pyx_kp_s_test_func_py); |
| 1957 |
Py_VISIT(traverse_module_state->__pyx_int_32); |
| 1958 |
Py_VISIT(traverse_module_state->__pyx_codeobj_); |
| 1959 |
return 0; |
| 1960 |
} |
| 1961 |
#endif |
| 1962 |
|
| 1963 |
#define __pyx_d __pyx_mstate_global->__pyx_d |
| 1964 |
#define __pyx_b __pyx_mstate_global->__pyx_b |
| 1965 |
#define __pyx_cython_runtime __pyx_mstate_global->__pyx_cython_runtime |
| 1966 |
#define __pyx_empty_tuple __pyx_mstate_global->__pyx_empty_tuple |
| 1967 |
#define __pyx_empty_bytes __pyx_mstate_global->__pyx_empty_bytes |
| 1968 |
#define __pyx_empty_unicode __pyx_mstate_global->__pyx_empty_unicode |
| 1969 |
#ifdef __Pyx_CyFunction_USED |
| 1970 |
#define __pyx_CyFunctionType __pyx_mstate_global->__pyx_CyFunctionType |
| 1971 |
#endif |
| 1972 |
#ifdef __Pyx_FusedFunction_USED |
| 1973 |
#define __pyx_FusedFunctionType __pyx_mstate_global->__pyx_FusedFunctionType |
| 1974 |
#endif |
| 1975 |
#ifdef __Pyx_Generator_USED |
| 1976 |
#define __pyx_GeneratorType __pyx_mstate_global->__pyx_GeneratorType |
| 1977 |
#endif |
| 1978 |
#ifdef __Pyx_IterableCoroutine_USED |
| 1979 |
#define __pyx_IterableCoroutineType __pyx_mstate_global->__pyx_IterableCoroutineType |
| 1980 |
#endif |
| 1981 |
#ifdef __Pyx_Coroutine_USED |
| 1982 |
#define __pyx_CoroutineAwaitType __pyx_mstate_global->__pyx_CoroutineAwaitType |
| 1983 |
#endif |
| 1984 |
#ifdef __Pyx_Coroutine_USED |
| 1985 |
#define __pyx_CoroutineType __pyx_mstate_global->__pyx_CoroutineType |
| 1986 |
#endif |
| 1987 |
#if CYTHON_USE_MODULE_STATE |
| 1988 |
#endif |
| 1989 |
#define __pyx_n_s__2 __pyx_mstate_global->__pyx_n_s__2 |
| 1990 |
#define __pyx_n_s_asyncio_coroutines __pyx_mstate_global->__pyx_n_s_asyncio_coroutines |
| 1991 |
#define __pyx_n_s_cline_in_traceback __pyx_mstate_global->__pyx_n_s_cline_in_traceback |
| 1992 |
#define __pyx_n_s_f __pyx_mstate_global->__pyx_n_s_f |
| 1993 |
#define __pyx_n_s_is_coroutine __pyx_mstate_global->__pyx_n_s_is_coroutine |
| 1994 |
#define __pyx_n_s_main __pyx_mstate_global->__pyx_n_s_main |
| 1995 |
#define __pyx_n_s_name __pyx_mstate_global->__pyx_n_s_name |
| 1996 |
#define __pyx_n_s_test __pyx_mstate_global->__pyx_n_s_test |
| 1997 |
#define __pyx_n_s_test_func __pyx_mstate_global->__pyx_n_s_test_func |
| 1998 |
#define __pyx_kp_s_test_func_py __pyx_mstate_global->__pyx_kp_s_test_func_py |
| 1999 |
#define __pyx_int_32 __pyx_mstate_global->__pyx_int_32 |
| 2000 |
#define __pyx_codeobj_ __pyx_mstate_global->__pyx_codeobj_ |
| 2001 |
|
| 2002 |
|
| 2003 |
|
| 2004 |
|
| 2005 |
|
| 2006 |
|
| 2007 |
|
| 2008 |
|
| 2009 |
static PyObject *__pyx_pw_9test_func_1f(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); |
| 2010 |
static PyMethodDef __pyx_mdef_9test_func_1f = {"f", (PyCFunction)__pyx_pw_9test_func_1f, METH_NOARGS, 0}; |
| 2011 |
static PyObject *__pyx_pw_9test_func_1f(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { |
| 2012 |
CYTHON_UNUSED PyObject *const *__pyx_kwvalues; |
| 2013 |
PyObject *__pyx_r = 0; |
| 2014 |
__Pyx_RefNannyDeclarations |
| 2015 |
__Pyx_RefNannySetupContext("f (wrapper)", 0); |
| 2016 |
__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); |
| 2017 |
__pyx_r = __pyx_pf_9test_func_f(__pyx_self); |
| 2018 |
|
| 2019 |
|
| 2020 |
__Pyx_RefNannyFinishContext(); |
| 2021 |
return __pyx_r; |
| 2022 |
} |
| 2023 |
|
| 2024 |
static PyObject *__pyx_pf_9test_func_f(CYTHON_UNUSED PyObject *__pyx_self) { |
| 2025 |
PyObject *__pyx_r = NULL; |
| 2026 |
__Pyx_RefNannyDeclarations |
| 2027 |
__Pyx_RefNannySetupContext("f", 0); |
| 2028 |
|
| 2029 |
|
| 2030 |
|
| 2031 |
|
| 2032 |
|
| 2033 |
__Pyx_XDECREF(__pyx_r); |
| 2034 |
__Pyx_INCREF(__pyx_int_32); |
| 2035 |
__pyx_r = __pyx_int_32; |
| 2036 |
goto __pyx_L0; |
| 2037 |
|
| 2038 |
|
| 2039 |
|
| 2040 |
|
| 2041 |
|
| 2042 |
|
| 2043 |
|
| 2044 |
__pyx_L0:; |
| 2045 |
__Pyx_XGIVEREF(__pyx_r); |
| 2046 |
__Pyx_RefNannyFinishContext(); |
| 2047 |
return __pyx_r; |
| 2048 |
} |
| 2049 |
|
| 2050 |
static PyMethodDef __pyx_methods[] = { |
| 2051 |
{0, 0, 0, 0} |
| 2052 |
}; |
| 2053 |
#ifndef CYTHON_SMALL_CODE |
| 2054 |
#if defined(__clang__) |
| 2055 |
#define CYTHON_SMALL_CODE |
| 2056 |
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) |
| 2057 |
#define CYTHON_SMALL_CODE __attribute__((cold)) |
| 2058 |
#else |
| 2059 |
#define CYTHON_SMALL_CODE |
| 2060 |
#endif |
| 2061 |
#endif |
| 2062 |
|
| 2063 |
|
| 2064 |
static int __Pyx_CreateStringTabAndInitStrings(void) { |
| 2065 |
__Pyx_StringTabEntry __pyx_string_tab[] = { |
| 2066 |
{&__pyx_n_s__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 0, 1, 1}, |
| 2067 |
{&__pyx_n_s_asyncio_coroutines, __pyx_k_asyncio_coroutines, sizeof(__pyx_k_asyncio_coroutines), 0, 0, 1, 1}, |
| 2068 |
{&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, |
| 2069 |
{&__pyx_n_s_f, __pyx_k_f, sizeof(__pyx_k_f), 0, 0, 1, 1}, |
| 2070 |
{&__pyx_n_s_is_coroutine, __pyx_k_is_coroutine, sizeof(__pyx_k_is_coroutine), 0, 0, 1, 1}, |
| 2071 |
{&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, |
| 2072 |
{&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, |
| 2073 |
{&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, |
| 2074 |
{&__pyx_n_s_test_func, __pyx_k_test_func, sizeof(__pyx_k_test_func), 0, 0, 1, 1}, |
| 2075 |
{&__pyx_kp_s_test_func_py, __pyx_k_test_func_py, sizeof(__pyx_k_test_func_py), 0, 0, 1, 0}, |
| 2076 |
{0, 0, 0, 0, 0, 0, 0} |
| 2077 |
}; |
| 2078 |
return __Pyx_InitStrings(__pyx_string_tab); |
| 2079 |
} |
| 2080 |
|
| 2081 |
static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { |
| 2082 |
return 0; |
| 2083 |
} |
| 2084 |
|
| 2085 |
|
| 2086 |
static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { |
| 2087 |
__Pyx_RefNannyDeclarations |
| 2088 |
__Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); |
| 2089 |
|
| 2090 |
|
| 2091 |
|
| 2092 |
|
| 2093 |
|
| 2094 |
__pyx_codeobj_ = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_test_func_py, __pyx_n_s_f, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj_)) __PYX_ERR(0, 1, __pyx_L1_error) |
| 2095 |
__Pyx_RefNannyFinishContext(); |
| 2096 |
return 0; |
| 2097 |
__pyx_L1_error:; |
| 2098 |
__Pyx_RefNannyFinishContext(); |
| 2099 |
return -1; |
| 2100 |
} |
| 2101 |
|
| 2102 |
|
| 2103 |
static CYTHON_SMALL_CODE int __Pyx_InitConstants(void) { |
| 2104 |
if (__Pyx_CreateStringTabAndInitStrings() < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
| 2105 |
__pyx_int_32 = PyInt_FromLong(32); if (unlikely(!__pyx_int_32)) __PYX_ERR(0, 1, __pyx_L1_error) |
| 2106 |
return 0; |
| 2107 |
__pyx_L1_error:; |
| 2108 |
return -1; |
| 2109 |
} |
| 2110 |
|
| 2111 |
|
| 2112 |
static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { |
| 2113 |
return 0; |
| 2114 |
} |
| 2115 |
|
| 2116 |
|
| 2117 |
static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); |
| 2118 |
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); |
| 2119 |
static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); |
| 2120 |
static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); |
| 2121 |
static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); |
| 2122 |
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); |
| 2123 |
static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); |
| 2124 |
|
| 2125 |
static int __Pyx_modinit_global_init_code(void) { |
| 2126 |
__Pyx_RefNannyDeclarations |
| 2127 |
__Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); |
| 2128 |
|
| 2129 |
__Pyx_RefNannyFinishContext(); |
| 2130 |
return 0; |
| 2131 |
} |
| 2132 |
|
| 2133 |
static int __Pyx_modinit_variable_export_code(void) { |
| 2134 |
__Pyx_RefNannyDeclarations |
| 2135 |
__Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); |
| 2136 |
|
| 2137 |
__Pyx_RefNannyFinishContext(); |
| 2138 |
return 0; |
| 2139 |
} |
| 2140 |
|
| 2141 |
static int __Pyx_modinit_function_export_code(void) { |
| 2142 |
__Pyx_RefNannyDeclarations |
| 2143 |
__Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); |
| 2144 |
|
| 2145 |
__Pyx_RefNannyFinishContext(); |
| 2146 |
return 0; |
| 2147 |
} |
| 2148 |
|
| 2149 |
static int __Pyx_modinit_type_init_code(void) { |
| 2150 |
__Pyx_RefNannyDeclarations |
| 2151 |
__Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); |
| 2152 |
|
| 2153 |
__Pyx_RefNannyFinishContext(); |
| 2154 |
return 0; |
| 2155 |
} |
| 2156 |
|
| 2157 |
static int __Pyx_modinit_type_import_code(void) { |
| 2158 |
__Pyx_RefNannyDeclarations |
| 2159 |
__Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); |
| 2160 |
|
| 2161 |
__Pyx_RefNannyFinishContext(); |
| 2162 |
return 0; |
| 2163 |
} |
| 2164 |
|
| 2165 |
static int __Pyx_modinit_variable_import_code(void) { |
| 2166 |
__Pyx_RefNannyDeclarations |
| 2167 |
__Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); |
| 2168 |
|
| 2169 |
__Pyx_RefNannyFinishContext(); |
| 2170 |
return 0; |
| 2171 |
} |
| 2172 |
|
| 2173 |
static int __Pyx_modinit_function_import_code(void) { |
| 2174 |
__Pyx_RefNannyDeclarations |
| 2175 |
__Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); |
| 2176 |
|
| 2177 |
__Pyx_RefNannyFinishContext(); |
| 2178 |
return 0; |
| 2179 |
} |
| 2180 |
|
| 2181 |
|
| 2182 |
#if PY_MAJOR_VERSION >= 3 |
| 2183 |
#if CYTHON_PEP489_MULTI_PHASE_INIT |
| 2184 |
static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); |
| 2185 |
static int __pyx_pymod_exec_test_func(PyObject* module); |
| 2186 |
static PyModuleDef_Slot __pyx_moduledef_slots[] = { |
| 2187 |
{Py_mod_create, (void*)__pyx_pymod_create}, |
| 2188 |
{Py_mod_exec, (void*)__pyx_pymod_exec_test_func}, |
| 2189 |
{0, NULL} |
| 2190 |
}; |
| 2191 |
#endif |
| 2192 |
|
| 2193 |
#ifdef __cplusplus |
| 2194 |
namespace { |
| 2195 |
struct PyModuleDef __pyx_moduledef = |
| 2196 |
#else |
| 2197 |
static struct PyModuleDef __pyx_moduledef = |
| 2198 |
#endif |
| 2199 |
{ |
| 2200 |
PyModuleDef_HEAD_INIT, |
| 2201 |
"test_func", |
| 2202 |
0, |
| 2203 |
#if CYTHON_PEP489_MULTI_PHASE_INIT |
| 2204 |
0, |
| 2205 |
#elif CYTHON_USE_MODULE_STATE |
| 2206 |
sizeof(__pyx_mstate), |
| 2207 |
#else |
| 2208 |
-1, |
| 2209 |
#endif |
| 2210 |
__pyx_methods , |
| 2211 |
#if CYTHON_PEP489_MULTI_PHASE_INIT |
| 2212 |
__pyx_moduledef_slots, |
| 2213 |
#else |
| 2214 |
NULL, |
| 2215 |
#endif |
| 2216 |
#if CYTHON_USE_MODULE_STATE |
| 2217 |
__pyx_m_traverse, |
| 2218 |
__pyx_m_clear, |
| 2219 |
NULL |
| 2220 |
#else |
| 2221 |
NULL, |
| 2222 |
NULL, |
| 2223 |
NULL |
| 2224 |
#endif |
| 2225 |
}; |
| 2226 |
#ifdef __cplusplus |
| 2227 |
} |
| 2228 |
#endif |
| 2229 |
#endif |
| 2230 |
|
| 2231 |
#ifndef CYTHON_NO_PYINIT_EXPORT |
| 2232 |
#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC |
| 2233 |
#elif PY_MAJOR_VERSION < 3 |
| 2234 |
#ifdef __cplusplus |
| 2235 |
#define __Pyx_PyMODINIT_FUNC extern "C" void |
| 2236 |
#else |
| 2237 |
#define __Pyx_PyMODINIT_FUNC void |
| 2238 |
#endif |
| 2239 |
#else |
| 2240 |
#ifdef __cplusplus |
| 2241 |
#define __Pyx_PyMODINIT_FUNC extern "C" PyObject * |
| 2242 |
#else |
| 2243 |
#define __Pyx_PyMODINIT_FUNC PyObject * |
| 2244 |
#endif |
| 2245 |
#endif |
| 2246 |
|
| 2247 |
|
| 2248 |
#if PY_MAJOR_VERSION < 3 |
| 2249 |
__Pyx_PyMODINIT_FUNC inittest_func(void) CYTHON_SMALL_CODE; |
| 2250 |
__Pyx_PyMODINIT_FUNC inittest_func(void) |
| 2251 |
#else |
| 2252 |
__Pyx_PyMODINIT_FUNC PyInit_test_func(void) CYTHON_SMALL_CODE; |
| 2253 |
__Pyx_PyMODINIT_FUNC PyInit_test_func(void) |
| 2254 |
#if CYTHON_PEP489_MULTI_PHASE_INIT |
| 2255 |
{ |
| 2256 |
return PyModuleDef_Init(&__pyx_moduledef); |
| 2257 |
} |
| 2258 |
static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { |
| 2259 |
#if PY_VERSION_HEX >= 0x030700A1 |
| 2260 |
static PY_INT64_T main_interpreter_id = -1; |
| 2261 |
PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); |
| 2262 |
if (main_interpreter_id == -1) { |
| 2263 |
main_interpreter_id = current_id; |
| 2264 |
return (unlikely(current_id == -1)) ? -1 : 0; |
| 2265 |
} else if (unlikely(main_interpreter_id != current_id)) |
| 2266 |
#else |
| 2267 |
static PyInterpreterState *main_interpreter = NULL; |
| 2268 |
PyInterpreterState *current_interpreter = PyThreadState_Get()->interp; |
| 2269 |
if (!main_interpreter) { |
| 2270 |
main_interpreter = current_interpreter; |
| 2271 |
} else if (unlikely(main_interpreter != current_interpreter)) |
| 2272 |
#endif |
| 2273 |
{ |
| 2274 |
PyErr_SetString( |
| 2275 |
PyExc_ImportError, |
| 2276 |
"Interpreter change detected - this module can only be loaded into one interpreter per process."); |
| 2277 |
return -1; |
| 2278 |
} |
| 2279 |
return 0; |
| 2280 |
} |
| 2281 |
#if CYTHON_COMPILING_IN_LIMITED_API |
| 2282 |
static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *module, const char* from_name, const char* to_name, int allow_none) |
| 2283 |
#else |
| 2284 |
static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) |
| 2285 |
#endif |
| 2286 |
{ |
| 2287 |
PyObject *value = PyObject_GetAttrString(spec, from_name); |
| 2288 |
int result = 0; |
| 2289 |
if (likely(value)) { |
| 2290 |
if (allow_none || value != Py_None) { |
| 2291 |
#if CYTHON_COMPILING_IN_LIMITED_API |
| 2292 |
result = PyModule_AddObject(module, to_name, value); |
| 2293 |
#else |
| 2294 |
result = PyDict_SetItemString(moddict, to_name, value); |
| 2295 |
#endif |
| 2296 |
} |
| 2297 |
Py_DECREF(value); |
| 2298 |
} else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { |
| 2299 |
PyErr_Clear(); |
| 2300 |
} else { |
| 2301 |
result = -1; |
| 2302 |
} |
| 2303 |
return result; |
| 2304 |
} |
| 2305 |
static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) { |
| 2306 |
PyObject *module = NULL, *moddict, *modname; |
| 2307 |
CYTHON_UNUSED_VAR(def); |
| 2308 |
if (__Pyx_check_single_interpreter()) |
| 2309 |
return NULL; |
| 2310 |
if (__pyx_m) |
| 2311 |
return __Pyx_NewRef(__pyx_m); |
| 2312 |
modname = PyObject_GetAttrString(spec, "name"); |
| 2313 |
if (unlikely(!modname)) goto bad; |
| 2314 |
module = PyModule_NewObject(modname); |
| 2315 |
Py_DECREF(modname); |
| 2316 |
if (unlikely(!module)) goto bad; |
| 2317 |
#if CYTHON_COMPILING_IN_LIMITED_API |
| 2318 |
moddict = module; |
| 2319 |
#else |
| 2320 |
moddict = PyModule_GetDict(module); |
| 2321 |
if (unlikely(!moddict)) goto bad; |
| 2322 |
#endif |
| 2323 |
if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; |
| 2324 |
if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; |
| 2325 |
if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; |
| 2326 |
if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad; |
| 2327 |
return module; |
| 2328 |
bad: |
| 2329 |
Py_XDECREF(module); |
| 2330 |
return NULL; |
| 2331 |
} |
| 2332 |
|
| 2333 |
|
| 2334 |
static CYTHON_SMALL_CODE int __pyx_pymod_exec_test_func(PyObject *__pyx_pyinit_module) |
| 2335 |
#endif |
| 2336 |
#endif |
| 2337 |
{ |
| 2338 |
int stringtab_initialized = 0; |
| 2339 |
#if CYTHON_USE_MODULE_STATE |
| 2340 |
int pystate_addmodule_run = 0; |
| 2341 |
#endif |
| 2342 |
PyObject *__pyx_t_1 = NULL; |
| 2343 |
PyObject *__pyx_t_2 = NULL; |
| 2344 |
int __pyx_lineno = 0; |
| 2345 |
const char *__pyx_filename = NULL; |
| 2346 |
int __pyx_clineno = 0; |
| 2347 |
__Pyx_RefNannyDeclarations |
| 2348 |
#if CYTHON_PEP489_MULTI_PHASE_INIT |
| 2349 |
if (__pyx_m) { |
| 2350 |
if (__pyx_m == __pyx_pyinit_module) return 0; |
| 2351 |
PyErr_SetString(PyExc_RuntimeError, "Module 'test_func' has already been imported. Re-initialisation is not supported."); |
| 2352 |
return -1; |
| 2353 |
} |
| 2354 |
#elif PY_MAJOR_VERSION >= 3 |
| 2355 |
if (__pyx_m) return __Pyx_NewRef(__pyx_m); |
| 2356 |
#endif |
| 2357 |
|
| 2358 |
#if CYTHON_PEP489_MULTI_PHASE_INIT |
| 2359 |
__pyx_m = __pyx_pyinit_module; |
| 2360 |
Py_INCREF(__pyx_m); |
| 2361 |
#else |
| 2362 |
#if PY_MAJOR_VERSION < 3 |
| 2363 |
__pyx_m = Py_InitModule4("test_func", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); |
| 2364 |
if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) |
| 2365 |
#elif CYTHON_USE_MODULE_STATE |
| 2366 |
__pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) |
| 2367 |
{ |
| 2368 |
int add_module_result = PyState_AddModule(__pyx_t_1, &__pyx_moduledef); |
| 2369 |
__pyx_t_1 = 0; |
| 2370 |
if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error) |
| 2371 |
pystate_addmodule_run = 1; |
| 2372 |
} |
| 2373 |
#else |
| 2374 |
__pyx_m = PyModule_Create(&__pyx_moduledef); |
| 2375 |
if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) |
| 2376 |
#endif |
| 2377 |
#endif |
| 2378 |
CYTHON_UNUSED_VAR(__pyx_t_1); |
| 2379 |
__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) |
| 2380 |
Py_INCREF(__pyx_d); |
| 2381 |
__pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) |
| 2382 |
Py_INCREF(__pyx_b); |
| 2383 |
__pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) |
| 2384 |
Py_INCREF(__pyx_cython_runtime); |
| 2385 |
if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error) |
| 2386 |
#if CYTHON_REFNANNY |
| 2387 |
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); |
| 2388 |
if (!__Pyx_RefNanny) { |
| 2389 |
PyErr_Clear(); |
| 2390 |
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); |
| 2391 |
if (!__Pyx_RefNanny) |
| 2392 |
Py_FatalError("failed to import 'refnanny' module"); |
| 2393 |
} |
| 2394 |
#endif |
| 2395 |
__Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_test_func(void)", 0); |
| 2396 |
if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) |
| 2397 |
#ifdef __Pxy_PyFrame_Initialize_Offsets |
| 2398 |
__Pxy_PyFrame_Initialize_Offsets(); |
| 2399 |
#endif |
| 2400 |
__pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) |
| 2401 |
__pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) |
| 2402 |
__pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) |
| 2403 |
#ifdef __Pyx_CyFunction_USED |
| 2404 |
if (__pyx_CyFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) |
| 2405 |
#endif |
| 2406 |
#ifdef __Pyx_FusedFunction_USED |
| 2407 |
if (__pyx_FusedFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) |
| 2408 |
#endif |
| 2409 |
#ifdef __Pyx_Coroutine_USED |
| 2410 |
if (__pyx_Coroutine_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) |
| 2411 |
#endif |
| 2412 |
#ifdef __Pyx_Generator_USED |
| 2413 |
if (__pyx_Generator_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) |
| 2414 |
#endif |
| 2415 |
#ifdef __Pyx_AsyncGen_USED |
| 2416 |
if (__pyx_AsyncGen_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) |
| 2417 |
#endif |
| 2418 |
#ifdef __Pyx_StopAsyncIteration_USED |
| 2419 |
if (__pyx_StopAsyncIteration_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) |
| 2420 |
#endif |
| 2421 |
|
| 2422 |
|
| 2423 |
#if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS |
| 2424 |
PyEval_InitThreads(); |
| 2425 |
#endif |
| 2426 |
|
| 2427 |
if (__Pyx_InitConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) |
| 2428 |
stringtab_initialized = 1; |
| 2429 |
if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) |
| 2430 |
#if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) |
| 2431 |
if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) |
| 2432 |
#endif |
| 2433 |
if (__pyx_module_is_main_test_func) { |
| 2434 |
if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) |
| 2435 |
} |
| 2436 |
#if PY_MAJOR_VERSION >= 3 |
| 2437 |
{ |
| 2438 |
PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) |
| 2439 |
if (!PyDict_GetItemString(modules, "test_func")) { |
| 2440 |
if (unlikely((PyDict_SetItemString(modules, "test_func", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) |
| 2441 |
} |
| 2442 |
} |
| 2443 |
#endif |
| 2444 |
|
| 2445 |
if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) |
| 2446 |
|
| 2447 |
if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) |
| 2448 |
|
| 2449 |
(void)__Pyx_modinit_global_init_code(); |
| 2450 |
(void)__Pyx_modinit_variable_export_code(); |
| 2451 |
(void)__Pyx_modinit_function_export_code(); |
| 2452 |
(void)__Pyx_modinit_type_init_code(); |
| 2453 |
(void)__Pyx_modinit_type_import_code(); |
| 2454 |
(void)__Pyx_modinit_variable_import_code(); |
| 2455 |
(void)__Pyx_modinit_function_import_code(); |
| 2456 |
|
| 2457 |
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) |
| 2458 |
if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) |
| 2459 |
#endif |
| 2460 |
|
| 2461 |
|
| 2462 |
|
| 2463 |
|
| 2464 |
|
| 2465 |
__pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_9test_func_1f, 0, __pyx_n_s_f, NULL, __pyx_n_s_test_func, __pyx_d, ((PyObject *)__pyx_codeobj_)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error) |
| 2466 |
__Pyx_GOTREF(__pyx_t_2); |
| 2467 |
if (PyDict_SetItem(__pyx_d, __pyx_n_s_f, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error) |
| 2468 |
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 2469 |
__pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error) |
| 2470 |
__Pyx_GOTREF(__pyx_t_2); |
| 2471 |
if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error) |
| 2472 |
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 2473 |
|
| 2474 |
|
| 2475 |
|
| 2476 |
goto __pyx_L0; |
| 2477 |
__pyx_L1_error:; |
| 2478 |
__Pyx_XDECREF(__pyx_t_2); |
| 2479 |
if (__pyx_m) { |
| 2480 |
if (__pyx_d && stringtab_initialized) { |
| 2481 |
__Pyx_AddTraceback("init test_func", __pyx_clineno, __pyx_lineno, __pyx_filename); |
| 2482 |
} |
| 2483 |
#if !CYTHON_USE_MODULE_STATE |
| 2484 |
Py_CLEAR(__pyx_m); |
| 2485 |
#else |
| 2486 |
Py_DECREF(__pyx_m); |
| 2487 |
if (pystate_addmodule_run) { |
| 2488 |
PyObject *tp, *value, *tb; |
| 2489 |
PyErr_Fetch(&tp, &value, &tb); |
| 2490 |
PyState_RemoveModule(&__pyx_moduledef); |
| 2491 |
PyErr_Restore(tp, value, tb); |
| 2492 |
} |
| 2493 |
#endif |
| 2494 |
} else if (!PyErr_Occurred()) { |
| 2495 |
PyErr_SetString(PyExc_ImportError, "init test_func"); |
| 2496 |
} |
| 2497 |
__pyx_L0:; |
| 2498 |
__Pyx_RefNannyFinishContext(); |
| 2499 |
#if CYTHON_PEP489_MULTI_PHASE_INIT |
| 2500 |
return (__pyx_m != NULL) ? 0 : -1; |
| 2501 |
#elif PY_MAJOR_VERSION >= 3 |
| 2502 |
return __pyx_m; |
| 2503 |
#else |
| 2504 |
return; |
| 2505 |
#endif |
| 2506 |
} |
| 2507 |
|
| 2508 |
|
| 2509 |
|
| 2510 |
|
| 2511 |
#ifdef _MSC_VER |
| 2512 |
#pragma warning( push ) |
| 2513 |
|
| 2514 |
|
| 2515 |
|
| 2516 |
|
| 2517 |
#pragma warning( disable : 4127 ) |
| 2518 |
#endif |
| 2519 |
|
| 2520 |
|
| 2521 |
|
| 2522 |
|
| 2523 |
|
| 2524 |
|
| 2525 |
|
| 2526 |
#if CYTHON_REFNANNY |
| 2527 |
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { |
| 2528 |
PyObject *m = NULL, *p = NULL; |
| 2529 |
void *r = NULL; |
| 2530 |
m = PyImport_ImportModule(modname); |
| 2531 |
if (!m) goto end; |
| 2532 |
p = PyObject_GetAttrString(m, "RefNannyAPI"); |
| 2533 |
if (!p) goto end; |
| 2534 |
r = PyLong_AsVoidPtr(p); |
| 2535 |
end: |
| 2536 |
Py_XDECREF(p); |
| 2537 |
Py_XDECREF(m); |
| 2538 |
return (__Pyx_RefNannyAPIStruct *)r; |
| 2539 |
} |
| 2540 |
#endif |
| 2541 |
|
| 2542 |
|
| 2543 |
#if CYTHON_COMPILING_IN_CPYTHON |
| 2544 |
static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) { |
| 2545 |
PyObject *v; |
| 2546 |
Py_ssize_t i; |
| 2547 |
for (i = 0; i < length; i++) { |
| 2548 |
v = dest[i] = src[i]; |
| 2549 |
Py_INCREF(v); |
| 2550 |
} |
| 2551 |
} |
| 2552 |
static CYTHON_INLINE PyObject * |
| 2553 |
__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) |
| 2554 |
{ |
| 2555 |
PyObject *res; |
| 2556 |
if (n <= 0) { |
| 2557 |
Py_INCREF(__pyx_empty_tuple); |
| 2558 |
return __pyx_empty_tuple; |
| 2559 |
} |
| 2560 |
res = PyTuple_New(n); |
| 2561 |
if (unlikely(res == NULL)) return NULL; |
| 2562 |
__Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n); |
| 2563 |
return res; |
| 2564 |
} |
| 2565 |
static CYTHON_INLINE PyObject * |
| 2566 |
__Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n) |
| 2567 |
{ |
| 2568 |
PyObject *res; |
| 2569 |
if (n <= 0) { |
| 2570 |
return PyList_New(0); |
| 2571 |
} |
| 2572 |
res = PyList_New(n); |
| 2573 |
if (unlikely(res == NULL)) return NULL; |
| 2574 |
__Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n); |
| 2575 |
return res; |
| 2576 |
} |
| 2577 |
#endif |
| 2578 |
|
| 2579 |
|
| 2580 |
static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { |
| 2581 |
#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API |
| 2582 |
return PyObject_RichCompareBool(s1, s2, equals); |
| 2583 |
#else |
| 2584 |
if (s1 == s2) { |
| 2585 |
return (equals == Py_EQ); |
| 2586 |
} else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { |
| 2587 |
const char *ps1, *ps2; |
| 2588 |
Py_ssize_t length = PyBytes_GET_SIZE(s1); |
| 2589 |
if (length != PyBytes_GET_SIZE(s2)) |
| 2590 |
return (equals == Py_NE); |
| 2591 |
ps1 = PyBytes_AS_STRING(s1); |
| 2592 |
ps2 = PyBytes_AS_STRING(s2); |
| 2593 |
if (ps1[0] != ps2[0]) { |
| 2594 |
return (equals == Py_NE); |
| 2595 |
} else if (length == 1) { |
| 2596 |
return (equals == Py_EQ); |
| 2597 |
} else { |
| 2598 |
int result; |
| 2599 |
#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000) |
| 2600 |
Py_hash_t hash1, hash2; |
| 2601 |
hash1 = ((PyBytesObject*)s1)->ob_shash; |
| 2602 |
hash2 = ((PyBytesObject*)s2)->ob_shash; |
| 2603 |
if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { |
| 2604 |
return (equals == Py_NE); |
| 2605 |
} |
| 2606 |
#endif |
| 2607 |
result = memcmp(ps1, ps2, (size_t)length); |
| 2608 |
return (equals == Py_EQ) ? (result == 0) : (result != 0); |
| 2609 |
} |
| 2610 |
} else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { |
| 2611 |
return (equals == Py_NE); |
| 2612 |
} else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { |
| 2613 |
return (equals == Py_NE); |
| 2614 |
} else { |
| 2615 |
int result; |
| 2616 |
PyObject* py_result = PyObject_RichCompare(s1, s2, equals); |
| 2617 |
if (!py_result) |
| 2618 |
return -1; |
| 2619 |
result = __Pyx_PyObject_IsTrue(py_result); |
| 2620 |
Py_DECREF(py_result); |
| 2621 |
return result; |
| 2622 |
} |
| 2623 |
#endif |
| 2624 |
} |
| 2625 |
|
| 2626 |
|
| 2627 |
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { |
| 2628 |
#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API |
| 2629 |
return PyObject_RichCompareBool(s1, s2, equals); |
| 2630 |
#else |
| 2631 |
#if PY_MAJOR_VERSION < 3 |
| 2632 |
PyObject* owned_ref = NULL; |
| 2633 |
#endif |
| 2634 |
int s1_is_unicode, s2_is_unicode; |
| 2635 |
if (s1 == s2) { |
| 2636 |
goto return_eq; |
| 2637 |
} |
| 2638 |
s1_is_unicode = PyUnicode_CheckExact(s1); |
| 2639 |
s2_is_unicode = PyUnicode_CheckExact(s2); |
| 2640 |
#if PY_MAJOR_VERSION < 3 |
| 2641 |
if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) { |
| 2642 |
owned_ref = PyUnicode_FromObject(s2); |
| 2643 |
if (unlikely(!owned_ref)) |
| 2644 |
return -1; |
| 2645 |
s2 = owned_ref; |
| 2646 |
s2_is_unicode = 1; |
| 2647 |
} else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) { |
| 2648 |
owned_ref = PyUnicode_FromObject(s1); |
| 2649 |
if (unlikely(!owned_ref)) |
| 2650 |
return -1; |
| 2651 |
s1 = owned_ref; |
| 2652 |
s1_is_unicode = 1; |
| 2653 |
} else if (((!s2_is_unicode) & (!s1_is_unicode))) { |
| 2654 |
return __Pyx_PyBytes_Equals(s1, s2, equals); |
| 2655 |
} |
| 2656 |
#endif |
| 2657 |
if (s1_is_unicode & s2_is_unicode) { |
| 2658 |
Py_ssize_t length; |
| 2659 |
int kind; |
| 2660 |
void *data1, *data2; |
| 2661 |
if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) |
| 2662 |
return -1; |
| 2663 |
length = __Pyx_PyUnicode_GET_LENGTH(s1); |
| 2664 |
if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { |
| 2665 |
goto return_ne; |
| 2666 |
} |
| 2667 |
#if CYTHON_USE_UNICODE_INTERNALS |
| 2668 |
{ |
| 2669 |
Py_hash_t hash1, hash2; |
| 2670 |
#if CYTHON_PEP393_ENABLED |
| 2671 |
hash1 = ((PyASCIIObject*)s1)->hash; |
| 2672 |
hash2 = ((PyASCIIObject*)s2)->hash; |
| 2673 |
#else |
| 2674 |
hash1 = ((PyUnicodeObject*)s1)->hash; |
| 2675 |
hash2 = ((PyUnicodeObject*)s2)->hash; |
| 2676 |
#endif |
| 2677 |
if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { |
| 2678 |
goto return_ne; |
| 2679 |
} |
| 2680 |
} |
| 2681 |
#endif |
| 2682 |
kind = __Pyx_PyUnicode_KIND(s1); |
| 2683 |
if (kind != __Pyx_PyUnicode_KIND(s2)) { |
| 2684 |
goto return_ne; |
| 2685 |
} |
| 2686 |
data1 = __Pyx_PyUnicode_DATA(s1); |
| 2687 |
data2 = __Pyx_PyUnicode_DATA(s2); |
| 2688 |
if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { |
| 2689 |
goto return_ne; |
| 2690 |
} else if (length == 1) { |
| 2691 |
goto return_eq; |
| 2692 |
} else { |
| 2693 |
int result = memcmp(data1, data2, (size_t)(length * kind)); |
| 2694 |
#if PY_MAJOR_VERSION < 3 |
| 2695 |
Py_XDECREF(owned_ref); |
| 2696 |
#endif |
| 2697 |
return (equals == Py_EQ) ? (result == 0) : (result != 0); |
| 2698 |
} |
| 2699 |
} else if ((s1 == Py_None) & s2_is_unicode) { |
| 2700 |
goto return_ne; |
| 2701 |
} else if ((s2 == Py_None) & s1_is_unicode) { |
| 2702 |
goto return_ne; |
| 2703 |
} else { |
| 2704 |
int result; |
| 2705 |
PyObject* py_result = PyObject_RichCompare(s1, s2, equals); |
| 2706 |
#if PY_MAJOR_VERSION < 3 |
| 2707 |
Py_XDECREF(owned_ref); |
| 2708 |
#endif |
| 2709 |
if (!py_result) |
| 2710 |
return -1; |
| 2711 |
result = __Pyx_PyObject_IsTrue(py_result); |
| 2712 |
Py_DECREF(py_result); |
| 2713 |
return result; |
| 2714 |
} |
| 2715 |
return_eq: |
| 2716 |
#if PY_MAJOR_VERSION < 3 |
| 2717 |
Py_XDECREF(owned_ref); |
| 2718 |
#endif |
| 2719 |
return (equals == Py_EQ); |
| 2720 |
return_ne: |
| 2721 |
#if PY_MAJOR_VERSION < 3 |
| 2722 |
Py_XDECREF(owned_ref); |
| 2723 |
#endif |
| 2724 |
return (equals == Py_NE); |
| 2725 |
#endif |
| 2726 |
} |
| 2727 |
|
| 2728 |
|
| 2729 |
#if CYTHON_METH_FASTCALL |
| 2730 |
static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s) |
| 2731 |
{ |
| 2732 |
Py_ssize_t i, n = PyTuple_GET_SIZE(kwnames); |
| 2733 |
for (i = 0; i < n; i++) |
| 2734 |
{ |
| 2735 |
if (s == PyTuple_GET_ITEM(kwnames, i)) return kwvalues[i]; |
| 2736 |
} |
| 2737 |
for (i = 0; i < n; i++) |
| 2738 |
{ |
| 2739 |
int eq = __Pyx_PyUnicode_Equals(s, PyTuple_GET_ITEM(kwnames, i), Py_EQ); |
| 2740 |
if (unlikely(eq != 0)) { |
| 2741 |
if (unlikely(eq < 0)) return NULL; |
| 2742 |
return kwvalues[i]; |
| 2743 |
} |
| 2744 |
} |
| 2745 |
return NULL; |
| 2746 |
} |
| 2747 |
#endif |
| 2748 |
|
| 2749 |
|
| 2750 |
#if CYTHON_USE_TYPE_SPECS |
| 2751 |
static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) { |
| 2752 |
#if PY_VERSION_HEX > 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API |
| 2753 |
CYTHON_UNUSED_VAR(spec); |
| 2754 |
CYTHON_UNUSED_VAR(type); |
| 2755 |
#else |
| 2756 |
const PyType_Slot *slot = spec->slots; |
| 2757 |
while (slot && slot->slot && slot->slot != Py_tp_members) |
| 2758 |
slot++; |
| 2759 |
if (slot && slot->slot == Py_tp_members) { |
| 2760 |
int changed = 0; |
| 2761 |
#if !(PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON) |
| 2762 |
const |
| 2763 |
#endif |
| 2764 |
PyMemberDef *memb = (PyMemberDef*) slot->pfunc; |
| 2765 |
while (memb && memb->name) { |
| 2766 |
if (memb->name[0] == '_' && memb->name[1] == '_') { |
| 2767 |
#if PY_VERSION_HEX < 0x030900b1 |
| 2768 |
if (strcmp(memb->name, "__weaklistoffset__") == 0) { |
| 2769 |
assert(memb->type == T_PYSSIZET); |
| 2770 |
assert(memb->flags == READONLY); |
| 2771 |
type->tp_weaklistoffset = memb->offset; |
| 2772 |
changed = 1; |
| 2773 |
} |
| 2774 |
else if (strcmp(memb->name, "__dictoffset__") == 0) { |
| 2775 |
assert(memb->type == T_PYSSIZET); |
| 2776 |
assert(memb->flags == READONLY); |
| 2777 |
type->tp_dictoffset = memb->offset; |
| 2778 |
changed = 1; |
| 2779 |
} |
| 2780 |
#if CYTHON_METH_FASTCALL |
| 2781 |
else if (strcmp(memb->name, "__vectorcalloffset__") == 0) { |
| 2782 |
assert(memb->type == T_PYSSIZET); |
| 2783 |
assert(memb->flags == READONLY); |
| 2784 |
#if PY_VERSION_HEX >= 0x030800b4 |
| 2785 |
type->tp_vectorcall_offset = memb->offset; |
| 2786 |
#else |
| 2787 |
type->tp_print = (printfunc) memb->offset; |
| 2788 |
#endif |
| 2789 |
changed = 1; |
| 2790 |
} |
| 2791 |
#endif |
| 2792 |
#else |
| 2793 |
if ((0)); |
| 2794 |
#endif |
| 2795 |
#if PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON |
| 2796 |
else if (strcmp(memb->name, "__module__") == 0) { |
| 2797 |
PyObject *descr; |
| 2798 |
assert(memb->type == T_OBJECT); |
| 2799 |
assert(memb->flags == 0 || memb->flags == READONLY); |
| 2800 |
descr = PyDescr_NewMember(type, memb); |
| 2801 |
if (unlikely(!descr)) |
| 2802 |
return -1; |
| 2803 |
if (unlikely(PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr) < 0)) { |
| 2804 |
Py_DECREF(descr); |
| 2805 |
return -1; |
| 2806 |
} |
| 2807 |
Py_DECREF(descr); |
| 2808 |
changed = 1; |
| 2809 |
} |
| 2810 |
#endif |
| 2811 |
} |
| 2812 |
memb++; |
| 2813 |
} |
| 2814 |
if (changed) |
| 2815 |
PyType_Modified(type); |
| 2816 |
} |
| 2817 |
#endif |
| 2818 |
return 0; |
| 2819 |
} |
| 2820 |
#endif |
| 2821 |
|
| 2822 |
|
| 2823 |
static PyObject *__Pyx_FetchSharedCythonABIModule(void) { |
| 2824 |
PyObject *abi_module = PyImport_AddModule((char*) __PYX_ABI_MODULE_NAME); |
| 2825 |
if (unlikely(!abi_module)) return NULL; |
| 2826 |
Py_INCREF(abi_module); |
| 2827 |
return abi_module; |
| 2828 |
} |
| 2829 |
|
| 2830 |
|
| 2831 |
static int __Pyx_VerifyCachedType(PyObject *cached_type, |
| 2832 |
const char *name, |
| 2833 |
Py_ssize_t basicsize, |
| 2834 |
Py_ssize_t expected_basicsize) { |
| 2835 |
if (!PyType_Check(cached_type)) { |
| 2836 |
PyErr_Format(PyExc_TypeError, |
| 2837 |
"Shared Cython type %.200s is not a type object", name); |
| 2838 |
return -1; |
| 2839 |
} |
| 2840 |
if (basicsize != expected_basicsize) { |
| 2841 |
PyErr_Format(PyExc_TypeError, |
| 2842 |
"Shared Cython type %.200s has the wrong size, try recompiling", |
| 2843 |
name); |
| 2844 |
return -1; |
| 2845 |
} |
| 2846 |
return 0; |
| 2847 |
} |
| 2848 |
#if !CYTHON_USE_TYPE_SPECS |
| 2849 |
static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { |
| 2850 |
PyObject* abi_module; |
| 2851 |
const char* object_name; |
| 2852 |
PyTypeObject *cached_type = NULL; |
| 2853 |
abi_module = __Pyx_FetchSharedCythonABIModule(); |
| 2854 |
if (!abi_module) return NULL; |
| 2855 |
object_name = strrchr(type->tp_name, '.'); |
| 2856 |
object_name = object_name ? object_name+1 : type->tp_name; |
| 2857 |
cached_type = (PyTypeObject*) PyObject_GetAttrString(abi_module, object_name); |
| 2858 |
if (cached_type) { |
| 2859 |
if (__Pyx_VerifyCachedType( |
| 2860 |
(PyObject *)cached_type, |
| 2861 |
object_name, |
| 2862 |
cached_type->tp_basicsize, |
| 2863 |
type->tp_basicsize) < 0) { |
| 2864 |
goto bad; |
| 2865 |
} |
| 2866 |
goto done; |
| 2867 |
} |
| 2868 |
if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; |
| 2869 |
PyErr_Clear(); |
| 2870 |
if (PyType_Ready(type) < 0) goto bad; |
| 2871 |
if (PyObject_SetAttrString(abi_module, object_name, (PyObject *)type) < 0) |
| 2872 |
goto bad; |
| 2873 |
Py_INCREF(type); |
| 2874 |
cached_type = type; |
| 2875 |
done: |
| 2876 |
Py_DECREF(abi_module); |
| 2877 |
return cached_type; |
| 2878 |
bad: |
| 2879 |
Py_XDECREF(cached_type); |
| 2880 |
cached_type = NULL; |
| 2881 |
goto done; |
| 2882 |
} |
| 2883 |
#else |
| 2884 |
static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases) { |
| 2885 |
PyObject *abi_module, *cached_type = NULL; |
| 2886 |
const char* object_name = strrchr(spec->name, '.'); |
| 2887 |
object_name = object_name ? object_name+1 : spec->name; |
| 2888 |
abi_module = __Pyx_FetchSharedCythonABIModule(); |
| 2889 |
if (!abi_module) return NULL; |
| 2890 |
cached_type = PyObject_GetAttrString(abi_module, object_name); |
| 2891 |
if (cached_type) { |
| 2892 |
Py_ssize_t basicsize; |
| 2893 |
#if CYTHON_COMPILING_IN_LIMITED_API |
| 2894 |
PyObject *py_basicsize; |
| 2895 |
py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__"); |
| 2896 |
if (unlikely(!py_basicsize)) goto bad; |
| 2897 |
basicsize = PyLong_AsSsize_t(py_basicsize); |
| 2898 |
Py_DECREF(py_basicsize); |
| 2899 |
py_basicsize = 0; |
| 2900 |
if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; |
| 2901 |
#else |
| 2902 |
basicsize = likely(PyType_Check(cached_type)) ? ((PyTypeObject*) cached_type)->tp_basicsize : -1; |
| 2903 |
#endif |
| 2904 |
if (__Pyx_VerifyCachedType( |
| 2905 |
cached_type, |
| 2906 |
object_name, |
| 2907 |
basicsize, |
| 2908 |
spec->basicsize) < 0) { |
| 2909 |
goto bad; |
| 2910 |
} |
| 2911 |
goto done; |
| 2912 |
} |
| 2913 |
if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; |
| 2914 |
PyErr_Clear(); |
| 2915 |
CYTHON_UNUSED_VAR(module); |
| 2916 |
cached_type = __Pyx_PyType_FromModuleAndSpec(abi_module, spec, bases); |
| 2917 |
if (unlikely(!cached_type)) goto bad; |
| 2918 |
if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad; |
| 2919 |
if (PyObject_SetAttrString(abi_module, object_name, cached_type) < 0) goto bad; |
| 2920 |
done: |
| 2921 |
Py_DECREF(abi_module); |
| 2922 |
assert(cached_type == NULL || PyType_Check(cached_type)); |
| 2923 |
return (PyTypeObject *) cached_type; |
| 2924 |
bad: |
| 2925 |
Py_XDECREF(cached_type); |
| 2926 |
cached_type = NULL; |
| 2927 |
goto done; |
| 2928 |
} |
| 2929 |
#endif |
| 2930 |
|
| 2931 |
|
| 2932 |
#if CYTHON_USE_TYPE_SLOTS |
| 2933 |
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { |
| 2934 |
PyTypeObject* tp = Py_TYPE(obj); |
| 2935 |
if (likely(tp->tp_getattro)) |
| 2936 |
return tp->tp_getattro(obj, attr_name); |
| 2937 |
#if PY_MAJOR_VERSION < 3 |
| 2938 |
if (likely(tp->tp_getattr)) |
| 2939 |
return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); |
| 2940 |
#endif |
| 2941 |
return PyObject_GetAttr(obj, attr_name); |
| 2942 |
} |
| 2943 |
#endif |
| 2944 |
|
| 2945 |
|
| 2946 |
#if CYTHON_METH_FASTCALL |
| 2947 |
static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) |
| 2948 |
{ |
| 2949 |
PyObject *res = NULL; |
| 2950 |
PyObject *kwnames; |
| 2951 |
PyObject **newargs; |
| 2952 |
PyObject **kwvalues; |
| 2953 |
Py_ssize_t i, pos; |
| 2954 |
size_t j; |
| 2955 |
PyObject *key, *value; |
| 2956 |
unsigned long keys_are_strings; |
| 2957 |
Py_ssize_t nkw = PyDict_GET_SIZE(kw); |
| 2958 |
newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0])); |
| 2959 |
if (unlikely(newargs == NULL)) { |
| 2960 |
PyErr_NoMemory(); |
| 2961 |
return NULL; |
| 2962 |
} |
| 2963 |
for (j = 0; j < nargs; j++) newargs[j] = args[j]; |
| 2964 |
kwnames = PyTuple_New(nkw); |
| 2965 |
if (unlikely(kwnames == NULL)) { |
| 2966 |
PyMem_Free(newargs); |
| 2967 |
return NULL; |
| 2968 |
} |
| 2969 |
kwvalues = newargs + nargs; |
| 2970 |
pos = i = 0; |
| 2971 |
keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS; |
| 2972 |
while (PyDict_Next(kw, &pos, &key, &value)) { |
| 2973 |
keys_are_strings &= Py_TYPE(key)->tp_flags; |
| 2974 |
Py_INCREF(key); |
| 2975 |
Py_INCREF(value); |
| 2976 |
PyTuple_SET_ITEM(kwnames, i, key); |
| 2977 |
kwvalues[i] = value; |
| 2978 |
i++; |
| 2979 |
} |
| 2980 |
if (unlikely(!keys_are_strings)) { |
| 2981 |
PyErr_SetString(PyExc_TypeError, "keywords must be strings"); |
| 2982 |
goto cleanup; |
| 2983 |
} |
| 2984 |
res = vc(func, newargs, nargs, kwnames); |
| 2985 |
cleanup: |
| 2986 |
Py_DECREF(kwnames); |
| 2987 |
for (i = 0; i < nkw; i++) |
| 2988 |
Py_DECREF(kwvalues[i]); |
| 2989 |
PyMem_Free(newargs); |
| 2990 |
return res; |
| 2991 |
} |
| 2992 |
static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) |
| 2993 |
{ |
| 2994 |
if (likely(kw == NULL) || PyDict_GET_SIZE(kw) == 0) { |
| 2995 |
return vc(func, args, nargs, NULL); |
| 2996 |
} |
| 2997 |
return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw); |
| 2998 |
} |
| 2999 |
#endif |
| 3000 |
|
| 3001 |
|
| 3002 |
static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) { |
| 3003 |
#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API |
| 3004 |
__Pyx_Py_XDECREF_SET( |
| 3005 |
__Pyx_CyFunction_GetClassObj(f), |
| 3006 |
((classobj) ? __Pyx_NewRef(classobj) : NULL)); |
| 3007 |
#else |
| 3008 |
__Pyx_Py_XDECREF_SET( |
| 3009 |
((PyCMethodObject *) (f))->mm_class, |
| 3010 |
(PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL)); |
| 3011 |
#endif |
| 3012 |
} |
| 3013 |
static PyObject * |
| 3014 |
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure) |
| 3015 |
{ |
| 3016 |
CYTHON_UNUSED_VAR(closure); |
| 3017 |
if (unlikely(op->func_doc == NULL)) { |
| 3018 |
#if CYTHON_COMPILING_IN_LIMITED_API |
| 3019 |
op->func_doc = PyObject_GetAttrString(op->func, "__doc__"); |
| 3020 |
if (unlikely(!op->func_doc)) return NULL; |
| 3021 |
#else |
| 3022 |
if (((PyCFunctionObject*)op)->m_ml->ml_doc) { |
| 3023 |
#if PY_MAJOR_VERSION >= 3 |
| 3024 |
op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); |
| 3025 |
#else |
| 3026 |
op->func_doc = PyString_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); |
| 3027 |
#endif |
| 3028 |
if (unlikely(op->func_doc == NULL)) |
| 3029 |
return NULL; |
| 3030 |
} else { |
| 3031 |
Py_INCREF(Py_None); |
| 3032 |
return Py_None; |
| 3033 |
} |
| 3034 |
#endif |
| 3035 |
} |
| 3036 |
Py_INCREF(op->func_doc); |
| 3037 |
return op->func_doc; |
| 3038 |
} |
| 3039 |
static int |
| 3040 |
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context) |
| 3041 |
{ |
| 3042 |
CYTHON_UNUSED_VAR(context); |
| 3043 |
if (value == NULL) { |
| 3044 |
value = Py_None; |
| 3045 |
} |
| 3046 |
Py_INCREF(value); |
| 3047 |
__Pyx_Py_XDECREF_SET(op->func_doc, value); |
| 3048 |
return 0; |
| 3049 |
} |
| 3050 |
static PyObject * |
| 3051 |
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context) |
| 3052 |
{ |
| 3053 |
CYTHON_UNUSED_VAR(context); |
| 3054 |
if (unlikely(op->func_name == NULL)) { |
| 3055 |
#if CYTHON_COMPILING_IN_LIMITED_API |
| 3056 |
op->func_name = PyObject_GetAttrString(op->func, "__name__"); |
| 3057 |
#elif PY_MAJOR_VERSION >= 3 |
| 3058 |
op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); |
| 3059 |
#else |
| 3060 |
op->func_name = PyString_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); |
| 3061 |
#endif |
| 3062 |
if (unlikely(op->func_name == NULL)) |
| 3063 |
return NULL; |
| 3064 |
} |
| 3065 |
Py_INCREF(op->func_name); |
| 3066 |
return op->func_name; |
| 3067 |
} |
| 3068 |
static int |
| 3069 |
__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context) |
| 3070 |
{ |
| 3071 |
CYTHON_UNUSED_VAR(context); |
| 3072 |
#if PY_MAJOR_VERSION >= 3 |
| 3073 |
if (unlikely(value == NULL || !PyUnicode_Check(value))) |
| 3074 |
#else |
| 3075 |
if (unlikely(value == NULL || !PyString_Check(value))) |
| 3076 |
#endif |
| 3077 |
{ |
| 3078 |
PyErr_SetString(PyExc_TypeError, |
| 3079 |
"__name__ must be set to a string object"); |
| 3080 |
return -1; |
| 3081 |
} |
| 3082 |
Py_INCREF(value); |
| 3083 |
__Pyx_Py_XDECREF_SET(op->func_name, value); |
| 3084 |
return 0; |
| 3085 |
} |
| 3086 |
static PyObject * |
| 3087 |
__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context) |
| 3088 |
{ |
| 3089 |
CYTHON_UNUSED_VAR(context); |
| 3090 |
Py_INCREF(op->func_qualname); |
| 3091 |
return op->func_qualname; |
| 3092 |
} |
| 3093 |
static int |
| 3094 |
__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context) |
| 3095 |
{ |
| 3096 |
CYTHON_UNUSED_VAR(context); |
| 3097 |
#if PY_MAJOR_VERSION >= 3 |
| 3098 |
if (unlikely(value == NULL || !PyUnicode_Check(value))) |
| 3099 |
#else |
| 3100 |
if (unlikely(value == NULL || !PyString_Check(value))) |
| 3101 |
#endif |
| 3102 |
{ |
| 3103 |
PyErr_SetString(PyExc_TypeError, |
| 3104 |
"__qualname__ must be set to a string object"); |
| 3105 |
return -1; |
| 3106 |
} |
| 3107 |
Py_INCREF(value); |
| 3108 |
__Pyx_Py_XDECREF_SET(op->func_qualname, value); |
| 3109 |
return 0; |
| 3110 |
} |
| 3111 |
static PyObject * |
| 3112 |
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context) |
| 3113 |
{ |
| 3114 |
CYTHON_UNUSED_VAR(context); |
| 3115 |
if (unlikely(op->func_dict == NULL)) { |
| 3116 |
op->func_dict = PyDict_New(); |
| 3117 |
if (unlikely(op->func_dict == NULL)) |
| 3118 |
return NULL; |
| 3119 |
} |
| 3120 |
Py_INCREF(op->func_dict); |
| 3121 |
return op->func_dict; |
| 3122 |
} |
| 3123 |
static int |
| 3124 |
__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, void *context) |
| 3125 |
{ |
| 3126 |
CYTHON_UNUSED_VAR(context); |
| 3127 |
if (unlikely(value == NULL)) { |
| 3128 |
PyErr_SetString(PyExc_TypeError, |
| 3129 |
"function's dictionary may not be deleted"); |
| 3130 |
return -1; |
| 3131 |
} |
| 3132 |
if (unlikely(!PyDict_Check(value))) { |
| 3133 |
PyErr_SetString(PyExc_TypeError, |
| 3134 |
"setting function's dictionary to a non-dict"); |
| 3135 |
return -1; |
| 3136 |
} |
| 3137 |
Py_INCREF(value); |
| 3138 |
__Pyx_Py_XDECREF_SET(op->func_dict, value); |
| 3139 |
return 0; |
| 3140 |
} |
| 3141 |
static PyObject * |
| 3142 |
__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context) |
| 3143 |
{ |
| 3144 |
CYTHON_UNUSED_VAR(context); |
| 3145 |
Py_INCREF(op->func_globals); |
| 3146 |
return op->func_globals; |
| 3147 |
} |
| 3148 |
static PyObject * |
| 3149 |
__Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context) |
| 3150 |
{ |
| 3151 |
CYTHON_UNUSED_VAR(op); |
| 3152 |
CYTHON_UNUSED_VAR(context); |
| 3153 |
Py_INCREF(Py_None); |
| 3154 |
return Py_None; |
| 3155 |
} |
| 3156 |
static PyObject * |
| 3157 |
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context) |
| 3158 |
{ |
| 3159 |
PyObject* result = (op->func_code) ? op->func_code : Py_None; |
| 3160 |
CYTHON_UNUSED_VAR(context); |
| 3161 |
Py_INCREF(result); |
| 3162 |
return result; |
| 3163 |
} |
| 3164 |
static int |
| 3165 |
__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { |
| 3166 |
int result = 0; |
| 3167 |
PyObject *res = op->defaults_getter((PyObject *) op); |
| 3168 |
if (unlikely(!res)) |
| 3169 |
return -1; |
| 3170 |
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS |
| 3171 |
op->defaults_tuple = PyTuple_GET_ITEM(res, 0); |
| 3172 |
Py_INCREF(op->defaults_tuple); |
| 3173 |
op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); |
| 3174 |
Py_INCREF(op->defaults_kwdict); |
| 3175 |
#else |
| 3176 |
op->defaults_tuple = __Pyx_PySequence_ITEM(res, 0); |
| 3177 |
if (unlikely(!op->defaults_tuple)) result = -1; |
| 3178 |
else { |
| 3179 |
op->defaults_kwdict = __Pyx_PySequence_ITEM(res, 1); |
| 3180 |
if (unlikely(!op->defaults_kwdict)) result = -1; |
| 3181 |
} |
| 3182 |
#endif |
| 3183 |
Py_DECREF(res); |
| 3184 |
return result; |
| 3185 |
} |
| 3186 |
static int |
| 3187 |
__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { |
| 3188 |
CYTHON_UNUSED_VAR(context); |
| 3189 |
if (!value) { |
| 3190 |
value = Py_None; |
| 3191 |
} else if (unlikely(value != Py_None && !PyTuple_Check(value))) { |
| 3192 |
PyErr_SetString(PyExc_TypeError, |
| 3193 |
"__defaults__ must be set to a tuple object"); |
| 3194 |
return -1; |
| 3195 |
} |
| 3196 |
PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not " |
| 3197 |
"currently affect the values used in function calls", 1); |
| 3198 |
Py_INCREF(value); |
| 3199 |
__Pyx_Py_XDECREF_SET(op->defaults_tuple, value); |
| 3200 |
return 0; |
| 3201 |
} |
| 3202 |
static PyObject * |
| 3203 |
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) { |
| 3204 |
PyObject* result = op->defaults_tuple; |
| 3205 |
CYTHON_UNUSED_VAR(context); |
| 3206 |
if (unlikely(!result)) { |
| 3207 |
if (op->defaults_getter) { |
| 3208 |
if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; |
| 3209 |
result = op->defaults_tuple; |
| 3210 |
} else { |
| 3211 |
result = Py_None; |
| 3212 |
} |
| 3213 |
} |
| 3214 |
Py_INCREF(result); |
| 3215 |
return result; |
| 3216 |
} |
| 3217 |
static int |
| 3218 |
__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { |
| 3219 |
CYTHON_UNUSED_VAR(context); |
| 3220 |
if (!value) { |
| 3221 |
value = Py_None; |
| 3222 |
} else if (unlikely(value != Py_None && !PyDict_Check(value))) { |
| 3223 |
PyErr_SetString(PyExc_TypeError, |
| 3224 |
"__kwdefaults__ must be set to a dict object"); |
| 3225 |
return -1; |
| 3226 |
} |
| 3227 |
PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not " |
| 3228 |
"currently affect the values used in function calls", 1); |
| 3229 |
Py_INCREF(value); |
| 3230 |
__Pyx_Py_XDECREF_SET(op->defaults_kwdict, value); |
| 3231 |
return 0; |
| 3232 |
} |
| 3233 |
static PyObject * |
| 3234 |
__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) { |
| 3235 |
PyObject* result = op->defaults_kwdict; |
| 3236 |
CYTHON_UNUSED_VAR(context); |
| 3237 |
if (unlikely(!result)) { |
| 3238 |
if (op->defaults_getter) { |
| 3239 |
if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; |
| 3240 |
result = op->defaults_kwdict; |
| 3241 |
} else { |
| 3242 |
result = Py_None; |
| 3243 |
} |
| 3244 |
} |
| 3245 |
Py_INCREF(result); |
| 3246 |
return result; |
| 3247 |
} |
| 3248 |
static int |
| 3249 |
__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) { |
| 3250 |
CYTHON_UNUSED_VAR(context); |
| 3251 |
if (!value || value == Py_None) { |
| 3252 |
value = NULL; |
| 3253 |
} else if (unlikely(!PyDict_Check(value))) { |
| 3254 |
PyErr_SetString(PyExc_TypeError, |
| 3255 |
"__annotations__ must be set to a dict object"); |
| 3256 |
return -1; |
| 3257 |
} |
| 3258 |
Py_XINCREF(value); |
| 3259 |
__Pyx_Py_XDECREF_SET(op->func_annotations, value); |
| 3260 |
return 0; |
| 3261 |
} |
| 3262 |
static PyObject * |
| 3263 |
__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) { |
| 3264 |
PyObject* result = op->func_annotations; |
| 3265 |
CYTHON_UNUSED_VAR(context); |
| 3266 |
if (unlikely(!result)) { |
| 3267 |
result = PyDict_New(); |
| 3268 |
if (unlikely(!result)) return NULL; |
| 3269 |
op->func_annotations = result; |
| 3270 |
} |
| 3271 |
Py_INCREF(result); |
| 3272 |
return result; |
| 3273 |
} |
| 3274 |
static PyObject * |
| 3275 |
__Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) { |
| 3276 |
int is_coroutine; |
| 3277 |
CYTHON_UNUSED_VAR(context); |
| 3278 |
if (op->func_is_coroutine) { |
| 3279 |
return __Pyx_NewRef(op->func_is_coroutine); |
| 3280 |
} |
| 3281 |
is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE; |
| 3282 |
#if PY_VERSION_HEX >= 0x03050000 |
| 3283 |
if (is_coroutine) { |
| 3284 |
PyObject *module, *fromlist, *marker = __pyx_n_s_is_coroutine; |
| 3285 |
fromlist = PyList_New(1); |
| 3286 |
if (unlikely(!fromlist)) return NULL; |
| 3287 |
Py_INCREF(marker); |
| 3288 |
#if CYTHON_ASSUME_SAFE_MACROS |
| 3289 |
PyList_SET_ITEM(fromlist, 0, marker); |
| 3290 |
#else |
| 3291 |
if (unlikely(PyList_SetItem(fromlist, 0, marker) < 0)) { |
| 3292 |
Py_DECREF(marker); |
| 3293 |
Py_DECREF(fromlist); |
| 3294 |
return NULL; |
| 3295 |
} |
| 3296 |
#endif |
| 3297 |
module = PyImport_ImportModuleLevelObject(__pyx_n_s_asyncio_coroutines, NULL, NULL, fromlist, 0); |
| 3298 |
Py_DECREF(fromlist); |
| 3299 |
if (unlikely(!module)) goto ignore; |
| 3300 |
op->func_is_coroutine = __Pyx_PyObject_GetAttrStr(module, marker); |
| 3301 |
Py_DECREF(module); |
| 3302 |
if (likely(op->func_is_coroutine)) { |
| 3303 |
return __Pyx_NewRef(op->func_is_coroutine); |
| 3304 |
} |
| 3305 |
ignore: |
| 3306 |
PyErr_Clear(); |
| 3307 |
} |
| 3308 |
#endif |
| 3309 |
op->func_is_coroutine = __Pyx_PyBool_FromLong(is_coroutine); |
| 3310 |
return __Pyx_NewRef(op->func_is_coroutine); |
| 3311 |
} |
| 3312 |
#if CYTHON_COMPILING_IN_LIMITED_API |
| 3313 |
static PyObject * |
| 3314 |
__Pyx_CyFunction_get_module(__pyx_CyFunctionObject *op, void *context) { |
| 3315 |
CYTHON_UNUSED_VAR(context); |
| 3316 |
return PyObject_GetAttrString(op->func, "__module__"); |
| 3317 |
} |
| 3318 |
static int |
| 3319 |
__Pyx_CyFunction_set_module(__pyx_CyFunctionObject *op, PyObject* value, void *context) { |
| 3320 |
CYTHON_UNUSED_VAR(context); |
| 3321 |
return PyObject_SetAttrString(op->func, "__module__", value); |
| 3322 |
} |
| 3323 |
#endif |
| 3324 |
static PyGetSetDef __pyx_CyFunction_getsets[] = { |
| 3325 |
{(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, |
| 3326 |
{(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, |
| 3327 |
{(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, |
| 3328 |
{(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, |
| 3329 |
{(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, |
| 3330 |
{(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, |
| 3331 |
{(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, |
| 3332 |
{(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, |
| 3333 |
{(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, |
| 3334 |
{(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, |
| 3335 |
{(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, |
| 3336 |
{(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, |
| 3337 |
{(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, |
| 3338 |
{(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, |
| 3339 |
{(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, |
| 3340 |
{(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, |
| 3341 |
{(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, |
| 3342 |
{(char *) "_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0}, |
| 3343 |
#if CYTHON_COMPILING_IN_LIMITED_API |
| 3344 |
{"__module__", (getter)__Pyx_CyFunction_get_module, (setter)__Pyx_CyFunction_set_module, 0, 0}, |
| 3345 |
#endif |
| 3346 |
{0, 0, 0, 0, 0} |
| 3347 |
}; |
| 3348 |
static PyMemberDef __pyx_CyFunction_members[] = { |
| 3349 |
#if !CYTHON_COMPILING_IN_LIMITED_API |
| 3350 |
{(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0}, |
| 3351 |
#endif |
| 3352 |
#if CYTHON_USE_TYPE_SPECS |
| 3353 |
{(char *) "__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0}, |
| 3354 |
#if CYTHON_METH_FASTCALL |
| 3355 |
#if CYTHON_BACKPORT_VECTORCALL |
| 3356 |
{(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0}, |
| 3357 |
#else |
| 3358 |
#if !CYTHON_COMPILING_IN_LIMITED_API |
| 3359 |
{(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0}, |
| 3360 |
#endif |
| 3361 |
#endif |
| 3362 |
#endif |
| 3363 |
#if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API |
| 3364 |
{(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0}, |
| 3365 |
#else |
| 3366 |
{(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0}, |
| 3367 |
#endif |
| 3368 |
#endif |
| 3369 |
{0, 0, 0, 0, 0} |
| 3370 |
}; |
| 3371 |
static PyObject * |
| 3372 |
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args) |
| 3373 |
{ |
| 3374 |
CYTHON_UNUSED_VAR(args); |
| 3375 |
#if PY_MAJOR_VERSION >= 3 |
| 3376 |
Py_INCREF(m->func_qualname); |
| 3377 |
return m->func_qualname; |
| 3378 |
#else |
| 3379 |
return PyString_FromString(((PyCFunctionObject*)m)->m_ml->ml_name); |
| 3380 |
#endif |
| 3381 |
} |
| 3382 |
static PyMethodDef __pyx_CyFunction_methods[] = { |
| 3383 |
{"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, |
| 3384 |
{0, 0, 0, 0} |
| 3385 |
}; |
| 3386 |
#if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API |
| 3387 |
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist) |
| 3388 |
#else |
| 3389 |
#define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist) |
| 3390 |
#endif |
| 3391 |
static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname, |
| 3392 |
PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { |
| 3393 |
#if !CYTHON_COMPILING_IN_LIMITED_API |
| 3394 |
PyCFunctionObject *cf = (PyCFunctionObject*) op; |
| 3395 |
#endif |
| 3396 |
if (unlikely(op == NULL)) |
| 3397 |
return NULL; |
| 3398 |
#if CYTHON_COMPILING_IN_LIMITED_API |
| 3399 |
op->func = PyCFunction_NewEx(ml, (PyObject*)op, module); |
| 3400 |
if (unlikely(!op->func)) return NULL; |
| 3401 |
#endif |
| 3402 |
op->flags = flags; |
| 3403 |
__Pyx_CyFunction_weakreflist(op) = NULL; |
| 3404 |
#if !CYTHON_COMPILING_IN_LIMITED_API |
| 3405 |
cf->m_ml = ml; |
| 3406 |
cf->m_self = (PyObject *) op; |
| 3407 |
#endif |
| 3408 |
Py_XINCREF(closure); |
| 3409 |
op->func_closure = closure; |
| 3410 |
#if !CYTHON_COMPILING_IN_LIMITED_API |
| 3411 |
Py_XINCREF(module); |
| 3412 |
cf->m_module = module; |
| 3413 |
#endif |
| 3414 |
op->func_dict = NULL; |
| 3415 |
op->func_name = NULL; |
| 3416 |
Py_INCREF(qualname); |
| 3417 |
op->func_qualname = qualname; |
| 3418 |
op->func_doc = NULL; |
| 3419 |
#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API |
| 3420 |
op->func_classobj = NULL; |
| 3421 |
#else |
| 3422 |
((PyCMethodObject*)op)->mm_class = NULL; |
| 3423 |
#endif |
| 3424 |
op->func_globals = globals; |
| 3425 |
Py_INCREF(op->func_globals); |
| 3426 |
Py_XINCREF(code); |
| 3427 |
op->func_code = code; |
| 3428 |
op->defaults_pyobjects = 0; |
| 3429 |
op->defaults_size = 0; |
| 3430 |
op->defaults = NULL; |
| 3431 |
op->defaults_tuple = NULL; |
| 3432 |
op->defaults_kwdict = NULL; |
| 3433 |
op->defaults_getter = NULL; |
| 3434 |
op->func_annotations = NULL; |
| 3435 |
op->func_is_coroutine = NULL; |
| 3436 |
#if CYTHON_METH_FASTCALL |
| 3437 |
switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) { |
| 3438 |
case METH_NOARGS: |
| 3439 |
__Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS; |
| 3440 |
break; |
| 3441 |
case METH_O: |
| 3442 |
__Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O; |
| 3443 |
break; |
| 3444 |
case METH_METHOD | METH_FASTCALL | METH_KEYWORDS: |
| 3445 |
__Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD; |
| 3446 |
break; |
| 3447 |
case METH_FASTCALL | METH_KEYWORDS: |
| 3448 |
__Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS; |
| 3449 |
break; |
| 3450 |
case METH_VARARGS | METH_KEYWORDS: |
| 3451 |
__Pyx_CyFunction_func_vectorcall(op) = NULL; |
| 3452 |
break; |
| 3453 |
default: |
| 3454 |
PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); |
| 3455 |
Py_DECREF(op); |
| 3456 |
return NULL; |
| 3457 |
} |
| 3458 |
#endif |
| 3459 |
return (PyObject *) op; |
| 3460 |
} |
| 3461 |
static int |
| 3462 |
__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) |
| 3463 |
{ |
| 3464 |
Py_CLEAR(m->func_closure); |
| 3465 |
#if CYTHON_COMPILING_IN_LIMITED_API |
| 3466 |
Py_CLEAR(m->func); |
| 3467 |
#else |
| 3468 |
Py_CLEAR(((PyCFunctionObject*)m)->m_module); |
| 3469 |
#endif |
| 3470 |
Py_CLEAR(m->func_dict); |
| 3471 |
Py_CLEAR(m->func_name); |
| 3472 |
Py_CLEAR(m->func_qualname); |
| 3473 |
Py_CLEAR(m->func_doc); |
| 3474 |
Py_CLEAR(m->func_globals); |
| 3475 |
Py_CLEAR(m->func_code); |
| 3476 |
#if !CYTHON_COMPILING_IN_LIMITED_API |
| 3477 |
#if PY_VERSION_HEX < 0x030900B1 |
| 3478 |
Py_CLEAR(__Pyx_CyFunction_GetClassObj(m)); |
| 3479 |
#else |
| 3480 |
{ |
| 3481 |
PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class; |
| 3482 |
((PyCMethodObject *) (m))->mm_class = NULL; |
| 3483 |
Py_XDECREF(cls); |
| 3484 |
} |
| 3485 |
#endif |
| 3486 |
#endif |
| 3487 |
Py_CLEAR(m->defaults_tuple); |
| 3488 |
Py_CLEAR(m->defaults_kwdict); |
| 3489 |
Py_CLEAR(m->func_annotations); |
| 3490 |
Py_CLEAR(m->func_is_coroutine); |
| 3491 |
if (m->defaults) { |
| 3492 |
PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); |
| 3493 |
int i; |
| 3494 |
for (i = 0; i < m->defaults_pyobjects; i++) |
| 3495 |
Py_XDECREF(pydefaults[i]); |
| 3496 |
PyObject_Free(m->defaults); |
| 3497 |
m->defaults = NULL; |
| 3498 |
} |
| 3499 |
return 0; |
| 3500 |
} |
| 3501 |
static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m) |
| 3502 |
{ |
| 3503 |
if (__Pyx_CyFunction_weakreflist(m) != NULL) |
| 3504 |
PyObject_ClearWeakRefs((PyObject *) m); |
| 3505 |
__Pyx_CyFunction_clear(m); |
| 3506 |
__Pyx_PyHeapTypeObject_GC_Del(m); |
| 3507 |
} |
| 3508 |
static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) |
| 3509 |
{ |
| 3510 |
PyObject_GC_UnTrack(m); |
| 3511 |
__Pyx__CyFunction_dealloc(m); |
| 3512 |
} |
| 3513 |
static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) |
| 3514 |
{ |
| 3515 |
Py_VISIT(m->func_closure); |
| 3516 |
#if CYTHON_COMPILING_IN_LIMITED_API |
| 3517 |
Py_VISIT(m->func); |
| 3518 |
#else |
| 3519 |
Py_VISIT(((PyCFunctionObject*)m)->m_module); |
| 3520 |
#endif |
| 3521 |
Py_VISIT(m->func_dict); |
| 3522 |
Py_VISIT(m->func_name); |
| 3523 |
Py_VISIT(m->func_qualname); |
| 3524 |
Py_VISIT(m->func_doc); |
| 3525 |
Py_VISIT(m->func_globals); |
| 3526 |
Py_VISIT(m->func_code); |
| 3527 |
#if !CYTHON_COMPILING_IN_LIMITED_API |
| 3528 |
Py_VISIT(__Pyx_CyFunction_GetClassObj(m)); |
| 3529 |
#endif |
| 3530 |
Py_VISIT(m->defaults_tuple); |
| 3531 |
Py_VISIT(m->defaults_kwdict); |
| 3532 |
Py_VISIT(m->func_is_coroutine); |
| 3533 |
if (m->defaults) { |
| 3534 |
PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); |
| 3535 |
int i; |
| 3536 |
for (i = 0; i < m->defaults_pyobjects; i++) |
| 3537 |
Py_VISIT(pydefaults[i]); |
| 3538 |
} |
| 3539 |
return 0; |
| 3540 |
} |
| 3541 |
static PyObject* |
| 3542 |
__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) |
| 3543 |
{ |
| 3544 |
#if PY_MAJOR_VERSION >= 3 |
| 3545 |
return PyUnicode_FromFormat("<cyfunction %U at %p>", |
| 3546 |
op->func_qualname, (void *)op); |
| 3547 |
#else |
| 3548 |
return PyString_FromFormat("<cyfunction %s at %p>", |
| 3549 |
PyString_AsString(op->func_qualname), (void *)op); |
| 3550 |
#endif |
| 3551 |
} |
| 3552 |
static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) { |
| 3553 |
#if CYTHON_COMPILING_IN_LIMITED_API |
| 3554 |
PyObject *f = ((__pyx_CyFunctionObject*)func)->func; |
| 3555 |
PyObject *py_name = NULL; |
| 3556 |
PyCFunction meth; |
| 3557 |
int flags; |
| 3558 |
meth = PyCFunction_GetFunction(f); |
| 3559 |
if (unlikely(!meth)) return NULL; |
| 3560 |
flags = PyCFunction_GetFlags(f); |
| 3561 |
if (unlikely(flags < 0)) return NULL; |
| 3562 |
#else |
| 3563 |
PyCFunctionObject* f = (PyCFunctionObject*)func; |
| 3564 |
PyCFunction meth = f->m_ml->ml_meth; |
| 3565 |
int flags = f->m_ml->ml_flags; |
| 3566 |
#endif |
| 3567 |
Py_ssize_t size; |
| 3568 |
switch (flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { |
| 3569 |
case METH_VARARGS: |
| 3570 |
if (likely(kw == NULL || PyDict_Size(kw) == 0)) |
| 3571 |
return (*meth)(self, arg); |
| 3572 |
break; |
| 3573 |
case METH_VARARGS | METH_KEYWORDS: |
| 3574 |
return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw); |
| 3575 |
case METH_NOARGS: |
| 3576 |
if (likely(kw == NULL || PyDict_Size(kw) == 0)) { |
| 3577 |
#if CYTHON_ASSUME_SAFE_MACROS |
| 3578 |
size = PyTuple_GET_SIZE(arg); |
| 3579 |
#else |
| 3580 |
size = PyTuple_Size(arg); |
| 3581 |
if (unlikely(size < 0)) return NULL; |
| 3582 |
#endif |
| 3583 |
if (likely(size == 0)) |
| 3584 |
return (*meth)(self, NULL); |
| 3585 |
#if CYTHON_COMPILING_IN_LIMITED_API |
| 3586 |
py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL); |
| 3587 |
if (!py_name) return NULL; |
| 3588 |
PyErr_Format(PyExc_TypeError, |
| 3589 |
"%.200S() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", |
| 3590 |
py_name, size); |
| 3591 |
Py_DECREF(py_name); |
| 3592 |
#else |
| 3593 |
PyErr_Format(PyExc_TypeError, |
| 3594 |
"%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", |
| 3595 |
f->m_ml->ml_name, size); |
| 3596 |
#endif |
| 3597 |
return NULL; |
| 3598 |
} |
| 3599 |
break; |
| 3600 |
case METH_O: |
| 3601 |
if (likely(kw == NULL || PyDict_Size(kw) == 0)) { |
| 3602 |
#if CYTHON_ASSUME_SAFE_MACROS |
| 3603 |
size = PyTuple_GET_SIZE(arg); |
| 3604 |
#else |
| 3605 |
size = PyTuple_Size(arg); |
| 3606 |
if (unlikely(size < 0)) return NULL; |
| 3607 |
#endif |
| 3608 |
if (likely(size == 1)) { |
| 3609 |
PyObject *result, *arg0; |
| 3610 |
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS |
| 3611 |
arg0 = PyTuple_GET_ITEM(arg, 0); |
| 3612 |
#else |
| 3613 |
arg0 = __Pyx_PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL; |
| 3614 |
#endif |
| 3615 |
result = (*meth)(self, arg0); |
| 3616 |
#if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) |
| 3617 |
Py_DECREF(arg0); |
| 3618 |
#endif |
| 3619 |
return result; |
| 3620 |
} |
| 3621 |
#if CYTHON_COMPILING_IN_LIMITED_API |
| 3622 |
py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL); |
| 3623 |
if (!py_name) return NULL; |
| 3624 |
PyErr_Format(PyExc_TypeError, |
| 3625 |
"%.200S() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", |
| 3626 |
py_name, size); |
| 3627 |
Py_DECREF(py_name); |
| 3628 |
#else |
| 3629 |
PyErr_Format(PyExc_TypeError, |
| 3630 |
"%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", |
| 3631 |
f->m_ml->ml_name, size); |
| 3632 |
#endif |
| 3633 |
return NULL; |
| 3634 |
} |
| 3635 |
break; |
| 3636 |
default: |
| 3637 |
PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); |
| 3638 |
return NULL; |
| 3639 |
} |
| 3640 |
#if CYTHON_COMPILING_IN_LIMITED_API |
| 3641 |
py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL); |
| 3642 |
if (!py_name) return NULL; |
| 3643 |
PyErr_Format(PyExc_TypeError, "%.200S() takes no keyword arguments", |
| 3644 |
py_name); |
| 3645 |
Py_DECREF(py_name); |
| 3646 |
#else |
| 3647 |
PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", |
| 3648 |
f->m_ml->ml_name); |
| 3649 |
#endif |
| 3650 |
return NULL; |
| 3651 |
} |
| 3652 |
static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { |
| 3653 |
PyObject *self, *result; |
| 3654 |
#if CYTHON_COMPILING_IN_LIMITED_API |
| 3655 |
self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)func)->func); |
| 3656 |
if (unlikely(!self) && PyErr_Occurred()) return NULL; |
| 3657 |
#else |
| 3658 |
self = ((PyCFunctionObject*)func)->m_self; |
| 3659 |
#endif |
| 3660 |
result = __Pyx_CyFunction_CallMethod(func, self, arg, kw); |
| 3661 |
return result; |
| 3662 |
} |
| 3663 |
static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) { |
| 3664 |
PyObject *result; |
| 3665 |
__pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func; |
| 3666 |
#if CYTHON_METH_FASTCALL |
| 3667 |
__pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc); |
| 3668 |
if (vc) { |
| 3669 |
#if CYTHON_ASSUME_SAFE_MACROS |
| 3670 |
return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw); |
| 3671 |
#else |
| 3672 |
(void) &__Pyx_PyVectorcall_FastCallDict; |
| 3673 |
return PyVectorcall_Call(func, args, kw); |
| 3674 |
#endif |
| 3675 |
} |
| 3676 |
#endif |
| 3677 |
if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { |
| 3678 |
Py_ssize_t argc; |
| 3679 |
PyObject *new_args; |
| 3680 |
PyObject *self; |
| 3681 |
#if CYTHON_ASSUME_SAFE_MACROS |
| 3682 |
argc = PyTuple_GET_SIZE(args); |
| 3683 |
#else |
| 3684 |
argc = PyTuple_Size(args); |
| 3685 |
if (unlikely(!argc) < 0) return NULL; |
| 3686 |
#endif |
| 3687 |
new_args = PyTuple_GetSlice(args, 1, argc); |
| 3688 |
if (unlikely(!new_args)) |
| 3689 |
return NULL; |
| 3690 |
self = PyTuple_GetItem(args, 0); |
| 3691 |
if (unlikely(!self)) { |
| 3692 |
Py_DECREF(new_args); |
| 3693 |
#if PY_MAJOR_VERSION > 2 |
| 3694 |
PyErr_Format(PyExc_TypeError, |
| 3695 |
"unbound method %.200S() needs an argument", |
| 3696 |
cyfunc->func_qualname); |
| 3697 |
#else |
| 3698 |
PyErr_SetString(PyExc_TypeError, |
| 3699 |
"unbound method needs an argument"); |
| 3700 |
#endif |
| 3701 |
return NULL; |
| 3702 |
} |
| 3703 |
result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw); |
| 3704 |
Py_DECREF(new_args); |
| 3705 |
} else { |
| 3706 |
result = __Pyx_CyFunction_Call(func, args, kw); |
| 3707 |
} |
| 3708 |
return result; |
| 3709 |
} |
| 3710 |
#if CYTHON_METH_FASTCALL |
| 3711 |
static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames) |
| 3712 |
{ |
| 3713 |
int ret = 0; |
| 3714 |
if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { |
| 3715 |
if (unlikely(nargs < 1)) { |
| 3716 |
PyErr_Format(PyExc_TypeError, "%.200s() needs an argument", |
| 3717 |
((PyCFunctionObject*)cyfunc)->m_ml->ml_name); |
| 3718 |
return -1; |
| 3719 |
} |
| 3720 |
ret = 1; |
| 3721 |
} |
| 3722 |
if (unlikely(kwnames) && unlikely(PyTuple_GET_SIZE(kwnames))) { |
| 3723 |
PyErr_Format(PyExc_TypeError, |
| 3724 |
"%.200s() takes no keyword arguments", ((PyCFunctionObject*)cyfunc)->m_ml->ml_name); |
| 3725 |
return -1; |
| 3726 |
} |
| 3727 |
return ret; |
| 3728 |
} |
| 3729 |
static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) |
| 3730 |
{ |
| 3731 |
__pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; |
| 3732 |
PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; |
| 3733 |
#if CYTHON_BACKPORT_VECTORCALL |
| 3734 |
Py_ssize_t nargs = (Py_ssize_t)nargsf; |
| 3735 |
#else |
| 3736 |
Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); |
| 3737 |
#endif |
| 3738 |
PyObject *self; |
| 3739 |
switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { |
| 3740 |
case 1: |
| 3741 |
self = args[0]; |
| 3742 |
args += 1; |
| 3743 |
nargs -= 1; |
| 3744 |
break; |
| 3745 |
case 0: |
| 3746 |
self = ((PyCFunctionObject*)cyfunc)->m_self; |
| 3747 |
break; |
| 3748 |
default: |
| 3749 |
return NULL; |
| 3750 |
} |
| 3751 |
if (unlikely(nargs != 0)) { |
| 3752 |
PyErr_Format(PyExc_TypeError, |
| 3753 |
"%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", |
| 3754 |
def->ml_name, nargs); |
| 3755 |
return NULL; |
| 3756 |
} |
| 3757 |
return def->ml_meth(self, NULL); |
| 3758 |
} |
| 3759 |
static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) |
| 3760 |
{ |
| 3761 |
__pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; |
| 3762 |
PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; |
| 3763 |
#if CYTHON_BACKPORT_VECTORCALL |
| 3764 |
Py_ssize_t nargs = (Py_ssize_t)nargsf; |
| 3765 |
#else |
| 3766 |
Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); |
| 3767 |
#endif |
| 3768 |
PyObject *self; |
| 3769 |
switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { |
| 3770 |
case 1: |
| 3771 |
self = args[0]; |
| 3772 |
args += 1; |
| 3773 |
nargs -= 1; |
| 3774 |
break; |
| 3775 |
case 0: |
| 3776 |
self = ((PyCFunctionObject*)cyfunc)->m_self; |
| 3777 |
break; |
| 3778 |
default: |
| 3779 |
return NULL; |
| 3780 |
} |
| 3781 |
if (unlikely(nargs != 1)) { |
| 3782 |
PyErr_Format(PyExc_TypeError, |
| 3783 |
"%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", |
| 3784 |
def->ml_name, nargs); |
| 3785 |
return NULL; |
| 3786 |
} |
| 3787 |
return def->ml_meth(self, args[0]); |
| 3788 |
} |
| 3789 |
static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) |
| 3790 |
{ |
| 3791 |
__pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; |
| 3792 |
PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; |
| 3793 |
#if CYTHON_BACKPORT_VECTORCALL |
| 3794 |
Py_ssize_t nargs = (Py_ssize_t)nargsf; |
| 3795 |
#else |
| 3796 |
Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); |
| 3797 |
#endif |
| 3798 |
PyObject *self; |
| 3799 |
switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { |
| 3800 |
case 1: |
| 3801 |
self = args[0]; |
| 3802 |
args += 1; |
| 3803 |
nargs -= 1; |
| 3804 |
break; |
| 3805 |
case 0: |
| 3806 |
self = ((PyCFunctionObject*)cyfunc)->m_self; |
| 3807 |
break; |
| 3808 |
default: |
| 3809 |
return NULL; |
| 3810 |
} |
| 3811 |
return ((_PyCFunctionFastWithKeywords)(void(*)(void))def->ml_meth)(self, args, nargs, kwnames); |
| 3812 |
} |
| 3813 |
static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) |
| 3814 |
{ |
| 3815 |
__pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; |
| 3816 |
PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; |
| 3817 |
PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc); |
| 3818 |
#if CYTHON_BACKPORT_VECTORCALL |
| 3819 |
Py_ssize_t nargs = (Py_ssize_t)nargsf; |
| 3820 |
#else |
| 3821 |
Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); |
| 3822 |
#endif |
| 3823 |
PyObject *self; |
| 3824 |
switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { |
| 3825 |
case 1: |
| 3826 |
self = args[0]; |
| 3827 |
args += 1; |
| 3828 |
nargs -= 1; |
| 3829 |
break; |
| 3830 |
case 0: |
| 3831 |
self = ((PyCFunctionObject*)cyfunc)->m_self; |
| 3832 |
break; |
| 3833 |
default: |
| 3834 |
return NULL; |
| 3835 |
} |
| 3836 |
return ((__Pyx_PyCMethod)(void(*)(void))def->ml_meth)(self, cls, args, (size_t)nargs, kwnames); |
| 3837 |
} |
| 3838 |
#endif |
| 3839 |
#if CYTHON_USE_TYPE_SPECS |
| 3840 |
static PyType_Slot __pyx_CyFunctionType_slots[] = { |
| 3841 |
{Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc}, |
| 3842 |
{Py_tp_repr, (void *)__Pyx_CyFunction_repr}, |
| 3843 |
{Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod}, |
| 3844 |
{Py_tp_traverse, (void *)__Pyx_CyFunction_traverse}, |
| 3845 |
{Py_tp_clear, (void *)__Pyx_CyFunction_clear}, |
| 3846 |
{Py_tp_methods, (void *)__pyx_CyFunction_methods}, |
| 3847 |
{Py_tp_members, (void *)__pyx_CyFunction_members}, |
| 3848 |
{Py_tp_getset, (void *)__pyx_CyFunction_getsets}, |
| 3849 |
{Py_tp_descr_get, (void *)__Pyx_PyMethod_New}, |
| 3850 |
{0, 0}, |
| 3851 |
}; |
| 3852 |
static PyType_Spec __pyx_CyFunctionType_spec = { |
| 3853 |
__PYX_TYPE_MODULE_PREFIX "cython_function_or_method", |
| 3854 |
sizeof(__pyx_CyFunctionObject), |
| 3855 |
0, |
| 3856 |
#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR |
| 3857 |
Py_TPFLAGS_METHOD_DESCRIPTOR | |
| 3858 |
#endif |
| 3859 |
#if (defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL) |
| 3860 |
_Py_TPFLAGS_HAVE_VECTORCALL | |
| 3861 |
#endif |
| 3862 |
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, |
| 3863 |
__pyx_CyFunctionType_slots |
| 3864 |
}; |
| 3865 |
#else |
| 3866 |
static PyTypeObject __pyx_CyFunctionType_type = { |
| 3867 |
PyVarObject_HEAD_INIT(0, 0) |
| 3868 |
__PYX_TYPE_MODULE_PREFIX "cython_function_or_method", |
| 3869 |
sizeof(__pyx_CyFunctionObject), |
| 3870 |
0, |
| 3871 |
(destructor) __Pyx_CyFunction_dealloc, |
| 3872 |
#if !CYTHON_METH_FASTCALL |
| 3873 |
0, |
| 3874 |
#elif CYTHON_BACKPORT_VECTORCALL |
| 3875 |
(printfunc)offsetof(__pyx_CyFunctionObject, func_vectorcall), |
| 3876 |
#else |
| 3877 |
offsetof(PyCFunctionObject, vectorcall), |
| 3878 |
#endif |
| 3879 |
0, |
| 3880 |
0, |
| 3881 |
#if PY_MAJOR_VERSION < 3 |
| 3882 |
0, |
| 3883 |
#else |
| 3884 |
0, |
| 3885 |
#endif |
| 3886 |
(reprfunc) __Pyx_CyFunction_repr, |
| 3887 |
0, |
| 3888 |
0, |
| 3889 |
0, |
| 3890 |
0, |
| 3891 |
__Pyx_CyFunction_CallAsMethod, |
| 3892 |
0, |
| 3893 |
0, |
| 3894 |
0, |
| 3895 |
0, |
| 3896 |
#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR |
| 3897 |
Py_TPFLAGS_METHOD_DESCRIPTOR | |
| 3898 |
#endif |
| 3899 |
#if defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL |
| 3900 |
_Py_TPFLAGS_HAVE_VECTORCALL | |
| 3901 |
#endif |
| 3902 |
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, |
| 3903 |
0, |
| 3904 |
(traverseproc) __Pyx_CyFunction_traverse, |
| 3905 |
(inquiry) __Pyx_CyFunction_clear, |
| 3906 |
0, |
| 3907 |
#if PY_VERSION_HEX < 0x030500A0 |
| 3908 |
offsetof(__pyx_CyFunctionObject, func_weakreflist), |
| 3909 |
#else |
| 3910 |
offsetof(PyCFunctionObject, m_weakreflist), |
| 3911 |
#endif |
| 3912 |
0, |
| 3913 |
0, |
| 3914 |
__pyx_CyFunction_methods, |
| 3915 |
__pyx_CyFunction_members, |
| 3916 |
__pyx_CyFunction_getsets, |
| 3917 |
0, |
| 3918 |
0, |
| 3919 |
__Pyx_PyMethod_New, |
| 3920 |
0, |
| 3921 |
offsetof(__pyx_CyFunctionObject, func_dict), |
| 3922 |
0, |
| 3923 |
0, |
| 3924 |
0, |
| 3925 |
0, |
| 3926 |
0, |
| 3927 |
0, |
| 3928 |
0, |
| 3929 |
0, |
| 3930 |
0, |
| 3931 |
0, |
| 3932 |
0, |
| 3933 |
0, |
| 3934 |
#if PY_VERSION_HEX >= 0x030400a1 |
| 3935 |
0, |
| 3936 |
#endif |
| 3937 |
#if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) |
| 3938 |
0, |
| 3939 |
#endif |
| 3940 |
#if __PYX_NEED_TP_PRINT_SLOT |
| 3941 |
0, |
| 3942 |
#endif |
| 3943 |
#if PY_VERSION_HEX >= 0x030C0000 |
| 3944 |
0, |
| 3945 |
#endif |
| 3946 |
#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 |
| 3947 |
0, |
| 3948 |
#endif |
| 3949 |
}; |
| 3950 |
#endif |
| 3951 |
static int __pyx_CyFunction_init(PyObject *module) { |
| 3952 |
#if CYTHON_USE_TYPE_SPECS |
| 3953 |
__pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx_CyFunctionType_spec, NULL); |
| 3954 |
#else |
| 3955 |
CYTHON_UNUSED_VAR(module); |
| 3956 |
__pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type); |
| 3957 |
#endif |
| 3958 |
if (unlikely(__pyx_CyFunctionType == NULL)) { |
| 3959 |
return -1; |
| 3960 |
} |
| 3961 |
return 0; |
| 3962 |
} |
| 3963 |
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) { |
| 3964 |
__pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; |
| 3965 |
m->defaults = PyObject_Malloc(size); |
| 3966 |
if (unlikely(!m->defaults)) |
| 3967 |
return PyErr_NoMemory(); |
| 3968 |
memset(m->defaults, 0, size); |
| 3969 |
m->defaults_pyobjects = pyobjects; |
| 3970 |
m->defaults_size = size; |
| 3971 |
return m->defaults; |
| 3972 |
} |
| 3973 |
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { |
| 3974 |
__pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; |
| 3975 |
m->defaults_tuple = tuple; |
| 3976 |
Py_INCREF(tuple); |
| 3977 |
} |
| 3978 |
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { |
| 3979 |
__pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; |
| 3980 |
m->defaults_kwdict = dict; |
| 3981 |
Py_INCREF(dict); |
| 3982 |
} |
| 3983 |
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { |
| 3984 |
__pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; |
| 3985 |
m->func_annotations = dict; |
| 3986 |
Py_INCREF(dict); |
| 3987 |
} |
| 3988 |
|
| 3989 |
|
| 3990 |
static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname, |
| 3991 |
PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { |
| 3992 |
PyObject *op = __Pyx_CyFunction_Init( |
| 3993 |
PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType), |
| 3994 |
ml, flags, qualname, closure, module, globals, code |
| 3995 |
); |
| 3996 |
if (likely(op)) { |
| 3997 |
PyObject_GC_Track(op); |
| 3998 |
} |
| 3999 |
return op; |
| 4000 |
} |
| 4001 |
|
| 4002 |
|
| 4003 |
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS |
| 4004 |
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { |
| 4005 |
PyObject *dict = Py_TYPE(obj)->tp_dict; |
| 4006 |
return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; |
| 4007 |
} |
| 4008 |
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { |
| 4009 |
PyObject **dictptr = NULL; |
| 4010 |
Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; |
| 4011 |
if (offset) { |
| 4012 |
#if CYTHON_COMPILING_IN_CPYTHON |
| 4013 |
dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); |
| 4014 |
#else |
| 4015 |
dictptr = _PyObject_GetDictPtr(obj); |
| 4016 |
#endif |
| 4017 |
} |
| 4018 |
return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; |
| 4019 |
} |
| 4020 |
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { |
| 4021 |
PyObject *dict = Py_TYPE(obj)->tp_dict; |
| 4022 |
if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) |
| 4023 |
return 0; |
| 4024 |
return obj_dict_version == __Pyx_get_object_dict_version(obj); |
| 4025 |
} |
| 4026 |
#endif |
| 4027 |
|
| 4028 |
|
| 4029 |
#if CYTHON_FAST_THREAD_STATE |
| 4030 |
static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { |
| 4031 |
Py_ssize_t i, n; |
| 4032 |
n = PyTuple_GET_SIZE(tuple); |
| 4033 |
#if PY_MAJOR_VERSION >= 3 |
| 4034 |
for (i=0; i<n; i++) { |
| 4035 |
if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1; |
| 4036 |
} |
| 4037 |
#endif |
| 4038 |
for (i=0; i<n; i++) { |
| 4039 |
if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1; |
| 4040 |
} |
| 4041 |
return 0; |
| 4042 |
} |
| 4043 |
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) { |
| 4044 |
int result; |
| 4045 |
PyObject *exc_type; |
| 4046 |
#if PY_VERSION_HEX >= 0x030C00A6 |
| 4047 |
PyObject *current_exception = tstate->current_exception; |
| 4048 |
if (unlikely(!current_exception)) return 0; |
| 4049 |
exc_type = (PyObject*) Py_TYPE(current_exception); |
| 4050 |
if (exc_type == err) return 1; |
| 4051 |
#else |
| 4052 |
exc_type = tstate->curexc_type; |
| 4053 |
if (exc_type == err) return 1; |
| 4054 |
if (unlikely(!exc_type)) return 0; |
| 4055 |
#endif |
| 4056 |
#if CYTHON_AVOID_BORROWED_REFS |
| 4057 |
Py_INCREF(exc_type); |
| 4058 |
#endif |
| 4059 |
if (unlikely(PyTuple_Check(err))) { |
| 4060 |
result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); |
| 4061 |
} else { |
| 4062 |
result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err); |
| 4063 |
} |
| 4064 |
#if CYTHON_AVOID_BORROWED_REFS |
| 4065 |
Py_DECREF(exc_type); |
| 4066 |
#endif |
| 4067 |
return result; |
| 4068 |
} |
| 4069 |
#endif |
| 4070 |
|
| 4071 |
|
| 4072 |
#if CYTHON_FAST_THREAD_STATE |
| 4073 |
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { |
| 4074 |
#if PY_VERSION_HEX >= 0x030C00A6 |
| 4075 |
PyObject *tmp_value; |
| 4076 |
assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value))); |
| 4077 |
if (value) { |
| 4078 |
#if CYTHON_COMPILING_IN_CPYTHON |
| 4079 |
if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb)) |
| 4080 |
#endif |
| 4081 |
PyException_SetTraceback(value, tb); |
| 4082 |
} |
| 4083 |
tmp_value = tstate->current_exception; |
| 4084 |
tstate->current_exception = value; |
| 4085 |
Py_XDECREF(tmp_value); |
| 4086 |
#else |
| 4087 |
PyObject *tmp_type, *tmp_value, *tmp_tb; |
| 4088 |
tmp_type = tstate->curexc_type; |
| 4089 |
tmp_value = tstate->curexc_value; |
| 4090 |
tmp_tb = tstate->curexc_traceback; |
| 4091 |
tstate->curexc_type = type; |
| 4092 |
tstate->curexc_value = value; |
| 4093 |
tstate->curexc_traceback = tb; |
| 4094 |
Py_XDECREF(tmp_type); |
| 4095 |
Py_XDECREF(tmp_value); |
| 4096 |
Py_XDECREF(tmp_tb); |
| 4097 |
#endif |
| 4098 |
} |
| 4099 |
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { |
| 4100 |
#if PY_VERSION_HEX >= 0x030C00A6 |
| 4101 |
PyObject* exc_value; |
| 4102 |
exc_value = tstate->current_exception; |
| 4103 |
tstate->current_exception = 0; |
| 4104 |
*value = exc_value; |
| 4105 |
*type = NULL; |
| 4106 |
*tb = NULL; |
| 4107 |
if (exc_value) { |
| 4108 |
*type = (PyObject*) Py_TYPE(exc_value); |
| 4109 |
Py_INCREF(*type); |
| 4110 |
#if CYTHON_COMPILING_IN_CPYTHON |
| 4111 |
*tb = ((PyBaseExceptionObject*) exc_value)->traceback; |
| 4112 |
Py_XINCREF(*tb); |
| 4113 |
#else |
| 4114 |
*tb = PyException_GetTraceback(exc_value); |
| 4115 |
#endif |
| 4116 |
} |
| 4117 |
#else |
| 4118 |
*type = tstate->curexc_type; |
| 4119 |
*value = tstate->curexc_value; |
| 4120 |
*tb = tstate->curexc_traceback; |
| 4121 |
tstate->curexc_type = 0; |
| 4122 |
tstate->curexc_value = 0; |
| 4123 |
tstate->curexc_traceback = 0; |
| 4124 |
#endif |
| 4125 |
} |
| 4126 |
#endif |
| 4127 |
|
| 4128 |
|
| 4129 |
static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { |
| 4130 |
__Pyx_PyThreadState_declare |
| 4131 |
__Pyx_PyThreadState_assign |
| 4132 |
if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) |
| 4133 |
__Pyx_PyErr_Clear(); |
| 4134 |
} |
| 4135 |
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { |
| 4136 |
PyObject *result; |
| 4137 |
#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 |
| 4138 |
PyTypeObject* tp = Py_TYPE(obj); |
| 4139 |
if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { |
| 4140 |
return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); |
| 4141 |
} |
| 4142 |
#endif |
| 4143 |
result = __Pyx_PyObject_GetAttrStr(obj, attr_name); |
| 4144 |
if (unlikely(!result)) { |
| 4145 |
__Pyx_PyObject_GetAttrStr_ClearAttributeError(); |
| 4146 |
} |
| 4147 |
return result; |
| 4148 |
} |
| 4149 |
|
| 4150 |
|
| 4151 |
#ifndef CYTHON_CLINE_IN_TRACEBACK |
| 4152 |
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { |
| 4153 |
PyObject *use_cline; |
| 4154 |
PyObject *ptype, *pvalue, *ptraceback; |
| 4155 |
#if CYTHON_COMPILING_IN_CPYTHON |
| 4156 |
PyObject **cython_runtime_dict; |
| 4157 |
#endif |
| 4158 |
CYTHON_MAYBE_UNUSED_VAR(tstate); |
| 4159 |
if (unlikely(!__pyx_cython_runtime)) { |
| 4160 |
return c_line; |
| 4161 |
} |
| 4162 |
__Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); |
| 4163 |
#if CYTHON_COMPILING_IN_CPYTHON |
| 4164 |
cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime); |
| 4165 |
if (likely(cython_runtime_dict)) { |
| 4166 |
__PYX_PY_DICT_LOOKUP_IF_MODIFIED( |
| 4167 |
use_cline, *cython_runtime_dict, |
| 4168 |
__Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback)) |
| 4169 |
} else |
| 4170 |
#endif |
| 4171 |
{ |
| 4172 |
PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStrNoError(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); |
| 4173 |
if (use_cline_obj) { |
| 4174 |
use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True; |
| 4175 |
Py_DECREF(use_cline_obj); |
| 4176 |
} else { |
| 4177 |
PyErr_Clear(); |
| 4178 |
use_cline = NULL; |
| 4179 |
} |
| 4180 |
} |
| 4181 |
if (!use_cline) { |
| 4182 |
c_line = 0; |
| 4183 |
(void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); |
| 4184 |
} |
| 4185 |
else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { |
| 4186 |
c_line = 0; |
| 4187 |
} |
| 4188 |
__Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); |
| 4189 |
return c_line; |
| 4190 |
} |
| 4191 |
#endif |
| 4192 |
|
| 4193 |
|
| 4194 |
#if !CYTHON_COMPILING_IN_LIMITED_API |
| 4195 |
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { |
| 4196 |
int start = 0, mid = 0, end = count - 1; |
| 4197 |
if (end >= 0 && code_line > entries[end].code_line) { |
| 4198 |
return count; |
| 4199 |
} |
| 4200 |
while (start < end) { |
| 4201 |
mid = start + (end - start) / 2; |
| 4202 |
if (code_line < entries[mid].code_line) { |
| 4203 |
end = mid; |
| 4204 |
} else if (code_line > entries[mid].code_line) { |
| 4205 |
start = mid + 1; |
| 4206 |
} else { |
| 4207 |
return mid; |
| 4208 |
} |
| 4209 |
} |
| 4210 |
if (code_line <= entries[mid].code_line) { |
| 4211 |
return mid; |
| 4212 |
} else { |
| 4213 |
return mid + 1; |
| 4214 |
} |
| 4215 |
} |
| 4216 |
static PyCodeObject *__pyx_find_code_object(int code_line) { |
| 4217 |
PyCodeObject* code_object; |
| 4218 |
int pos; |
| 4219 |
if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { |
| 4220 |
return NULL; |
| 4221 |
} |
| 4222 |
pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); |
| 4223 |
if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { |
| 4224 |
return NULL; |
| 4225 |
} |
| 4226 |
code_object = __pyx_code_cache.entries[pos].code_object; |
| 4227 |
Py_INCREF(code_object); |
| 4228 |
return code_object; |
| 4229 |
} |
| 4230 |
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { |
| 4231 |
int pos, i; |
| 4232 |
__Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; |
| 4233 |
if (unlikely(!code_line)) { |
| 4234 |
return; |
| 4235 |
} |
| 4236 |
if (unlikely(!entries)) { |
| 4237 |
entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); |
| 4238 |
if (likely(entries)) { |
| 4239 |
__pyx_code_cache.entries = entries; |
| 4240 |
__pyx_code_cache.max_count = 64; |
| 4241 |
__pyx_code_cache.count = 1; |
| 4242 |
entries[0].code_line = code_line; |
| 4243 |
entries[0].code_object = code_object; |
| 4244 |
Py_INCREF(code_object); |
| 4245 |
} |
| 4246 |
return; |
| 4247 |
} |
| 4248 |
pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); |
| 4249 |
if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { |
| 4250 |
PyCodeObject* tmp = entries[pos].code_object; |
| 4251 |
entries[pos].code_object = code_object; |
| 4252 |
Py_DECREF(tmp); |
| 4253 |
return; |
| 4254 |
} |
| 4255 |
if (__pyx_code_cache.count == __pyx_code_cache.max_count) { |
| 4256 |
int new_max = __pyx_code_cache.max_count + 64; |
| 4257 |
entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( |
| 4258 |
__pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry)); |
| 4259 |
if (unlikely(!entries)) { |
| 4260 |
return; |
| 4261 |
} |
| 4262 |
__pyx_code_cache.entries = entries; |
| 4263 |
__pyx_code_cache.max_count = new_max; |
| 4264 |
} |
| 4265 |
for (i=__pyx_code_cache.count; i>pos; i--) { |
| 4266 |
entries[i] = entries[i-1]; |
| 4267 |
} |
| 4268 |
entries[pos].code_line = code_line; |
| 4269 |
entries[pos].code_object = code_object; |
| 4270 |
__pyx_code_cache.count++; |
| 4271 |
Py_INCREF(code_object); |
| 4272 |
} |
| 4273 |
#endif |
| 4274 |
|
| 4275 |
|
| 4276 |
#include "compile.h" |
| 4277 |
#include "frameobject.h" |
| 4278 |
#include "traceback.h" |
| 4279 |
#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION) |
| 4280 |
#ifndef Py_BUILD_CORE |
| 4281 |
#define Py_BUILD_CORE 1 |
| 4282 |
#endif |
| 4283 |
#include "internal/pycore_frame.h" |
| 4284 |
#endif |
| 4285 |
#if CYTHON_COMPILING_IN_LIMITED_API |
| 4286 |
static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict, |
| 4287 |
PyObject *firstlineno, PyObject *name) { |
| 4288 |
PyObject *replace = NULL; |
| 4289 |
if (unlikely(PyDict_SetItemString(scratch_dict, "co_firstlineno", firstlineno))) return NULL; |
| 4290 |
if (unlikely(PyDict_SetItemString(scratch_dict, "co_name", name))) return NULL; |
| 4291 |
replace = PyObject_GetAttrString(code, "replace"); |
| 4292 |
if (likely(replace)) { |
| 4293 |
PyObject *result; |
| 4294 |
result = PyObject_Call(replace, __pyx_empty_tuple, scratch_dict); |
| 4295 |
Py_DECREF(replace); |
| 4296 |
return result; |
| 4297 |
} |
| 4298 |
#if __PYX_LIMITED_VERSION_HEX < 0x030780000 |
| 4299 |
PyErr_Clear(); |
| 4300 |
{ |
| 4301 |
PyObject *compiled = NULL, *result = NULL; |
| 4302 |
if (unlikely(PyDict_SetItemString(scratch_dict, "code", code))) return NULL; |
| 4303 |
if (unlikely(PyDict_SetItemString(scratch_dict, "type", (PyObject*)(&PyType_Type)))) return NULL; |
| 4304 |
compiled = Py_CompileString( |
| 4305 |
"out = type(code)(\n" |
| 4306 |
" code.co_argcount, code.co_kwonlyargcount, code.co_nlocals, code.co_stacksize,\n" |
| 4307 |
" code.co_flags, code.co_code, code.co_consts, code.co_names,\n" |
| 4308 |
" code.co_varnames, code.co_filename, co_name, co_firstlineno,\n" |
| 4309 |
" code.co_lnotab)\n", "<dummy>", Py_file_input); |
| 4310 |
if (!compiled) return NULL; |
| 4311 |
result = PyEval_EvalCode(compiled, scratch_dict, scratch_dict); |
| 4312 |
Py_DECREF(compiled); |
| 4313 |
if (!result) PyErr_Print(); |
| 4314 |
Py_DECREF(result); |
| 4315 |
result = PyDict_GetItemString(scratch_dict, "out"); |
| 4316 |
if (result) Py_INCREF(result); |
| 4317 |
return result; |
| 4318 |
} |
| 4319 |
#endif |
| 4320 |
} |
| 4321 |
static void __Pyx_AddTraceback(const char *funcname, int c_line, |
| 4322 |
int py_line, const char *filename) { |
| 4323 |
PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL; |
| 4324 |
PyObject *replace = NULL, *getframe = NULL, *frame = NULL; |
| 4325 |
PyObject *exc_type, *exc_value, *exc_traceback; |
| 4326 |
int success = 0; |
| 4327 |
if (c_line) { |
| 4328 |
(void) __pyx_cfilenm; |
| 4329 |
(void) __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line); |
| 4330 |
} |
| 4331 |
PyErr_Fetch(&exc_type, &exc_value, &exc_traceback); |
| 4332 |
code_object = Py_CompileString("_getframe()", filename, Py_eval_input); |
| 4333 |
if (unlikely(!code_object)) goto bad; |
| 4334 |
py_py_line = PyLong_FromLong(py_line); |
| 4335 |
if (unlikely(!py_py_line)) goto bad; |
| 4336 |
py_funcname = PyUnicode_FromString(funcname); |
| 4337 |
if (unlikely(!py_funcname)) goto bad; |
| 4338 |
dict = PyDict_New(); |
| 4339 |
if (unlikely(!dict)) goto bad; |
| 4340 |
{ |
| 4341 |
PyObject *old_code_object = code_object; |
| 4342 |
code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname); |
| 4343 |
Py_DECREF(old_code_object); |
| 4344 |
} |
| 4345 |
if (unlikely(!code_object)) goto bad; |
| 4346 |
getframe = PySys_GetObject("_getframe"); |
| 4347 |
if (unlikely(!getframe)) goto bad; |
| 4348 |
if (unlikely(PyDict_SetItemString(dict, "_getframe", getframe))) goto bad; |
| 4349 |
frame = PyEval_EvalCode(code_object, dict, dict); |
| 4350 |
if (unlikely(!frame) || frame == Py_None) goto bad; |
| 4351 |
success = 1; |
| 4352 |
bad: |
| 4353 |
PyErr_Restore(exc_type, exc_value, exc_traceback); |
| 4354 |
Py_XDECREF(code_object); |
| 4355 |
Py_XDECREF(py_py_line); |
| 4356 |
Py_XDECREF(py_funcname); |
| 4357 |
Py_XDECREF(dict); |
| 4358 |
Py_XDECREF(replace); |
| 4359 |
if (success) { |
| 4360 |
PyTraceBack_Here( |
| 4361 |
(struct _frame*)frame); |
| 4362 |
} |
| 4363 |
Py_XDECREF(frame); |
| 4364 |
} |
| 4365 |
#else |
| 4366 |
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( |
| 4367 |
const char *funcname, int c_line, |
| 4368 |
int py_line, const char *filename) { |
| 4369 |
PyCodeObject *py_code = NULL; |
| 4370 |
PyObject *py_funcname = NULL; |
| 4371 |
#if PY_MAJOR_VERSION < 3 |
| 4372 |
PyObject *py_srcfile = NULL; |
| 4373 |
py_srcfile = PyString_FromString(filename); |
| 4374 |
if (!py_srcfile) goto bad; |
| 4375 |
#endif |
| 4376 |
if (c_line) { |
| 4377 |
#if PY_MAJOR_VERSION < 3 |
| 4378 |
py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); |
| 4379 |
if (!py_funcname) goto bad; |
| 4380 |
#else |
| 4381 |
py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); |
| 4382 |
if (!py_funcname) goto bad; |
| 4383 |
funcname = PyUnicode_AsUTF8(py_funcname); |
| 4384 |
if (!funcname) goto bad; |
| 4385 |
#endif |
| 4386 |
} |
| 4387 |
else { |
| 4388 |
#if PY_MAJOR_VERSION < 3 |
| 4389 |
py_funcname = PyString_FromString(funcname); |
| 4390 |
if (!py_funcname) goto bad; |
| 4391 |
#endif |
| 4392 |
} |
| 4393 |
#if PY_MAJOR_VERSION < 3 |
| 4394 |
py_code = __Pyx_PyCode_New( |
| 4395 |
0, |
| 4396 |
0, |
| 4397 |
0, |
| 4398 |
0, |
| 4399 |
0, |
| 4400 |
0, |
| 4401 |
__pyx_empty_bytes, |
| 4402 |
__pyx_empty_tuple, |
| 4403 |
__pyx_empty_tuple, |
| 4404 |
__pyx_empty_tuple, |
| 4405 |
__pyx_empty_tuple, |
| 4406 |
__pyx_empty_tuple, |
| 4407 |
py_srcfile, |
| 4408 |
py_funcname, |
| 4409 |
py_line, |
| 4410 |
__pyx_empty_bytes |
| 4411 |
); |
| 4412 |
Py_DECREF(py_srcfile); |
| 4413 |
#else |
| 4414 |
py_code = PyCode_NewEmpty(filename, funcname, py_line); |
| 4415 |
#endif |
| 4416 |
Py_XDECREF(py_funcname); |
| 4417 |
return py_code; |
| 4418 |
bad: |
| 4419 |
Py_XDECREF(py_funcname); |
| 4420 |
#if PY_MAJOR_VERSION < 3 |
| 4421 |
Py_XDECREF(py_srcfile); |
| 4422 |
#endif |
| 4423 |
return NULL; |
| 4424 |
} |
| 4425 |
static void __Pyx_AddTraceback(const char *funcname, int c_line, |
| 4426 |
int py_line, const char *filename) { |
| 4427 |
PyCodeObject *py_code = 0; |
| 4428 |
PyFrameObject *py_frame = 0; |
| 4429 |
PyThreadState *tstate = __Pyx_PyThreadState_Current; |
| 4430 |
PyObject *ptype, *pvalue, *ptraceback; |
| 4431 |
if (c_line) { |
| 4432 |
c_line = __Pyx_CLineForTraceback(tstate, c_line); |
| 4433 |
} |
| 4434 |
py_code = __pyx_find_code_object(c_line ? -c_line : py_line); |
| 4435 |
if (!py_code) { |
| 4436 |
__Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); |
| 4437 |
py_code = __Pyx_CreateCodeObjectForTraceback( |
| 4438 |
funcname, c_line, py_line, filename); |
| 4439 |
if (!py_code) { |
| 4440 |
|
| 4441 |
|
| 4442 |
Py_XDECREF(ptype); |
| 4443 |
Py_XDECREF(pvalue); |
| 4444 |
Py_XDECREF(ptraceback); |
| 4445 |
goto bad; |
| 4446 |
} |
| 4447 |
__Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); |
| 4448 |
__pyx_insert_code_object(c_line ? -c_line : py_line, py_code); |
| 4449 |
} |
| 4450 |
py_frame = PyFrame_New( |
| 4451 |
tstate, |
| 4452 |
py_code, |
| 4453 |
__pyx_d, |
| 4454 |
0 |
| 4455 |
); |
| 4456 |
if (!py_frame) goto bad; |
| 4457 |
__Pyx_PyFrame_SetLineNumber(py_frame, py_line); |
| 4458 |
PyTraceBack_Here(py_frame); |
| 4459 |
bad: |
| 4460 |
Py_XDECREF(py_code); |
| 4461 |
Py_XDECREF(py_frame); |
| 4462 |
} |
| 4463 |
#endif |
| 4464 |
|
| 4465 |
|
| 4466 |
#if CYTHON_COMPILING_IN_LIMITED_API |
| 4467 |
static __Pyx_TypeName |
| 4468 |
__Pyx_PyType_GetName(PyTypeObject* tp) |
| 4469 |
{ |
| 4470 |
PyObject *name = __Pyx_PyObject_GetAttrStr((PyObject *)tp, |
| 4471 |
__pyx_n_s_name); |
| 4472 |
if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) { |
| 4473 |
PyErr_Clear(); |
| 4474 |
Py_XDECREF(name); |
| 4475 |
name = __Pyx_NewRef(__pyx_n_s__2); |
| 4476 |
} |
| 4477 |
return name; |
| 4478 |
} |
| 4479 |
#endif |
| 4480 |
|
| 4481 |
|
| 4482 |
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { |
| 4483 |
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC |
| 4484 |
#pragma GCC diagnostic push |
| 4485 |
#pragma GCC diagnostic ignored "-Wconversion" |
| 4486 |
#endif |
| 4487 |
const long neg_one = (long) -1, const_zero = (long) 0; |
| 4488 |
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC |
| 4489 |
#pragma GCC diagnostic pop |
| 4490 |
#endif |
| 4491 |
const int is_unsigned = neg_one > const_zero; |
| 4492 |
if (is_unsigned) { |
| 4493 |
if (sizeof(long) < sizeof(long)) { |
| 4494 |
return PyInt_FromLong((long) value); |
| 4495 |
} else if (sizeof(long) <= sizeof(unsigned long)) { |
| 4496 |
return PyLong_FromUnsignedLong((unsigned long) value); |
| 4497 |
#ifdef HAVE_LONG_LONG |
| 4498 |
} else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { |
| 4499 |
return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); |
| 4500 |
#endif |
| 4501 |
} |
| 4502 |
} else { |
| 4503 |
if (sizeof(long) <= sizeof(long)) { |
| 4504 |
return PyInt_FromLong((long) value); |
| 4505 |
#ifdef HAVE_LONG_LONG |
| 4506 |
} else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { |
| 4507 |
return PyLong_FromLongLong((PY_LONG_LONG) value); |
| 4508 |
#endif |
| 4509 |
} |
| 4510 |
} |
| 4511 |
{ |
| 4512 |
int one = 1; int little = (int)*(unsigned char *)&one; |
| 4513 |
unsigned char *bytes = (unsigned char *)&value; |
| 4514 |
#if !CYTHON_COMPILING_IN_LIMITED_API |
| 4515 |
return _PyLong_FromByteArray(bytes, sizeof(long), |
| 4516 |
little, !is_unsigned); |
| 4517 |
#else |
| 4518 |
PyObject *from_bytes, *result = NULL; |
| 4519 |
PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL; |
| 4520 |
from_bytes = PyObject_GetAttrString((PyObject*)&PyInt_Type, "from_bytes"); |
| 4521 |
if (!from_bytes) return NULL; |
| 4522 |
py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long)); |
| 4523 |
if (!py_bytes) goto limited_bad; |
| 4524 |
order_str = PyUnicode_FromString(little ? "little" : "big"); |
| 4525 |
if (!order_str) goto limited_bad; |
| 4526 |
arg_tuple = PyTuple_Pack(2, py_bytes, order_str); |
| 4527 |
if (!arg_tuple) goto limited_bad; |
| 4528 |
kwds = PyDict_New(); |
| 4529 |
if (!kwds) goto limited_bad; |
| 4530 |
if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(!is_unsigned ? Py_True : Py_False))) goto limited_bad; |
| 4531 |
result = PyObject_Call(from_bytes, arg_tuple, kwds); |
| 4532 |
limited_bad: |
| 4533 |
Py_XDECREF(from_bytes); |
| 4534 |
Py_XDECREF(py_bytes); |
| 4535 |
Py_XDECREF(order_str); |
| 4536 |
Py_XDECREF(arg_tuple); |
| 4537 |
Py_XDECREF(kwds); |
| 4538 |
return result; |
| 4539 |
#endif |
| 4540 |
} |
| 4541 |
} |
| 4542 |
|
| 4543 |
|
| 4544 |
#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ |
| 4545 |
__PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) |
| 4546 |
#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ |
| 4547 |
__PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) |
| 4548 |
#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ |
| 4549 |
{\ |
| 4550 |
func_type value = func_value;\ |
| 4551 |
if (sizeof(target_type) < sizeof(func_type)) {\ |
| 4552 |
if (unlikely(value != (func_type) (target_type) value)) {\ |
| 4553 |
func_type zero = 0;\ |
| 4554 |
if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ |
| 4555 |
return (target_type) -1;\ |
| 4556 |
if (is_unsigned && unlikely(value < zero))\ |
| 4557 |
goto raise_neg_overflow;\ |
| 4558 |
else\ |
| 4559 |
goto raise_overflow;\ |
| 4560 |
}\ |
| 4561 |
}\ |
| 4562 |
return (target_type) value;\ |
| 4563 |
} |
| 4564 |
|
| 4565 |
|
| 4566 |
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { |
| 4567 |
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC |
| 4568 |
#pragma GCC diagnostic push |
| 4569 |
#pragma GCC diagnostic ignored "-Wconversion" |
| 4570 |
#endif |
| 4571 |
const long neg_one = (long) -1, const_zero = (long) 0; |
| 4572 |
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC |
| 4573 |
#pragma GCC diagnostic pop |
| 4574 |
#endif |
| 4575 |
const int is_unsigned = neg_one > const_zero; |
| 4576 |
#if PY_MAJOR_VERSION < 3 |
| 4577 |
if (likely(PyInt_Check(x))) { |
| 4578 |
if ((sizeof(long) < sizeof(long))) { |
| 4579 |
__PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) |
| 4580 |
} else { |
| 4581 |
long val = PyInt_AS_LONG(x); |
| 4582 |
if (is_unsigned && unlikely(val < 0)) { |
| 4583 |
goto raise_neg_overflow; |
| 4584 |
} |
| 4585 |
return (long) val; |
| 4586 |
} |
| 4587 |
} else |
| 4588 |
#endif |
| 4589 |
if (likely(PyLong_Check(x))) { |
| 4590 |
if (is_unsigned) { |
| 4591 |
#if CYTHON_USE_PYLONG_INTERNALS |
| 4592 |
if (unlikely(__Pyx_PyLong_IsNeg(x))) { |
| 4593 |
goto raise_neg_overflow; |
| 4594 |
} else if (__Pyx_PyLong_IsCompact(x)) { |
| 4595 |
__PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) |
| 4596 |
} else { |
| 4597 |
const digit* digits = __Pyx_PyLong_Digits(x); |
| 4598 |
assert(__Pyx_PyLong_DigitCount(x) > 1); |
| 4599 |
switch (__Pyx_PyLong_DigitCount(x)) { |
| 4600 |
case 2: |
| 4601 |
if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { |
| 4602 |
if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { |
| 4603 |
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) |
| 4604 |
} else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) { |
| 4605 |
return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); |
| 4606 |
} |
| 4607 |
} |
| 4608 |
break; |
| 4609 |
case 3: |
| 4610 |
if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { |
| 4611 |
if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { |
| 4612 |
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) |
| 4613 |
} else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) { |
| 4614 |
return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); |
| 4615 |
} |
| 4616 |
} |
| 4617 |
break; |
| 4618 |
case 4: |
| 4619 |
if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { |
| 4620 |
if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { |
| 4621 |
__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]))) |
| 4622 |
} else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) { |
| 4623 |
return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); |
| 4624 |
} |
| 4625 |
} |
| 4626 |
break; |
| 4627 |
} |
| 4628 |
} |
| 4629 |
#endif |
| 4630 |
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 |
| 4631 |
if (unlikely(Py_SIZE(x) < 0)) { |
| 4632 |
goto raise_neg_overflow; |
| 4633 |
} |
| 4634 |
#else |
| 4635 |
{ |
| 4636 |
int result = PyObject_RichCompareBool(x, Py_False, Py_LT); |
| 4637 |
if (unlikely(result < 0)) |
| 4638 |
return (long) -1; |
| 4639 |
if (unlikely(result == 1)) |
| 4640 |
goto raise_neg_overflow; |
| 4641 |
} |
| 4642 |
#endif |
| 4643 |
if ((sizeof(long) <= sizeof(unsigned long))) { |
| 4644 |
__PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) |
| 4645 |
#ifdef HAVE_LONG_LONG |
| 4646 |
} else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) { |
| 4647 |
__PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) |
| 4648 |
#endif |
| 4649 |
} |
| 4650 |
} else { |
| 4651 |
#if CYTHON_USE_PYLONG_INTERNALS |
| 4652 |
if (__Pyx_PyLong_IsCompact(x)) { |
| 4653 |
__PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) |
| 4654 |
} else { |
| 4655 |
const digit* digits = __Pyx_PyLong_Digits(x); |
| 4656 |
assert(__Pyx_PyLong_DigitCount(x) > 1); |
| 4657 |
switch (__Pyx_PyLong_SignedDigitCount(x)) { |
| 4658 |
case -2: |
| 4659 |
if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) { |
| 4660 |
if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { |
| 4661 |
__PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) |
| 4662 |
} else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { |
| 4663 |
return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); |
| 4664 |
} |
| 4665 |
} |
| 4666 |
break; |
| 4667 |
case 2: |
| 4668 |
if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { |
| 4669 |
if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { |
| 4670 |
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) |
| 4671 |
} else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { |
| 4672 |
return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); |
| 4673 |
} |
| 4674 |
} |
| 4675 |
break; |
| 4676 |
case -3: |
| 4677 |
if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { |
| 4678 |
if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { |
| 4679 |
__PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) |
| 4680 |
} else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { |
| 4681 |
return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); |
| 4682 |
} |
| 4683 |
} |
| 4684 |
break; |
| 4685 |
case 3: |
| 4686 |
if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { |
| 4687 |
if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { |
| 4688 |
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) |
| 4689 |
} else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { |
| 4690 |
return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); |
| 4691 |
} |
| 4692 |
} |
| 4693 |
break; |
| 4694 |
case -4: |
| 4695 |
if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { |
| 4696 |
if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { |
| 4697 |
__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]))) |
| 4698 |
} else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { |
| 4699 |
return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); |
| 4700 |
} |
| 4701 |
} |
| 4702 |
break; |
| 4703 |
case 4: |
| 4704 |
if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { |
| 4705 |
if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { |
| 4706 |
__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]))) |
| 4707 |
} else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { |
| 4708 |
return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); |
| 4709 |
} |
| 4710 |
} |
| 4711 |
break; |
| 4712 |
} |
| 4713 |
} |
| 4714 |
#endif |
| 4715 |
if ((sizeof(long) <= sizeof(long))) { |
| 4716 |
__PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) |
| 4717 |
#ifdef HAVE_LONG_LONG |
| 4718 |
} else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) { |
| 4719 |
__PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) |
| 4720 |
#endif |
| 4721 |
} |
| 4722 |
} |
| 4723 |
{ |
| 4724 |
long val; |
| 4725 |
PyObject *v = __Pyx_PyNumber_IntOrLong(x); |
| 4726 |
#if PY_MAJOR_VERSION < 3 |
| 4727 |
if (likely(v) && !PyLong_Check(v)) { |
| 4728 |
PyObject *tmp = v; |
| 4729 |
v = PyNumber_Long(tmp); |
| 4730 |
Py_DECREF(tmp); |
| 4731 |
} |
| 4732 |
#endif |
| 4733 |
if (likely(v)) { |
| 4734 |
int ret = -1; |
| 4735 |
#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) |
| 4736 |
int one = 1; int is_little = (int)*(unsigned char *)&one; |
| 4737 |
unsigned char *bytes = (unsigned char *)&val; |
| 4738 |
ret = _PyLong_AsByteArray((PyLongObject *)v, |
| 4739 |
bytes, sizeof(val), |
| 4740 |
is_little, !is_unsigned); |
| 4741 |
#else |
| 4742 |
PyObject *stepval = NULL, *mask = NULL, *shift = NULL; |
| 4743 |
int bits, remaining_bits, is_negative = 0; |
| 4744 |
long idigit; |
| 4745 |
int chunk_size = (sizeof(long) < 8) ? 30 : 62; |
| 4746 |
if (unlikely(!PyLong_CheckExact(v))) { |
| 4747 |
PyObject *tmp = v; |
| 4748 |
v = PyNumber_Long(v); |
| 4749 |
assert(PyLong_CheckExact(v)); |
| 4750 |
Py_DECREF(tmp); |
| 4751 |
if (unlikely(!v)) return (long) -1; |
| 4752 |
} |
| 4753 |
#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 |
| 4754 |
if (Py_SIZE(x) == 0) |
| 4755 |
return (long) 0; |
| 4756 |
is_negative = Py_SIZE(x) < 0; |
| 4757 |
#else |
| 4758 |
{ |
| 4759 |
int result = PyObject_RichCompareBool(x, Py_False, Py_LT); |
| 4760 |
if (unlikely(result < 0)) |
| 4761 |
return (long) -1; |
| 4762 |
is_negative = result == 1; |
| 4763 |
} |
| 4764 |
#endif |
| 4765 |
if (is_unsigned && unlikely(is_negative)) { |
| 4766 |
goto raise_neg_overflow; |
| 4767 |
} else if (is_negative) { |
| 4768 |
stepval = PyNumber_Invert(v); |
| 4769 |
if (unlikely(!stepval)) |
| 4770 |
return (long) -1; |
| 4771 |
} else { |
| 4772 |
stepval = __Pyx_NewRef(v); |
| 4773 |
} |
| 4774 |
val = (long) 0; |
| 4775 |
mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; |
| 4776 |
shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; |
| 4777 |
for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) { |
| 4778 |
PyObject *tmp, *digit; |
| 4779 |
digit = PyNumber_And(stepval, mask); |
| 4780 |
if (unlikely(!digit)) goto done; |
| 4781 |
idigit = PyLong_AsLong(digit); |
| 4782 |
Py_DECREF(digit); |
| 4783 |
if (unlikely(idigit < 0)) goto done; |
| 4784 |
tmp = PyNumber_Rshift(stepval, shift); |
| 4785 |
if (unlikely(!tmp)) goto done; |
| 4786 |
Py_DECREF(stepval); stepval = tmp; |
| 4787 |
val |= ((long) idigit) << bits; |
| 4788 |
#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 |
| 4789 |
if (Py_SIZE(stepval) == 0) |
| 4790 |
goto unpacking_done; |
| 4791 |
#endif |
| 4792 |
} |
| 4793 |
idigit = PyLong_AsLong(stepval); |
| 4794 |
if (unlikely(idigit < 0)) goto done; |
| 4795 |
remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1); |
| 4796 |
if (unlikely(idigit >= (1L << remaining_bits))) |
| 4797 |
goto raise_overflow; |
| 4798 |
val |= ((long) idigit) << bits; |
| 4799 |
#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 |
| 4800 |
unpacking_done: |
| 4801 |
#endif |
| 4802 |
if (!is_unsigned) { |
| 4803 |
if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1)))) |
| 4804 |
goto raise_overflow; |
| 4805 |
if (is_negative) |
| 4806 |
val = ~val; |
| 4807 |
} |
| 4808 |
ret = 0; |
| 4809 |
done: |
| 4810 |
Py_XDECREF(shift); |
| 4811 |
Py_XDECREF(mask); |
| 4812 |
Py_XDECREF(stepval); |
| 4813 |
#endif |
| 4814 |
Py_DECREF(v); |
| 4815 |
if (likely(!ret)) |
| 4816 |
return val; |
| 4817 |
} |
| 4818 |
return (long) -1; |
| 4819 |
} |
| 4820 |
} else { |
| 4821 |
long val; |
| 4822 |
PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); |
| 4823 |
if (!tmp) return (long) -1; |
| 4824 |
val = __Pyx_PyInt_As_long(tmp); |
| 4825 |
Py_DECREF(tmp); |
| 4826 |
return val; |
| 4827 |
} |
| 4828 |
raise_overflow: |
| 4829 |
PyErr_SetString(PyExc_OverflowError, |
| 4830 |
"value too large to convert to long"); |
| 4831 |
return (long) -1; |
| 4832 |
raise_neg_overflow: |
| 4833 |
PyErr_SetString(PyExc_OverflowError, |
| 4834 |
"can't convert negative value to long"); |
| 4835 |
return (long) -1; |
| 4836 |
} |
| 4837 |
|
| 4838 |
|
| 4839 |
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { |
| 4840 |
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC |
| 4841 |
#pragma GCC diagnostic push |
| 4842 |
#pragma GCC diagnostic ignored "-Wconversion" |
| 4843 |
#endif |
| 4844 |
const int neg_one = (int) -1, const_zero = (int) 0; |
| 4845 |
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC |
| 4846 |
#pragma GCC diagnostic pop |
| 4847 |
#endif |
| 4848 |
const int is_unsigned = neg_one > const_zero; |
| 4849 |
#if PY_MAJOR_VERSION < 3 |
| 4850 |
if (likely(PyInt_Check(x))) { |
| 4851 |
if ((sizeof(int) < sizeof(long))) { |
| 4852 |
__PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) |
| 4853 |
} else { |
| 4854 |
long val = PyInt_AS_LONG(x); |
| 4855 |
if (is_unsigned && unlikely(val < 0)) { |
| 4856 |
goto raise_neg_overflow; |
| 4857 |
} |
| 4858 |
return (int) val; |
| 4859 |
} |
| 4860 |
} else |
| 4861 |
#endif |
| 4862 |
if (likely(PyLong_Check(x))) { |
| 4863 |
if (is_unsigned) { |
| 4864 |
#if CYTHON_USE_PYLONG_INTERNALS |
| 4865 |
if (unlikely(__Pyx_PyLong_IsNeg(x))) { |
| 4866 |
goto raise_neg_overflow; |
| 4867 |
} else if (__Pyx_PyLong_IsCompact(x)) { |
| 4868 |
__PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) |
| 4869 |
} else { |
| 4870 |
const digit* digits = __Pyx_PyLong_Digits(x); |
| 4871 |
assert(__Pyx_PyLong_DigitCount(x) > 1); |
| 4872 |
switch (__Pyx_PyLong_DigitCount(x)) { |
| 4873 |
case 2: |
| 4874 |
if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { |
| 4875 |
if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { |
| 4876 |
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) |
| 4877 |
} else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) { |
| 4878 |
return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); |
| 4879 |
} |
| 4880 |
} |
| 4881 |
break; |
| 4882 |
case 3: |
| 4883 |
if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { |
| 4884 |
if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { |
| 4885 |
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) |
| 4886 |
} else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) { |
| 4887 |
return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); |
| 4888 |
} |
| 4889 |
} |
| 4890 |
break; |
| 4891 |
case 4: |
| 4892 |
if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { |
| 4893 |
if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { |
| 4894 |
__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]))) |
| 4895 |
} else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) { |
| 4896 |
return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); |
| 4897 |
} |
| 4898 |
} |
| 4899 |
break; |
| 4900 |
} |
| 4901 |
} |
| 4902 |
#endif |
| 4903 |
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 |
| 4904 |
if (unlikely(Py_SIZE(x) < 0)) { |
| 4905 |
goto raise_neg_overflow; |
| 4906 |
} |
| 4907 |
#else |
| 4908 |
{ |
| 4909 |
int result = PyObject_RichCompareBool(x, Py_False, Py_LT); |
| 4910 |
if (unlikely(result < 0)) |
| 4911 |
return (int) -1; |
| 4912 |
if (unlikely(result == 1)) |
| 4913 |
goto raise_neg_overflow; |
| 4914 |
} |
| 4915 |
#endif |
| 4916 |
if ((sizeof(int) <= sizeof(unsigned long))) { |
| 4917 |
__PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) |
| 4918 |
#ifdef HAVE_LONG_LONG |
| 4919 |
} else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) { |
| 4920 |
__PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) |
| 4921 |
#endif |
| 4922 |
} |
| 4923 |
} else { |
| 4924 |
#if CYTHON_USE_PYLONG_INTERNALS |
| 4925 |
if (__Pyx_PyLong_IsCompact(x)) { |
| 4926 |
__PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) |
| 4927 |
} else { |
| 4928 |
const digit* digits = __Pyx_PyLong_Digits(x); |
| 4929 |
assert(__Pyx_PyLong_DigitCount(x) > 1); |
| 4930 |
switch (__Pyx_PyLong_SignedDigitCount(x)) { |
| 4931 |
case -2: |
| 4932 |
if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) { |
| 4933 |
if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { |
| 4934 |
__PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) |
| 4935 |
} else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { |
| 4936 |
return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); |
| 4937 |
} |
| 4938 |
} |
| 4939 |
break; |
| 4940 |
case 2: |
| 4941 |
if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { |
| 4942 |
if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { |
| 4943 |
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) |
| 4944 |
} else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { |
| 4945 |
return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); |
| 4946 |
} |
| 4947 |
} |
| 4948 |
break; |
| 4949 |
case -3: |
| 4950 |
if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { |
| 4951 |
if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { |
| 4952 |
__PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) |
| 4953 |
} else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { |
| 4954 |
return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); |
| 4955 |
} |
| 4956 |
} |
| 4957 |
break; |
| 4958 |
case 3: |
| 4959 |
if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { |
| 4960 |
if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { |
| 4961 |
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) |
| 4962 |
} else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { |
| 4963 |
return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); |
| 4964 |
} |
| 4965 |
} |
| 4966 |
break; |
| 4967 |
case -4: |
| 4968 |
if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { |
| 4969 |
if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { |
| 4970 |
__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]))) |
| 4971 |
} else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { |
| 4972 |
return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); |
| 4973 |
} |
| 4974 |
} |
| 4975 |
break; |
| 4976 |
case 4: |
| 4977 |
if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { |
| 4978 |
if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { |
| 4979 |
__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]))) |
| 4980 |
} else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { |
| 4981 |
return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); |
| 4982 |
} |
| 4983 |
} |
| 4984 |
break; |
| 4985 |
} |
| 4986 |
} |
| 4987 |
#endif |
| 4988 |
if ((sizeof(int) <= sizeof(long))) { |
| 4989 |
__PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) |
| 4990 |
#ifdef HAVE_LONG_LONG |
| 4991 |
} else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) { |
| 4992 |
__PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) |
| 4993 |
#endif |
| 4994 |
} |
| 4995 |
} |
| 4996 |
{ |
| 4997 |
int val; |
| 4998 |
PyObject *v = __Pyx_PyNumber_IntOrLong(x); |
| 4999 |
#if PY_MAJOR_VERSION < 3 |
| 5000 |
if (likely(v) && !PyLong_Check(v)) { |
| 5001 |
PyObject *tmp = v; |
| 5002 |
v = PyNumber_Long(tmp); |
| 5003 |
Py_DECREF(tmp); |
| 5004 |
} |
| 5005 |
#endif |
| 5006 |
if (likely(v)) { |
| 5007 |
int ret = -1; |
| 5008 |
#if !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) |
| 5009 |
int one = 1; int is_little = (int)*(unsigned char *)&one; |
| 5010 |
unsigned char *bytes = (unsigned char *)&val; |
| 5011 |
ret = _PyLong_AsByteArray((PyLongObject *)v, |
| 5012 |
bytes, sizeof(val), |
| 5013 |
is_little, !is_unsigned); |
| 5014 |
#else |
| 5015 |
PyObject *stepval = NULL, *mask = NULL, *shift = NULL; |
| 5016 |
int bits, remaining_bits, is_negative = 0; |
| 5017 |
long idigit; |
| 5018 |
int chunk_size = (sizeof(long) < 8) ? 30 : 62; |
| 5019 |
if (unlikely(!PyLong_CheckExact(v))) { |
| 5020 |
PyObject *tmp = v; |
| 5021 |
v = PyNumber_Long(v); |
| 5022 |
assert(PyLong_CheckExact(v)); |
| 5023 |
Py_DECREF(tmp); |
| 5024 |
if (unlikely(!v)) return (int) -1; |
| 5025 |
} |
| 5026 |
#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 |
| 5027 |
if (Py_SIZE(x) == 0) |
| 5028 |
return (int) 0; |
| 5029 |
is_negative = Py_SIZE(x) < 0; |
| 5030 |
#else |
| 5031 |
{ |
| 5032 |
int result = PyObject_RichCompareBool(x, Py_False, Py_LT); |
| 5033 |
if (unlikely(result < 0)) |
| 5034 |
return (int) -1; |
| 5035 |
is_negative = result == 1; |
| 5036 |
} |
| 5037 |
#endif |
| 5038 |
if (is_unsigned && unlikely(is_negative)) { |
| 5039 |
goto raise_neg_overflow; |
| 5040 |
} else if (is_negative) { |
| 5041 |
stepval = PyNumber_Invert(v); |
| 5042 |
if (unlikely(!stepval)) |
| 5043 |
return (int) -1; |
| 5044 |
} else { |
| 5045 |
stepval = __Pyx_NewRef(v); |
| 5046 |
} |
| 5047 |
val = (int) 0; |
| 5048 |
mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; |
| 5049 |
shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; |
| 5050 |
for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) { |
| 5051 |
PyObject *tmp, *digit; |
| 5052 |
digit = PyNumber_And(stepval, mask); |
| 5053 |
if (unlikely(!digit)) goto done; |
| 5054 |
idigit = PyLong_AsLong(digit); |
| 5055 |
Py_DECREF(digit); |
| 5056 |
if (unlikely(idigit < 0)) goto done; |
| 5057 |
tmp = PyNumber_Rshift(stepval, shift); |
| 5058 |
if (unlikely(!tmp)) goto done; |
| 5059 |
Py_DECREF(stepval); stepval = tmp; |
| 5060 |
val |= ((int) idigit) << bits; |
| 5061 |
#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 |
| 5062 |
if (Py_SIZE(stepval) == 0) |
| 5063 |
goto unpacking_done; |
| 5064 |
#endif |
| 5065 |
} |
| 5066 |
idigit = PyLong_AsLong(stepval); |
| 5067 |
if (unlikely(idigit < 0)) goto done; |
| 5068 |
remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1); |
| 5069 |
if (unlikely(idigit >= (1L << remaining_bits))) |
| 5070 |
goto raise_overflow; |
| 5071 |
val |= ((int) idigit) << bits; |
| 5072 |
#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 |
| 5073 |
unpacking_done: |
| 5074 |
#endif |
| 5075 |
if (!is_unsigned) { |
| 5076 |
if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1)))) |
| 5077 |
goto raise_overflow; |
| 5078 |
if (is_negative) |
| 5079 |
val = ~val; |
| 5080 |
} |
| 5081 |
ret = 0; |
| 5082 |
done: |
| 5083 |
Py_XDECREF(shift); |
| 5084 |
Py_XDECREF(mask); |
| 5085 |
Py_XDECREF(stepval); |
| 5086 |
#endif |
| 5087 |
Py_DECREF(v); |
| 5088 |
if (likely(!ret)) |
| 5089 |
return val; |
| 5090 |
} |
| 5091 |
return (int) -1; |
| 5092 |
} |
| 5093 |
} else { |
| 5094 |
int val; |
| 5095 |
PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); |
| 5096 |
if (!tmp) return (int) -1; |
| 5097 |
val = __Pyx_PyInt_As_int(tmp); |
| 5098 |
Py_DECREF(tmp); |
| 5099 |
return val; |
| 5100 |
} |
| 5101 |
raise_overflow: |
| 5102 |
PyErr_SetString(PyExc_OverflowError, |
| 5103 |
"value too large to convert to int"); |
| 5104 |
return (int) -1; |
| 5105 |
raise_neg_overflow: |
| 5106 |
PyErr_SetString(PyExc_OverflowError, |
| 5107 |
"can't convert negative value to int"); |
| 5108 |
return (int) -1; |
| 5109 |
} |
| 5110 |
|
| 5111 |
|
| 5112 |
#if CYTHON_COMPILING_IN_CPYTHON |
| 5113 |
static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { |
| 5114 |
while (a) { |
| 5115 |
a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*); |
| 5116 |
if (a == b) |
| 5117 |
return 1; |
| 5118 |
} |
| 5119 |
return b == &PyBaseObject_Type; |
| 5120 |
} |
| 5121 |
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { |
| 5122 |
PyObject *mro; |
| 5123 |
if (a == b) return 1; |
| 5124 |
mro = a->tp_mro; |
| 5125 |
if (likely(mro)) { |
| 5126 |
Py_ssize_t i, n; |
| 5127 |
n = PyTuple_GET_SIZE(mro); |
| 5128 |
for (i = 0; i < n; i++) { |
| 5129 |
if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) |
| 5130 |
return 1; |
| 5131 |
} |
| 5132 |
return 0; |
| 5133 |
} |
| 5134 |
return __Pyx_InBases(a, b); |
| 5135 |
} |
| 5136 |
static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) { |
| 5137 |
PyObject *mro; |
| 5138 |
if (cls == a || cls == b) return 1; |
| 5139 |
mro = cls->tp_mro; |
| 5140 |
if (likely(mro)) { |
| 5141 |
Py_ssize_t i, n; |
| 5142 |
n = PyTuple_GET_SIZE(mro); |
| 5143 |
for (i = 0; i < n; i++) { |
| 5144 |
PyObject *base = PyTuple_GET_ITEM(mro, i); |
| 5145 |
if (base == (PyObject *)a || base == (PyObject *)b) |
| 5146 |
return 1; |
| 5147 |
} |
| 5148 |
return 0; |
| 5149 |
} |
| 5150 |
return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b); |
| 5151 |
} |
| 5152 |
#if PY_MAJOR_VERSION == 2 |
| 5153 |
static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { |
| 5154 |
PyObject *exception, *value, *tb; |
| 5155 |
int res; |
| 5156 |
__Pyx_PyThreadState_declare |
| 5157 |
__Pyx_PyThreadState_assign |
| 5158 |
__Pyx_ErrFetch(&exception, &value, &tb); |
| 5159 |
res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0; |
| 5160 |
if (unlikely(res == -1)) { |
| 5161 |
PyErr_WriteUnraisable(err); |
| 5162 |
res = 0; |
| 5163 |
} |
| 5164 |
if (!res) { |
| 5165 |
res = PyObject_IsSubclass(err, exc_type2); |
| 5166 |
if (unlikely(res == -1)) { |
| 5167 |
PyErr_WriteUnraisable(err); |
| 5168 |
res = 0; |
| 5169 |
} |
| 5170 |
} |
| 5171 |
__Pyx_ErrRestore(exception, value, tb); |
| 5172 |
return res; |
| 5173 |
} |
| 5174 |
#else |
| 5175 |
static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { |
| 5176 |
if (exc_type1) { |
| 5177 |
return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2); |
| 5178 |
} else { |
| 5179 |
return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); |
| 5180 |
} |
| 5181 |
} |
| 5182 |
#endif |
| 5183 |
static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { |
| 5184 |
Py_ssize_t i, n; |
| 5185 |
assert(PyExceptionClass_Check(exc_type)); |
| 5186 |
n = PyTuple_GET_SIZE(tuple); |
| 5187 |
#if PY_MAJOR_VERSION >= 3 |
| 5188 |
for (i=0; i<n; i++) { |
| 5189 |
if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1; |
| 5190 |
} |
| 5191 |
#endif |
| 5192 |
for (i=0; i<n; i++) { |
| 5193 |
PyObject *t = PyTuple_GET_ITEM(tuple, i); |
| 5194 |
#if PY_MAJOR_VERSION < 3 |
| 5195 |
if (likely(exc_type == t)) return 1; |
| 5196 |
#endif |
| 5197 |
if (likely(PyExceptionClass_Check(t))) { |
| 5198 |
if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1; |
| 5199 |
} else { |
| 5200 |
} |
| 5201 |
} |
| 5202 |
return 0; |
| 5203 |
} |
| 5204 |
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) { |
| 5205 |
if (likely(err == exc_type)) return 1; |
| 5206 |
if (likely(PyExceptionClass_Check(err))) { |
| 5207 |
if (likely(PyExceptionClass_Check(exc_type))) { |
| 5208 |
return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type); |
| 5209 |
} else if (likely(PyTuple_Check(exc_type))) { |
| 5210 |
return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type); |
| 5211 |
} else { |
| 5212 |
} |
| 5213 |
} |
| 5214 |
return PyErr_GivenExceptionMatches(err, exc_type); |
| 5215 |
} |
| 5216 |
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) { |
| 5217 |
assert(PyExceptionClass_Check(exc_type1)); |
| 5218 |
assert(PyExceptionClass_Check(exc_type2)); |
| 5219 |
if (likely(err == exc_type1 || err == exc_type2)) return 1; |
| 5220 |
if (likely(PyExceptionClass_Check(err))) { |
| 5221 |
return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2); |
| 5222 |
} |
| 5223 |
return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2)); |
| 5224 |
} |
| 5225 |
#endif |
| 5226 |
|
| 5227 |
|
| 5228 |
static int __Pyx_check_binary_version(void) { |
| 5229 |
char ctversion[5]; |
| 5230 |
int same=1, i, found_dot; |
| 5231 |
const char* rt_from_call = Py_GetVersion(); |
| 5232 |
PyOS_snprintf(ctversion, 5, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); |
| 5233 |
found_dot = 0; |
| 5234 |
for (i = 0; i < 4; i++) { |
| 5235 |
if (!ctversion[i]) { |
| 5236 |
same = (rt_from_call[i] < '0' || rt_from_call[i] > '9'); |
| 5237 |
break; |
| 5238 |
} |
| 5239 |
if (rt_from_call[i] != ctversion[i]) { |
| 5240 |
same = 0; |
| 5241 |
break; |
| 5242 |
} |
| 5243 |
} |
| 5244 |
if (!same) { |
| 5245 |
char rtversion[5] = {'\0'}; |
| 5246 |
char message[200]; |
| 5247 |
for (i=0; i<4; ++i) { |
| 5248 |
if (rt_from_call[i] == '.') { |
| 5249 |
if (found_dot) break; |
| 5250 |
found_dot = 1; |
| 5251 |
} else if (rt_from_call[i] < '0' || rt_from_call[i] > '9') { |
| 5252 |
break; |
| 5253 |
} |
| 5254 |
rtversion[i] = rt_from_call[i]; |
| 5255 |
} |
| 5256 |
PyOS_snprintf(message, sizeof(message), |
| 5257 |
"compile time version %s of module '%.100s' " |
| 5258 |
"does not match runtime version %s", |
| 5259 |
ctversion, __Pyx_MODULE_NAME, rtversion); |
| 5260 |
return PyErr_WarnEx(NULL, message, 1); |
| 5261 |
} |
| 5262 |
return 0; |
| 5263 |
} |
| 5264 |
|
| 5265 |
|
| 5266 |
#if PY_MAJOR_VERSION >= 3 |
| 5267 |
static int __Pyx_InitString(__Pyx_StringTabEntry t, PyObject **str) { |
| 5268 |
if (t.is_unicode | t.is_str) { |
| 5269 |
if (t.intern) { |
| 5270 |
*str = PyUnicode_InternFromString(t.s); |
| 5271 |
} else if (t.encoding) { |
| 5272 |
*str = PyUnicode_Decode(t.s, t.n - 1, t.encoding, NULL); |
| 5273 |
} else { |
| 5274 |
*str = PyUnicode_FromStringAndSize(t.s, t.n - 1); |
| 5275 |
} |
| 5276 |
} else { |
| 5277 |
*str = PyBytes_FromStringAndSize(t.s, t.n - 1); |
| 5278 |
} |
| 5279 |
if (!*str) |
| 5280 |
return -1; |
| 5281 |
if (PyObject_Hash(*str) == -1) |
| 5282 |
return -1; |
| 5283 |
return 0; |
| 5284 |
} |
| 5285 |
#endif |
| 5286 |
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { |
| 5287 |
while (t->p) { |
| 5288 |
#if PY_MAJOR_VERSION >= 3 |
| 5289 |
__Pyx_InitString(*t, t->p); |
| 5290 |
#else |
| 5291 |
if (t->is_unicode) { |
| 5292 |
*t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); |
| 5293 |
} else if (t->intern) { |
| 5294 |
*t->p = PyString_InternFromString(t->s); |
| 5295 |
} else { |
| 5296 |
*t->p = PyString_FromStringAndSize(t->s, t->n - 1); |
| 5297 |
} |
| 5298 |
if (!*t->p) |
| 5299 |
return -1; |
| 5300 |
if (PyObject_Hash(*t->p) == -1) |
| 5301 |
return -1; |
| 5302 |
#endif |
| 5303 |
++t; |
| 5304 |
} |
| 5305 |
return 0; |
| 5306 |
} |
| 5307 |
|
| 5308 |
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { |
| 5309 |
return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str)); |
| 5310 |
} |
| 5311 |
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) { |
| 5312 |
Py_ssize_t ignore; |
| 5313 |
return __Pyx_PyObject_AsStringAndSize(o, &ignore); |
| 5314 |
} |
| 5315 |
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT |
| 5316 |
#if !CYTHON_PEP393_ENABLED |
| 5317 |
static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { |
| 5318 |
char* defenc_c; |
| 5319 |
PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); |
| 5320 |
if (!defenc) return NULL; |
| 5321 |
defenc_c = PyBytes_AS_STRING(defenc); |
| 5322 |
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII |
| 5323 |
{ |
| 5324 |
char* end = defenc_c + PyBytes_GET_SIZE(defenc); |
| 5325 |
char* c; |
| 5326 |
for (c = defenc_c; c < end; c++) { |
| 5327 |
if ((unsigned char) (*c) >= 128) { |
| 5328 |
PyUnicode_AsASCIIString(o); |
| 5329 |
return NULL; |
| 5330 |
} |
| 5331 |
} |
| 5332 |
} |
| 5333 |
#endif |
| 5334 |
*length = PyBytes_GET_SIZE(defenc); |
| 5335 |
return defenc_c; |
| 5336 |
} |
| 5337 |
#else |
| 5338 |
static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { |
| 5339 |
if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL; |
| 5340 |
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII |
| 5341 |
if (likely(PyUnicode_IS_ASCII(o))) { |
| 5342 |
*length = PyUnicode_GET_LENGTH(o); |
| 5343 |
return PyUnicode_AsUTF8(o); |
| 5344 |
} else { |
| 5345 |
PyUnicode_AsASCIIString(o); |
| 5346 |
return NULL; |
| 5347 |
} |
| 5348 |
#else |
| 5349 |
return PyUnicode_AsUTF8AndSize(o, length); |
| 5350 |
#endif |
| 5351 |
} |
| 5352 |
#endif |
| 5353 |
#endif |
| 5354 |
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { |
| 5355 |
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT |
| 5356 |
if ( |
| 5357 |
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII |
| 5358 |
__Pyx_sys_getdefaultencoding_not_ascii && |
| 5359 |
#endif |
| 5360 |
PyUnicode_Check(o)) { |
| 5361 |
return __Pyx_PyUnicode_AsStringAndSize(o, length); |
| 5362 |
} else |
| 5363 |
#endif |
| 5364 |
#if (!CYTHON_COMPILING_IN_PYPY && !CYTHON_COMPILING_IN_LIMITED_API) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) |
| 5365 |
if (PyByteArray_Check(o)) { |
| 5366 |
*length = PyByteArray_GET_SIZE(o); |
| 5367 |
return PyByteArray_AS_STRING(o); |
| 5368 |
} else |
| 5369 |
#endif |
| 5370 |
{ |
| 5371 |
char* result; |
| 5372 |
int r = PyBytes_AsStringAndSize(o, &result, length); |
| 5373 |
if (unlikely(r < 0)) { |
| 5374 |
return NULL; |
| 5375 |
} else { |
| 5376 |
return result; |
| 5377 |
} |
| 5378 |
} |
| 5379 |
} |
| 5380 |
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { |
| 5381 |
int is_true = x == Py_True; |
| 5382 |
if (is_true | (x == Py_False) | (x == Py_None)) return is_true; |
| 5383 |
else return PyObject_IsTrue(x); |
| 5384 |
} |
| 5385 |
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { |
| 5386 |
int retval; |
| 5387 |
if (unlikely(!x)) return -1; |
| 5388 |
retval = __Pyx_PyObject_IsTrue(x); |
| 5389 |
Py_DECREF(x); |
| 5390 |
return retval; |
| 5391 |
} |
| 5392 |
static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) { |
| 5393 |
__Pyx_TypeName result_type_name = __Pyx_PyType_GetName(Py_TYPE(result)); |
| 5394 |
#if PY_MAJOR_VERSION >= 3 |
| 5395 |
if (PyLong_Check(result)) { |
| 5396 |
if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, |
| 5397 |
"__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). " |
| 5398 |
"The ability to return an instance of a strict subclass of int is deprecated, " |
| 5399 |
"and may be removed in a future version of Python.", |
| 5400 |
result_type_name)) { |
| 5401 |
__Pyx_DECREF_TypeName(result_type_name); |
| 5402 |
Py_DECREF(result); |
| 5403 |
return NULL; |
| 5404 |
} |
| 5405 |
__Pyx_DECREF_TypeName(result_type_name); |
| 5406 |
return result; |
| 5407 |
} |
| 5408 |
#endif |
| 5409 |
PyErr_Format(PyExc_TypeError, |
| 5410 |
"__%.4s__ returned non-%.4s (type " __Pyx_FMT_TYPENAME ")", |
| 5411 |
type_name, type_name, result_type_name); |
| 5412 |
__Pyx_DECREF_TypeName(result_type_name); |
| 5413 |
Py_DECREF(result); |
| 5414 |
return NULL; |
| 5415 |
} |
| 5416 |
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) { |
| 5417 |
#if CYTHON_USE_TYPE_SLOTS |
| 5418 |
PyNumberMethods *m; |
| 5419 |
#endif |
| 5420 |
const char *name = NULL; |
| 5421 |
PyObject *res = NULL; |
| 5422 |
#if PY_MAJOR_VERSION < 3 |
| 5423 |
if (likely(PyInt_Check(x) || PyLong_Check(x))) |
| 5424 |
#else |
| 5425 |
if (likely(PyLong_Check(x))) |
| 5426 |
#endif |
| 5427 |
return __Pyx_NewRef(x); |
| 5428 |
#if CYTHON_USE_TYPE_SLOTS |
| 5429 |
m = Py_TYPE(x)->tp_as_number; |
| 5430 |
#if PY_MAJOR_VERSION < 3 |
| 5431 |
if (m && m->nb_int) { |
| 5432 |
name = "int"; |
| 5433 |
res = m->nb_int(x); |
| 5434 |
} |
| 5435 |
else if (m && m->nb_long) { |
| 5436 |
name = "long"; |
| 5437 |
res = m->nb_long(x); |
| 5438 |
} |
| 5439 |
#else |
| 5440 |
if (likely(m && m->nb_int)) { |
| 5441 |
name = "int"; |
| 5442 |
res = m->nb_int(x); |
| 5443 |
} |
| 5444 |
#endif |
| 5445 |
#else |
| 5446 |
if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) { |
| 5447 |
res = PyNumber_Int(x); |
| 5448 |
} |
| 5449 |
#endif |
| 5450 |
if (likely(res)) { |
| 5451 |
#if PY_MAJOR_VERSION < 3 |
| 5452 |
if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) { |
| 5453 |
#else |
| 5454 |
if (unlikely(!PyLong_CheckExact(res))) { |
| 5455 |
#endif |
| 5456 |
return __Pyx_PyNumber_IntOrLongWrongResultType(res, name); |
| 5457 |
} |
| 5458 |
} |
| 5459 |
else if (!PyErr_Occurred()) { |
| 5460 |
PyErr_SetString(PyExc_TypeError, |
| 5461 |
"an integer is required"); |
| 5462 |
} |
| 5463 |
return res; |
| 5464 |
} |
| 5465 |
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { |
| 5466 |
Py_ssize_t ival; |
| 5467 |
PyObject *x; |
| 5468 |
#if PY_MAJOR_VERSION < 3 |
| 5469 |
if (likely(PyInt_CheckExact(b))) { |
| 5470 |
if (sizeof(Py_ssize_t) >= sizeof(long)) |
| 5471 |
return PyInt_AS_LONG(b); |
| 5472 |
else |
| 5473 |
return PyInt_AsSsize_t(b); |
| 5474 |
} |
| 5475 |
#endif |
| 5476 |
if (likely(PyLong_CheckExact(b))) { |
| 5477 |
#if CYTHON_USE_PYLONG_INTERNALS |
| 5478 |
if (likely(__Pyx_PyLong_IsCompact(b))) { |
| 5479 |
return __Pyx_PyLong_CompactValue(b); |
| 5480 |
} else { |
| 5481 |
const digit* digits = __Pyx_PyLong_Digits(b); |
| 5482 |
const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b); |
| 5483 |
switch (size) { |
| 5484 |
case 2: |
| 5485 |
if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { |
| 5486 |
return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); |
| 5487 |
} |
| 5488 |
break; |
| 5489 |
case -2: |
| 5490 |
if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { |
| 5491 |
return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); |
| 5492 |
} |
| 5493 |
break; |
| 5494 |
case 3: |
| 5495 |
if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { |
| 5496 |
return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); |
| 5497 |
} |
| 5498 |
break; |
| 5499 |
case -3: |
| 5500 |
if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { |
| 5501 |
return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); |
| 5502 |
} |
| 5503 |
break; |
| 5504 |
case 4: |
| 5505 |
if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { |
| 5506 |
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])); |
| 5507 |
} |
| 5508 |
break; |
| 5509 |
case -4: |
| 5510 |
if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { |
| 5511 |
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])); |
| 5512 |
} |
| 5513 |
break; |
| 5514 |
} |
| 5515 |
} |
| 5516 |
#endif |
| 5517 |
return PyLong_AsSsize_t(b); |
| 5518 |
} |
| 5519 |
x = PyNumber_Index(b); |
| 5520 |
if (!x) return -1; |
| 5521 |
ival = PyInt_AsSsize_t(x); |
| 5522 |
Py_DECREF(x); |
| 5523 |
return ival; |
| 5524 |
} |
| 5525 |
static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) { |
| 5526 |
if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) { |
| 5527 |
return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o); |
| 5528 |
#if PY_MAJOR_VERSION < 3 |
| 5529 |
} else if (likely(PyInt_CheckExact(o))) { |
| 5530 |
return PyInt_AS_LONG(o); |
| 5531 |
#endif |
| 5532 |
} else { |
| 5533 |
Py_ssize_t ival; |
| 5534 |
PyObject *x; |
| 5535 |
x = PyNumber_Index(o); |
| 5536 |
if (!x) return -1; |
| 5537 |
ival = PyInt_AsLong(x); |
| 5538 |
Py_DECREF(x); |
| 5539 |
return ival; |
| 5540 |
} |
| 5541 |
} |
| 5542 |
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { |
| 5543 |
return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False); |
| 5544 |
} |
| 5545 |
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { |
| 5546 |
return PyInt_FromSize_t(ival); |
| 5547 |
} |
| 5548 |
|
| 5549 |
|
| 5550 |
|
| 5551 |
#ifdef _MSC_VER |
| 5552 |
#pragma warning( pop ) |
| 5553 |
#endif |
| 5554 |
|
| 5555 |
|
| 5556 |
|
| 5557 |
|
| 5558 |
#endif |