My omnium-gatherom of scripts and source code.
at main 8725 lines 346 kB view raw
1/* Generated by Cython 3.0.10 */ 2 3/* BEGIN: Cython Metadata 4{ 5 "distutils": { 6 "name": "search", 7 "sources": [ 8 "search.pyx" 9 ] 10 }, 11 "module_name": "search" 12} 13END: Cython Metadata */ 14 15#ifndef PY_SSIZE_T_CLEAN 16#define PY_SSIZE_T_CLEAN 17#endif /* PY_SSIZE_T_CLEAN */ 18#if defined(CYTHON_LIMITED_API) && 0 19 #ifndef Py_LIMITED_API 20 #if CYTHON_LIMITED_API+0 > 0x03030000 21 #define Py_LIMITED_API CYTHON_LIMITED_API 22 #else 23 #define Py_LIMITED_API 0x03030000 24 #endif 25 #endif 26#endif 27 28#include "Python.h" 29#ifndef Py_PYTHON_H 30 #error Python headers needed to compile C extensions, please install development version of Python. 31#elif PY_VERSION_HEX < 0x02070000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) 32 #error Cython requires Python 2.7+ or Python 3.3+. 33#else 34#if defined(CYTHON_LIMITED_API) && CYTHON_LIMITED_API 35#define __PYX_EXTRA_ABI_MODULE_NAME "limited" 36#else 37#define __PYX_EXTRA_ABI_MODULE_NAME "" 38#endif 39#define CYTHON_ABI "3_0_10" __PYX_EXTRA_ABI_MODULE_NAME 40#define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI 41#define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." 42#define CYTHON_HEX_VERSION 0x03000AF0 43#define CYTHON_FUTURE_DIVISION 1 44#include <stddef.h> 45#ifndef offsetof 46 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) 47#endif 48#if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS) 49 #ifndef __stdcall 50 #define __stdcall 51 #endif 52 #ifndef __cdecl 53 #define __cdecl 54 #endif 55 #ifndef __fastcall 56 #define __fastcall 57 #endif 58#endif 59#ifndef DL_IMPORT 60 #define DL_IMPORT(t) t 61#endif 62#ifndef DL_EXPORT 63 #define DL_EXPORT(t) t 64#endif 65#define __PYX_COMMA , 66#ifndef HAVE_LONG_LONG 67 #define HAVE_LONG_LONG 68#endif 69#ifndef PY_LONG_LONG 70 #define PY_LONG_LONG LONG_LONG 71#endif 72#ifndef Py_HUGE_VAL 73 #define Py_HUGE_VAL HUGE_VAL 74#endif 75#define __PYX_LIMITED_VERSION_HEX PY_VERSION_HEX 76#if defined(GRAALVM_PYTHON) 77 /* For very preliminary testing purposes. Most variables are set the same as PyPy. 78 The existence of this section does not imply that anything works or is even tested */ 79 #define CYTHON_COMPILING_IN_PYPY 0 80 #define CYTHON_COMPILING_IN_CPYTHON 0 81 #define CYTHON_COMPILING_IN_LIMITED_API 0 82 #define CYTHON_COMPILING_IN_GRAAL 1 83 #define CYTHON_COMPILING_IN_NOGIL 0 84 #undef CYTHON_USE_TYPE_SLOTS 85 #define CYTHON_USE_TYPE_SLOTS 0 86 #undef CYTHON_USE_TYPE_SPECS 87 #define CYTHON_USE_TYPE_SPECS 0 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 #undef CYTHON_PEP489_MULTI_PHASE_INIT 122 #define CYTHON_PEP489_MULTI_PHASE_INIT 1 123 #undef CYTHON_USE_MODULE_STATE 124 #define CYTHON_USE_MODULE_STATE 0 125 #undef CYTHON_USE_TP_FINALIZE 126 #define CYTHON_USE_TP_FINALIZE 0 127 #undef CYTHON_USE_DICT_VERSIONS 128 #define CYTHON_USE_DICT_VERSIONS 0 129 #undef CYTHON_USE_EXC_INFO_STACK 130 #define CYTHON_USE_EXC_INFO_STACK 0 131 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC 132 #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 133 #endif 134 #undef CYTHON_USE_FREELISTS 135 #define CYTHON_USE_FREELISTS 0 136#elif defined(PYPY_VERSION) 137 #define CYTHON_COMPILING_IN_PYPY 1 138 #define CYTHON_COMPILING_IN_CPYTHON 0 139 #define CYTHON_COMPILING_IN_LIMITED_API 0 140 #define CYTHON_COMPILING_IN_GRAAL 0 141 #define CYTHON_COMPILING_IN_NOGIL 0 142 #undef CYTHON_USE_TYPE_SLOTS 143 #define CYTHON_USE_TYPE_SLOTS 0 144 #ifndef CYTHON_USE_TYPE_SPECS 145 #define CYTHON_USE_TYPE_SPECS 0 146 #endif 147 #undef CYTHON_USE_PYTYPE_LOOKUP 148 #define CYTHON_USE_PYTYPE_LOOKUP 0 149 #if PY_VERSION_HEX < 0x03050000 150 #undef CYTHON_USE_ASYNC_SLOTS 151 #define CYTHON_USE_ASYNC_SLOTS 0 152 #elif !defined(CYTHON_USE_ASYNC_SLOTS) 153 #define CYTHON_USE_ASYNC_SLOTS 1 154 #endif 155 #undef CYTHON_USE_PYLIST_INTERNALS 156 #define CYTHON_USE_PYLIST_INTERNALS 0 157 #undef CYTHON_USE_UNICODE_INTERNALS 158 #define CYTHON_USE_UNICODE_INTERNALS 0 159 #undef CYTHON_USE_UNICODE_WRITER 160 #define CYTHON_USE_UNICODE_WRITER 0 161 #undef CYTHON_USE_PYLONG_INTERNALS 162 #define CYTHON_USE_PYLONG_INTERNALS 0 163 #undef CYTHON_AVOID_BORROWED_REFS 164 #define CYTHON_AVOID_BORROWED_REFS 1 165 #undef CYTHON_ASSUME_SAFE_MACROS 166 #define CYTHON_ASSUME_SAFE_MACROS 0 167 #undef CYTHON_UNPACK_METHODS 168 #define CYTHON_UNPACK_METHODS 0 169 #undef CYTHON_FAST_THREAD_STATE 170 #define CYTHON_FAST_THREAD_STATE 0 171 #undef CYTHON_FAST_GIL 172 #define CYTHON_FAST_GIL 0 173 #undef CYTHON_METH_FASTCALL 174 #define CYTHON_METH_FASTCALL 0 175 #undef CYTHON_FAST_PYCALL 176 #define CYTHON_FAST_PYCALL 0 177 #ifndef CYTHON_PEP487_INIT_SUBCLASS 178 #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3) 179 #endif 180 #if PY_VERSION_HEX < 0x03090000 181 #undef CYTHON_PEP489_MULTI_PHASE_INIT 182 #define CYTHON_PEP489_MULTI_PHASE_INIT 0 183 #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) 184 #define CYTHON_PEP489_MULTI_PHASE_INIT 1 185 #endif 186 #undef CYTHON_USE_MODULE_STATE 187 #define CYTHON_USE_MODULE_STATE 0 188 #undef CYTHON_USE_TP_FINALIZE 189 #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1 && PYPY_VERSION_NUM >= 0x07030C00) 190 #undef CYTHON_USE_DICT_VERSIONS 191 #define CYTHON_USE_DICT_VERSIONS 0 192 #undef CYTHON_USE_EXC_INFO_STACK 193 #define CYTHON_USE_EXC_INFO_STACK 0 194 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC 195 #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 196 #endif 197 #undef CYTHON_USE_FREELISTS 198 #define CYTHON_USE_FREELISTS 0 199#elif defined(CYTHON_LIMITED_API) 200 #ifdef Py_LIMITED_API 201 #undef __PYX_LIMITED_VERSION_HEX 202 #define __PYX_LIMITED_VERSION_HEX Py_LIMITED_API 203 #endif 204 #define CYTHON_COMPILING_IN_PYPY 0 205 #define CYTHON_COMPILING_IN_CPYTHON 0 206 #define CYTHON_COMPILING_IN_LIMITED_API 1 207 #define CYTHON_COMPILING_IN_GRAAL 0 208 #define CYTHON_COMPILING_IN_NOGIL 0 209 #undef CYTHON_CLINE_IN_TRACEBACK 210 #define CYTHON_CLINE_IN_TRACEBACK 0 211 #undef CYTHON_USE_TYPE_SLOTS 212 #define CYTHON_USE_TYPE_SLOTS 0 213 #undef CYTHON_USE_TYPE_SPECS 214 #define CYTHON_USE_TYPE_SPECS 1 215 #undef CYTHON_USE_PYTYPE_LOOKUP 216 #define CYTHON_USE_PYTYPE_LOOKUP 0 217 #undef CYTHON_USE_ASYNC_SLOTS 218 #define CYTHON_USE_ASYNC_SLOTS 0 219 #undef CYTHON_USE_PYLIST_INTERNALS 220 #define CYTHON_USE_PYLIST_INTERNALS 0 221 #undef CYTHON_USE_UNICODE_INTERNALS 222 #define CYTHON_USE_UNICODE_INTERNALS 0 223 #ifndef CYTHON_USE_UNICODE_WRITER 224 #define CYTHON_USE_UNICODE_WRITER 0 225 #endif 226 #undef CYTHON_USE_PYLONG_INTERNALS 227 #define CYTHON_USE_PYLONG_INTERNALS 0 228 #ifndef CYTHON_AVOID_BORROWED_REFS 229 #define CYTHON_AVOID_BORROWED_REFS 0 230 #endif 231 #undef CYTHON_ASSUME_SAFE_MACROS 232 #define CYTHON_ASSUME_SAFE_MACROS 0 233 #undef CYTHON_UNPACK_METHODS 234 #define CYTHON_UNPACK_METHODS 0 235 #undef CYTHON_FAST_THREAD_STATE 236 #define CYTHON_FAST_THREAD_STATE 0 237 #undef CYTHON_FAST_GIL 238 #define CYTHON_FAST_GIL 0 239 #undef CYTHON_METH_FASTCALL 240 #define CYTHON_METH_FASTCALL 0 241 #undef CYTHON_FAST_PYCALL 242 #define CYTHON_FAST_PYCALL 0 243 #ifndef CYTHON_PEP487_INIT_SUBCLASS 244 #define CYTHON_PEP487_INIT_SUBCLASS 1 245 #endif 246 #undef CYTHON_PEP489_MULTI_PHASE_INIT 247 #define CYTHON_PEP489_MULTI_PHASE_INIT 0 248 #undef CYTHON_USE_MODULE_STATE 249 #define CYTHON_USE_MODULE_STATE 1 250 #ifndef CYTHON_USE_TP_FINALIZE 251 #define CYTHON_USE_TP_FINALIZE 0 252 #endif 253 #undef CYTHON_USE_DICT_VERSIONS 254 #define CYTHON_USE_DICT_VERSIONS 0 255 #undef CYTHON_USE_EXC_INFO_STACK 256 #define CYTHON_USE_EXC_INFO_STACK 0 257 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC 258 #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 259 #endif 260 #undef CYTHON_USE_FREELISTS 261 #define CYTHON_USE_FREELISTS 0 262#elif defined(Py_GIL_DISABLED) || defined(Py_NOGIL) 263 #define CYTHON_COMPILING_IN_PYPY 0 264 #define CYTHON_COMPILING_IN_CPYTHON 0 265 #define CYTHON_COMPILING_IN_LIMITED_API 0 266 #define CYTHON_COMPILING_IN_GRAAL 0 267 #define CYTHON_COMPILING_IN_NOGIL 1 268 #ifndef CYTHON_USE_TYPE_SLOTS 269 #define CYTHON_USE_TYPE_SLOTS 1 270 #endif 271 #ifndef CYTHON_USE_TYPE_SPECS 272 #define CYTHON_USE_TYPE_SPECS 0 273 #endif 274 #undef CYTHON_USE_PYTYPE_LOOKUP 275 #define CYTHON_USE_PYTYPE_LOOKUP 0 276 #ifndef CYTHON_USE_ASYNC_SLOTS 277 #define CYTHON_USE_ASYNC_SLOTS 1 278 #endif 279 #ifndef CYTHON_USE_PYLONG_INTERNALS 280 #define CYTHON_USE_PYLONG_INTERNALS 0 281 #endif 282 #undef CYTHON_USE_PYLIST_INTERNALS 283 #define CYTHON_USE_PYLIST_INTERNALS 0 284 #ifndef CYTHON_USE_UNICODE_INTERNALS 285 #define CYTHON_USE_UNICODE_INTERNALS 1 286 #endif 287 #undef CYTHON_USE_UNICODE_WRITER 288 #define CYTHON_USE_UNICODE_WRITER 0 289 #ifndef CYTHON_AVOID_BORROWED_REFS 290 #define CYTHON_AVOID_BORROWED_REFS 0 291 #endif 292 #ifndef CYTHON_ASSUME_SAFE_MACROS 293 #define CYTHON_ASSUME_SAFE_MACROS 1 294 #endif 295 #ifndef CYTHON_UNPACK_METHODS 296 #define CYTHON_UNPACK_METHODS 1 297 #endif 298 #undef CYTHON_FAST_THREAD_STATE 299 #define CYTHON_FAST_THREAD_STATE 0 300 #undef CYTHON_FAST_GIL 301 #define CYTHON_FAST_GIL 0 302 #ifndef CYTHON_METH_FASTCALL 303 #define CYTHON_METH_FASTCALL 1 304 #endif 305 #undef CYTHON_FAST_PYCALL 306 #define CYTHON_FAST_PYCALL 0 307 #ifndef CYTHON_PEP487_INIT_SUBCLASS 308 #define CYTHON_PEP487_INIT_SUBCLASS 1 309 #endif 310 #ifndef CYTHON_PEP489_MULTI_PHASE_INIT 311 #define CYTHON_PEP489_MULTI_PHASE_INIT 1 312 #endif 313 #ifndef CYTHON_USE_MODULE_STATE 314 #define CYTHON_USE_MODULE_STATE 0 315 #endif 316 #ifndef CYTHON_USE_TP_FINALIZE 317 #define CYTHON_USE_TP_FINALIZE 1 318 #endif 319 #undef CYTHON_USE_DICT_VERSIONS 320 #define CYTHON_USE_DICT_VERSIONS 0 321 #undef CYTHON_USE_EXC_INFO_STACK 322 #define CYTHON_USE_EXC_INFO_STACK 0 323 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC 324 #define CYTHON_UPDATE_DESCRIPTOR_DOC 1 325 #endif 326 #ifndef CYTHON_USE_FREELISTS 327 #define CYTHON_USE_FREELISTS 0 328 #endif 329#else 330 #define CYTHON_COMPILING_IN_PYPY 0 331 #define CYTHON_COMPILING_IN_CPYTHON 1 332 #define CYTHON_COMPILING_IN_LIMITED_API 0 333 #define CYTHON_COMPILING_IN_GRAAL 0 334 #define CYTHON_COMPILING_IN_NOGIL 0 335 #ifndef CYTHON_USE_TYPE_SLOTS 336 #define CYTHON_USE_TYPE_SLOTS 1 337 #endif 338 #ifndef CYTHON_USE_TYPE_SPECS 339 #define CYTHON_USE_TYPE_SPECS 0 340 #endif 341 #ifndef CYTHON_USE_PYTYPE_LOOKUP 342 #define CYTHON_USE_PYTYPE_LOOKUP 1 343 #endif 344 #if PY_MAJOR_VERSION < 3 345 #undef CYTHON_USE_ASYNC_SLOTS 346 #define CYTHON_USE_ASYNC_SLOTS 0 347 #elif !defined(CYTHON_USE_ASYNC_SLOTS) 348 #define CYTHON_USE_ASYNC_SLOTS 1 349 #endif 350 #ifndef CYTHON_USE_PYLONG_INTERNALS 351 #define CYTHON_USE_PYLONG_INTERNALS 1 352 #endif 353 #ifndef CYTHON_USE_PYLIST_INTERNALS 354 #define CYTHON_USE_PYLIST_INTERNALS 1 355 #endif 356 #ifndef CYTHON_USE_UNICODE_INTERNALS 357 #define CYTHON_USE_UNICODE_INTERNALS 1 358 #endif 359 #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2 360 #undef CYTHON_USE_UNICODE_WRITER 361 #define CYTHON_USE_UNICODE_WRITER 0 362 #elif !defined(CYTHON_USE_UNICODE_WRITER) 363 #define CYTHON_USE_UNICODE_WRITER 1 364 #endif 365 #ifndef CYTHON_AVOID_BORROWED_REFS 366 #define CYTHON_AVOID_BORROWED_REFS 0 367 #endif 368 #ifndef CYTHON_ASSUME_SAFE_MACROS 369 #define CYTHON_ASSUME_SAFE_MACROS 1 370 #endif 371 #ifndef CYTHON_UNPACK_METHODS 372 #define CYTHON_UNPACK_METHODS 1 373 #endif 374 #ifndef CYTHON_FAST_THREAD_STATE 375 #define CYTHON_FAST_THREAD_STATE 1 376 #endif 377 #ifndef CYTHON_FAST_GIL 378 #define CYTHON_FAST_GIL (PY_MAJOR_VERSION < 3 || PY_VERSION_HEX >= 0x03060000 && PY_VERSION_HEX < 0x030C00A6) 379 #endif 380 #ifndef CYTHON_METH_FASTCALL 381 #define CYTHON_METH_FASTCALL (PY_VERSION_HEX >= 0x030700A1) 382 #endif 383 #ifndef CYTHON_FAST_PYCALL 384 #define CYTHON_FAST_PYCALL 1 385 #endif 386 #ifndef CYTHON_PEP487_INIT_SUBCLASS 387 #define CYTHON_PEP487_INIT_SUBCLASS 1 388 #endif 389 #if PY_VERSION_HEX < 0x03050000 390 #undef CYTHON_PEP489_MULTI_PHASE_INIT 391 #define CYTHON_PEP489_MULTI_PHASE_INIT 0 392 #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) 393 #define CYTHON_PEP489_MULTI_PHASE_INIT 1 394 #endif 395 #ifndef CYTHON_USE_MODULE_STATE 396 #define CYTHON_USE_MODULE_STATE 0 397 #endif 398 #if PY_VERSION_HEX < 0x030400a1 399 #undef CYTHON_USE_TP_FINALIZE 400 #define CYTHON_USE_TP_FINALIZE 0 401 #elif !defined(CYTHON_USE_TP_FINALIZE) 402 #define CYTHON_USE_TP_FINALIZE 1 403 #endif 404 #if PY_VERSION_HEX < 0x030600B1 405 #undef CYTHON_USE_DICT_VERSIONS 406 #define CYTHON_USE_DICT_VERSIONS 0 407 #elif !defined(CYTHON_USE_DICT_VERSIONS) 408 #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX < 0x030C00A5) 409 #endif 410 #if PY_VERSION_HEX < 0x030700A3 411 #undef CYTHON_USE_EXC_INFO_STACK 412 #define CYTHON_USE_EXC_INFO_STACK 0 413 #elif !defined(CYTHON_USE_EXC_INFO_STACK) 414 #define CYTHON_USE_EXC_INFO_STACK 1 415 #endif 416 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC 417 #define CYTHON_UPDATE_DESCRIPTOR_DOC 1 418 #endif 419 #ifndef CYTHON_USE_FREELISTS 420 #define CYTHON_USE_FREELISTS 1 421 #endif 422#endif 423#if !defined(CYTHON_FAST_PYCCALL) 424#define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) 425#endif 426#if !defined(CYTHON_VECTORCALL) 427#define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL && PY_VERSION_HEX >= 0x030800B1) 428#endif 429#define CYTHON_BACKPORT_VECTORCALL (CYTHON_METH_FASTCALL && PY_VERSION_HEX < 0x030800B1) 430#if CYTHON_USE_PYLONG_INTERNALS 431 #if PY_MAJOR_VERSION < 3 432 #include "longintrepr.h" 433 #endif 434 #undef SHIFT 435 #undef BASE 436 #undef MASK 437 #ifdef SIZEOF_VOID_P 438 enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) }; 439 #endif 440#endif 441#ifndef __has_attribute 442 #define __has_attribute(x) 0 443#endif 444#ifndef __has_cpp_attribute 445 #define __has_cpp_attribute(x) 0 446#endif 447#ifndef CYTHON_RESTRICT 448 #if defined(__GNUC__) 449 #define CYTHON_RESTRICT __restrict__ 450 #elif defined(_MSC_VER) && _MSC_VER >= 1400 451 #define CYTHON_RESTRICT __restrict 452 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 453 #define CYTHON_RESTRICT restrict 454 #else 455 #define CYTHON_RESTRICT 456 #endif 457#endif 458#ifndef CYTHON_UNUSED 459 #if defined(__cplusplus) 460 /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17 461 * but leads to warnings with -pedantic, since it is a C++17 feature */ 462 #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) 463 #if __has_cpp_attribute(maybe_unused) 464 #define CYTHON_UNUSED [[maybe_unused]] 465 #endif 466 #endif 467 #endif 468#endif 469#ifndef CYTHON_UNUSED 470# if defined(__GNUC__) 471# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) 472# define CYTHON_UNUSED __attribute__ ((__unused__)) 473# else 474# define CYTHON_UNUSED 475# endif 476# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) 477# define CYTHON_UNUSED __attribute__ ((__unused__)) 478# else 479# define CYTHON_UNUSED 480# endif 481#endif 482#ifndef CYTHON_UNUSED_VAR 483# if defined(__cplusplus) 484 template<class T> void CYTHON_UNUSED_VAR( const T& ) { } 485# else 486# define CYTHON_UNUSED_VAR(x) (void)(x) 487# endif 488#endif 489#ifndef CYTHON_MAYBE_UNUSED_VAR 490 #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x) 491#endif 492#ifndef CYTHON_NCP_UNUSED 493# if CYTHON_COMPILING_IN_CPYTHON 494# define CYTHON_NCP_UNUSED 495# else 496# define CYTHON_NCP_UNUSED CYTHON_UNUSED 497# endif 498#endif 499#ifndef CYTHON_USE_CPP_STD_MOVE 500 #if defined(__cplusplus) && (\ 501 __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600)) 502 #define CYTHON_USE_CPP_STD_MOVE 1 503 #else 504 #define CYTHON_USE_CPP_STD_MOVE 0 505 #endif 506#endif 507#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) 508#ifdef _MSC_VER 509 #ifndef _MSC_STDINT_H_ 510 #if _MSC_VER < 1300 511 typedef unsigned char uint8_t; 512 typedef unsigned short uint16_t; 513 typedef unsigned int uint32_t; 514 #else 515 typedef unsigned __int8 uint8_t; 516 typedef unsigned __int16 uint16_t; 517 typedef unsigned __int32 uint32_t; 518 #endif 519 #endif 520 #if _MSC_VER < 1300 521 #ifdef _WIN64 522 typedef unsigned long long __pyx_uintptr_t; 523 #else 524 typedef unsigned int __pyx_uintptr_t; 525 #endif 526 #else 527 #ifdef _WIN64 528 typedef unsigned __int64 __pyx_uintptr_t; 529 #else 530 typedef unsigned __int32 __pyx_uintptr_t; 531 #endif 532 #endif 533#else 534 #include <stdint.h> 535 typedef uintptr_t __pyx_uintptr_t; 536#endif 537#ifndef CYTHON_FALLTHROUGH 538 #if defined(__cplusplus) 539 /* for clang __has_cpp_attribute(fallthrough) is true even before C++17 540 * but leads to warnings with -pedantic, since it is a C++17 feature */ 541 #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) 542 #if __has_cpp_attribute(fallthrough) 543 #define CYTHON_FALLTHROUGH [[fallthrough]] 544 #endif 545 #endif 546 #ifndef CYTHON_FALLTHROUGH 547 #if __has_cpp_attribute(clang::fallthrough) 548 #define CYTHON_FALLTHROUGH [[clang::fallthrough]] 549 #elif __has_cpp_attribute(gnu::fallthrough) 550 #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] 551 #endif 552 #endif 553 #endif 554 #ifndef CYTHON_FALLTHROUGH 555 #if __has_attribute(fallthrough) 556 #define CYTHON_FALLTHROUGH __attribute__((fallthrough)) 557 #else 558 #define CYTHON_FALLTHROUGH 559 #endif 560 #endif 561 #if defined(__clang__) && defined(__apple_build_version__) 562 #if __apple_build_version__ < 7000000 563 #undef CYTHON_FALLTHROUGH 564 #define CYTHON_FALLTHROUGH 565 #endif 566 #endif 567#endif 568#ifdef __cplusplus 569 template <typename T> 570 struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);}; 571 #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL<type>::value) 572#else 573 #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0) 574#endif 575#if CYTHON_COMPILING_IN_PYPY == 1 576 #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x030A0000) 577#else 578 #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000) 579#endif 580#define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer)) 581 582#ifndef CYTHON_INLINE 583 #if defined(__clang__) 584 #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) 585 #elif defined(__GNUC__) 586 #define CYTHON_INLINE __inline__ 587 #elif defined(_MSC_VER) 588 #define CYTHON_INLINE __inline 589 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 590 #define CYTHON_INLINE inline 591 #else 592 #define CYTHON_INLINE 593 #endif 594#endif 595 596#define __PYX_BUILD_PY_SSIZE_T "n" 597#define CYTHON_FORMAT_SSIZE_T "z" 598#if PY_MAJOR_VERSION < 3 599 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" 600 #define __Pyx_DefaultClassType PyClass_Type 601 #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ 602 PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) 603#else 604 #define __Pyx_BUILTIN_MODULE_NAME "builtins" 605 #define __Pyx_DefaultClassType PyType_Type 606#if CYTHON_COMPILING_IN_LIMITED_API 607 static CYTHON_INLINE PyObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f, 608 PyObject *code, PyObject *c, PyObject* n, PyObject *v, 609 PyObject *fv, PyObject *cell, PyObject* fn, 610 PyObject *name, int fline, PyObject *lnos) { 611 PyObject *exception_table = NULL; 612 PyObject *types_module=NULL, *code_type=NULL, *result=NULL; 613 #if __PYX_LIMITED_VERSION_HEX < 0x030B0000 614 PyObject *version_info; 615 PyObject *py_minor_version = NULL; 616 #endif 617 long minor_version = 0; 618 PyObject *type, *value, *traceback; 619 PyErr_Fetch(&type, &value, &traceback); 620 #if __PYX_LIMITED_VERSION_HEX >= 0x030B0000 621 minor_version = 11; 622 #else 623 if (!(version_info = PySys_GetObject("version_info"))) goto end; 624 if (!(py_minor_version = PySequence_GetItem(version_info, 1))) goto end; 625 minor_version = PyLong_AsLong(py_minor_version); 626 Py_DECREF(py_minor_version); 627 if (minor_version == -1 && PyErr_Occurred()) goto end; 628 #endif 629 if (!(types_module = PyImport_ImportModule("types"))) goto end; 630 if (!(code_type = PyObject_GetAttrString(types_module, "CodeType"))) goto end; 631 if (minor_version <= 7) { 632 (void)p; 633 result = PyObject_CallFunction(code_type, "iiiiiOOOOOOiOO", a, k, l, s, f, code, 634 c, n, v, fn, name, fline, lnos, fv, cell); 635 } else if (minor_version <= 10) { 636 result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOiOO", a,p, k, l, s, f, code, 637 c, n, v, fn, name, fline, lnos, fv, cell); 638 } else { 639 if (!(exception_table = PyBytes_FromStringAndSize(NULL, 0))) goto end; 640 result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOOiOO", a,p, k, l, s, f, code, 641 c, n, v, fn, name, name, fline, lnos, exception_table, fv, cell); 642 } 643 end: 644 Py_XDECREF(code_type); 645 Py_XDECREF(exception_table); 646 Py_XDECREF(types_module); 647 if (type) { 648 PyErr_Restore(type, value, traceback); 649 } 650 return result; 651 } 652 #ifndef CO_OPTIMIZED 653 #define CO_OPTIMIZED 0x0001 654 #endif 655 #ifndef CO_NEWLOCALS 656 #define CO_NEWLOCALS 0x0002 657 #endif 658 #ifndef CO_VARARGS 659 #define CO_VARARGS 0x0004 660 #endif 661 #ifndef CO_VARKEYWORDS 662 #define CO_VARKEYWORDS 0x0008 663 #endif 664 #ifndef CO_ASYNC_GENERATOR 665 #define CO_ASYNC_GENERATOR 0x0200 666 #endif 667 #ifndef CO_GENERATOR 668 #define CO_GENERATOR 0x0020 669 #endif 670 #ifndef CO_COROUTINE 671 #define CO_COROUTINE 0x0080 672 #endif 673#elif PY_VERSION_HEX >= 0x030B0000 674 static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f, 675 PyObject *code, PyObject *c, PyObject* n, PyObject *v, 676 PyObject *fv, PyObject *cell, PyObject* fn, 677 PyObject *name, int fline, PyObject *lnos) { 678 PyCodeObject *result; 679 PyObject *empty_bytes = PyBytes_FromStringAndSize("", 0); 680 if (!empty_bytes) return NULL; 681 result = 682 #if PY_VERSION_HEX >= 0x030C0000 683 PyUnstable_Code_NewWithPosOnlyArgs 684 #else 685 PyCode_NewWithPosOnlyArgs 686 #endif 687 (a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, name, fline, lnos, empty_bytes); 688 Py_DECREF(empty_bytes); 689 return result; 690 } 691#elif PY_VERSION_HEX >= 0x030800B2 && !CYTHON_COMPILING_IN_PYPY 692 #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ 693 PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) 694#else 695 #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ 696 PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) 697#endif 698#endif 699#if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE) 700 #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type) 701#else 702 #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type)) 703#endif 704#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is) 705 #define __Pyx_Py_Is(x, y) Py_Is(x, y) 706#else 707 #define __Pyx_Py_Is(x, y) ((x) == (y)) 708#endif 709#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone) 710 #define __Pyx_Py_IsNone(ob) Py_IsNone(ob) 711#else 712 #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None) 713#endif 714#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue) 715 #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob) 716#else 717 #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True) 718#endif 719#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse) 720 #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob) 721#else 722 #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False) 723#endif 724#define __Pyx_NoneAsNull(obj) (__Pyx_Py_IsNone(obj) ? NULL : (obj)) 725#if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY 726 #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o) 727#else 728 #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o) 729#endif 730#ifndef CO_COROUTINE 731 #define CO_COROUTINE 0x80 732#endif 733#ifndef CO_ASYNC_GENERATOR 734 #define CO_ASYNC_GENERATOR 0x200 735#endif 736#ifndef Py_TPFLAGS_CHECKTYPES 737 #define Py_TPFLAGS_CHECKTYPES 0 738#endif 739#ifndef Py_TPFLAGS_HAVE_INDEX 740 #define Py_TPFLAGS_HAVE_INDEX 0 741#endif 742#ifndef Py_TPFLAGS_HAVE_NEWBUFFER 743 #define Py_TPFLAGS_HAVE_NEWBUFFER 0 744#endif 745#ifndef Py_TPFLAGS_HAVE_FINALIZE 746 #define Py_TPFLAGS_HAVE_FINALIZE 0 747#endif 748#ifndef Py_TPFLAGS_SEQUENCE 749 #define Py_TPFLAGS_SEQUENCE 0 750#endif 751#ifndef Py_TPFLAGS_MAPPING 752 #define Py_TPFLAGS_MAPPING 0 753#endif 754#ifndef METH_STACKLESS 755 #define METH_STACKLESS 0 756#endif 757#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL) 758 #ifndef METH_FASTCALL 759 #define METH_FASTCALL 0x80 760 #endif 761 typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs); 762 typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args, 763 Py_ssize_t nargs, PyObject *kwnames); 764#else 765 #if PY_VERSION_HEX >= 0x030d00A4 766 # define __Pyx_PyCFunctionFast PyCFunctionFast 767 # define __Pyx_PyCFunctionFastWithKeywords PyCFunctionFastWithKeywords 768 #else 769 # define __Pyx_PyCFunctionFast _PyCFunctionFast 770 # define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords 771 #endif 772#endif 773#if CYTHON_METH_FASTCALL 774 #define __Pyx_METH_FASTCALL METH_FASTCALL 775 #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast 776 #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords 777#else 778 #define __Pyx_METH_FASTCALL METH_VARARGS 779 #define __Pyx_PyCFunction_FastCall PyCFunction 780 #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords 781#endif 782#if CYTHON_VECTORCALL 783 #define __pyx_vectorcallfunc vectorcallfunc 784 #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET 785 #define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n)) 786#elif CYTHON_BACKPORT_VECTORCALL 787 typedef PyObject *(*__pyx_vectorcallfunc)(PyObject *callable, PyObject *const *args, 788 size_t nargsf, PyObject *kwnames); 789 #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET ((size_t)1 << (8 * sizeof(size_t) - 1)) 790 #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(((size_t)(n)) & ~__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)) 791#else 792 #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0 793 #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n)) 794#endif 795#if PY_MAJOR_VERSION >= 0x030900B1 796#define __Pyx_PyCFunction_CheckExact(func) PyCFunction_CheckExact(func) 797#else 798#define __Pyx_PyCFunction_CheckExact(func) PyCFunction_Check(func) 799#endif 800#define __Pyx_CyOrPyCFunction_Check(func) PyCFunction_Check(func) 801#if CYTHON_COMPILING_IN_CPYTHON 802#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) (((PyCFunctionObject*)(func))->m_ml->ml_meth) 803#elif !CYTHON_COMPILING_IN_LIMITED_API 804#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) PyCFunction_GET_FUNCTION(func) 805#endif 806#if CYTHON_COMPILING_IN_CPYTHON 807#define __Pyx_CyOrPyCFunction_GET_FLAGS(func) (((PyCFunctionObject*)(func))->m_ml->ml_flags) 808static CYTHON_INLINE PyObject* __Pyx_CyOrPyCFunction_GET_SELF(PyObject *func) { 809 return (__Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_STATIC) ? NULL : ((PyCFunctionObject*)func)->m_self; 810} 811#endif 812static CYTHON_INLINE int __Pyx__IsSameCFunction(PyObject *func, void *cfunc) { 813#if CYTHON_COMPILING_IN_LIMITED_API 814 return PyCFunction_Check(func) && PyCFunction_GetFunction(func) == (PyCFunction) cfunc; 815#else 816 return PyCFunction_Check(func) && PyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc; 817#endif 818} 819#define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCFunction(func, cfunc) 820#if __PYX_LIMITED_VERSION_HEX < 0x030900B1 821 #define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b)) 822 typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *); 823#else 824 #define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b) 825 #define __Pyx_PyCMethod PyCMethod 826#endif 827#ifndef METH_METHOD 828 #define METH_METHOD 0x200 829#endif 830#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) 831 #define PyObject_Malloc(s) PyMem_Malloc(s) 832 #define PyObject_Free(p) PyMem_Free(p) 833 #define PyObject_Realloc(p) PyMem_Realloc(p) 834#endif 835#if CYTHON_COMPILING_IN_LIMITED_API 836 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) 837 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) 838#else 839 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) 840 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) 841#endif 842#if CYTHON_COMPILING_IN_LIMITED_API 843 #define __Pyx_PyThreadState_Current PyThreadState_Get() 844#elif !CYTHON_FAST_THREAD_STATE 845 #define __Pyx_PyThreadState_Current PyThreadState_GET() 846#elif PY_VERSION_HEX >= 0x030d00A1 847 #define __Pyx_PyThreadState_Current PyThreadState_GetUnchecked() 848#elif PY_VERSION_HEX >= 0x03060000 849 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() 850#elif PY_VERSION_HEX >= 0x03000000 851 #define __Pyx_PyThreadState_Current PyThreadState_GET() 852#else 853 #define __Pyx_PyThreadState_Current _PyThreadState_Current 854#endif 855#if CYTHON_COMPILING_IN_LIMITED_API 856static CYTHON_INLINE void *__Pyx_PyModule_GetState(PyObject *op) 857{ 858 void *result; 859 result = PyModule_GetState(op); 860 if (!result) 861 Py_FatalError("Couldn't find the module state"); 862 return result; 863} 864#endif 865#define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE(obj), name, func_ctype) 866#if CYTHON_COMPILING_IN_LIMITED_API 867 #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name)) 868#else 869 #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name) 870#endif 871#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT) 872#include "pythread.h" 873#define Py_tss_NEEDS_INIT 0 874typedef int Py_tss_t; 875static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) { 876 *key = PyThread_create_key(); 877 return 0; 878} 879static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) { 880 Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t)); 881 *key = Py_tss_NEEDS_INIT; 882 return key; 883} 884static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) { 885 PyObject_Free(key); 886} 887static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) { 888 return *key != Py_tss_NEEDS_INIT; 889} 890static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) { 891 PyThread_delete_key(*key); 892 *key = Py_tss_NEEDS_INIT; 893} 894static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) { 895 return PyThread_set_key_value(*key, value); 896} 897static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { 898 return PyThread_get_key_value(*key); 899} 900#endif 901#if PY_MAJOR_VERSION < 3 902 #if CYTHON_COMPILING_IN_PYPY 903 #if PYPY_VERSION_NUM < 0x07030600 904 #if defined(__cplusplus) && __cplusplus >= 201402L 905 [[deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")]] 906 #elif defined(__GNUC__) || defined(__clang__) 907 __attribute__ ((__deprecated__("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6"))) 908 #elif defined(_MSC_VER) 909 __declspec(deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")) 910 #endif 911 static CYTHON_INLINE int PyGILState_Check(void) { 912 return 0; 913 } 914 #else // PYPY_VERSION_NUM < 0x07030600 915 #endif // PYPY_VERSION_NUM < 0x07030600 916 #else 917 static CYTHON_INLINE int PyGILState_Check(void) { 918 PyThreadState * tstate = _PyThreadState_Current; 919 return tstate && (tstate == PyGILState_GetThisThreadState()); 920 } 921 #endif 922#endif 923#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000 || defined(_PyDict_NewPresized) 924#define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) 925#else 926#define __Pyx_PyDict_NewPresized(n) PyDict_New() 927#endif 928#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION 929 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) 930 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) 931#else 932 #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) 933 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) 934#endif 935#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030600B4 && PY_VERSION_HEX < 0x030d0000 && CYTHON_USE_UNICODE_INTERNALS 936#define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) 937static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) { 938 PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name); 939 if (res == NULL) PyErr_Clear(); 940 return res; 941} 942#elif PY_MAJOR_VERSION >= 3 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000) 943#define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError 944#define __Pyx_PyDict_GetItemStr PyDict_GetItem 945#else 946static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) { 947#if CYTHON_COMPILING_IN_PYPY 948 return PyDict_GetItem(dict, name); 949#else 950 PyDictEntry *ep; 951 PyDictObject *mp = (PyDictObject*) dict; 952 long hash = ((PyStringObject *) name)->ob_shash; 953 assert(hash != -1); 954 ep = (mp->ma_lookup)(mp, name, hash); 955 if (ep == NULL) { 956 return NULL; 957 } 958 return ep->me_value; 959#endif 960} 961#define __Pyx_PyDict_GetItemStr PyDict_GetItem 962#endif 963#if CYTHON_USE_TYPE_SLOTS 964 #define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags) 965 #define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0) 966 #define __Pyx_PyObject_GetIterNextFunc(obj) (Py_TYPE(obj)->tp_iternext) 967#else 968 #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp)) 969 #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature) 970 #define __Pyx_PyObject_GetIterNextFunc(obj) PyIter_Next 971#endif 972#if CYTHON_COMPILING_IN_LIMITED_API 973 #define __Pyx_SetItemOnTypeDict(tp, k, v) PyObject_GenericSetAttr((PyObject*)tp, k, v) 974#else 975 #define __Pyx_SetItemOnTypeDict(tp, k, v) PyDict_SetItem(tp->tp_dict, k, v) 976#endif 977#if CYTHON_USE_TYPE_SPECS && PY_VERSION_HEX >= 0x03080000 978#define __Pyx_PyHeapTypeObject_GC_Del(obj) {\ 979 PyTypeObject *type = Py_TYPE((PyObject*)obj);\ 980 assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\ 981 PyObject_GC_Del(obj);\ 982 Py_DECREF(type);\ 983} 984#else 985#define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj) 986#endif 987#if CYTHON_COMPILING_IN_LIMITED_API 988 #define CYTHON_PEP393_ENABLED 1 989 #define __Pyx_PyUnicode_READY(op) (0) 990 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GetLength(u) 991 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i) 992 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111U) 993 #define __Pyx_PyUnicode_KIND(u) ((void)u, (0)) 994 #define __Pyx_PyUnicode_DATA(u) ((void*)u) 995 #define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i)) 996 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u)) 997#elif PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) 998 #define CYTHON_PEP393_ENABLED 1 999 #if PY_VERSION_HEX >= 0x030C0000 1000 #define __Pyx_PyUnicode_READY(op) (0) 1001 #else 1002 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ 1003 0 : _PyUnicode_Ready((PyObject *)(op))) 1004 #endif 1005 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) 1006 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) 1007 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) 1008 #define __Pyx_PyUnicode_KIND(u) ((int)PyUnicode_KIND(u)) 1009 #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) 1010 #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) 1011 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, (Py_UCS4) ch) 1012 #if PY_VERSION_HEX >= 0x030C0000 1013 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) 1014 #else 1015 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000 1016 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length)) 1017 #else 1018 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) 1019 #endif 1020 #endif 1021#else 1022 #define CYTHON_PEP393_ENABLED 0 1023 #define PyUnicode_1BYTE_KIND 1 1024 #define PyUnicode_2BYTE_KIND 2 1025 #define PyUnicode_4BYTE_KIND 4 1026 #define __Pyx_PyUnicode_READY(op) (0) 1027 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) 1028 #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) 1029 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535U : 1114111U) 1030 #define __Pyx_PyUnicode_KIND(u) ((int)sizeof(Py_UNICODE)) 1031 #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) 1032 #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) 1033 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = (Py_UNICODE) ch) 1034 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) 1035#endif 1036#if CYTHON_COMPILING_IN_PYPY 1037 #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) 1038 #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) 1039#else 1040 #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) 1041 #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ 1042 PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) 1043#endif 1044#if CYTHON_COMPILING_IN_PYPY 1045 #if !defined(PyUnicode_DecodeUnicodeEscape) 1046 #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors) 1047 #endif 1048 #if !defined(PyUnicode_Contains) || (PY_MAJOR_VERSION == 2 && PYPY_VERSION_NUM < 0x07030500) 1049 #undef PyUnicode_Contains 1050 #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) 1051 #endif 1052 #if !defined(PyByteArray_Check) 1053 #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) 1054 #endif 1055 #if !defined(PyObject_Format) 1056 #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) 1057 #endif 1058#endif 1059#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)) 1060#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) 1061#if PY_MAJOR_VERSION >= 3 1062 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) 1063#else 1064 #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) 1065#endif 1066#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII) 1067 #define PyObject_ASCII(o) PyObject_Repr(o) 1068#endif 1069#if PY_MAJOR_VERSION >= 3 1070 #define PyBaseString_Type PyUnicode_Type 1071 #define PyStringObject PyUnicodeObject 1072 #define PyString_Type PyUnicode_Type 1073 #define PyString_Check PyUnicode_Check 1074 #define PyString_CheckExact PyUnicode_CheckExact 1075#ifndef PyObject_Unicode 1076 #define PyObject_Unicode PyObject_Str 1077#endif 1078#endif 1079#if PY_MAJOR_VERSION >= 3 1080 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) 1081 #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) 1082#else 1083 #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) 1084 #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) 1085#endif 1086#if CYTHON_COMPILING_IN_CPYTHON 1087 #define __Pyx_PySequence_ListKeepNew(obj)\ 1088 (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj)) 1089#else 1090 #define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj) 1091#endif 1092#ifndef PySet_CheckExact 1093 #define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type) 1094#endif 1095#if PY_VERSION_HEX >= 0x030900A4 1096 #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt) 1097 #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size) 1098#else 1099 #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt) 1100 #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size) 1101#endif 1102#if CYTHON_ASSUME_SAFE_MACROS 1103 #define __Pyx_PySequence_ITEM(o, i) PySequence_ITEM(o, i) 1104 #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) 1105 #define __Pyx_PyTuple_SET_ITEM(o, i, v) (PyTuple_SET_ITEM(o, i, v), (0)) 1106 #define __Pyx_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0)) 1107 #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_GET_SIZE(o) 1108 #define __Pyx_PyList_GET_SIZE(o) PyList_GET_SIZE(o) 1109 #define __Pyx_PySet_GET_SIZE(o) PySet_GET_SIZE(o) 1110 #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_GET_SIZE(o) 1111 #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_GET_SIZE(o) 1112#else 1113 #define __Pyx_PySequence_ITEM(o, i) PySequence_GetItem(o, i) 1114 #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq) 1115 #define __Pyx_PyTuple_SET_ITEM(o, i, v) PyTuple_SetItem(o, i, v) 1116 #define __Pyx_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v) 1117 #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_Size(o) 1118 #define __Pyx_PyList_GET_SIZE(o) PyList_Size(o) 1119 #define __Pyx_PySet_GET_SIZE(o) PySet_Size(o) 1120 #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_Size(o) 1121 #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_Size(o) 1122#endif 1123#if __PYX_LIMITED_VERSION_HEX >= 0x030d00A1 1124 #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name) 1125#else 1126 static CYTHON_INLINE PyObject *__Pyx_PyImport_AddModuleRef(const char *name) { 1127 PyObject *module = PyImport_AddModule(name); 1128 Py_XINCREF(module); 1129 return module; 1130 } 1131#endif 1132#if PY_MAJOR_VERSION >= 3 1133 #define PyIntObject PyLongObject 1134 #define PyInt_Type PyLong_Type 1135 #define PyInt_Check(op) PyLong_Check(op) 1136 #define PyInt_CheckExact(op) PyLong_CheckExact(op) 1137 #define __Pyx_Py3Int_Check(op) PyLong_Check(op) 1138 #define __Pyx_Py3Int_CheckExact(op) PyLong_CheckExact(op) 1139 #define PyInt_FromString PyLong_FromString 1140 #define PyInt_FromUnicode PyLong_FromUnicode 1141 #define PyInt_FromLong PyLong_FromLong 1142 #define PyInt_FromSize_t PyLong_FromSize_t 1143 #define PyInt_FromSsize_t PyLong_FromSsize_t 1144 #define PyInt_AsLong PyLong_AsLong 1145 #define PyInt_AS_LONG PyLong_AS_LONG 1146 #define PyInt_AsSsize_t PyLong_AsSsize_t 1147 #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask 1148 #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask 1149 #define PyNumber_Int PyNumber_Long 1150#else 1151 #define __Pyx_Py3Int_Check(op) (PyLong_Check(op) || PyInt_Check(op)) 1152 #define __Pyx_Py3Int_CheckExact(op) (PyLong_CheckExact(op) || PyInt_CheckExact(op)) 1153#endif 1154#if PY_MAJOR_VERSION >= 3 1155 #define PyBoolObject PyLongObject 1156#endif 1157#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY 1158 #ifndef PyUnicode_InternFromString 1159 #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) 1160 #endif 1161#endif 1162#if PY_VERSION_HEX < 0x030200A4 1163 typedef long Py_hash_t; 1164 #define __Pyx_PyInt_FromHash_t PyInt_FromLong 1165 #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t 1166#else 1167 #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t 1168 #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t 1169#endif 1170#if CYTHON_USE_ASYNC_SLOTS 1171 #if PY_VERSION_HEX >= 0x030500B1 1172 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods 1173 #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) 1174 #else 1175 #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) 1176 #endif 1177#else 1178 #define __Pyx_PyType_AsAsync(obj) NULL 1179#endif 1180#ifndef __Pyx_PyAsyncMethodsStruct 1181 typedef struct { 1182 unaryfunc am_await; 1183 unaryfunc am_aiter; 1184 unaryfunc am_anext; 1185 } __Pyx_PyAsyncMethodsStruct; 1186#endif 1187 1188#if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS) 1189 #if !defined(_USE_MATH_DEFINES) 1190 #define _USE_MATH_DEFINES 1191 #endif 1192#endif 1193#include <math.h> 1194#ifdef NAN 1195#define __PYX_NAN() ((float) NAN) 1196#else 1197static CYTHON_INLINE float __PYX_NAN() { 1198 float value; 1199 memset(&value, 0xFF, sizeof(value)); 1200 return value; 1201} 1202#endif 1203#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) 1204#define __Pyx_truncl trunc 1205#else 1206#define __Pyx_truncl truncl 1207#endif 1208 1209#define __PYX_MARK_ERR_POS(f_index, lineno) \ 1210 { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; } 1211#define __PYX_ERR(f_index, lineno, Ln_error) \ 1212 { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; } 1213 1214#ifdef CYTHON_EXTERN_C 1215 #undef __PYX_EXTERN_C 1216 #define __PYX_EXTERN_C CYTHON_EXTERN_C 1217#elif defined(__PYX_EXTERN_C) 1218 #ifdef _MSC_VER 1219 #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.") 1220 #else 1221 #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead. 1222 #endif 1223#else 1224 #ifdef __cplusplus 1225 #define __PYX_EXTERN_C extern "C" 1226 #else 1227 #define __PYX_EXTERN_C extern 1228 #endif 1229#endif 1230 1231#define __PYX_HAVE__search 1232#define __PYX_HAVE_API__search 1233/* Early includes */ 1234#ifdef _OPENMP 1235#include <omp.h> 1236#endif /* _OPENMP */ 1237 1238#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS) 1239#define CYTHON_WITHOUT_ASSERTIONS 1240#endif 1241 1242typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding; 1243 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; 1244 1245#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 1246#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0 1247#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8) 1248#define __PYX_DEFAULT_STRING_ENCODING "" 1249#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString 1250#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize 1251#define __Pyx_uchar_cast(c) ((unsigned char)c) 1252#define __Pyx_long_cast(x) ((long)x) 1253#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ 1254 (sizeof(type) < sizeof(Py_ssize_t)) ||\ 1255 (sizeof(type) > sizeof(Py_ssize_t) &&\ 1256 likely(v < (type)PY_SSIZE_T_MAX ||\ 1257 v == (type)PY_SSIZE_T_MAX) &&\ 1258 (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ 1259 v == (type)PY_SSIZE_T_MIN))) ||\ 1260 (sizeof(type) == sizeof(Py_ssize_t) &&\ 1261 (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ 1262 v == (type)PY_SSIZE_T_MAX))) ) 1263static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) { 1264 return (size_t) i < (size_t) limit; 1265} 1266#if defined (__cplusplus) && __cplusplus >= 201103L 1267 #include <cstdlib> 1268 #define __Pyx_sst_abs(value) std::abs(value) 1269#elif SIZEOF_INT >= SIZEOF_SIZE_T 1270 #define __Pyx_sst_abs(value) abs(value) 1271#elif SIZEOF_LONG >= SIZEOF_SIZE_T 1272 #define __Pyx_sst_abs(value) labs(value) 1273#elif defined (_MSC_VER) 1274 #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value)) 1275#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 1276 #define __Pyx_sst_abs(value) llabs(value) 1277#elif defined (__GNUC__) 1278 #define __Pyx_sst_abs(value) __builtin_llabs(value) 1279#else 1280 #define __Pyx_sst_abs(value) ((value<0) ? -value : value) 1281#endif 1282static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s); 1283static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*); 1284static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); 1285static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char*); 1286#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) 1287#define __Pyx_PyBytes_FromString PyBytes_FromString 1288#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize 1289static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); 1290#if PY_MAJOR_VERSION < 3 1291 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString 1292 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize 1293#else 1294 #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString 1295 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize 1296#endif 1297#define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s)) 1298#define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s)) 1299#define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s)) 1300#define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) 1301#define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) 1302#define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) 1303#define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) 1304#define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) 1305#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) 1306#define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) 1307#define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) 1308#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) 1309#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) 1310#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) 1311#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) 1312#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) 1313#define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o) 1314#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode 1315#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) 1316#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) 1317static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b); 1318static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); 1319static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*); 1320static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); 1321#define __Pyx_PySequence_Tuple(obj)\ 1322 (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) 1323static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); 1324static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); 1325static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); 1326#if CYTHON_ASSUME_SAFE_MACROS 1327#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) 1328#else 1329#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) 1330#endif 1331#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) 1332#if PY_MAJOR_VERSION >= 3 1333#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) 1334#else 1335#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) 1336#endif 1337#if CYTHON_USE_PYLONG_INTERNALS 1338 #if PY_VERSION_HEX >= 0x030C00A7 1339 #ifndef _PyLong_SIGN_MASK 1340 #define _PyLong_SIGN_MASK 3 1341 #endif 1342 #ifndef _PyLong_NON_SIZE_BITS 1343 #define _PyLong_NON_SIZE_BITS 3 1344 #endif 1345 #define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK) 1346 #define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0) 1347 #define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x)) 1348 #define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1) 1349 #define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0) 1350 #define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0]) 1351 #define __Pyx_PyLong_DigitCount(x) ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS)) 1352 #define __Pyx_PyLong_SignedDigitCount(x)\ 1353 ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x)) 1354 #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue) 1355 #define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x) 1356 #define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x) 1357 #else 1358 #define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS)) 1359 #define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0]) 1360 #endif 1361 typedef Py_ssize_t __Pyx_compact_pylong; 1362 typedef size_t __Pyx_compact_upylong; 1363 #else 1364 #define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0) 1365 #define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0) 1366 #define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0) 1367 #define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0) 1368 #define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0]) 1369 #define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x)) 1370 #define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x) 1371 #define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1) 1372 #define __Pyx_PyLong_CompactValue(x)\ 1373 ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0])) 1374 typedef sdigit __Pyx_compact_pylong; 1375 typedef digit __Pyx_compact_upylong; 1376 #endif 1377 #if PY_VERSION_HEX >= 0x030C00A5 1378 #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit) 1379 #else 1380 #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit) 1381 #endif 1382#endif 1383#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 1384#include <string.h> 1385static int __Pyx_sys_getdefaultencoding_not_ascii; 1386static int __Pyx_init_sys_getdefaultencoding_params(void) { 1387 PyObject* sys; 1388 PyObject* default_encoding = NULL; 1389 PyObject* ascii_chars_u = NULL; 1390 PyObject* ascii_chars_b = NULL; 1391 const char* default_encoding_c; 1392 sys = PyImport_ImportModule("sys"); 1393 if (!sys) goto bad; 1394 default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL); 1395 Py_DECREF(sys); 1396 if (!default_encoding) goto bad; 1397 default_encoding_c = PyBytes_AsString(default_encoding); 1398 if (!default_encoding_c) goto bad; 1399 if (strcmp(default_encoding_c, "ascii") == 0) { 1400 __Pyx_sys_getdefaultencoding_not_ascii = 0; 1401 } else { 1402 char ascii_chars[128]; 1403 int c; 1404 for (c = 0; c < 128; c++) { 1405 ascii_chars[c] = (char) c; 1406 } 1407 __Pyx_sys_getdefaultencoding_not_ascii = 1; 1408 ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); 1409 if (!ascii_chars_u) goto bad; 1410 ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); 1411 if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { 1412 PyErr_Format( 1413 PyExc_ValueError, 1414 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.", 1415 default_encoding_c); 1416 goto bad; 1417 } 1418 Py_DECREF(ascii_chars_u); 1419 Py_DECREF(ascii_chars_b); 1420 } 1421 Py_DECREF(default_encoding); 1422 return 0; 1423bad: 1424 Py_XDECREF(default_encoding); 1425 Py_XDECREF(ascii_chars_u); 1426 Py_XDECREF(ascii_chars_b); 1427 return -1; 1428} 1429#endif 1430#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 1431#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) 1432#else 1433#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) 1434#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 1435#include <string.h> 1436static char* __PYX_DEFAULT_STRING_ENCODING; 1437static int __Pyx_init_sys_getdefaultencoding_params(void) { 1438 PyObject* sys; 1439 PyObject* default_encoding = NULL; 1440 char* default_encoding_c; 1441 sys = PyImport_ImportModule("sys"); 1442 if (!sys) goto bad; 1443 default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); 1444 Py_DECREF(sys); 1445 if (!default_encoding) goto bad; 1446 default_encoding_c = PyBytes_AsString(default_encoding); 1447 if (!default_encoding_c) goto bad; 1448 __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1); 1449 if (!__PYX_DEFAULT_STRING_ENCODING) goto bad; 1450 strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); 1451 Py_DECREF(default_encoding); 1452 return 0; 1453bad: 1454 Py_XDECREF(default_encoding); 1455 return -1; 1456} 1457#endif 1458#endif 1459 1460 1461/* Test for GCC > 2.95 */ 1462#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) 1463 #define likely(x) __builtin_expect(!!(x), 1) 1464 #define unlikely(x) __builtin_expect(!!(x), 0) 1465#else /* !__GNUC__ or GCC < 2.95 */ 1466 #define likely(x) (x) 1467 #define unlikely(x) (x) 1468#endif /* __GNUC__ */ 1469static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } 1470 1471#if !CYTHON_USE_MODULE_STATE 1472static PyObject *__pyx_m = NULL; 1473#endif 1474static int __pyx_lineno; 1475static int __pyx_clineno = 0; 1476static const char * __pyx_cfilenm = __FILE__; 1477static const char *__pyx_filename; 1478 1479/* #### Code section: filename_table ### */ 1480 1481static const char *__pyx_f[] = { 1482 "search.pyx", 1483}; 1484/* #### Code section: utility_code_proto_before_types ### */ 1485/* ForceInitThreads.proto */ 1486#ifndef __PYX_FORCE_INIT_THREADS 1487 #define __PYX_FORCE_INIT_THREADS 0 1488#endif 1489 1490/* #### Code section: numeric_typedefs ### */ 1491/* #### Code section: complex_type_declarations ### */ 1492/* #### Code section: type_declarations ### */ 1493 1494/*--- Type declarations ---*/ 1495/* #### Code section: utility_code_proto ### */ 1496 1497/* --- Runtime support code (head) --- */ 1498/* Refnanny.proto */ 1499#ifndef CYTHON_REFNANNY 1500 #define CYTHON_REFNANNY 0 1501#endif 1502#if CYTHON_REFNANNY 1503 typedef struct { 1504 void (*INCREF)(void*, PyObject*, Py_ssize_t); 1505 void (*DECREF)(void*, PyObject*, Py_ssize_t); 1506 void (*GOTREF)(void*, PyObject*, Py_ssize_t); 1507 void (*GIVEREF)(void*, PyObject*, Py_ssize_t); 1508 void* (*SetupContext)(const char*, Py_ssize_t, const char*); 1509 void (*FinishContext)(void**); 1510 } __Pyx_RefNannyAPIStruct; 1511 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; 1512 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); 1513 #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; 1514#ifdef WITH_THREAD 1515 #define __Pyx_RefNannySetupContext(name, acquire_gil)\ 1516 if (acquire_gil) {\ 1517 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ 1518 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ 1519 PyGILState_Release(__pyx_gilstate_save);\ 1520 } else {\ 1521 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ 1522 } 1523 #define __Pyx_RefNannyFinishContextNogil() {\ 1524 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ 1525 __Pyx_RefNannyFinishContext();\ 1526 PyGILState_Release(__pyx_gilstate_save);\ 1527 } 1528#else 1529 #define __Pyx_RefNannySetupContext(name, acquire_gil)\ 1530 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__)) 1531 #define __Pyx_RefNannyFinishContextNogil() __Pyx_RefNannyFinishContext() 1532#endif 1533 #define __Pyx_RefNannyFinishContextNogil() {\ 1534 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ 1535 __Pyx_RefNannyFinishContext();\ 1536 PyGILState_Release(__pyx_gilstate_save);\ 1537 } 1538 #define __Pyx_RefNannyFinishContext()\ 1539 __Pyx_RefNanny->FinishContext(&__pyx_refnanny) 1540 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) 1541 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) 1542 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) 1543 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) 1544 #define __Pyx_XINCREF(r) do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0) 1545 #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0) 1546 #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0) 1547 #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0) 1548#else 1549 #define __Pyx_RefNannyDeclarations 1550 #define __Pyx_RefNannySetupContext(name, acquire_gil) 1551 #define __Pyx_RefNannyFinishContextNogil() 1552 #define __Pyx_RefNannyFinishContext() 1553 #define __Pyx_INCREF(r) Py_INCREF(r) 1554 #define __Pyx_DECREF(r) Py_DECREF(r) 1555 #define __Pyx_GOTREF(r) 1556 #define __Pyx_GIVEREF(r) 1557 #define __Pyx_XINCREF(r) Py_XINCREF(r) 1558 #define __Pyx_XDECREF(r) Py_XDECREF(r) 1559 #define __Pyx_XGOTREF(r) 1560 #define __Pyx_XGIVEREF(r) 1561#endif 1562#define __Pyx_Py_XDECREF_SET(r, v) do {\ 1563 PyObject *tmp = (PyObject *) r;\ 1564 r = v; Py_XDECREF(tmp);\ 1565 } while (0) 1566#define __Pyx_XDECREF_SET(r, v) do {\ 1567 PyObject *tmp = (PyObject *) r;\ 1568 r = v; __Pyx_XDECREF(tmp);\ 1569 } while (0) 1570#define __Pyx_DECREF_SET(r, v) do {\ 1571 PyObject *tmp = (PyObject *) r;\ 1572 r = v; __Pyx_DECREF(tmp);\ 1573 } while (0) 1574#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) 1575#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) 1576 1577/* PyErrExceptionMatches.proto */ 1578#if CYTHON_FAST_THREAD_STATE 1579#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) 1580static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); 1581#else 1582#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) 1583#endif 1584 1585/* PyThreadStateGet.proto */ 1586#if CYTHON_FAST_THREAD_STATE 1587#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; 1588#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; 1589#if PY_VERSION_HEX >= 0x030C00A6 1590#define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL) 1591#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL) 1592#else 1593#define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL) 1594#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type) 1595#endif 1596#else 1597#define __Pyx_PyThreadState_declare 1598#define __Pyx_PyThreadState_assign 1599#define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL) 1600#define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred() 1601#endif 1602 1603/* PyErrFetchRestore.proto */ 1604#if CYTHON_FAST_THREAD_STATE 1605#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) 1606#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) 1607#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) 1608#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) 1609#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) 1610static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); 1611static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); 1612#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6 1613#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) 1614#else 1615#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) 1616#endif 1617#else 1618#define __Pyx_PyErr_Clear() PyErr_Clear() 1619#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) 1620#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) 1621#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) 1622#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) 1623#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) 1624#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) 1625#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) 1626#endif 1627 1628/* PyObjectGetAttrStr.proto */ 1629#if CYTHON_USE_TYPE_SLOTS 1630static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); 1631#else 1632#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) 1633#endif 1634 1635/* PyObjectGetAttrStrNoError.proto */ 1636static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); 1637 1638/* GetBuiltinName.proto */ 1639static PyObject *__Pyx_GetBuiltinName(PyObject *name); 1640 1641/* TupleAndListFromArray.proto */ 1642#if CYTHON_COMPILING_IN_CPYTHON 1643static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n); 1644static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n); 1645#endif 1646 1647/* IncludeStringH.proto */ 1648#include <string.h> 1649 1650/* BytesEquals.proto */ 1651static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); 1652 1653/* UnicodeEquals.proto */ 1654static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); 1655 1656/* fastcall.proto */ 1657#if CYTHON_AVOID_BORROWED_REFS 1658 #define __Pyx_Arg_VARARGS(args, i) PySequence_GetItem(args, i) 1659#elif CYTHON_ASSUME_SAFE_MACROS 1660 #define __Pyx_Arg_VARARGS(args, i) PyTuple_GET_ITEM(args, i) 1661#else 1662 #define __Pyx_Arg_VARARGS(args, i) PyTuple_GetItem(args, i) 1663#endif 1664#if CYTHON_AVOID_BORROWED_REFS 1665 #define __Pyx_Arg_NewRef_VARARGS(arg) __Pyx_NewRef(arg) 1666 #define __Pyx_Arg_XDECREF_VARARGS(arg) Py_XDECREF(arg) 1667#else 1668 #define __Pyx_Arg_NewRef_VARARGS(arg) arg 1669 #define __Pyx_Arg_XDECREF_VARARGS(arg) 1670#endif 1671#define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds) 1672#define __Pyx_KwValues_VARARGS(args, nargs) NULL 1673#define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s) 1674#define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw) 1675#if CYTHON_METH_FASTCALL 1676 #define __Pyx_Arg_FASTCALL(args, i) args[i] 1677 #define __Pyx_NumKwargs_FASTCALL(kwds) PyTuple_GET_SIZE(kwds) 1678 #define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs)) 1679 static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s); 1680#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 1681 CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues); 1682 #else 1683 #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw) 1684 #endif 1685 #define __Pyx_Arg_NewRef_FASTCALL(arg) arg /* no-op, __Pyx_Arg_FASTCALL is direct and this needs 1686 to have the same reference counting */ 1687 #define __Pyx_Arg_XDECREF_FASTCALL(arg) 1688#else 1689 #define __Pyx_Arg_FASTCALL __Pyx_Arg_VARARGS 1690 #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS 1691 #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS 1692 #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS 1693 #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS 1694 #define __Pyx_Arg_NewRef_FASTCALL(arg) __Pyx_Arg_NewRef_VARARGS(arg) 1695 #define __Pyx_Arg_XDECREF_FASTCALL(arg) __Pyx_Arg_XDECREF_VARARGS(arg) 1696#endif 1697#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS 1698#define __Pyx_ArgsSlice_VARARGS(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_VARARGS(args, start), stop - start) 1699#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_FASTCALL(args, start), stop - start) 1700#else 1701#define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop) 1702#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop) 1703#endif 1704 1705/* RaiseArgTupleInvalid.proto */ 1706static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, 1707 Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); 1708 1709/* RaiseDoubleKeywords.proto */ 1710static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); 1711 1712/* ParseKeywords.proto */ 1713static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject *const *kwvalues, 1714 PyObject **argnames[], 1715 PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, 1716 const char* function_name); 1717 1718/* GetItemInt.proto */ 1719#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ 1720 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ 1721 __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\ 1722 (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\ 1723 __Pyx_GetItemInt_Generic(o, to_py_func(i)))) 1724#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ 1725 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ 1726 __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ 1727 (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) 1728static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, 1729 int wraparound, int boundscheck); 1730#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ 1731 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ 1732 __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ 1733 (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) 1734static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, 1735 int wraparound, int boundscheck); 1736static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); 1737static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, 1738 int is_list, int wraparound, int boundscheck); 1739 1740/* ListAppend.proto */ 1741#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS 1742static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { 1743 PyListObject* L = (PyListObject*) list; 1744 Py_ssize_t len = Py_SIZE(list); 1745 if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { 1746 Py_INCREF(x); 1747 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 1748 L->ob_item[len] = x; 1749 #else 1750 PyList_SET_ITEM(list, len, x); 1751 #endif 1752 __Pyx_SET_SIZE(list, len + 1); 1753 return 0; 1754 } 1755 return PyList_Append(list, x); 1756} 1757#else 1758#define __Pyx_PyList_Append(L,x) PyList_Append(L,x) 1759#endif 1760 1761/* PyObjectCall.proto */ 1762#if CYTHON_COMPILING_IN_CPYTHON 1763static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); 1764#else 1765#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) 1766#endif 1767 1768/* PyIntBinop.proto */ 1769#if !CYTHON_COMPILING_IN_PYPY 1770static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check); 1771#else 1772#define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\ 1773 (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2)) 1774#endif 1775 1776/* PyDictVersioning.proto */ 1777#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS 1778#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) 1779#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) 1780#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ 1781 (version_var) = __PYX_GET_DICT_VERSION(dict);\ 1782 (cache_var) = (value); 1783#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ 1784 static PY_UINT64_T __pyx_dict_version = 0;\ 1785 static PyObject *__pyx_dict_cached_value = NULL;\ 1786 if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ 1787 (VAR) = __pyx_dict_cached_value;\ 1788 } else {\ 1789 (VAR) = __pyx_dict_cached_value = (LOOKUP);\ 1790 __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ 1791 }\ 1792} 1793static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); 1794static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); 1795static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); 1796#else 1797#define __PYX_GET_DICT_VERSION(dict) (0) 1798#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) 1799#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); 1800#endif 1801 1802/* GetModuleGlobalName.proto */ 1803#if CYTHON_USE_DICT_VERSIONS 1804#define __Pyx_GetModuleGlobalName(var, name) do {\ 1805 static PY_UINT64_T __pyx_dict_version = 0;\ 1806 static PyObject *__pyx_dict_cached_value = NULL;\ 1807 (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\ 1808 (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\ 1809 __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ 1810} while(0) 1811#define __Pyx_GetModuleGlobalNameUncached(var, name) do {\ 1812 PY_UINT64_T __pyx_dict_version;\ 1813 PyObject *__pyx_dict_cached_value;\ 1814 (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ 1815} while(0) 1816static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value); 1817#else 1818#define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name) 1819#define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name) 1820static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); 1821#endif 1822 1823/* PyFunctionFastCall.proto */ 1824#if CYTHON_FAST_PYCALL 1825#if !CYTHON_VECTORCALL 1826#define __Pyx_PyFunction_FastCall(func, args, nargs)\ 1827 __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) 1828static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs); 1829#endif 1830#define __Pyx_BUILD_ASSERT_EXPR(cond)\ 1831 (sizeof(char [1 - 2*!(cond)]) - 1) 1832#ifndef Py_MEMBER_SIZE 1833#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) 1834#endif 1835#if !CYTHON_VECTORCALL 1836#if PY_VERSION_HEX >= 0x03080000 1837 #include "frameobject.h" 1838#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API 1839 #ifndef Py_BUILD_CORE 1840 #define Py_BUILD_CORE 1 1841 #endif 1842 #include "internal/pycore_frame.h" 1843#endif 1844 #define __Pxy_PyFrame_Initialize_Offsets() 1845 #define __Pyx_PyFrame_GetLocalsplus(frame) ((frame)->f_localsplus) 1846#else 1847 static size_t __pyx_pyframe_localsplus_offset = 0; 1848 #include "frameobject.h" 1849 #define __Pxy_PyFrame_Initialize_Offsets()\ 1850 ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\ 1851 (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus))) 1852 #define __Pyx_PyFrame_GetLocalsplus(frame)\ 1853 (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset)) 1854#endif 1855#endif 1856#endif 1857 1858/* PyObjectCallMethO.proto */ 1859#if CYTHON_COMPILING_IN_CPYTHON 1860static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); 1861#endif 1862 1863/* PyObjectFastCall.proto */ 1864#define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL) 1865static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs); 1866 1867/* PyIntCompare.proto */ 1868static CYTHON_INLINE int __Pyx_PyInt_BoolNeObjC(PyObject *op1, PyObject *op2, long intval, long inplace); 1869 1870/* PyIntBinop.proto */ 1871#if !CYTHON_COMPILING_IN_PYPY 1872static PyObject* __Pyx_PyInt_MultiplyCObj(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check); 1873#else 1874#define __Pyx_PyInt_MultiplyCObj(op1, op2, intval, inplace, zerodivision_check)\ 1875 (inplace ? PyNumber_InPlaceMultiply(op1, op2) : PyNumber_Multiply(op1, op2)) 1876#endif 1877 1878/* RaiseUnexpectedTypeError.proto */ 1879static int __Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj); 1880 1881/* SliceTupleAndList.proto */ 1882#if CYTHON_COMPILING_IN_CPYTHON 1883static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice(PyObject* src, Py_ssize_t start, Py_ssize_t stop); 1884static CYTHON_INLINE PyObject* __Pyx_PyTuple_GetSlice(PyObject* src, Py_ssize_t start, Py_ssize_t stop); 1885#else 1886#define __Pyx_PyList_GetSlice(seq, start, stop) PySequence_GetSlice(seq, start, stop) 1887#define __Pyx_PyTuple_GetSlice(seq, start, stop) PySequence_GetSlice(seq, start, stop) 1888#endif 1889 1890/* PyObjectCallOneArg.proto */ 1891static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); 1892 1893/* ObjectGetItem.proto */ 1894#if CYTHON_USE_TYPE_SLOTS 1895static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key); 1896#else 1897#define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key) 1898#endif 1899 1900/* PyIntCompare.proto */ 1901static CYTHON_INLINE int __Pyx_PyInt_BoolEqObjC(PyObject *op1, PyObject *op2, long intval, long inplace); 1902 1903/* Import.proto */ 1904static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); 1905 1906/* ImportFrom.proto */ 1907static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); 1908 1909/* IncludeStructmemberH.proto */ 1910#include <structmember.h> 1911 1912/* FixUpExtensionType.proto */ 1913#if CYTHON_USE_TYPE_SPECS 1914static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type); 1915#endif 1916 1917/* FetchSharedCythonModule.proto */ 1918static PyObject *__Pyx_FetchSharedCythonABIModule(void); 1919 1920/* FetchCommonType.proto */ 1921#if !CYTHON_USE_TYPE_SPECS 1922static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); 1923#else 1924static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases); 1925#endif 1926 1927/* PyMethodNew.proto */ 1928#if CYTHON_COMPILING_IN_LIMITED_API 1929static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { 1930 PyObject *typesModule=NULL, *methodType=NULL, *result=NULL; 1931 CYTHON_UNUSED_VAR(typ); 1932 if (!self) 1933 return __Pyx_NewRef(func); 1934 typesModule = PyImport_ImportModule("types"); 1935 if (!typesModule) return NULL; 1936 methodType = PyObject_GetAttrString(typesModule, "MethodType"); 1937 Py_DECREF(typesModule); 1938 if (!methodType) return NULL; 1939 result = PyObject_CallFunctionObjArgs(methodType, func, self, NULL); 1940 Py_DECREF(methodType); 1941 return result; 1942} 1943#elif PY_MAJOR_VERSION >= 3 1944static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { 1945 CYTHON_UNUSED_VAR(typ); 1946 if (!self) 1947 return __Pyx_NewRef(func); 1948 return PyMethod_New(func, self); 1949} 1950#else 1951 #define __Pyx_PyMethod_New PyMethod_New 1952#endif 1953 1954/* PyVectorcallFastCallDict.proto */ 1955#if CYTHON_METH_FASTCALL 1956static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw); 1957#endif 1958 1959/* CythonFunctionShared.proto */ 1960#define __Pyx_CyFunction_USED 1961#define __Pyx_CYFUNCTION_STATICMETHOD 0x01 1962#define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 1963#define __Pyx_CYFUNCTION_CCLASS 0x04 1964#define __Pyx_CYFUNCTION_COROUTINE 0x08 1965#define __Pyx_CyFunction_GetClosure(f)\ 1966 (((__pyx_CyFunctionObject *) (f))->func_closure) 1967#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API 1968 #define __Pyx_CyFunction_GetClassObj(f)\ 1969 (((__pyx_CyFunctionObject *) (f))->func_classobj) 1970#else 1971 #define __Pyx_CyFunction_GetClassObj(f)\ 1972 ((PyObject*) ((PyCMethodObject *) (f))->mm_class) 1973#endif 1974#define __Pyx_CyFunction_SetClassObj(f, classobj)\ 1975 __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj)) 1976#define __Pyx_CyFunction_Defaults(type, f)\ 1977 ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) 1978#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\ 1979 ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) 1980typedef struct { 1981#if CYTHON_COMPILING_IN_LIMITED_API 1982 PyObject_HEAD 1983 PyObject *func; 1984#elif PY_VERSION_HEX < 0x030900B1 1985 PyCFunctionObject func; 1986#else 1987 PyCMethodObject func; 1988#endif 1989#if CYTHON_BACKPORT_VECTORCALL 1990 __pyx_vectorcallfunc func_vectorcall; 1991#endif 1992#if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API 1993 PyObject *func_weakreflist; 1994#endif 1995 PyObject *func_dict; 1996 PyObject *func_name; 1997 PyObject *func_qualname; 1998 PyObject *func_doc; 1999 PyObject *func_globals; 2000 PyObject *func_code; 2001 PyObject *func_closure; 2002#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API 2003 PyObject *func_classobj; 2004#endif 2005 void *defaults; 2006 int defaults_pyobjects; 2007 size_t defaults_size; 2008 int flags; 2009 PyObject *defaults_tuple; 2010 PyObject *defaults_kwdict; 2011 PyObject *(*defaults_getter)(PyObject *); 2012 PyObject *func_annotations; 2013 PyObject *func_is_coroutine; 2014} __pyx_CyFunctionObject; 2015#undef __Pyx_CyOrPyCFunction_Check 2016#define __Pyx_CyFunction_Check(obj) __Pyx_TypeCheck(obj, __pyx_CyFunctionType) 2017#define __Pyx_CyOrPyCFunction_Check(obj) __Pyx_TypeCheck2(obj, __pyx_CyFunctionType, &PyCFunction_Type) 2018#define __Pyx_CyFunction_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_CyFunctionType) 2019static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void *cfunc); 2020#undef __Pyx_IsSameCFunction 2021#define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCyOrCFunction(func, cfunc) 2022static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml, 2023 int flags, PyObject* qualname, 2024 PyObject *closure, 2025 PyObject *module, PyObject *globals, 2026 PyObject* code); 2027static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj); 2028static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m, 2029 size_t size, 2030 int pyobjects); 2031static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, 2032 PyObject *tuple); 2033static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, 2034 PyObject *dict); 2035static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, 2036 PyObject *dict); 2037static int __pyx_CyFunction_init(PyObject *module); 2038#if CYTHON_METH_FASTCALL 2039static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); 2040static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); 2041static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); 2042static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); 2043#if CYTHON_BACKPORT_VECTORCALL 2044#define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall) 2045#else 2046#define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall) 2047#endif 2048#endif 2049 2050/* CythonFunction.proto */ 2051static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, 2052 int flags, PyObject* qualname, 2053 PyObject *closure, 2054 PyObject *module, PyObject *globals, 2055 PyObject* code); 2056 2057/* CLineInTraceback.proto */ 2058#ifdef CYTHON_CLINE_IN_TRACEBACK 2059#define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) 2060#else 2061static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); 2062#endif 2063 2064/* CodeObjectCache.proto */ 2065#if !CYTHON_COMPILING_IN_LIMITED_API 2066typedef struct { 2067 PyCodeObject* code_object; 2068 int code_line; 2069} __Pyx_CodeObjectCacheEntry; 2070struct __Pyx_CodeObjectCache { 2071 int count; 2072 int max_count; 2073 __Pyx_CodeObjectCacheEntry* entries; 2074}; 2075static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; 2076static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); 2077static PyCodeObject *__pyx_find_code_object(int code_line); 2078static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); 2079#endif 2080 2081/* AddTraceback.proto */ 2082static void __Pyx_AddTraceback(const char *funcname, int c_line, 2083 int py_line, const char *filename); 2084 2085/* GCCDiagnostics.proto */ 2086#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) 2087#define __Pyx_HAS_GCC_DIAGNOSTIC 2088#endif 2089 2090/* CIntFromPy.proto */ 2091static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); 2092 2093/* CIntToPy.proto */ 2094static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); 2095 2096/* CIntToPy.proto */ 2097static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); 2098 2099/* FormatTypeName.proto */ 2100#if CYTHON_COMPILING_IN_LIMITED_API 2101typedef PyObject *__Pyx_TypeName; 2102#define __Pyx_FMT_TYPENAME "%U" 2103static __Pyx_TypeName __Pyx_PyType_GetName(PyTypeObject* tp); 2104#define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj) 2105#else 2106typedef const char *__Pyx_TypeName; 2107#define __Pyx_FMT_TYPENAME "%.200s" 2108#define __Pyx_PyType_GetName(tp) ((tp)->tp_name) 2109#define __Pyx_DECREF_TypeName(obj) 2110#endif 2111 2112/* CIntFromPy.proto */ 2113static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); 2114 2115/* FastTypeChecks.proto */ 2116#if CYTHON_COMPILING_IN_CPYTHON 2117#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) 2118#define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2) 2119static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); 2120static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b); 2121static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); 2122static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); 2123#else 2124#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) 2125#define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2)) 2126#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) 2127#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2)) 2128#endif 2129#define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2) 2130#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) 2131 2132/* CheckBinaryVersion.proto */ 2133static unsigned long __Pyx_get_runtime_version(void); 2134static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer); 2135 2136/* InitStrings.proto */ 2137static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); 2138 2139/* #### Code section: module_declarations ### */ 2140 2141/* Module declarations from "cython" */ 2142 2143/* Module declarations from "search" */ 2144/* #### Code section: typeinfo ### */ 2145/* #### Code section: before_global_var ### */ 2146#define __Pyx_MODULE_NAME "search" 2147extern int __pyx_module_is_main_search; 2148int __pyx_module_is_main_search = 0; 2149 2150/* Implementation of "search" */ 2151/* #### Code section: global_var ### */ 2152static PyObject *__pyx_builtin_range; 2153/* #### Code section: string_decls ### */ 2154static const char __pyx_k_F[] = "F"; 2155static const char __pyx_k_a[] = "a"; 2156static const char __pyx_k_b[] = "b"; 2157static const char __pyx_k_l[] = "l"; 2158static const char __pyx_k_r[] = "r"; 2159static const char __pyx_k__2[] = "."; 2160static const char __pyx_k__7[] = "?"; 2161static const char __pyx_k_bw[] = "bw"; 2162static const char __pyx_k_fw[] = "fw"; 2163static const char __pyx_k_ctn[] = "ctn"; 2164static const char __pyx_k_gcd[] = "gcd"; 2165static const char __pyx_k_body[] = "body"; 2166static const char __pyx_k_head[] = "head"; 2167static const char __pyx_k_llen[] = "llen"; 2168static const char __pyx_k_main[] = "__main__"; 2169static const char __pyx_k_math[] = "math"; 2170static const char __pyx_k_name[] = "__name__"; 2171static const char __pyx_k_ones[] = "ones"; 2172static const char __pyx_k_read[] = "read"; 2173static const char __pyx_k_rlen[] = "rlen"; 2174static const char __pyx_k_test[] = "__test__"; 2175static const char __pyx_k_range[] = "range"; 2176static const char __pyx_k_import[] = "__import__"; 2177static const char __pyx_k_l_body[] = "l_body"; 2178static const char __pyx_k_r_body[] = "r_body"; 2179static const char __pyx_k_return[] = "return"; 2180static const char __pyx_k_search[] = "search"; 2181static const char __pyx_k_sequence[] = "sequence"; 2182static const char __pyx_k_ctn_degree[] = "ctn_degree"; 2183static const char __pyx_k_cython_int[] = "cython.int"; 2184static const char __pyx_k_search_pyx[] = "search.pyx"; 2185static const char __pyx_k_upper_bound[] = "upper_bound"; 2186static const char __pyx_k_is_coroutine[] = "_is_coroutine"; 2187static const char __pyx_k_class_getitem[] = "__class_getitem__"; 2188static const char __pyx_k_set_cython_int[] = "set[cython.int]"; 2189static const char __pyx_k_list_cython_int[] = "list[cython.int]"; 2190static const char __pyx_k_asyncio_coroutines[] = "asyncio.coroutines"; 2191static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; 2192/* #### Code section: decls ### */ 2193static PyObject *__pyx_pf_6search_F(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_a, int __pyx_v_b); /* proto */ 2194static PyObject *__pyx_pf_6search_2search(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_upper_bound, int __pyx_v_ctn_degree); /* proto */ 2195/* #### Code section: late_includes ### */ 2196/* #### Code section: module_state ### */ 2197typedef struct { 2198 PyObject *__pyx_d; 2199 PyObject *__pyx_b; 2200 PyObject *__pyx_cython_runtime; 2201 PyObject *__pyx_empty_tuple; 2202 PyObject *__pyx_empty_bytes; 2203 PyObject *__pyx_empty_unicode; 2204 #ifdef __Pyx_CyFunction_USED 2205 PyTypeObject *__pyx_CyFunctionType; 2206 #endif 2207 #ifdef __Pyx_FusedFunction_USED 2208 PyTypeObject *__pyx_FusedFunctionType; 2209 #endif 2210 #ifdef __Pyx_Generator_USED 2211 PyTypeObject *__pyx_GeneratorType; 2212 #endif 2213 #ifdef __Pyx_IterableCoroutine_USED 2214 PyTypeObject *__pyx_IterableCoroutineType; 2215 #endif 2216 #ifdef __Pyx_Coroutine_USED 2217 PyTypeObject *__pyx_CoroutineAwaitType; 2218 #endif 2219 #ifdef __Pyx_Coroutine_USED 2220 PyTypeObject *__pyx_CoroutineType; 2221 #endif 2222 #if CYTHON_USE_MODULE_STATE 2223 #endif 2224 #if CYTHON_USE_MODULE_STATE 2225 #endif 2226 PyObject *__pyx_n_s_F; 2227 PyObject *__pyx_kp_u__2; 2228 PyObject *__pyx_n_s__7; 2229 PyObject *__pyx_n_s_a; 2230 PyObject *__pyx_n_s_asyncio_coroutines; 2231 PyObject *__pyx_n_s_b; 2232 PyObject *__pyx_n_s_body; 2233 PyObject *__pyx_n_s_bw; 2234 PyObject *__pyx_n_s_class_getitem; 2235 PyObject *__pyx_n_s_cline_in_traceback; 2236 PyObject *__pyx_n_s_ctn; 2237 PyObject *__pyx_n_s_ctn_degree; 2238 PyObject *__pyx_kp_s_cython_int; 2239 PyObject *__pyx_n_s_fw; 2240 PyObject *__pyx_n_s_gcd; 2241 PyObject *__pyx_n_s_head; 2242 PyObject *__pyx_n_s_import; 2243 PyObject *__pyx_n_s_is_coroutine; 2244 PyObject *__pyx_n_s_l; 2245 PyObject *__pyx_n_s_l_body; 2246 PyObject *__pyx_kp_s_list_cython_int; 2247 PyObject *__pyx_n_s_llen; 2248 PyObject *__pyx_n_s_main; 2249 PyObject *__pyx_n_s_math; 2250 PyObject *__pyx_n_s_name; 2251 PyObject *__pyx_n_s_ones; 2252 PyObject *__pyx_n_s_r; 2253 PyObject *__pyx_n_s_r_body; 2254 PyObject *__pyx_n_s_range; 2255 PyObject *__pyx_n_s_read; 2256 PyObject *__pyx_n_s_return; 2257 PyObject *__pyx_n_s_rlen; 2258 PyObject *__pyx_n_s_search; 2259 PyObject *__pyx_kp_s_search_pyx; 2260 PyObject *__pyx_n_s_sequence; 2261 PyObject *__pyx_kp_s_set_cython_int; 2262 PyObject *__pyx_n_s_test; 2263 PyObject *__pyx_n_s_upper_bound; 2264 PyObject *__pyx_int_1; 2265 PyObject *__pyx_int_2; 2266 PyObject *__pyx_int_neg_1; 2267 PyObject *__pyx_slice_; 2268 PyObject *__pyx_tuple__3; 2269 PyObject *__pyx_tuple__5; 2270 PyObject *__pyx_codeobj__4; 2271 PyObject *__pyx_codeobj__6; 2272} __pyx_mstate; 2273 2274#if CYTHON_USE_MODULE_STATE 2275#ifdef __cplusplus 2276namespace { 2277 extern struct PyModuleDef __pyx_moduledef; 2278} /* anonymous namespace */ 2279#else 2280static struct PyModuleDef __pyx_moduledef; 2281#endif 2282 2283#define __pyx_mstate(o) ((__pyx_mstate *)__Pyx_PyModule_GetState(o)) 2284 2285#define __pyx_mstate_global (__pyx_mstate(PyState_FindModule(&__pyx_moduledef))) 2286 2287#define __pyx_m (PyState_FindModule(&__pyx_moduledef)) 2288#else 2289static __pyx_mstate __pyx_mstate_global_static = 2290#ifdef __cplusplus 2291 {}; 2292#else 2293 {0}; 2294#endif 2295static __pyx_mstate *__pyx_mstate_global = &__pyx_mstate_global_static; 2296#endif 2297/* #### Code section: module_state_clear ### */ 2298#if CYTHON_USE_MODULE_STATE 2299static int __pyx_m_clear(PyObject *m) { 2300 __pyx_mstate *clear_module_state = __pyx_mstate(m); 2301 if (!clear_module_state) return 0; 2302 Py_CLEAR(clear_module_state->__pyx_d); 2303 Py_CLEAR(clear_module_state->__pyx_b); 2304 Py_CLEAR(clear_module_state->__pyx_cython_runtime); 2305 Py_CLEAR(clear_module_state->__pyx_empty_tuple); 2306 Py_CLEAR(clear_module_state->__pyx_empty_bytes); 2307 Py_CLEAR(clear_module_state->__pyx_empty_unicode); 2308 #ifdef __Pyx_CyFunction_USED 2309 Py_CLEAR(clear_module_state->__pyx_CyFunctionType); 2310 #endif 2311 #ifdef __Pyx_FusedFunction_USED 2312 Py_CLEAR(clear_module_state->__pyx_FusedFunctionType); 2313 #endif 2314 Py_CLEAR(clear_module_state->__pyx_n_s_F); 2315 Py_CLEAR(clear_module_state->__pyx_kp_u__2); 2316 Py_CLEAR(clear_module_state->__pyx_n_s__7); 2317 Py_CLEAR(clear_module_state->__pyx_n_s_a); 2318 Py_CLEAR(clear_module_state->__pyx_n_s_asyncio_coroutines); 2319 Py_CLEAR(clear_module_state->__pyx_n_s_b); 2320 Py_CLEAR(clear_module_state->__pyx_n_s_body); 2321 Py_CLEAR(clear_module_state->__pyx_n_s_bw); 2322 Py_CLEAR(clear_module_state->__pyx_n_s_class_getitem); 2323 Py_CLEAR(clear_module_state->__pyx_n_s_cline_in_traceback); 2324 Py_CLEAR(clear_module_state->__pyx_n_s_ctn); 2325 Py_CLEAR(clear_module_state->__pyx_n_s_ctn_degree); 2326 Py_CLEAR(clear_module_state->__pyx_kp_s_cython_int); 2327 Py_CLEAR(clear_module_state->__pyx_n_s_fw); 2328 Py_CLEAR(clear_module_state->__pyx_n_s_gcd); 2329 Py_CLEAR(clear_module_state->__pyx_n_s_head); 2330 Py_CLEAR(clear_module_state->__pyx_n_s_import); 2331 Py_CLEAR(clear_module_state->__pyx_n_s_is_coroutine); 2332 Py_CLEAR(clear_module_state->__pyx_n_s_l); 2333 Py_CLEAR(clear_module_state->__pyx_n_s_l_body); 2334 Py_CLEAR(clear_module_state->__pyx_kp_s_list_cython_int); 2335 Py_CLEAR(clear_module_state->__pyx_n_s_llen); 2336 Py_CLEAR(clear_module_state->__pyx_n_s_main); 2337 Py_CLEAR(clear_module_state->__pyx_n_s_math); 2338 Py_CLEAR(clear_module_state->__pyx_n_s_name); 2339 Py_CLEAR(clear_module_state->__pyx_n_s_ones); 2340 Py_CLEAR(clear_module_state->__pyx_n_s_r); 2341 Py_CLEAR(clear_module_state->__pyx_n_s_r_body); 2342 Py_CLEAR(clear_module_state->__pyx_n_s_range); 2343 Py_CLEAR(clear_module_state->__pyx_n_s_read); 2344 Py_CLEAR(clear_module_state->__pyx_n_s_return); 2345 Py_CLEAR(clear_module_state->__pyx_n_s_rlen); 2346 Py_CLEAR(clear_module_state->__pyx_n_s_search); 2347 Py_CLEAR(clear_module_state->__pyx_kp_s_search_pyx); 2348 Py_CLEAR(clear_module_state->__pyx_n_s_sequence); 2349 Py_CLEAR(clear_module_state->__pyx_kp_s_set_cython_int); 2350 Py_CLEAR(clear_module_state->__pyx_n_s_test); 2351 Py_CLEAR(clear_module_state->__pyx_n_s_upper_bound); 2352 Py_CLEAR(clear_module_state->__pyx_int_1); 2353 Py_CLEAR(clear_module_state->__pyx_int_2); 2354 Py_CLEAR(clear_module_state->__pyx_int_neg_1); 2355 Py_CLEAR(clear_module_state->__pyx_slice_); 2356 Py_CLEAR(clear_module_state->__pyx_tuple__3); 2357 Py_CLEAR(clear_module_state->__pyx_tuple__5); 2358 Py_CLEAR(clear_module_state->__pyx_codeobj__4); 2359 Py_CLEAR(clear_module_state->__pyx_codeobj__6); 2360 return 0; 2361} 2362#endif 2363/* #### Code section: module_state_traverse ### */ 2364#if CYTHON_USE_MODULE_STATE 2365static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { 2366 __pyx_mstate *traverse_module_state = __pyx_mstate(m); 2367 if (!traverse_module_state) return 0; 2368 Py_VISIT(traverse_module_state->__pyx_d); 2369 Py_VISIT(traverse_module_state->__pyx_b); 2370 Py_VISIT(traverse_module_state->__pyx_cython_runtime); 2371 Py_VISIT(traverse_module_state->__pyx_empty_tuple); 2372 Py_VISIT(traverse_module_state->__pyx_empty_bytes); 2373 Py_VISIT(traverse_module_state->__pyx_empty_unicode); 2374 #ifdef __Pyx_CyFunction_USED 2375 Py_VISIT(traverse_module_state->__pyx_CyFunctionType); 2376 #endif 2377 #ifdef __Pyx_FusedFunction_USED 2378 Py_VISIT(traverse_module_state->__pyx_FusedFunctionType); 2379 #endif 2380 Py_VISIT(traverse_module_state->__pyx_n_s_F); 2381 Py_VISIT(traverse_module_state->__pyx_kp_u__2); 2382 Py_VISIT(traverse_module_state->__pyx_n_s__7); 2383 Py_VISIT(traverse_module_state->__pyx_n_s_a); 2384 Py_VISIT(traverse_module_state->__pyx_n_s_asyncio_coroutines); 2385 Py_VISIT(traverse_module_state->__pyx_n_s_b); 2386 Py_VISIT(traverse_module_state->__pyx_n_s_body); 2387 Py_VISIT(traverse_module_state->__pyx_n_s_bw); 2388 Py_VISIT(traverse_module_state->__pyx_n_s_class_getitem); 2389 Py_VISIT(traverse_module_state->__pyx_n_s_cline_in_traceback); 2390 Py_VISIT(traverse_module_state->__pyx_n_s_ctn); 2391 Py_VISIT(traverse_module_state->__pyx_n_s_ctn_degree); 2392 Py_VISIT(traverse_module_state->__pyx_kp_s_cython_int); 2393 Py_VISIT(traverse_module_state->__pyx_n_s_fw); 2394 Py_VISIT(traverse_module_state->__pyx_n_s_gcd); 2395 Py_VISIT(traverse_module_state->__pyx_n_s_head); 2396 Py_VISIT(traverse_module_state->__pyx_n_s_import); 2397 Py_VISIT(traverse_module_state->__pyx_n_s_is_coroutine); 2398 Py_VISIT(traverse_module_state->__pyx_n_s_l); 2399 Py_VISIT(traverse_module_state->__pyx_n_s_l_body); 2400 Py_VISIT(traverse_module_state->__pyx_kp_s_list_cython_int); 2401 Py_VISIT(traverse_module_state->__pyx_n_s_llen); 2402 Py_VISIT(traverse_module_state->__pyx_n_s_main); 2403 Py_VISIT(traverse_module_state->__pyx_n_s_math); 2404 Py_VISIT(traverse_module_state->__pyx_n_s_name); 2405 Py_VISIT(traverse_module_state->__pyx_n_s_ones); 2406 Py_VISIT(traverse_module_state->__pyx_n_s_r); 2407 Py_VISIT(traverse_module_state->__pyx_n_s_r_body); 2408 Py_VISIT(traverse_module_state->__pyx_n_s_range); 2409 Py_VISIT(traverse_module_state->__pyx_n_s_read); 2410 Py_VISIT(traverse_module_state->__pyx_n_s_return); 2411 Py_VISIT(traverse_module_state->__pyx_n_s_rlen); 2412 Py_VISIT(traverse_module_state->__pyx_n_s_search); 2413 Py_VISIT(traverse_module_state->__pyx_kp_s_search_pyx); 2414 Py_VISIT(traverse_module_state->__pyx_n_s_sequence); 2415 Py_VISIT(traverse_module_state->__pyx_kp_s_set_cython_int); 2416 Py_VISIT(traverse_module_state->__pyx_n_s_test); 2417 Py_VISIT(traverse_module_state->__pyx_n_s_upper_bound); 2418 Py_VISIT(traverse_module_state->__pyx_int_1); 2419 Py_VISIT(traverse_module_state->__pyx_int_2); 2420 Py_VISIT(traverse_module_state->__pyx_int_neg_1); 2421 Py_VISIT(traverse_module_state->__pyx_slice_); 2422 Py_VISIT(traverse_module_state->__pyx_tuple__3); 2423 Py_VISIT(traverse_module_state->__pyx_tuple__5); 2424 Py_VISIT(traverse_module_state->__pyx_codeobj__4); 2425 Py_VISIT(traverse_module_state->__pyx_codeobj__6); 2426 return 0; 2427} 2428#endif 2429/* #### Code section: module_state_defines ### */ 2430#define __pyx_d __pyx_mstate_global->__pyx_d 2431#define __pyx_b __pyx_mstate_global->__pyx_b 2432#define __pyx_cython_runtime __pyx_mstate_global->__pyx_cython_runtime 2433#define __pyx_empty_tuple __pyx_mstate_global->__pyx_empty_tuple 2434#define __pyx_empty_bytes __pyx_mstate_global->__pyx_empty_bytes 2435#define __pyx_empty_unicode __pyx_mstate_global->__pyx_empty_unicode 2436#ifdef __Pyx_CyFunction_USED 2437#define __pyx_CyFunctionType __pyx_mstate_global->__pyx_CyFunctionType 2438#endif 2439#ifdef __Pyx_FusedFunction_USED 2440#define __pyx_FusedFunctionType __pyx_mstate_global->__pyx_FusedFunctionType 2441#endif 2442#ifdef __Pyx_Generator_USED 2443#define __pyx_GeneratorType __pyx_mstate_global->__pyx_GeneratorType 2444#endif 2445#ifdef __Pyx_IterableCoroutine_USED 2446#define __pyx_IterableCoroutineType __pyx_mstate_global->__pyx_IterableCoroutineType 2447#endif 2448#ifdef __Pyx_Coroutine_USED 2449#define __pyx_CoroutineAwaitType __pyx_mstate_global->__pyx_CoroutineAwaitType 2450#endif 2451#ifdef __Pyx_Coroutine_USED 2452#define __pyx_CoroutineType __pyx_mstate_global->__pyx_CoroutineType 2453#endif 2454#if CYTHON_USE_MODULE_STATE 2455#endif 2456#if CYTHON_USE_MODULE_STATE 2457#endif 2458#define __pyx_n_s_F __pyx_mstate_global->__pyx_n_s_F 2459#define __pyx_kp_u__2 __pyx_mstate_global->__pyx_kp_u__2 2460#define __pyx_n_s__7 __pyx_mstate_global->__pyx_n_s__7 2461#define __pyx_n_s_a __pyx_mstate_global->__pyx_n_s_a 2462#define __pyx_n_s_asyncio_coroutines __pyx_mstate_global->__pyx_n_s_asyncio_coroutines 2463#define __pyx_n_s_b __pyx_mstate_global->__pyx_n_s_b 2464#define __pyx_n_s_body __pyx_mstate_global->__pyx_n_s_body 2465#define __pyx_n_s_bw __pyx_mstate_global->__pyx_n_s_bw 2466#define __pyx_n_s_class_getitem __pyx_mstate_global->__pyx_n_s_class_getitem 2467#define __pyx_n_s_cline_in_traceback __pyx_mstate_global->__pyx_n_s_cline_in_traceback 2468#define __pyx_n_s_ctn __pyx_mstate_global->__pyx_n_s_ctn 2469#define __pyx_n_s_ctn_degree __pyx_mstate_global->__pyx_n_s_ctn_degree 2470#define __pyx_kp_s_cython_int __pyx_mstate_global->__pyx_kp_s_cython_int 2471#define __pyx_n_s_fw __pyx_mstate_global->__pyx_n_s_fw 2472#define __pyx_n_s_gcd __pyx_mstate_global->__pyx_n_s_gcd 2473#define __pyx_n_s_head __pyx_mstate_global->__pyx_n_s_head 2474#define __pyx_n_s_import __pyx_mstate_global->__pyx_n_s_import 2475#define __pyx_n_s_is_coroutine __pyx_mstate_global->__pyx_n_s_is_coroutine 2476#define __pyx_n_s_l __pyx_mstate_global->__pyx_n_s_l 2477#define __pyx_n_s_l_body __pyx_mstate_global->__pyx_n_s_l_body 2478#define __pyx_kp_s_list_cython_int __pyx_mstate_global->__pyx_kp_s_list_cython_int 2479#define __pyx_n_s_llen __pyx_mstate_global->__pyx_n_s_llen 2480#define __pyx_n_s_main __pyx_mstate_global->__pyx_n_s_main 2481#define __pyx_n_s_math __pyx_mstate_global->__pyx_n_s_math 2482#define __pyx_n_s_name __pyx_mstate_global->__pyx_n_s_name 2483#define __pyx_n_s_ones __pyx_mstate_global->__pyx_n_s_ones 2484#define __pyx_n_s_r __pyx_mstate_global->__pyx_n_s_r 2485#define __pyx_n_s_r_body __pyx_mstate_global->__pyx_n_s_r_body 2486#define __pyx_n_s_range __pyx_mstate_global->__pyx_n_s_range 2487#define __pyx_n_s_read __pyx_mstate_global->__pyx_n_s_read 2488#define __pyx_n_s_return __pyx_mstate_global->__pyx_n_s_return 2489#define __pyx_n_s_rlen __pyx_mstate_global->__pyx_n_s_rlen 2490#define __pyx_n_s_search __pyx_mstate_global->__pyx_n_s_search 2491#define __pyx_kp_s_search_pyx __pyx_mstate_global->__pyx_kp_s_search_pyx 2492#define __pyx_n_s_sequence __pyx_mstate_global->__pyx_n_s_sequence 2493#define __pyx_kp_s_set_cython_int __pyx_mstate_global->__pyx_kp_s_set_cython_int 2494#define __pyx_n_s_test __pyx_mstate_global->__pyx_n_s_test 2495#define __pyx_n_s_upper_bound __pyx_mstate_global->__pyx_n_s_upper_bound 2496#define __pyx_int_1 __pyx_mstate_global->__pyx_int_1 2497#define __pyx_int_2 __pyx_mstate_global->__pyx_int_2 2498#define __pyx_int_neg_1 __pyx_mstate_global->__pyx_int_neg_1 2499#define __pyx_slice_ __pyx_mstate_global->__pyx_slice_ 2500#define __pyx_tuple__3 __pyx_mstate_global->__pyx_tuple__3 2501#define __pyx_tuple__5 __pyx_mstate_global->__pyx_tuple__5 2502#define __pyx_codeobj__4 __pyx_mstate_global->__pyx_codeobj__4 2503#define __pyx_codeobj__6 __pyx_mstate_global->__pyx_codeobj__6 2504/* #### Code section: module_code ### */ 2505 2506/* "search.pyx":4 2507 * import cython 2508 * 2509 * def F(a: cython.int, b: cython.int) -> list[cython.int]: # <<<<<<<<<<<<<< 2510 * sequence: list[cython.int] = [a, b] 2511 * while sequence[-1] > 1: 2512 */ 2513 2514/* Python wrapper */ 2515static PyObject *__pyx_pw_6search_1F(PyObject *__pyx_self, 2516#if CYTHON_METH_FASTCALL 2517PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds 2518#else 2519PyObject *__pyx_args, PyObject *__pyx_kwds 2520#endif 2521); /*proto*/ 2522static PyMethodDef __pyx_mdef_6search_1F = {"F", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6search_1F, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; 2523static PyObject *__pyx_pw_6search_1F(PyObject *__pyx_self, 2524#if CYTHON_METH_FASTCALL 2525PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds 2526#else 2527PyObject *__pyx_args, PyObject *__pyx_kwds 2528#endif 2529) { 2530 int __pyx_v_a; 2531 int __pyx_v_b; 2532 #if !CYTHON_METH_FASTCALL 2533 CYTHON_UNUSED Py_ssize_t __pyx_nargs; 2534 #endif 2535 CYTHON_UNUSED PyObject *const *__pyx_kwvalues; 2536 PyObject* values[2] = {0,0}; 2537 int __pyx_lineno = 0; 2538 const char *__pyx_filename = NULL; 2539 int __pyx_clineno = 0; 2540 PyObject *__pyx_r = 0; 2541 __Pyx_RefNannyDeclarations 2542 __Pyx_RefNannySetupContext("F (wrapper)", 0); 2543 #if !CYTHON_METH_FASTCALL 2544 #if CYTHON_ASSUME_SAFE_MACROS 2545 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); 2546 #else 2547 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; 2548 #endif 2549 #endif 2550 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); 2551 { 2552 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_a,&__pyx_n_s_b,0}; 2553 if (__pyx_kwds) { 2554 Py_ssize_t kw_args; 2555 switch (__pyx_nargs) { 2556 case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); 2557 CYTHON_FALLTHROUGH; 2558 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); 2559 CYTHON_FALLTHROUGH; 2560 case 0: break; 2561 default: goto __pyx_L5_argtuple_error; 2562 } 2563 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); 2564 switch (__pyx_nargs) { 2565 case 0: 2566 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_a)) != 0)) { 2567 (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); 2568 kw_args--; 2569 } 2570 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4, __pyx_L3_error) 2571 else goto __pyx_L5_argtuple_error; 2572 CYTHON_FALLTHROUGH; 2573 case 1: 2574 if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_b)) != 0)) { 2575 (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); 2576 kw_args--; 2577 } 2578 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 4, __pyx_L3_error) 2579 else { 2580 __Pyx_RaiseArgtupleInvalid("F", 1, 2, 2, 1); __PYX_ERR(0, 4, __pyx_L3_error) 2581 } 2582 } 2583 if (unlikely(kw_args > 0)) { 2584 const Py_ssize_t kwd_pos_args = __pyx_nargs; 2585 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "F") < 0)) __PYX_ERR(0, 4, __pyx_L3_error) 2586 } 2587 } else if (unlikely(__pyx_nargs != 2)) { 2588 goto __pyx_L5_argtuple_error; 2589 } else { 2590 values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); 2591 values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); 2592 } 2593 __pyx_v_a = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_a == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4, __pyx_L3_error) 2594 __pyx_v_b = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_b == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4, __pyx_L3_error) 2595 } 2596 goto __pyx_L6_skip; 2597 __pyx_L5_argtuple_error:; 2598 __Pyx_RaiseArgtupleInvalid("F", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 4, __pyx_L3_error) 2599 __pyx_L6_skip:; 2600 goto __pyx_L4_argument_unpacking_done; 2601 __pyx_L3_error:; 2602 { 2603 Py_ssize_t __pyx_temp; 2604 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { 2605 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); 2606 } 2607 } 2608 __Pyx_AddTraceback("search.F", __pyx_clineno, __pyx_lineno, __pyx_filename); 2609 __Pyx_RefNannyFinishContext(); 2610 return NULL; 2611 __pyx_L4_argument_unpacking_done:; 2612 __pyx_r = __pyx_pf_6search_F(__pyx_self, __pyx_v_a, __pyx_v_b); 2613 2614 /* function exit code */ 2615 { 2616 Py_ssize_t __pyx_temp; 2617 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { 2618 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); 2619 } 2620 } 2621 __Pyx_RefNannyFinishContext(); 2622 return __pyx_r; 2623} 2624 2625static PyObject *__pyx_pf_6search_F(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_a, int __pyx_v_b) { 2626 PyObject *__pyx_v_sequence = 0; 2627 PyObject *__pyx_r = NULL; 2628 __Pyx_RefNannyDeclarations 2629 PyObject *__pyx_t_1 = NULL; 2630 PyObject *__pyx_t_2 = NULL; 2631 PyObject *__pyx_t_3 = NULL; 2632 int __pyx_t_4; 2633 int __pyx_t_5; 2634 int __pyx_lineno = 0; 2635 const char *__pyx_filename = NULL; 2636 int __pyx_clineno = 0; 2637 __Pyx_RefNannySetupContext("F", 1); 2638 2639 /* "search.pyx":5 2640 * 2641 * def F(a: cython.int, b: cython.int) -> list[cython.int]: 2642 * sequence: list[cython.int] = [a, b] # <<<<<<<<<<<<<< 2643 * while sequence[-1] > 1: 2644 * sequence.append(-sequence[-2] % sequence[-1]) 2645 */ 2646 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_a); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5, __pyx_L1_error) 2647 __Pyx_GOTREF(__pyx_t_1); 2648 __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_b); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5, __pyx_L1_error) 2649 __Pyx_GOTREF(__pyx_t_2); 2650 __pyx_t_3 = PyList_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5, __pyx_L1_error) 2651 __Pyx_GOTREF(__pyx_t_3); 2652 __Pyx_GIVEREF(__pyx_t_1); 2653 if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 5, __pyx_L1_error); 2654 __Pyx_GIVEREF(__pyx_t_2); 2655 if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 1, __pyx_t_2)) __PYX_ERR(0, 5, __pyx_L1_error); 2656 __pyx_t_1 = 0; 2657 __pyx_t_2 = 0; 2658 __pyx_v_sequence = ((PyObject*)__pyx_t_3); 2659 __pyx_t_3 = 0; 2660 2661 /* "search.pyx":6 2662 * def F(a: cython.int, b: cython.int) -> list[cython.int]: 2663 * sequence: list[cython.int] = [a, b] 2664 * while sequence[-1] > 1: # <<<<<<<<<<<<<< 2665 * sequence.append(-sequence[-2] % sequence[-1]) 2666 * 2667 */ 2668 while (1) { 2669 __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_sequence, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 6, __pyx_L1_error) 2670 __Pyx_GOTREF(__pyx_t_3); 2671 __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_int_1, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __pyx_L1_error) 2672 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; 2673 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 6, __pyx_L1_error) 2674 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; 2675 if (!__pyx_t_4) break; 2676 2677 /* "search.pyx":7 2678 * sequence: list[cython.int] = [a, b] 2679 * while sequence[-1] > 1: 2680 * sequence.append(-sequence[-2] % sequence[-1]) # <<<<<<<<<<<<<< 2681 * 2682 * return sequence 2683 */ 2684 __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_sequence, -2L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 7, __pyx_L1_error) 2685 __Pyx_GOTREF(__pyx_t_2); 2686 __pyx_t_3 = PyNumber_Negative(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 7, __pyx_L1_error) 2687 __Pyx_GOTREF(__pyx_t_3); 2688 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; 2689 __pyx_t_2 = __Pyx_GetItemInt_List(__pyx_v_sequence, -1L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 7, __pyx_L1_error) 2690 __Pyx_GOTREF(__pyx_t_2); 2691 __pyx_t_1 = PyNumber_Remainder(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error) 2692 __Pyx_GOTREF(__pyx_t_1); 2693 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; 2694 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; 2695 __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_sequence, __pyx_t_1); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 7, __pyx_L1_error) 2696 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; 2697 } 2698 2699 /* "search.pyx":9 2700 * sequence.append(-sequence[-2] % sequence[-1]) 2701 * 2702 * return sequence # <<<<<<<<<<<<<< 2703 * 2704 * def search(upper_bound: cython.int, ctn_degree: cython.int) -> set[cython.int]: 2705 */ 2706 __Pyx_XDECREF(__pyx_r); 2707 __Pyx_INCREF(__pyx_v_sequence); 2708 __pyx_r = __pyx_v_sequence; 2709 goto __pyx_L0; 2710 2711 /* "search.pyx":4 2712 * import cython 2713 * 2714 * def F(a: cython.int, b: cython.int) -> list[cython.int]: # <<<<<<<<<<<<<< 2715 * sequence: list[cython.int] = [a, b] 2716 * while sequence[-1] > 1: 2717 */ 2718 2719 /* function exit code */ 2720 __pyx_L1_error:; 2721 __Pyx_XDECREF(__pyx_t_1); 2722 __Pyx_XDECREF(__pyx_t_2); 2723 __Pyx_XDECREF(__pyx_t_3); 2724 __Pyx_AddTraceback("search.F", __pyx_clineno, __pyx_lineno, __pyx_filename); 2725 __pyx_r = NULL; 2726 __pyx_L0:; 2727 __Pyx_XDECREF(__pyx_v_sequence); 2728 __Pyx_XGIVEREF(__pyx_r); 2729 __Pyx_RefNannyFinishContext(); 2730 return __pyx_r; 2731} 2732 2733/* "search.pyx":11 2734 * return sequence 2735 * 2736 * def search(upper_bound: cython.int, ctn_degree: cython.int) -> set[cython.int]: # <<<<<<<<<<<<<< 2737 * ctn: set[tuple] = set() 2738 * for a in range(1, upper_bound + 1, 2): 2739 */ 2740 2741/* Python wrapper */ 2742static PyObject *__pyx_pw_6search_3search(PyObject *__pyx_self, 2743#if CYTHON_METH_FASTCALL 2744PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds 2745#else 2746PyObject *__pyx_args, PyObject *__pyx_kwds 2747#endif 2748); /*proto*/ 2749static PyMethodDef __pyx_mdef_6search_3search = {"search", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_6search_3search, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; 2750static PyObject *__pyx_pw_6search_3search(PyObject *__pyx_self, 2751#if CYTHON_METH_FASTCALL 2752PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds 2753#else 2754PyObject *__pyx_args, PyObject *__pyx_kwds 2755#endif 2756) { 2757 int __pyx_v_upper_bound; 2758 int __pyx_v_ctn_degree; 2759 #if !CYTHON_METH_FASTCALL 2760 CYTHON_UNUSED Py_ssize_t __pyx_nargs; 2761 #endif 2762 CYTHON_UNUSED PyObject *const *__pyx_kwvalues; 2763 PyObject* values[2] = {0,0}; 2764 int __pyx_lineno = 0; 2765 const char *__pyx_filename = NULL; 2766 int __pyx_clineno = 0; 2767 PyObject *__pyx_r = 0; 2768 __Pyx_RefNannyDeclarations 2769 __Pyx_RefNannySetupContext("search (wrapper)", 0); 2770 #if !CYTHON_METH_FASTCALL 2771 #if CYTHON_ASSUME_SAFE_MACROS 2772 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); 2773 #else 2774 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL; 2775 #endif 2776 #endif 2777 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); 2778 { 2779 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_upper_bound,&__pyx_n_s_ctn_degree,0}; 2780 if (__pyx_kwds) { 2781 Py_ssize_t kw_args; 2782 switch (__pyx_nargs) { 2783 case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); 2784 CYTHON_FALLTHROUGH; 2785 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); 2786 CYTHON_FALLTHROUGH; 2787 case 0: break; 2788 default: goto __pyx_L5_argtuple_error; 2789 } 2790 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); 2791 switch (__pyx_nargs) { 2792 case 0: 2793 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_upper_bound)) != 0)) { 2794 (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); 2795 kw_args--; 2796 } 2797 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 11, __pyx_L3_error) 2798 else goto __pyx_L5_argtuple_error; 2799 CYTHON_FALLTHROUGH; 2800 case 1: 2801 if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ctn_degree)) != 0)) { 2802 (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); 2803 kw_args--; 2804 } 2805 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 11, __pyx_L3_error) 2806 else { 2807 __Pyx_RaiseArgtupleInvalid("search", 1, 2, 2, 1); __PYX_ERR(0, 11, __pyx_L3_error) 2808 } 2809 } 2810 if (unlikely(kw_args > 0)) { 2811 const Py_ssize_t kwd_pos_args = __pyx_nargs; 2812 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "search") < 0)) __PYX_ERR(0, 11, __pyx_L3_error) 2813 } 2814 } else if (unlikely(__pyx_nargs != 2)) { 2815 goto __pyx_L5_argtuple_error; 2816 } else { 2817 values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); 2818 values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); 2819 } 2820 __pyx_v_upper_bound = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_upper_bound == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 11, __pyx_L3_error) 2821 __pyx_v_ctn_degree = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_ctn_degree == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 11, __pyx_L3_error) 2822 } 2823 goto __pyx_L6_skip; 2824 __pyx_L5_argtuple_error:; 2825 __Pyx_RaiseArgtupleInvalid("search", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 11, __pyx_L3_error) 2826 __pyx_L6_skip:; 2827 goto __pyx_L4_argument_unpacking_done; 2828 __pyx_L3_error:; 2829 { 2830 Py_ssize_t __pyx_temp; 2831 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { 2832 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); 2833 } 2834 } 2835 __Pyx_AddTraceback("search.search", __pyx_clineno, __pyx_lineno, __pyx_filename); 2836 __Pyx_RefNannyFinishContext(); 2837 return NULL; 2838 __pyx_L4_argument_unpacking_done:; 2839 __pyx_r = __pyx_pf_6search_2search(__pyx_self, __pyx_v_upper_bound, __pyx_v_ctn_degree); 2840 2841 /* function exit code */ 2842 { 2843 Py_ssize_t __pyx_temp; 2844 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { 2845 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); 2846 } 2847 } 2848 __Pyx_RefNannyFinishContext(); 2849 return __pyx_r; 2850} 2851 2852static PyObject *__pyx_pf_6search_2search(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_upper_bound, int __pyx_v_ctn_degree) { 2853 PyObject *__pyx_v_ctn = 0; 2854 PyObject *__pyx_v_a = NULL; 2855 PyObject *__pyx_v_b = NULL; 2856 PyObject *__pyx_v_l = 0; 2857 PyObject *__pyx_v_r = 0; 2858 PyObject *__pyx_v_head = 0; 2859 PyObject *__pyx_v_read = 0; 2860 PyObject *__pyx_v_l_body = 0; 2861 PyObject *__pyx_v_r_body = 0; 2862 size_t __pyx_v_llen; 2863 size_t __pyx_v_rlen; 2864 PyObject *__pyx_v_body = 0; 2865 PyObject *__pyx_v_fw = 0; 2866 PyObject *__pyx_v_bw = 0; 2867 size_t __pyx_v_ones; 2868 PyObject *__pyx_r = NULL; 2869 __Pyx_RefNannyDeclarations 2870 PyObject *__pyx_t_1 = NULL; 2871 PyObject *__pyx_t_2 = NULL; 2872 Py_ssize_t __pyx_t_3; 2873 PyObject *(*__pyx_t_4)(PyObject *); 2874 int __pyx_t_5; 2875 PyObject *__pyx_t_6 = NULL; 2876 PyObject *__pyx_t_7 = NULL; 2877 PyObject *__pyx_t_8 = NULL; 2878 int __pyx_t_9; 2879 Py_ssize_t __pyx_t_10; 2880 PyObject *(*__pyx_t_11)(PyObject *); 2881 PyObject *__pyx_t_12 = NULL; 2882 Py_ssize_t __pyx_t_13; 2883 int __pyx_t_14; 2884 int __pyx_t_15; 2885 Py_ssize_t __pyx_t_16; 2886 int __pyx_lineno = 0; 2887 const char *__pyx_filename = NULL; 2888 int __pyx_clineno = 0; 2889 __Pyx_RefNannySetupContext("search", 1); 2890 2891 /* "search.pyx":12 2892 * 2893 * def search(upper_bound: cython.int, ctn_degree: cython.int) -> set[cython.int]: 2894 * ctn: set[tuple] = set() # <<<<<<<<<<<<<< 2895 * for a in range(1, upper_bound + 1, 2): 2896 * for b in range(1, min(upper_bound, a) + 1, 2): 2897 */ 2898 __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __pyx_L1_error) 2899 __Pyx_GOTREF(__pyx_t_1); 2900 __pyx_v_ctn = ((PyObject*)__pyx_t_1); 2901 __pyx_t_1 = 0; 2902 2903 /* "search.pyx":13 2904 * def search(upper_bound: cython.int, ctn_degree: cython.int) -> set[cython.int]: 2905 * ctn: set[tuple] = set() 2906 * for a in range(1, upper_bound + 1, 2): # <<<<<<<<<<<<<< 2907 * for b in range(1, min(upper_bound, a) + 1, 2): 2908 * if gcd(a, b) != 1: 2909 */ 2910 __pyx_t_1 = __Pyx_PyInt_From_long((__pyx_v_upper_bound + 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error) 2911 __Pyx_GOTREF(__pyx_t_1); 2912 __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error) 2913 __Pyx_GOTREF(__pyx_t_2); 2914 __Pyx_INCREF(__pyx_int_1); 2915 __Pyx_GIVEREF(__pyx_int_1); 2916 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_1)) __PYX_ERR(0, 13, __pyx_L1_error); 2917 __Pyx_GIVEREF(__pyx_t_1); 2918 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error); 2919 __Pyx_INCREF(__pyx_int_2); 2920 __Pyx_GIVEREF(__pyx_int_2); 2921 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_int_2)) __PYX_ERR(0, 13, __pyx_L1_error); 2922 __pyx_t_1 = 0; 2923 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error) 2924 __Pyx_GOTREF(__pyx_t_1); 2925 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; 2926 if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { 2927 __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); 2928 __pyx_t_3 = 0; 2929 __pyx_t_4 = NULL; 2930 } else { 2931 __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error) 2932 __Pyx_GOTREF(__pyx_t_2); 2933 __pyx_t_4 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 13, __pyx_L1_error) 2934 } 2935 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; 2936 for (;;) { 2937 if (likely(!__pyx_t_4)) { 2938 if (likely(PyList_CheckExact(__pyx_t_2))) { 2939 { 2940 Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); 2941 #if !CYTHON_ASSUME_SAFE_MACROS 2942 if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 13, __pyx_L1_error) 2943 #endif 2944 if (__pyx_t_3 >= __pyx_temp) break; 2945 } 2946 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS 2947 __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely((0 < 0))) __PYX_ERR(0, 13, __pyx_L1_error) 2948 #else 2949 __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error) 2950 __Pyx_GOTREF(__pyx_t_1); 2951 #endif 2952 } else { 2953 { 2954 Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); 2955 #if !CYTHON_ASSUME_SAFE_MACROS 2956 if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 13, __pyx_L1_error) 2957 #endif 2958 if (__pyx_t_3 >= __pyx_temp) break; 2959 } 2960 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS 2961 __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely((0 < 0))) __PYX_ERR(0, 13, __pyx_L1_error) 2962 #else 2963 __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error) 2964 __Pyx_GOTREF(__pyx_t_1); 2965 #endif 2966 } 2967 } else { 2968 __pyx_t_1 = __pyx_t_4(__pyx_t_2); 2969 if (unlikely(!__pyx_t_1)) { 2970 PyObject* exc_type = PyErr_Occurred(); 2971 if (exc_type) { 2972 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); 2973 else __PYX_ERR(0, 13, __pyx_L1_error) 2974 } 2975 break; 2976 } 2977 __Pyx_GOTREF(__pyx_t_1); 2978 } 2979 __Pyx_XDECREF_SET(__pyx_v_a, __pyx_t_1); 2980 __pyx_t_1 = 0; 2981 2982 /* "search.pyx":14 2983 * ctn: set[tuple] = set() 2984 * for a in range(1, upper_bound + 1, 2): 2985 * for b in range(1, min(upper_bound, a) + 1, 2): # <<<<<<<<<<<<<< 2986 * if gcd(a, b) != 1: 2987 * continue 2988 */ 2989 __Pyx_INCREF(__pyx_v_a); 2990 __pyx_t_1 = __pyx_v_a; 2991 __pyx_t_5 = __pyx_v_upper_bound; 2992 __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 14, __pyx_L1_error) 2993 __Pyx_GOTREF(__pyx_t_7); 2994 __pyx_t_8 = PyObject_RichCompare(__pyx_t_1, __pyx_t_7, Py_LT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 14, __pyx_L1_error) 2995 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; 2996 __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 14, __pyx_L1_error) 2997 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; 2998 if (__pyx_t_9) { 2999 __Pyx_INCREF(__pyx_t_1); 3000 __pyx_t_6 = __pyx_t_1; 3001 } else { 3002 __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 14, __pyx_L1_error) 3003 __Pyx_GOTREF(__pyx_t_8); 3004 __pyx_t_6 = __pyx_t_8; 3005 __pyx_t_8 = 0; 3006 } 3007 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; 3008 __pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_t_6, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error) 3009 __Pyx_GOTREF(__pyx_t_1); 3010 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; 3011 __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 14, __pyx_L1_error) 3012 __Pyx_GOTREF(__pyx_t_6); 3013 __Pyx_INCREF(__pyx_int_1); 3014 __Pyx_GIVEREF(__pyx_int_1); 3015 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_int_1)) __PYX_ERR(0, 14, __pyx_L1_error); 3016 __Pyx_GIVEREF(__pyx_t_1); 3017 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error); 3018 __Pyx_INCREF(__pyx_int_2); 3019 __Pyx_GIVEREF(__pyx_int_2); 3020 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_int_2)) __PYX_ERR(0, 14, __pyx_L1_error); 3021 __pyx_t_1 = 0; 3022 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error) 3023 __Pyx_GOTREF(__pyx_t_1); 3024 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; 3025 if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { 3026 __pyx_t_6 = __pyx_t_1; __Pyx_INCREF(__pyx_t_6); 3027 __pyx_t_10 = 0; 3028 __pyx_t_11 = NULL; 3029 } else { 3030 __pyx_t_10 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 14, __pyx_L1_error) 3031 __Pyx_GOTREF(__pyx_t_6); 3032 __pyx_t_11 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 14, __pyx_L1_error) 3033 } 3034 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; 3035 for (;;) { 3036 if (likely(!__pyx_t_11)) { 3037 if (likely(PyList_CheckExact(__pyx_t_6))) { 3038 { 3039 Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6); 3040 #if !CYTHON_ASSUME_SAFE_MACROS 3041 if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 14, __pyx_L1_error) 3042 #endif 3043 if (__pyx_t_10 >= __pyx_temp) break; 3044 } 3045 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS 3046 __pyx_t_1 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_10); __Pyx_INCREF(__pyx_t_1); __pyx_t_10++; if (unlikely((0 < 0))) __PYX_ERR(0, 14, __pyx_L1_error) 3047 #else 3048 __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error) 3049 __Pyx_GOTREF(__pyx_t_1); 3050 #endif 3051 } else { 3052 { 3053 Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6); 3054 #if !CYTHON_ASSUME_SAFE_MACROS 3055 if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 14, __pyx_L1_error) 3056 #endif 3057 if (__pyx_t_10 >= __pyx_temp) break; 3058 } 3059 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS 3060 __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_10); __Pyx_INCREF(__pyx_t_1); __pyx_t_10++; if (unlikely((0 < 0))) __PYX_ERR(0, 14, __pyx_L1_error) 3061 #else 3062 __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error) 3063 __Pyx_GOTREF(__pyx_t_1); 3064 #endif 3065 } 3066 } else { 3067 __pyx_t_1 = __pyx_t_11(__pyx_t_6); 3068 if (unlikely(!__pyx_t_1)) { 3069 PyObject* exc_type = PyErr_Occurred(); 3070 if (exc_type) { 3071 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); 3072 else __PYX_ERR(0, 14, __pyx_L1_error) 3073 } 3074 break; 3075 } 3076 __Pyx_GOTREF(__pyx_t_1); 3077 } 3078 __Pyx_XDECREF_SET(__pyx_v_b, __pyx_t_1); 3079 __pyx_t_1 = 0; 3080 3081 /* "search.pyx":15 3082 * for a in range(1, upper_bound + 1, 2): 3083 * for b in range(1, min(upper_bound, a) + 1, 2): 3084 * if gcd(a, b) != 1: # <<<<<<<<<<<<<< 3085 * continue 3086 * l: list[cython.int] = F(2 * a, b) 3087 */ 3088 __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_gcd); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 15, __pyx_L1_error) 3089 __Pyx_GOTREF(__pyx_t_8); 3090 __pyx_t_7 = NULL; 3091 __pyx_t_5 = 0; 3092 #if CYTHON_UNPACK_METHODS 3093 if (unlikely(PyMethod_Check(__pyx_t_8))) { 3094 __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8); 3095 if (likely(__pyx_t_7)) { 3096 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); 3097 __Pyx_INCREF(__pyx_t_7); 3098 __Pyx_INCREF(function); 3099 __Pyx_DECREF_SET(__pyx_t_8, function); 3100 __pyx_t_5 = 1; 3101 } 3102 } 3103 #endif 3104 { 3105 PyObject *__pyx_callargs[3] = {__pyx_t_7, __pyx_v_a, __pyx_v_b}; 3106 __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_5, 2+__pyx_t_5); 3107 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; 3108 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error) 3109 __Pyx_GOTREF(__pyx_t_1); 3110 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; 3111 } 3112 __pyx_t_9 = (__Pyx_PyInt_BoolNeObjC(__pyx_t_1, __pyx_int_1, 1, 0)); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 15, __pyx_L1_error) 3113 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; 3114 if (__pyx_t_9) { 3115 3116 /* "search.pyx":16 3117 * for b in range(1, min(upper_bound, a) + 1, 2): 3118 * if gcd(a, b) != 1: 3119 * continue # <<<<<<<<<<<<<< 3120 * l: list[cython.int] = F(2 * a, b) 3121 * r: list[cython.int] = F(2 * b, a) 3122 */ 3123 goto __pyx_L5_continue; 3124 3125 /* "search.pyx":15 3126 * for a in range(1, upper_bound + 1, 2): 3127 * for b in range(1, min(upper_bound, a) + 1, 2): 3128 * if gcd(a, b) != 1: # <<<<<<<<<<<<<< 3129 * continue 3130 * l: list[cython.int] = F(2 * a, b) 3131 */ 3132 } 3133 3134 /* "search.pyx":17 3135 * if gcd(a, b) != 1: 3136 * continue 3137 * l: list[cython.int] = F(2 * a, b) # <<<<<<<<<<<<<< 3138 * r: list[cython.int] = F(2 * b, a) 3139 * head: list[cython.int] = [a, b] 3140 */ 3141 __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_F); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 17, __pyx_L1_error) 3142 __Pyx_GOTREF(__pyx_t_8); 3143 __pyx_t_7 = __Pyx_PyInt_MultiplyCObj(__pyx_int_2, __pyx_v_a, 2, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 17, __pyx_L1_error) 3144 __Pyx_GOTREF(__pyx_t_7); 3145 __pyx_t_12 = NULL; 3146 __pyx_t_5 = 0; 3147 #if CYTHON_UNPACK_METHODS 3148 if (unlikely(PyMethod_Check(__pyx_t_8))) { 3149 __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_8); 3150 if (likely(__pyx_t_12)) { 3151 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); 3152 __Pyx_INCREF(__pyx_t_12); 3153 __Pyx_INCREF(function); 3154 __Pyx_DECREF_SET(__pyx_t_8, function); 3155 __pyx_t_5 = 1; 3156 } 3157 } 3158 #endif 3159 { 3160 PyObject *__pyx_callargs[3] = {__pyx_t_12, __pyx_t_7, __pyx_v_b}; 3161 __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_5, 2+__pyx_t_5); 3162 __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; 3163 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; 3164 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error) 3165 __Pyx_GOTREF(__pyx_t_1); 3166 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; 3167 } 3168 if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("list", __pyx_t_1))) __PYX_ERR(0, 17, __pyx_L1_error) 3169 __Pyx_XDECREF_SET(__pyx_v_l, ((PyObject*)__pyx_t_1)); 3170 __pyx_t_1 = 0; 3171 3172 /* "search.pyx":18 3173 * continue 3174 * l: list[cython.int] = F(2 * a, b) 3175 * r: list[cython.int] = F(2 * b, a) # <<<<<<<<<<<<<< 3176 * head: list[cython.int] = [a, b] 3177 * read: list[cython.int] = [b, a] 3178 */ 3179 __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_F); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 18, __pyx_L1_error) 3180 __Pyx_GOTREF(__pyx_t_8); 3181 __pyx_t_7 = __Pyx_PyInt_MultiplyCObj(__pyx_int_2, __pyx_v_b, 2, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 18, __pyx_L1_error) 3182 __Pyx_GOTREF(__pyx_t_7); 3183 __pyx_t_12 = NULL; 3184 __pyx_t_5 = 0; 3185 #if CYTHON_UNPACK_METHODS 3186 if (unlikely(PyMethod_Check(__pyx_t_8))) { 3187 __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_8); 3188 if (likely(__pyx_t_12)) { 3189 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); 3190 __Pyx_INCREF(__pyx_t_12); 3191 __Pyx_INCREF(function); 3192 __Pyx_DECREF_SET(__pyx_t_8, function); 3193 __pyx_t_5 = 1; 3194 } 3195 } 3196 #endif 3197 { 3198 PyObject *__pyx_callargs[3] = {__pyx_t_12, __pyx_t_7, __pyx_v_a}; 3199 __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+1-__pyx_t_5, 2+__pyx_t_5); 3200 __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; 3201 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; 3202 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error) 3203 __Pyx_GOTREF(__pyx_t_1); 3204 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; 3205 } 3206 if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("list", __pyx_t_1))) __PYX_ERR(0, 18, __pyx_L1_error) 3207 __Pyx_XDECREF_SET(__pyx_v_r, ((PyObject*)__pyx_t_1)); 3208 __pyx_t_1 = 0; 3209 3210 /* "search.pyx":19 3211 * l: list[cython.int] = F(2 * a, b) 3212 * r: list[cython.int] = F(2 * b, a) 3213 * head: list[cython.int] = [a, b] # <<<<<<<<<<<<<< 3214 * read: list[cython.int] = [b, a] 3215 * l_body: list[cython.int] = l[2:] 3216 */ 3217 __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error) 3218 __Pyx_GOTREF(__pyx_t_1); 3219 __Pyx_INCREF(__pyx_v_a); 3220 __Pyx_GIVEREF(__pyx_v_a); 3221 if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_a)) __PYX_ERR(0, 19, __pyx_L1_error); 3222 __Pyx_INCREF(__pyx_v_b); 3223 __Pyx_GIVEREF(__pyx_v_b); 3224 if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 1, __pyx_v_b)) __PYX_ERR(0, 19, __pyx_L1_error); 3225 __Pyx_XDECREF_SET(__pyx_v_head, ((PyObject*)__pyx_t_1)); 3226 __pyx_t_1 = 0; 3227 3228 /* "search.pyx":20 3229 * r: list[cython.int] = F(2 * b, a) 3230 * head: list[cython.int] = [a, b] 3231 * read: list[cython.int] = [b, a] # <<<<<<<<<<<<<< 3232 * l_body: list[cython.int] = l[2:] 3233 * r_body: list[cython.int] = r[2:][::-1] 3234 */ 3235 __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) 3236 __Pyx_GOTREF(__pyx_t_1); 3237 __Pyx_INCREF(__pyx_v_b); 3238 __Pyx_GIVEREF(__pyx_v_b); 3239 if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_b)) __PYX_ERR(0, 20, __pyx_L1_error); 3240 __Pyx_INCREF(__pyx_v_a); 3241 __Pyx_GIVEREF(__pyx_v_a); 3242 if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 1, __pyx_v_a)) __PYX_ERR(0, 20, __pyx_L1_error); 3243 __Pyx_XDECREF_SET(__pyx_v_read, ((PyObject*)__pyx_t_1)); 3244 __pyx_t_1 = 0; 3245 3246 /* "search.pyx":21 3247 * head: list[cython.int] = [a, b] 3248 * read: list[cython.int] = [b, a] 3249 * l_body: list[cython.int] = l[2:] # <<<<<<<<<<<<<< 3250 * r_body: list[cython.int] = r[2:][::-1] 3251 * llen: cython.size_t = len(l_body) 3252 */ 3253 if (unlikely(__pyx_v_l == Py_None)) { 3254 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); 3255 __PYX_ERR(0, 21, __pyx_L1_error) 3256 } 3257 __pyx_t_1 = __Pyx_PyList_GetSlice(__pyx_v_l, 2, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 21, __pyx_L1_error) 3258 __Pyx_GOTREF(__pyx_t_1); 3259 __Pyx_XDECREF_SET(__pyx_v_l_body, ((PyObject*)__pyx_t_1)); 3260 __pyx_t_1 = 0; 3261 3262 /* "search.pyx":22 3263 * read: list[cython.int] = [b, a] 3264 * l_body: list[cython.int] = l[2:] 3265 * r_body: list[cython.int] = r[2:][::-1] # <<<<<<<<<<<<<< 3266 * llen: cython.size_t = len(l_body) 3267 * rlen: cython.size_t = len(r_body) 3268 */ 3269 if (unlikely(__pyx_v_r == Py_None)) { 3270 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); 3271 __PYX_ERR(0, 22, __pyx_L1_error) 3272 } 3273 __pyx_t_1 = __Pyx_PyList_GetSlice(__pyx_v_r, 2, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error) 3274 __Pyx_GOTREF(__pyx_t_1); 3275 __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_slice_); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 22, __pyx_L1_error) 3276 __Pyx_GOTREF(__pyx_t_8); 3277 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; 3278 __Pyx_XDECREF_SET(__pyx_v_r_body, ((PyObject*)__pyx_t_8)); 3279 __pyx_t_8 = 0; 3280 3281 /* "search.pyx":23 3282 * l_body: list[cython.int] = l[2:] 3283 * r_body: list[cython.int] = r[2:][::-1] 3284 * llen: cython.size_t = len(l_body) # <<<<<<<<<<<<<< 3285 * rlen: cython.size_t = len(r_body) 3286 * # insert at 2 if possible 3287 */ 3288 __pyx_t_13 = __Pyx_PyList_GET_SIZE(__pyx_v_l_body); if (unlikely(__pyx_t_13 == ((Py_ssize_t)-1))) __PYX_ERR(0, 23, __pyx_L1_error) 3289 __pyx_v_llen = __pyx_t_13; 3290 3291 /* "search.pyx":24 3292 * r_body: list[cython.int] = r[2:][::-1] 3293 * llen: cython.size_t = len(l_body) 3294 * rlen: cython.size_t = len(r_body) # <<<<<<<<<<<<<< 3295 * # insert at 2 if possible 3296 * if l[-2] == 2 and llen - 1 + rlen == ctn_degree: 3297 */ 3298 __pyx_t_13 = __Pyx_PyList_GET_SIZE(__pyx_v_r_body); if (unlikely(__pyx_t_13 == ((Py_ssize_t)-1))) __PYX_ERR(0, 24, __pyx_L1_error) 3299 __pyx_v_rlen = __pyx_t_13; 3300 3301 /* "search.pyx":26 3302 * rlen: cython.size_t = len(r_body) 3303 * # insert at 2 if possible 3304 * if l[-2] == 2 and llen - 1 + rlen == ctn_degree: # <<<<<<<<<<<<<< 3305 * body: list[cython.int] = l_body[:-1] + r_body[2:] 3306 * fw: list[cython.int] = head + body 3307 */ 3308 if (unlikely(__pyx_v_l == Py_None)) { 3309 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); 3310 __PYX_ERR(0, 26, __pyx_L1_error) 3311 } 3312 __pyx_t_8 = __Pyx_GetItemInt_List(__pyx_v_l, -2L, long, 1, __Pyx_PyInt_From_long, 1, 1, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 26, __pyx_L1_error) 3313 __Pyx_GOTREF(__pyx_t_8); 3314 __pyx_t_14 = (__Pyx_PyInt_BoolEqObjC(__pyx_t_8, __pyx_int_2, 2, 0)); if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(0, 26, __pyx_L1_error) 3315 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; 3316 if (__pyx_t_14) { 3317 } else { 3318 __pyx_t_9 = __pyx_t_14; 3319 goto __pyx_L9_bool_binop_done; 3320 } 3321 __pyx_t_14 = (((__pyx_v_llen - 1) + __pyx_v_rlen) == __pyx_v_ctn_degree); 3322 __pyx_t_9 = __pyx_t_14; 3323 __pyx_L9_bool_binop_done:; 3324 if (__pyx_t_9) { 3325 3326 /* "search.pyx":27 3327 * # insert at 2 if possible 3328 * if l[-2] == 2 and llen - 1 + rlen == ctn_degree: 3329 * body: list[cython.int] = l_body[:-1] + r_body[2:] # <<<<<<<<<<<<<< 3330 * fw: list[cython.int] = head + body 3331 * bw: list[cython.int] = read + body[::-1] 3332 */ 3333 __pyx_t_8 = __Pyx_PyList_GetSlice(__pyx_v_l_body, 0, -1L); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 27, __pyx_L1_error) 3334 __Pyx_GOTREF(__pyx_t_8); 3335 __pyx_t_1 = __Pyx_PyList_GetSlice(__pyx_v_r_body, 2, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 27, __pyx_L1_error) 3336 __Pyx_GOTREF(__pyx_t_1); 3337 __pyx_t_7 = PyNumber_Add(__pyx_t_8, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 27, __pyx_L1_error) 3338 __Pyx_GOTREF(__pyx_t_7); 3339 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; 3340 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; 3341 __Pyx_XDECREF_SET(__pyx_v_body, ((PyObject*)__pyx_t_7)); 3342 __pyx_t_7 = 0; 3343 3344 /* "search.pyx":28 3345 * if l[-2] == 2 and llen - 1 + rlen == ctn_degree: 3346 * body: list[cython.int] = l_body[:-1] + r_body[2:] 3347 * fw: list[cython.int] = head + body # <<<<<<<<<<<<<< 3348 * bw: list[cython.int] = read + body[::-1] 3349 * ctn.add(tuple(fw)) 3350 */ 3351 __pyx_t_7 = PyNumber_Add(__pyx_v_head, __pyx_v_body); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 28, __pyx_L1_error) 3352 __Pyx_GOTREF(__pyx_t_7); 3353 __Pyx_XDECREF_SET(__pyx_v_fw, ((PyObject*)__pyx_t_7)); 3354 __pyx_t_7 = 0; 3355 3356 /* "search.pyx":29 3357 * body: list[cython.int] = l_body[:-1] + r_body[2:] 3358 * fw: list[cython.int] = head + body 3359 * bw: list[cython.int] = read + body[::-1] # <<<<<<<<<<<<<< 3360 * ctn.add(tuple(fw)) 3361 * ctn.add(tuple(bw)) 3362 */ 3363 __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_body, __pyx_slice_); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 29, __pyx_L1_error) 3364 __Pyx_GOTREF(__pyx_t_7); 3365 __pyx_t_1 = PyNumber_Add(__pyx_v_read, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error) 3366 __Pyx_GOTREF(__pyx_t_1); 3367 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; 3368 __Pyx_XDECREF_SET(__pyx_v_bw, ((PyObject*)__pyx_t_1)); 3369 __pyx_t_1 = 0; 3370 3371 /* "search.pyx":30 3372 * fw: list[cython.int] = head + body 3373 * bw: list[cython.int] = read + body[::-1] 3374 * ctn.add(tuple(fw)) # <<<<<<<<<<<<<< 3375 * ctn.add(tuple(bw)) 3376 * 3377 */ 3378 __pyx_t_1 = PyList_AsTuple(__pyx_v_fw); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 30, __pyx_L1_error) 3379 __Pyx_GOTREF(__pyx_t_1); 3380 __pyx_t_15 = PySet_Add(__pyx_v_ctn, __pyx_t_1); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 30, __pyx_L1_error) 3381 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; 3382 3383 /* "search.pyx":31 3384 * bw: list[cython.int] = read + body[::-1] 3385 * ctn.add(tuple(fw)) 3386 * ctn.add(tuple(bw)) # <<<<<<<<<<<<<< 3387 * 3388 * # insert without one 1 if possible 3389 */ 3390 __pyx_t_1 = PyList_AsTuple(__pyx_v_bw); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 31, __pyx_L1_error) 3391 __Pyx_GOTREF(__pyx_t_1); 3392 __pyx_t_15 = PySet_Add(__pyx_v_ctn, __pyx_t_1); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 31, __pyx_L1_error) 3393 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; 3394 3395 /* "search.pyx":26 3396 * rlen: cython.size_t = len(r_body) 3397 * # insert at 2 if possible 3398 * if l[-2] == 2 and llen - 1 + rlen == ctn_degree: # <<<<<<<<<<<<<< 3399 * body: list[cython.int] = l_body[:-1] + r_body[2:] 3400 * fw: list[cython.int] = head + body 3401 */ 3402 } 3403 3404 /* "search.pyx":34 3405 * 3406 * # insert without one 1 if possible 3407 * if llen + rlen + 1 == ctn_degree: # <<<<<<<<<<<<<< 3408 * body: list[cython.int] = l_body[:-1] + r_body 3409 * fw: list[cython.int] = head + body 3410 */ 3411 __pyx_t_9 = (((__pyx_v_llen + __pyx_v_rlen) + 1) == __pyx_v_ctn_degree); 3412 if (__pyx_t_9) { 3413 3414 /* "search.pyx":35 3415 * # insert without one 1 if possible 3416 * if llen + rlen + 1 == ctn_degree: 3417 * body: list[cython.int] = l_body[:-1] + r_body # <<<<<<<<<<<<<< 3418 * fw: list[cython.int] = head + body 3419 * bw: list[cython.int] = read + body[::-1] 3420 */ 3421 __pyx_t_1 = __Pyx_PyList_GetSlice(__pyx_v_l_body, 0, -1L); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 35, __pyx_L1_error) 3422 __Pyx_GOTREF(__pyx_t_1); 3423 __pyx_t_7 = PyNumber_Add(__pyx_t_1, __pyx_v_r_body); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 35, __pyx_L1_error) 3424 __Pyx_GOTREF(__pyx_t_7); 3425 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; 3426 __Pyx_XDECREF_SET(__pyx_v_body, ((PyObject*)__pyx_t_7)); 3427 __pyx_t_7 = 0; 3428 3429 /* "search.pyx":36 3430 * if llen + rlen + 1 == ctn_degree: 3431 * body: list[cython.int] = l_body[:-1] + r_body 3432 * fw: list[cython.int] = head + body # <<<<<<<<<<<<<< 3433 * bw: list[cython.int] = read + body[::-1] 3434 * ctn.add(tuple(fw)) 3435 */ 3436 __pyx_t_7 = PyNumber_Add(__pyx_v_head, __pyx_v_body); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 36, __pyx_L1_error) 3437 __Pyx_GOTREF(__pyx_t_7); 3438 __Pyx_XDECREF_SET(__pyx_v_fw, ((PyObject*)__pyx_t_7)); 3439 __pyx_t_7 = 0; 3440 3441 /* "search.pyx":37 3442 * body: list[cython.int] = l_body[:-1] + r_body 3443 * fw: list[cython.int] = head + body 3444 * bw: list[cython.int] = read + body[::-1] # <<<<<<<<<<<<<< 3445 * ctn.add(tuple(fw)) 3446 * ctn.add(tuple(bw)) 3447 */ 3448 __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_body, __pyx_slice_); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 37, __pyx_L1_error) 3449 __Pyx_GOTREF(__pyx_t_7); 3450 __pyx_t_1 = PyNumber_Add(__pyx_v_read, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 37, __pyx_L1_error) 3451 __Pyx_GOTREF(__pyx_t_1); 3452 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; 3453 __Pyx_XDECREF_SET(__pyx_v_bw, ((PyObject*)__pyx_t_1)); 3454 __pyx_t_1 = 0; 3455 3456 /* "search.pyx":38 3457 * fw: list[cython.int] = head + body 3458 * bw: list[cython.int] = read + body[::-1] 3459 * ctn.add(tuple(fw)) # <<<<<<<<<<<<<< 3460 * ctn.add(tuple(bw)) 3461 * 3462 */ 3463 __pyx_t_1 = PyList_AsTuple(__pyx_v_fw); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error) 3464 __Pyx_GOTREF(__pyx_t_1); 3465 __pyx_t_15 = PySet_Add(__pyx_v_ctn, __pyx_t_1); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 38, __pyx_L1_error) 3466 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; 3467 3468 /* "search.pyx":39 3469 * bw: list[cython.int] = read + body[::-1] 3470 * ctn.add(tuple(fw)) 3471 * ctn.add(tuple(bw)) # <<<<<<<<<<<<<< 3472 * 3473 * # insert with both ones if possible 3474 */ 3475 __pyx_t_1 = PyList_AsTuple(__pyx_v_bw); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 39, __pyx_L1_error) 3476 __Pyx_GOTREF(__pyx_t_1); 3477 __pyx_t_15 = PySet_Add(__pyx_v_ctn, __pyx_t_1); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 39, __pyx_L1_error) 3478 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; 3479 3480 /* "search.pyx":34 3481 * 3482 * # insert without one 1 if possible 3483 * if llen + rlen + 1 == ctn_degree: # <<<<<<<<<<<<<< 3484 * body: list[cython.int] = l_body[:-1] + r_body 3485 * fw: list[cython.int] = head + body 3486 */ 3487 } 3488 3489 /* "search.pyx":42 3490 * 3491 * # insert with both ones if possible 3492 * if llen + rlen + 2 == ctn_degree: # <<<<<<<<<<<<<< 3493 * body: list[cython.int] = l_body + r_body 3494 * fw: list[cython.int] = head + body 3495 */ 3496 __pyx_t_9 = (((__pyx_v_llen + __pyx_v_rlen) + 2) == __pyx_v_ctn_degree); 3497 if (__pyx_t_9) { 3498 3499 /* "search.pyx":43 3500 * # insert with both ones if possible 3501 * if llen + rlen + 2 == ctn_degree: 3502 * body: list[cython.int] = l_body + r_body # <<<<<<<<<<<<<< 3503 * fw: list[cython.int] = head + body 3504 * bw: list[cython.int] = read + body[::-1] 3505 */ 3506 __pyx_t_1 = PyNumber_Add(__pyx_v_l_body, __pyx_v_r_body); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 43, __pyx_L1_error) 3507 __Pyx_GOTREF(__pyx_t_1); 3508 __Pyx_XDECREF_SET(__pyx_v_body, ((PyObject*)__pyx_t_1)); 3509 __pyx_t_1 = 0; 3510 3511 /* "search.pyx":44 3512 * if llen + rlen + 2 == ctn_degree: 3513 * body: list[cython.int] = l_body + r_body 3514 * fw: list[cython.int] = head + body # <<<<<<<<<<<<<< 3515 * bw: list[cython.int] = read + body[::-1] 3516 * ctn.add(tuple(fw)) 3517 */ 3518 __pyx_t_1 = PyNumber_Add(__pyx_v_head, __pyx_v_body); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error) 3519 __Pyx_GOTREF(__pyx_t_1); 3520 __Pyx_XDECREF_SET(__pyx_v_fw, ((PyObject*)__pyx_t_1)); 3521 __pyx_t_1 = 0; 3522 3523 /* "search.pyx":45 3524 * body: list[cython.int] = l_body + r_body 3525 * fw: list[cython.int] = head + body 3526 * bw: list[cython.int] = read + body[::-1] # <<<<<<<<<<<<<< 3527 * ctn.add(tuple(fw)) 3528 * ctn.add(tuple(bw)) 3529 */ 3530 __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_body, __pyx_slice_); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error) 3531 __Pyx_GOTREF(__pyx_t_1); 3532 __pyx_t_7 = PyNumber_Add(__pyx_v_read, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 45, __pyx_L1_error) 3533 __Pyx_GOTREF(__pyx_t_7); 3534 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; 3535 __Pyx_XDECREF_SET(__pyx_v_bw, ((PyObject*)__pyx_t_7)); 3536 __pyx_t_7 = 0; 3537 3538 /* "search.pyx":46 3539 * fw: list[cython.int] = head + body 3540 * bw: list[cython.int] = read + body[::-1] 3541 * ctn.add(tuple(fw)) # <<<<<<<<<<<<<< 3542 * ctn.add(tuple(bw)) 3543 * 3544 */ 3545 __pyx_t_7 = PyList_AsTuple(__pyx_v_fw); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 46, __pyx_L1_error) 3546 __Pyx_GOTREF(__pyx_t_7); 3547 __pyx_t_15 = PySet_Add(__pyx_v_ctn, __pyx_t_7); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 46, __pyx_L1_error) 3548 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; 3549 3550 /* "search.pyx":47 3551 * bw: list[cython.int] = read + body[::-1] 3552 * ctn.add(tuple(fw)) 3553 * ctn.add(tuple(bw)) # <<<<<<<<<<<<<< 3554 * 3555 * elif llen + rlen + 2 < ctn_degree: 3556 */ 3557 __pyx_t_7 = PyList_AsTuple(__pyx_v_bw); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 47, __pyx_L1_error) 3558 __Pyx_GOTREF(__pyx_t_7); 3559 __pyx_t_15 = PySet_Add(__pyx_v_ctn, __pyx_t_7); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 47, __pyx_L1_error) 3560 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; 3561 3562 /* "search.pyx":42 3563 * 3564 * # insert with both ones if possible 3565 * if llen + rlen + 2 == ctn_degree: # <<<<<<<<<<<<<< 3566 * body: list[cython.int] = l_body + r_body 3567 * fw: list[cython.int] = head + body 3568 */ 3569 goto __pyx_L12; 3570 } 3571 3572 /* "search.pyx":49 3573 * ctn.add(tuple(bw)) 3574 * 3575 * elif llen + rlen + 2 < ctn_degree: # <<<<<<<<<<<<<< 3576 * # add ones if possible 3577 * ones: cython.size_t = ctn_degree - (len(l_body) + len(r_body) + 2) 3578 */ 3579 __pyx_t_9 = (((__pyx_v_llen + __pyx_v_rlen) + 2) < __pyx_v_ctn_degree); 3580 if (__pyx_t_9) { 3581 3582 /* "search.pyx":51 3583 * elif llen + rlen + 2 < ctn_degree: 3584 * # add ones if possible 3585 * ones: cython.size_t = ctn_degree - (len(l_body) + len(r_body) + 2) # <<<<<<<<<<<<<< 3586 * body: list[cython.int] = l_body + ([1] * ones) + r_body 3587 * fw: list[cython.int] = head + body 3588 */ 3589 __pyx_t_13 = __Pyx_PyList_GET_SIZE(__pyx_v_l_body); if (unlikely(__pyx_t_13 == ((Py_ssize_t)-1))) __PYX_ERR(0, 51, __pyx_L1_error) 3590 __pyx_t_16 = __Pyx_PyList_GET_SIZE(__pyx_v_r_body); if (unlikely(__pyx_t_16 == ((Py_ssize_t)-1))) __PYX_ERR(0, 51, __pyx_L1_error) 3591 __pyx_v_ones = (__pyx_v_ctn_degree - ((__pyx_t_13 + __pyx_t_16) + 2)); 3592 3593 /* "search.pyx":52 3594 * # add ones if possible 3595 * ones: cython.size_t = ctn_degree - (len(l_body) + len(r_body) + 2) 3596 * body: list[cython.int] = l_body + ([1] * ones) + r_body # <<<<<<<<<<<<<< 3597 * fw: list[cython.int] = head + body 3598 * bw: list[cython.int] = read + body[::-1] 3599 */ 3600 __pyx_t_7 = PyList_New(1 * (__pyx_v_ones)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 52, __pyx_L1_error) 3601 __Pyx_GOTREF(__pyx_t_7); 3602 { Py_ssize_t __pyx_temp; 3603 for (__pyx_temp=0; __pyx_temp < __pyx_v_ones; __pyx_temp++) { 3604 __Pyx_INCREF(__pyx_int_1); 3605 __Pyx_GIVEREF(__pyx_int_1); 3606 if (__Pyx_PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_int_1)) __PYX_ERR(0, 52, __pyx_L1_error); 3607 } 3608 } 3609 __pyx_t_1 = PyNumber_Add(__pyx_v_l_body, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __pyx_L1_error) 3610 __Pyx_GOTREF(__pyx_t_1); 3611 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; 3612 __pyx_t_7 = PyNumber_Add(__pyx_t_1, __pyx_v_r_body); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 52, __pyx_L1_error) 3613 __Pyx_GOTREF(__pyx_t_7); 3614 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; 3615 __Pyx_XDECREF_SET(__pyx_v_body, ((PyObject*)__pyx_t_7)); 3616 __pyx_t_7 = 0; 3617 3618 /* "search.pyx":53 3619 * ones: cython.size_t = ctn_degree - (len(l_body) + len(r_body) + 2) 3620 * body: list[cython.int] = l_body + ([1] * ones) + r_body 3621 * fw: list[cython.int] = head + body # <<<<<<<<<<<<<< 3622 * bw: list[cython.int] = read + body[::-1] 3623 * ctn.add(tuple(fw)) 3624 */ 3625 __pyx_t_7 = PyNumber_Add(__pyx_v_head, __pyx_v_body); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 53, __pyx_L1_error) 3626 __Pyx_GOTREF(__pyx_t_7); 3627 __Pyx_XDECREF_SET(__pyx_v_fw, ((PyObject*)__pyx_t_7)); 3628 __pyx_t_7 = 0; 3629 3630 /* "search.pyx":54 3631 * body: list[cython.int] = l_body + ([1] * ones) + r_body 3632 * fw: list[cython.int] = head + body 3633 * bw: list[cython.int] = read + body[::-1] # <<<<<<<<<<<<<< 3634 * ctn.add(tuple(fw)) 3635 * ctn.add(tuple(bw)) 3636 */ 3637 __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_body, __pyx_slice_); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 54, __pyx_L1_error) 3638 __Pyx_GOTREF(__pyx_t_7); 3639 __pyx_t_1 = PyNumber_Add(__pyx_v_read, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 54, __pyx_L1_error) 3640 __Pyx_GOTREF(__pyx_t_1); 3641 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; 3642 __Pyx_XDECREF_SET(__pyx_v_bw, ((PyObject*)__pyx_t_1)); 3643 __pyx_t_1 = 0; 3644 3645 /* "search.pyx":55 3646 * fw: list[cython.int] = head + body 3647 * bw: list[cython.int] = read + body[::-1] 3648 * ctn.add(tuple(fw)) # <<<<<<<<<<<<<< 3649 * ctn.add(tuple(bw)) 3650 * return ctn 3651 */ 3652 __pyx_t_1 = PyList_AsTuple(__pyx_v_fw); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 55, __pyx_L1_error) 3653 __Pyx_GOTREF(__pyx_t_1); 3654 __pyx_t_15 = PySet_Add(__pyx_v_ctn, __pyx_t_1); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 55, __pyx_L1_error) 3655 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; 3656 3657 /* "search.pyx":56 3658 * bw: list[cython.int] = read + body[::-1] 3659 * ctn.add(tuple(fw)) 3660 * ctn.add(tuple(bw)) # <<<<<<<<<<<<<< 3661 * return ctn 3662 */ 3663 __pyx_t_1 = PyList_AsTuple(__pyx_v_bw); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error) 3664 __Pyx_GOTREF(__pyx_t_1); 3665 __pyx_t_15 = PySet_Add(__pyx_v_ctn, __pyx_t_1); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 56, __pyx_L1_error) 3666 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; 3667 3668 /* "search.pyx":49 3669 * ctn.add(tuple(bw)) 3670 * 3671 * elif llen + rlen + 2 < ctn_degree: # <<<<<<<<<<<<<< 3672 * # add ones if possible 3673 * ones: cython.size_t = ctn_degree - (len(l_body) + len(r_body) + 2) 3674 */ 3675 } 3676 __pyx_L12:; 3677 3678 /* "search.pyx":14 3679 * ctn: set[tuple] = set() 3680 * for a in range(1, upper_bound + 1, 2): 3681 * for b in range(1, min(upper_bound, a) + 1, 2): # <<<<<<<<<<<<<< 3682 * if gcd(a, b) != 1: 3683 * continue 3684 */ 3685 __pyx_L5_continue:; 3686 } 3687 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; 3688 3689 /* "search.pyx":13 3690 * def search(upper_bound: cython.int, ctn_degree: cython.int) -> set[cython.int]: 3691 * ctn: set[tuple] = set() 3692 * for a in range(1, upper_bound + 1, 2): # <<<<<<<<<<<<<< 3693 * for b in range(1, min(upper_bound, a) + 1, 2): 3694 * if gcd(a, b) != 1: 3695 */ 3696 } 3697 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; 3698 3699 /* "search.pyx":57 3700 * ctn.add(tuple(fw)) 3701 * ctn.add(tuple(bw)) 3702 * return ctn # <<<<<<<<<<<<<< 3703 */ 3704 __Pyx_XDECREF(__pyx_r); 3705 __Pyx_INCREF(__pyx_v_ctn); 3706 __pyx_r = __pyx_v_ctn; 3707 goto __pyx_L0; 3708 3709 /* "search.pyx":11 3710 * return sequence 3711 * 3712 * def search(upper_bound: cython.int, ctn_degree: cython.int) -> set[cython.int]: # <<<<<<<<<<<<<< 3713 * ctn: set[tuple] = set() 3714 * for a in range(1, upper_bound + 1, 2): 3715 */ 3716 3717 /* function exit code */ 3718 __pyx_L1_error:; 3719 __Pyx_XDECREF(__pyx_t_1); 3720 __Pyx_XDECREF(__pyx_t_2); 3721 __Pyx_XDECREF(__pyx_t_6); 3722 __Pyx_XDECREF(__pyx_t_7); 3723 __Pyx_XDECREF(__pyx_t_8); 3724 __Pyx_XDECREF(__pyx_t_12); 3725 __Pyx_AddTraceback("search.search", __pyx_clineno, __pyx_lineno, __pyx_filename); 3726 __pyx_r = NULL; 3727 __pyx_L0:; 3728 __Pyx_XDECREF(__pyx_v_ctn); 3729 __Pyx_XDECREF(__pyx_v_a); 3730 __Pyx_XDECREF(__pyx_v_b); 3731 __Pyx_XDECREF(__pyx_v_l); 3732 __Pyx_XDECREF(__pyx_v_r); 3733 __Pyx_XDECREF(__pyx_v_head); 3734 __Pyx_XDECREF(__pyx_v_read); 3735 __Pyx_XDECREF(__pyx_v_l_body); 3736 __Pyx_XDECREF(__pyx_v_r_body); 3737 __Pyx_XDECREF(__pyx_v_body); 3738 __Pyx_XDECREF(__pyx_v_fw); 3739 __Pyx_XDECREF(__pyx_v_bw); 3740 __Pyx_XGIVEREF(__pyx_r); 3741 __Pyx_RefNannyFinishContext(); 3742 return __pyx_r; 3743} 3744 3745static PyMethodDef __pyx_methods[] = { 3746 {0, 0, 0, 0} 3747}; 3748#ifndef CYTHON_SMALL_CODE 3749#if defined(__clang__) 3750 #define CYTHON_SMALL_CODE 3751#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) 3752 #define CYTHON_SMALL_CODE __attribute__((cold)) 3753#else 3754 #define CYTHON_SMALL_CODE 3755#endif 3756#endif 3757/* #### Code section: pystring_table ### */ 3758 3759static int __Pyx_CreateStringTabAndInitStrings(void) { 3760 __Pyx_StringTabEntry __pyx_string_tab[] = { 3761 {&__pyx_n_s_F, __pyx_k_F, sizeof(__pyx_k_F), 0, 0, 1, 1}, 3762 {&__pyx_kp_u__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 1, 0, 0}, 3763 {&__pyx_n_s__7, __pyx_k__7, sizeof(__pyx_k__7), 0, 0, 1, 1}, 3764 {&__pyx_n_s_a, __pyx_k_a, sizeof(__pyx_k_a), 0, 0, 1, 1}, 3765 {&__pyx_n_s_asyncio_coroutines, __pyx_k_asyncio_coroutines, sizeof(__pyx_k_asyncio_coroutines), 0, 0, 1, 1}, 3766 {&__pyx_n_s_b, __pyx_k_b, sizeof(__pyx_k_b), 0, 0, 1, 1}, 3767 {&__pyx_n_s_body, __pyx_k_body, sizeof(__pyx_k_body), 0, 0, 1, 1}, 3768 {&__pyx_n_s_bw, __pyx_k_bw, sizeof(__pyx_k_bw), 0, 0, 1, 1}, 3769 {&__pyx_n_s_class_getitem, __pyx_k_class_getitem, sizeof(__pyx_k_class_getitem), 0, 0, 1, 1}, 3770 {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, 3771 {&__pyx_n_s_ctn, __pyx_k_ctn, sizeof(__pyx_k_ctn), 0, 0, 1, 1}, 3772 {&__pyx_n_s_ctn_degree, __pyx_k_ctn_degree, sizeof(__pyx_k_ctn_degree), 0, 0, 1, 1}, 3773 {&__pyx_kp_s_cython_int, __pyx_k_cython_int, sizeof(__pyx_k_cython_int), 0, 0, 1, 0}, 3774 {&__pyx_n_s_fw, __pyx_k_fw, sizeof(__pyx_k_fw), 0, 0, 1, 1}, 3775 {&__pyx_n_s_gcd, __pyx_k_gcd, sizeof(__pyx_k_gcd), 0, 0, 1, 1}, 3776 {&__pyx_n_s_head, __pyx_k_head, sizeof(__pyx_k_head), 0, 0, 1, 1}, 3777 {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, 3778 {&__pyx_n_s_is_coroutine, __pyx_k_is_coroutine, sizeof(__pyx_k_is_coroutine), 0, 0, 1, 1}, 3779 {&__pyx_n_s_l, __pyx_k_l, sizeof(__pyx_k_l), 0, 0, 1, 1}, 3780 {&__pyx_n_s_l_body, __pyx_k_l_body, sizeof(__pyx_k_l_body), 0, 0, 1, 1}, 3781 {&__pyx_kp_s_list_cython_int, __pyx_k_list_cython_int, sizeof(__pyx_k_list_cython_int), 0, 0, 1, 0}, 3782 {&__pyx_n_s_llen, __pyx_k_llen, sizeof(__pyx_k_llen), 0, 0, 1, 1}, 3783 {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, 3784 {&__pyx_n_s_math, __pyx_k_math, sizeof(__pyx_k_math), 0, 0, 1, 1}, 3785 {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, 3786 {&__pyx_n_s_ones, __pyx_k_ones, sizeof(__pyx_k_ones), 0, 0, 1, 1}, 3787 {&__pyx_n_s_r, __pyx_k_r, sizeof(__pyx_k_r), 0, 0, 1, 1}, 3788 {&__pyx_n_s_r_body, __pyx_k_r_body, sizeof(__pyx_k_r_body), 0, 0, 1, 1}, 3789 {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, 3790 {&__pyx_n_s_read, __pyx_k_read, sizeof(__pyx_k_read), 0, 0, 1, 1}, 3791 {&__pyx_n_s_return, __pyx_k_return, sizeof(__pyx_k_return), 0, 0, 1, 1}, 3792 {&__pyx_n_s_rlen, __pyx_k_rlen, sizeof(__pyx_k_rlen), 0, 0, 1, 1}, 3793 {&__pyx_n_s_search, __pyx_k_search, sizeof(__pyx_k_search), 0, 0, 1, 1}, 3794 {&__pyx_kp_s_search_pyx, __pyx_k_search_pyx, sizeof(__pyx_k_search_pyx), 0, 0, 1, 0}, 3795 {&__pyx_n_s_sequence, __pyx_k_sequence, sizeof(__pyx_k_sequence), 0, 0, 1, 1}, 3796 {&__pyx_kp_s_set_cython_int, __pyx_k_set_cython_int, sizeof(__pyx_k_set_cython_int), 0, 0, 1, 0}, 3797 {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, 3798 {&__pyx_n_s_upper_bound, __pyx_k_upper_bound, sizeof(__pyx_k_upper_bound), 0, 0, 1, 1}, 3799 {0, 0, 0, 0, 0, 0, 0} 3800 }; 3801 return __Pyx_InitStrings(__pyx_string_tab); 3802} 3803/* #### Code section: cached_builtins ### */ 3804static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { 3805 __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 13, __pyx_L1_error) 3806 return 0; 3807 __pyx_L1_error:; 3808 return -1; 3809} 3810/* #### Code section: cached_constants ### */ 3811 3812static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { 3813 __Pyx_RefNannyDeclarations 3814 __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); 3815 3816 /* "search.pyx":22 3817 * read: list[cython.int] = [b, a] 3818 * l_body: list[cython.int] = l[2:] 3819 * r_body: list[cython.int] = r[2:][::-1] # <<<<<<<<<<<<<< 3820 * llen: cython.size_t = len(l_body) 3821 * rlen: cython.size_t = len(r_body) 3822 */ 3823 __pyx_slice_ = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_slice_)) __PYX_ERR(0, 22, __pyx_L1_error) 3824 __Pyx_GOTREF(__pyx_slice_); 3825 __Pyx_GIVEREF(__pyx_slice_); 3826 3827 /* "search.pyx":4 3828 * import cython 3829 * 3830 * def F(a: cython.int, b: cython.int) -> list[cython.int]: # <<<<<<<<<<<<<< 3831 * sequence: list[cython.int] = [a, b] 3832 * while sequence[-1] > 1: 3833 */ 3834 __pyx_tuple__3 = PyTuple_Pack(3, __pyx_n_s_a, __pyx_n_s_b, __pyx_n_s_sequence); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 4, __pyx_L1_error) 3835 __Pyx_GOTREF(__pyx_tuple__3); 3836 __Pyx_GIVEREF(__pyx_tuple__3); 3837 __pyx_codeobj__4 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__3, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_search_pyx, __pyx_n_s_F, 4, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__4)) __PYX_ERR(0, 4, __pyx_L1_error) 3838 3839 /* "search.pyx":11 3840 * return sequence 3841 * 3842 * def search(upper_bound: cython.int, ctn_degree: cython.int) -> set[cython.int]: # <<<<<<<<<<<<<< 3843 * ctn: set[tuple] = set() 3844 * for a in range(1, upper_bound + 1, 2): 3845 */ 3846 __pyx_tuple__5 = PyTuple_Pack(17, __pyx_n_s_upper_bound, __pyx_n_s_ctn_degree, __pyx_n_s_ctn, __pyx_n_s_a, __pyx_n_s_b, __pyx_n_s_l, __pyx_n_s_r, __pyx_n_s_head, __pyx_n_s_read, __pyx_n_s_l_body, __pyx_n_s_r_body, __pyx_n_s_llen, __pyx_n_s_rlen, __pyx_n_s_body, __pyx_n_s_fw, __pyx_n_s_bw, __pyx_n_s_ones); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 11, __pyx_L1_error) 3847 __Pyx_GOTREF(__pyx_tuple__5); 3848 __Pyx_GIVEREF(__pyx_tuple__5); 3849 __pyx_codeobj__6 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 17, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__5, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_search_pyx, __pyx_n_s_search, 11, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__6)) __PYX_ERR(0, 11, __pyx_L1_error) 3850 __Pyx_RefNannyFinishContext(); 3851 return 0; 3852 __pyx_L1_error:; 3853 __Pyx_RefNannyFinishContext(); 3854 return -1; 3855} 3856/* #### Code section: init_constants ### */ 3857 3858static CYTHON_SMALL_CODE int __Pyx_InitConstants(void) { 3859 if (__Pyx_CreateStringTabAndInitStrings() < 0) __PYX_ERR(0, 1, __pyx_L1_error); 3860 __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) 3861 __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error) 3862 __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error) 3863 return 0; 3864 __pyx_L1_error:; 3865 return -1; 3866} 3867/* #### Code section: init_globals ### */ 3868 3869static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { 3870 return 0; 3871} 3872/* #### Code section: init_module ### */ 3873 3874static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/ 3875static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/ 3876static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/ 3877static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/ 3878static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/ 3879static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/ 3880static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/ 3881 3882static int __Pyx_modinit_global_init_code(void) { 3883 __Pyx_RefNannyDeclarations 3884 __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); 3885 /*--- Global init code ---*/ 3886 __Pyx_RefNannyFinishContext(); 3887 return 0; 3888} 3889 3890static int __Pyx_modinit_variable_export_code(void) { 3891 __Pyx_RefNannyDeclarations 3892 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); 3893 /*--- Variable export code ---*/ 3894 __Pyx_RefNannyFinishContext(); 3895 return 0; 3896} 3897 3898static int __Pyx_modinit_function_export_code(void) { 3899 __Pyx_RefNannyDeclarations 3900 __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); 3901 /*--- Function export code ---*/ 3902 __Pyx_RefNannyFinishContext(); 3903 return 0; 3904} 3905 3906static int __Pyx_modinit_type_init_code(void) { 3907 __Pyx_RefNannyDeclarations 3908 __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); 3909 /*--- Type init code ---*/ 3910 __Pyx_RefNannyFinishContext(); 3911 return 0; 3912} 3913 3914static int __Pyx_modinit_type_import_code(void) { 3915 __Pyx_RefNannyDeclarations 3916 __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); 3917 /*--- Type import code ---*/ 3918 __Pyx_RefNannyFinishContext(); 3919 return 0; 3920} 3921 3922static int __Pyx_modinit_variable_import_code(void) { 3923 __Pyx_RefNannyDeclarations 3924 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); 3925 /*--- Variable import code ---*/ 3926 __Pyx_RefNannyFinishContext(); 3927 return 0; 3928} 3929 3930static int __Pyx_modinit_function_import_code(void) { 3931 __Pyx_RefNannyDeclarations 3932 __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); 3933 /*--- Function import code ---*/ 3934 __Pyx_RefNannyFinishContext(); 3935 return 0; 3936} 3937 3938 3939#if PY_MAJOR_VERSION >= 3 3940#if CYTHON_PEP489_MULTI_PHASE_INIT 3941static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ 3942static int __pyx_pymod_exec_search(PyObject* module); /*proto*/ 3943static PyModuleDef_Slot __pyx_moduledef_slots[] = { 3944 {Py_mod_create, (void*)__pyx_pymod_create}, 3945 {Py_mod_exec, (void*)__pyx_pymod_exec_search}, 3946 {0, NULL} 3947}; 3948#endif 3949 3950#ifdef __cplusplus 3951namespace { 3952 struct PyModuleDef __pyx_moduledef = 3953 #else 3954 static struct PyModuleDef __pyx_moduledef = 3955 #endif 3956 { 3957 PyModuleDef_HEAD_INIT, 3958 "search", 3959 0, /* m_doc */ 3960 #if CYTHON_PEP489_MULTI_PHASE_INIT 3961 0, /* m_size */ 3962 #elif CYTHON_USE_MODULE_STATE 3963 sizeof(__pyx_mstate), /* m_size */ 3964 #else 3965 -1, /* m_size */ 3966 #endif 3967 __pyx_methods /* m_methods */, 3968 #if CYTHON_PEP489_MULTI_PHASE_INIT 3969 __pyx_moduledef_slots, /* m_slots */ 3970 #else 3971 NULL, /* m_reload */ 3972 #endif 3973 #if CYTHON_USE_MODULE_STATE 3974 __pyx_m_traverse, /* m_traverse */ 3975 __pyx_m_clear, /* m_clear */ 3976 NULL /* m_free */ 3977 #else 3978 NULL, /* m_traverse */ 3979 NULL, /* m_clear */ 3980 NULL /* m_free */ 3981 #endif 3982 }; 3983 #ifdef __cplusplus 3984} /* anonymous namespace */ 3985#endif 3986#endif 3987 3988#ifndef CYTHON_NO_PYINIT_EXPORT 3989#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC 3990#elif PY_MAJOR_VERSION < 3 3991#ifdef __cplusplus 3992#define __Pyx_PyMODINIT_FUNC extern "C" void 3993#else 3994#define __Pyx_PyMODINIT_FUNC void 3995#endif 3996#else 3997#ifdef __cplusplus 3998#define __Pyx_PyMODINIT_FUNC extern "C" PyObject * 3999#else 4000#define __Pyx_PyMODINIT_FUNC PyObject * 4001#endif 4002#endif 4003 4004 4005#if PY_MAJOR_VERSION < 3 4006__Pyx_PyMODINIT_FUNC initsearch(void) CYTHON_SMALL_CODE; /*proto*/ 4007__Pyx_PyMODINIT_FUNC initsearch(void) 4008#else 4009__Pyx_PyMODINIT_FUNC PyInit_search(void) CYTHON_SMALL_CODE; /*proto*/ 4010__Pyx_PyMODINIT_FUNC PyInit_search(void) 4011#if CYTHON_PEP489_MULTI_PHASE_INIT 4012{ 4013 return PyModuleDef_Init(&__pyx_moduledef); 4014} 4015static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { 4016 #if PY_VERSION_HEX >= 0x030700A1 4017 static PY_INT64_T main_interpreter_id = -1; 4018 PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); 4019 if (main_interpreter_id == -1) { 4020 main_interpreter_id = current_id; 4021 return (unlikely(current_id == -1)) ? -1 : 0; 4022 } else if (unlikely(main_interpreter_id != current_id)) 4023 #else 4024 static PyInterpreterState *main_interpreter = NULL; 4025 PyInterpreterState *current_interpreter = PyThreadState_Get()->interp; 4026 if (!main_interpreter) { 4027 main_interpreter = current_interpreter; 4028 } else if (unlikely(main_interpreter != current_interpreter)) 4029 #endif 4030 { 4031 PyErr_SetString( 4032 PyExc_ImportError, 4033 "Interpreter change detected - this module can only be loaded into one interpreter per process."); 4034 return -1; 4035 } 4036 return 0; 4037} 4038#if CYTHON_COMPILING_IN_LIMITED_API 4039static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *module, const char* from_name, const char* to_name, int allow_none) 4040#else 4041static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) 4042#endif 4043{ 4044 PyObject *value = PyObject_GetAttrString(spec, from_name); 4045 int result = 0; 4046 if (likely(value)) { 4047 if (allow_none || value != Py_None) { 4048#if CYTHON_COMPILING_IN_LIMITED_API 4049 result = PyModule_AddObject(module, to_name, value); 4050#else 4051 result = PyDict_SetItemString(moddict, to_name, value); 4052#endif 4053 } 4054 Py_DECREF(value); 4055 } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { 4056 PyErr_Clear(); 4057 } else { 4058 result = -1; 4059 } 4060 return result; 4061} 4062static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) { 4063 PyObject *module = NULL, *moddict, *modname; 4064 CYTHON_UNUSED_VAR(def); 4065 if (__Pyx_check_single_interpreter()) 4066 return NULL; 4067 if (__pyx_m) 4068 return __Pyx_NewRef(__pyx_m); 4069 modname = PyObject_GetAttrString(spec, "name"); 4070 if (unlikely(!modname)) goto bad; 4071 module = PyModule_NewObject(modname); 4072 Py_DECREF(modname); 4073 if (unlikely(!module)) goto bad; 4074#if CYTHON_COMPILING_IN_LIMITED_API 4075 moddict = module; 4076#else 4077 moddict = PyModule_GetDict(module); 4078 if (unlikely(!moddict)) goto bad; 4079#endif 4080 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; 4081 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; 4082 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; 4083 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad; 4084 return module; 4085bad: 4086 Py_XDECREF(module); 4087 return NULL; 4088} 4089 4090 4091static CYTHON_SMALL_CODE int __pyx_pymod_exec_search(PyObject *__pyx_pyinit_module) 4092#endif 4093#endif 4094{ 4095 int stringtab_initialized = 0; 4096 #if CYTHON_USE_MODULE_STATE 4097 int pystate_addmodule_run = 0; 4098 #endif 4099 PyObject *__pyx_t_1 = NULL; 4100 PyObject *__pyx_t_2 = NULL; 4101 PyObject *__pyx_t_3 = NULL; 4102 int __pyx_lineno = 0; 4103 const char *__pyx_filename = NULL; 4104 int __pyx_clineno = 0; 4105 __Pyx_RefNannyDeclarations 4106 #if CYTHON_PEP489_MULTI_PHASE_INIT 4107 if (__pyx_m) { 4108 if (__pyx_m == __pyx_pyinit_module) return 0; 4109 PyErr_SetString(PyExc_RuntimeError, "Module 'search' has already been imported. Re-initialisation is not supported."); 4110 return -1; 4111 } 4112 #elif PY_MAJOR_VERSION >= 3 4113 if (__pyx_m) return __Pyx_NewRef(__pyx_m); 4114 #endif 4115 /*--- Module creation code ---*/ 4116 #if CYTHON_PEP489_MULTI_PHASE_INIT 4117 __pyx_m = __pyx_pyinit_module; 4118 Py_INCREF(__pyx_m); 4119 #else 4120 #if PY_MAJOR_VERSION < 3 4121 __pyx_m = Py_InitModule4("search", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); 4122 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) 4123 #elif CYTHON_USE_MODULE_STATE 4124 __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) 4125 { 4126 int add_module_result = PyState_AddModule(__pyx_t_1, &__pyx_moduledef); 4127 __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to "search" pseudovariable */ 4128 if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error) 4129 pystate_addmodule_run = 1; 4130 } 4131 #else 4132 __pyx_m = PyModule_Create(&__pyx_moduledef); 4133 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) 4134 #endif 4135 #endif 4136 CYTHON_UNUSED_VAR(__pyx_t_1); 4137 __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) 4138 Py_INCREF(__pyx_d); 4139 __pyx_b = __Pyx_PyImport_AddModuleRef(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) 4140 __pyx_cython_runtime = __Pyx_PyImport_AddModuleRef((const char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) 4141 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error) 4142 #if CYTHON_REFNANNY 4143__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); 4144if (!__Pyx_RefNanny) { 4145 PyErr_Clear(); 4146 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); 4147 if (!__Pyx_RefNanny) 4148 Py_FatalError("failed to import 'refnanny' module"); 4149} 4150#endif 4151 __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_search(void)", 0); 4152 if (__Pyx_check_binary_version(__PYX_LIMITED_VERSION_HEX, __Pyx_get_runtime_version(), CYTHON_COMPILING_IN_LIMITED_API) < 0) __PYX_ERR(0, 1, __pyx_L1_error) 4153 #ifdef __Pxy_PyFrame_Initialize_Offsets 4154 __Pxy_PyFrame_Initialize_Offsets(); 4155 #endif 4156 __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) 4157 __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) 4158 __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) 4159 #ifdef __Pyx_CyFunction_USED 4160 if (__pyx_CyFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) 4161 #endif 4162 #ifdef __Pyx_FusedFunction_USED 4163 if (__pyx_FusedFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) 4164 #endif 4165 #ifdef __Pyx_Coroutine_USED 4166 if (__pyx_Coroutine_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) 4167 #endif 4168 #ifdef __Pyx_Generator_USED 4169 if (__pyx_Generator_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) 4170 #endif 4171 #ifdef __Pyx_AsyncGen_USED 4172 if (__pyx_AsyncGen_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) 4173 #endif 4174 #ifdef __Pyx_StopAsyncIteration_USED 4175 if (__pyx_StopAsyncIteration_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) 4176 #endif 4177 /*--- Library function declarations ---*/ 4178 /*--- Threads initialization code ---*/ 4179 #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS 4180 PyEval_InitThreads(); 4181 #endif 4182 /*--- Initialize various global constants etc. ---*/ 4183 if (__Pyx_InitConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) 4184 stringtab_initialized = 1; 4185 if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) 4186 #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) 4187 if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) 4188 #endif 4189 if (__pyx_module_is_main_search) { 4190 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) 4191 } 4192 #if PY_MAJOR_VERSION >= 3 4193 { 4194 PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) 4195 if (!PyDict_GetItemString(modules, "search")) { 4196 if (unlikely((PyDict_SetItemString(modules, "search", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) 4197 } 4198 } 4199 #endif 4200 /*--- Builtin init code ---*/ 4201 if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) 4202 /*--- Constants init code ---*/ 4203 if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) 4204 /*--- Global type/function init code ---*/ 4205 (void)__Pyx_modinit_global_init_code(); 4206 (void)__Pyx_modinit_variable_export_code(); 4207 (void)__Pyx_modinit_function_export_code(); 4208 (void)__Pyx_modinit_type_init_code(); 4209 (void)__Pyx_modinit_type_import_code(); 4210 (void)__Pyx_modinit_variable_import_code(); 4211 (void)__Pyx_modinit_function_import_code(); 4212 /*--- Execution code ---*/ 4213 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) 4214 if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) 4215 #endif 4216 4217 /* "search.pyx":1 4218 * from math import gcd # <<<<<<<<<<<<<< 4219 * import cython 4220 * 4221 */ 4222 __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error) 4223 __Pyx_GOTREF(__pyx_t_2); 4224 __Pyx_INCREF(__pyx_n_s_gcd); 4225 __Pyx_GIVEREF(__pyx_n_s_gcd); 4226 if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_gcd)) __PYX_ERR(0, 1, __pyx_L1_error); 4227 __pyx_t_3 = __Pyx_Import(__pyx_n_s_math, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1, __pyx_L1_error) 4228 __Pyx_GOTREF(__pyx_t_3); 4229 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; 4230 __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_gcd); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error) 4231 __Pyx_GOTREF(__pyx_t_2); 4232 if (PyDict_SetItem(__pyx_d, __pyx_n_s_gcd, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error) 4233 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; 4234 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; 4235 4236 /* "search.pyx":4 4237 * import cython 4238 * 4239 * def F(a: cython.int, b: cython.int) -> list[cython.int]: # <<<<<<<<<<<<<< 4240 * sequence: list[cython.int] = [a, b] 4241 * while sequence[-1] > 1: 4242 */ 4243 __pyx_t_3 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4, __pyx_L1_error) 4244 __Pyx_GOTREF(__pyx_t_3); 4245 if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_a, __pyx_kp_s_cython_int) < 0) __PYX_ERR(0, 4, __pyx_L1_error) 4246 if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_b, __pyx_kp_s_cython_int) < 0) __PYX_ERR(0, 4, __pyx_L1_error) 4247 if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_kp_s_list_cython_int) < 0) __PYX_ERR(0, 4, __pyx_L1_error) 4248 __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_6search_1F, 0, __pyx_n_s_F, NULL, __pyx_n_s_search, __pyx_d, ((PyObject *)__pyx_codeobj__4)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4, __pyx_L1_error) 4249 __Pyx_GOTREF(__pyx_t_2); 4250 __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_3); 4251 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; 4252 if (PyDict_SetItem(__pyx_d, __pyx_n_s_F, __pyx_t_2) < 0) __PYX_ERR(0, 4, __pyx_L1_error) 4253 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; 4254 4255 /* "search.pyx":11 4256 * return sequence 4257 * 4258 * def search(upper_bound: cython.int, ctn_degree: cython.int) -> set[cython.int]: # <<<<<<<<<<<<<< 4259 * ctn: set[tuple] = set() 4260 * for a in range(1, upper_bound + 1, 2): 4261 */ 4262 __pyx_t_2 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 11, __pyx_L1_error) 4263 __Pyx_GOTREF(__pyx_t_2); 4264 if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_upper_bound, __pyx_kp_s_cython_int) < 0) __PYX_ERR(0, 11, __pyx_L1_error) 4265 if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_ctn_degree, __pyx_kp_s_cython_int) < 0) __PYX_ERR(0, 11, __pyx_L1_error) 4266 if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, __pyx_kp_s_set_cython_int) < 0) __PYX_ERR(0, 11, __pyx_L1_error) 4267 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_6search_3search, 0, __pyx_n_s_search, NULL, __pyx_n_s_search, __pyx_d, ((PyObject *)__pyx_codeobj__6)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 11, __pyx_L1_error) 4268 __Pyx_GOTREF(__pyx_t_3); 4269 __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_2); 4270 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; 4271 if (PyDict_SetItem(__pyx_d, __pyx_n_s_search, __pyx_t_3) < 0) __PYX_ERR(0, 11, __pyx_L1_error) 4272 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; 4273 4274 /* "search.pyx":1 4275 * from math import gcd # <<<<<<<<<<<<<< 4276 * import cython 4277 * 4278 */ 4279 __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1, __pyx_L1_error) 4280 __Pyx_GOTREF(__pyx_t_3); 4281 if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_3) < 0) __PYX_ERR(0, 1, __pyx_L1_error) 4282 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; 4283 4284 /*--- Wrapped vars code ---*/ 4285 4286 goto __pyx_L0; 4287 __pyx_L1_error:; 4288 __Pyx_XDECREF(__pyx_t_2); 4289 __Pyx_XDECREF(__pyx_t_3); 4290 if (__pyx_m) { 4291 if (__pyx_d && stringtab_initialized) { 4292 __Pyx_AddTraceback("init search", __pyx_clineno, __pyx_lineno, __pyx_filename); 4293 } 4294 #if !CYTHON_USE_MODULE_STATE 4295 Py_CLEAR(__pyx_m); 4296 #else 4297 Py_DECREF(__pyx_m); 4298 if (pystate_addmodule_run) { 4299 PyObject *tp, *value, *tb; 4300 PyErr_Fetch(&tp, &value, &tb); 4301 PyState_RemoveModule(&__pyx_moduledef); 4302 PyErr_Restore(tp, value, tb); 4303 } 4304 #endif 4305 } else if (!PyErr_Occurred()) { 4306 PyErr_SetString(PyExc_ImportError, "init search"); 4307 } 4308 __pyx_L0:; 4309 __Pyx_RefNannyFinishContext(); 4310 #if CYTHON_PEP489_MULTI_PHASE_INIT 4311 return (__pyx_m != NULL) ? 0 : -1; 4312 #elif PY_MAJOR_VERSION >= 3 4313 return __pyx_m; 4314 #else 4315 return; 4316 #endif 4317} 4318/* #### Code section: cleanup_globals ### */ 4319/* #### Code section: cleanup_module ### */ 4320/* #### Code section: main_method ### */ 4321/* #### Code section: utility_code_pragmas ### */ 4322#ifdef _MSC_VER 4323#pragma warning( push ) 4324/* Warning 4127: conditional expression is constant 4325 * Cython uses constant conditional expressions to allow in inline functions to be optimized at 4326 * compile-time, so this warning is not useful 4327 */ 4328#pragma warning( disable : 4127 ) 4329#endif 4330 4331 4332 4333/* #### Code section: utility_code_def ### */ 4334 4335/* --- Runtime support code --- */ 4336/* Refnanny */ 4337#if CYTHON_REFNANNY 4338static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { 4339 PyObject *m = NULL, *p = NULL; 4340 void *r = NULL; 4341 m = PyImport_ImportModule(modname); 4342 if (!m) goto end; 4343 p = PyObject_GetAttrString(m, "RefNannyAPI"); 4344 if (!p) goto end; 4345 r = PyLong_AsVoidPtr(p); 4346end: 4347 Py_XDECREF(p); 4348 Py_XDECREF(m); 4349 return (__Pyx_RefNannyAPIStruct *)r; 4350} 4351#endif 4352 4353/* PyErrExceptionMatches */ 4354#if CYTHON_FAST_THREAD_STATE 4355static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { 4356 Py_ssize_t i, n; 4357 n = PyTuple_GET_SIZE(tuple); 4358#if PY_MAJOR_VERSION >= 3 4359 for (i=0; i<n; i++) { 4360 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1; 4361 } 4362#endif 4363 for (i=0; i<n; i++) { 4364 if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1; 4365 } 4366 return 0; 4367} 4368static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) { 4369 int result; 4370 PyObject *exc_type; 4371#if PY_VERSION_HEX >= 0x030C00A6 4372 PyObject *current_exception = tstate->current_exception; 4373 if (unlikely(!current_exception)) return 0; 4374 exc_type = (PyObject*) Py_TYPE(current_exception); 4375 if (exc_type == err) return 1; 4376#else 4377 exc_type = tstate->curexc_type; 4378 if (exc_type == err) return 1; 4379 if (unlikely(!exc_type)) return 0; 4380#endif 4381 #if CYTHON_AVOID_BORROWED_REFS 4382 Py_INCREF(exc_type); 4383 #endif 4384 if (unlikely(PyTuple_Check(err))) { 4385 result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); 4386 } else { 4387 result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err); 4388 } 4389 #if CYTHON_AVOID_BORROWED_REFS 4390 Py_DECREF(exc_type); 4391 #endif 4392 return result; 4393} 4394#endif 4395 4396/* PyErrFetchRestore */ 4397#if CYTHON_FAST_THREAD_STATE 4398static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { 4399#if PY_VERSION_HEX >= 0x030C00A6 4400 PyObject *tmp_value; 4401 assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value))); 4402 if (value) { 4403 #if CYTHON_COMPILING_IN_CPYTHON 4404 if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb)) 4405 #endif 4406 PyException_SetTraceback(value, tb); 4407 } 4408 tmp_value = tstate->current_exception; 4409 tstate->current_exception = value; 4410 Py_XDECREF(tmp_value); 4411 Py_XDECREF(type); 4412 Py_XDECREF(tb); 4413#else 4414 PyObject *tmp_type, *tmp_value, *tmp_tb; 4415 tmp_type = tstate->curexc_type; 4416 tmp_value = tstate->curexc_value; 4417 tmp_tb = tstate->curexc_traceback; 4418 tstate->curexc_type = type; 4419 tstate->curexc_value = value; 4420 tstate->curexc_traceback = tb; 4421 Py_XDECREF(tmp_type); 4422 Py_XDECREF(tmp_value); 4423 Py_XDECREF(tmp_tb); 4424#endif 4425} 4426static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { 4427#if PY_VERSION_HEX >= 0x030C00A6 4428 PyObject* exc_value; 4429 exc_value = tstate->current_exception; 4430 tstate->current_exception = 0; 4431 *value = exc_value; 4432 *type = NULL; 4433 *tb = NULL; 4434 if (exc_value) { 4435 *type = (PyObject*) Py_TYPE(exc_value); 4436 Py_INCREF(*type); 4437 #if CYTHON_COMPILING_IN_CPYTHON 4438 *tb = ((PyBaseExceptionObject*) exc_value)->traceback; 4439 Py_XINCREF(*tb); 4440 #else 4441 *tb = PyException_GetTraceback(exc_value); 4442 #endif 4443 } 4444#else 4445 *type = tstate->curexc_type; 4446 *value = tstate->curexc_value; 4447 *tb = tstate->curexc_traceback; 4448 tstate->curexc_type = 0; 4449 tstate->curexc_value = 0; 4450 tstate->curexc_traceback = 0; 4451#endif 4452} 4453#endif 4454 4455/* PyObjectGetAttrStr */ 4456#if CYTHON_USE_TYPE_SLOTS 4457static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { 4458 PyTypeObject* tp = Py_TYPE(obj); 4459 if (likely(tp->tp_getattro)) 4460 return tp->tp_getattro(obj, attr_name); 4461#if PY_MAJOR_VERSION < 3 4462 if (likely(tp->tp_getattr)) 4463 return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); 4464#endif 4465 return PyObject_GetAttr(obj, attr_name); 4466} 4467#endif 4468 4469/* PyObjectGetAttrStrNoError */ 4470#if __PYX_LIMITED_VERSION_HEX < 0x030d00A1 4471static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { 4472 __Pyx_PyThreadState_declare 4473 __Pyx_PyThreadState_assign 4474 if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) 4475 __Pyx_PyErr_Clear(); 4476} 4477#endif 4478static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { 4479 PyObject *result; 4480#if __PYX_LIMITED_VERSION_HEX >= 0x030d00A1 4481 (void) PyObject_GetOptionalAttr(obj, attr_name, &result); 4482 return result; 4483#else 4484#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 4485 PyTypeObject* tp = Py_TYPE(obj); 4486 if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { 4487 return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); 4488 } 4489#endif 4490 result = __Pyx_PyObject_GetAttrStr(obj, attr_name); 4491 if (unlikely(!result)) { 4492 __Pyx_PyObject_GetAttrStr_ClearAttributeError(); 4493 } 4494 return result; 4495#endif 4496} 4497 4498/* GetBuiltinName */ 4499static PyObject *__Pyx_GetBuiltinName(PyObject *name) { 4500 PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_b, name); 4501 if (unlikely(!result) && !PyErr_Occurred()) { 4502 PyErr_Format(PyExc_NameError, 4503#if PY_MAJOR_VERSION >= 3 4504 "name '%U' is not defined", name); 4505#else 4506 "name '%.200s' is not defined", PyString_AS_STRING(name)); 4507#endif 4508 } 4509 return result; 4510} 4511 4512/* TupleAndListFromArray */ 4513#if CYTHON_COMPILING_IN_CPYTHON 4514static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) { 4515 PyObject *v; 4516 Py_ssize_t i; 4517 for (i = 0; i < length; i++) { 4518 v = dest[i] = src[i]; 4519 Py_INCREF(v); 4520 } 4521} 4522static CYTHON_INLINE PyObject * 4523__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) 4524{ 4525 PyObject *res; 4526 if (n <= 0) { 4527 Py_INCREF(__pyx_empty_tuple); 4528 return __pyx_empty_tuple; 4529 } 4530 res = PyTuple_New(n); 4531 if (unlikely(res == NULL)) return NULL; 4532 __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n); 4533 return res; 4534} 4535static CYTHON_INLINE PyObject * 4536__Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n) 4537{ 4538 PyObject *res; 4539 if (n <= 0) { 4540 return PyList_New(0); 4541 } 4542 res = PyList_New(n); 4543 if (unlikely(res == NULL)) return NULL; 4544 __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n); 4545 return res; 4546} 4547#endif 4548 4549/* BytesEquals */ 4550static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { 4551#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API 4552 return PyObject_RichCompareBool(s1, s2, equals); 4553#else 4554 if (s1 == s2) { 4555 return (equals == Py_EQ); 4556 } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { 4557 const char *ps1, *ps2; 4558 Py_ssize_t length = PyBytes_GET_SIZE(s1); 4559 if (length != PyBytes_GET_SIZE(s2)) 4560 return (equals == Py_NE); 4561 ps1 = PyBytes_AS_STRING(s1); 4562 ps2 = PyBytes_AS_STRING(s2); 4563 if (ps1[0] != ps2[0]) { 4564 return (equals == Py_NE); 4565 } else if (length == 1) { 4566 return (equals == Py_EQ); 4567 } else { 4568 int result; 4569#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000) 4570 Py_hash_t hash1, hash2; 4571 hash1 = ((PyBytesObject*)s1)->ob_shash; 4572 hash2 = ((PyBytesObject*)s2)->ob_shash; 4573 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { 4574 return (equals == Py_NE); 4575 } 4576#endif 4577 result = memcmp(ps1, ps2, (size_t)length); 4578 return (equals == Py_EQ) ? (result == 0) : (result != 0); 4579 } 4580 } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { 4581 return (equals == Py_NE); 4582 } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { 4583 return (equals == Py_NE); 4584 } else { 4585 int result; 4586 PyObject* py_result = PyObject_RichCompare(s1, s2, equals); 4587 if (!py_result) 4588 return -1; 4589 result = __Pyx_PyObject_IsTrue(py_result); 4590 Py_DECREF(py_result); 4591 return result; 4592 } 4593#endif 4594} 4595 4596/* UnicodeEquals */ 4597static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { 4598#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API 4599 return PyObject_RichCompareBool(s1, s2, equals); 4600#else 4601#if PY_MAJOR_VERSION < 3 4602 PyObject* owned_ref = NULL; 4603#endif 4604 int s1_is_unicode, s2_is_unicode; 4605 if (s1 == s2) { 4606 goto return_eq; 4607 } 4608 s1_is_unicode = PyUnicode_CheckExact(s1); 4609 s2_is_unicode = PyUnicode_CheckExact(s2); 4610#if PY_MAJOR_VERSION < 3 4611 if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) { 4612 owned_ref = PyUnicode_FromObject(s2); 4613 if (unlikely(!owned_ref)) 4614 return -1; 4615 s2 = owned_ref; 4616 s2_is_unicode = 1; 4617 } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) { 4618 owned_ref = PyUnicode_FromObject(s1); 4619 if (unlikely(!owned_ref)) 4620 return -1; 4621 s1 = owned_ref; 4622 s1_is_unicode = 1; 4623 } else if (((!s2_is_unicode) & (!s1_is_unicode))) { 4624 return __Pyx_PyBytes_Equals(s1, s2, equals); 4625 } 4626#endif 4627 if (s1_is_unicode & s2_is_unicode) { 4628 Py_ssize_t length; 4629 int kind; 4630 void *data1, *data2; 4631 if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) 4632 return -1; 4633 length = __Pyx_PyUnicode_GET_LENGTH(s1); 4634 if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { 4635 goto return_ne; 4636 } 4637#if CYTHON_USE_UNICODE_INTERNALS 4638 { 4639 Py_hash_t hash1, hash2; 4640 #if CYTHON_PEP393_ENABLED 4641 hash1 = ((PyASCIIObject*)s1)->hash; 4642 hash2 = ((PyASCIIObject*)s2)->hash; 4643 #else 4644 hash1 = ((PyUnicodeObject*)s1)->hash; 4645 hash2 = ((PyUnicodeObject*)s2)->hash; 4646 #endif 4647 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { 4648 goto return_ne; 4649 } 4650 } 4651#endif 4652 kind = __Pyx_PyUnicode_KIND(s1); 4653 if (kind != __Pyx_PyUnicode_KIND(s2)) { 4654 goto return_ne; 4655 } 4656 data1 = __Pyx_PyUnicode_DATA(s1); 4657 data2 = __Pyx_PyUnicode_DATA(s2); 4658 if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { 4659 goto return_ne; 4660 } else if (length == 1) { 4661 goto return_eq; 4662 } else { 4663 int result = memcmp(data1, data2, (size_t)(length * kind)); 4664 #if PY_MAJOR_VERSION < 3 4665 Py_XDECREF(owned_ref); 4666 #endif 4667 return (equals == Py_EQ) ? (result == 0) : (result != 0); 4668 } 4669 } else if ((s1 == Py_None) & s2_is_unicode) { 4670 goto return_ne; 4671 } else if ((s2 == Py_None) & s1_is_unicode) { 4672 goto return_ne; 4673 } else { 4674 int result; 4675 PyObject* py_result = PyObject_RichCompare(s1, s2, equals); 4676 #if PY_MAJOR_VERSION < 3 4677 Py_XDECREF(owned_ref); 4678 #endif 4679 if (!py_result) 4680 return -1; 4681 result = __Pyx_PyObject_IsTrue(py_result); 4682 Py_DECREF(py_result); 4683 return result; 4684 } 4685return_eq: 4686 #if PY_MAJOR_VERSION < 3 4687 Py_XDECREF(owned_ref); 4688 #endif 4689 return (equals == Py_EQ); 4690return_ne: 4691 #if PY_MAJOR_VERSION < 3 4692 Py_XDECREF(owned_ref); 4693 #endif 4694 return (equals == Py_NE); 4695#endif 4696} 4697 4698/* fastcall */ 4699#if CYTHON_METH_FASTCALL 4700static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s) 4701{ 4702 Py_ssize_t i, n = PyTuple_GET_SIZE(kwnames); 4703 for (i = 0; i < n; i++) 4704 { 4705 if (s == PyTuple_GET_ITEM(kwnames, i)) return kwvalues[i]; 4706 } 4707 for (i = 0; i < n; i++) 4708 { 4709 int eq = __Pyx_PyUnicode_Equals(s, PyTuple_GET_ITEM(kwnames, i), Py_EQ); 4710 if (unlikely(eq != 0)) { 4711 if (unlikely(eq < 0)) return NULL; 4712 return kwvalues[i]; 4713 } 4714 } 4715 return NULL; 4716} 4717#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 4718CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues) { 4719 Py_ssize_t i, nkwargs = PyTuple_GET_SIZE(kwnames); 4720 PyObject *dict; 4721 dict = PyDict_New(); 4722 if (unlikely(!dict)) 4723 return NULL; 4724 for (i=0; i<nkwargs; i++) { 4725 PyObject *key = PyTuple_GET_ITEM(kwnames, i); 4726 if (unlikely(PyDict_SetItem(dict, key, kwvalues[i]) < 0)) 4727 goto bad; 4728 } 4729 return dict; 4730bad: 4731 Py_DECREF(dict); 4732 return NULL; 4733} 4734#endif 4735#endif 4736 4737/* RaiseArgTupleInvalid */ 4738static void __Pyx_RaiseArgtupleInvalid( 4739 const char* func_name, 4740 int exact, 4741 Py_ssize_t num_min, 4742 Py_ssize_t num_max, 4743 Py_ssize_t num_found) 4744{ 4745 Py_ssize_t num_expected; 4746 const char *more_or_less; 4747 if (num_found < num_min) { 4748 num_expected = num_min; 4749 more_or_less = "at least"; 4750 } else { 4751 num_expected = num_max; 4752 more_or_less = "at most"; 4753 } 4754 if (exact) { 4755 more_or_less = "exactly"; 4756 } 4757 PyErr_Format(PyExc_TypeError, 4758 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", 4759 func_name, more_or_less, num_expected, 4760 (num_expected == 1) ? "" : "s", num_found); 4761} 4762 4763/* RaiseDoubleKeywords */ 4764static void __Pyx_RaiseDoubleKeywordsError( 4765 const char* func_name, 4766 PyObject* kw_name) 4767{ 4768 PyErr_Format(PyExc_TypeError, 4769 #if PY_MAJOR_VERSION >= 3 4770 "%s() got multiple values for keyword argument '%U'", func_name, kw_name); 4771 #else 4772 "%s() got multiple values for keyword argument '%s'", func_name, 4773 PyString_AsString(kw_name)); 4774 #endif 4775} 4776 4777/* ParseKeywords */ 4778static int __Pyx_ParseOptionalKeywords( 4779 PyObject *kwds, 4780 PyObject *const *kwvalues, 4781 PyObject **argnames[], 4782 PyObject *kwds2, 4783 PyObject *values[], 4784 Py_ssize_t num_pos_args, 4785 const char* function_name) 4786{ 4787 PyObject *key = 0, *value = 0; 4788 Py_ssize_t pos = 0; 4789 PyObject*** name; 4790 PyObject*** first_kw_arg = argnames + num_pos_args; 4791 int kwds_is_tuple = CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds)); 4792 while (1) { 4793 Py_XDECREF(key); key = NULL; 4794 Py_XDECREF(value); value = NULL; 4795 if (kwds_is_tuple) { 4796 Py_ssize_t size; 4797#if CYTHON_ASSUME_SAFE_MACROS 4798 size = PyTuple_GET_SIZE(kwds); 4799#else 4800 size = PyTuple_Size(kwds); 4801 if (size < 0) goto bad; 4802#endif 4803 if (pos >= size) break; 4804#if CYTHON_AVOID_BORROWED_REFS 4805 key = __Pyx_PySequence_ITEM(kwds, pos); 4806 if (!key) goto bad; 4807#elif CYTHON_ASSUME_SAFE_MACROS 4808 key = PyTuple_GET_ITEM(kwds, pos); 4809#else 4810 key = PyTuple_GetItem(kwds, pos); 4811 if (!key) goto bad; 4812#endif 4813 value = kwvalues[pos]; 4814 pos++; 4815 } 4816 else 4817 { 4818 if (!PyDict_Next(kwds, &pos, &key, &value)) break; 4819#if CYTHON_AVOID_BORROWED_REFS 4820 Py_INCREF(key); 4821#endif 4822 } 4823 name = first_kw_arg; 4824 while (*name && (**name != key)) name++; 4825 if (*name) { 4826 values[name-argnames] = value; 4827#if CYTHON_AVOID_BORROWED_REFS 4828 Py_INCREF(value); 4829 Py_DECREF(key); 4830#endif 4831 key = NULL; 4832 value = NULL; 4833 continue; 4834 } 4835#if !CYTHON_AVOID_BORROWED_REFS 4836 Py_INCREF(key); 4837#endif 4838 Py_INCREF(value); 4839 name = first_kw_arg; 4840 #if PY_MAJOR_VERSION < 3 4841 if (likely(PyString_Check(key))) { 4842 while (*name) { 4843 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) 4844 && _PyString_Eq(**name, key)) { 4845 values[name-argnames] = value; 4846#if CYTHON_AVOID_BORROWED_REFS 4847 value = NULL; 4848#endif 4849 break; 4850 } 4851 name++; 4852 } 4853 if (*name) continue; 4854 else { 4855 PyObject*** argname = argnames; 4856 while (argname != first_kw_arg) { 4857 if ((**argname == key) || ( 4858 (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) 4859 && _PyString_Eq(**argname, key))) { 4860 goto arg_passed_twice; 4861 } 4862 argname++; 4863 } 4864 } 4865 } else 4866 #endif 4867 if (likely(PyUnicode_Check(key))) { 4868 while (*name) { 4869 int cmp = ( 4870 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 4871 (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : 4872 #endif 4873 PyUnicode_Compare(**name, key) 4874 ); 4875 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; 4876 if (cmp == 0) { 4877 values[name-argnames] = value; 4878#if CYTHON_AVOID_BORROWED_REFS 4879 value = NULL; 4880#endif 4881 break; 4882 } 4883 name++; 4884 } 4885 if (*name) continue; 4886 else { 4887 PyObject*** argname = argnames; 4888 while (argname != first_kw_arg) { 4889 int cmp = (**argname == key) ? 0 : 4890 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 4891 (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : 4892 #endif 4893 PyUnicode_Compare(**argname, key); 4894 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; 4895 if (cmp == 0) goto arg_passed_twice; 4896 argname++; 4897 } 4898 } 4899 } else 4900 goto invalid_keyword_type; 4901 if (kwds2) { 4902 if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; 4903 } else { 4904 goto invalid_keyword; 4905 } 4906 } 4907 Py_XDECREF(key); 4908 Py_XDECREF(value); 4909 return 0; 4910arg_passed_twice: 4911 __Pyx_RaiseDoubleKeywordsError(function_name, key); 4912 goto bad; 4913invalid_keyword_type: 4914 PyErr_Format(PyExc_TypeError, 4915 "%.200s() keywords must be strings", function_name); 4916 goto bad; 4917invalid_keyword: 4918 #if PY_MAJOR_VERSION < 3 4919 PyErr_Format(PyExc_TypeError, 4920 "%.200s() got an unexpected keyword argument '%.200s'", 4921 function_name, PyString_AsString(key)); 4922 #else 4923 PyErr_Format(PyExc_TypeError, 4924 "%s() got an unexpected keyword argument '%U'", 4925 function_name, key); 4926 #endif 4927bad: 4928 Py_XDECREF(key); 4929 Py_XDECREF(value); 4930 return -1; 4931} 4932 4933/* GetItemInt */ 4934static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { 4935 PyObject *r; 4936 if (unlikely(!j)) return NULL; 4937 r = PyObject_GetItem(o, j); 4938 Py_DECREF(j); 4939 return r; 4940} 4941static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, 4942 CYTHON_NCP_UNUSED int wraparound, 4943 CYTHON_NCP_UNUSED int boundscheck) { 4944#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS 4945 Py_ssize_t wrapped_i = i; 4946 if (wraparound & unlikely(i < 0)) { 4947 wrapped_i += PyList_GET_SIZE(o); 4948 } 4949 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) { 4950 PyObject *r = PyList_GET_ITEM(o, wrapped_i); 4951 Py_INCREF(r); 4952 return r; 4953 } 4954 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); 4955#else 4956 return PySequence_GetItem(o, i); 4957#endif 4958} 4959static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, 4960 CYTHON_NCP_UNUSED int wraparound, 4961 CYTHON_NCP_UNUSED int boundscheck) { 4962#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS 4963 Py_ssize_t wrapped_i = i; 4964 if (wraparound & unlikely(i < 0)) { 4965 wrapped_i += PyTuple_GET_SIZE(o); 4966 } 4967 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) { 4968 PyObject *r = PyTuple_GET_ITEM(o, wrapped_i); 4969 Py_INCREF(r); 4970 return r; 4971 } 4972 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); 4973#else 4974 return PySequence_GetItem(o, i); 4975#endif 4976} 4977static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, 4978 CYTHON_NCP_UNUSED int wraparound, 4979 CYTHON_NCP_UNUSED int boundscheck) { 4980#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS 4981 if (is_list || PyList_CheckExact(o)) { 4982 Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); 4983 if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) { 4984 PyObject *r = PyList_GET_ITEM(o, n); 4985 Py_INCREF(r); 4986 return r; 4987 } 4988 } 4989 else if (PyTuple_CheckExact(o)) { 4990 Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); 4991 if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) { 4992 PyObject *r = PyTuple_GET_ITEM(o, n); 4993 Py_INCREF(r); 4994 return r; 4995 } 4996 } else { 4997 PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; 4998 PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; 4999 if (mm && mm->mp_subscript) { 5000 PyObject *r, *key = PyInt_FromSsize_t(i); 5001 if (unlikely(!key)) return NULL; 5002 r = mm->mp_subscript(o, key); 5003 Py_DECREF(key); 5004 return r; 5005 } 5006 if (likely(sm && sm->sq_item)) { 5007 if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { 5008 Py_ssize_t l = sm->sq_length(o); 5009 if (likely(l >= 0)) { 5010 i += l; 5011 } else { 5012 if (!PyErr_ExceptionMatches(PyExc_OverflowError)) 5013 return NULL; 5014 PyErr_Clear(); 5015 } 5016 } 5017 return sm->sq_item(o, i); 5018 } 5019 } 5020#else 5021 if (is_list || !PyMapping_Check(o)) { 5022 return PySequence_GetItem(o, i); 5023 } 5024#endif 5025 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); 5026} 5027 5028/* PyObjectCall */ 5029#if CYTHON_COMPILING_IN_CPYTHON 5030static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { 5031 PyObject *result; 5032 ternaryfunc call = Py_TYPE(func)->tp_call; 5033 if (unlikely(!call)) 5034 return PyObject_Call(func, arg, kw); 5035 #if PY_MAJOR_VERSION < 3 5036 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) 5037 return NULL; 5038 #else 5039 if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) 5040 return NULL; 5041 #endif 5042 result = (*call)(func, arg, kw); 5043 Py_LeaveRecursiveCall(); 5044 if (unlikely(!result) && unlikely(!PyErr_Occurred())) { 5045 PyErr_SetString( 5046 PyExc_SystemError, 5047 "NULL result without error in PyObject_Call"); 5048 } 5049 return result; 5050} 5051#endif 5052 5053/* PyIntBinop */ 5054#if !CYTHON_COMPILING_IN_PYPY 5055static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) { 5056 CYTHON_MAYBE_UNUSED_VAR(intval); 5057 CYTHON_MAYBE_UNUSED_VAR(inplace); 5058 CYTHON_UNUSED_VAR(zerodivision_check); 5059 #if PY_MAJOR_VERSION < 3 5060 if (likely(PyInt_CheckExact(op1))) { 5061 const long b = intval; 5062 long x; 5063 long a = PyInt_AS_LONG(op1); 5064 5065 x = (long)((unsigned long)a + (unsigned long)b); 5066 if (likely((x^a) >= 0 || (x^b) >= 0)) 5067 return PyInt_FromLong(x); 5068 return PyLong_Type.tp_as_number->nb_add(op1, op2); 5069 } 5070 #endif 5071 #if CYTHON_USE_PYLONG_INTERNALS 5072 if (likely(PyLong_CheckExact(op1))) { 5073 const long b = intval; 5074 long a, x; 5075#ifdef HAVE_LONG_LONG 5076 const PY_LONG_LONG llb = intval; 5077 PY_LONG_LONG lla, llx; 5078#endif 5079 if (unlikely(__Pyx_PyLong_IsZero(op1))) { 5080 return __Pyx_NewRef(op2); 5081 } 5082 if (likely(__Pyx_PyLong_IsCompact(op1))) { 5083 a = __Pyx_PyLong_CompactValue(op1); 5084 } else { 5085 const digit* digits = __Pyx_PyLong_Digits(op1); 5086 const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(op1); 5087 switch (size) { 5088 case -2: 5089 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { 5090 a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); 5091 break; 5092 #ifdef HAVE_LONG_LONG 5093 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { 5094 lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); 5095 goto long_long; 5096 #endif 5097 } 5098 CYTHON_FALLTHROUGH; 5099 case 2: 5100 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { 5101 a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); 5102 break; 5103 #ifdef HAVE_LONG_LONG 5104 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { 5105 lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); 5106 goto long_long; 5107 #endif 5108 } 5109 CYTHON_FALLTHROUGH; 5110 case -3: 5111 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { 5112 a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); 5113 break; 5114 #ifdef HAVE_LONG_LONG 5115 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { 5116 lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); 5117 goto long_long; 5118 #endif 5119 } 5120 CYTHON_FALLTHROUGH; 5121 case 3: 5122 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { 5123 a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); 5124 break; 5125 #ifdef HAVE_LONG_LONG 5126 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { 5127 lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); 5128 goto long_long; 5129 #endif 5130 } 5131 CYTHON_FALLTHROUGH; 5132 case -4: 5133 if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { 5134 a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); 5135 break; 5136 #ifdef HAVE_LONG_LONG 5137 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { 5138 lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); 5139 goto long_long; 5140 #endif 5141 } 5142 CYTHON_FALLTHROUGH; 5143 case 4: 5144 if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { 5145 a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); 5146 break; 5147 #ifdef HAVE_LONG_LONG 5148 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { 5149 lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); 5150 goto long_long; 5151 #endif 5152 } 5153 CYTHON_FALLTHROUGH; 5154 default: return PyLong_Type.tp_as_number->nb_add(op1, op2); 5155 } 5156 } 5157 x = a + b; 5158 return PyLong_FromLong(x); 5159#ifdef HAVE_LONG_LONG 5160 long_long: 5161 llx = lla + llb; 5162 return PyLong_FromLongLong(llx); 5163#endif 5164 5165 5166 } 5167 #endif 5168 if (PyFloat_CheckExact(op1)) { 5169 const long b = intval; 5170#if CYTHON_COMPILING_IN_LIMITED_API 5171 double a = __pyx_PyFloat_AsDouble(op1); 5172#else 5173 double a = PyFloat_AS_DOUBLE(op1); 5174#endif 5175 double result; 5176 5177 PyFPE_START_PROTECT("add", return NULL) 5178 result = ((double)a) + (double)b; 5179 PyFPE_END_PROTECT(result) 5180 return PyFloat_FromDouble(result); 5181 } 5182 return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2); 5183} 5184#endif 5185 5186/* PyDictVersioning */ 5187#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS 5188static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { 5189 PyObject *dict = Py_TYPE(obj)->tp_dict; 5190 return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; 5191} 5192static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { 5193 PyObject **dictptr = NULL; 5194 Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; 5195 if (offset) { 5196#if CYTHON_COMPILING_IN_CPYTHON 5197 dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); 5198#else 5199 dictptr = _PyObject_GetDictPtr(obj); 5200#endif 5201 } 5202 return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; 5203} 5204static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { 5205 PyObject *dict = Py_TYPE(obj)->tp_dict; 5206 if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) 5207 return 0; 5208 return obj_dict_version == __Pyx_get_object_dict_version(obj); 5209} 5210#endif 5211 5212/* GetModuleGlobalName */ 5213#if CYTHON_USE_DICT_VERSIONS 5214static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) 5215#else 5216static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) 5217#endif 5218{ 5219 PyObject *result; 5220#if !CYTHON_AVOID_BORROWED_REFS 5221#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && PY_VERSION_HEX < 0x030d0000 5222 result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); 5223 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) 5224 if (likely(result)) { 5225 return __Pyx_NewRef(result); 5226 } else if (unlikely(PyErr_Occurred())) { 5227 return NULL; 5228 } 5229#elif CYTHON_COMPILING_IN_LIMITED_API 5230 if (unlikely(!__pyx_m)) { 5231 return NULL; 5232 } 5233 result = PyObject_GetAttr(__pyx_m, name); 5234 if (likely(result)) { 5235 return result; 5236 } 5237#else 5238 result = PyDict_GetItem(__pyx_d, name); 5239 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) 5240 if (likely(result)) { 5241 return __Pyx_NewRef(result); 5242 } 5243#endif 5244#else 5245 result = PyObject_GetItem(__pyx_d, name); 5246 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) 5247 if (likely(result)) { 5248 return __Pyx_NewRef(result); 5249 } 5250 PyErr_Clear(); 5251#endif 5252 return __Pyx_GetBuiltinName(name); 5253} 5254 5255/* PyFunctionFastCall */ 5256#if CYTHON_FAST_PYCALL && !CYTHON_VECTORCALL 5257static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, 5258 PyObject *globals) { 5259 PyFrameObject *f; 5260 PyThreadState *tstate = __Pyx_PyThreadState_Current; 5261 PyObject **fastlocals; 5262 Py_ssize_t i; 5263 PyObject *result; 5264 assert(globals != NULL); 5265 /* XXX Perhaps we should create a specialized 5266 PyFrame_New() that doesn't take locals, but does 5267 take builtins without sanity checking them. 5268 */ 5269 assert(tstate != NULL); 5270 f = PyFrame_New(tstate, co, globals, NULL); 5271 if (f == NULL) { 5272 return NULL; 5273 } 5274 fastlocals = __Pyx_PyFrame_GetLocalsplus(f); 5275 for (i = 0; i < na; i++) { 5276 Py_INCREF(*args); 5277 fastlocals[i] = *args++; 5278 } 5279 result = PyEval_EvalFrameEx(f,0); 5280 ++tstate->recursion_depth; 5281 Py_DECREF(f); 5282 --tstate->recursion_depth; 5283 return result; 5284} 5285static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) { 5286 PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); 5287 PyObject *globals = PyFunction_GET_GLOBALS(func); 5288 PyObject *argdefs = PyFunction_GET_DEFAULTS(func); 5289 PyObject *closure; 5290#if PY_MAJOR_VERSION >= 3 5291 PyObject *kwdefs; 5292#endif 5293 PyObject *kwtuple, **k; 5294 PyObject **d; 5295 Py_ssize_t nd; 5296 Py_ssize_t nk; 5297 PyObject *result; 5298 assert(kwargs == NULL || PyDict_Check(kwargs)); 5299 nk = kwargs ? PyDict_Size(kwargs) : 0; 5300 #if PY_MAJOR_VERSION < 3 5301 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) { 5302 return NULL; 5303 } 5304 #else 5305 if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) { 5306 return NULL; 5307 } 5308 #endif 5309 if ( 5310#if PY_MAJOR_VERSION >= 3 5311 co->co_kwonlyargcount == 0 && 5312#endif 5313 likely(kwargs == NULL || nk == 0) && 5314 co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { 5315 if (argdefs == NULL && co->co_argcount == nargs) { 5316 result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); 5317 goto done; 5318 } 5319 else if (nargs == 0 && argdefs != NULL 5320 && co->co_argcount == Py_SIZE(argdefs)) { 5321 /* function called with no arguments, but all parameters have 5322 a default value: use default values as arguments .*/ 5323 args = &PyTuple_GET_ITEM(argdefs, 0); 5324 result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); 5325 goto done; 5326 } 5327 } 5328 if (kwargs != NULL) { 5329 Py_ssize_t pos, i; 5330 kwtuple = PyTuple_New(2 * nk); 5331 if (kwtuple == NULL) { 5332 result = NULL; 5333 goto done; 5334 } 5335 k = &PyTuple_GET_ITEM(kwtuple, 0); 5336 pos = i = 0; 5337 while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { 5338 Py_INCREF(k[i]); 5339 Py_INCREF(k[i+1]); 5340 i += 2; 5341 } 5342 nk = i / 2; 5343 } 5344 else { 5345 kwtuple = NULL; 5346 k = NULL; 5347 } 5348 closure = PyFunction_GET_CLOSURE(func); 5349#if PY_MAJOR_VERSION >= 3 5350 kwdefs = PyFunction_GET_KW_DEFAULTS(func); 5351#endif 5352 if (argdefs != NULL) { 5353 d = &PyTuple_GET_ITEM(argdefs, 0); 5354 nd = Py_SIZE(argdefs); 5355 } 5356 else { 5357 d = NULL; 5358 nd = 0; 5359 } 5360#if PY_MAJOR_VERSION >= 3 5361 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, 5362 args, (int)nargs, 5363 k, (int)nk, 5364 d, (int)nd, kwdefs, closure); 5365#else 5366 result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, 5367 args, (int)nargs, 5368 k, (int)nk, 5369 d, (int)nd, closure); 5370#endif 5371 Py_XDECREF(kwtuple); 5372done: 5373 Py_LeaveRecursiveCall(); 5374 return result; 5375} 5376#endif 5377 5378/* PyObjectCallMethO */ 5379#if CYTHON_COMPILING_IN_CPYTHON 5380static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { 5381 PyObject *self, *result; 5382 PyCFunction cfunc; 5383 cfunc = __Pyx_CyOrPyCFunction_GET_FUNCTION(func); 5384 self = __Pyx_CyOrPyCFunction_GET_SELF(func); 5385 #if PY_MAJOR_VERSION < 3 5386 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) 5387 return NULL; 5388 #else 5389 if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) 5390 return NULL; 5391 #endif 5392 result = cfunc(self, arg); 5393 Py_LeaveRecursiveCall(); 5394 if (unlikely(!result) && unlikely(!PyErr_Occurred())) { 5395 PyErr_SetString( 5396 PyExc_SystemError, 5397 "NULL result without error in PyObject_Call"); 5398 } 5399 return result; 5400} 5401#endif 5402 5403/* PyObjectFastCall */ 5404#if PY_VERSION_HEX < 0x03090000 || CYTHON_COMPILING_IN_LIMITED_API 5405static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs) { 5406 PyObject *argstuple; 5407 PyObject *result = 0; 5408 size_t i; 5409 argstuple = PyTuple_New((Py_ssize_t)nargs); 5410 if (unlikely(!argstuple)) return NULL; 5411 for (i = 0; i < nargs; i++) { 5412 Py_INCREF(args[i]); 5413 if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) < 0) goto bad; 5414 } 5415 result = __Pyx_PyObject_Call(func, argstuple, kwargs); 5416 bad: 5417 Py_DECREF(argstuple); 5418 return result; 5419} 5420#endif 5421static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t _nargs, PyObject *kwargs) { 5422 Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs); 5423#if CYTHON_COMPILING_IN_CPYTHON 5424 if (nargs == 0 && kwargs == NULL) { 5425 if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_NOARGS)) 5426 return __Pyx_PyObject_CallMethO(func, NULL); 5427 } 5428 else if (nargs == 1 && kwargs == NULL) { 5429 if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_O)) 5430 return __Pyx_PyObject_CallMethO(func, args[0]); 5431 } 5432#endif 5433 #if PY_VERSION_HEX < 0x030800B1 5434 #if CYTHON_FAST_PYCCALL 5435 if (PyCFunction_Check(func)) { 5436 if (kwargs) { 5437 return _PyCFunction_FastCallDict(func, args, nargs, kwargs); 5438 } else { 5439 return _PyCFunction_FastCallKeywords(func, args, nargs, NULL); 5440 } 5441 } 5442 #if PY_VERSION_HEX >= 0x030700A1 5443 if (!kwargs && __Pyx_IS_TYPE(func, &PyMethodDescr_Type)) { 5444 return _PyMethodDescr_FastCallKeywords(func, args, nargs, NULL); 5445 } 5446 #endif 5447 #endif 5448 #if CYTHON_FAST_PYCALL 5449 if (PyFunction_Check(func)) { 5450 return __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs); 5451 } 5452 #endif 5453 #endif 5454 if (kwargs == NULL) { 5455 #if CYTHON_VECTORCALL 5456 #if PY_VERSION_HEX < 0x03090000 5457 vectorcallfunc f = _PyVectorcall_Function(func); 5458 #else 5459 vectorcallfunc f = PyVectorcall_Function(func); 5460 #endif 5461 if (f) { 5462 return f(func, args, (size_t)nargs, NULL); 5463 } 5464 #elif defined(__Pyx_CyFunction_USED) && CYTHON_BACKPORT_VECTORCALL 5465 if (__Pyx_CyFunction_CheckExact(func)) { 5466 __pyx_vectorcallfunc f = __Pyx_CyFunction_func_vectorcall(func); 5467 if (f) return f(func, args, (size_t)nargs, NULL); 5468 } 5469 #endif 5470 } 5471 if (nargs == 0) { 5472 return __Pyx_PyObject_Call(func, __pyx_empty_tuple, kwargs); 5473 } 5474 #if PY_VERSION_HEX >= 0x03090000 && !CYTHON_COMPILING_IN_LIMITED_API 5475 return PyObject_VectorcallDict(func, args, (size_t)nargs, kwargs); 5476 #else 5477 return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs); 5478 #endif 5479} 5480 5481/* PyIntCompare */ 5482static CYTHON_INLINE int __Pyx_PyInt_BoolNeObjC(PyObject *op1, PyObject *op2, long intval, long inplace) { 5483 CYTHON_MAYBE_UNUSED_VAR(intval); 5484 CYTHON_UNUSED_VAR(inplace); 5485 if (op1 == op2) { 5486 return 0; 5487 } 5488 #if PY_MAJOR_VERSION < 3 5489 if (likely(PyInt_CheckExact(op1))) { 5490 const long b = intval; 5491 long a = PyInt_AS_LONG(op1); 5492 return (a != b); 5493 } 5494 #endif 5495 #if CYTHON_USE_PYLONG_INTERNALS 5496 if (likely(PyLong_CheckExact(op1))) { 5497 int unequal; 5498 unsigned long uintval; 5499 Py_ssize_t size = __Pyx_PyLong_DigitCount(op1); 5500 const digit* digits = __Pyx_PyLong_Digits(op1); 5501 if (intval == 0) { 5502 return (__Pyx_PyLong_IsZero(op1) != 1); 5503 } else if (intval < 0) { 5504 if (__Pyx_PyLong_IsNonNeg(op1)) 5505 return 1; 5506 intval = -intval; 5507 } else { 5508 if (__Pyx_PyLong_IsNeg(op1)) 5509 return 1; 5510 } 5511 uintval = (unsigned long) intval; 5512#if PyLong_SHIFT * 4 < SIZEOF_LONG*8 5513 if (uintval >> (PyLong_SHIFT * 4)) { 5514 unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) 5515 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); 5516 } else 5517#endif 5518#if PyLong_SHIFT * 3 < SIZEOF_LONG*8 5519 if (uintval >> (PyLong_SHIFT * 3)) { 5520 unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) 5521 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); 5522 } else 5523#endif 5524#if PyLong_SHIFT * 2 < SIZEOF_LONG*8 5525 if (uintval >> (PyLong_SHIFT * 2)) { 5526 unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) 5527 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); 5528 } else 5529#endif 5530#if PyLong_SHIFT * 1 < SIZEOF_LONG*8 5531 if (uintval >> (PyLong_SHIFT * 1)) { 5532 unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) 5533 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); 5534 } else 5535#endif 5536 unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK)); 5537 return (unequal != 0); 5538 } 5539 #endif 5540 if (PyFloat_CheckExact(op1)) { 5541 const long b = intval; 5542#if CYTHON_COMPILING_IN_LIMITED_API 5543 double a = __pyx_PyFloat_AsDouble(op1); 5544#else 5545 double a = PyFloat_AS_DOUBLE(op1); 5546#endif 5547 return ((double)a != (double)b); 5548 } 5549 return __Pyx_PyObject_IsTrueAndDecref( 5550 PyObject_RichCompare(op1, op2, Py_NE)); 5551} 5552 5553/* PyIntBinop */ 5554#if !CYTHON_COMPILING_IN_PYPY 5555static PyObject* __Pyx_PyInt_MultiplyCObj(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) { 5556 CYTHON_MAYBE_UNUSED_VAR(intval); 5557 CYTHON_MAYBE_UNUSED_VAR(inplace); 5558 CYTHON_UNUSED_VAR(zerodivision_check); 5559 #if PY_MAJOR_VERSION < 3 5560 if (likely(PyInt_CheckExact(op2))) { 5561 const long a = intval; 5562 long b = PyInt_AS_LONG(op2); 5563 5564#ifdef HAVE_LONG_LONG 5565 if (sizeof(PY_LONG_LONG) > sizeof(long)) { 5566 PY_LONG_LONG result = (PY_LONG_LONG)a * (PY_LONG_LONG)b; 5567 return (result >= LONG_MIN && result <= LONG_MAX) ? 5568 PyInt_FromLong((long)result) : PyLong_FromLongLong(result); 5569 } 5570#endif 5571#if CYTHON_USE_TYPE_SLOTS 5572 return PyInt_Type.tp_as_number->nb_multiply(op1, op2); 5573#else 5574 return PyNumber_Multiply(op1, op2); 5575#endif 5576 } 5577 #endif 5578 #if CYTHON_USE_PYLONG_INTERNALS 5579 if (likely(PyLong_CheckExact(op2))) { 5580 const long a = intval; 5581 long b, x; 5582#ifdef HAVE_LONG_LONG 5583 const PY_LONG_LONG lla = intval; 5584 PY_LONG_LONG llb, llx; 5585#endif 5586 if (unlikely(__Pyx_PyLong_IsZero(op2))) { 5587 return __Pyx_NewRef(op2); 5588 } 5589 if (likely(__Pyx_PyLong_IsCompact(op2))) { 5590 b = __Pyx_PyLong_CompactValue(op2); 5591 } else { 5592 const digit* digits = __Pyx_PyLong_Digits(op2); 5593 const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(op2); 5594 switch (size) { 5595 case -2: 5596 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT+30) { 5597 b = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); 5598 break; 5599 #ifdef HAVE_LONG_LONG 5600 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT+30) { 5601 llb = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); 5602 goto long_long; 5603 #endif 5604 } 5605 CYTHON_FALLTHROUGH; 5606 case 2: 5607 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT+30) { 5608 b = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); 5609 break; 5610 #ifdef HAVE_LONG_LONG 5611 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT+30) { 5612 llb = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); 5613 goto long_long; 5614 #endif 5615 } 5616 CYTHON_FALLTHROUGH; 5617 case -3: 5618 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT+30) { 5619 b = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); 5620 break; 5621 #ifdef HAVE_LONG_LONG 5622 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT+30) { 5623 llb = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); 5624 goto long_long; 5625 #endif 5626 } 5627 CYTHON_FALLTHROUGH; 5628 case 3: 5629 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT+30) { 5630 b = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); 5631 break; 5632 #ifdef HAVE_LONG_LONG 5633 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT+30) { 5634 llb = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); 5635 goto long_long; 5636 #endif 5637 } 5638 CYTHON_FALLTHROUGH; 5639 case -4: 5640 if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT+30) { 5641 b = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); 5642 break; 5643 #ifdef HAVE_LONG_LONG 5644 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT+30) { 5645 llb = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); 5646 goto long_long; 5647 #endif 5648 } 5649 CYTHON_FALLTHROUGH; 5650 case 4: 5651 if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT+30) { 5652 b = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); 5653 break; 5654 #ifdef HAVE_LONG_LONG 5655 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT+30) { 5656 llb = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); 5657 goto long_long; 5658 #endif 5659 } 5660 CYTHON_FALLTHROUGH; 5661 default: return PyLong_Type.tp_as_number->nb_multiply(op1, op2); 5662 } 5663 } 5664 CYTHON_UNUSED_VAR(a); 5665 CYTHON_UNUSED_VAR(b); 5666 #ifdef HAVE_LONG_LONG 5667 llb = b; 5668 goto long_long; 5669 #else 5670 return PyLong_Type.tp_as_number->nb_multiply(op1, op2); 5671 #endif 5672 return PyLong_FromLong(x); 5673#ifdef HAVE_LONG_LONG 5674 long_long: 5675 llx = lla * llb; 5676 return PyLong_FromLongLong(llx); 5677#endif 5678 5679 5680 } 5681 #endif 5682 if (PyFloat_CheckExact(op2)) { 5683 const long a = intval; 5684#if CYTHON_COMPILING_IN_LIMITED_API 5685 double b = __pyx_PyFloat_AsDouble(op2); 5686#else 5687 double b = PyFloat_AS_DOUBLE(op2); 5688#endif 5689 double result; 5690 5691 PyFPE_START_PROTECT("multiply", return NULL) 5692 result = ((double)a) * (double)b; 5693 PyFPE_END_PROTECT(result) 5694 return PyFloat_FromDouble(result); 5695 } 5696 return (inplace ? PyNumber_InPlaceMultiply : PyNumber_Multiply)(op1, op2); 5697} 5698#endif 5699 5700/* RaiseUnexpectedTypeError */ 5701static int 5702__Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj) 5703{ 5704 __Pyx_TypeName obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); 5705 PyErr_Format(PyExc_TypeError, "Expected %s, got " __Pyx_FMT_TYPENAME, 5706 expected, obj_type_name); 5707 __Pyx_DECREF_TypeName(obj_type_name); 5708 return 0; 5709} 5710 5711/* SliceTupleAndList */ 5712#if CYTHON_COMPILING_IN_CPYTHON 5713static CYTHON_INLINE void __Pyx_crop_slice(Py_ssize_t* _start, Py_ssize_t* _stop, Py_ssize_t* _length) { 5714 Py_ssize_t start = *_start, stop = *_stop, length = *_length; 5715 if (start < 0) { 5716 start += length; 5717 if (start < 0) 5718 start = 0; 5719 } 5720 if (stop < 0) 5721 stop += length; 5722 else if (stop > length) 5723 stop = length; 5724 *_length = stop - start; 5725 *_start = start; 5726 *_stop = stop; 5727} 5728static CYTHON_INLINE PyObject* __Pyx_PyList_GetSlice( 5729 PyObject* src, Py_ssize_t start, Py_ssize_t stop) { 5730 Py_ssize_t length = PyList_GET_SIZE(src); 5731 __Pyx_crop_slice(&start, &stop, &length); 5732 if (length <= 0) { 5733 return PyList_New(0); 5734 } 5735 return __Pyx_PyList_FromArray(((PyListObject*)src)->ob_item + start, length); 5736} 5737static CYTHON_INLINE PyObject* __Pyx_PyTuple_GetSlice( 5738 PyObject* src, Py_ssize_t start, Py_ssize_t stop) { 5739 Py_ssize_t length = PyTuple_GET_SIZE(src); 5740 __Pyx_crop_slice(&start, &stop, &length); 5741 return __Pyx_PyTuple_FromArray(((PyTupleObject*)src)->ob_item + start, length); 5742} 5743#endif 5744 5745/* PyObjectCallOneArg */ 5746static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { 5747 PyObject *args[2] = {NULL, arg}; 5748 return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); 5749} 5750 5751/* ObjectGetItem */ 5752#if CYTHON_USE_TYPE_SLOTS 5753static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject *index) { 5754 PyObject *runerr = NULL; 5755 Py_ssize_t key_value; 5756 key_value = __Pyx_PyIndex_AsSsize_t(index); 5757 if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) { 5758 return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1); 5759 } 5760 if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) { 5761 __Pyx_TypeName index_type_name = __Pyx_PyType_GetName(Py_TYPE(index)); 5762 PyErr_Clear(); 5763 PyErr_Format(PyExc_IndexError, 5764 "cannot fit '" __Pyx_FMT_TYPENAME "' into an index-sized integer", index_type_name); 5765 __Pyx_DECREF_TypeName(index_type_name); 5766 } 5767 return NULL; 5768} 5769static PyObject *__Pyx_PyObject_GetItem_Slow(PyObject *obj, PyObject *key) { 5770 __Pyx_TypeName obj_type_name; 5771 if (likely(PyType_Check(obj))) { 5772 PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(obj, __pyx_n_s_class_getitem); 5773 if (!meth) { 5774 PyErr_Clear(); 5775 } else { 5776 PyObject *result = __Pyx_PyObject_CallOneArg(meth, key); 5777 Py_DECREF(meth); 5778 return result; 5779 } 5780 } 5781 obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); 5782 PyErr_Format(PyExc_TypeError, 5783 "'" __Pyx_FMT_TYPENAME "' object is not subscriptable", obj_type_name); 5784 __Pyx_DECREF_TypeName(obj_type_name); 5785 return NULL; 5786} 5787static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key) { 5788 PyTypeObject *tp = Py_TYPE(obj); 5789 PyMappingMethods *mm = tp->tp_as_mapping; 5790 PySequenceMethods *sm = tp->tp_as_sequence; 5791 if (likely(mm && mm->mp_subscript)) { 5792 return mm->mp_subscript(obj, key); 5793 } 5794 if (likely(sm && sm->sq_item)) { 5795 return __Pyx_PyObject_GetIndex(obj, key); 5796 } 5797 return __Pyx_PyObject_GetItem_Slow(obj, key); 5798} 5799#endif 5800 5801/* PyIntCompare */ 5802static CYTHON_INLINE int __Pyx_PyInt_BoolEqObjC(PyObject *op1, PyObject *op2, long intval, long inplace) { 5803 CYTHON_MAYBE_UNUSED_VAR(intval); 5804 CYTHON_UNUSED_VAR(inplace); 5805 if (op1 == op2) { 5806 return 1; 5807 } 5808 #if PY_MAJOR_VERSION < 3 5809 if (likely(PyInt_CheckExact(op1))) { 5810 const long b = intval; 5811 long a = PyInt_AS_LONG(op1); 5812 return (a == b); 5813 } 5814 #endif 5815 #if CYTHON_USE_PYLONG_INTERNALS 5816 if (likely(PyLong_CheckExact(op1))) { 5817 int unequal; 5818 unsigned long uintval; 5819 Py_ssize_t size = __Pyx_PyLong_DigitCount(op1); 5820 const digit* digits = __Pyx_PyLong_Digits(op1); 5821 if (intval == 0) { 5822 return (__Pyx_PyLong_IsZero(op1) == 1); 5823 } else if (intval < 0) { 5824 if (__Pyx_PyLong_IsNonNeg(op1)) 5825 return 0; 5826 intval = -intval; 5827 } else { 5828 if (__Pyx_PyLong_IsNeg(op1)) 5829 return 0; 5830 } 5831 uintval = (unsigned long) intval; 5832#if PyLong_SHIFT * 4 < SIZEOF_LONG*8 5833 if (uintval >> (PyLong_SHIFT * 4)) { 5834 unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) 5835 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); 5836 } else 5837#endif 5838#if PyLong_SHIFT * 3 < SIZEOF_LONG*8 5839 if (uintval >> (PyLong_SHIFT * 3)) { 5840 unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) 5841 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); 5842 } else 5843#endif 5844#if PyLong_SHIFT * 2 < SIZEOF_LONG*8 5845 if (uintval >> (PyLong_SHIFT * 2)) { 5846 unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) 5847 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); 5848 } else 5849#endif 5850#if PyLong_SHIFT * 1 < SIZEOF_LONG*8 5851 if (uintval >> (PyLong_SHIFT * 1)) { 5852 unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) 5853 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); 5854 } else 5855#endif 5856 unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK)); 5857 return (unequal == 0); 5858 } 5859 #endif 5860 if (PyFloat_CheckExact(op1)) { 5861 const long b = intval; 5862#if CYTHON_COMPILING_IN_LIMITED_API 5863 double a = __pyx_PyFloat_AsDouble(op1); 5864#else 5865 double a = PyFloat_AS_DOUBLE(op1); 5866#endif 5867 return ((double)a == (double)b); 5868 } 5869 return __Pyx_PyObject_IsTrueAndDecref( 5870 PyObject_RichCompare(op1, op2, Py_EQ)); 5871} 5872 5873/* Import */ 5874static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { 5875 PyObject *module = 0; 5876 PyObject *empty_dict = 0; 5877 PyObject *empty_list = 0; 5878 #if PY_MAJOR_VERSION < 3 5879 PyObject *py_import; 5880 py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); 5881 if (unlikely(!py_import)) 5882 goto bad; 5883 if (!from_list) { 5884 empty_list = PyList_New(0); 5885 if (unlikely(!empty_list)) 5886 goto bad; 5887 from_list = empty_list; 5888 } 5889 #endif 5890 empty_dict = PyDict_New(); 5891 if (unlikely(!empty_dict)) 5892 goto bad; 5893 { 5894 #if PY_MAJOR_VERSION >= 3 5895 if (level == -1) { 5896 if (strchr(__Pyx_MODULE_NAME, '.') != NULL) { 5897 module = PyImport_ImportModuleLevelObject( 5898 name, __pyx_d, empty_dict, from_list, 1); 5899 if (unlikely(!module)) { 5900 if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError))) 5901 goto bad; 5902 PyErr_Clear(); 5903 } 5904 } 5905 level = 0; 5906 } 5907 #endif 5908 if (!module) { 5909 #if PY_MAJOR_VERSION < 3 5910 PyObject *py_level = PyInt_FromLong(level); 5911 if (unlikely(!py_level)) 5912 goto bad; 5913 module = PyObject_CallFunctionObjArgs(py_import, 5914 name, __pyx_d, empty_dict, from_list, py_level, (PyObject *)NULL); 5915 Py_DECREF(py_level); 5916 #else 5917 module = PyImport_ImportModuleLevelObject( 5918 name, __pyx_d, empty_dict, from_list, level); 5919 #endif 5920 } 5921 } 5922bad: 5923 Py_XDECREF(empty_dict); 5924 Py_XDECREF(empty_list); 5925 #if PY_MAJOR_VERSION < 3 5926 Py_XDECREF(py_import); 5927 #endif 5928 return module; 5929} 5930 5931/* ImportFrom */ 5932static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { 5933 PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); 5934 if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { 5935 const char* module_name_str = 0; 5936 PyObject* module_name = 0; 5937 PyObject* module_dot = 0; 5938 PyObject* full_name = 0; 5939 PyErr_Clear(); 5940 module_name_str = PyModule_GetName(module); 5941 if (unlikely(!module_name_str)) { goto modbad; } 5942 module_name = PyUnicode_FromString(module_name_str); 5943 if (unlikely(!module_name)) { goto modbad; } 5944 module_dot = PyUnicode_Concat(module_name, __pyx_kp_u__2); 5945 if (unlikely(!module_dot)) { goto modbad; } 5946 full_name = PyUnicode_Concat(module_dot, name); 5947 if (unlikely(!full_name)) { goto modbad; } 5948 #if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) 5949 { 5950 PyObject *modules = PyImport_GetModuleDict(); 5951 if (unlikely(!modules)) 5952 goto modbad; 5953 value = PyObject_GetItem(modules, full_name); 5954 } 5955 #else 5956 value = PyImport_GetModule(full_name); 5957 #endif 5958 modbad: 5959 Py_XDECREF(full_name); 5960 Py_XDECREF(module_dot); 5961 Py_XDECREF(module_name); 5962 } 5963 if (unlikely(!value)) { 5964 PyErr_Format(PyExc_ImportError, 5965 #if PY_MAJOR_VERSION < 3 5966 "cannot import name %.230s", PyString_AS_STRING(name)); 5967 #else 5968 "cannot import name %S", name); 5969 #endif 5970 } 5971 return value; 5972} 5973 5974/* FixUpExtensionType */ 5975#if CYTHON_USE_TYPE_SPECS 5976static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) { 5977#if PY_VERSION_HEX > 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API 5978 CYTHON_UNUSED_VAR(spec); 5979 CYTHON_UNUSED_VAR(type); 5980#else 5981 const PyType_Slot *slot = spec->slots; 5982 while (slot && slot->slot && slot->slot != Py_tp_members) 5983 slot++; 5984 if (slot && slot->slot == Py_tp_members) { 5985 int changed = 0; 5986#if !(PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON) 5987 const 5988#endif 5989 PyMemberDef *memb = (PyMemberDef*) slot->pfunc; 5990 while (memb && memb->name) { 5991 if (memb->name[0] == '_' && memb->name[1] == '_') { 5992#if PY_VERSION_HEX < 0x030900b1 5993 if (strcmp(memb->name, "__weaklistoffset__") == 0) { 5994 assert(memb->type == T_PYSSIZET); 5995 assert(memb->flags == READONLY); 5996 type->tp_weaklistoffset = memb->offset; 5997 changed = 1; 5998 } 5999 else if (strcmp(memb->name, "__dictoffset__") == 0) { 6000 assert(memb->type == T_PYSSIZET); 6001 assert(memb->flags == READONLY); 6002 type->tp_dictoffset = memb->offset; 6003 changed = 1; 6004 } 6005#if CYTHON_METH_FASTCALL 6006 else if (strcmp(memb->name, "__vectorcalloffset__") == 0) { 6007 assert(memb->type == T_PYSSIZET); 6008 assert(memb->flags == READONLY); 6009#if PY_VERSION_HEX >= 0x030800b4 6010 type->tp_vectorcall_offset = memb->offset; 6011#else 6012 type->tp_print = (printfunc) memb->offset; 6013#endif 6014 changed = 1; 6015 } 6016#endif 6017#else 6018 if ((0)); 6019#endif 6020#if PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON 6021 else if (strcmp(memb->name, "__module__") == 0) { 6022 PyObject *descr; 6023 assert(memb->type == T_OBJECT); 6024 assert(memb->flags == 0 || memb->flags == READONLY); 6025 descr = PyDescr_NewMember(type, memb); 6026 if (unlikely(!descr)) 6027 return -1; 6028 if (unlikely(PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr) < 0)) { 6029 Py_DECREF(descr); 6030 return -1; 6031 } 6032 Py_DECREF(descr); 6033 changed = 1; 6034 } 6035#endif 6036 } 6037 memb++; 6038 } 6039 if (changed) 6040 PyType_Modified(type); 6041 } 6042#endif 6043 return 0; 6044} 6045#endif 6046 6047/* FetchSharedCythonModule */ 6048static PyObject *__Pyx_FetchSharedCythonABIModule(void) { 6049 return __Pyx_PyImport_AddModuleRef((char*) __PYX_ABI_MODULE_NAME); 6050} 6051 6052/* FetchCommonType */ 6053static int __Pyx_VerifyCachedType(PyObject *cached_type, 6054 const char *name, 6055 Py_ssize_t basicsize, 6056 Py_ssize_t expected_basicsize) { 6057 if (!PyType_Check(cached_type)) { 6058 PyErr_Format(PyExc_TypeError, 6059 "Shared Cython type %.200s is not a type object", name); 6060 return -1; 6061 } 6062 if (basicsize != expected_basicsize) { 6063 PyErr_Format(PyExc_TypeError, 6064 "Shared Cython type %.200s has the wrong size, try recompiling", 6065 name); 6066 return -1; 6067 } 6068 return 0; 6069} 6070#if !CYTHON_USE_TYPE_SPECS 6071static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { 6072 PyObject* abi_module; 6073 const char* object_name; 6074 PyTypeObject *cached_type = NULL; 6075 abi_module = __Pyx_FetchSharedCythonABIModule(); 6076 if (!abi_module) return NULL; 6077 object_name = strrchr(type->tp_name, '.'); 6078 object_name = object_name ? object_name+1 : type->tp_name; 6079 cached_type = (PyTypeObject*) PyObject_GetAttrString(abi_module, object_name); 6080 if (cached_type) { 6081 if (__Pyx_VerifyCachedType( 6082 (PyObject *)cached_type, 6083 object_name, 6084 cached_type->tp_basicsize, 6085 type->tp_basicsize) < 0) { 6086 goto bad; 6087 } 6088 goto done; 6089 } 6090 if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; 6091 PyErr_Clear(); 6092 if (PyType_Ready(type) < 0) goto bad; 6093 if (PyObject_SetAttrString(abi_module, object_name, (PyObject *)type) < 0) 6094 goto bad; 6095 Py_INCREF(type); 6096 cached_type = type; 6097done: 6098 Py_DECREF(abi_module); 6099 return cached_type; 6100bad: 6101 Py_XDECREF(cached_type); 6102 cached_type = NULL; 6103 goto done; 6104} 6105#else 6106static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases) { 6107 PyObject *abi_module, *cached_type = NULL; 6108 const char* object_name = strrchr(spec->name, '.'); 6109 object_name = object_name ? object_name+1 : spec->name; 6110 abi_module = __Pyx_FetchSharedCythonABIModule(); 6111 if (!abi_module) return NULL; 6112 cached_type = PyObject_GetAttrString(abi_module, object_name); 6113 if (cached_type) { 6114 Py_ssize_t basicsize; 6115#if CYTHON_COMPILING_IN_LIMITED_API 6116 PyObject *py_basicsize; 6117 py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__"); 6118 if (unlikely(!py_basicsize)) goto bad; 6119 basicsize = PyLong_AsSsize_t(py_basicsize); 6120 Py_DECREF(py_basicsize); 6121 py_basicsize = 0; 6122 if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; 6123#else 6124 basicsize = likely(PyType_Check(cached_type)) ? ((PyTypeObject*) cached_type)->tp_basicsize : -1; 6125#endif 6126 if (__Pyx_VerifyCachedType( 6127 cached_type, 6128 object_name, 6129 basicsize, 6130 spec->basicsize) < 0) { 6131 goto bad; 6132 } 6133 goto done; 6134 } 6135 if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; 6136 PyErr_Clear(); 6137 CYTHON_UNUSED_VAR(module); 6138 cached_type = __Pyx_PyType_FromModuleAndSpec(abi_module, spec, bases); 6139 if (unlikely(!cached_type)) goto bad; 6140 if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad; 6141 if (PyObject_SetAttrString(abi_module, object_name, cached_type) < 0) goto bad; 6142done: 6143 Py_DECREF(abi_module); 6144 assert(cached_type == NULL || PyType_Check(cached_type)); 6145 return (PyTypeObject *) cached_type; 6146bad: 6147 Py_XDECREF(cached_type); 6148 cached_type = NULL; 6149 goto done; 6150} 6151#endif 6152 6153/* PyVectorcallFastCallDict */ 6154#if CYTHON_METH_FASTCALL 6155static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) 6156{ 6157 PyObject *res = NULL; 6158 PyObject *kwnames; 6159 PyObject **newargs; 6160 PyObject **kwvalues; 6161 Py_ssize_t i, pos; 6162 size_t j; 6163 PyObject *key, *value; 6164 unsigned long keys_are_strings; 6165 Py_ssize_t nkw = PyDict_GET_SIZE(kw); 6166 newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0])); 6167 if (unlikely(newargs == NULL)) { 6168 PyErr_NoMemory(); 6169 return NULL; 6170 } 6171 for (j = 0; j < nargs; j++) newargs[j] = args[j]; 6172 kwnames = PyTuple_New(nkw); 6173 if (unlikely(kwnames == NULL)) { 6174 PyMem_Free(newargs); 6175 return NULL; 6176 } 6177 kwvalues = newargs + nargs; 6178 pos = i = 0; 6179 keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS; 6180 while (PyDict_Next(kw, &pos, &key, &value)) { 6181 keys_are_strings &= Py_TYPE(key)->tp_flags; 6182 Py_INCREF(key); 6183 Py_INCREF(value); 6184 PyTuple_SET_ITEM(kwnames, i, key); 6185 kwvalues[i] = value; 6186 i++; 6187 } 6188 if (unlikely(!keys_are_strings)) { 6189 PyErr_SetString(PyExc_TypeError, "keywords must be strings"); 6190 goto cleanup; 6191 } 6192 res = vc(func, newargs, nargs, kwnames); 6193cleanup: 6194 Py_DECREF(kwnames); 6195 for (i = 0; i < nkw; i++) 6196 Py_DECREF(kwvalues[i]); 6197 PyMem_Free(newargs); 6198 return res; 6199} 6200static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) 6201{ 6202 if (likely(kw == NULL) || PyDict_GET_SIZE(kw) == 0) { 6203 return vc(func, args, nargs, NULL); 6204 } 6205 return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw); 6206} 6207#endif 6208 6209/* CythonFunctionShared */ 6210#if CYTHON_COMPILING_IN_LIMITED_API 6211static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void *cfunc) { 6212 if (__Pyx_CyFunction_Check(func)) { 6213 return PyCFunction_GetFunction(((__pyx_CyFunctionObject*)func)->func) == (PyCFunction) cfunc; 6214 } else if (PyCFunction_Check(func)) { 6215 return PyCFunction_GetFunction(func) == (PyCFunction) cfunc; 6216 } 6217 return 0; 6218} 6219#else 6220static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void *cfunc) { 6221 return __Pyx_CyOrPyCFunction_Check(func) && __Pyx_CyOrPyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc; 6222} 6223#endif 6224static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) { 6225#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API 6226 __Pyx_Py_XDECREF_SET( 6227 __Pyx_CyFunction_GetClassObj(f), 6228 ((classobj) ? __Pyx_NewRef(classobj) : NULL)); 6229#else 6230 __Pyx_Py_XDECREF_SET( 6231 ((PyCMethodObject *) (f))->mm_class, 6232 (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL)); 6233#endif 6234} 6235static PyObject * 6236__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure) 6237{ 6238 CYTHON_UNUSED_VAR(closure); 6239 if (unlikely(op->func_doc == NULL)) { 6240#if CYTHON_COMPILING_IN_LIMITED_API 6241 op->func_doc = PyObject_GetAttrString(op->func, "__doc__"); 6242 if (unlikely(!op->func_doc)) return NULL; 6243#else 6244 if (((PyCFunctionObject*)op)->m_ml->ml_doc) { 6245#if PY_MAJOR_VERSION >= 3 6246 op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); 6247#else 6248 op->func_doc = PyString_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); 6249#endif 6250 if (unlikely(op->func_doc == NULL)) 6251 return NULL; 6252 } else { 6253 Py_INCREF(Py_None); 6254 return Py_None; 6255 } 6256#endif 6257 } 6258 Py_INCREF(op->func_doc); 6259 return op->func_doc; 6260} 6261static int 6262__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context) 6263{ 6264 CYTHON_UNUSED_VAR(context); 6265 if (value == NULL) { 6266 value = Py_None; 6267 } 6268 Py_INCREF(value); 6269 __Pyx_Py_XDECREF_SET(op->func_doc, value); 6270 return 0; 6271} 6272static PyObject * 6273__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context) 6274{ 6275 CYTHON_UNUSED_VAR(context); 6276 if (unlikely(op->func_name == NULL)) { 6277#if CYTHON_COMPILING_IN_LIMITED_API 6278 op->func_name = PyObject_GetAttrString(op->func, "__name__"); 6279#elif PY_MAJOR_VERSION >= 3 6280 op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); 6281#else 6282 op->func_name = PyString_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); 6283#endif 6284 if (unlikely(op->func_name == NULL)) 6285 return NULL; 6286 } 6287 Py_INCREF(op->func_name); 6288 return op->func_name; 6289} 6290static int 6291__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context) 6292{ 6293 CYTHON_UNUSED_VAR(context); 6294#if PY_MAJOR_VERSION >= 3 6295 if (unlikely(value == NULL || !PyUnicode_Check(value))) 6296#else 6297 if (unlikely(value == NULL || !PyString_Check(value))) 6298#endif 6299 { 6300 PyErr_SetString(PyExc_TypeError, 6301 "__name__ must be set to a string object"); 6302 return -1; 6303 } 6304 Py_INCREF(value); 6305 __Pyx_Py_XDECREF_SET(op->func_name, value); 6306 return 0; 6307} 6308static PyObject * 6309__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context) 6310{ 6311 CYTHON_UNUSED_VAR(context); 6312 Py_INCREF(op->func_qualname); 6313 return op->func_qualname; 6314} 6315static int 6316__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context) 6317{ 6318 CYTHON_UNUSED_VAR(context); 6319#if PY_MAJOR_VERSION >= 3 6320 if (unlikely(value == NULL || !PyUnicode_Check(value))) 6321#else 6322 if (unlikely(value == NULL || !PyString_Check(value))) 6323#endif 6324 { 6325 PyErr_SetString(PyExc_TypeError, 6326 "__qualname__ must be set to a string object"); 6327 return -1; 6328 } 6329 Py_INCREF(value); 6330 __Pyx_Py_XDECREF_SET(op->func_qualname, value); 6331 return 0; 6332} 6333static PyObject * 6334__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context) 6335{ 6336 CYTHON_UNUSED_VAR(context); 6337 if (unlikely(op->func_dict == NULL)) { 6338 op->func_dict = PyDict_New(); 6339 if (unlikely(op->func_dict == NULL)) 6340 return NULL; 6341 } 6342 Py_INCREF(op->func_dict); 6343 return op->func_dict; 6344} 6345static int 6346__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, void *context) 6347{ 6348 CYTHON_UNUSED_VAR(context); 6349 if (unlikely(value == NULL)) { 6350 PyErr_SetString(PyExc_TypeError, 6351 "function's dictionary may not be deleted"); 6352 return -1; 6353 } 6354 if (unlikely(!PyDict_Check(value))) { 6355 PyErr_SetString(PyExc_TypeError, 6356 "setting function's dictionary to a non-dict"); 6357 return -1; 6358 } 6359 Py_INCREF(value); 6360 __Pyx_Py_XDECREF_SET(op->func_dict, value); 6361 return 0; 6362} 6363static PyObject * 6364__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context) 6365{ 6366 CYTHON_UNUSED_VAR(context); 6367 Py_INCREF(op->func_globals); 6368 return op->func_globals; 6369} 6370static PyObject * 6371__Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context) 6372{ 6373 CYTHON_UNUSED_VAR(op); 6374 CYTHON_UNUSED_VAR(context); 6375 Py_INCREF(Py_None); 6376 return Py_None; 6377} 6378static PyObject * 6379__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context) 6380{ 6381 PyObject* result = (op->func_code) ? op->func_code : Py_None; 6382 CYTHON_UNUSED_VAR(context); 6383 Py_INCREF(result); 6384 return result; 6385} 6386static int 6387__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { 6388 int result = 0; 6389 PyObject *res = op->defaults_getter((PyObject *) op); 6390 if (unlikely(!res)) 6391 return -1; 6392 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS 6393 op->defaults_tuple = PyTuple_GET_ITEM(res, 0); 6394 Py_INCREF(op->defaults_tuple); 6395 op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); 6396 Py_INCREF(op->defaults_kwdict); 6397 #else 6398 op->defaults_tuple = __Pyx_PySequence_ITEM(res, 0); 6399 if (unlikely(!op->defaults_tuple)) result = -1; 6400 else { 6401 op->defaults_kwdict = __Pyx_PySequence_ITEM(res, 1); 6402 if (unlikely(!op->defaults_kwdict)) result = -1; 6403 } 6404 #endif 6405 Py_DECREF(res); 6406 return result; 6407} 6408static int 6409__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { 6410 CYTHON_UNUSED_VAR(context); 6411 if (!value) { 6412 value = Py_None; 6413 } else if (unlikely(value != Py_None && !PyTuple_Check(value))) { 6414 PyErr_SetString(PyExc_TypeError, 6415 "__defaults__ must be set to a tuple object"); 6416 return -1; 6417 } 6418 PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not " 6419 "currently affect the values used in function calls", 1); 6420 Py_INCREF(value); 6421 __Pyx_Py_XDECREF_SET(op->defaults_tuple, value); 6422 return 0; 6423} 6424static PyObject * 6425__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) { 6426 PyObject* result = op->defaults_tuple; 6427 CYTHON_UNUSED_VAR(context); 6428 if (unlikely(!result)) { 6429 if (op->defaults_getter) { 6430 if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; 6431 result = op->defaults_tuple; 6432 } else { 6433 result = Py_None; 6434 } 6435 } 6436 Py_INCREF(result); 6437 return result; 6438} 6439static int 6440__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { 6441 CYTHON_UNUSED_VAR(context); 6442 if (!value) { 6443 value = Py_None; 6444 } else if (unlikely(value != Py_None && !PyDict_Check(value))) { 6445 PyErr_SetString(PyExc_TypeError, 6446 "__kwdefaults__ must be set to a dict object"); 6447 return -1; 6448 } 6449 PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not " 6450 "currently affect the values used in function calls", 1); 6451 Py_INCREF(value); 6452 __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value); 6453 return 0; 6454} 6455static PyObject * 6456__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) { 6457 PyObject* result = op->defaults_kwdict; 6458 CYTHON_UNUSED_VAR(context); 6459 if (unlikely(!result)) { 6460 if (op->defaults_getter) { 6461 if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; 6462 result = op->defaults_kwdict; 6463 } else { 6464 result = Py_None; 6465 } 6466 } 6467 Py_INCREF(result); 6468 return result; 6469} 6470static int 6471__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) { 6472 CYTHON_UNUSED_VAR(context); 6473 if (!value || value == Py_None) { 6474 value = NULL; 6475 } else if (unlikely(!PyDict_Check(value))) { 6476 PyErr_SetString(PyExc_TypeError, 6477 "__annotations__ must be set to a dict object"); 6478 return -1; 6479 } 6480 Py_XINCREF(value); 6481 __Pyx_Py_XDECREF_SET(op->func_annotations, value); 6482 return 0; 6483} 6484static PyObject * 6485__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) { 6486 PyObject* result = op->func_annotations; 6487 CYTHON_UNUSED_VAR(context); 6488 if (unlikely(!result)) { 6489 result = PyDict_New(); 6490 if (unlikely(!result)) return NULL; 6491 op->func_annotations = result; 6492 } 6493 Py_INCREF(result); 6494 return result; 6495} 6496static PyObject * 6497__Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) { 6498 int is_coroutine; 6499 CYTHON_UNUSED_VAR(context); 6500 if (op->func_is_coroutine) { 6501 return __Pyx_NewRef(op->func_is_coroutine); 6502 } 6503 is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE; 6504#if PY_VERSION_HEX >= 0x03050000 6505 if (is_coroutine) { 6506 PyObject *module, *fromlist, *marker = __pyx_n_s_is_coroutine; 6507 fromlist = PyList_New(1); 6508 if (unlikely(!fromlist)) return NULL; 6509 Py_INCREF(marker); 6510#if CYTHON_ASSUME_SAFE_MACROS 6511 PyList_SET_ITEM(fromlist, 0, marker); 6512#else 6513 if (unlikely(PyList_SetItem(fromlist, 0, marker) < 0)) { 6514 Py_DECREF(marker); 6515 Py_DECREF(fromlist); 6516 return NULL; 6517 } 6518#endif 6519 module = PyImport_ImportModuleLevelObject(__pyx_n_s_asyncio_coroutines, NULL, NULL, fromlist, 0); 6520 Py_DECREF(fromlist); 6521 if (unlikely(!module)) goto ignore; 6522 op->func_is_coroutine = __Pyx_PyObject_GetAttrStr(module, marker); 6523 Py_DECREF(module); 6524 if (likely(op->func_is_coroutine)) { 6525 return __Pyx_NewRef(op->func_is_coroutine); 6526 } 6527ignore: 6528 PyErr_Clear(); 6529 } 6530#endif 6531 op->func_is_coroutine = __Pyx_PyBool_FromLong(is_coroutine); 6532 return __Pyx_NewRef(op->func_is_coroutine); 6533} 6534#if CYTHON_COMPILING_IN_LIMITED_API 6535static PyObject * 6536__Pyx_CyFunction_get_module(__pyx_CyFunctionObject *op, void *context) { 6537 CYTHON_UNUSED_VAR(context); 6538 return PyObject_GetAttrString(op->func, "__module__"); 6539} 6540static int 6541__Pyx_CyFunction_set_module(__pyx_CyFunctionObject *op, PyObject* value, void *context) { 6542 CYTHON_UNUSED_VAR(context); 6543 return PyObject_SetAttrString(op->func, "__module__", value); 6544} 6545#endif 6546static PyGetSetDef __pyx_CyFunction_getsets[] = { 6547 {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, 6548 {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, 6549 {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, 6550 {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, 6551 {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, 6552 {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, 6553 {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, 6554 {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, 6555 {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, 6556 {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, 6557 {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, 6558 {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, 6559 {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, 6560 {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, 6561 {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, 6562 {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, 6563 {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, 6564 {(char *) "_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0}, 6565#if CYTHON_COMPILING_IN_LIMITED_API 6566 {"__module__", (getter)__Pyx_CyFunction_get_module, (setter)__Pyx_CyFunction_set_module, 0, 0}, 6567#endif 6568 {0, 0, 0, 0, 0} 6569}; 6570static PyMemberDef __pyx_CyFunction_members[] = { 6571#if !CYTHON_COMPILING_IN_LIMITED_API 6572 {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0}, 6573#endif 6574#if CYTHON_USE_TYPE_SPECS 6575 {(char *) "__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0}, 6576#if CYTHON_METH_FASTCALL 6577#if CYTHON_BACKPORT_VECTORCALL 6578 {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0}, 6579#else 6580#if !CYTHON_COMPILING_IN_LIMITED_API 6581 {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0}, 6582#endif 6583#endif 6584#endif 6585#if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API 6586 {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0}, 6587#else 6588 {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0}, 6589#endif 6590#endif 6591 {0, 0, 0, 0, 0} 6592}; 6593static PyObject * 6594__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args) 6595{ 6596 CYTHON_UNUSED_VAR(args); 6597#if PY_MAJOR_VERSION >= 3 6598 Py_INCREF(m->func_qualname); 6599 return m->func_qualname; 6600#else 6601 return PyString_FromString(((PyCFunctionObject*)m)->m_ml->ml_name); 6602#endif 6603} 6604static PyMethodDef __pyx_CyFunction_methods[] = { 6605 {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, 6606 {0, 0, 0, 0} 6607}; 6608#if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API 6609#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist) 6610#else 6611#define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist) 6612#endif 6613static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname, 6614 PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { 6615#if !CYTHON_COMPILING_IN_LIMITED_API 6616 PyCFunctionObject *cf = (PyCFunctionObject*) op; 6617#endif 6618 if (unlikely(op == NULL)) 6619 return NULL; 6620#if CYTHON_COMPILING_IN_LIMITED_API 6621 op->func = PyCFunction_NewEx(ml, (PyObject*)op, module); 6622 if (unlikely(!op->func)) return NULL; 6623#endif 6624 op->flags = flags; 6625 __Pyx_CyFunction_weakreflist(op) = NULL; 6626#if !CYTHON_COMPILING_IN_LIMITED_API 6627 cf->m_ml = ml; 6628 cf->m_self = (PyObject *) op; 6629#endif 6630 Py_XINCREF(closure); 6631 op->func_closure = closure; 6632#if !CYTHON_COMPILING_IN_LIMITED_API 6633 Py_XINCREF(module); 6634 cf->m_module = module; 6635#endif 6636 op->func_dict = NULL; 6637 op->func_name = NULL; 6638 Py_INCREF(qualname); 6639 op->func_qualname = qualname; 6640 op->func_doc = NULL; 6641#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API 6642 op->func_classobj = NULL; 6643#else 6644 ((PyCMethodObject*)op)->mm_class = NULL; 6645#endif 6646 op->func_globals = globals; 6647 Py_INCREF(op->func_globals); 6648 Py_XINCREF(code); 6649 op->func_code = code; 6650 op->defaults_pyobjects = 0; 6651 op->defaults_size = 0; 6652 op->defaults = NULL; 6653 op->defaults_tuple = NULL; 6654 op->defaults_kwdict = NULL; 6655 op->defaults_getter = NULL; 6656 op->func_annotations = NULL; 6657 op->func_is_coroutine = NULL; 6658#if CYTHON_METH_FASTCALL 6659 switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) { 6660 case METH_NOARGS: 6661 __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS; 6662 break; 6663 case METH_O: 6664 __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O; 6665 break; 6666 case METH_METHOD | METH_FASTCALL | METH_KEYWORDS: 6667 __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD; 6668 break; 6669 case METH_FASTCALL | METH_KEYWORDS: 6670 __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS; 6671 break; 6672 case METH_VARARGS | METH_KEYWORDS: 6673 __Pyx_CyFunction_func_vectorcall(op) = NULL; 6674 break; 6675 default: 6676 PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); 6677 Py_DECREF(op); 6678 return NULL; 6679 } 6680#endif 6681 return (PyObject *) op; 6682} 6683static int 6684__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) 6685{ 6686 Py_CLEAR(m->func_closure); 6687#if CYTHON_COMPILING_IN_LIMITED_API 6688 Py_CLEAR(m->func); 6689#else 6690 Py_CLEAR(((PyCFunctionObject*)m)->m_module); 6691#endif 6692 Py_CLEAR(m->func_dict); 6693 Py_CLEAR(m->func_name); 6694 Py_CLEAR(m->func_qualname); 6695 Py_CLEAR(m->func_doc); 6696 Py_CLEAR(m->func_globals); 6697 Py_CLEAR(m->func_code); 6698#if !CYTHON_COMPILING_IN_LIMITED_API 6699#if PY_VERSION_HEX < 0x030900B1 6700 Py_CLEAR(__Pyx_CyFunction_GetClassObj(m)); 6701#else 6702 { 6703 PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class; 6704 ((PyCMethodObject *) (m))->mm_class = NULL; 6705 Py_XDECREF(cls); 6706 } 6707#endif 6708#endif 6709 Py_CLEAR(m->defaults_tuple); 6710 Py_CLEAR(m->defaults_kwdict); 6711 Py_CLEAR(m->func_annotations); 6712 Py_CLEAR(m->func_is_coroutine); 6713 if (m->defaults) { 6714 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); 6715 int i; 6716 for (i = 0; i < m->defaults_pyobjects; i++) 6717 Py_XDECREF(pydefaults[i]); 6718 PyObject_Free(m->defaults); 6719 m->defaults = NULL; 6720 } 6721 return 0; 6722} 6723static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m) 6724{ 6725 if (__Pyx_CyFunction_weakreflist(m) != NULL) 6726 PyObject_ClearWeakRefs((PyObject *) m); 6727 __Pyx_CyFunction_clear(m); 6728 __Pyx_PyHeapTypeObject_GC_Del(m); 6729} 6730static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) 6731{ 6732 PyObject_GC_UnTrack(m); 6733 __Pyx__CyFunction_dealloc(m); 6734} 6735static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) 6736{ 6737 Py_VISIT(m->func_closure); 6738#if CYTHON_COMPILING_IN_LIMITED_API 6739 Py_VISIT(m->func); 6740#else 6741 Py_VISIT(((PyCFunctionObject*)m)->m_module); 6742#endif 6743 Py_VISIT(m->func_dict); 6744 Py_VISIT(m->func_name); 6745 Py_VISIT(m->func_qualname); 6746 Py_VISIT(m->func_doc); 6747 Py_VISIT(m->func_globals); 6748 Py_VISIT(m->func_code); 6749#if !CYTHON_COMPILING_IN_LIMITED_API 6750 Py_VISIT(__Pyx_CyFunction_GetClassObj(m)); 6751#endif 6752 Py_VISIT(m->defaults_tuple); 6753 Py_VISIT(m->defaults_kwdict); 6754 Py_VISIT(m->func_is_coroutine); 6755 if (m->defaults) { 6756 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); 6757 int i; 6758 for (i = 0; i < m->defaults_pyobjects; i++) 6759 Py_VISIT(pydefaults[i]); 6760 } 6761 return 0; 6762} 6763static PyObject* 6764__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) 6765{ 6766#if PY_MAJOR_VERSION >= 3 6767 return PyUnicode_FromFormat("<cyfunction %U at %p>", 6768 op->func_qualname, (void *)op); 6769#else 6770 return PyString_FromFormat("<cyfunction %s at %p>", 6771 PyString_AsString(op->func_qualname), (void *)op); 6772#endif 6773} 6774static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) { 6775#if CYTHON_COMPILING_IN_LIMITED_API 6776 PyObject *f = ((__pyx_CyFunctionObject*)func)->func; 6777 PyObject *py_name = NULL; 6778 PyCFunction meth; 6779 int flags; 6780 meth = PyCFunction_GetFunction(f); 6781 if (unlikely(!meth)) return NULL; 6782 flags = PyCFunction_GetFlags(f); 6783 if (unlikely(flags < 0)) return NULL; 6784#else 6785 PyCFunctionObject* f = (PyCFunctionObject*)func; 6786 PyCFunction meth = f->m_ml->ml_meth; 6787 int flags = f->m_ml->ml_flags; 6788#endif 6789 Py_ssize_t size; 6790 switch (flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { 6791 case METH_VARARGS: 6792 if (likely(kw == NULL || PyDict_Size(kw) == 0)) 6793 return (*meth)(self, arg); 6794 break; 6795 case METH_VARARGS | METH_KEYWORDS: 6796 return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw); 6797 case METH_NOARGS: 6798 if (likely(kw == NULL || PyDict_Size(kw) == 0)) { 6799#if CYTHON_ASSUME_SAFE_MACROS 6800 size = PyTuple_GET_SIZE(arg); 6801#else 6802 size = PyTuple_Size(arg); 6803 if (unlikely(size < 0)) return NULL; 6804#endif 6805 if (likely(size == 0)) 6806 return (*meth)(self, NULL); 6807#if CYTHON_COMPILING_IN_LIMITED_API 6808 py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL); 6809 if (!py_name) return NULL; 6810 PyErr_Format(PyExc_TypeError, 6811 "%.200S() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", 6812 py_name, size); 6813 Py_DECREF(py_name); 6814#else 6815 PyErr_Format(PyExc_TypeError, 6816 "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", 6817 f->m_ml->ml_name, size); 6818#endif 6819 return NULL; 6820 } 6821 break; 6822 case METH_O: 6823 if (likely(kw == NULL || PyDict_Size(kw) == 0)) { 6824#if CYTHON_ASSUME_SAFE_MACROS 6825 size = PyTuple_GET_SIZE(arg); 6826#else 6827 size = PyTuple_Size(arg); 6828 if (unlikely(size < 0)) return NULL; 6829#endif 6830 if (likely(size == 1)) { 6831 PyObject *result, *arg0; 6832 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS 6833 arg0 = PyTuple_GET_ITEM(arg, 0); 6834 #else 6835 arg0 = __Pyx_PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL; 6836 #endif 6837 result = (*meth)(self, arg0); 6838 #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) 6839 Py_DECREF(arg0); 6840 #endif 6841 return result; 6842 } 6843#if CYTHON_COMPILING_IN_LIMITED_API 6844 py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL); 6845 if (!py_name) return NULL; 6846 PyErr_Format(PyExc_TypeError, 6847 "%.200S() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", 6848 py_name, size); 6849 Py_DECREF(py_name); 6850#else 6851 PyErr_Format(PyExc_TypeError, 6852 "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", 6853 f->m_ml->ml_name, size); 6854#endif 6855 return NULL; 6856 } 6857 break; 6858 default: 6859 PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); 6860 return NULL; 6861 } 6862#if CYTHON_COMPILING_IN_LIMITED_API 6863 py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL); 6864 if (!py_name) return NULL; 6865 PyErr_Format(PyExc_TypeError, "%.200S() takes no keyword arguments", 6866 py_name); 6867 Py_DECREF(py_name); 6868#else 6869 PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", 6870 f->m_ml->ml_name); 6871#endif 6872 return NULL; 6873} 6874static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { 6875 PyObject *self, *result; 6876#if CYTHON_COMPILING_IN_LIMITED_API 6877 self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)func)->func); 6878 if (unlikely(!self) && PyErr_Occurred()) return NULL; 6879#else 6880 self = ((PyCFunctionObject*)func)->m_self; 6881#endif 6882 result = __Pyx_CyFunction_CallMethod(func, self, arg, kw); 6883 return result; 6884} 6885static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) { 6886 PyObject *result; 6887 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func; 6888#if CYTHON_METH_FASTCALL 6889 __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc); 6890 if (vc) { 6891#if CYTHON_ASSUME_SAFE_MACROS 6892 return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw); 6893#else 6894 (void) &__Pyx_PyVectorcall_FastCallDict; 6895 return PyVectorcall_Call(func, args, kw); 6896#endif 6897 } 6898#endif 6899 if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { 6900 Py_ssize_t argc; 6901 PyObject *new_args; 6902 PyObject *self; 6903#if CYTHON_ASSUME_SAFE_MACROS 6904 argc = PyTuple_GET_SIZE(args); 6905#else 6906 argc = PyTuple_Size(args); 6907 if (unlikely(!argc) < 0) return NULL; 6908#endif 6909 new_args = PyTuple_GetSlice(args, 1, argc); 6910 if (unlikely(!new_args)) 6911 return NULL; 6912 self = PyTuple_GetItem(args, 0); 6913 if (unlikely(!self)) { 6914 Py_DECREF(new_args); 6915#if PY_MAJOR_VERSION > 2 6916 PyErr_Format(PyExc_TypeError, 6917 "unbound method %.200S() needs an argument", 6918 cyfunc->func_qualname); 6919#else 6920 PyErr_SetString(PyExc_TypeError, 6921 "unbound method needs an argument"); 6922#endif 6923 return NULL; 6924 } 6925 result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw); 6926 Py_DECREF(new_args); 6927 } else { 6928 result = __Pyx_CyFunction_Call(func, args, kw); 6929 } 6930 return result; 6931} 6932#if CYTHON_METH_FASTCALL 6933static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames) 6934{ 6935 int ret = 0; 6936 if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { 6937 if (unlikely(nargs < 1)) { 6938 PyErr_Format(PyExc_TypeError, "%.200s() needs an argument", 6939 ((PyCFunctionObject*)cyfunc)->m_ml->ml_name); 6940 return -1; 6941 } 6942 ret = 1; 6943 } 6944 if (unlikely(kwnames) && unlikely(PyTuple_GET_SIZE(kwnames))) { 6945 PyErr_Format(PyExc_TypeError, 6946 "%.200s() takes no keyword arguments", ((PyCFunctionObject*)cyfunc)->m_ml->ml_name); 6947 return -1; 6948 } 6949 return ret; 6950} 6951static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) 6952{ 6953 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; 6954 PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; 6955#if CYTHON_BACKPORT_VECTORCALL 6956 Py_ssize_t nargs = (Py_ssize_t)nargsf; 6957#else 6958 Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); 6959#endif 6960 PyObject *self; 6961 switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { 6962 case 1: 6963 self = args[0]; 6964 args += 1; 6965 nargs -= 1; 6966 break; 6967 case 0: 6968 self = ((PyCFunctionObject*)cyfunc)->m_self; 6969 break; 6970 default: 6971 return NULL; 6972 } 6973 if (unlikely(nargs != 0)) { 6974 PyErr_Format(PyExc_TypeError, 6975 "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", 6976 def->ml_name, nargs); 6977 return NULL; 6978 } 6979 return def->ml_meth(self, NULL); 6980} 6981static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) 6982{ 6983 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; 6984 PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; 6985#if CYTHON_BACKPORT_VECTORCALL 6986 Py_ssize_t nargs = (Py_ssize_t)nargsf; 6987#else 6988 Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); 6989#endif 6990 PyObject *self; 6991 switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { 6992 case 1: 6993 self = args[0]; 6994 args += 1; 6995 nargs -= 1; 6996 break; 6997 case 0: 6998 self = ((PyCFunctionObject*)cyfunc)->m_self; 6999 break; 7000 default: 7001 return NULL; 7002 } 7003 if (unlikely(nargs != 1)) { 7004 PyErr_Format(PyExc_TypeError, 7005 "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", 7006 def->ml_name, nargs); 7007 return NULL; 7008 } 7009 return def->ml_meth(self, args[0]); 7010} 7011static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) 7012{ 7013 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; 7014 PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; 7015#if CYTHON_BACKPORT_VECTORCALL 7016 Py_ssize_t nargs = (Py_ssize_t)nargsf; 7017#else 7018 Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); 7019#endif 7020 PyObject *self; 7021 switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { 7022 case 1: 7023 self = args[0]; 7024 args += 1; 7025 nargs -= 1; 7026 break; 7027 case 0: 7028 self = ((PyCFunctionObject*)cyfunc)->m_self; 7029 break; 7030 default: 7031 return NULL; 7032 } 7033 return ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))def->ml_meth)(self, args, nargs, kwnames); 7034} 7035static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) 7036{ 7037 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; 7038 PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; 7039 PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc); 7040#if CYTHON_BACKPORT_VECTORCALL 7041 Py_ssize_t nargs = (Py_ssize_t)nargsf; 7042#else 7043 Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); 7044#endif 7045 PyObject *self; 7046 switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { 7047 case 1: 7048 self = args[0]; 7049 args += 1; 7050 nargs -= 1; 7051 break; 7052 case 0: 7053 self = ((PyCFunctionObject*)cyfunc)->m_self; 7054 break; 7055 default: 7056 return NULL; 7057 } 7058 return ((__Pyx_PyCMethod)(void(*)(void))def->ml_meth)(self, cls, args, (size_t)nargs, kwnames); 7059} 7060#endif 7061#if CYTHON_USE_TYPE_SPECS 7062static PyType_Slot __pyx_CyFunctionType_slots[] = { 7063 {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc}, 7064 {Py_tp_repr, (void *)__Pyx_CyFunction_repr}, 7065 {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod}, 7066 {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse}, 7067 {Py_tp_clear, (void *)__Pyx_CyFunction_clear}, 7068 {Py_tp_methods, (void *)__pyx_CyFunction_methods}, 7069 {Py_tp_members, (void *)__pyx_CyFunction_members}, 7070 {Py_tp_getset, (void *)__pyx_CyFunction_getsets}, 7071 {Py_tp_descr_get, (void *)__Pyx_PyMethod_New}, 7072 {0, 0}, 7073}; 7074static PyType_Spec __pyx_CyFunctionType_spec = { 7075 __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", 7076 sizeof(__pyx_CyFunctionObject), 7077 0, 7078#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR 7079 Py_TPFLAGS_METHOD_DESCRIPTOR | 7080#endif 7081#if (defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL) 7082 _Py_TPFLAGS_HAVE_VECTORCALL | 7083#endif 7084 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, 7085 __pyx_CyFunctionType_slots 7086}; 7087#else 7088static PyTypeObject __pyx_CyFunctionType_type = { 7089 PyVarObject_HEAD_INIT(0, 0) 7090 __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", 7091 sizeof(__pyx_CyFunctionObject), 7092 0, 7093 (destructor) __Pyx_CyFunction_dealloc, 7094#if !CYTHON_METH_FASTCALL 7095 0, 7096#elif CYTHON_BACKPORT_VECTORCALL 7097 (printfunc)offsetof(__pyx_CyFunctionObject, func_vectorcall), 7098#else 7099 offsetof(PyCFunctionObject, vectorcall), 7100#endif 7101 0, 7102 0, 7103#if PY_MAJOR_VERSION < 3 7104 0, 7105#else 7106 0, 7107#endif 7108 (reprfunc) __Pyx_CyFunction_repr, 7109 0, 7110 0, 7111 0, 7112 0, 7113 __Pyx_CyFunction_CallAsMethod, 7114 0, 7115 0, 7116 0, 7117 0, 7118#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR 7119 Py_TPFLAGS_METHOD_DESCRIPTOR | 7120#endif 7121#if defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL 7122 _Py_TPFLAGS_HAVE_VECTORCALL | 7123#endif 7124 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, 7125 0, 7126 (traverseproc) __Pyx_CyFunction_traverse, 7127 (inquiry) __Pyx_CyFunction_clear, 7128 0, 7129#if PY_VERSION_HEX < 0x030500A0 7130 offsetof(__pyx_CyFunctionObject, func_weakreflist), 7131#else 7132 offsetof(PyCFunctionObject, m_weakreflist), 7133#endif 7134 0, 7135 0, 7136 __pyx_CyFunction_methods, 7137 __pyx_CyFunction_members, 7138 __pyx_CyFunction_getsets, 7139 0, 7140 0, 7141 __Pyx_PyMethod_New, 7142 0, 7143 offsetof(__pyx_CyFunctionObject, func_dict), 7144 0, 7145 0, 7146 0, 7147 0, 7148 0, 7149 0, 7150 0, 7151 0, 7152 0, 7153 0, 7154 0, 7155 0, 7156#if PY_VERSION_HEX >= 0x030400a1 7157 0, 7158#endif 7159#if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) 7160 0, 7161#endif 7162#if __PYX_NEED_TP_PRINT_SLOT 7163 0, 7164#endif 7165#if PY_VERSION_HEX >= 0x030C0000 7166 0, 7167#endif 7168#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 7169 0, 7170#endif 7171}; 7172#endif 7173static int __pyx_CyFunction_init(PyObject *module) { 7174#if CYTHON_USE_TYPE_SPECS 7175 __pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx_CyFunctionType_spec, NULL); 7176#else 7177 CYTHON_UNUSED_VAR(module); 7178 __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type); 7179#endif 7180 if (unlikely(__pyx_CyFunctionType == NULL)) { 7181 return -1; 7182 } 7183 return 0; 7184} 7185static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) { 7186 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; 7187 m->defaults = PyObject_Malloc(size); 7188 if (unlikely(!m->defaults)) 7189 return PyErr_NoMemory(); 7190 memset(m->defaults, 0, size); 7191 m->defaults_pyobjects = pyobjects; 7192 m->defaults_size = size; 7193 return m->defaults; 7194} 7195static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { 7196 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; 7197 m->defaults_tuple = tuple; 7198 Py_INCREF(tuple); 7199} 7200static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { 7201 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; 7202 m->defaults_kwdict = dict; 7203 Py_INCREF(dict); 7204} 7205static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { 7206 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; 7207 m->func_annotations = dict; 7208 Py_INCREF(dict); 7209} 7210 7211/* CythonFunction */ 7212static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname, 7213 PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { 7214 PyObject *op = __Pyx_CyFunction_Init( 7215 PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType), 7216 ml, flags, qualname, closure, module, globals, code 7217 ); 7218 if (likely(op)) { 7219 PyObject_GC_Track(op); 7220 } 7221 return op; 7222} 7223 7224/* CLineInTraceback */ 7225#ifndef CYTHON_CLINE_IN_TRACEBACK 7226static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { 7227 PyObject *use_cline; 7228 PyObject *ptype, *pvalue, *ptraceback; 7229#if CYTHON_COMPILING_IN_CPYTHON 7230 PyObject **cython_runtime_dict; 7231#endif 7232 CYTHON_MAYBE_UNUSED_VAR(tstate); 7233 if (unlikely(!__pyx_cython_runtime)) { 7234 return c_line; 7235 } 7236 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); 7237#if CYTHON_COMPILING_IN_CPYTHON 7238 cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime); 7239 if (likely(cython_runtime_dict)) { 7240 __PYX_PY_DICT_LOOKUP_IF_MODIFIED( 7241 use_cline, *cython_runtime_dict, 7242 __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback)) 7243 } else 7244#endif 7245 { 7246 PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStrNoError(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); 7247 if (use_cline_obj) { 7248 use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True; 7249 Py_DECREF(use_cline_obj); 7250 } else { 7251 PyErr_Clear(); 7252 use_cline = NULL; 7253 } 7254 } 7255 if (!use_cline) { 7256 c_line = 0; 7257 (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); 7258 } 7259 else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { 7260 c_line = 0; 7261 } 7262 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); 7263 return c_line; 7264} 7265#endif 7266 7267/* CodeObjectCache */ 7268#if !CYTHON_COMPILING_IN_LIMITED_API 7269static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { 7270 int start = 0, mid = 0, end = count - 1; 7271 if (end >= 0 && code_line > entries[end].code_line) { 7272 return count; 7273 } 7274 while (start < end) { 7275 mid = start + (end - start) / 2; 7276 if (code_line < entries[mid].code_line) { 7277 end = mid; 7278 } else if (code_line > entries[mid].code_line) { 7279 start = mid + 1; 7280 } else { 7281 return mid; 7282 } 7283 } 7284 if (code_line <= entries[mid].code_line) { 7285 return mid; 7286 } else { 7287 return mid + 1; 7288 } 7289} 7290static PyCodeObject *__pyx_find_code_object(int code_line) { 7291 PyCodeObject* code_object; 7292 int pos; 7293 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { 7294 return NULL; 7295 } 7296 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); 7297 if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { 7298 return NULL; 7299 } 7300 code_object = __pyx_code_cache.entries[pos].code_object; 7301 Py_INCREF(code_object); 7302 return code_object; 7303} 7304static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { 7305 int pos, i; 7306 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; 7307 if (unlikely(!code_line)) { 7308 return; 7309 } 7310 if (unlikely(!entries)) { 7311 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); 7312 if (likely(entries)) { 7313 __pyx_code_cache.entries = entries; 7314 __pyx_code_cache.max_count = 64; 7315 __pyx_code_cache.count = 1; 7316 entries[0].code_line = code_line; 7317 entries[0].code_object = code_object; 7318 Py_INCREF(code_object); 7319 } 7320 return; 7321 } 7322 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); 7323 if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { 7324 PyCodeObject* tmp = entries[pos].code_object; 7325 entries[pos].code_object = code_object; 7326 Py_DECREF(tmp); 7327 return; 7328 } 7329 if (__pyx_code_cache.count == __pyx_code_cache.max_count) { 7330 int new_max = __pyx_code_cache.max_count + 64; 7331 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( 7332 __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry)); 7333 if (unlikely(!entries)) { 7334 return; 7335 } 7336 __pyx_code_cache.entries = entries; 7337 __pyx_code_cache.max_count = new_max; 7338 } 7339 for (i=__pyx_code_cache.count; i>pos; i--) { 7340 entries[i] = entries[i-1]; 7341 } 7342 entries[pos].code_line = code_line; 7343 entries[pos].code_object = code_object; 7344 __pyx_code_cache.count++; 7345 Py_INCREF(code_object); 7346} 7347#endif 7348 7349/* AddTraceback */ 7350#include "compile.h" 7351#include "frameobject.h" 7352#include "traceback.h" 7353#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API 7354 #ifndef Py_BUILD_CORE 7355 #define Py_BUILD_CORE 1 7356 #endif 7357 #include "internal/pycore_frame.h" 7358#endif 7359#if CYTHON_COMPILING_IN_LIMITED_API 7360static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict, 7361 PyObject *firstlineno, PyObject *name) { 7362 PyObject *replace = NULL; 7363 if (unlikely(PyDict_SetItemString(scratch_dict, "co_firstlineno", firstlineno))) return NULL; 7364 if (unlikely(PyDict_SetItemString(scratch_dict, "co_name", name))) return NULL; 7365 replace = PyObject_GetAttrString(code, "replace"); 7366 if (likely(replace)) { 7367 PyObject *result; 7368 result = PyObject_Call(replace, __pyx_empty_tuple, scratch_dict); 7369 Py_DECREF(replace); 7370 return result; 7371 } 7372 PyErr_Clear(); 7373 #if __PYX_LIMITED_VERSION_HEX < 0x030780000 7374 { 7375 PyObject *compiled = NULL, *result = NULL; 7376 if (unlikely(PyDict_SetItemString(scratch_dict, "code", code))) return NULL; 7377 if (unlikely(PyDict_SetItemString(scratch_dict, "type", (PyObject*)(&PyType_Type)))) return NULL; 7378 compiled = Py_CompileString( 7379 "out = type(code)(\n" 7380 " code.co_argcount, code.co_kwonlyargcount, code.co_nlocals, code.co_stacksize,\n" 7381 " code.co_flags, code.co_code, code.co_consts, code.co_names,\n" 7382 " code.co_varnames, code.co_filename, co_name, co_firstlineno,\n" 7383 " code.co_lnotab)\n", "<dummy>", Py_file_input); 7384 if (!compiled) return NULL; 7385 result = PyEval_EvalCode(compiled, scratch_dict, scratch_dict); 7386 Py_DECREF(compiled); 7387 if (!result) PyErr_Print(); 7388 Py_DECREF(result); 7389 result = PyDict_GetItemString(scratch_dict, "out"); 7390 if (result) Py_INCREF(result); 7391 return result; 7392 } 7393 #else 7394 return NULL; 7395 #endif 7396} 7397static void __Pyx_AddTraceback(const char *funcname, int c_line, 7398 int py_line, const char *filename) { 7399 PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL; 7400 PyObject *replace = NULL, *getframe = NULL, *frame = NULL; 7401 PyObject *exc_type, *exc_value, *exc_traceback; 7402 int success = 0; 7403 if (c_line) { 7404 (void) __pyx_cfilenm; 7405 (void) __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line); 7406 } 7407 PyErr_Fetch(&exc_type, &exc_value, &exc_traceback); 7408 code_object = Py_CompileString("_getframe()", filename, Py_eval_input); 7409 if (unlikely(!code_object)) goto bad; 7410 py_py_line = PyLong_FromLong(py_line); 7411 if (unlikely(!py_py_line)) goto bad; 7412 py_funcname = PyUnicode_FromString(funcname); 7413 if (unlikely(!py_funcname)) goto bad; 7414 dict = PyDict_New(); 7415 if (unlikely(!dict)) goto bad; 7416 { 7417 PyObject *old_code_object = code_object; 7418 code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname); 7419 Py_DECREF(old_code_object); 7420 } 7421 if (unlikely(!code_object)) goto bad; 7422 getframe = PySys_GetObject("_getframe"); 7423 if (unlikely(!getframe)) goto bad; 7424 if (unlikely(PyDict_SetItemString(dict, "_getframe", getframe))) goto bad; 7425 frame = PyEval_EvalCode(code_object, dict, dict); 7426 if (unlikely(!frame) || frame == Py_None) goto bad; 7427 success = 1; 7428 bad: 7429 PyErr_Restore(exc_type, exc_value, exc_traceback); 7430 Py_XDECREF(code_object); 7431 Py_XDECREF(py_py_line); 7432 Py_XDECREF(py_funcname); 7433 Py_XDECREF(dict); 7434 Py_XDECREF(replace); 7435 if (success) { 7436 PyTraceBack_Here( 7437 (struct _frame*)frame); 7438 } 7439 Py_XDECREF(frame); 7440} 7441#else 7442static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( 7443 const char *funcname, int c_line, 7444 int py_line, const char *filename) { 7445 PyCodeObject *py_code = NULL; 7446 PyObject *py_funcname = NULL; 7447 #if PY_MAJOR_VERSION < 3 7448 PyObject *py_srcfile = NULL; 7449 py_srcfile = PyString_FromString(filename); 7450 if (!py_srcfile) goto bad; 7451 #endif 7452 if (c_line) { 7453 #if PY_MAJOR_VERSION < 3 7454 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); 7455 if (!py_funcname) goto bad; 7456 #else 7457 py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); 7458 if (!py_funcname) goto bad; 7459 funcname = PyUnicode_AsUTF8(py_funcname); 7460 if (!funcname) goto bad; 7461 #endif 7462 } 7463 else { 7464 #if PY_MAJOR_VERSION < 3 7465 py_funcname = PyString_FromString(funcname); 7466 if (!py_funcname) goto bad; 7467 #endif 7468 } 7469 #if PY_MAJOR_VERSION < 3 7470 py_code = __Pyx_PyCode_New( 7471 0, 7472 0, 7473 0, 7474 0, 7475 0, 7476 0, 7477 __pyx_empty_bytes, /*PyObject *code,*/ 7478 __pyx_empty_tuple, /*PyObject *consts,*/ 7479 __pyx_empty_tuple, /*PyObject *names,*/ 7480 __pyx_empty_tuple, /*PyObject *varnames,*/ 7481 __pyx_empty_tuple, /*PyObject *freevars,*/ 7482 __pyx_empty_tuple, /*PyObject *cellvars,*/ 7483 py_srcfile, /*PyObject *filename,*/ 7484 py_funcname, /*PyObject *name,*/ 7485 py_line, 7486 __pyx_empty_bytes /*PyObject *lnotab*/ 7487 ); 7488 Py_DECREF(py_srcfile); 7489 #else 7490 py_code = PyCode_NewEmpty(filename, funcname, py_line); 7491 #endif 7492 Py_XDECREF(py_funcname); 7493 return py_code; 7494bad: 7495 Py_XDECREF(py_funcname); 7496 #if PY_MAJOR_VERSION < 3 7497 Py_XDECREF(py_srcfile); 7498 #endif 7499 return NULL; 7500} 7501static void __Pyx_AddTraceback(const char *funcname, int c_line, 7502 int py_line, const char *filename) { 7503 PyCodeObject *py_code = 0; 7504 PyFrameObject *py_frame = 0; 7505 PyThreadState *tstate = __Pyx_PyThreadState_Current; 7506 PyObject *ptype, *pvalue, *ptraceback; 7507 if (c_line) { 7508 c_line = __Pyx_CLineForTraceback(tstate, c_line); 7509 } 7510 py_code = __pyx_find_code_object(c_line ? -c_line : py_line); 7511 if (!py_code) { 7512 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); 7513 py_code = __Pyx_CreateCodeObjectForTraceback( 7514 funcname, c_line, py_line, filename); 7515 if (!py_code) { 7516 /* If the code object creation fails, then we should clear the 7517 fetched exception references and propagate the new exception */ 7518 Py_XDECREF(ptype); 7519 Py_XDECREF(pvalue); 7520 Py_XDECREF(ptraceback); 7521 goto bad; 7522 } 7523 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); 7524 __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); 7525 } 7526 py_frame = PyFrame_New( 7527 tstate, /*PyThreadState *tstate,*/ 7528 py_code, /*PyCodeObject *code,*/ 7529 __pyx_d, /*PyObject *globals,*/ 7530 0 /*PyObject *locals*/ 7531 ); 7532 if (!py_frame) goto bad; 7533 __Pyx_PyFrame_SetLineNumber(py_frame, py_line); 7534 PyTraceBack_Here(py_frame); 7535bad: 7536 Py_XDECREF(py_code); 7537 Py_XDECREF(py_frame); 7538} 7539#endif 7540 7541/* CIntFromPyVerify */ 7542#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ 7543 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) 7544#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ 7545 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) 7546#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ 7547 {\ 7548 func_type value = func_value;\ 7549 if (sizeof(target_type) < sizeof(func_type)) {\ 7550 if (unlikely(value != (func_type) (target_type) value)) {\ 7551 func_type zero = 0;\ 7552 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ 7553 return (target_type) -1;\ 7554 if (is_unsigned && unlikely(value < zero))\ 7555 goto raise_neg_overflow;\ 7556 else\ 7557 goto raise_overflow;\ 7558 }\ 7559 }\ 7560 return (target_type) value;\ 7561 } 7562 7563/* CIntFromPy */ 7564static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { 7565#ifdef __Pyx_HAS_GCC_DIAGNOSTIC 7566#pragma GCC diagnostic push 7567#pragma GCC diagnostic ignored "-Wconversion" 7568#endif 7569 const int neg_one = (int) -1, const_zero = (int) 0; 7570#ifdef __Pyx_HAS_GCC_DIAGNOSTIC 7571#pragma GCC diagnostic pop 7572#endif 7573 const int is_unsigned = neg_one > const_zero; 7574#if PY_MAJOR_VERSION < 3 7575 if (likely(PyInt_Check(x))) { 7576 if ((sizeof(int) < sizeof(long))) { 7577 __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) 7578 } else { 7579 long val = PyInt_AS_LONG(x); 7580 if (is_unsigned && unlikely(val < 0)) { 7581 goto raise_neg_overflow; 7582 } 7583 return (int) val; 7584 } 7585 } else 7586#endif 7587 if (likely(PyLong_Check(x))) { 7588 if (is_unsigned) { 7589#if CYTHON_USE_PYLONG_INTERNALS 7590 if (unlikely(__Pyx_PyLong_IsNeg(x))) { 7591 goto raise_neg_overflow; 7592 } else if (__Pyx_PyLong_IsCompact(x)) { 7593 __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) 7594 } else { 7595 const digit* digits = __Pyx_PyLong_Digits(x); 7596 assert(__Pyx_PyLong_DigitCount(x) > 1); 7597 switch (__Pyx_PyLong_DigitCount(x)) { 7598 case 2: 7599 if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { 7600 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { 7601 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) 7602 } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) { 7603 return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); 7604 } 7605 } 7606 break; 7607 case 3: 7608 if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { 7609 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { 7610 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) 7611 } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) { 7612 return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); 7613 } 7614 } 7615 break; 7616 case 4: 7617 if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { 7618 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { 7619 __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]))) 7620 } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) { 7621 return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); 7622 } 7623 } 7624 break; 7625 } 7626 } 7627#endif 7628#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 7629 if (unlikely(Py_SIZE(x) < 0)) { 7630 goto raise_neg_overflow; 7631 } 7632#else 7633 { 7634 int result = PyObject_RichCompareBool(x, Py_False, Py_LT); 7635 if (unlikely(result < 0)) 7636 return (int) -1; 7637 if (unlikely(result == 1)) 7638 goto raise_neg_overflow; 7639 } 7640#endif 7641 if ((sizeof(int) <= sizeof(unsigned long))) { 7642 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) 7643#ifdef HAVE_LONG_LONG 7644 } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) { 7645 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) 7646#endif 7647 } 7648 } else { 7649#if CYTHON_USE_PYLONG_INTERNALS 7650 if (__Pyx_PyLong_IsCompact(x)) { 7651 __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) 7652 } else { 7653 const digit* digits = __Pyx_PyLong_Digits(x); 7654 assert(__Pyx_PyLong_DigitCount(x) > 1); 7655 switch (__Pyx_PyLong_SignedDigitCount(x)) { 7656 case -2: 7657 if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) { 7658 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { 7659 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) 7660 } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { 7661 return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); 7662 } 7663 } 7664 break; 7665 case 2: 7666 if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { 7667 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { 7668 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) 7669 } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { 7670 return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); 7671 } 7672 } 7673 break; 7674 case -3: 7675 if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { 7676 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { 7677 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) 7678 } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { 7679 return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); 7680 } 7681 } 7682 break; 7683 case 3: 7684 if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { 7685 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { 7686 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) 7687 } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { 7688 return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); 7689 } 7690 } 7691 break; 7692 case -4: 7693 if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { 7694 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { 7695 __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]))) 7696 } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { 7697 return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); 7698 } 7699 } 7700 break; 7701 case 4: 7702 if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { 7703 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { 7704 __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]))) 7705 } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { 7706 return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); 7707 } 7708 } 7709 break; 7710 } 7711 } 7712#endif 7713 if ((sizeof(int) <= sizeof(long))) { 7714 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) 7715#ifdef HAVE_LONG_LONG 7716 } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) { 7717 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) 7718#endif 7719 } 7720 } 7721 { 7722 int val; 7723 PyObject *v = __Pyx_PyNumber_IntOrLong(x); 7724#if PY_MAJOR_VERSION < 3 7725 if (likely(v) && !PyLong_Check(v)) { 7726 PyObject *tmp = v; 7727 v = PyNumber_Long(tmp); 7728 Py_DECREF(tmp); 7729 } 7730#endif 7731 if (likely(v)) { 7732 int ret = -1; 7733#if PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) 7734 int one = 1; int is_little = (int)*(unsigned char *)&one; 7735 unsigned char *bytes = (unsigned char *)&val; 7736 ret = _PyLong_AsByteArray((PyLongObject *)v, 7737 bytes, sizeof(val), 7738 is_little, !is_unsigned); 7739#else 7740 PyObject *stepval = NULL, *mask = NULL, *shift = NULL; 7741 int bits, remaining_bits, is_negative = 0; 7742 long idigit; 7743 int chunk_size = (sizeof(long) < 8) ? 30 : 62; 7744 if (unlikely(!PyLong_CheckExact(v))) { 7745 PyObject *tmp = v; 7746 v = PyNumber_Long(v); 7747 assert(PyLong_CheckExact(v)); 7748 Py_DECREF(tmp); 7749 if (unlikely(!v)) return (int) -1; 7750 } 7751#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 7752 if (Py_SIZE(x) == 0) 7753 return (int) 0; 7754 is_negative = Py_SIZE(x) < 0; 7755#else 7756 { 7757 int result = PyObject_RichCompareBool(x, Py_False, Py_LT); 7758 if (unlikely(result < 0)) 7759 return (int) -1; 7760 is_negative = result == 1; 7761 } 7762#endif 7763 if (is_unsigned && unlikely(is_negative)) { 7764 goto raise_neg_overflow; 7765 } else if (is_negative) { 7766 stepval = PyNumber_Invert(v); 7767 if (unlikely(!stepval)) 7768 return (int) -1; 7769 } else { 7770 stepval = __Pyx_NewRef(v); 7771 } 7772 val = (int) 0; 7773 mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; 7774 shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; 7775 for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) { 7776 PyObject *tmp, *digit; 7777 digit = PyNumber_And(stepval, mask); 7778 if (unlikely(!digit)) goto done; 7779 idigit = PyLong_AsLong(digit); 7780 Py_DECREF(digit); 7781 if (unlikely(idigit < 0)) goto done; 7782 tmp = PyNumber_Rshift(stepval, shift); 7783 if (unlikely(!tmp)) goto done; 7784 Py_DECREF(stepval); stepval = tmp; 7785 val |= ((int) idigit) << bits; 7786 #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 7787 if (Py_SIZE(stepval) == 0) 7788 goto unpacking_done; 7789 #endif 7790 } 7791 idigit = PyLong_AsLong(stepval); 7792 if (unlikely(idigit < 0)) goto done; 7793 remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1); 7794 if (unlikely(idigit >= (1L << remaining_bits))) 7795 goto raise_overflow; 7796 val |= ((int) idigit) << bits; 7797 #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 7798 unpacking_done: 7799 #endif 7800 if (!is_unsigned) { 7801 if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1)))) 7802 goto raise_overflow; 7803 if (is_negative) 7804 val = ~val; 7805 } 7806 ret = 0; 7807 done: 7808 Py_XDECREF(shift); 7809 Py_XDECREF(mask); 7810 Py_XDECREF(stepval); 7811#endif 7812 Py_DECREF(v); 7813 if (likely(!ret)) 7814 return val; 7815 } 7816 return (int) -1; 7817 } 7818 } else { 7819 int val; 7820 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); 7821 if (!tmp) return (int) -1; 7822 val = __Pyx_PyInt_As_int(tmp); 7823 Py_DECREF(tmp); 7824 return val; 7825 } 7826raise_overflow: 7827 PyErr_SetString(PyExc_OverflowError, 7828 "value too large to convert to int"); 7829 return (int) -1; 7830raise_neg_overflow: 7831 PyErr_SetString(PyExc_OverflowError, 7832 "can't convert negative value to int"); 7833 return (int) -1; 7834} 7835 7836/* CIntToPy */ 7837static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { 7838#ifdef __Pyx_HAS_GCC_DIAGNOSTIC 7839#pragma GCC diagnostic push 7840#pragma GCC diagnostic ignored "-Wconversion" 7841#endif 7842 const int neg_one = (int) -1, const_zero = (int) 0; 7843#ifdef __Pyx_HAS_GCC_DIAGNOSTIC 7844#pragma GCC diagnostic pop 7845#endif 7846 const int is_unsigned = neg_one > const_zero; 7847 if (is_unsigned) { 7848 if (sizeof(int) < sizeof(long)) { 7849 return PyInt_FromLong((long) value); 7850 } else if (sizeof(int) <= sizeof(unsigned long)) { 7851 return PyLong_FromUnsignedLong((unsigned long) value); 7852#ifdef HAVE_LONG_LONG 7853 } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { 7854 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); 7855#endif 7856 } 7857 } else { 7858 if (sizeof(int) <= sizeof(long)) { 7859 return PyInt_FromLong((long) value); 7860#ifdef HAVE_LONG_LONG 7861 } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { 7862 return PyLong_FromLongLong((PY_LONG_LONG) value); 7863#endif 7864 } 7865 } 7866 { 7867 int one = 1; int little = (int)*(unsigned char *)&one; 7868 unsigned char *bytes = (unsigned char *)&value; 7869#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 7870 return _PyLong_FromByteArray(bytes, sizeof(int), 7871 little, !is_unsigned); 7872#else 7873 PyObject *from_bytes, *result = NULL; 7874 PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL; 7875 from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); 7876 if (!from_bytes) return NULL; 7877 py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(int)); 7878 if (!py_bytes) goto limited_bad; 7879 order_str = PyUnicode_FromString(little ? "little" : "big"); 7880 if (!order_str) goto limited_bad; 7881 arg_tuple = PyTuple_Pack(2, py_bytes, order_str); 7882 if (!arg_tuple) goto limited_bad; 7883 if (!is_unsigned) { 7884 kwds = PyDict_New(); 7885 if (!kwds) goto limited_bad; 7886 if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad; 7887 } 7888 result = PyObject_Call(from_bytes, arg_tuple, kwds); 7889 limited_bad: 7890 Py_XDECREF(kwds); 7891 Py_XDECREF(arg_tuple); 7892 Py_XDECREF(order_str); 7893 Py_XDECREF(py_bytes); 7894 Py_XDECREF(from_bytes); 7895 return result; 7896#endif 7897 } 7898} 7899 7900/* CIntToPy */ 7901static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { 7902#ifdef __Pyx_HAS_GCC_DIAGNOSTIC 7903#pragma GCC diagnostic push 7904#pragma GCC diagnostic ignored "-Wconversion" 7905#endif 7906 const long neg_one = (long) -1, const_zero = (long) 0; 7907#ifdef __Pyx_HAS_GCC_DIAGNOSTIC 7908#pragma GCC diagnostic pop 7909#endif 7910 const int is_unsigned = neg_one > const_zero; 7911 if (is_unsigned) { 7912 if (sizeof(long) < sizeof(long)) { 7913 return PyInt_FromLong((long) value); 7914 } else if (sizeof(long) <= sizeof(unsigned long)) { 7915 return PyLong_FromUnsignedLong((unsigned long) value); 7916#ifdef HAVE_LONG_LONG 7917 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { 7918 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); 7919#endif 7920 } 7921 } else { 7922 if (sizeof(long) <= sizeof(long)) { 7923 return PyInt_FromLong((long) value); 7924#ifdef HAVE_LONG_LONG 7925 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { 7926 return PyLong_FromLongLong((PY_LONG_LONG) value); 7927#endif 7928 } 7929 } 7930 { 7931 int one = 1; int little = (int)*(unsigned char *)&one; 7932 unsigned char *bytes = (unsigned char *)&value; 7933#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 7934 return _PyLong_FromByteArray(bytes, sizeof(long), 7935 little, !is_unsigned); 7936#else 7937 PyObject *from_bytes, *result = NULL; 7938 PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL; 7939 from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes"); 7940 if (!from_bytes) return NULL; 7941 py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long)); 7942 if (!py_bytes) goto limited_bad; 7943 order_str = PyUnicode_FromString(little ? "little" : "big"); 7944 if (!order_str) goto limited_bad; 7945 arg_tuple = PyTuple_Pack(2, py_bytes, order_str); 7946 if (!arg_tuple) goto limited_bad; 7947 if (!is_unsigned) { 7948 kwds = PyDict_New(); 7949 if (!kwds) goto limited_bad; 7950 if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad; 7951 } 7952 result = PyObject_Call(from_bytes, arg_tuple, kwds); 7953 limited_bad: 7954 Py_XDECREF(kwds); 7955 Py_XDECREF(arg_tuple); 7956 Py_XDECREF(order_str); 7957 Py_XDECREF(py_bytes); 7958 Py_XDECREF(from_bytes); 7959 return result; 7960#endif 7961 } 7962} 7963 7964/* FormatTypeName */ 7965#if CYTHON_COMPILING_IN_LIMITED_API 7966static __Pyx_TypeName 7967__Pyx_PyType_GetName(PyTypeObject* tp) 7968{ 7969 PyObject *name = __Pyx_PyObject_GetAttrStr((PyObject *)tp, 7970 __pyx_n_s_name); 7971 if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) { 7972 PyErr_Clear(); 7973 Py_XDECREF(name); 7974 name = __Pyx_NewRef(__pyx_n_s__7); 7975 } 7976 return name; 7977} 7978#endif 7979 7980/* CIntFromPy */ 7981static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { 7982#ifdef __Pyx_HAS_GCC_DIAGNOSTIC 7983#pragma GCC diagnostic push 7984#pragma GCC diagnostic ignored "-Wconversion" 7985#endif 7986 const long neg_one = (long) -1, const_zero = (long) 0; 7987#ifdef __Pyx_HAS_GCC_DIAGNOSTIC 7988#pragma GCC diagnostic pop 7989#endif 7990 const int is_unsigned = neg_one > const_zero; 7991#if PY_MAJOR_VERSION < 3 7992 if (likely(PyInt_Check(x))) { 7993 if ((sizeof(long) < sizeof(long))) { 7994 __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) 7995 } else { 7996 long val = PyInt_AS_LONG(x); 7997 if (is_unsigned && unlikely(val < 0)) { 7998 goto raise_neg_overflow; 7999 } 8000 return (long) val; 8001 } 8002 } else 8003#endif 8004 if (likely(PyLong_Check(x))) { 8005 if (is_unsigned) { 8006#if CYTHON_USE_PYLONG_INTERNALS 8007 if (unlikely(__Pyx_PyLong_IsNeg(x))) { 8008 goto raise_neg_overflow; 8009 } else if (__Pyx_PyLong_IsCompact(x)) { 8010 __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) 8011 } else { 8012 const digit* digits = __Pyx_PyLong_Digits(x); 8013 assert(__Pyx_PyLong_DigitCount(x) > 1); 8014 switch (__Pyx_PyLong_DigitCount(x)) { 8015 case 2: 8016 if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { 8017 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { 8018 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) 8019 } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) { 8020 return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); 8021 } 8022 } 8023 break; 8024 case 3: 8025 if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { 8026 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { 8027 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) 8028 } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) { 8029 return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); 8030 } 8031 } 8032 break; 8033 case 4: 8034 if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { 8035 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { 8036 __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]))) 8037 } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) { 8038 return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); 8039 } 8040 } 8041 break; 8042 } 8043 } 8044#endif 8045#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 8046 if (unlikely(Py_SIZE(x) < 0)) { 8047 goto raise_neg_overflow; 8048 } 8049#else 8050 { 8051 int result = PyObject_RichCompareBool(x, Py_False, Py_LT); 8052 if (unlikely(result < 0)) 8053 return (long) -1; 8054 if (unlikely(result == 1)) 8055 goto raise_neg_overflow; 8056 } 8057#endif 8058 if ((sizeof(long) <= sizeof(unsigned long))) { 8059 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) 8060#ifdef HAVE_LONG_LONG 8061 } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) { 8062 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) 8063#endif 8064 } 8065 } else { 8066#if CYTHON_USE_PYLONG_INTERNALS 8067 if (__Pyx_PyLong_IsCompact(x)) { 8068 __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) 8069 } else { 8070 const digit* digits = __Pyx_PyLong_Digits(x); 8071 assert(__Pyx_PyLong_DigitCount(x) > 1); 8072 switch (__Pyx_PyLong_SignedDigitCount(x)) { 8073 case -2: 8074 if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) { 8075 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { 8076 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) 8077 } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { 8078 return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); 8079 } 8080 } 8081 break; 8082 case 2: 8083 if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { 8084 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { 8085 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) 8086 } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { 8087 return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); 8088 } 8089 } 8090 break; 8091 case -3: 8092 if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { 8093 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { 8094 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) 8095 } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { 8096 return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); 8097 } 8098 } 8099 break; 8100 case 3: 8101 if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { 8102 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { 8103 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) 8104 } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { 8105 return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); 8106 } 8107 } 8108 break; 8109 case -4: 8110 if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { 8111 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { 8112 __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]))) 8113 } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { 8114 return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); 8115 } 8116 } 8117 break; 8118 case 4: 8119 if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { 8120 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { 8121 __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]))) 8122 } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { 8123 return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); 8124 } 8125 } 8126 break; 8127 } 8128 } 8129#endif 8130 if ((sizeof(long) <= sizeof(long))) { 8131 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) 8132#ifdef HAVE_LONG_LONG 8133 } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) { 8134 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) 8135#endif 8136 } 8137 } 8138 { 8139 long val; 8140 PyObject *v = __Pyx_PyNumber_IntOrLong(x); 8141#if PY_MAJOR_VERSION < 3 8142 if (likely(v) && !PyLong_Check(v)) { 8143 PyObject *tmp = v; 8144 v = PyNumber_Long(tmp); 8145 Py_DECREF(tmp); 8146 } 8147#endif 8148 if (likely(v)) { 8149 int ret = -1; 8150#if PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray) 8151 int one = 1; int is_little = (int)*(unsigned char *)&one; 8152 unsigned char *bytes = (unsigned char *)&val; 8153 ret = _PyLong_AsByteArray((PyLongObject *)v, 8154 bytes, sizeof(val), 8155 is_little, !is_unsigned); 8156#else 8157 PyObject *stepval = NULL, *mask = NULL, *shift = NULL; 8158 int bits, remaining_bits, is_negative = 0; 8159 long idigit; 8160 int chunk_size = (sizeof(long) < 8) ? 30 : 62; 8161 if (unlikely(!PyLong_CheckExact(v))) { 8162 PyObject *tmp = v; 8163 v = PyNumber_Long(v); 8164 assert(PyLong_CheckExact(v)); 8165 Py_DECREF(tmp); 8166 if (unlikely(!v)) return (long) -1; 8167 } 8168#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 8169 if (Py_SIZE(x) == 0) 8170 return (long) 0; 8171 is_negative = Py_SIZE(x) < 0; 8172#else 8173 { 8174 int result = PyObject_RichCompareBool(x, Py_False, Py_LT); 8175 if (unlikely(result < 0)) 8176 return (long) -1; 8177 is_negative = result == 1; 8178 } 8179#endif 8180 if (is_unsigned && unlikely(is_negative)) { 8181 goto raise_neg_overflow; 8182 } else if (is_negative) { 8183 stepval = PyNumber_Invert(v); 8184 if (unlikely(!stepval)) 8185 return (long) -1; 8186 } else { 8187 stepval = __Pyx_NewRef(v); 8188 } 8189 val = (long) 0; 8190 mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done; 8191 shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done; 8192 for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) { 8193 PyObject *tmp, *digit; 8194 digit = PyNumber_And(stepval, mask); 8195 if (unlikely(!digit)) goto done; 8196 idigit = PyLong_AsLong(digit); 8197 Py_DECREF(digit); 8198 if (unlikely(idigit < 0)) goto done; 8199 tmp = PyNumber_Rshift(stepval, shift); 8200 if (unlikely(!tmp)) goto done; 8201 Py_DECREF(stepval); stepval = tmp; 8202 val |= ((long) idigit) << bits; 8203 #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 8204 if (Py_SIZE(stepval) == 0) 8205 goto unpacking_done; 8206 #endif 8207 } 8208 idigit = PyLong_AsLong(stepval); 8209 if (unlikely(idigit < 0)) goto done; 8210 remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1); 8211 if (unlikely(idigit >= (1L << remaining_bits))) 8212 goto raise_overflow; 8213 val |= ((long) idigit) << bits; 8214 #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 8215 unpacking_done: 8216 #endif 8217 if (!is_unsigned) { 8218 if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1)))) 8219 goto raise_overflow; 8220 if (is_negative) 8221 val = ~val; 8222 } 8223 ret = 0; 8224 done: 8225 Py_XDECREF(shift); 8226 Py_XDECREF(mask); 8227 Py_XDECREF(stepval); 8228#endif 8229 Py_DECREF(v); 8230 if (likely(!ret)) 8231 return val; 8232 } 8233 return (long) -1; 8234 } 8235 } else { 8236 long val; 8237 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); 8238 if (!tmp) return (long) -1; 8239 val = __Pyx_PyInt_As_long(tmp); 8240 Py_DECREF(tmp); 8241 return val; 8242 } 8243raise_overflow: 8244 PyErr_SetString(PyExc_OverflowError, 8245 "value too large to convert to long"); 8246 return (long) -1; 8247raise_neg_overflow: 8248 PyErr_SetString(PyExc_OverflowError, 8249 "can't convert negative value to long"); 8250 return (long) -1; 8251} 8252 8253/* FastTypeChecks */ 8254#if CYTHON_COMPILING_IN_CPYTHON 8255static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { 8256 while (a) { 8257 a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*); 8258 if (a == b) 8259 return 1; 8260 } 8261 return b == &PyBaseObject_Type; 8262} 8263static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { 8264 PyObject *mro; 8265 if (a == b) return 1; 8266 mro = a->tp_mro; 8267 if (likely(mro)) { 8268 Py_ssize_t i, n; 8269 n = PyTuple_GET_SIZE(mro); 8270 for (i = 0; i < n; i++) { 8271 if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) 8272 return 1; 8273 } 8274 return 0; 8275 } 8276 return __Pyx_InBases(a, b); 8277} 8278static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) { 8279 PyObject *mro; 8280 if (cls == a || cls == b) return 1; 8281 mro = cls->tp_mro; 8282 if (likely(mro)) { 8283 Py_ssize_t i, n; 8284 n = PyTuple_GET_SIZE(mro); 8285 for (i = 0; i < n; i++) { 8286 PyObject *base = PyTuple_GET_ITEM(mro, i); 8287 if (base == (PyObject *)a || base == (PyObject *)b) 8288 return 1; 8289 } 8290 return 0; 8291 } 8292 return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b); 8293} 8294#if PY_MAJOR_VERSION == 2 8295static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { 8296 PyObject *exception, *value, *tb; 8297 int res; 8298 __Pyx_PyThreadState_declare 8299 __Pyx_PyThreadState_assign 8300 __Pyx_ErrFetch(&exception, &value, &tb); 8301 res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0; 8302 if (unlikely(res == -1)) { 8303 PyErr_WriteUnraisable(err); 8304 res = 0; 8305 } 8306 if (!res) { 8307 res = PyObject_IsSubclass(err, exc_type2); 8308 if (unlikely(res == -1)) { 8309 PyErr_WriteUnraisable(err); 8310 res = 0; 8311 } 8312 } 8313 __Pyx_ErrRestore(exception, value, tb); 8314 return res; 8315} 8316#else 8317static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { 8318 if (exc_type1) { 8319 return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2); 8320 } else { 8321 return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); 8322 } 8323} 8324#endif 8325static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { 8326 Py_ssize_t i, n; 8327 assert(PyExceptionClass_Check(exc_type)); 8328 n = PyTuple_GET_SIZE(tuple); 8329#if PY_MAJOR_VERSION >= 3 8330 for (i=0; i<n; i++) { 8331 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1; 8332 } 8333#endif 8334 for (i=0; i<n; i++) { 8335 PyObject *t = PyTuple_GET_ITEM(tuple, i); 8336 #if PY_MAJOR_VERSION < 3 8337 if (likely(exc_type == t)) return 1; 8338 #endif 8339 if (likely(PyExceptionClass_Check(t))) { 8340 if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1; 8341 } else { 8342 } 8343 } 8344 return 0; 8345} 8346static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) { 8347 if (likely(err == exc_type)) return 1; 8348 if (likely(PyExceptionClass_Check(err))) { 8349 if (likely(PyExceptionClass_Check(exc_type))) { 8350 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type); 8351 } else if (likely(PyTuple_Check(exc_type))) { 8352 return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type); 8353 } else { 8354 } 8355 } 8356 return PyErr_GivenExceptionMatches(err, exc_type); 8357} 8358static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) { 8359 assert(PyExceptionClass_Check(exc_type1)); 8360 assert(PyExceptionClass_Check(exc_type2)); 8361 if (likely(err == exc_type1 || err == exc_type2)) return 1; 8362 if (likely(PyExceptionClass_Check(err))) { 8363 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2); 8364 } 8365 return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2)); 8366} 8367#endif 8368 8369/* CheckBinaryVersion */ 8370static unsigned long __Pyx_get_runtime_version(void) { 8371#if __PYX_LIMITED_VERSION_HEX >= 0x030B00A4 8372 return Py_Version & ~0xFFUL; 8373#else 8374 const char* rt_version = Py_GetVersion(); 8375 unsigned long version = 0; 8376 unsigned long factor = 0x01000000UL; 8377 unsigned int digit = 0; 8378 int i = 0; 8379 while (factor) { 8380 while ('0' <= rt_version[i] && rt_version[i] <= '9') { 8381 digit = digit * 10 + (unsigned int) (rt_version[i] - '0'); 8382 ++i; 8383 } 8384 version += factor * digit; 8385 if (rt_version[i] != '.') 8386 break; 8387 digit = 0; 8388 factor >>= 8; 8389 ++i; 8390 } 8391 return version; 8392#endif 8393} 8394static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer) { 8395 const unsigned long MAJOR_MINOR = 0xFFFF0000UL; 8396 if ((rt_version & MAJOR_MINOR) == (ct_version & MAJOR_MINOR)) 8397 return 0; 8398 if (likely(allow_newer && (rt_version & MAJOR_MINOR) > (ct_version & MAJOR_MINOR))) 8399 return 1; 8400 { 8401 char message[200]; 8402 PyOS_snprintf(message, sizeof(message), 8403 "compile time Python version %d.%d " 8404 "of module '%.100s' " 8405 "%s " 8406 "runtime version %d.%d", 8407 (int) (ct_version >> 24), (int) ((ct_version >> 16) & 0xFF), 8408 __Pyx_MODULE_NAME, 8409 (allow_newer) ? "was newer than" : "does not match", 8410 (int) (rt_version >> 24), (int) ((rt_version >> 16) & 0xFF) 8411 ); 8412 return PyErr_WarnEx(NULL, message, 1); 8413 } 8414} 8415 8416/* InitStrings */ 8417#if PY_MAJOR_VERSION >= 3 8418static int __Pyx_InitString(__Pyx_StringTabEntry t, PyObject **str) { 8419 if (t.is_unicode | t.is_str) { 8420 if (t.intern) { 8421 *str = PyUnicode_InternFromString(t.s); 8422 } else if (t.encoding) { 8423 *str = PyUnicode_Decode(t.s, t.n - 1, t.encoding, NULL); 8424 } else { 8425 *str = PyUnicode_FromStringAndSize(t.s, t.n - 1); 8426 } 8427 } else { 8428 *str = PyBytes_FromStringAndSize(t.s, t.n - 1); 8429 } 8430 if (!*str) 8431 return -1; 8432 if (PyObject_Hash(*str) == -1) 8433 return -1; 8434 return 0; 8435} 8436#endif 8437static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { 8438 while (t->p) { 8439 #if PY_MAJOR_VERSION >= 3 8440 __Pyx_InitString(*t, t->p); 8441 #else 8442 if (t->is_unicode) { 8443 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); 8444 } else if (t->intern) { 8445 *t->p = PyString_InternFromString(t->s); 8446 } else { 8447 *t->p = PyString_FromStringAndSize(t->s, t->n - 1); 8448 } 8449 if (!*t->p) 8450 return -1; 8451 if (PyObject_Hash(*t->p) == -1) 8452 return -1; 8453 #endif 8454 ++t; 8455 } 8456 return 0; 8457} 8458 8459#include <string.h> 8460static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s) { 8461 size_t len = strlen(s); 8462 if (unlikely(len > (size_t) PY_SSIZE_T_MAX)) { 8463 PyErr_SetString(PyExc_OverflowError, "byte string is too long"); 8464 return -1; 8465 } 8466 return (Py_ssize_t) len; 8467} 8468static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { 8469 Py_ssize_t len = __Pyx_ssize_strlen(c_str); 8470 if (unlikely(len < 0)) return NULL; 8471 return __Pyx_PyUnicode_FromStringAndSize(c_str, len); 8472} 8473static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char* c_str) { 8474 Py_ssize_t len = __Pyx_ssize_strlen(c_str); 8475 if (unlikely(len < 0)) return NULL; 8476 return PyByteArray_FromStringAndSize(c_str, len); 8477} 8478static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) { 8479 Py_ssize_t ignore; 8480 return __Pyx_PyObject_AsStringAndSize(o, &ignore); 8481} 8482#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 8483#if !CYTHON_PEP393_ENABLED 8484static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { 8485 char* defenc_c; 8486 PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); 8487 if (!defenc) return NULL; 8488 defenc_c = PyBytes_AS_STRING(defenc); 8489#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 8490 { 8491 char* end = defenc_c + PyBytes_GET_SIZE(defenc); 8492 char* c; 8493 for (c = defenc_c; c < end; c++) { 8494 if ((unsigned char) (*c) >= 128) { 8495 PyUnicode_AsASCIIString(o); 8496 return NULL; 8497 } 8498 } 8499 } 8500#endif 8501 *length = PyBytes_GET_SIZE(defenc); 8502 return defenc_c; 8503} 8504#else 8505static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { 8506 if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL; 8507#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 8508 if (likely(PyUnicode_IS_ASCII(o))) { 8509 *length = PyUnicode_GET_LENGTH(o); 8510 return PyUnicode_AsUTF8(o); 8511 } else { 8512 PyUnicode_AsASCIIString(o); 8513 return NULL; 8514 } 8515#else 8516 return PyUnicode_AsUTF8AndSize(o, length); 8517#endif 8518} 8519#endif 8520#endif 8521static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { 8522#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 8523 if ( 8524#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 8525 __Pyx_sys_getdefaultencoding_not_ascii && 8526#endif 8527 PyUnicode_Check(o)) { 8528 return __Pyx_PyUnicode_AsStringAndSize(o, length); 8529 } else 8530#endif 8531#if (!CYTHON_COMPILING_IN_PYPY && !CYTHON_COMPILING_IN_LIMITED_API) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) 8532 if (PyByteArray_Check(o)) { 8533 *length = PyByteArray_GET_SIZE(o); 8534 return PyByteArray_AS_STRING(o); 8535 } else 8536#endif 8537 { 8538 char* result; 8539 int r = PyBytes_AsStringAndSize(o, &result, length); 8540 if (unlikely(r < 0)) { 8541 return NULL; 8542 } else { 8543 return result; 8544 } 8545 } 8546} 8547static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { 8548 int is_true = x == Py_True; 8549 if (is_true | (x == Py_False) | (x == Py_None)) return is_true; 8550 else return PyObject_IsTrue(x); 8551} 8552static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { 8553 int retval; 8554 if (unlikely(!x)) return -1; 8555 retval = __Pyx_PyObject_IsTrue(x); 8556 Py_DECREF(x); 8557 return retval; 8558} 8559static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) { 8560 __Pyx_TypeName result_type_name = __Pyx_PyType_GetName(Py_TYPE(result)); 8561#if PY_MAJOR_VERSION >= 3 8562 if (PyLong_Check(result)) { 8563 if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, 8564 "__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). " 8565 "The ability to return an instance of a strict subclass of int is deprecated, " 8566 "and may be removed in a future version of Python.", 8567 result_type_name)) { 8568 __Pyx_DECREF_TypeName(result_type_name); 8569 Py_DECREF(result); 8570 return NULL; 8571 } 8572 __Pyx_DECREF_TypeName(result_type_name); 8573 return result; 8574 } 8575#endif 8576 PyErr_Format(PyExc_TypeError, 8577 "__%.4s__ returned non-%.4s (type " __Pyx_FMT_TYPENAME ")", 8578 type_name, type_name, result_type_name); 8579 __Pyx_DECREF_TypeName(result_type_name); 8580 Py_DECREF(result); 8581 return NULL; 8582} 8583static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) { 8584#if CYTHON_USE_TYPE_SLOTS 8585 PyNumberMethods *m; 8586#endif 8587 const char *name = NULL; 8588 PyObject *res = NULL; 8589#if PY_MAJOR_VERSION < 3 8590 if (likely(PyInt_Check(x) || PyLong_Check(x))) 8591#else 8592 if (likely(PyLong_Check(x))) 8593#endif 8594 return __Pyx_NewRef(x); 8595#if CYTHON_USE_TYPE_SLOTS 8596 m = Py_TYPE(x)->tp_as_number; 8597 #if PY_MAJOR_VERSION < 3 8598 if (m && m->nb_int) { 8599 name = "int"; 8600 res = m->nb_int(x); 8601 } 8602 else if (m && m->nb_long) { 8603 name = "long"; 8604 res = m->nb_long(x); 8605 } 8606 #else 8607 if (likely(m && m->nb_int)) { 8608 name = "int"; 8609 res = m->nb_int(x); 8610 } 8611 #endif 8612#else 8613 if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) { 8614 res = PyNumber_Int(x); 8615 } 8616#endif 8617 if (likely(res)) { 8618#if PY_MAJOR_VERSION < 3 8619 if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) { 8620#else 8621 if (unlikely(!PyLong_CheckExact(res))) { 8622#endif 8623 return __Pyx_PyNumber_IntOrLongWrongResultType(res, name); 8624 } 8625 } 8626 else if (!PyErr_Occurred()) { 8627 PyErr_SetString(PyExc_TypeError, 8628 "an integer is required"); 8629 } 8630 return res; 8631} 8632static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { 8633 Py_ssize_t ival; 8634 PyObject *x; 8635#if PY_MAJOR_VERSION < 3 8636 if (likely(PyInt_CheckExact(b))) { 8637 if (sizeof(Py_ssize_t) >= sizeof(long)) 8638 return PyInt_AS_LONG(b); 8639 else 8640 return PyInt_AsSsize_t(b); 8641 } 8642#endif 8643 if (likely(PyLong_CheckExact(b))) { 8644 #if CYTHON_USE_PYLONG_INTERNALS 8645 if (likely(__Pyx_PyLong_IsCompact(b))) { 8646 return __Pyx_PyLong_CompactValue(b); 8647 } else { 8648 const digit* digits = __Pyx_PyLong_Digits(b); 8649 const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b); 8650 switch (size) { 8651 case 2: 8652 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { 8653 return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); 8654 } 8655 break; 8656 case -2: 8657 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { 8658 return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); 8659 } 8660 break; 8661 case 3: 8662 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { 8663 return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); 8664 } 8665 break; 8666 case -3: 8667 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { 8668 return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); 8669 } 8670 break; 8671 case 4: 8672 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { 8673 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])); 8674 } 8675 break; 8676 case -4: 8677 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { 8678 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])); 8679 } 8680 break; 8681 } 8682 } 8683 #endif 8684 return PyLong_AsSsize_t(b); 8685 } 8686 x = PyNumber_Index(b); 8687 if (!x) return -1; 8688 ival = PyInt_AsSsize_t(x); 8689 Py_DECREF(x); 8690 return ival; 8691} 8692static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) { 8693 if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) { 8694 return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o); 8695#if PY_MAJOR_VERSION < 3 8696 } else if (likely(PyInt_CheckExact(o))) { 8697 return PyInt_AS_LONG(o); 8698#endif 8699 } else { 8700 Py_ssize_t ival; 8701 PyObject *x; 8702 x = PyNumber_Index(o); 8703 if (!x) return -1; 8704 ival = PyInt_AsLong(x); 8705 Py_DECREF(x); 8706 return ival; 8707 } 8708} 8709static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { 8710 return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False); 8711} 8712static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { 8713 return PyInt_FromSize_t(ival); 8714} 8715 8716 8717/* #### Code section: utility_code_pragmas_end ### */ 8718#ifdef _MSC_VER 8719#pragma warning( pop ) 8720#endif 8721 8722 8723 8724/* #### Code section: end ### */ 8725#endif /* Py_PYTHON_H */