| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
#ifndef PY_SSIZE_T_CLEAN |
| 16 |
#define PY_SSIZE_T_CLEAN |
| 17 |
#endif |
| 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 |
#define CYTHON_ABI "3_0_0b2" |
| 35 |
#define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI |
| 36 |
#define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." |
| 37 |
#define CYTHON_HEX_VERSION 0x030000B2 |
| 38 |
#define CYTHON_FUTURE_DIVISION 1 |
| 39 |
#include <stddef.h> |
| 40 |
#ifndef offsetof |
| 41 |
#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) |
| 42 |
#endif |
| 43 |
#if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS) |
| 44 |
#ifndef __stdcall |
| 45 |
#define __stdcall |
| 46 |
#endif |
| 47 |
#ifndef __cdecl |
| 48 |
#define __cdecl |
| 49 |
#endif |
| 50 |
#ifndef __fastcall |
| 51 |
#define __fastcall |
| 52 |
#endif |
| 53 |
#endif |
| 54 |
#ifndef DL_IMPORT |
| 55 |
#define DL_IMPORT(t) t |
| 56 |
#endif |
| 57 |
#define __PYX_COMMA , |
| 58 |
#ifndef HAVE_LONG_LONG |
| 59 |
#define HAVE_LONG_LONG |
| 60 |
#endif |
| 61 |
#ifndef PY_LONG_LONG |
| 62 |
#define PY_LONG_LONG LONG_LONG |
| 63 |
#endif |
| 64 |
#ifndef Py_HUGE_VAL |
| 65 |
#define Py_HUGE_VAL HUGE_VAL |
| 66 |
#endif |
| 67 |
#if defined(GRAALVM_PYTHON) |
| 68 |
|
| 69 |
|
| 70 |
#define CYTHON_COMPILING_IN_PYPY 0 |
| 71 |
#define CYTHON_COMPILING_IN_CPYTHON 0 |
| 72 |
#define CYTHON_COMPILING_IN_LIMITED_API 0 |
| 73 |
#define CYTHON_COMPILING_IN_GRAAL 1 |
| 74 |
#define CYTHON_COMPILING_IN_NOGIL 0 |
| 75 |
#undef CYTHON_USE_TYPE_SLOTS |
| 76 |
#define CYTHON_USE_TYPE_SLOTS 0 |
| 77 |
#undef CYTHON_USE_TYPE_SPECS |
| 78 |
#define CYTHON_USE_TYPE_SPECS 0 |
| 79 |
#undef CYTHON_USE_PYTYPE_LOOKUP |
| 80 |
#define CYTHON_USE_PYTYPE_LOOKUP 0 |
| 81 |
#if PY_VERSION_HEX < 0x03050000 |
| 82 |
#undef CYTHON_USE_ASYNC_SLOTS |
| 83 |
#define CYTHON_USE_ASYNC_SLOTS 0 |
| 84 |
#elif !defined(CYTHON_USE_ASYNC_SLOTS) |
| 85 |
#define CYTHON_USE_ASYNC_SLOTS 1 |
| 86 |
#endif |
| 87 |
#undef CYTHON_USE_PYLIST_INTERNALS |
| 88 |
#define CYTHON_USE_PYLIST_INTERNALS 0 |
| 89 |
#undef CYTHON_USE_UNICODE_INTERNALS |
| 90 |
#define CYTHON_USE_UNICODE_INTERNALS 0 |
| 91 |
#undef CYTHON_USE_UNICODE_WRITER |
| 92 |
#define CYTHON_USE_UNICODE_WRITER 0 |
| 93 |
#undef CYTHON_USE_PYLONG_INTERNALS |
| 94 |
#define CYTHON_USE_PYLONG_INTERNALS 0 |
| 95 |
#undef CYTHON_AVOID_BORROWED_REFS |
| 96 |
#define CYTHON_AVOID_BORROWED_REFS 1 |
| 97 |
#undef CYTHON_ASSUME_SAFE_MACROS |
| 98 |
#define CYTHON_ASSUME_SAFE_MACROS 0 |
| 99 |
#undef CYTHON_UNPACK_METHODS |
| 100 |
#define CYTHON_UNPACK_METHODS 0 |
| 101 |
#undef CYTHON_FAST_THREAD_STATE |
| 102 |
#define CYTHON_FAST_THREAD_STATE 0 |
| 103 |
#undef CYTHON_FAST_GIL |
| 104 |
#define CYTHON_FAST_GIL 0 |
| 105 |
#undef CYTHON_METH_FASTCALL |
| 106 |
#define CYTHON_METH_FASTCALL 0 |
| 107 |
#undef CYTHON_FAST_PYCALL |
| 108 |
#define CYTHON_FAST_PYCALL 0 |
| 109 |
#ifndef CYTHON_PEP487_INIT_SUBCLASS |
| 110 |
#define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3) |
| 111 |
#endif |
| 112 |
#undef CYTHON_PEP489_MULTI_PHASE_INIT |
| 113 |
#define CYTHON_PEP489_MULTI_PHASE_INIT 1 |
| 114 |
#undef CYTHON_USE_MODULE_STATE |
| 115 |
#define CYTHON_USE_MODULE_STATE 0 |
| 116 |
#undef CYTHON_USE_TP_FINALIZE |
| 117 |
#define CYTHON_USE_TP_FINALIZE 0 |
| 118 |
#undef CYTHON_USE_DICT_VERSIONS |
| 119 |
#define CYTHON_USE_DICT_VERSIONS 0 |
| 120 |
#undef CYTHON_USE_EXC_INFO_STACK |
| 121 |
#define CYTHON_USE_EXC_INFO_STACK 0 |
| 122 |
#ifndef CYTHON_UPDATE_DESCRIPTOR_DOC |
| 123 |
#define CYTHON_UPDATE_DESCRIPTOR_DOC 0 |
| 124 |
#endif |
| 125 |
#elif defined(PYPY_VERSION) |
| 126 |
#define CYTHON_COMPILING_IN_PYPY 1 |
| 127 |
#define CYTHON_COMPILING_IN_CPYTHON 0 |
| 128 |
#define CYTHON_COMPILING_IN_LIMITED_API 0 |
| 129 |
#define CYTHON_COMPILING_IN_GRAAL 0 |
| 130 |
#define CYTHON_COMPILING_IN_NOGIL 0 |
| 131 |
#undef CYTHON_USE_TYPE_SLOTS |
| 132 |
#define CYTHON_USE_TYPE_SLOTS 0 |
| 133 |
#undef CYTHON_USE_TYPE_SPECS |
| 134 |
#define CYTHON_USE_TYPE_SPECS 0 |
| 135 |
#undef CYTHON_USE_PYTYPE_LOOKUP |
| 136 |
#define CYTHON_USE_PYTYPE_LOOKUP 0 |
| 137 |
#if PY_VERSION_HEX < 0x03050000 |
| 138 |
#undef CYTHON_USE_ASYNC_SLOTS |
| 139 |
#define CYTHON_USE_ASYNC_SLOTS 0 |
| 140 |
#elif !defined(CYTHON_USE_ASYNC_SLOTS) |
| 141 |
#define CYTHON_USE_ASYNC_SLOTS 1 |
| 142 |
#endif |
| 143 |
#undef CYTHON_USE_PYLIST_INTERNALS |
| 144 |
#define CYTHON_USE_PYLIST_INTERNALS 0 |
| 145 |
#undef CYTHON_USE_UNICODE_INTERNALS |
| 146 |
#define CYTHON_USE_UNICODE_INTERNALS 0 |
| 147 |
#undef CYTHON_USE_UNICODE_WRITER |
| 148 |
#define CYTHON_USE_UNICODE_WRITER 0 |
| 149 |
#undef CYTHON_USE_PYLONG_INTERNALS |
| 150 |
#define CYTHON_USE_PYLONG_INTERNALS 0 |
| 151 |
#undef CYTHON_AVOID_BORROWED_REFS |
| 152 |
#define CYTHON_AVOID_BORROWED_REFS 1 |
| 153 |
#undef CYTHON_ASSUME_SAFE_MACROS |
| 154 |
#define CYTHON_ASSUME_SAFE_MACROS 0 |
| 155 |
#undef CYTHON_UNPACK_METHODS |
| 156 |
#define CYTHON_UNPACK_METHODS 0 |
| 157 |
#undef CYTHON_FAST_THREAD_STATE |
| 158 |
#define CYTHON_FAST_THREAD_STATE 0 |
| 159 |
#undef CYTHON_FAST_GIL |
| 160 |
#define CYTHON_FAST_GIL 0 |
| 161 |
#undef CYTHON_METH_FASTCALL |
| 162 |
#define CYTHON_METH_FASTCALL 0 |
| 163 |
#undef CYTHON_FAST_PYCALL |
| 164 |
#define CYTHON_FAST_PYCALL 0 |
| 165 |
#ifndef CYTHON_PEP487_INIT_SUBCLASS |
| 166 |
#define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3) |
| 167 |
#endif |
| 168 |
#if PY_VERSION_HEX < 0x03090000 |
| 169 |
#undef CYTHON_PEP489_MULTI_PHASE_INIT |
| 170 |
#define CYTHON_PEP489_MULTI_PHASE_INIT 0 |
| 171 |
#elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) |
| 172 |
#define CYTHON_PEP489_MULTI_PHASE_INIT 1 |
| 173 |
#endif |
| 174 |
#undef CYTHON_USE_MODULE_STATE |
| 175 |
#define CYTHON_USE_MODULE_STATE 0 |
| 176 |
#undef CYTHON_USE_TP_FINALIZE |
| 177 |
#define CYTHON_USE_TP_FINALIZE 0 |
| 178 |
#undef CYTHON_USE_DICT_VERSIONS |
| 179 |
#define CYTHON_USE_DICT_VERSIONS 0 |
| 180 |
#undef CYTHON_USE_EXC_INFO_STACK |
| 181 |
#define CYTHON_USE_EXC_INFO_STACK 0 |
| 182 |
#ifndef CYTHON_UPDATE_DESCRIPTOR_DOC |
| 183 |
#define CYTHON_UPDATE_DESCRIPTOR_DOC 0 |
| 184 |
#endif |
| 185 |
#elif defined(CYTHON_LIMITED_API) |
| 186 |
#define CYTHON_COMPILING_IN_PYPY 0 |
| 187 |
#define CYTHON_COMPILING_IN_CPYTHON 0 |
| 188 |
#define CYTHON_COMPILING_IN_LIMITED_API 1 |
| 189 |
#define CYTHON_COMPILING_IN_GRAAL 0 |
| 190 |
#define CYTHON_COMPILING_IN_NOGIL 0 |
| 191 |
#undef CYTHON_CLINE_IN_TRACEBACK |
| 192 |
#define CYTHON_CLINE_IN_TRACEBACK 0 |
| 193 |
#undef CYTHON_USE_TYPE_SLOTS |
| 194 |
#define CYTHON_USE_TYPE_SLOTS 0 |
| 195 |
#undef CYTHON_USE_TYPE_SPECS |
| 196 |
#define CYTHON_USE_TYPE_SPECS 1 |
| 197 |
#undef CYTHON_USE_PYTYPE_LOOKUP |
| 198 |
#define CYTHON_USE_PYTYPE_LOOKUP 0 |
| 199 |
#undef CYTHON_USE_ASYNC_SLOTS |
| 200 |
#define CYTHON_USE_ASYNC_SLOTS 0 |
| 201 |
#undef CYTHON_USE_PYLIST_INTERNALS |
| 202 |
#define CYTHON_USE_PYLIST_INTERNALS 0 |
| 203 |
#undef CYTHON_USE_UNICODE_INTERNALS |
| 204 |
#define CYTHON_USE_UNICODE_INTERNALS 0 |
| 205 |
#ifndef CYTHON_USE_UNICODE_WRITER |
| 206 |
#define CYTHON_USE_UNICODE_WRITER 0 |
| 207 |
#endif |
| 208 |
#undef CYTHON_USE_PYLONG_INTERNALS |
| 209 |
#define CYTHON_USE_PYLONG_INTERNALS 0 |
| 210 |
#ifndef CYTHON_AVOID_BORROWED_REFS |
| 211 |
#define CYTHON_AVOID_BORROWED_REFS 0 |
| 212 |
#endif |
| 213 |
#undef CYTHON_ASSUME_SAFE_MACROS |
| 214 |
#define CYTHON_ASSUME_SAFE_MACROS 0 |
| 215 |
#undef CYTHON_UNPACK_METHODS |
| 216 |
#define CYTHON_UNPACK_METHODS 0 |
| 217 |
#undef CYTHON_FAST_THREAD_STATE |
| 218 |
#define CYTHON_FAST_THREAD_STATE 0 |
| 219 |
#undef CYTHON_FAST_GIL |
| 220 |
#define CYTHON_FAST_GIL 0 |
| 221 |
#undef CYTHON_METH_FASTCALL |
| 222 |
#define CYTHON_METH_FASTCALL 0 |
| 223 |
#undef CYTHON_FAST_PYCALL |
| 224 |
#define CYTHON_FAST_PYCALL 0 |
| 225 |
#ifndef CYTHON_PEP487_INIT_SUBCLASS |
| 226 |
#define CYTHON_PEP487_INIT_SUBCLASS 1 |
| 227 |
#endif |
| 228 |
#undef CYTHON_PEP489_MULTI_PHASE_INIT |
| 229 |
#define CYTHON_PEP489_MULTI_PHASE_INIT 0 |
| 230 |
#undef CYTHON_USE_MODULE_STATE |
| 231 |
#define CYTHON_USE_MODULE_STATE 1 |
| 232 |
#ifndef CYTHON_USE_TP_FINALIZE |
| 233 |
#define CYTHON_USE_TP_FINALIZE 1 |
| 234 |
#endif |
| 235 |
#undef CYTHON_USE_DICT_VERSIONS |
| 236 |
#define CYTHON_USE_DICT_VERSIONS 0 |
| 237 |
#undef CYTHON_USE_EXC_INFO_STACK |
| 238 |
#define CYTHON_USE_EXC_INFO_STACK 0 |
| 239 |
#ifndef CYTHON_UPDATE_DESCRIPTOR_DOC |
| 240 |
#define CYTHON_UPDATE_DESCRIPTOR_DOC 0 |
| 241 |
#endif |
| 242 |
#elif defined(PY_NOGIL) |
| 243 |
#define CYTHON_COMPILING_IN_PYPY 0 |
| 244 |
#define CYTHON_COMPILING_IN_CPYTHON 0 |
| 245 |
#define CYTHON_COMPILING_IN_LIMITED_API 0 |
| 246 |
#define CYTHON_COMPILING_IN_GRAAL 0 |
| 247 |
#define CYTHON_COMPILING_IN_NOGIL 1 |
| 248 |
#ifndef CYTHON_USE_TYPE_SLOTS |
| 249 |
#define CYTHON_USE_TYPE_SLOTS 1 |
| 250 |
#endif |
| 251 |
#undef CYTHON_USE_PYTYPE_LOOKUP |
| 252 |
#define CYTHON_USE_PYTYPE_LOOKUP 0 |
| 253 |
#ifndef CYTHON_USE_ASYNC_SLOTS |
| 254 |
#define CYTHON_USE_ASYNC_SLOTS 1 |
| 255 |
#endif |
| 256 |
#undef CYTHON_USE_PYLIST_INTERNALS |
| 257 |
#define CYTHON_USE_PYLIST_INTERNALS 0 |
| 258 |
#ifndef CYTHON_USE_UNICODE_INTERNALS |
| 259 |
#define CYTHON_USE_UNICODE_INTERNALS 1 |
| 260 |
#endif |
| 261 |
#undef CYTHON_USE_UNICODE_WRITER |
| 262 |
#define CYTHON_USE_UNICODE_WRITER 0 |
| 263 |
#undef CYTHON_USE_PYLONG_INTERNALS |
| 264 |
#define CYTHON_USE_PYLONG_INTERNALS 0 |
| 265 |
#ifndef CYTHON_AVOID_BORROWED_REFS |
| 266 |
#define CYTHON_AVOID_BORROWED_REFS 0 |
| 267 |
#endif |
| 268 |
#ifndef CYTHON_ASSUME_SAFE_MACROS |
| 269 |
#define CYTHON_ASSUME_SAFE_MACROS 1 |
| 270 |
#endif |
| 271 |
#ifndef CYTHON_UNPACK_METHODS |
| 272 |
#define CYTHON_UNPACK_METHODS 1 |
| 273 |
#endif |
| 274 |
#undef CYTHON_FAST_THREAD_STATE |
| 275 |
#define CYTHON_FAST_THREAD_STATE 0 |
| 276 |
#undef CYTHON_FAST_PYCALL |
| 277 |
#define CYTHON_FAST_PYCALL 0 |
| 278 |
#ifndef CYTHON_PEP489_MULTI_PHASE_INIT |
| 279 |
#define CYTHON_PEP489_MULTI_PHASE_INIT 1 |
| 280 |
#endif |
| 281 |
#ifndef CYTHON_USE_TP_FINALIZE |
| 282 |
#define CYTHON_USE_TP_FINALIZE 1 |
| 283 |
#endif |
| 284 |
#undef CYTHON_USE_DICT_VERSIONS |
| 285 |
#define CYTHON_USE_DICT_VERSIONS 0 |
| 286 |
#undef CYTHON_USE_EXC_INFO_STACK |
| 287 |
#define CYTHON_USE_EXC_INFO_STACK 0 |
| 288 |
#else |
| 289 |
#define CYTHON_COMPILING_IN_PYPY 0 |
| 290 |
#define CYTHON_COMPILING_IN_CPYTHON 1 |
| 291 |
#define CYTHON_COMPILING_IN_LIMITED_API 0 |
| 292 |
#define CYTHON_COMPILING_IN_GRAAL 0 |
| 293 |
#define CYTHON_COMPILING_IN_NOGIL 0 |
| 294 |
#ifndef CYTHON_USE_TYPE_SLOTS |
| 295 |
#define CYTHON_USE_TYPE_SLOTS 1 |
| 296 |
#endif |
| 297 |
#ifndef CYTHON_USE_TYPE_SPECS |
| 298 |
#define CYTHON_USE_TYPE_SPECS 0 |
| 299 |
#endif |
| 300 |
#ifndef CYTHON_USE_PYTYPE_LOOKUP |
| 301 |
#define CYTHON_USE_PYTYPE_LOOKUP 1 |
| 302 |
#endif |
| 303 |
#if PY_MAJOR_VERSION < 3 |
| 304 |
#undef CYTHON_USE_ASYNC_SLOTS |
| 305 |
#define CYTHON_USE_ASYNC_SLOTS 0 |
| 306 |
#elif !defined(CYTHON_USE_ASYNC_SLOTS) |
| 307 |
#define CYTHON_USE_ASYNC_SLOTS 1 |
| 308 |
#endif |
| 309 |
#ifndef CYTHON_USE_PYLONG_INTERNALS |
| 310 |
#define CYTHON_USE_PYLONG_INTERNALS 1 |
| 311 |
#endif |
| 312 |
#ifndef CYTHON_USE_PYLIST_INTERNALS |
| 313 |
#define CYTHON_USE_PYLIST_INTERNALS 1 |
| 314 |
#endif |
| 315 |
#ifndef CYTHON_USE_UNICODE_INTERNALS |
| 316 |
#define CYTHON_USE_UNICODE_INTERNALS 1 |
| 317 |
#endif |
| 318 |
#if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2 |
| 319 |
#undef CYTHON_USE_UNICODE_WRITER |
| 320 |
#define CYTHON_USE_UNICODE_WRITER 0 |
| 321 |
#elif !defined(CYTHON_USE_UNICODE_WRITER) |
| 322 |
#define CYTHON_USE_UNICODE_WRITER 1 |
| 323 |
#endif |
| 324 |
#ifndef CYTHON_AVOID_BORROWED_REFS |
| 325 |
#define CYTHON_AVOID_BORROWED_REFS 0 |
| 326 |
#endif |
| 327 |
#ifndef CYTHON_ASSUME_SAFE_MACROS |
| 328 |
#define CYTHON_ASSUME_SAFE_MACROS 1 |
| 329 |
#endif |
| 330 |
#ifndef CYTHON_UNPACK_METHODS |
| 331 |
#define CYTHON_UNPACK_METHODS 1 |
| 332 |
#endif |
| 333 |
#ifndef CYTHON_FAST_THREAD_STATE |
| 334 |
#define CYTHON_FAST_THREAD_STATE (PY_VERSION_HEX < 0x030C00A6) |
| 335 |
#endif |
| 336 |
#ifndef CYTHON_FAST_GIL |
| 337 |
#define CYTHON_FAST_GIL (PY_MAJOR_VERSION < 3 || PY_VERSION_HEX >= 0x03060000 && PY_VERSION_HEX < 0x030C00A6) |
| 338 |
#endif |
| 339 |
#ifndef CYTHON_METH_FASTCALL |
| 340 |
#define CYTHON_METH_FASTCALL (PY_VERSION_HEX >= 0x030700A1) |
| 341 |
#endif |
| 342 |
#ifndef CYTHON_FAST_PYCALL |
| 343 |
#define CYTHON_FAST_PYCALL 1 |
| 344 |
#endif |
| 345 |
#ifndef CYTHON_PEP487_INIT_SUBCLASS |
| 346 |
#define CYTHON_PEP487_INIT_SUBCLASS 1 |
| 347 |
#endif |
| 348 |
#if PY_VERSION_HEX < 0x03050000 |
| 349 |
#undef CYTHON_PEP489_MULTI_PHASE_INIT |
| 350 |
#define CYTHON_PEP489_MULTI_PHASE_INIT 0 |
| 351 |
#elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT) |
| 352 |
#define CYTHON_PEP489_MULTI_PHASE_INIT 1 |
| 353 |
#endif |
| 354 |
#ifndef CYTHON_USE_MODULE_STATE |
| 355 |
#define CYTHON_USE_MODULE_STATE 0 |
| 356 |
#endif |
| 357 |
#if PY_VERSION_HEX < 0x030400a1 |
| 358 |
#undef CYTHON_USE_TP_FINALIZE |
| 359 |
#define CYTHON_USE_TP_FINALIZE 0 |
| 360 |
#elif !defined(CYTHON_USE_TP_FINALIZE) |
| 361 |
#define CYTHON_USE_TP_FINALIZE 1 |
| 362 |
#endif |
| 363 |
#if PY_VERSION_HEX < 0x030600B1 |
| 364 |
#undef CYTHON_USE_DICT_VERSIONS |
| 365 |
#define CYTHON_USE_DICT_VERSIONS 0 |
| 366 |
#elif !defined(CYTHON_USE_DICT_VERSIONS) |
| 367 |
#define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX < 0x030C00A5) |
| 368 |
#endif |
| 369 |
#if PY_VERSION_HEX < 0x030700A3 |
| 370 |
#undef CYTHON_USE_EXC_INFO_STACK |
| 371 |
#define CYTHON_USE_EXC_INFO_STACK 0 |
| 372 |
#elif !defined(CYTHON_USE_EXC_INFO_STACK) |
| 373 |
#define CYTHON_USE_EXC_INFO_STACK 1 |
| 374 |
#endif |
| 375 |
#ifndef CYTHON_UPDATE_DESCRIPTOR_DOC |
| 376 |
#define CYTHON_UPDATE_DESCRIPTOR_DOC 1 |
| 377 |
#endif |
| 378 |
#endif |
| 379 |
#if !defined(CYTHON_FAST_PYCCALL) |
| 380 |
#define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) |
| 381 |
#endif |
| 382 |
#if !defined(CYTHON_VECTORCALL) |
| 383 |
#define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL && PY_VERSION_HEX >= 0x030800B1) |
| 384 |
#endif |
| 385 |
#define CYTHON_BACKPORT_VECTORCALL (CYTHON_METH_FASTCALL && PY_VERSION_HEX < 0x030800B1) |
| 386 |
#if CYTHON_USE_PYLONG_INTERNALS |
| 387 |
#if PY_MAJOR_VERSION < 3 |
| 388 |
#include "longintrepr.h" |
| 389 |
#endif |
| 390 |
#undef SHIFT |
| 391 |
#undef BASE |
| 392 |
#undef MASK |
| 393 |
#ifdef SIZEOF_VOID_P |
| 394 |
enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) }; |
| 395 |
#endif |
| 396 |
#endif |
| 397 |
#ifndef __has_attribute |
| 398 |
#define __has_attribute(x) 0 |
| 399 |
#endif |
| 400 |
#ifndef __has_cpp_attribute |
| 401 |
#define __has_cpp_attribute(x) 0 |
| 402 |
#endif |
| 403 |
#ifndef CYTHON_RESTRICT |
| 404 |
#if defined(__GNUC__) |
| 405 |
#define CYTHON_RESTRICT __restrict__ |
| 406 |
#elif defined(_MSC_VER) && _MSC_VER >= 1400 |
| 407 |
#define CYTHON_RESTRICT __restrict |
| 408 |
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L |
| 409 |
#define CYTHON_RESTRICT restrict |
| 410 |
#else |
| 411 |
#define CYTHON_RESTRICT |
| 412 |
#endif |
| 413 |
#endif |
| 414 |
#ifndef CYTHON_UNUSED |
| 415 |
#if defined(__cplusplus) |
| 416 |
|
| 417 |
|
| 418 |
#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) |
| 419 |
#if __has_cpp_attribute(maybe_unused) |
| 420 |
#define CYTHON_UNUSED [[maybe_unused]] |
| 421 |
#endif |
| 422 |
#endif |
| 423 |
#endif |
| 424 |
#endif |
| 425 |
#ifndef CYTHON_UNUSED |
| 426 |
# if defined(__GNUC__) |
| 427 |
# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) |
| 428 |
# define CYTHON_UNUSED __attribute__ ((__unused__)) |
| 429 |
# else |
| 430 |
# define CYTHON_UNUSED |
| 431 |
# endif |
| 432 |
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) |
| 433 |
# define CYTHON_UNUSED __attribute__ ((__unused__)) |
| 434 |
# else |
| 435 |
# define CYTHON_UNUSED |
| 436 |
# endif |
| 437 |
#endif |
| 438 |
#ifndef CYTHON_UNUSED_VAR |
| 439 |
# if defined(__cplusplus) |
| 440 |
template<class T> void CYTHON_UNUSED_VAR( const T& ) { } |
| 441 |
# else |
| 442 |
# define CYTHON_UNUSED_VAR(x) (void)(x) |
| 443 |
# endif |
| 444 |
#endif |
| 445 |
#ifndef CYTHON_MAYBE_UNUSED_VAR |
| 446 |
#define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x) |
| 447 |
#endif |
| 448 |
#ifndef CYTHON_NCP_UNUSED |
| 449 |
# if CYTHON_COMPILING_IN_CPYTHON |
| 450 |
# define CYTHON_NCP_UNUSED |
| 451 |
# else |
| 452 |
# define CYTHON_NCP_UNUSED CYTHON_UNUSED |
| 453 |
# endif |
| 454 |
#endif |
| 455 |
#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) |
| 456 |
#ifdef _MSC_VER |
| 457 |
#ifndef _MSC_STDINT_H_ |
| 458 |
#if _MSC_VER < 1300 |
| 459 |
typedef unsigned char uint8_t; |
| 460 |
typedef unsigned short uint16_t; |
| 461 |
typedef unsigned int uint32_t; |
| 462 |
#else |
| 463 |
typedef unsigned __int8 uint8_t; |
| 464 |
typedef unsigned __int16 uint16_t; |
| 465 |
typedef unsigned __int32 uint32_t; |
| 466 |
#endif |
| 467 |
#endif |
| 468 |
#if _MSC_VER < 1300 |
| 469 |
#ifdef _WIN64 |
| 470 |
typedef unsigned long long __pyx_uintptr_t; |
| 471 |
#else |
| 472 |
typedef unsigned int __pyx_uintptr_t; |
| 473 |
#endif |
| 474 |
#else |
| 475 |
#ifdef _WIN64 |
| 476 |
typedef unsigned __int64 __pyx_uintptr_t; |
| 477 |
#else |
| 478 |
typedef unsigned __int32 __pyx_uintptr_t; |
| 479 |
#endif |
| 480 |
#endif |
| 481 |
#else |
| 482 |
#include <stdint.h> |
| 483 |
typedef uintptr_t __pyx_uintptr_t; |
| 484 |
#endif |
| 485 |
#ifndef CYTHON_FALLTHROUGH |
| 486 |
#if defined(__cplusplus) |
| 487 |
|
| 488 |
|
| 489 |
#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L) |
| 490 |
#if __has_cpp_attribute(fallthrough) |
| 491 |
#define CYTHON_FALLTHROUGH [[fallthrough]] |
| 492 |
#endif |
| 493 |
#endif |
| 494 |
#ifndef CYTHON_FALLTHROUGH |
| 495 |
#if __has_cpp_attribute(clang::fallthrough) |
| 496 |
#define CYTHON_FALLTHROUGH [[clang::fallthrough]] |
| 497 |
#elif __has_cpp_attribute(gnu::fallthrough) |
| 498 |
#define CYTHON_FALLTHROUGH [[gnu::fallthrough]] |
| 499 |
#endif |
| 500 |
#endif |
| 501 |
#endif |
| 502 |
#ifndef CYTHON_FALLTHROUGH |
| 503 |
#if __has_attribute(fallthrough) |
| 504 |
#define CYTHON_FALLTHROUGH __attribute__((fallthrough)) |
| 505 |
#else |
| 506 |
#define CYTHON_FALLTHROUGH |
| 507 |
#endif |
| 508 |
#endif |
| 509 |
#if defined(__clang__) && defined(__apple_build_version__) |
| 510 |
#if __apple_build_version__ < 7000000 |
| 511 |
#undef CYTHON_FALLTHROUGH |
| 512 |
#define CYTHON_FALLTHROUGH |
| 513 |
#endif |
| 514 |
#endif |
| 515 |
#endif |
| 516 |
#ifdef __cplusplus |
| 517 |
template <typename T> |
| 518 |
struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);}; |
| 519 |
#define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL<type>::value) |
| 520 |
#else |
| 521 |
#define __PYX_IS_UNSIGNED(type) (((type)-1) > 0) |
| 522 |
#endif |
| 523 |
#define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer)) |
| 524 |
|
| 525 |
#ifndef CYTHON_INLINE |
| 526 |
#if defined(__clang__) |
| 527 |
#define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) |
| 528 |
#elif defined(__GNUC__) |
| 529 |
#define CYTHON_INLINE __inline__ |
| 530 |
#elif defined(_MSC_VER) |
| 531 |
#define CYTHON_INLINE __inline |
| 532 |
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L |
| 533 |
#define CYTHON_INLINE inline |
| 534 |
#else |
| 535 |
#define CYTHON_INLINE |
| 536 |
#endif |
| 537 |
#endif |
| 538 |
|
| 539 |
#define __PYX_BUILD_PY_SSIZE_T "n" |
| 540 |
#define CYTHON_FORMAT_SSIZE_T "z" |
| 541 |
#if PY_MAJOR_VERSION < 3 |
| 542 |
#define __Pyx_BUILTIN_MODULE_NAME "__builtin__" |
| 543 |
#define __Pyx_DefaultClassType PyClass_Type |
| 544 |
#define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ |
| 545 |
PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) |
| 546 |
#else |
| 547 |
#define __Pyx_BUILTIN_MODULE_NAME "builtins" |
| 548 |
#define __Pyx_DefaultClassType PyType_Type |
| 549 |
#if PY_VERSION_HEX >= 0x030B00A1 |
| 550 |
static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f, |
| 551 |
PyObject *code, PyObject *c, PyObject* n, PyObject *v, |
| 552 |
PyObject *fv, PyObject *cell, PyObject* fn, |
| 553 |
PyObject *name, int fline, PyObject *lnos) { |
| 554 |
PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL; |
| 555 |
PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *empty=NULL; |
| 556 |
const char *fn_cstr=NULL; |
| 557 |
const char *name_cstr=NULL; |
| 558 |
PyCodeObject *co=NULL, *result=NULL; |
| 559 |
PyObject *type, *value, *traceback; |
| 560 |
PyErr_Fetch(&type, &value, &traceback); |
| 561 |
if (!(kwds=PyDict_New())) goto end; |
| 562 |
if (!(argcount=PyLong_FromLong(a))) goto end; |
| 563 |
if (PyDict_SetItemString(kwds, "co_argcount", argcount) != 0) goto end; |
| 564 |
if (!(posonlyargcount=PyLong_FromLong(p))) goto end; |
| 565 |
if (PyDict_SetItemString(kwds, "co_posonlyargcount", posonlyargcount) != 0) goto end; |
| 566 |
if (!(kwonlyargcount=PyLong_FromLong(k))) goto end; |
| 567 |
if (PyDict_SetItemString(kwds, "co_kwonlyargcount", kwonlyargcount) != 0) goto end; |
| 568 |
if (!(nlocals=PyLong_FromLong(l))) goto end; |
| 569 |
if (PyDict_SetItemString(kwds, "co_nlocals", nlocals) != 0) goto end; |
| 570 |
if (!(stacksize=PyLong_FromLong(s))) goto end; |
| 571 |
if (PyDict_SetItemString(kwds, "co_stacksize", stacksize) != 0) goto end; |
| 572 |
if (!(flags=PyLong_FromLong(f))) goto end; |
| 573 |
if (PyDict_SetItemString(kwds, "co_flags", flags) != 0) goto end; |
| 574 |
if (PyDict_SetItemString(kwds, "co_code", code) != 0) goto end; |
| 575 |
if (PyDict_SetItemString(kwds, "co_consts", c) != 0) goto end; |
| 576 |
if (PyDict_SetItemString(kwds, "co_names", n) != 0) goto end; |
| 577 |
if (PyDict_SetItemString(kwds, "co_varnames", v) != 0) goto end; |
| 578 |
if (PyDict_SetItemString(kwds, "co_freevars", fv) != 0) goto end; |
| 579 |
if (PyDict_SetItemString(kwds, "co_cellvars", cell) != 0) goto end; |
| 580 |
if (PyDict_SetItemString(kwds, "co_linetable", lnos) != 0) goto end; |
| 581 |
if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL))) goto end; |
| 582 |
if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL))) goto end; |
| 583 |
if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline))) goto end; |
| 584 |
if (!(replace = PyObject_GetAttrString((PyObject*)co, "replace"))) goto end; |
| 585 |
if (!(empty = PyTuple_New(0))) goto end; |
| 586 |
result = (PyCodeObject*) PyObject_Call(replace, empty, kwds); |
| 587 |
end: |
| 588 |
Py_XDECREF((PyObject*) co); |
| 589 |
Py_XDECREF(kwds); |
| 590 |
Py_XDECREF(argcount); |
| 591 |
Py_XDECREF(posonlyargcount); |
| 592 |
Py_XDECREF(kwonlyargcount); |
| 593 |
Py_XDECREF(nlocals); |
| 594 |
Py_XDECREF(stacksize); |
| 595 |
Py_XDECREF(replace); |
| 596 |
Py_XDECREF(empty); |
| 597 |
if (type) { |
| 598 |
PyErr_Restore(type, value, traceback); |
| 599 |
} |
| 600 |
return result; |
| 601 |
} |
| 602 |
#elif PY_VERSION_HEX >= 0x030800B2 && !CYTHON_COMPILING_IN_PYPY |
| 603 |
#define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ |
| 604 |
PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) |
| 605 |
#else |
| 606 |
#define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ |
| 607 |
PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) |
| 608 |
#endif |
| 609 |
#endif |
| 610 |
#if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE) |
| 611 |
#define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type) |
| 612 |
#else |
| 613 |
#define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type)) |
| 614 |
#endif |
| 615 |
#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is) |
| 616 |
#define __Pyx_Py_Is(x, y) Py_Is(x, y) |
| 617 |
#else |
| 618 |
#define __Pyx_Py_Is(x, y) ((x) == (y)) |
| 619 |
#endif |
| 620 |
#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone) |
| 621 |
#define __Pyx_Py_IsNone(ob) Py_IsNone(ob) |
| 622 |
#else |
| 623 |
#define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None) |
| 624 |
#endif |
| 625 |
#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue) |
| 626 |
#define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob) |
| 627 |
#else |
| 628 |
#define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True) |
| 629 |
#endif |
| 630 |
#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse) |
| 631 |
#define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob) |
| 632 |
#else |
| 633 |
#define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False) |
| 634 |
#endif |
| 635 |
#define __Pyx_NoneAsNull(obj) (__Pyx_Py_IsNone(obj) ? NULL : (obj)) |
| 636 |
#ifndef CO_COROUTINE |
| 637 |
#define CO_COROUTINE 0x80 |
| 638 |
#endif |
| 639 |
#ifndef CO_ASYNC_GENERATOR |
| 640 |
#define CO_ASYNC_GENERATOR 0x200 |
| 641 |
#endif |
| 642 |
#ifndef Py_TPFLAGS_CHECKTYPES |
| 643 |
#define Py_TPFLAGS_CHECKTYPES 0 |
| 644 |
#endif |
| 645 |
#ifndef Py_TPFLAGS_HAVE_INDEX |
| 646 |
#define Py_TPFLAGS_HAVE_INDEX 0 |
| 647 |
#endif |
| 648 |
#ifndef Py_TPFLAGS_HAVE_NEWBUFFER |
| 649 |
#define Py_TPFLAGS_HAVE_NEWBUFFER 0 |
| 650 |
#endif |
| 651 |
#ifndef Py_TPFLAGS_HAVE_FINALIZE |
| 652 |
#define Py_TPFLAGS_HAVE_FINALIZE 0 |
| 653 |
#endif |
| 654 |
#ifndef Py_TPFLAGS_SEQUENCE |
| 655 |
#define Py_TPFLAGS_SEQUENCE 0 |
| 656 |
#endif |
| 657 |
#ifndef Py_TPFLAGS_MAPPING |
| 658 |
#define Py_TPFLAGS_MAPPING 0 |
| 659 |
#endif |
| 660 |
#ifndef METH_STACKLESS |
| 661 |
#define METH_STACKLESS 0 |
| 662 |
#endif |
| 663 |
#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL) |
| 664 |
#ifndef METH_FASTCALL |
| 665 |
#define METH_FASTCALL 0x80 |
| 666 |
#endif |
| 667 |
typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs); |
| 668 |
typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args, |
| 669 |
Py_ssize_t nargs, PyObject *kwnames); |
| 670 |
#else |
| 671 |
#define __Pyx_PyCFunctionFast _PyCFunctionFast |
| 672 |
#define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords |
| 673 |
#endif |
| 674 |
#if CYTHON_METH_FASTCALL |
| 675 |
#define __Pyx_METH_FASTCALL METH_FASTCALL |
| 676 |
#define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast |
| 677 |
#define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords |
| 678 |
#else |
| 679 |
#define __Pyx_METH_FASTCALL METH_VARARGS |
| 680 |
#define __Pyx_PyCFunction_FastCall PyCFunction |
| 681 |
#define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords |
| 682 |
#endif |
| 683 |
#if CYTHON_VECTORCALL |
| 684 |
#define __pyx_vectorcallfunc vectorcallfunc |
| 685 |
#define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET |
| 686 |
#define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n)) |
| 687 |
#elif CYTHON_BACKPORT_VECTORCALL |
| 688 |
typedef PyObject *(*__pyx_vectorcallfunc)(PyObject *callable, PyObject *const *args, |
| 689 |
size_t nargsf, PyObject *kwnames); |
| 690 |
#define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET ((size_t)1 << (8 * sizeof(size_t) - 1)) |
| 691 |
#define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(((size_t)(n)) & ~__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)) |
| 692 |
#else |
| 693 |
#define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0 |
| 694 |
#define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n)) |
| 695 |
#endif |
| 696 |
#if PY_VERSION_HEX < 0x030900B1 |
| 697 |
#define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b)) |
| 698 |
typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *); |
| 699 |
#else |
| 700 |
#define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b) |
| 701 |
#define __Pyx_PyCMethod PyCMethod |
| 702 |
#endif |
| 703 |
#ifndef METH_METHOD |
| 704 |
#define METH_METHOD 0x200 |
| 705 |
#endif |
| 706 |
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) |
| 707 |
#define PyObject_Malloc(s) PyMem_Malloc(s) |
| 708 |
#define PyObject_Free(p) PyMem_Free(p) |
| 709 |
#define PyObject_Realloc(p) PyMem_Realloc(p) |
| 710 |
#endif |
| 711 |
#if CYTHON_COMPILING_IN_LIMITED_API |
| 712 |
#define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) |
| 713 |
#define __Pyx_PyFrame_SetLineNumber(frame, lineno) |
| 714 |
#else |
| 715 |
#define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) |
| 716 |
#define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) |
| 717 |
#endif |
| 718 |
#if CYTHON_COMPILING_IN_LIMITED_API |
| 719 |
#define __Pyx_PyThreadState_Current PyThreadState_Get() |
| 720 |
#elif !CYTHON_FAST_THREAD_STATE |
| 721 |
#define __Pyx_PyThreadState_Current PyThreadState_GET() |
| 722 |
#elif PY_VERSION_HEX >= 0x03060000 |
| 723 |
#define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() |
| 724 |
#elif PY_VERSION_HEX >= 0x03000000 |
| 725 |
#define __Pyx_PyThreadState_Current PyThreadState_GET() |
| 726 |
#else |
| 727 |
#define __Pyx_PyThreadState_Current _PyThreadState_Current |
| 728 |
#endif |
| 729 |
#if CYTHON_COMPILING_IN_LIMITED_API |
| 730 |
static CYTHON_INLINE void *__Pyx_PyModule_GetState(PyObject *op) |
| 731 |
{ |
| 732 |
void *result; |
| 733 |
result = PyModule_GetState(op); |
| 734 |
if (!result) |
| 735 |
Py_FatalError("Couldn't find the module state"); |
| 736 |
return result; |
| 737 |
} |
| 738 |
#endif |
| 739 |
#define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE(obj), name, func_ctype) |
| 740 |
#if CYTHON_COMPILING_IN_LIMITED_API |
| 741 |
#define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name)) |
| 742 |
#else |
| 743 |
#define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name) |
| 744 |
#endif |
| 745 |
#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT) |
| 746 |
#include "pythread.h" |
| 747 |
#define Py_tss_NEEDS_INIT 0 |
| 748 |
typedef int Py_tss_t; |
| 749 |
static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) { |
| 750 |
*key = PyThread_create_key(); |
| 751 |
return 0; |
| 752 |
} |
| 753 |
static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) { |
| 754 |
Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t)); |
| 755 |
*key = Py_tss_NEEDS_INIT; |
| 756 |
return key; |
| 757 |
} |
| 758 |
static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) { |
| 759 |
PyObject_Free(key); |
| 760 |
} |
| 761 |
static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) { |
| 762 |
return *key != Py_tss_NEEDS_INIT; |
| 763 |
} |
| 764 |
static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) { |
| 765 |
PyThread_delete_key(*key); |
| 766 |
*key = Py_tss_NEEDS_INIT; |
| 767 |
} |
| 768 |
static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) { |
| 769 |
return PyThread_set_key_value(*key, value); |
| 770 |
} |
| 771 |
static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { |
| 772 |
return PyThread_get_key_value(*key); |
| 773 |
} |
| 774 |
#endif |
| 775 |
#if PY_MAJOR_VERSION < 3 |
| 776 |
#if CYTHON_COMPILING_IN_PYPY |
| 777 |
#if PYPY_VERSION_NUM < 0x07030600 |
| 778 |
#if defined(__cplusplus) && __cplusplus >= 201402L |
| 779 |
[[deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")]] |
| 780 |
#elif defined(__GNUC__) || defined(__clang__) |
| 781 |
__attribute__ ((__deprecated__("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6"))) |
| 782 |
#elif defined(_MSC_VER) |
| 783 |
__declspec(deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")) |
| 784 |
#endif |
| 785 |
static CYTHON_INLINE int PyGILState_Check(void) { |
| 786 |
return 0; |
| 787 |
} |
| 788 |
#else |
| 789 |
#endif |
| 790 |
#else |
| 791 |
static CYTHON_INLINE int PyGILState_Check(void) { |
| 792 |
PyThreadState * tstate = _PyThreadState_Current; |
| 793 |
return tstate && (tstate == PyGILState_GetThisThreadState()); |
| 794 |
} |
| 795 |
#endif |
| 796 |
#endif |
| 797 |
#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) |
| 798 |
#define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) |
| 799 |
#else |
| 800 |
#define __Pyx_PyDict_NewPresized(n) PyDict_New() |
| 801 |
#endif |
| 802 |
#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION |
| 803 |
#define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) |
| 804 |
#define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) |
| 805 |
#else |
| 806 |
#define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) |
| 807 |
#define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) |
| 808 |
#endif |
| 809 |
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030600B4 && CYTHON_USE_UNICODE_INTERNALS |
| 810 |
#define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) |
| 811 |
static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) { |
| 812 |
PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name); |
| 813 |
if (res == NULL) PyErr_Clear(); |
| 814 |
return res; |
| 815 |
} |
| 816 |
#elif PY_MAJOR_VERSION >= 3 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000) |
| 817 |
#define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError |
| 818 |
#define __Pyx_PyDict_GetItemStr PyDict_GetItem |
| 819 |
#else |
| 820 |
static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) { |
| 821 |
#if CYTHON_COMPILING_IN_PYPY |
| 822 |
return PyDict_GetItem(dict, name); |
| 823 |
#else |
| 824 |
PyDictEntry *ep; |
| 825 |
PyDictObject *mp = (PyDictObject*) dict; |
| 826 |
long hash = ((PyStringObject *) name)->ob_shash; |
| 827 |
assert(hash != -1); |
| 828 |
ep = (mp->ma_lookup)(mp, name, hash); |
| 829 |
if (ep == NULL) { |
| 830 |
return NULL; |
| 831 |
} |
| 832 |
return ep->me_value; |
| 833 |
#endif |
| 834 |
} |
| 835 |
#define __Pyx_PyDict_GetItemStr PyDict_GetItem |
| 836 |
#endif |
| 837 |
#if CYTHON_USE_TYPE_SLOTS |
| 838 |
#define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags) |
| 839 |
#define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0) |
| 840 |
#define __Pyx_PyObject_GetIterNextFunc(obj) (Py_TYPE(obj)->tp_iternext) |
| 841 |
#else |
| 842 |
#define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp)) |
| 843 |
#define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature) |
| 844 |
#define __Pyx_PyObject_GetIterNextFunc(obj) PyIter_Next |
| 845 |
#endif |
| 846 |
#if CYTHON_USE_TYPE_SPECS && PY_VERSION_HEX >= 0x03080000 |
| 847 |
#define __Pyx_PyHeapTypeObject_GC_Del(obj) {\ |
| 848 |
PyTypeObject *type = Py_TYPE(obj);\ |
| 849 |
assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\ |
| 850 |
PyObject_GC_Del(obj);\ |
| 851 |
Py_DECREF(type);\ |
| 852 |
} |
| 853 |
#else |
| 854 |
#define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj) |
| 855 |
#endif |
| 856 |
#if CYTHON_COMPILING_IN_LIMITED_API |
| 857 |
#define CYTHON_PEP393_ENABLED 1 |
| 858 |
#define __Pyx_PyUnicode_READY(op) (0) |
| 859 |
#define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GetLength(u) |
| 860 |
#define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i) |
| 861 |
#define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111U) |
| 862 |
#define __Pyx_PyUnicode_KIND(u) ((void)u, (0)) |
| 863 |
#define __Pyx_PyUnicode_DATA(u) ((void*)u) |
| 864 |
#define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i)) |
| 865 |
#define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u)) |
| 866 |
#elif PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) |
| 867 |
#define CYTHON_PEP393_ENABLED 1 |
| 868 |
#if PY_VERSION_HEX >= 0x030C0000 |
| 869 |
#define __Pyx_PyUnicode_READY(op) (0) |
| 870 |
#else |
| 871 |
#define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ |
| 872 |
0 : _PyUnicode_Ready((PyObject *)(op))) |
| 873 |
#endif |
| 874 |
#define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) |
| 875 |
#define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) |
| 876 |
#define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) |
| 877 |
#define __Pyx_PyUnicode_KIND(u) ((int)PyUnicode_KIND(u)) |
| 878 |
#define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) |
| 879 |
#define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) |
| 880 |
#define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) |
| 881 |
#if PY_VERSION_HEX >= 0x030C0000 |
| 882 |
#define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) |
| 883 |
#else |
| 884 |
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000 |
| 885 |
#define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length)) |
| 886 |
#else |
| 887 |
#define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) |
| 888 |
#endif |
| 889 |
#endif |
| 890 |
#else |
| 891 |
#define CYTHON_PEP393_ENABLED 0 |
| 892 |
#define PyUnicode_1BYTE_KIND 1 |
| 893 |
#define PyUnicode_2BYTE_KIND 2 |
| 894 |
#define PyUnicode_4BYTE_KIND 4 |
| 895 |
#define __Pyx_PyUnicode_READY(op) (0) |
| 896 |
#define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) |
| 897 |
#define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) |
| 898 |
#define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535U : 1114111U) |
| 899 |
#define __Pyx_PyUnicode_KIND(u) ((int)sizeof(Py_UNICODE)) |
| 900 |
#define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) |
| 901 |
#define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) |
| 902 |
#define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch) |
| 903 |
#define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) |
| 904 |
#endif |
| 905 |
#if CYTHON_COMPILING_IN_PYPY |
| 906 |
#define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) |
| 907 |
#define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) |
| 908 |
#else |
| 909 |
#define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) |
| 910 |
#define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ |
| 911 |
PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) |
| 912 |
#endif |
| 913 |
#if CYTHON_COMPILING_IN_PYPY |
| 914 |
#if !defined(PyUnicode_DecodeUnicodeEscape) |
| 915 |
#define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors) |
| 916 |
#endif |
| 917 |
#if !defined(PyUnicode_Contains) || (PY_MAJOR_VERSION == 2 && PYPY_VERSION_NUM < 0x07030500) |
| 918 |
#undef PyUnicode_Contains |
| 919 |
#define PyUnicode_Contains(u, s) PySequence_Contains(u, s) |
| 920 |
#endif |
| 921 |
#if !defined(PyByteArray_Check) |
| 922 |
#define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) |
| 923 |
#endif |
| 924 |
#if !defined(PyObject_Format) |
| 925 |
#define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) |
| 926 |
#endif |
| 927 |
#endif |
| 928 |
#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)) |
| 929 |
#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) |
| 930 |
#if PY_MAJOR_VERSION >= 3 |
| 931 |
#define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) |
| 932 |
#else |
| 933 |
#define __Pyx_PyString_Format(a, b) PyString_Format(a, b) |
| 934 |
#endif |
| 935 |
#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII) |
| 936 |
#define PyObject_ASCII(o) PyObject_Repr(o) |
| 937 |
#endif |
| 938 |
#if PY_MAJOR_VERSION >= 3 |
| 939 |
#define PyBaseString_Type PyUnicode_Type |
| 940 |
#define PyStringObject PyUnicodeObject |
| 941 |
#define PyString_Type PyUnicode_Type |
| 942 |
#define PyString_Check PyUnicode_Check |
| 943 |
#define PyString_CheckExact PyUnicode_CheckExact |
| 944 |
#ifndef PyObject_Unicode |
| 945 |
#define PyObject_Unicode PyObject_Str |
| 946 |
#endif |
| 947 |
#endif |
| 948 |
#if PY_MAJOR_VERSION >= 3 |
| 949 |
#define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) |
| 950 |
#define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) |
| 951 |
#else |
| 952 |
#define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) |
| 953 |
#define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) |
| 954 |
#endif |
| 955 |
#if CYTHON_COMPILING_IN_CPYTHON |
| 956 |
#define __Pyx_PySequence_ListKeepNew(obj)\ |
| 957 |
(likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj)) |
| 958 |
#else |
| 959 |
#define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj) |
| 960 |
#endif |
| 961 |
#ifndef PySet_CheckExact |
| 962 |
#define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type) |
| 963 |
#endif |
| 964 |
#if PY_VERSION_HEX >= 0x030900A4 |
| 965 |
#define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt) |
| 966 |
#define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size) |
| 967 |
#else |
| 968 |
#define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt) |
| 969 |
#define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size) |
| 970 |
#endif |
| 971 |
#if CYTHON_ASSUME_SAFE_MACROS |
| 972 |
#define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) |
| 973 |
#else |
| 974 |
#define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq) |
| 975 |
#endif |
| 976 |
#if PY_MAJOR_VERSION >= 3 |
| 977 |
#define PyIntObject PyLongObject |
| 978 |
#define PyInt_Type PyLong_Type |
| 979 |
#define PyInt_Check(op) PyLong_Check(op) |
| 980 |
#define PyInt_CheckExact(op) PyLong_CheckExact(op) |
| 981 |
#define __Pyx_Py3Int_Check(op) PyLong_Check(op) |
| 982 |
#define __Pyx_Py3Int_CheckExact(op) PyLong_CheckExact(op) |
| 983 |
#define PyInt_FromString PyLong_FromString |
| 984 |
#define PyInt_FromUnicode PyLong_FromUnicode |
| 985 |
#define PyInt_FromLong PyLong_FromLong |
| 986 |
#define PyInt_FromSize_t PyLong_FromSize_t |
| 987 |
#define PyInt_FromSsize_t PyLong_FromSsize_t |
| 988 |
#define PyInt_AsLong PyLong_AsLong |
| 989 |
#define PyInt_AS_LONG PyLong_AS_LONG |
| 990 |
#define PyInt_AsSsize_t PyLong_AsSsize_t |
| 991 |
#define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask |
| 992 |
#define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask |
| 993 |
#define PyNumber_Int PyNumber_Long |
| 994 |
#else |
| 995 |
#define __Pyx_Py3Int_Check(op) (PyLong_Check(op) || PyInt_Check(op)) |
| 996 |
#define __Pyx_Py3Int_CheckExact(op) (PyLong_CheckExact(op) || PyInt_CheckExact(op)) |
| 997 |
#endif |
| 998 |
#if PY_MAJOR_VERSION >= 3 |
| 999 |
#define PyBoolObject PyLongObject |
| 1000 |
#endif |
| 1001 |
#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY |
| 1002 |
#ifndef PyUnicode_InternFromString |
| 1003 |
#define PyUnicode_InternFromString(s) PyUnicode_FromString(s) |
| 1004 |
#endif |
| 1005 |
#endif |
| 1006 |
#if PY_VERSION_HEX < 0x030200A4 |
| 1007 |
typedef long Py_hash_t; |
| 1008 |
#define __Pyx_PyInt_FromHash_t PyInt_FromLong |
| 1009 |
#define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t |
| 1010 |
#else |
| 1011 |
#define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t |
| 1012 |
#define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t |
| 1013 |
#endif |
| 1014 |
#if CYTHON_USE_ASYNC_SLOTS |
| 1015 |
#if PY_VERSION_HEX >= 0x030500B1 |
| 1016 |
#define __Pyx_PyAsyncMethodsStruct PyAsyncMethods |
| 1017 |
#define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) |
| 1018 |
#else |
| 1019 |
#define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) |
| 1020 |
#endif |
| 1021 |
#else |
| 1022 |
#define __Pyx_PyType_AsAsync(obj) NULL |
| 1023 |
#endif |
| 1024 |
#ifndef __Pyx_PyAsyncMethodsStruct |
| 1025 |
typedef struct { |
| 1026 |
unaryfunc am_await; |
| 1027 |
unaryfunc am_aiter; |
| 1028 |
unaryfunc am_anext; |
| 1029 |
} __Pyx_PyAsyncMethodsStruct; |
| 1030 |
#endif |
| 1031 |
|
| 1032 |
#if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS) |
| 1033 |
#if !defined(_USE_MATH_DEFINES) |
| 1034 |
#define _USE_MATH_DEFINES |
| 1035 |
#endif |
| 1036 |
#endif |
| 1037 |
#include <math.h> |
| 1038 |
#ifdef NAN |
| 1039 |
#define __PYX_NAN() ((float) NAN) |
| 1040 |
#else |
| 1041 |
static CYTHON_INLINE float __PYX_NAN() { |
| 1042 |
float value; |
| 1043 |
memset(&value, 0xFF, sizeof(value)); |
| 1044 |
return value; |
| 1045 |
} |
| 1046 |
#endif |
| 1047 |
#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) |
| 1048 |
#define __Pyx_truncl trunc |
| 1049 |
#else |
| 1050 |
#define __Pyx_truncl truncl |
| 1051 |
#endif |
| 1052 |
|
| 1053 |
#define __PYX_MARK_ERR_POS(f_index, lineno) \ |
| 1054 |
{ __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; } |
| 1055 |
#define __PYX_ERR(f_index, lineno, Ln_error) \ |
| 1056 |
{ __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; } |
| 1057 |
|
| 1058 |
#ifdef CYTHON_EXTERN_C |
| 1059 |
#undef __PYX_EXTERN_C |
| 1060 |
#define __PYX_EXTERN_C CYTHON_EXTERN_C |
| 1061 |
#elif defined(__PYX_EXTERN_C) |
| 1062 |
#ifdef _MSC_VER |
| 1063 |
#pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.") |
| 1064 |
#else |
| 1065 |
#warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead. |
| 1066 |
#endif |
| 1067 |
#else |
| 1068 |
#ifdef __cplusplus |
| 1069 |
#define __PYX_EXTERN_C extern "C" |
| 1070 |
#else |
| 1071 |
#define __PYX_EXTERN_C extern |
| 1072 |
#endif |
| 1073 |
#endif |
| 1074 |
|
| 1075 |
#define __PYX_HAVE__test_async_gen_exception_04 |
| 1076 |
#define __PYX_HAVE_API__test_async_gen_exception_04 |
| 1077 |
|
| 1078 |
#ifdef _OPENMP |
| 1079 |
#include <omp.h> |
| 1080 |
#endif |
| 1081 |
|
| 1082 |
#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS) |
| 1083 |
#define CYTHON_WITHOUT_ASSERTIONS |
| 1084 |
#endif |
| 1085 |
|
| 1086 |
typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding; |
| 1087 |
const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; |
| 1088 |
|
| 1089 |
#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 |
| 1090 |
#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0 |
| 1091 |
#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8) |
| 1092 |
#define __PYX_DEFAULT_STRING_ENCODING "" |
| 1093 |
#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString |
| 1094 |
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize |
| 1095 |
#define __Pyx_uchar_cast(c) ((unsigned char)c) |
| 1096 |
#define __Pyx_long_cast(x) ((long)x) |
| 1097 |
#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ |
| 1098 |
(sizeof(type) < sizeof(Py_ssize_t)) ||\ |
| 1099 |
(sizeof(type) > sizeof(Py_ssize_t) &&\ |
| 1100 |
likely(v < (type)PY_SSIZE_T_MAX ||\ |
| 1101 |
v == (type)PY_SSIZE_T_MAX) &&\ |
| 1102 |
(!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ |
| 1103 |
v == (type)PY_SSIZE_T_MIN))) ||\ |
| 1104 |
(sizeof(type) == sizeof(Py_ssize_t) &&\ |
| 1105 |
(is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ |
| 1106 |
v == (type)PY_SSIZE_T_MAX))) ) |
| 1107 |
static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) { |
| 1108 |
return (size_t) i < (size_t) limit; |
| 1109 |
} |
| 1110 |
#if defined (__cplusplus) && __cplusplus >= 201103L |
| 1111 |
#include <cstdlib> |
| 1112 |
#define __Pyx_sst_abs(value) std::abs(value) |
| 1113 |
#elif SIZEOF_INT >= SIZEOF_SIZE_T |
| 1114 |
#define __Pyx_sst_abs(value) abs(value) |
| 1115 |
#elif SIZEOF_LONG >= SIZEOF_SIZE_T |
| 1116 |
#define __Pyx_sst_abs(value) labs(value) |
| 1117 |
#elif defined (_MSC_VER) |
| 1118 |
#define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value)) |
| 1119 |
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L |
| 1120 |
#define __Pyx_sst_abs(value) llabs(value) |
| 1121 |
#elif defined (__GNUC__) |
| 1122 |
#define __Pyx_sst_abs(value) __builtin_llabs(value) |
| 1123 |
#else |
| 1124 |
#define __Pyx_sst_abs(value) ((value<0) ? -value : value) |
| 1125 |
#endif |
| 1126 |
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*); |
| 1127 |
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); |
| 1128 |
#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s)) |
| 1129 |
#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) |
| 1130 |
#define __Pyx_PyBytes_FromString PyBytes_FromString |
| 1131 |
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize |
| 1132 |
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); |
| 1133 |
#if PY_MAJOR_VERSION < 3 |
| 1134 |
#define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString |
| 1135 |
#define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize |
| 1136 |
#else |
| 1137 |
#define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString |
| 1138 |
#define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize |
| 1139 |
#endif |
| 1140 |
#define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s)) |
| 1141 |
#define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s)) |
| 1142 |
#define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s)) |
| 1143 |
#define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) |
| 1144 |
#define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) |
| 1145 |
#define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) |
| 1146 |
#define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) |
| 1147 |
#define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) |
| 1148 |
#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s)) |
| 1149 |
#define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) |
| 1150 |
#define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) |
| 1151 |
#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) |
| 1152 |
#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) |
| 1153 |
#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) |
| 1154 |
#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) |
| 1155 |
#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) |
| 1156 |
#if CYTHON_COMPILING_IN_LIMITED_API |
| 1157 |
static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const wchar_t *u) |
| 1158 |
{ |
| 1159 |
const wchar_t *u_end = u; |
| 1160 |
while (*u_end++) ; |
| 1161 |
return (size_t)(u_end - u - 1); |
| 1162 |
} |
| 1163 |
#else |
| 1164 |
static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) |
| 1165 |
{ |
| 1166 |
const Py_UNICODE *u_end = u; |
| 1167 |
while (*u_end++) ; |
| 1168 |
return (size_t)(u_end - u - 1); |
| 1169 |
} |
| 1170 |
#endif |
| 1171 |
#define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o) |
| 1172 |
#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) |
| 1173 |
#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode |
| 1174 |
#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode |
| 1175 |
#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) |
| 1176 |
#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) |
| 1177 |
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b); |
| 1178 |
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); |
| 1179 |
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*); |
| 1180 |
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); |
| 1181 |
#define __Pyx_PySequence_Tuple(obj)\ |
| 1182 |
(likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) |
| 1183 |
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); |
| 1184 |
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); |
| 1185 |
static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); |
| 1186 |
#if CYTHON_ASSUME_SAFE_MACROS |
| 1187 |
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) |
| 1188 |
#else |
| 1189 |
#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) |
| 1190 |
#endif |
| 1191 |
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) |
| 1192 |
#if PY_MAJOR_VERSION >= 3 |
| 1193 |
#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) |
| 1194 |
#else |
| 1195 |
#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) |
| 1196 |
#endif |
| 1197 |
#if CYTHON_USE_PYLONG_INTERNALS |
| 1198 |
#if PY_VERSION_HEX >= 0x030C00A7 |
| 1199 |
#define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & 3) |
| 1200 |
#define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0) |
| 1201 |
#define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x)) |
| 1202 |
#define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1) |
| 1203 |
#define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0) |
| 1204 |
#define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << 3)) // (2 << NON_SIZE_BITS) |
| 1205 |
#define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0]) |
| 1206 |
#define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0]) |
| 1207 |
#define __Pyx_PyLong_DigitCount(x) (((PyLongObject*)x)->long_value.lv_tag >> 3) // (>> NON_SIZE_BITS) |
| 1208 |
#define __Pyx_PyLong_SignedDigitCount(x)\ |
| 1209 |
((1 - (Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag & 3)) * (Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> 3)) // (>> NON_SIZE_BITS) |
| 1210 |
typedef Py_ssize_t __Pyx_compact_pylong; |
| 1211 |
typedef size_t __Pyx_compact_upylong; |
| 1212 |
#else |
| 1213 |
#define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0) |
| 1214 |
#define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0) |
| 1215 |
#define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0) |
| 1216 |
#define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0) |
| 1217 |
#define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1) |
| 1218 |
#define __Pyx_PyLong_CompactValue(x)\ |
| 1219 |
((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0])) |
| 1220 |
#define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0]) |
| 1221 |
#define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x)) |
| 1222 |
#define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x) |
| 1223 |
typedef sdigit __Pyx_compact_pylong; |
| 1224 |
typedef digit __Pyx_compact_upylong; |
| 1225 |
#endif |
| 1226 |
#if PY_VERSION_HEX >= 0x030C00A5 |
| 1227 |
#define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit) |
| 1228 |
#else |
| 1229 |
#define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit) |
| 1230 |
#endif |
| 1231 |
#endif |
| 1232 |
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII |
| 1233 |
static int __Pyx_sys_getdefaultencoding_not_ascii; |
| 1234 |
static int __Pyx_init_sys_getdefaultencoding_params(void) { |
| 1235 |
PyObject* sys; |
| 1236 |
PyObject* default_encoding = NULL; |
| 1237 |
PyObject* ascii_chars_u = NULL; |
| 1238 |
PyObject* ascii_chars_b = NULL; |
| 1239 |
const char* default_encoding_c; |
| 1240 |
sys = PyImport_ImportModule("sys"); |
| 1241 |
if (!sys) goto bad; |
| 1242 |
default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL); |
| 1243 |
Py_DECREF(sys); |
| 1244 |
if (!default_encoding) goto bad; |
| 1245 |
default_encoding_c = PyBytes_AsString(default_encoding); |
| 1246 |
if (!default_encoding_c) goto bad; |
| 1247 |
if (strcmp(default_encoding_c, "ascii") == 0) { |
| 1248 |
__Pyx_sys_getdefaultencoding_not_ascii = 0; |
| 1249 |
} else { |
| 1250 |
char ascii_chars[128]; |
| 1251 |
int c; |
| 1252 |
for (c = 0; c < 128; c++) { |
| 1253 |
ascii_chars[c] = c; |
| 1254 |
} |
| 1255 |
__Pyx_sys_getdefaultencoding_not_ascii = 1; |
| 1256 |
ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); |
| 1257 |
if (!ascii_chars_u) goto bad; |
| 1258 |
ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); |
| 1259 |
if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { |
| 1260 |
PyErr_Format( |
| 1261 |
PyExc_ValueError, |
| 1262 |
"This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.", |
| 1263 |
default_encoding_c); |
| 1264 |
goto bad; |
| 1265 |
} |
| 1266 |
Py_DECREF(ascii_chars_u); |
| 1267 |
Py_DECREF(ascii_chars_b); |
| 1268 |
} |
| 1269 |
Py_DECREF(default_encoding); |
| 1270 |
return 0; |
| 1271 |
bad: |
| 1272 |
Py_XDECREF(default_encoding); |
| 1273 |
Py_XDECREF(ascii_chars_u); |
| 1274 |
Py_XDECREF(ascii_chars_b); |
| 1275 |
return -1; |
| 1276 |
} |
| 1277 |
#endif |
| 1278 |
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 |
| 1279 |
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) |
| 1280 |
#else |
| 1281 |
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) |
| 1282 |
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT |
| 1283 |
static char* __PYX_DEFAULT_STRING_ENCODING; |
| 1284 |
static int __Pyx_init_sys_getdefaultencoding_params(void) { |
| 1285 |
PyObject* sys; |
| 1286 |
PyObject* default_encoding = NULL; |
| 1287 |
char* default_encoding_c; |
| 1288 |
sys = PyImport_ImportModule("sys"); |
| 1289 |
if (!sys) goto bad; |
| 1290 |
default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); |
| 1291 |
Py_DECREF(sys); |
| 1292 |
if (!default_encoding) goto bad; |
| 1293 |
default_encoding_c = PyBytes_AsString(default_encoding); |
| 1294 |
if (!default_encoding_c) goto bad; |
| 1295 |
__PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1); |
| 1296 |
if (!__PYX_DEFAULT_STRING_ENCODING) goto bad; |
| 1297 |
strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); |
| 1298 |
Py_DECREF(default_encoding); |
| 1299 |
return 0; |
| 1300 |
bad: |
| 1301 |
Py_XDECREF(default_encoding); |
| 1302 |
return -1; |
| 1303 |
} |
| 1304 |
#endif |
| 1305 |
#endif |
| 1306 |
|
| 1307 |
|
| 1308 |
|
| 1309 |
#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) |
| 1310 |
#define likely(x) __builtin_expect(!!(x), 1) |
| 1311 |
#define unlikely(x) __builtin_expect(!!(x), 0) |
| 1312 |
#else |
| 1313 |
#define likely(x) (x) |
| 1314 |
#define unlikely(x) (x) |
| 1315 |
#endif |
| 1316 |
static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } |
| 1317 |
|
| 1318 |
#if !CYTHON_USE_MODULE_STATE |
| 1319 |
static PyObject *__pyx_m = NULL; |
| 1320 |
#endif |
| 1321 |
static int __pyx_lineno; |
| 1322 |
static int __pyx_clineno = 0; |
| 1323 |
static const char * __pyx_cfilenm = __FILE__; |
| 1324 |
static const char *__pyx_filename; |
| 1325 |
|
| 1326 |
|
| 1327 |
|
| 1328 |
static const char *__pyx_f[] = { |
| 1329 |
"test_async_gen_exception_04.py", |
| 1330 |
}; |
| 1331 |
|
| 1332 |
|
| 1333 |
|
| 1334 |
|
| 1335 |
|
| 1336 |
|
| 1337 |
struct __pyx_obj_27test_async_gen_exception_04___pyx_scope_struct__gen; |
| 1338 |
|
| 1339 |
|
| 1340 |
|
| 1341 |
|
| 1342 |
|
| 1343 |
|
| 1344 |
|
| 1345 |
|
| 1346 |
struct __pyx_obj_27test_async_gen_exception_04___pyx_scope_struct__gen { |
| 1347 |
PyObject_HEAD |
| 1348 |
}; |
| 1349 |
|
| 1350 |
|
| 1351 |
|
| 1352 |
|
| 1353 |
|
| 1354 |
#ifndef CYTHON_REFNANNY |
| 1355 |
#define CYTHON_REFNANNY 0 |
| 1356 |
#endif |
| 1357 |
#if CYTHON_REFNANNY |
| 1358 |
typedef struct { |
| 1359 |
void (*INCREF)(void*, PyObject*, Py_ssize_t); |
| 1360 |
void (*DECREF)(void*, PyObject*, Py_ssize_t); |
| 1361 |
void (*GOTREF)(void*, PyObject*, Py_ssize_t); |
| 1362 |
void (*GIVEREF)(void*, PyObject*, Py_ssize_t); |
| 1363 |
void* (*SetupContext)(const char*, Py_ssize_t, const char*); |
| 1364 |
void (*FinishContext)(void**); |
| 1365 |
} __Pyx_RefNannyAPIStruct; |
| 1366 |
static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; |
| 1367 |
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); |
| 1368 |
#define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; |
| 1369 |
#ifdef WITH_THREAD |
| 1370 |
#define __Pyx_RefNannySetupContext(name, acquire_gil)\ |
| 1371 |
if (acquire_gil) {\ |
| 1372 |
PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ |
| 1373 |
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ |
| 1374 |
PyGILState_Release(__pyx_gilstate_save);\ |
| 1375 |
} else {\ |
| 1376 |
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ |
| 1377 |
} |
| 1378 |
#define __Pyx_RefNannyFinishContextNogil() {\ |
| 1379 |
PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ |
| 1380 |
__Pyx_RefNannyFinishContext();\ |
| 1381 |
PyGILState_Release(__pyx_gilstate_save);\ |
| 1382 |
} |
| 1383 |
#else |
| 1384 |
#define __Pyx_RefNannySetupContext(name, acquire_gil)\ |
| 1385 |
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__)) |
| 1386 |
#define __Pyx_RefNannyFinishContextNogil() __Pyx_RefNannyFinishContext() |
| 1387 |
#endif |
| 1388 |
#define __Pyx_RefNannyFinishContextNogil() {\ |
| 1389 |
PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ |
| 1390 |
__Pyx_RefNannyFinishContext();\ |
| 1391 |
PyGILState_Release(__pyx_gilstate_save);\ |
| 1392 |
} |
| 1393 |
#define __Pyx_RefNannyFinishContext()\ |
| 1394 |
__Pyx_RefNanny->FinishContext(&__pyx_refnanny) |
| 1395 |
#define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) |
| 1396 |
#define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) |
| 1397 |
#define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) |
| 1398 |
#define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__)) |
| 1399 |
#define __Pyx_XINCREF(r) do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0) |
| 1400 |
#define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0) |
| 1401 |
#define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0) |
| 1402 |
#define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0) |
| 1403 |
#else |
| 1404 |
#define __Pyx_RefNannyDeclarations |
| 1405 |
#define __Pyx_RefNannySetupContext(name, acquire_gil) |
| 1406 |
#define __Pyx_RefNannyFinishContextNogil() |
| 1407 |
#define __Pyx_RefNannyFinishContext() |
| 1408 |
#define __Pyx_INCREF(r) Py_INCREF(r) |
| 1409 |
#define __Pyx_DECREF(r) Py_DECREF(r) |
| 1410 |
#define __Pyx_GOTREF(r) |
| 1411 |
#define __Pyx_GIVEREF(r) |
| 1412 |
#define __Pyx_XINCREF(r) Py_XINCREF(r) |
| 1413 |
#define __Pyx_XDECREF(r) Py_XDECREF(r) |
| 1414 |
#define __Pyx_XGOTREF(r) |
| 1415 |
#define __Pyx_XGIVEREF(r) |
| 1416 |
#endif |
| 1417 |
#define __Pyx_Py_XDECREF_SET(r, v) do {\ |
| 1418 |
PyObject *tmp = (PyObject *) r;\ |
| 1419 |
r = v; Py_XDECREF(tmp);\ |
| 1420 |
} while (0) |
| 1421 |
#define __Pyx_XDECREF_SET(r, v) do {\ |
| 1422 |
PyObject *tmp = (PyObject *) r;\ |
| 1423 |
r = v; __Pyx_XDECREF(tmp);\ |
| 1424 |
} while (0) |
| 1425 |
#define __Pyx_DECREF_SET(r, v) do {\ |
| 1426 |
PyObject *tmp = (PyObject *) r;\ |
| 1427 |
r = v; __Pyx_DECREF(tmp);\ |
| 1428 |
} while (0) |
| 1429 |
#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) |
| 1430 |
#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) |
| 1431 |
|
| 1432 |
|
| 1433 |
#if CYTHON_FAST_THREAD_STATE |
| 1434 |
#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) |
| 1435 |
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); |
| 1436 |
#else |
| 1437 |
#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) |
| 1438 |
#endif |
| 1439 |
|
| 1440 |
|
| 1441 |
#if CYTHON_FAST_THREAD_STATE |
| 1442 |
#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; |
| 1443 |
#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; |
| 1444 |
#define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type |
| 1445 |
#else |
| 1446 |
#define __Pyx_PyThreadState_declare |
| 1447 |
#define __Pyx_PyThreadState_assign |
| 1448 |
#define __Pyx_PyErr_Occurred() PyErr_Occurred() |
| 1449 |
#endif |
| 1450 |
|
| 1451 |
|
| 1452 |
#if CYTHON_FAST_THREAD_STATE |
| 1453 |
#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) |
| 1454 |
#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) |
| 1455 |
#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) |
| 1456 |
#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) |
| 1457 |
#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) |
| 1458 |
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); |
| 1459 |
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); |
| 1460 |
#if CYTHON_COMPILING_IN_CPYTHON |
| 1461 |
#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) |
| 1462 |
#else |
| 1463 |
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) |
| 1464 |
#endif |
| 1465 |
#else |
| 1466 |
#define __Pyx_PyErr_Clear() PyErr_Clear() |
| 1467 |
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) |
| 1468 |
#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) |
| 1469 |
#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) |
| 1470 |
#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) |
| 1471 |
#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) |
| 1472 |
#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) |
| 1473 |
#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) |
| 1474 |
#endif |
| 1475 |
|
| 1476 |
|
| 1477 |
#if CYTHON_USE_TYPE_SLOTS |
| 1478 |
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); |
| 1479 |
#else |
| 1480 |
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) |
| 1481 |
#endif |
| 1482 |
|
| 1483 |
|
| 1484 |
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); |
| 1485 |
|
| 1486 |
|
| 1487 |
static PyObject *__Pyx_GetBuiltinName(PyObject *name); |
| 1488 |
|
| 1489 |
|
| 1490 |
#if CYTHON_COMPILING_IN_CPYTHON |
| 1491 |
static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n); |
| 1492 |
static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n); |
| 1493 |
#endif |
| 1494 |
|
| 1495 |
|
| 1496 |
#include <string.h> |
| 1497 |
|
| 1498 |
|
| 1499 |
static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); |
| 1500 |
|
| 1501 |
|
| 1502 |
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); |
| 1503 |
|
| 1504 |
|
| 1505 |
#define __Pyx_Arg_VARARGS(args, i) PyTuple_GET_ITEM(args, i) |
| 1506 |
#define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds) |
| 1507 |
#define __Pyx_KwValues_VARARGS(args, nargs) NULL |
| 1508 |
#define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s) |
| 1509 |
#define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw) |
| 1510 |
#if CYTHON_METH_FASTCALL |
| 1511 |
#define __Pyx_Arg_FASTCALL(args, i) args[i] |
| 1512 |
#define __Pyx_NumKwargs_FASTCALL(kwds) PyTuple_GET_SIZE(kwds) |
| 1513 |
#define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs)) |
| 1514 |
static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s); |
| 1515 |
#define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw) |
| 1516 |
#else |
| 1517 |
#define __Pyx_Arg_FASTCALL __Pyx_Arg_VARARGS |
| 1518 |
#define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS |
| 1519 |
#define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS |
| 1520 |
#define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS |
| 1521 |
#define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS |
| 1522 |
#endif |
| 1523 |
#if CYTHON_COMPILING_IN_CPYTHON |
| 1524 |
#define __Pyx_ArgsSlice_VARARGS(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_VARARGS(args, start), stop - start) |
| 1525 |
#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_FASTCALL(args, start), stop - start) |
| 1526 |
#else |
| 1527 |
#define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop) |
| 1528 |
#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop) |
| 1529 |
#endif |
| 1530 |
|
| 1531 |
|
| 1532 |
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS |
| 1533 |
#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) |
| 1534 |
#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) |
| 1535 |
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ |
| 1536 |
(version_var) = __PYX_GET_DICT_VERSION(dict);\ |
| 1537 |
(cache_var) = (value); |
| 1538 |
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ |
| 1539 |
static PY_UINT64_T __pyx_dict_version = 0;\ |
| 1540 |
static PyObject *__pyx_dict_cached_value = NULL;\ |
| 1541 |
if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ |
| 1542 |
(VAR) = __pyx_dict_cached_value;\ |
| 1543 |
} else {\ |
| 1544 |
(VAR) = __pyx_dict_cached_value = (LOOKUP);\ |
| 1545 |
__pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ |
| 1546 |
}\ |
| 1547 |
} |
| 1548 |
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); |
| 1549 |
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); |
| 1550 |
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); |
| 1551 |
#else |
| 1552 |
#define __PYX_GET_DICT_VERSION(dict) (0) |
| 1553 |
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) |
| 1554 |
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); |
| 1555 |
#endif |
| 1556 |
|
| 1557 |
|
| 1558 |
#if CYTHON_USE_DICT_VERSIONS |
| 1559 |
#define __Pyx_GetModuleGlobalName(var, name) do {\ |
| 1560 |
static PY_UINT64_T __pyx_dict_version = 0;\ |
| 1561 |
static PyObject *__pyx_dict_cached_value = NULL;\ |
| 1562 |
(var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\ |
| 1563 |
(likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\ |
| 1564 |
__Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ |
| 1565 |
} while(0) |
| 1566 |
#define __Pyx_GetModuleGlobalNameUncached(var, name) do {\ |
| 1567 |
PY_UINT64_T __pyx_dict_version;\ |
| 1568 |
PyObject *__pyx_dict_cached_value;\ |
| 1569 |
(var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ |
| 1570 |
} while(0) |
| 1571 |
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value); |
| 1572 |
#else |
| 1573 |
#define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name) |
| 1574 |
#define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name) |
| 1575 |
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); |
| 1576 |
#endif |
| 1577 |
|
| 1578 |
|
| 1579 |
#define __Pyx_StopAsyncIteration_USED |
| 1580 |
static PyObject *__Pyx_PyExc_StopAsyncIteration; |
| 1581 |
static int __pyx_StopAsyncIteration_init(PyObject *module); |
| 1582 |
|
| 1583 |
|
| 1584 |
#if CYTHON_FAST_THREAD_STATE |
| 1585 |
#define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) |
| 1586 |
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); |
| 1587 |
#else |
| 1588 |
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); |
| 1589 |
#endif |
| 1590 |
|
| 1591 |
|
| 1592 |
static void __Pyx_Generator_Replace_StopIteration(int in_async_gen); |
| 1593 |
|
| 1594 |
|
| 1595 |
static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); |
| 1596 |
|
| 1597 |
|
| 1598 |
static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject *const *kwvalues, |
| 1599 |
PyObject **argnames[], |
| 1600 |
PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, |
| 1601 |
const char* function_name); |
| 1602 |
|
| 1603 |
|
| 1604 |
static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, |
| 1605 |
Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); |
| 1606 |
|
| 1607 |
|
| 1608 |
#if CYTHON_FAST_PYCALL |
| 1609 |
#if !CYTHON_VECTORCALL |
| 1610 |
#define __Pyx_PyFunction_FastCall(func, args, nargs)\ |
| 1611 |
__Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) |
| 1612 |
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs); |
| 1613 |
#endif |
| 1614 |
#define __Pyx_BUILD_ASSERT_EXPR(cond)\ |
| 1615 |
(sizeof(char [1 - 2*!(cond)]) - 1) |
| 1616 |
#ifndef Py_MEMBER_SIZE |
| 1617 |
#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) |
| 1618 |
#endif |
| 1619 |
#if !CYTHON_VECTORCALL |
| 1620 |
#if PY_VERSION_HEX >= 0x03080000 |
| 1621 |
#include "frameobject.h" |
| 1622 |
#if PY_VERSION_HEX >= 0x030b00a6 && !defined(PYPY_VERSION) |
| 1623 |
#ifndef Py_BUILD_CORE |
| 1624 |
#define Py_BUILD_CORE 1 |
| 1625 |
#endif |
| 1626 |
#include "internal/pycore_frame.h" |
| 1627 |
#endif |
| 1628 |
#define __Pxy_PyFrame_Initialize_Offsets() |
| 1629 |
#define __Pyx_PyFrame_GetLocalsplus(frame) ((frame)->f_localsplus) |
| 1630 |
#else |
| 1631 |
static size_t __pyx_pyframe_localsplus_offset = 0; |
| 1632 |
#include "frameobject.h" |
| 1633 |
#define __Pxy_PyFrame_Initialize_Offsets()\ |
| 1634 |
((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\ |
| 1635 |
(void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus))) |
| 1636 |
#define __Pyx_PyFrame_GetLocalsplus(frame)\ |
| 1637 |
(assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset)) |
| 1638 |
#endif |
| 1639 |
#endif |
| 1640 |
#endif |
| 1641 |
|
| 1642 |
|
| 1643 |
#if CYTHON_COMPILING_IN_CPYTHON |
| 1644 |
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); |
| 1645 |
#else |
| 1646 |
#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) |
| 1647 |
#endif |
| 1648 |
|
| 1649 |
|
| 1650 |
#if CYTHON_COMPILING_IN_CPYTHON |
| 1651 |
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); |
| 1652 |
#endif |
| 1653 |
|
| 1654 |
|
| 1655 |
#define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL) |
| 1656 |
static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs); |
| 1657 |
|
| 1658 |
|
| 1659 |
#define __Pyx_PyIter_Next(obj) __Pyx_PyIter_Next2(obj, NULL) |
| 1660 |
static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject *, PyObject *); |
| 1661 |
|
| 1662 |
|
| 1663 |
#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE |
| 1664 |
static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); |
| 1665 |
#endif |
| 1666 |
|
| 1667 |
|
| 1668 |
#if CYTHON_FAST_THREAD_STATE |
| 1669 |
#define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) |
| 1670 |
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); |
| 1671 |
#define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb) |
| 1672 |
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); |
| 1673 |
#else |
| 1674 |
#define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb) |
| 1675 |
#define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) |
| 1676 |
#endif |
| 1677 |
|
| 1678 |
|
| 1679 |
#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ |
| 1680 |
(__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ |
| 1681 |
__Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\ |
| 1682 |
(is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\ |
| 1683 |
__Pyx_GetItemInt_Generic(o, to_py_func(i)))) |
| 1684 |
#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ |
| 1685 |
(__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ |
| 1686 |
__Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ |
| 1687 |
(PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) |
| 1688 |
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, |
| 1689 |
int wraparound, int boundscheck); |
| 1690 |
#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ |
| 1691 |
(__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ |
| 1692 |
__Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ |
| 1693 |
(PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) |
| 1694 |
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, |
| 1695 |
int wraparound, int boundscheck); |
| 1696 |
static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); |
| 1697 |
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, |
| 1698 |
int is_list, int wraparound, int boundscheck); |
| 1699 |
|
| 1700 |
|
| 1701 |
#if CYTHON_FAST_THREAD_STATE |
| 1702 |
#define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb) |
| 1703 |
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); |
| 1704 |
#else |
| 1705 |
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb); |
| 1706 |
#endif |
| 1707 |
|
| 1708 |
|
| 1709 |
#include <structmember.h> |
| 1710 |
|
| 1711 |
|
| 1712 |
#if CYTHON_USE_TYPE_SPECS |
| 1713 |
static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type); |
| 1714 |
#endif |
| 1715 |
|
| 1716 |
|
| 1717 |
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); |
| 1718 |
|
| 1719 |
|
| 1720 |
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); |
| 1721 |
|
| 1722 |
|
| 1723 |
static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method); |
| 1724 |
|
| 1725 |
|
| 1726 |
static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name); |
| 1727 |
|
| 1728 |
|
| 1729 |
#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS |
| 1730 |
static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases); |
| 1731 |
#endif |
| 1732 |
|
| 1733 |
|
| 1734 |
CYTHON_UNUSED static int __Pyx_PyType_Ready(PyTypeObject *t); |
| 1735 |
|
| 1736 |
|
| 1737 |
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 |
| 1738 |
static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name); |
| 1739 |
#else |
| 1740 |
#define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr |
| 1741 |
#endif |
| 1742 |
|
| 1743 |
|
| 1744 |
static PyObject *__Pyx_FetchSharedCythonABIModule(void); |
| 1745 |
|
| 1746 |
|
| 1747 |
#if !CYTHON_USE_TYPE_SPECS |
| 1748 |
static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); |
| 1749 |
#else |
| 1750 |
static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases); |
| 1751 |
#endif |
| 1752 |
|
| 1753 |
|
| 1754 |
#if PY_MAJOR_VERSION >= 3 |
| 1755 |
static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { |
| 1756 |
CYTHON_UNUSED_VAR(typ); |
| 1757 |
if (!self) |
| 1758 |
return __Pyx_NewRef(func); |
| 1759 |
return PyMethod_New(func, self); |
| 1760 |
} |
| 1761 |
#else |
| 1762 |
#define __Pyx_PyMethod_New PyMethod_New |
| 1763 |
#endif |
| 1764 |
|
| 1765 |
|
| 1766 |
#if CYTHON_METH_FASTCALL |
| 1767 |
static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw); |
| 1768 |
#endif |
| 1769 |
|
| 1770 |
|
| 1771 |
#define __Pyx_CyFunction_USED |
| 1772 |
#define __Pyx_CYFUNCTION_STATICMETHOD 0x01 |
| 1773 |
#define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 |
| 1774 |
#define __Pyx_CYFUNCTION_CCLASS 0x04 |
| 1775 |
#define __Pyx_CYFUNCTION_COROUTINE 0x08 |
| 1776 |
#define __Pyx_CyFunction_GetClosure(f)\ |
| 1777 |
(((__pyx_CyFunctionObject *) (f))->func_closure) |
| 1778 |
#if PY_VERSION_HEX < 0x030900B1 |
| 1779 |
#define __Pyx_CyFunction_GetClassObj(f)\ |
| 1780 |
(((__pyx_CyFunctionObject *) (f))->func_classobj) |
| 1781 |
#else |
| 1782 |
#define __Pyx_CyFunction_GetClassObj(f)\ |
| 1783 |
((PyObject*) ((PyCMethodObject *) (f))->mm_class) |
| 1784 |
#endif |
| 1785 |
#define __Pyx_CyFunction_SetClassObj(f, classobj)\ |
| 1786 |
__Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj)) |
| 1787 |
#define __Pyx_CyFunction_Defaults(type, f)\ |
| 1788 |
((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) |
| 1789 |
#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\ |
| 1790 |
((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) |
| 1791 |
typedef struct { |
| 1792 |
#if PY_VERSION_HEX < 0x030900B1 |
| 1793 |
PyCFunctionObject func; |
| 1794 |
#else |
| 1795 |
PyCMethodObject func; |
| 1796 |
#endif |
| 1797 |
#if CYTHON_BACKPORT_VECTORCALL |
| 1798 |
__pyx_vectorcallfunc func_vectorcall; |
| 1799 |
#endif |
| 1800 |
#if PY_VERSION_HEX < 0x030500A0 |
| 1801 |
PyObject *func_weakreflist; |
| 1802 |
#endif |
| 1803 |
PyObject *func_dict; |
| 1804 |
PyObject *func_name; |
| 1805 |
PyObject *func_qualname; |
| 1806 |
PyObject *func_doc; |
| 1807 |
PyObject *func_globals; |
| 1808 |
PyObject *func_code; |
| 1809 |
PyObject *func_closure; |
| 1810 |
#if PY_VERSION_HEX < 0x030900B1 |
| 1811 |
PyObject *func_classobj; |
| 1812 |
#endif |
| 1813 |
void *defaults; |
| 1814 |
int defaults_pyobjects; |
| 1815 |
size_t defaults_size; |
| 1816 |
int flags; |
| 1817 |
PyObject *defaults_tuple; |
| 1818 |
PyObject *defaults_kwdict; |
| 1819 |
PyObject *(*defaults_getter)(PyObject *); |
| 1820 |
PyObject *func_annotations; |
| 1821 |
PyObject *func_is_coroutine; |
| 1822 |
} __pyx_CyFunctionObject; |
| 1823 |
#define __Pyx_CyFunction_Check(obj) __Pyx_TypeCheck(obj, __pyx_CyFunctionType) |
| 1824 |
#define __Pyx_IsCyOrPyCFunction(obj) __Pyx_TypeCheck2(obj, __pyx_CyFunctionType, &PyCFunction_Type) |
| 1825 |
#define __Pyx_CyFunction_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_CyFunctionType) |
| 1826 |
static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml, |
| 1827 |
int flags, PyObject* qualname, |
| 1828 |
PyObject *closure, |
| 1829 |
PyObject *module, PyObject *globals, |
| 1830 |
PyObject* code); |
| 1831 |
static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj); |
| 1832 |
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m, |
| 1833 |
size_t size, |
| 1834 |
int pyobjects); |
| 1835 |
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, |
| 1836 |
PyObject *tuple); |
| 1837 |
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, |
| 1838 |
PyObject *dict); |
| 1839 |
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, |
| 1840 |
PyObject *dict); |
| 1841 |
static int __pyx_CyFunction_init(PyObject *module); |
| 1842 |
#if CYTHON_METH_FASTCALL |
| 1843 |
static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); |
| 1844 |
static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); |
| 1845 |
static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); |
| 1846 |
static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames); |
| 1847 |
#if CYTHON_BACKPORT_VECTORCALL |
| 1848 |
#define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall) |
| 1849 |
#else |
| 1850 |
#define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall) |
| 1851 |
#endif |
| 1852 |
#endif |
| 1853 |
|
| 1854 |
|
| 1855 |
static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, |
| 1856 |
int flags, PyObject* qualname, |
| 1857 |
PyObject *closure, |
| 1858 |
PyObject *module, PyObject *globals, |
| 1859 |
PyObject* code); |
| 1860 |
|
| 1861 |
|
| 1862 |
#ifdef CYTHON_CLINE_IN_TRACEBACK |
| 1863 |
#define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) |
| 1864 |
#else |
| 1865 |
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); |
| 1866 |
#endif |
| 1867 |
|
| 1868 |
|
| 1869 |
#if !CYTHON_COMPILING_IN_LIMITED_API |
| 1870 |
typedef struct { |
| 1871 |
PyCodeObject* code_object; |
| 1872 |
int code_line; |
| 1873 |
} __Pyx_CodeObjectCacheEntry; |
| 1874 |
struct __Pyx_CodeObjectCache { |
| 1875 |
int count; |
| 1876 |
int max_count; |
| 1877 |
__Pyx_CodeObjectCacheEntry* entries; |
| 1878 |
}; |
| 1879 |
static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; |
| 1880 |
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); |
| 1881 |
static PyCodeObject *__pyx_find_code_object(int code_line); |
| 1882 |
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); |
| 1883 |
#endif |
| 1884 |
|
| 1885 |
|
| 1886 |
static void __Pyx_AddTraceback(const char *funcname, int c_line, |
| 1887 |
int py_line, const char *filename); |
| 1888 |
|
| 1889 |
|
| 1890 |
#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) |
| 1891 |
#define __Pyx_HAS_GCC_DIAGNOSTIC |
| 1892 |
#endif |
| 1893 |
|
| 1894 |
|
| 1895 |
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); |
| 1896 |
|
| 1897 |
|
| 1898 |
#if CYTHON_COMPILING_IN_LIMITED_API |
| 1899 |
typedef PyObject *__Pyx_TypeName; |
| 1900 |
#define __Pyx_FMT_TYPENAME "%U" |
| 1901 |
static __Pyx_TypeName __Pyx_PyType_GetName(PyTypeObject* tp); |
| 1902 |
#define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj) |
| 1903 |
#else |
| 1904 |
typedef const char *__Pyx_TypeName; |
| 1905 |
#define __Pyx_FMT_TYPENAME "%.200s" |
| 1906 |
#define __Pyx_PyType_GetName(tp) ((tp)->tp_name) |
| 1907 |
#define __Pyx_DECREF_TypeName(obj) |
| 1908 |
#endif |
| 1909 |
|
| 1910 |
|
| 1911 |
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); |
| 1912 |
|
| 1913 |
|
| 1914 |
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); |
| 1915 |
|
| 1916 |
|
| 1917 |
#if CYTHON_COMPILING_IN_CPYTHON |
| 1918 |
#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) |
| 1919 |
#define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2) |
| 1920 |
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); |
| 1921 |
static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b); |
| 1922 |
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); |
| 1923 |
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); |
| 1924 |
#else |
| 1925 |
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) |
| 1926 |
#define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2)) |
| 1927 |
#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) |
| 1928 |
#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2)) |
| 1929 |
#endif |
| 1930 |
#define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_Occurred(), err1, err2) |
| 1931 |
#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) |
| 1932 |
|
| 1933 |
|
| 1934 |
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); |
| 1935 |
|
| 1936 |
|
| 1937 |
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); |
| 1938 |
|
| 1939 |
|
| 1940 |
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg); |
| 1941 |
|
| 1942 |
|
| 1943 |
struct __pyx_CoroutineObject; |
| 1944 |
typedef PyObject *(*__pyx_coroutine_body_t)(struct __pyx_CoroutineObject *, PyThreadState *, PyObject *); |
| 1945 |
#if CYTHON_USE_EXC_INFO_STACK |
| 1946 |
#define __Pyx_ExcInfoStruct _PyErr_StackItem |
| 1947 |
#else |
| 1948 |
typedef struct { |
| 1949 |
PyObject *exc_type; |
| 1950 |
PyObject *exc_value; |
| 1951 |
PyObject *exc_traceback; |
| 1952 |
} __Pyx_ExcInfoStruct; |
| 1953 |
#endif |
| 1954 |
typedef struct __pyx_CoroutineObject { |
| 1955 |
PyObject_HEAD |
| 1956 |
__pyx_coroutine_body_t body; |
| 1957 |
PyObject *closure; |
| 1958 |
__Pyx_ExcInfoStruct gi_exc_state; |
| 1959 |
PyObject *gi_weakreflist; |
| 1960 |
PyObject *classobj; |
| 1961 |
PyObject *yieldfrom; |
| 1962 |
PyObject *gi_name; |
| 1963 |
PyObject *gi_qualname; |
| 1964 |
PyObject *gi_modulename; |
| 1965 |
PyObject *gi_code; |
| 1966 |
PyObject *gi_frame; |
| 1967 |
int resume_label; |
| 1968 |
char is_running; |
| 1969 |
} __pyx_CoroutineObject; |
| 1970 |
static __pyx_CoroutineObject *__Pyx__Coroutine_New( |
| 1971 |
PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, |
| 1972 |
PyObject *name, PyObject *qualname, PyObject *module_name); |
| 1973 |
static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit( |
| 1974 |
__pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, |
| 1975 |
PyObject *name, PyObject *qualname, PyObject *module_name); |
| 1976 |
static CYTHON_INLINE void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *self); |
| 1977 |
static int __Pyx_Coroutine_clear(PyObject *self); |
| 1978 |
static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value); |
| 1979 |
static PyObject *__Pyx_Coroutine_Close(PyObject *self); |
| 1980 |
static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args); |
| 1981 |
#if CYTHON_USE_EXC_INFO_STACK |
| 1982 |
#define __Pyx_Coroutine_SwapException(self) |
| 1983 |
#define __Pyx_Coroutine_ResetAndClearException(self) __Pyx_Coroutine_ExceptionClear(&(self)->gi_exc_state) |
| 1984 |
#else |
| 1985 |
#define __Pyx_Coroutine_SwapException(self) {\ |
| 1986 |
__Pyx_ExceptionSwap(&(self)->gi_exc_state.exc_type, &(self)->gi_exc_state.exc_value, &(self)->gi_exc_state.exc_traceback);\ |
| 1987 |
__Pyx_Coroutine_ResetFrameBackpointer(&(self)->gi_exc_state);\ |
| 1988 |
} |
| 1989 |
#define __Pyx_Coroutine_ResetAndClearException(self) {\ |
| 1990 |
__Pyx_ExceptionReset((self)->gi_exc_state.exc_type, (self)->gi_exc_state.exc_value, (self)->gi_exc_state.exc_traceback);\ |
| 1991 |
(self)->gi_exc_state.exc_type = (self)->gi_exc_state.exc_value = (self)->gi_exc_state.exc_traceback = NULL;\ |
| 1992 |
} |
| 1993 |
#endif |
| 1994 |
#if CYTHON_FAST_THREAD_STATE |
| 1995 |
#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\ |
| 1996 |
__Pyx_PyGen__FetchStopIterationValue(__pyx_tstate, pvalue) |
| 1997 |
#else |
| 1998 |
#define __Pyx_PyGen_FetchStopIterationValue(pvalue)\ |
| 1999 |
__Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, pvalue) |
| 2000 |
#endif |
| 2001 |
static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *tstate, PyObject **pvalue); |
| 2002 |
static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state); |
| 2003 |
|
| 2004 |
|
| 2005 |
static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code); |
| 2006 |
|
| 2007 |
|
| 2008 |
static int __Pyx_patch_abc(void); |
| 2009 |
|
| 2010 |
|
| 2011 |
#define __Pyx_Coroutine_USED |
| 2012 |
#define __Pyx_Coroutine_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_CoroutineType) |
| 2013 |
#define __Pyx_Coroutine_Check(obj) __Pyx_Coroutine_CheckExact(obj) |
| 2014 |
#define __Pyx_CoroutineAwait_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_CoroutineAwaitType) |
| 2015 |
#define __Pyx_Coroutine_New(body, code, closure, name, qualname, module_name)\ |
| 2016 |
__Pyx__Coroutine_New(__pyx_CoroutineType, body, code, closure, name, qualname, module_name) |
| 2017 |
static int __pyx_Coroutine_init(PyObject *module); |
| 2018 |
static PyObject *__Pyx__Coroutine_await(PyObject *coroutine); |
| 2019 |
typedef struct { |
| 2020 |
PyObject_HEAD |
| 2021 |
PyObject *coroutine; |
| 2022 |
} __pyx_CoroutineAwaitObject; |
| 2023 |
static PyObject *__Pyx_CoroutineAwait_Close(__pyx_CoroutineAwaitObject *self, PyObject *arg); |
| 2024 |
static PyObject *__Pyx_CoroutineAwait_Throw(__pyx_CoroutineAwaitObject *self, PyObject *args); |
| 2025 |
|
| 2026 |
|
| 2027 |
#define __Pyx_ReturnWithStopIteration(value)\ |
| 2028 |
if (value == Py_None) PyErr_SetNone(PyExc_StopIteration); else __Pyx__ReturnWithStopIteration(value) |
| 2029 |
static void __Pyx__ReturnWithStopIteration(PyObject* value); |
| 2030 |
|
| 2031 |
|
| 2032 |
#define __Pyx_AsyncGen_USED |
| 2033 |
typedef struct { |
| 2034 |
__pyx_CoroutineObject coro; |
| 2035 |
PyObject *ag_finalizer; |
| 2036 |
int ag_hooks_inited; |
| 2037 |
int ag_closed; |
| 2038 |
int ag_running_async; |
| 2039 |
} __pyx_PyAsyncGenObject; |
| 2040 |
static PyTypeObject *__pyx__PyAsyncGenWrappedValueType = 0; |
| 2041 |
static PyTypeObject *__pyx__PyAsyncGenASendType = 0; |
| 2042 |
static PyTypeObject *__pyx__PyAsyncGenAThrowType = 0; |
| 2043 |
static PyTypeObject *__pyx_AsyncGenType = 0; |
| 2044 |
#define __Pyx_AsyncGen_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_AsyncGenType) |
| 2045 |
#define __pyx_PyAsyncGenASend_CheckExact(o)\ |
| 2046 |
__Pyx_IS_TYPE(o, __pyx__PyAsyncGenASendType) |
| 2047 |
#define __pyx_PyAsyncGenAThrow_CheckExact(o)\ |
| 2048 |
__Pyx_IS_TYPE(o, __pyx__PyAsyncGenAThrowType) |
| 2049 |
static PyObject *__Pyx_async_gen_anext(PyObject *o); |
| 2050 |
static CYTHON_INLINE PyObject *__Pyx_async_gen_asend_iternext(PyObject *o); |
| 2051 |
static PyObject *__Pyx_async_gen_asend_send(PyObject *o, PyObject *arg); |
| 2052 |
static PyObject *__Pyx_async_gen_asend_close(PyObject *o, PyObject *args); |
| 2053 |
static PyObject *__Pyx_async_gen_athrow_close(PyObject *o, PyObject *args); |
| 2054 |
static PyObject *__Pyx__PyAsyncGenValueWrapperNew(PyObject *val); |
| 2055 |
static __pyx_CoroutineObject *__Pyx_AsyncGen_New( |
| 2056 |
__pyx_coroutine_body_t body, PyObject *code, PyObject *closure, |
| 2057 |
PyObject *name, PyObject *qualname, PyObject *module_name) { |
| 2058 |
__pyx_PyAsyncGenObject *gen = PyObject_GC_New(__pyx_PyAsyncGenObject, __pyx_AsyncGenType); |
| 2059 |
if (unlikely(!gen)) |
| 2060 |
return NULL; |
| 2061 |
gen->ag_finalizer = NULL; |
| 2062 |
gen->ag_closed = 0; |
| 2063 |
gen->ag_hooks_inited = 0; |
| 2064 |
gen->ag_running_async = 0; |
| 2065 |
return __Pyx__Coroutine_NewInit((__pyx_CoroutineObject*)gen, body, code, closure, name, qualname, module_name); |
| 2066 |
} |
| 2067 |
static int __pyx_AsyncGen_init(PyObject *module); |
| 2068 |
static void __Pyx_PyAsyncGen_Fini(void); |
| 2069 |
|
| 2070 |
|
| 2071 |
static int __Pyx_check_binary_version(void); |
| 2072 |
|
| 2073 |
|
| 2074 |
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); |
| 2075 |
|
| 2076 |
|
| 2077 |
|
| 2078 |
|
| 2079 |
|
| 2080 |
|
| 2081 |
#define __Pyx_MODULE_NAME "test_async_gen_exception_04" |
| 2082 |
extern int __pyx_module_is_main_test_async_gen_exception_04; |
| 2083 |
int __pyx_module_is_main_test_async_gen_exception_04 = 0; |
| 2084 |
|
| 2085 |
|
| 2086 |
|
| 2087 |
static PyObject *__pyx_builtin_StopIteration; |
| 2088 |
|
| 2089 |
static const char __pyx_k_g[] = "g"; |
| 2090 |
static const char __pyx_k__4[] = "?"; |
| 2091 |
static const char __pyx_k_ai[] = "ai"; |
| 2092 |
static const char __pyx_k_an[] = "an"; |
| 2093 |
static const char __pyx_k_ex[] = "ex"; |
| 2094 |
static const char __pyx_k_gc[] = "gc"; |
| 2095 |
static const char __pyx_k_gen[] = "gen"; |
| 2096 |
static const char __pyx_k_ZERO[] = "ZERO"; |
| 2097 |
static const char __pyx_k_args[] = "args"; |
| 2098 |
static const char __pyx_k_main[] = "__main__"; |
| 2099 |
static const char __pyx_k_name[] = "__name__"; |
| 2100 |
static const char __pyx_k_send[] = "send"; |
| 2101 |
static const char __pyx_k_test[] = "__test__"; |
| 2102 |
static const char __pyx_k_aiter[] = "__aiter__"; |
| 2103 |
static const char __pyx_k_anext[] = "__anext__"; |
| 2104 |
static const char __pyx_k_close[] = "close"; |
| 2105 |
static const char __pyx_k_throw[] = "throw"; |
| 2106 |
static const char __pyx_k_enable[] = "enable"; |
| 2107 |
static const char __pyx_k_disable[] = "disable"; |
| 2108 |
static const char __pyx_k_isenabled[] = "isenabled"; |
| 2109 |
static const char __pyx_k_is_coroutine[] = "_is_coroutine"; |
| 2110 |
static const char __pyx_k_StopIteration[] = "StopIteration"; |
| 2111 |
static const char __pyx_k_test_last_yield[] = "test_last_yield"; |
| 2112 |
static const char __pyx_k_asyncio_coroutines[] = "asyncio.coroutines"; |
| 2113 |
static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; |
| 2114 |
static const char __pyx_k_test_async_gen_exception_04[] = "test_async_gen_exception_04"; |
| 2115 |
static const char __pyx_k_tmp_test_async_gen_exception_04[] = "/tmp/test_async_gen_exception_04.py"; |
| 2116 |
|
| 2117 |
static PyObject *__pyx_pf_27test_async_gen_exception_04_gen(CYTHON_UNUSED PyObject *__pyx_self); |
| 2118 |
static PyObject *__pyx_pf_27test_async_gen_exception_04_3test_last_yield(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_g); |
| 2119 |
static PyObject *__pyx_tp_new_27test_async_gen_exception_04___pyx_scope_struct__gen(PyTypeObject *t, PyObject *a, PyObject *k); |
| 2120 |
|
| 2121 |
|
| 2122 |
typedef struct { |
| 2123 |
PyObject *__pyx_d; |
| 2124 |
PyObject *__pyx_b; |
| 2125 |
PyObject *__pyx_cython_runtime; |
| 2126 |
PyObject *__pyx_empty_tuple; |
| 2127 |
PyObject *__pyx_empty_bytes; |
| 2128 |
PyObject *__pyx_empty_unicode; |
| 2129 |
#ifdef __Pyx_CyFunction_USED |
| 2130 |
PyTypeObject *__pyx_CyFunctionType; |
| 2131 |
#endif |
| 2132 |
#ifdef __Pyx_FusedFunction_USED |
| 2133 |
PyTypeObject *__pyx_FusedFunctionType; |
| 2134 |
#endif |
| 2135 |
#ifdef __Pyx_Generator_USED |
| 2136 |
PyTypeObject *__pyx_GeneratorType; |
| 2137 |
#endif |
| 2138 |
#ifdef __Pyx_IterableCoroutine_USED |
| 2139 |
PyTypeObject *__pyx_IterableCoroutineType; |
| 2140 |
#endif |
| 2141 |
#ifdef __Pyx_Coroutine_USED |
| 2142 |
PyTypeObject *__pyx_CoroutineAwaitType; |
| 2143 |
#endif |
| 2144 |
#ifdef __Pyx_Coroutine_USED |
| 2145 |
PyTypeObject *__pyx_CoroutineType; |
| 2146 |
#endif |
| 2147 |
#if CYTHON_USE_MODULE_STATE |
| 2148 |
PyObject *__pyx_type_27test_async_gen_exception_04___pyx_scope_struct__gen; |
| 2149 |
#endif |
| 2150 |
PyTypeObject *__pyx_ptype_27test_async_gen_exception_04___pyx_scope_struct__gen; |
| 2151 |
PyObject *__pyx_n_s_StopIteration; |
| 2152 |
PyObject *__pyx_n_s_ZERO; |
| 2153 |
PyObject *__pyx_n_s__4; |
| 2154 |
PyObject *__pyx_n_s_ai; |
| 2155 |
PyObject *__pyx_n_s_aiter; |
| 2156 |
PyObject *__pyx_n_s_an; |
| 2157 |
PyObject *__pyx_n_s_anext; |
| 2158 |
PyObject *__pyx_n_s_args; |
| 2159 |
PyObject *__pyx_n_s_asyncio_coroutines; |
| 2160 |
PyObject *__pyx_n_s_cline_in_traceback; |
| 2161 |
PyObject *__pyx_n_s_close; |
| 2162 |
PyObject *__pyx_kp_u_disable; |
| 2163 |
PyObject *__pyx_kp_u_enable; |
| 2164 |
PyObject *__pyx_n_s_ex; |
| 2165 |
PyObject *__pyx_n_s_g; |
| 2166 |
PyObject *__pyx_kp_u_gc; |
| 2167 |
PyObject *__pyx_n_s_gen; |
| 2168 |
PyObject *__pyx_n_s_is_coroutine; |
| 2169 |
PyObject *__pyx_kp_u_isenabled; |
| 2170 |
PyObject *__pyx_n_s_main; |
| 2171 |
PyObject *__pyx_n_s_name; |
| 2172 |
PyObject *__pyx_n_s_send; |
| 2173 |
PyObject *__pyx_n_s_test; |
| 2174 |
PyObject *__pyx_n_s_test_async_gen_exception_04; |
| 2175 |
PyObject *__pyx_n_s_test_last_yield; |
| 2176 |
PyObject *__pyx_n_s_throw; |
| 2177 |
PyObject *__pyx_kp_s_tmp_test_async_gen_exception_04; |
| 2178 |
PyObject *__pyx_int_0; |
| 2179 |
PyObject *__pyx_int_1; |
| 2180 |
PyObject *__pyx_int_123; |
| 2181 |
PyObject *__pyx_codeobj_; |
| 2182 |
PyObject *__pyx_tuple__2; |
| 2183 |
PyObject *__pyx_codeobj__3; |
| 2184 |
} __pyx_mstate; |
| 2185 |
|
| 2186 |
#if CYTHON_USE_MODULE_STATE |
| 2187 |
#ifdef __cplusplus |
| 2188 |
namespace { |
| 2189 |
extern struct PyModuleDef __pyx_moduledef; |
| 2190 |
} |
| 2191 |
#else |
| 2192 |
static struct PyModuleDef __pyx_moduledef; |
| 2193 |
#endif |
| 2194 |
|
| 2195 |
#define __pyx_mstate(o) ((__pyx_mstate *)__Pyx_PyModule_GetState(o)) |
| 2196 |
|
| 2197 |
#define __pyx_mstate_global (__pyx_mstate(PyState_FindModule(&__pyx_moduledef))) |
| 2198 |
|
| 2199 |
#define __pyx_m (PyState_FindModule(&__pyx_moduledef)) |
| 2200 |
#else |
| 2201 |
static __pyx_mstate __pyx_mstate_global_static = |
| 2202 |
#ifdef __cplusplus |
| 2203 |
{}; |
| 2204 |
#else |
| 2205 |
{0}; |
| 2206 |
#endif |
| 2207 |
static __pyx_mstate *__pyx_mstate_global = &__pyx_mstate_global_static; |
| 2208 |
#endif |
| 2209 |
|
| 2210 |
#if CYTHON_USE_MODULE_STATE |
| 2211 |
static int __pyx_m_clear(PyObject *m) { |
| 2212 |
__pyx_mstate *clear_module_state = __pyx_mstate(m); |
| 2213 |
if (!clear_module_state) return 0; |
| 2214 |
Py_CLEAR(clear_module_state->__pyx_d); |
| 2215 |
Py_CLEAR(clear_module_state->__pyx_b); |
| 2216 |
Py_CLEAR(clear_module_state->__pyx_cython_runtime); |
| 2217 |
Py_CLEAR(clear_module_state->__pyx_empty_tuple); |
| 2218 |
Py_CLEAR(clear_module_state->__pyx_empty_bytes); |
| 2219 |
Py_CLEAR(clear_module_state->__pyx_empty_unicode); |
| 2220 |
#ifdef __Pyx_CyFunction_USED |
| 2221 |
Py_CLEAR(clear_module_state->__pyx_CyFunctionType); |
| 2222 |
#endif |
| 2223 |
#ifdef __Pyx_FusedFunction_USED |
| 2224 |
Py_CLEAR(clear_module_state->__pyx_FusedFunctionType); |
| 2225 |
#endif |
| 2226 |
Py_CLEAR(clear_module_state->__pyx_ptype_27test_async_gen_exception_04___pyx_scope_struct__gen); |
| 2227 |
Py_CLEAR(clear_module_state->__pyx_type_27test_async_gen_exception_04___pyx_scope_struct__gen); |
| 2228 |
Py_CLEAR(clear_module_state->__pyx_n_s_StopIteration); |
| 2229 |
Py_CLEAR(clear_module_state->__pyx_n_s_ZERO); |
| 2230 |
Py_CLEAR(clear_module_state->__pyx_n_s__4); |
| 2231 |
Py_CLEAR(clear_module_state->__pyx_n_s_ai); |
| 2232 |
Py_CLEAR(clear_module_state->__pyx_n_s_aiter); |
| 2233 |
Py_CLEAR(clear_module_state->__pyx_n_s_an); |
| 2234 |
Py_CLEAR(clear_module_state->__pyx_n_s_anext); |
| 2235 |
Py_CLEAR(clear_module_state->__pyx_n_s_args); |
| 2236 |
Py_CLEAR(clear_module_state->__pyx_n_s_asyncio_coroutines); |
| 2237 |
Py_CLEAR(clear_module_state->__pyx_n_s_cline_in_traceback); |
| 2238 |
Py_CLEAR(clear_module_state->__pyx_n_s_close); |
| 2239 |
Py_CLEAR(clear_module_state->__pyx_kp_u_disable); |
| 2240 |
Py_CLEAR(clear_module_state->__pyx_kp_u_enable); |
| 2241 |
Py_CLEAR(clear_module_state->__pyx_n_s_ex); |
| 2242 |
Py_CLEAR(clear_module_state->__pyx_n_s_g); |
| 2243 |
Py_CLEAR(clear_module_state->__pyx_kp_u_gc); |
| 2244 |
Py_CLEAR(clear_module_state->__pyx_n_s_gen); |
| 2245 |
Py_CLEAR(clear_module_state->__pyx_n_s_is_coroutine); |
| 2246 |
Py_CLEAR(clear_module_state->__pyx_kp_u_isenabled); |
| 2247 |
Py_CLEAR(clear_module_state->__pyx_n_s_main); |
| 2248 |
Py_CLEAR(clear_module_state->__pyx_n_s_name); |
| 2249 |
Py_CLEAR(clear_module_state->__pyx_n_s_send); |
| 2250 |
Py_CLEAR(clear_module_state->__pyx_n_s_test); |
| 2251 |
Py_CLEAR(clear_module_state->__pyx_n_s_test_async_gen_exception_04); |
| 2252 |
Py_CLEAR(clear_module_state->__pyx_n_s_test_last_yield); |
| 2253 |
Py_CLEAR(clear_module_state->__pyx_n_s_throw); |
| 2254 |
Py_CLEAR(clear_module_state->__pyx_kp_s_tmp_test_async_gen_exception_04); |
| 2255 |
Py_CLEAR(clear_module_state->__pyx_int_0); |
| 2256 |
Py_CLEAR(clear_module_state->__pyx_int_1); |
| 2257 |
Py_CLEAR(clear_module_state->__pyx_int_123); |
| 2258 |
Py_CLEAR(clear_module_state->__pyx_codeobj_); |
| 2259 |
Py_CLEAR(clear_module_state->__pyx_tuple__2); |
| 2260 |
Py_CLEAR(clear_module_state->__pyx_codeobj__3); |
| 2261 |
return 0; |
| 2262 |
} |
| 2263 |
#endif |
| 2264 |
|
| 2265 |
#if CYTHON_USE_MODULE_STATE |
| 2266 |
static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { |
| 2267 |
__pyx_mstate *traverse_module_state = __pyx_mstate(m); |
| 2268 |
if (!traverse_module_state) return 0; |
| 2269 |
Py_VISIT(traverse_module_state->__pyx_d); |
| 2270 |
Py_VISIT(traverse_module_state->__pyx_b); |
| 2271 |
Py_VISIT(traverse_module_state->__pyx_cython_runtime); |
| 2272 |
Py_VISIT(traverse_module_state->__pyx_empty_tuple); |
| 2273 |
Py_VISIT(traverse_module_state->__pyx_empty_bytes); |
| 2274 |
Py_VISIT(traverse_module_state->__pyx_empty_unicode); |
| 2275 |
#ifdef __Pyx_CyFunction_USED |
| 2276 |
Py_VISIT(traverse_module_state->__pyx_CyFunctionType); |
| 2277 |
#endif |
| 2278 |
#ifdef __Pyx_FusedFunction_USED |
| 2279 |
Py_VISIT(traverse_module_state->__pyx_FusedFunctionType); |
| 2280 |
#endif |
| 2281 |
Py_VISIT(traverse_module_state->__pyx_ptype_27test_async_gen_exception_04___pyx_scope_struct__gen); |
| 2282 |
Py_VISIT(traverse_module_state->__pyx_type_27test_async_gen_exception_04___pyx_scope_struct__gen); |
| 2283 |
Py_VISIT(traverse_module_state->__pyx_n_s_StopIteration); |
| 2284 |
Py_VISIT(traverse_module_state->__pyx_n_s_ZERO); |
| 2285 |
Py_VISIT(traverse_module_state->__pyx_n_s__4); |
| 2286 |
Py_VISIT(traverse_module_state->__pyx_n_s_ai); |
| 2287 |
Py_VISIT(traverse_module_state->__pyx_n_s_aiter); |
| 2288 |
Py_VISIT(traverse_module_state->__pyx_n_s_an); |
| 2289 |
Py_VISIT(traverse_module_state->__pyx_n_s_anext); |
| 2290 |
Py_VISIT(traverse_module_state->__pyx_n_s_args); |
| 2291 |
Py_VISIT(traverse_module_state->__pyx_n_s_asyncio_coroutines); |
| 2292 |
Py_VISIT(traverse_module_state->__pyx_n_s_cline_in_traceback); |
| 2293 |
Py_VISIT(traverse_module_state->__pyx_n_s_close); |
| 2294 |
Py_VISIT(traverse_module_state->__pyx_kp_u_disable); |
| 2295 |
Py_VISIT(traverse_module_state->__pyx_kp_u_enable); |
| 2296 |
Py_VISIT(traverse_module_state->__pyx_n_s_ex); |
| 2297 |
Py_VISIT(traverse_module_state->__pyx_n_s_g); |
| 2298 |
Py_VISIT(traverse_module_state->__pyx_kp_u_gc); |
| 2299 |
Py_VISIT(traverse_module_state->__pyx_n_s_gen); |
| 2300 |
Py_VISIT(traverse_module_state->__pyx_n_s_is_coroutine); |
| 2301 |
Py_VISIT(traverse_module_state->__pyx_kp_u_isenabled); |
| 2302 |
Py_VISIT(traverse_module_state->__pyx_n_s_main); |
| 2303 |
Py_VISIT(traverse_module_state->__pyx_n_s_name); |
| 2304 |
Py_VISIT(traverse_module_state->__pyx_n_s_send); |
| 2305 |
Py_VISIT(traverse_module_state->__pyx_n_s_test); |
| 2306 |
Py_VISIT(traverse_module_state->__pyx_n_s_test_async_gen_exception_04); |
| 2307 |
Py_VISIT(traverse_module_state->__pyx_n_s_test_last_yield); |
| 2308 |
Py_VISIT(traverse_module_state->__pyx_n_s_throw); |
| 2309 |
Py_VISIT(traverse_module_state->__pyx_kp_s_tmp_test_async_gen_exception_04); |
| 2310 |
Py_VISIT(traverse_module_state->__pyx_int_0); |
| 2311 |
Py_VISIT(traverse_module_state->__pyx_int_1); |
| 2312 |
Py_VISIT(traverse_module_state->__pyx_int_123); |
| 2313 |
Py_VISIT(traverse_module_state->__pyx_codeobj_); |
| 2314 |
Py_VISIT(traverse_module_state->__pyx_tuple__2); |
| 2315 |
Py_VISIT(traverse_module_state->__pyx_codeobj__3); |
| 2316 |
return 0; |
| 2317 |
} |
| 2318 |
#endif |
| 2319 |
|
| 2320 |
#define __pyx_d __pyx_mstate_global->__pyx_d |
| 2321 |
#define __pyx_b __pyx_mstate_global->__pyx_b |
| 2322 |
#define __pyx_cython_runtime __pyx_mstate_global->__pyx_cython_runtime |
| 2323 |
#define __pyx_empty_tuple __pyx_mstate_global->__pyx_empty_tuple |
| 2324 |
#define __pyx_empty_bytes __pyx_mstate_global->__pyx_empty_bytes |
| 2325 |
#define __pyx_empty_unicode __pyx_mstate_global->__pyx_empty_unicode |
| 2326 |
#ifdef __Pyx_CyFunction_USED |
| 2327 |
#define __pyx_CyFunctionType __pyx_mstate_global->__pyx_CyFunctionType |
| 2328 |
#endif |
| 2329 |
#ifdef __Pyx_FusedFunction_USED |
| 2330 |
#define __pyx_FusedFunctionType __pyx_mstate_global->__pyx_FusedFunctionType |
| 2331 |
#endif |
| 2332 |
#ifdef __Pyx_Generator_USED |
| 2333 |
#define __pyx_GeneratorType __pyx_mstate_global->__pyx_GeneratorType |
| 2334 |
#endif |
| 2335 |
#ifdef __Pyx_IterableCoroutine_USED |
| 2336 |
#define __pyx_IterableCoroutineType __pyx_mstate_global->__pyx_IterableCoroutineType |
| 2337 |
#endif |
| 2338 |
#ifdef __Pyx_Coroutine_USED |
| 2339 |
#define __pyx_CoroutineAwaitType __pyx_mstate_global->__pyx_CoroutineAwaitType |
| 2340 |
#endif |
| 2341 |
#ifdef __Pyx_Coroutine_USED |
| 2342 |
#define __pyx_CoroutineType __pyx_mstate_global->__pyx_CoroutineType |
| 2343 |
#endif |
| 2344 |
#if CYTHON_USE_MODULE_STATE |
| 2345 |
#define __pyx_type_27test_async_gen_exception_04___pyx_scope_struct__gen __pyx_mstate_global->__pyx_type_27test_async_gen_exception_04___pyx_scope_struct__gen |
| 2346 |
#endif |
| 2347 |
#define __pyx_ptype_27test_async_gen_exception_04___pyx_scope_struct__gen __pyx_mstate_global->__pyx_ptype_27test_async_gen_exception_04___pyx_scope_struct__gen |
| 2348 |
#define __pyx_n_s_StopIteration __pyx_mstate_global->__pyx_n_s_StopIteration |
| 2349 |
#define __pyx_n_s_ZERO __pyx_mstate_global->__pyx_n_s_ZERO |
| 2350 |
#define __pyx_n_s__4 __pyx_mstate_global->__pyx_n_s__4 |
| 2351 |
#define __pyx_n_s_ai __pyx_mstate_global->__pyx_n_s_ai |
| 2352 |
#define __pyx_n_s_aiter __pyx_mstate_global->__pyx_n_s_aiter |
| 2353 |
#define __pyx_n_s_an __pyx_mstate_global->__pyx_n_s_an |
| 2354 |
#define __pyx_n_s_anext __pyx_mstate_global->__pyx_n_s_anext |
| 2355 |
#define __pyx_n_s_args __pyx_mstate_global->__pyx_n_s_args |
| 2356 |
#define __pyx_n_s_asyncio_coroutines __pyx_mstate_global->__pyx_n_s_asyncio_coroutines |
| 2357 |
#define __pyx_n_s_cline_in_traceback __pyx_mstate_global->__pyx_n_s_cline_in_traceback |
| 2358 |
#define __pyx_n_s_close __pyx_mstate_global->__pyx_n_s_close |
| 2359 |
#define __pyx_kp_u_disable __pyx_mstate_global->__pyx_kp_u_disable |
| 2360 |
#define __pyx_kp_u_enable __pyx_mstate_global->__pyx_kp_u_enable |
| 2361 |
#define __pyx_n_s_ex __pyx_mstate_global->__pyx_n_s_ex |
| 2362 |
#define __pyx_n_s_g __pyx_mstate_global->__pyx_n_s_g |
| 2363 |
#define __pyx_kp_u_gc __pyx_mstate_global->__pyx_kp_u_gc |
| 2364 |
#define __pyx_n_s_gen __pyx_mstate_global->__pyx_n_s_gen |
| 2365 |
#define __pyx_n_s_is_coroutine __pyx_mstate_global->__pyx_n_s_is_coroutine |
| 2366 |
#define __pyx_kp_u_isenabled __pyx_mstate_global->__pyx_kp_u_isenabled |
| 2367 |
#define __pyx_n_s_main __pyx_mstate_global->__pyx_n_s_main |
| 2368 |
#define __pyx_n_s_name __pyx_mstate_global->__pyx_n_s_name |
| 2369 |
#define __pyx_n_s_send __pyx_mstate_global->__pyx_n_s_send |
| 2370 |
#define __pyx_n_s_test __pyx_mstate_global->__pyx_n_s_test |
| 2371 |
#define __pyx_n_s_test_async_gen_exception_04 __pyx_mstate_global->__pyx_n_s_test_async_gen_exception_04 |
| 2372 |
#define __pyx_n_s_test_last_yield __pyx_mstate_global->__pyx_n_s_test_last_yield |
| 2373 |
#define __pyx_n_s_throw __pyx_mstate_global->__pyx_n_s_throw |
| 2374 |
#define __pyx_kp_s_tmp_test_async_gen_exception_04 __pyx_mstate_global->__pyx_kp_s_tmp_test_async_gen_exception_04 |
| 2375 |
#define __pyx_int_0 __pyx_mstate_global->__pyx_int_0 |
| 2376 |
#define __pyx_int_1 __pyx_mstate_global->__pyx_int_1 |
| 2377 |
#define __pyx_int_123 __pyx_mstate_global->__pyx_int_123 |
| 2378 |
#define __pyx_codeobj_ __pyx_mstate_global->__pyx_codeobj_ |
| 2379 |
#define __pyx_tuple__2 __pyx_mstate_global->__pyx_tuple__2 |
| 2380 |
#define __pyx_codeobj__3 __pyx_mstate_global->__pyx_codeobj__3 |
| 2381 |
|
| 2382 |
static PyObject *__pyx_gb_27test_async_gen_exception_04_2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); |
| 2383 |
|
| 2384 |
|
| 2385 |
|
| 2386 |
|
| 2387 |
|
| 2388 |
|
| 2389 |
|
| 2390 |
|
| 2391 |
|
| 2392 |
|
| 2393 |
static PyObject *__pyx_pw_27test_async_gen_exception_04_1gen(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); |
| 2394 |
static PyMethodDef __pyx_mdef_27test_async_gen_exception_04_1gen = {"gen", (PyCFunction)__pyx_pw_27test_async_gen_exception_04_1gen, METH_NOARGS, 0}; |
| 2395 |
static PyObject *__pyx_pw_27test_async_gen_exception_04_1gen(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { |
| 2396 |
CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs); |
| 2397 |
PyObject *__pyx_r = 0; |
| 2398 |
__Pyx_RefNannyDeclarations |
| 2399 |
__Pyx_RefNannySetupContext("gen (wrapper)", 0); |
| 2400 |
__pyx_r = __pyx_pf_27test_async_gen_exception_04_gen(__pyx_self); |
| 2401 |
|
| 2402 |
|
| 2403 |
__Pyx_RefNannyFinishContext(); |
| 2404 |
return __pyx_r; |
| 2405 |
} |
| 2406 |
|
| 2407 |
static PyObject *__pyx_pf_27test_async_gen_exception_04_gen(CYTHON_UNUSED PyObject *__pyx_self) { |
| 2408 |
struct __pyx_obj_27test_async_gen_exception_04___pyx_scope_struct__gen *__pyx_cur_scope; |
| 2409 |
PyObject *__pyx_r = NULL; |
| 2410 |
__Pyx_RefNannyDeclarations |
| 2411 |
int __pyx_lineno = 0; |
| 2412 |
const char *__pyx_filename = NULL; |
| 2413 |
int __pyx_clineno = 0; |
| 2414 |
__Pyx_RefNannySetupContext("gen", 0); |
| 2415 |
__pyx_cur_scope = (struct __pyx_obj_27test_async_gen_exception_04___pyx_scope_struct__gen *)__pyx_tp_new_27test_async_gen_exception_04___pyx_scope_struct__gen(__pyx_ptype_27test_async_gen_exception_04___pyx_scope_struct__gen, __pyx_empty_tuple, NULL); |
| 2416 |
if (unlikely(!__pyx_cur_scope)) { |
| 2417 |
__pyx_cur_scope = ((struct __pyx_obj_27test_async_gen_exception_04___pyx_scope_struct__gen *)Py_None); |
| 2418 |
__Pyx_INCREF(Py_None); |
| 2419 |
__PYX_ERR(0, 3, __pyx_L1_error) |
| 2420 |
} else { |
| 2421 |
__Pyx_GOTREF((PyObject *)__pyx_cur_scope); |
| 2422 |
} |
| 2423 |
{ |
| 2424 |
__pyx_CoroutineObject *gen = __Pyx_AsyncGen_New((__pyx_coroutine_body_t) __pyx_gb_27test_async_gen_exception_04_2generator, __pyx_codeobj_, (PyObject *) __pyx_cur_scope, __pyx_n_s_gen, __pyx_n_s_gen, __pyx_n_s_test_async_gen_exception_04); if (unlikely(!gen)) __PYX_ERR(0, 3, __pyx_L1_error) |
| 2425 |
__Pyx_DECREF(__pyx_cur_scope); |
| 2426 |
__Pyx_RefNannyFinishContext(); |
| 2427 |
return (PyObject *) gen; |
| 2428 |
} |
| 2429 |
|
| 2430 |
|
| 2431 |
__pyx_L1_error:; |
| 2432 |
__Pyx_AddTraceback("test_async_gen_exception_04.gen", __pyx_clineno, __pyx_lineno, __pyx_filename); |
| 2433 |
__pyx_r = NULL; |
| 2434 |
__Pyx_DECREF((PyObject *)__pyx_cur_scope); |
| 2435 |
__Pyx_XGIVEREF(__pyx_r); |
| 2436 |
__Pyx_RefNannyFinishContext(); |
| 2437 |
return __pyx_r; |
| 2438 |
} |
| 2439 |
|
| 2440 |
static PyObject *__pyx_gb_27test_async_gen_exception_04_2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) |
| 2441 |
{ |
| 2442 |
PyObject *__pyx_r = NULL; |
| 2443 |
PyObject *__pyx_t_1 = NULL; |
| 2444 |
PyObject *__pyx_t_2 = NULL; |
| 2445 |
int __pyx_lineno = 0; |
| 2446 |
const char *__pyx_filename = NULL; |
| 2447 |
int __pyx_clineno = 0; |
| 2448 |
__Pyx_RefNannyDeclarations |
| 2449 |
__Pyx_RefNannySetupContext("gen", 0); |
| 2450 |
switch (__pyx_generator->resume_label) { |
| 2451 |
case 0: goto __pyx_L3_first_run; |
| 2452 |
case 1: goto __pyx_L4_resume_from_yield; |
| 2453 |
default: |
| 2454 |
__Pyx_RefNannyFinishContext(); |
| 2455 |
return NULL; |
| 2456 |
} |
| 2457 |
__pyx_L3_first_run:; |
| 2458 |
if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 3, __pyx_L1_error) |
| 2459 |
|
| 2460 |
|
| 2461 |
|
| 2462 |
|
| 2463 |
|
| 2464 |
|
| 2465 |
|
| 2466 |
|
| 2467 |
__Pyx_INCREF(__pyx_int_123); |
| 2468 |
__pyx_r = __pyx_int_123; |
| 2469 |
__Pyx_XGIVEREF(__pyx_r); |
| 2470 |
__Pyx_RefNannyFinishContext(); |
| 2471 |
__Pyx_Coroutine_ResetAndClearException(__pyx_generator); |
| 2472 |
|
| 2473 |
__pyx_generator->resume_label = 1; |
| 2474 |
return __Pyx__PyAsyncGenValueWrapperNew(__pyx_r); |
| 2475 |
__pyx_L4_resume_from_yield:; |
| 2476 |
if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 4, __pyx_L1_error) |
| 2477 |
|
| 2478 |
|
| 2479 |
|
| 2480 |
|
| 2481 |
|
| 2482 |
|
| 2483 |
|
| 2484 |
|
| 2485 |
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_ZERO); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5, __pyx_L1_error) |
| 2486 |
__Pyx_GOTREF(__pyx_t_1); |
| 2487 |
__pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_int_1, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5, __pyx_L1_error) |
| 2488 |
__Pyx_GOTREF(__pyx_t_2); |
| 2489 |
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| 2490 |
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 2491 |
|
| 2492 |
|
| 2493 |
|
| 2494 |
|
| 2495 |
|
| 2496 |
|
| 2497 |
|
| 2498 |
|
| 2499 |
|
| 2500 |
|
| 2501 |
PyErr_SetNone(__Pyx_PyExc_StopAsyncIteration); |
| 2502 |
goto __pyx_L0; |
| 2503 |
__pyx_L1_error:; |
| 2504 |
__Pyx_Generator_Replace_StopIteration(1); |
| 2505 |
__Pyx_XDECREF(__pyx_t_1); |
| 2506 |
__Pyx_XDECREF(__pyx_t_2); |
| 2507 |
__Pyx_AddTraceback("gen", __pyx_clineno, __pyx_lineno, __pyx_filename); |
| 2508 |
__pyx_L0:; |
| 2509 |
__Pyx_XDECREF(__pyx_r); __pyx_r = 0; |
| 2510 |
#if !CYTHON_USE_EXC_INFO_STACK |
| 2511 |
__Pyx_Coroutine_ResetAndClearException(__pyx_generator); |
| 2512 |
#endif |
| 2513 |
__pyx_generator->resume_label = -1; |
| 2514 |
__Pyx_Coroutine_clear((PyObject*)__pyx_generator); |
| 2515 |
__Pyx_RefNannyFinishContext(); |
| 2516 |
return __pyx_r; |
| 2517 |
} |
| 2518 |
|
| 2519 |
|
| 2520 |
|
| 2521 |
|
| 2522 |
|
| 2523 |
|
| 2524 |
|
| 2525 |
|
| 2526 |
|
| 2527 |
|
| 2528 |
static PyObject *__pyx_pw_27test_async_gen_exception_04_4test_last_yield(PyObject *__pyx_self, |
| 2529 |
#if CYTHON_METH_FASTCALL |
| 2530 |
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds |
| 2531 |
#else |
| 2532 |
PyObject *__pyx_args, PyObject *__pyx_kwds |
| 2533 |
#endif |
| 2534 |
); |
| 2535 |
static PyMethodDef __pyx_mdef_27test_async_gen_exception_04_4test_last_yield = {"test_last_yield", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_27test_async_gen_exception_04_4test_last_yield, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; |
| 2536 |
static PyObject *__pyx_pw_27test_async_gen_exception_04_4test_last_yield(PyObject *__pyx_self, |
| 2537 |
#if CYTHON_METH_FASTCALL |
| 2538 |
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds |
| 2539 |
#else |
| 2540 |
PyObject *__pyx_args, PyObject *__pyx_kwds |
| 2541 |
#endif |
| 2542 |
) { |
| 2543 |
PyObject *__pyx_v_g = 0; |
| 2544 |
#if !CYTHON_METH_FASTCALL |
| 2545 |
CYTHON_UNUSED const Py_ssize_t __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); |
| 2546 |
#endif |
| 2547 |
CYTHON_UNUSED PyObject *const *__pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); |
| 2548 |
int __pyx_lineno = 0; |
| 2549 |
const char *__pyx_filename = NULL; |
| 2550 |
int __pyx_clineno = 0; |
| 2551 |
PyObject *__pyx_r = 0; |
| 2552 |
__Pyx_RefNannyDeclarations |
| 2553 |
__Pyx_RefNannySetupContext("test_last_yield (wrapper)", 0); |
| 2554 |
{ |
| 2555 |
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_g,0}; |
| 2556 |
PyObject* values[1] = {0}; |
| 2557 |
if (__pyx_kwds) { |
| 2558 |
Py_ssize_t kw_args; |
| 2559 |
switch (__pyx_nargs) { |
| 2560 |
case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); |
| 2561 |
CYTHON_FALLTHROUGH; |
| 2562 |
case 0: break; |
| 2563 |
default: goto __pyx_L5_argtuple_error; |
| 2564 |
} |
| 2565 |
kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); |
| 2566 |
switch (__pyx_nargs) { |
| 2567 |
case 0: |
| 2568 |
if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_g)) != 0)) kw_args--; |
| 2569 |
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 7, __pyx_L3_error) |
| 2570 |
else goto __pyx_L5_argtuple_error; |
| 2571 |
} |
| 2572 |
if (unlikely(kw_args > 0)) { |
| 2573 |
const Py_ssize_t kwd_pos_args = __pyx_nargs; |
| 2574 |
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "test_last_yield") < 0)) __PYX_ERR(0, 7, __pyx_L3_error) |
| 2575 |
} |
| 2576 |
} else if (unlikely(__pyx_nargs != 1)) { |
| 2577 |
goto __pyx_L5_argtuple_error; |
| 2578 |
} else { |
| 2579 |
values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); |
| 2580 |
} |
| 2581 |
__pyx_v_g = values[0]; |
| 2582 |
} |
| 2583 |
goto __pyx_L4_argument_unpacking_done; |
| 2584 |
__pyx_L5_argtuple_error:; |
| 2585 |
__Pyx_RaiseArgtupleInvalid("test_last_yield", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 7, __pyx_L3_error) |
| 2586 |
__pyx_L3_error:; |
| 2587 |
__Pyx_AddTraceback("test_async_gen_exception_04.test_last_yield", __pyx_clineno, __pyx_lineno, __pyx_filename); |
| 2588 |
__Pyx_RefNannyFinishContext(); |
| 2589 |
return NULL; |
| 2590 |
__pyx_L4_argument_unpacking_done:; |
| 2591 |
__pyx_r = __pyx_pf_27test_async_gen_exception_04_3test_last_yield(__pyx_self, __pyx_v_g); |
| 2592 |
|
| 2593 |
|
| 2594 |
__Pyx_RefNannyFinishContext(); |
| 2595 |
return __pyx_r; |
| 2596 |
} |
| 2597 |
|
| 2598 |
static PyObject *__pyx_pf_27test_async_gen_exception_04_3test_last_yield(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_g) { |
| 2599 |
PyObject *__pyx_v_ai = NULL; |
| 2600 |
PyObject *__pyx_v_an = NULL; |
| 2601 |
PyObject *__pyx_v_ex = NULL; |
| 2602 |
PyObject *__pyx_r = NULL; |
| 2603 |
__Pyx_RefNannyDeclarations |
| 2604 |
PyObject *__pyx_t_1 = NULL; |
| 2605 |
PyObject *__pyx_t_2 = NULL; |
| 2606 |
PyObject *__pyx_t_3 = NULL; |
| 2607 |
int __pyx_t_4; |
| 2608 |
PyObject *__pyx_t_5 = NULL; |
| 2609 |
PyObject *__pyx_t_6 = NULL; |
| 2610 |
PyObject *__pyx_t_7 = NULL; |
| 2611 |
PyObject *__pyx_t_8 = NULL; |
| 2612 |
PyObject *__pyx_t_9 = NULL; |
| 2613 |
int __pyx_t_10; |
| 2614 |
char const *__pyx_t_11; |
| 2615 |
PyObject *__pyx_t_12 = NULL; |
| 2616 |
PyObject *__pyx_t_13 = NULL; |
| 2617 |
PyObject *__pyx_t_14 = NULL; |
| 2618 |
PyObject *__pyx_t_15 = NULL; |
| 2619 |
PyObject *__pyx_t_16 = NULL; |
| 2620 |
PyObject *__pyx_t_17 = NULL; |
| 2621 |
int __pyx_lineno = 0; |
| 2622 |
const char *__pyx_filename = NULL; |
| 2623 |
int __pyx_clineno = 0; |
| 2624 |
__Pyx_RefNannySetupContext("test_last_yield", 0); |
| 2625 |
|
| 2626 |
|
| 2627 |
|
| 2628 |
|
| 2629 |
|
| 2630 |
|
| 2631 |
|
| 2632 |
|
| 2633 |
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_g, __pyx_n_s_aiter); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 8, __pyx_L1_error) |
| 2634 |
__Pyx_GOTREF(__pyx_t_2); |
| 2635 |
__pyx_t_3 = NULL; |
| 2636 |
__pyx_t_4 = 0; |
| 2637 |
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { |
| 2638 |
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); |
| 2639 |
if (likely(__pyx_t_3)) { |
| 2640 |
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); |
| 2641 |
__Pyx_INCREF(__pyx_t_3); |
| 2642 |
__Pyx_INCREF(function); |
| 2643 |
__Pyx_DECREF_SET(__pyx_t_2, function); |
| 2644 |
__pyx_t_4 = 1; |
| 2645 |
} |
| 2646 |
} |
| 2647 |
{ |
| 2648 |
PyObject *__pyx_callargs[1] = {__pyx_t_3, }; |
| 2649 |
__pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4); |
| 2650 |
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; |
| 2651 |
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error) |
| 2652 |
__Pyx_GOTREF(__pyx_t_1); |
| 2653 |
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 2654 |
} |
| 2655 |
__pyx_v_ai = __pyx_t_1; |
| 2656 |
__pyx_t_1 = 0; |
| 2657 |
|
| 2658 |
|
| 2659 |
|
| 2660 |
|
| 2661 |
|
| 2662 |
|
| 2663 |
|
| 2664 |
|
| 2665 |
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_ai, __pyx_n_s_anext); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error) |
| 2666 |
__Pyx_GOTREF(__pyx_t_2); |
| 2667 |
__pyx_t_3 = NULL; |
| 2668 |
__pyx_t_4 = 0; |
| 2669 |
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { |
| 2670 |
__pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); |
| 2671 |
if (likely(__pyx_t_3)) { |
| 2672 |
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); |
| 2673 |
__Pyx_INCREF(__pyx_t_3); |
| 2674 |
__Pyx_INCREF(function); |
| 2675 |
__Pyx_DECREF_SET(__pyx_t_2, function); |
| 2676 |
__pyx_t_4 = 1; |
| 2677 |
} |
| 2678 |
} |
| 2679 |
{ |
| 2680 |
PyObject *__pyx_callargs[1] = {__pyx_t_3, }; |
| 2681 |
__pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4); |
| 2682 |
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; |
| 2683 |
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error) |
| 2684 |
__Pyx_GOTREF(__pyx_t_1); |
| 2685 |
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 2686 |
} |
| 2687 |
__pyx_v_an = __pyx_t_1; |
| 2688 |
__pyx_t_1 = 0; |
| 2689 |
|
| 2690 |
|
| 2691 |
|
| 2692 |
|
| 2693 |
|
| 2694 |
|
| 2695 |
|
| 2696 |
|
| 2697 |
{ |
| 2698 |
__Pyx_PyThreadState_declare |
| 2699 |
__Pyx_PyThreadState_assign |
| 2700 |
__Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7); |
| 2701 |
__Pyx_XGOTREF(__pyx_t_5); |
| 2702 |
__Pyx_XGOTREF(__pyx_t_6); |
| 2703 |
__Pyx_XGOTREF(__pyx_t_7); |
| 2704 |
{ |
| 2705 |
|
| 2706 |
|
| 2707 |
|
| 2708 |
|
| 2709 |
|
| 2710 |
|
| 2711 |
|
| 2712 |
|
| 2713 |
__pyx_t_1 = __Pyx_PyIter_Next(__pyx_v_an); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L3_error) |
| 2714 |
__Pyx_GOTREF(__pyx_t_1); |
| 2715 |
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| 2716 |
|
| 2717 |
|
| 2718 |
|
| 2719 |
|
| 2720 |
|
| 2721 |
|
| 2722 |
|
| 2723 |
|
| 2724 |
} |
| 2725 |
|
| 2726 |
|
| 2727 |
|
| 2728 |
|
| 2729 |
|
| 2730 |
|
| 2731 |
|
| 2732 |
{ |
| 2733 |
__Pyx_XDECREF(__pyx_r); |
| 2734 |
__pyx_r = Py_None; __Pyx_INCREF(Py_None); |
| 2735 |
goto __pyx_L6_except_return; |
| 2736 |
} |
| 2737 |
__pyx_L3_error:; |
| 2738 |
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; |
| 2739 |
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 2740 |
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; |
| 2741 |
|
| 2742 |
|
| 2743 |
|
| 2744 |
|
| 2745 |
|
| 2746 |
|
| 2747 |
|
| 2748 |
|
| 2749 |
__pyx_t_4 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_StopIteration); |
| 2750 |
if (__pyx_t_4) { |
| 2751 |
__Pyx_AddTraceback("test_async_gen_exception_04.test_last_yield", __pyx_clineno, __pyx_lineno, __pyx_filename); |
| 2752 |
if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3) < 0) __PYX_ERR(0, 12, __pyx_L5_except_error) |
| 2753 |
__Pyx_GOTREF(__pyx_t_1); |
| 2754 |
__Pyx_GOTREF(__pyx_t_2); |
| 2755 |
__Pyx_GOTREF(__pyx_t_3); |
| 2756 |
__Pyx_INCREF(__pyx_t_2); |
| 2757 |
__pyx_v_ex = __pyx_t_2; |
| 2758 |
{ |
| 2759 |
|
| 2760 |
|
| 2761 |
|
| 2762 |
|
| 2763 |
|
| 2764 |
|
| 2765 |
|
| 2766 |
|
| 2767 |
__Pyx_XDECREF(__pyx_r); |
| 2768 |
__pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_ex, __pyx_n_s_args); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 13, __pyx_L14_error) |
| 2769 |
__Pyx_GOTREF(__pyx_t_8); |
| 2770 |
__pyx_t_9 = __Pyx_GetItemInt(__pyx_t_8, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 13, __pyx_L14_error) |
| 2771 |
__Pyx_GOTREF(__pyx_t_9); |
| 2772 |
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; |
| 2773 |
__pyx_r = __pyx_t_9; |
| 2774 |
__pyx_t_9 = 0; |
| 2775 |
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; |
| 2776 |
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 2777 |
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; |
| 2778 |
goto __pyx_L13_return; |
| 2779 |
} |
| 2780 |
|
| 2781 |
|
| 2782 |
|
| 2783 |
|
| 2784 |
|
| 2785 |
|
| 2786 |
|
| 2787 |
|
| 2788 |
{ |
| 2789 |
__pyx_L14_error:; |
| 2790 |
{ |
| 2791 |
__Pyx_PyThreadState_declare |
| 2792 |
__Pyx_PyThreadState_assign |
| 2793 |
__pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; |
| 2794 |
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; |
| 2795 |
__Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; |
| 2796 |
if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17); |
| 2797 |
if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14) < 0)) __Pyx_ErrFetch(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14); |
| 2798 |
__Pyx_XGOTREF(__pyx_t_12); |
| 2799 |
__Pyx_XGOTREF(__pyx_t_13); |
| 2800 |
__Pyx_XGOTREF(__pyx_t_14); |
| 2801 |
__Pyx_XGOTREF(__pyx_t_15); |
| 2802 |
__Pyx_XGOTREF(__pyx_t_16); |
| 2803 |
__Pyx_XGOTREF(__pyx_t_17); |
| 2804 |
__pyx_t_4 = __pyx_lineno; __pyx_t_10 = __pyx_clineno; __pyx_t_11 = __pyx_filename; |
| 2805 |
{ |
| 2806 |
__Pyx_DECREF(__pyx_v_ex); __pyx_v_ex = 0; |
| 2807 |
} |
| 2808 |
if (PY_MAJOR_VERSION >= 3) { |
| 2809 |
__Pyx_XGIVEREF(__pyx_t_15); |
| 2810 |
__Pyx_XGIVEREF(__pyx_t_16); |
| 2811 |
__Pyx_XGIVEREF(__pyx_t_17); |
| 2812 |
__Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17); |
| 2813 |
} |
| 2814 |
__Pyx_XGIVEREF(__pyx_t_12); |
| 2815 |
__Pyx_XGIVEREF(__pyx_t_13); |
| 2816 |
__Pyx_XGIVEREF(__pyx_t_14); |
| 2817 |
__Pyx_ErrRestore(__pyx_t_12, __pyx_t_13, __pyx_t_14); |
| 2818 |
__pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; |
| 2819 |
__pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_10; __pyx_filename = __pyx_t_11; |
| 2820 |
goto __pyx_L5_except_error; |
| 2821 |
} |
| 2822 |
__pyx_L13_return: { |
| 2823 |
__pyx_t_17 = __pyx_r; |
| 2824 |
__pyx_r = 0; |
| 2825 |
__Pyx_DECREF(__pyx_v_ex); __pyx_v_ex = 0; |
| 2826 |
__pyx_r = __pyx_t_17; |
| 2827 |
__pyx_t_17 = 0; |
| 2828 |
goto __pyx_L6_except_return; |
| 2829 |
} |
| 2830 |
} |
| 2831 |
} |
| 2832 |
goto __pyx_L5_except_error; |
| 2833 |
|
| 2834 |
|
| 2835 |
|
| 2836 |
|
| 2837 |
|
| 2838 |
|
| 2839 |
|
| 2840 |
|
| 2841 |
__pyx_L5_except_error:; |
| 2842 |
__Pyx_XGIVEREF(__pyx_t_5); |
| 2843 |
__Pyx_XGIVEREF(__pyx_t_6); |
| 2844 |
__Pyx_XGIVEREF(__pyx_t_7); |
| 2845 |
__Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7); |
| 2846 |
goto __pyx_L1_error; |
| 2847 |
__pyx_L6_except_return:; |
| 2848 |
__Pyx_XGIVEREF(__pyx_t_5); |
| 2849 |
__Pyx_XGIVEREF(__pyx_t_6); |
| 2850 |
__Pyx_XGIVEREF(__pyx_t_7); |
| 2851 |
__Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7); |
| 2852 |
goto __pyx_L0; |
| 2853 |
} |
| 2854 |
|
| 2855 |
|
| 2856 |
|
| 2857 |
|
| 2858 |
|
| 2859 |
|
| 2860 |
|
| 2861 |
|
| 2862 |
|
| 2863 |
|
| 2864 |
__pyx_L1_error:; |
| 2865 |
__Pyx_XDECREF(__pyx_t_1); |
| 2866 |
__Pyx_XDECREF(__pyx_t_2); |
| 2867 |
__Pyx_XDECREF(__pyx_t_3); |
| 2868 |
__Pyx_XDECREF(__pyx_t_8); |
| 2869 |
__Pyx_XDECREF(__pyx_t_9); |
| 2870 |
__Pyx_AddTraceback("test_async_gen_exception_04.test_last_yield", __pyx_clineno, __pyx_lineno, __pyx_filename); |
| 2871 |
__pyx_r = NULL; |
| 2872 |
__pyx_L0:; |
| 2873 |
__Pyx_XDECREF(__pyx_v_ai); |
| 2874 |
__Pyx_XDECREF(__pyx_v_an); |
| 2875 |
__Pyx_XDECREF(__pyx_v_ex); |
| 2876 |
__Pyx_XGIVEREF(__pyx_r); |
| 2877 |
__Pyx_RefNannyFinishContext(); |
| 2878 |
return __pyx_r; |
| 2879 |
} |
| 2880 |
|
| 2881 |
static struct __pyx_obj_27test_async_gen_exception_04___pyx_scope_struct__gen *__pyx_freelist_27test_async_gen_exception_04___pyx_scope_struct__gen[8]; |
| 2882 |
static int __pyx_freecount_27test_async_gen_exception_04___pyx_scope_struct__gen = 0; |
| 2883 |
|
| 2884 |
static PyObject *__pyx_tp_new_27test_async_gen_exception_04___pyx_scope_struct__gen(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { |
| 2885 |
PyObject *o; |
| 2886 |
#if CYTHON_COMPILING_IN_LIMITED_API |
| 2887 |
allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); |
| 2888 |
o = alloc_func(t, 0); |
| 2889 |
#else |
| 2890 |
if (CYTHON_COMPILING_IN_CPYTHON && likely((int)(__pyx_freecount_27test_async_gen_exception_04___pyx_scope_struct__gen > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_27test_async_gen_exception_04___pyx_scope_struct__gen)))) { |
| 2891 |
o = (PyObject*)__pyx_freelist_27test_async_gen_exception_04___pyx_scope_struct__gen[--__pyx_freecount_27test_async_gen_exception_04___pyx_scope_struct__gen]; |
| 2892 |
memset(o, 0, sizeof(struct __pyx_obj_27test_async_gen_exception_04___pyx_scope_struct__gen)); |
| 2893 |
(void) PyObject_INIT(o, t); |
| 2894 |
} else { |
| 2895 |
o = (*t->tp_alloc)(t, 0); |
| 2896 |
if (unlikely(!o)) return 0; |
| 2897 |
} |
| 2898 |
#endif |
| 2899 |
return o; |
| 2900 |
} |
| 2901 |
|
| 2902 |
static void __pyx_tp_dealloc_27test_async_gen_exception_04___pyx_scope_struct__gen(PyObject *o) { |
| 2903 |
#if CYTHON_USE_TP_FINALIZE |
| 2904 |
if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { |
| 2905 |
if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_27test_async_gen_exception_04___pyx_scope_struct__gen) { |
| 2906 |
if (PyObject_CallFinalizerFromDealloc(o)) return; |
| 2907 |
} |
| 2908 |
} |
| 2909 |
#endif |
| 2910 |
if (CYTHON_COMPILING_IN_CPYTHON && ((int)(__pyx_freecount_27test_async_gen_exception_04___pyx_scope_struct__gen < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_27test_async_gen_exception_04___pyx_scope_struct__gen)))) { |
| 2911 |
__pyx_freelist_27test_async_gen_exception_04___pyx_scope_struct__gen[__pyx_freecount_27test_async_gen_exception_04___pyx_scope_struct__gen++] = ((struct __pyx_obj_27test_async_gen_exception_04___pyx_scope_struct__gen *)o); |
| 2912 |
} else { |
| 2913 |
(*Py_TYPE(o)->tp_free)(o); |
| 2914 |
} |
| 2915 |
} |
| 2916 |
#if CYTHON_USE_TYPE_SPECS |
| 2917 |
static PyType_Slot __pyx_type_27test_async_gen_exception_04___pyx_scope_struct__gen_slots[] = { |
| 2918 |
{Py_tp_dealloc, (void *)__pyx_tp_dealloc_27test_async_gen_exception_04___pyx_scope_struct__gen}, |
| 2919 |
{Py_tp_new, (void *)__pyx_tp_new_27test_async_gen_exception_04___pyx_scope_struct__gen}, |
| 2920 |
{0, 0}, |
| 2921 |
}; |
| 2922 |
static PyType_Spec __pyx_type_27test_async_gen_exception_04___pyx_scope_struct__gen_spec = { |
| 2923 |
"test_async_gen_exception_04.__pyx_scope_struct__gen", |
| 2924 |
sizeof(struct __pyx_obj_27test_async_gen_exception_04___pyx_scope_struct__gen), |
| 2925 |
0, |
| 2926 |
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_FINALIZE, |
| 2927 |
__pyx_type_27test_async_gen_exception_04___pyx_scope_struct__gen_slots, |
| 2928 |
}; |
| 2929 |
#else |
| 2930 |
|
| 2931 |
static PyTypeObject __pyx_type_27test_async_gen_exception_04___pyx_scope_struct__gen = { |
| 2932 |
PyVarObject_HEAD_INIT(0, 0) |
| 2933 |
"test_async_gen_exception_04.""__pyx_scope_struct__gen", |
| 2934 |
sizeof(struct __pyx_obj_27test_async_gen_exception_04___pyx_scope_struct__gen), |
| 2935 |
0, |
| 2936 |
__pyx_tp_dealloc_27test_async_gen_exception_04___pyx_scope_struct__gen, |
| 2937 |
#if PY_VERSION_HEX < 0x030800b4 |
| 2938 |
0, |
| 2939 |
#endif |
| 2940 |
#if PY_VERSION_HEX >= 0x030800b4 |
| 2941 |
0, |
| 2942 |
#endif |
| 2943 |
0, |
| 2944 |
0, |
| 2945 |
#if PY_MAJOR_VERSION < 3 |
| 2946 |
0, |
| 2947 |
#endif |
| 2948 |
#if PY_MAJOR_VERSION >= 3 |
| 2949 |
0, |
| 2950 |
#endif |
| 2951 |
0, |
| 2952 |
0, |
| 2953 |
0, |
| 2954 |
0, |
| 2955 |
0, |
| 2956 |
0, |
| 2957 |
0, |
| 2958 |
0, |
| 2959 |
0, |
| 2960 |
0, |
| 2961 |
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_FINALIZE, |
| 2962 |
0, |
| 2963 |
0, |
| 2964 |
0, |
| 2965 |
0, |
| 2966 |
0, |
| 2967 |
0, |
| 2968 |
0, |
| 2969 |
0, |
| 2970 |
0, |
| 2971 |
0, |
| 2972 |
0, |
| 2973 |
0, |
| 2974 |
0, |
| 2975 |
0, |
| 2976 |
#if !CYTHON_USE_TYPE_SPECS |
| 2977 |
0, |
| 2978 |
#endif |
| 2979 |
0, |
| 2980 |
0, |
| 2981 |
__pyx_tp_new_27test_async_gen_exception_04___pyx_scope_struct__gen, |
| 2982 |
0, |
| 2983 |
0, |
| 2984 |
0, |
| 2985 |
0, |
| 2986 |
0, |
| 2987 |
0, |
| 2988 |
0, |
| 2989 |
0, |
| 2990 |
0, |
| 2991 |
#if PY_VERSION_HEX >= 0x030400a1 |
| 2992 |
#if CYTHON_USE_TP_FINALIZE |
| 2993 |
0, |
| 2994 |
#else |
| 2995 |
NULL, |
| 2996 |
#endif |
| 2997 |
#endif |
| 2998 |
#if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) |
| 2999 |
0, |
| 3000 |
#endif |
| 3001 |
#if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 |
| 3002 |
0, |
| 3003 |
#endif |
| 3004 |
#if PY_VERSION_HEX >= 0x030C0000 |
| 3005 |
0, |
| 3006 |
#endif |
| 3007 |
#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 |
| 3008 |
0, |
| 3009 |
#endif |
| 3010 |
}; |
| 3011 |
#endif |
| 3012 |
|
| 3013 |
static PyMethodDef __pyx_methods[] = { |
| 3014 |
{0, 0, 0, 0} |
| 3015 |
}; |
| 3016 |
#ifndef CYTHON_SMALL_CODE |
| 3017 |
#if defined(__clang__) |
| 3018 |
#define CYTHON_SMALL_CODE |
| 3019 |
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) |
| 3020 |
#define CYTHON_SMALL_CODE __attribute__((cold)) |
| 3021 |
#else |
| 3022 |
#define CYTHON_SMALL_CODE |
| 3023 |
#endif |
| 3024 |
#endif |
| 3025 |
|
| 3026 |
|
| 3027 |
static int __Pyx_CreateStringTabAndInitStrings(void) { |
| 3028 |
__Pyx_StringTabEntry __pyx_string_tab[] = { |
| 3029 |
{&__pyx_n_s_StopIteration, __pyx_k_StopIteration, sizeof(__pyx_k_StopIteration), 0, 0, 1, 1}, |
| 3030 |
{&__pyx_n_s_ZERO, __pyx_k_ZERO, sizeof(__pyx_k_ZERO), 0, 0, 1, 1}, |
| 3031 |
{&__pyx_n_s__4, __pyx_k__4, sizeof(__pyx_k__4), 0, 0, 1, 1}, |
| 3032 |
{&__pyx_n_s_ai, __pyx_k_ai, sizeof(__pyx_k_ai), 0, 0, 1, 1}, |
| 3033 |
{&__pyx_n_s_aiter, __pyx_k_aiter, sizeof(__pyx_k_aiter), 0, 0, 1, 1}, |
| 3034 |
{&__pyx_n_s_an, __pyx_k_an, sizeof(__pyx_k_an), 0, 0, 1, 1}, |
| 3035 |
{&__pyx_n_s_anext, __pyx_k_anext, sizeof(__pyx_k_anext), 0, 0, 1, 1}, |
| 3036 |
{&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1}, |
| 3037 |
{&__pyx_n_s_asyncio_coroutines, __pyx_k_asyncio_coroutines, sizeof(__pyx_k_asyncio_coroutines), 0, 0, 1, 1}, |
| 3038 |
{&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, |
| 3039 |
{&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1}, |
| 3040 |
{&__pyx_kp_u_disable, __pyx_k_disable, sizeof(__pyx_k_disable), 0, 1, 0, 0}, |
| 3041 |
{&__pyx_kp_u_enable, __pyx_k_enable, sizeof(__pyx_k_enable), 0, 1, 0, 0}, |
| 3042 |
{&__pyx_n_s_ex, __pyx_k_ex, sizeof(__pyx_k_ex), 0, 0, 1, 1}, |
| 3043 |
{&__pyx_n_s_g, __pyx_k_g, sizeof(__pyx_k_g), 0, 0, 1, 1}, |
| 3044 |
{&__pyx_kp_u_gc, __pyx_k_gc, sizeof(__pyx_k_gc), 0, 1, 0, 0}, |
| 3045 |
{&__pyx_n_s_gen, __pyx_k_gen, sizeof(__pyx_k_gen), 0, 0, 1, 1}, |
| 3046 |
{&__pyx_n_s_is_coroutine, __pyx_k_is_coroutine, sizeof(__pyx_k_is_coroutine), 0, 0, 1, 1}, |
| 3047 |
{&__pyx_kp_u_isenabled, __pyx_k_isenabled, sizeof(__pyx_k_isenabled), 0, 1, 0, 0}, |
| 3048 |
{&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, |
| 3049 |
{&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, |
| 3050 |
{&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1}, |
| 3051 |
{&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, |
| 3052 |
{&__pyx_n_s_test_async_gen_exception_04, __pyx_k_test_async_gen_exception_04, sizeof(__pyx_k_test_async_gen_exception_04), 0, 0, 1, 1}, |
| 3053 |
{&__pyx_n_s_test_last_yield, __pyx_k_test_last_yield, sizeof(__pyx_k_test_last_yield), 0, 0, 1, 1}, |
| 3054 |
{&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1}, |
| 3055 |
{&__pyx_kp_s_tmp_test_async_gen_exception_04, __pyx_k_tmp_test_async_gen_exception_04, sizeof(__pyx_k_tmp_test_async_gen_exception_04), 0, 0, 1, 0}, |
| 3056 |
{0, 0, 0, 0, 0, 0, 0} |
| 3057 |
}; |
| 3058 |
return __Pyx_InitStrings(__pyx_string_tab); |
| 3059 |
} |
| 3060 |
|
| 3061 |
static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { |
| 3062 |
__pyx_builtin_StopIteration = __Pyx_GetBuiltinName(__pyx_n_s_StopIteration); if (!__pyx_builtin_StopIteration) __PYX_ERR(0, 12, __pyx_L1_error) |
| 3063 |
return 0; |
| 3064 |
__pyx_L1_error:; |
| 3065 |
return -1; |
| 3066 |
} |
| 3067 |
|
| 3068 |
|
| 3069 |
static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { |
| 3070 |
__Pyx_RefNannyDeclarations |
| 3071 |
__Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); |
| 3072 |
|
| 3073 |
|
| 3074 |
|
| 3075 |
|
| 3076 |
|
| 3077 |
|
| 3078 |
|
| 3079 |
|
| 3080 |
__pyx_codeobj_ = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_ASYNC_GENERATOR, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tmp_test_async_gen_exception_04, __pyx_n_s_gen, 3, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj_)) __PYX_ERR(0, 3, __pyx_L1_error) |
| 3081 |
|
| 3082 |
|
| 3083 |
|
| 3084 |
|
| 3085 |
|
| 3086 |
|
| 3087 |
|
| 3088 |
|
| 3089 |
__pyx_tuple__2 = PyTuple_Pack(4, __pyx_n_s_g, __pyx_n_s_ai, __pyx_n_s_an, __pyx_n_s_ex); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 7, __pyx_L1_error) |
| 3090 |
__Pyx_GOTREF(__pyx_tuple__2); |
| 3091 |
__Pyx_GIVEREF(__pyx_tuple__2); |
| 3092 |
__pyx_codeobj__3 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__2, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tmp_test_async_gen_exception_04, __pyx_n_s_test_last_yield, 7, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__3)) __PYX_ERR(0, 7, __pyx_L1_error) |
| 3093 |
__Pyx_RefNannyFinishContext(); |
| 3094 |
return 0; |
| 3095 |
__pyx_L1_error:; |
| 3096 |
__Pyx_RefNannyFinishContext(); |
| 3097 |
return -1; |
| 3098 |
} |
| 3099 |
|
| 3100 |
|
| 3101 |
static CYTHON_SMALL_CODE int __Pyx_InitConstants(void) { |
| 3102 |
if (__Pyx_CreateStringTabAndInitStrings() < 0) __PYX_ERR(0, 1, __pyx_L1_error); |
| 3103 |
__pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error) |
| 3104 |
__pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) |
| 3105 |
__pyx_int_123 = PyInt_FromLong(123); if (unlikely(!__pyx_int_123)) __PYX_ERR(0, 1, __pyx_L1_error) |
| 3106 |
return 0; |
| 3107 |
__pyx_L1_error:; |
| 3108 |
return -1; |
| 3109 |
} |
| 3110 |
|
| 3111 |
|
| 3112 |
static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { |
| 3113 |
return 0; |
| 3114 |
} |
| 3115 |
|
| 3116 |
|
| 3117 |
static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); |
| 3118 |
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); |
| 3119 |
static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); |
| 3120 |
static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); |
| 3121 |
static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); |
| 3122 |
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); |
| 3123 |
static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); |
| 3124 |
|
| 3125 |
static int __Pyx_modinit_global_init_code(void) { |
| 3126 |
__Pyx_RefNannyDeclarations |
| 3127 |
__Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); |
| 3128 |
|
| 3129 |
__Pyx_RefNannyFinishContext(); |
| 3130 |
return 0; |
| 3131 |
} |
| 3132 |
|
| 3133 |
static int __Pyx_modinit_variable_export_code(void) { |
| 3134 |
__Pyx_RefNannyDeclarations |
| 3135 |
__Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); |
| 3136 |
|
| 3137 |
__Pyx_RefNannyFinishContext(); |
| 3138 |
return 0; |
| 3139 |
} |
| 3140 |
|
| 3141 |
static int __Pyx_modinit_function_export_code(void) { |
| 3142 |
__Pyx_RefNannyDeclarations |
| 3143 |
__Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); |
| 3144 |
|
| 3145 |
__Pyx_RefNannyFinishContext(); |
| 3146 |
return 0; |
| 3147 |
} |
| 3148 |
|
| 3149 |
static int __Pyx_modinit_type_init_code(void) { |
| 3150 |
__Pyx_RefNannyDeclarations |
| 3151 |
int __pyx_lineno = 0; |
| 3152 |
const char *__pyx_filename = NULL; |
| 3153 |
int __pyx_clineno = 0; |
| 3154 |
__Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); |
| 3155 |
|
| 3156 |
#if CYTHON_USE_TYPE_SPECS |
| 3157 |
__pyx_ptype_27test_async_gen_exception_04___pyx_scope_struct__gen = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_27test_async_gen_exception_04___pyx_scope_struct__gen_spec, NULL); if (unlikely(!__pyx_ptype_27test_async_gen_exception_04___pyx_scope_struct__gen)) __PYX_ERR(0, 3, __pyx_L1_error) |
| 3158 |
if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_27test_async_gen_exception_04___pyx_scope_struct__gen_spec, __pyx_ptype_27test_async_gen_exception_04___pyx_scope_struct__gen) < 0) __PYX_ERR(0, 3, __pyx_L1_error) |
| 3159 |
#else |
| 3160 |
__pyx_ptype_27test_async_gen_exception_04___pyx_scope_struct__gen = &__pyx_type_27test_async_gen_exception_04___pyx_scope_struct__gen; |
| 3161 |
#endif |
| 3162 |
#if !CYTHON_COMPILING_IN_LIMITED_API |
| 3163 |
#endif |
| 3164 |
#if !CYTHON_USE_TYPE_SPECS |
| 3165 |
if (__Pyx_PyType_Ready(__pyx_ptype_27test_async_gen_exception_04___pyx_scope_struct__gen) < 0) __PYX_ERR(0, 3, __pyx_L1_error) |
| 3166 |
#endif |
| 3167 |
#if PY_MAJOR_VERSION < 3 |
| 3168 |
__pyx_ptype_27test_async_gen_exception_04___pyx_scope_struct__gen->tp_print = 0; |
| 3169 |
#endif |
| 3170 |
#if !CYTHON_COMPILING_IN_LIMITED_API |
| 3171 |
if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_27test_async_gen_exception_04___pyx_scope_struct__gen->tp_dictoffset && __pyx_ptype_27test_async_gen_exception_04___pyx_scope_struct__gen->tp_getattro == PyObject_GenericGetAttr)) { |
| 3172 |
__pyx_ptype_27test_async_gen_exception_04___pyx_scope_struct__gen->tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; |
| 3173 |
} |
| 3174 |
#endif |
| 3175 |
__Pyx_RefNannyFinishContext(); |
| 3176 |
return 0; |
| 3177 |
__pyx_L1_error:; |
| 3178 |
__Pyx_RefNannyFinishContext(); |
| 3179 |
return -1; |
| 3180 |
} |
| 3181 |
|
| 3182 |
static int __Pyx_modinit_type_import_code(void) { |
| 3183 |
__Pyx_RefNannyDeclarations |
| 3184 |
__Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); |
| 3185 |
|
| 3186 |
__Pyx_RefNannyFinishContext(); |
| 3187 |
return 0; |
| 3188 |
} |
| 3189 |
|
| 3190 |
static int __Pyx_modinit_variable_import_code(void) { |
| 3191 |
__Pyx_RefNannyDeclarations |
| 3192 |
__Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); |
| 3193 |
|
| 3194 |
__Pyx_RefNannyFinishContext(); |
| 3195 |
return 0; |
| 3196 |
} |
| 3197 |
|
| 3198 |
static int __Pyx_modinit_function_import_code(void) { |
| 3199 |
__Pyx_RefNannyDeclarations |
| 3200 |
__Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); |
| 3201 |
|
| 3202 |
__Pyx_RefNannyFinishContext(); |
| 3203 |
return 0; |
| 3204 |
} |
| 3205 |
|
| 3206 |
|
| 3207 |
#if PY_MAJOR_VERSION >= 3 |
| 3208 |
#if CYTHON_PEP489_MULTI_PHASE_INIT |
| 3209 |
static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); |
| 3210 |
static int __pyx_pymod_exec_test_async_gen_exception_04(PyObject* module); |
| 3211 |
static PyModuleDef_Slot __pyx_moduledef_slots[] = { |
| 3212 |
{Py_mod_create, (void*)__pyx_pymod_create}, |
| 3213 |
{Py_mod_exec, (void*)__pyx_pymod_exec_test_async_gen_exception_04}, |
| 3214 |
{0, NULL} |
| 3215 |
}; |
| 3216 |
#endif |
| 3217 |
|
| 3218 |
#ifdef __cplusplus |
| 3219 |
namespace { |
| 3220 |
struct PyModuleDef __pyx_moduledef = |
| 3221 |
#else |
| 3222 |
static struct PyModuleDef __pyx_moduledef = |
| 3223 |
#endif |
| 3224 |
{ |
| 3225 |
PyModuleDef_HEAD_INIT, |
| 3226 |
"test_async_gen_exception_04", |
| 3227 |
0, |
| 3228 |
#if CYTHON_PEP489_MULTI_PHASE_INIT |
| 3229 |
0, |
| 3230 |
#elif CYTHON_USE_MODULE_STATE |
| 3231 |
sizeof(__pyx_mstate), |
| 3232 |
#else |
| 3233 |
-1, |
| 3234 |
#endif |
| 3235 |
__pyx_methods , |
| 3236 |
#if CYTHON_PEP489_MULTI_PHASE_INIT |
| 3237 |
__pyx_moduledef_slots, |
| 3238 |
#else |
| 3239 |
NULL, |
| 3240 |
#endif |
| 3241 |
#if CYTHON_USE_MODULE_STATE |
| 3242 |
__pyx_m_traverse, |
| 3243 |
__pyx_m_clear, |
| 3244 |
NULL |
| 3245 |
#else |
| 3246 |
NULL, |
| 3247 |
NULL, |
| 3248 |
NULL |
| 3249 |
#endif |
| 3250 |
}; |
| 3251 |
#ifdef __cplusplus |
| 3252 |
} |
| 3253 |
#endif |
| 3254 |
#endif |
| 3255 |
|
| 3256 |
#ifndef CYTHON_NO_PYINIT_EXPORT |
| 3257 |
#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC |
| 3258 |
#elif PY_MAJOR_VERSION < 3 |
| 3259 |
#ifdef __cplusplus |
| 3260 |
#define __Pyx_PyMODINIT_FUNC extern "C" void |
| 3261 |
#else |
| 3262 |
#define __Pyx_PyMODINIT_FUNC void |
| 3263 |
#endif |
| 3264 |
#else |
| 3265 |
#ifdef __cplusplus |
| 3266 |
#define __Pyx_PyMODINIT_FUNC extern "C" PyObject * |
| 3267 |
#else |
| 3268 |
#define __Pyx_PyMODINIT_FUNC PyObject * |
| 3269 |
#endif |
| 3270 |
#endif |
| 3271 |
|
| 3272 |
|
| 3273 |
#if PY_MAJOR_VERSION < 3 |
| 3274 |
__Pyx_PyMODINIT_FUNC inittest_async_gen_exception_04(void) CYTHON_SMALL_CODE; |
| 3275 |
__Pyx_PyMODINIT_FUNC inittest_async_gen_exception_04(void) |
| 3276 |
#else |
| 3277 |
__Pyx_PyMODINIT_FUNC PyInit_test_async_gen_exception_04(void) CYTHON_SMALL_CODE; |
| 3278 |
__Pyx_PyMODINIT_FUNC PyInit_test_async_gen_exception_04(void) |
| 3279 |
#if CYTHON_PEP489_MULTI_PHASE_INIT |
| 3280 |
{ |
| 3281 |
return PyModuleDef_Init(&__pyx_moduledef); |
| 3282 |
} |
| 3283 |
static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { |
| 3284 |
#if PY_VERSION_HEX >= 0x030700A1 |
| 3285 |
static PY_INT64_T main_interpreter_id = -1; |
| 3286 |
PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); |
| 3287 |
if (main_interpreter_id == -1) { |
| 3288 |
main_interpreter_id = current_id; |
| 3289 |
return (unlikely(current_id == -1)) ? -1 : 0; |
| 3290 |
} else if (unlikely(main_interpreter_id != current_id)) |
| 3291 |
#else |
| 3292 |
static PyInterpreterState *main_interpreter = NULL; |
| 3293 |
PyInterpreterState *current_interpreter = PyThreadState_Get()->interp; |
| 3294 |
if (!main_interpreter) { |
| 3295 |
main_interpreter = current_interpreter; |
| 3296 |
} else if (unlikely(main_interpreter != current_interpreter)) |
| 3297 |
#endif |
| 3298 |
{ |
| 3299 |
PyErr_SetString( |
| 3300 |
PyExc_ImportError, |
| 3301 |
"Interpreter change detected - this module can only be loaded into one interpreter per process."); |
| 3302 |
return -1; |
| 3303 |
} |
| 3304 |
return 0; |
| 3305 |
} |
| 3306 |
#if CYTHON_COMPILING_IN_LIMITED_API |
| 3307 |
static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *module, const char* from_name, const char* to_name, int allow_none) |
| 3308 |
#else |
| 3309 |
static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) |
| 3310 |
#endif |
| 3311 |
{ |
| 3312 |
PyObject *value = PyObject_GetAttrString(spec, from_name); |
| 3313 |
int result = 0; |
| 3314 |
if (likely(value)) { |
| 3315 |
if (allow_none || value != Py_None) { |
| 3316 |
#if CYTHON_COMPILING_IN_LIMITED_API |
| 3317 |
result = PyModule_AddObject(module, to_name, value); |
| 3318 |
#else |
| 3319 |
result = PyDict_SetItemString(moddict, to_name, value); |
| 3320 |
#endif |
| 3321 |
} |
| 3322 |
Py_DECREF(value); |
| 3323 |
} else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { |
| 3324 |
PyErr_Clear(); |
| 3325 |
} else { |
| 3326 |
result = -1; |
| 3327 |
} |
| 3328 |
return result; |
| 3329 |
} |
| 3330 |
static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) { |
| 3331 |
PyObject *module = NULL, *moddict, *modname; |
| 3332 |
CYTHON_UNUSED_VAR(def); |
| 3333 |
if (__Pyx_check_single_interpreter()) |
| 3334 |
return NULL; |
| 3335 |
if (__pyx_m) |
| 3336 |
return __Pyx_NewRef(__pyx_m); |
| 3337 |
modname = PyObject_GetAttrString(spec, "name"); |
| 3338 |
if (unlikely(!modname)) goto bad; |
| 3339 |
module = PyModule_NewObject(modname); |
| 3340 |
Py_DECREF(modname); |
| 3341 |
if (unlikely(!module)) goto bad; |
| 3342 |
#if CYTHON_COMPILING_IN_LIMITED_API |
| 3343 |
moddict = module; |
| 3344 |
#else |
| 3345 |
moddict = PyModule_GetDict(module); |
| 3346 |
if (unlikely(!moddict)) goto bad; |
| 3347 |
#endif |
| 3348 |
if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; |
| 3349 |
if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; |
| 3350 |
if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; |
| 3351 |
if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad; |
| 3352 |
return module; |
| 3353 |
bad: |
| 3354 |
Py_XDECREF(module); |
| 3355 |
return NULL; |
| 3356 |
} |
| 3357 |
|
| 3358 |
|
| 3359 |
static CYTHON_SMALL_CODE int __pyx_pymod_exec_test_async_gen_exception_04(PyObject *__pyx_pyinit_module) |
| 3360 |
#endif |
| 3361 |
#endif |
| 3362 |
{ |
| 3363 |
int stringtab_initialized = 0; |
| 3364 |
#if CYTHON_USE_MODULE_STATE |
| 3365 |
int pystate_addmodule_run = 0; |
| 3366 |
#endif |
| 3367 |
PyObject *__pyx_t_1 = NULL; |
| 3368 |
PyObject *__pyx_t_2 = NULL; |
| 3369 |
int __pyx_lineno = 0; |
| 3370 |
const char *__pyx_filename = NULL; |
| 3371 |
int __pyx_clineno = 0; |
| 3372 |
__Pyx_RefNannyDeclarations |
| 3373 |
#if CYTHON_PEP489_MULTI_PHASE_INIT |
| 3374 |
if (__pyx_m) { |
| 3375 |
if (__pyx_m == __pyx_pyinit_module) return 0; |
| 3376 |
PyErr_SetString(PyExc_RuntimeError, "Module 'test_async_gen_exception_04' has already been imported. Re-initialisation is not supported."); |
| 3377 |
return -1; |
| 3378 |
} |
| 3379 |
#elif PY_MAJOR_VERSION >= 3 |
| 3380 |
if (__pyx_m) return __Pyx_NewRef(__pyx_m); |
| 3381 |
#endif |
| 3382 |
|
| 3383 |
#if CYTHON_PEP489_MULTI_PHASE_INIT |
| 3384 |
__pyx_m = __pyx_pyinit_module; |
| 3385 |
Py_INCREF(__pyx_m); |
| 3386 |
#else |
| 3387 |
#if PY_MAJOR_VERSION < 3 |
| 3388 |
__pyx_m = Py_InitModule4("test_async_gen_exception_04", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); |
| 3389 |
if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) |
| 3390 |
#elif CYTHON_USE_MODULE_STATE |
| 3391 |
__pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) |
| 3392 |
{ |
| 3393 |
int add_module_result = PyState_AddModule(__pyx_t_1, &__pyx_moduledef); |
| 3394 |
__pyx_t_1 = 0; |
| 3395 |
if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error) |
| 3396 |
pystate_addmodule_run = 1; |
| 3397 |
} |
| 3398 |
#else |
| 3399 |
__pyx_m = PyModule_Create(&__pyx_moduledef); |
| 3400 |
if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) |
| 3401 |
#endif |
| 3402 |
#endif |
| 3403 |
CYTHON_UNUSED_VAR(__pyx_t_1); |
| 3404 |
__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) |
| 3405 |
Py_INCREF(__pyx_d); |
| 3406 |
__pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) |
| 3407 |
Py_INCREF(__pyx_b); |
| 3408 |
__pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) |
| 3409 |
Py_INCREF(__pyx_cython_runtime); |
| 3410 |
if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error) |
| 3411 |
#if CYTHON_REFNANNY |
| 3412 |
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); |
| 3413 |
if (!__Pyx_RefNanny) { |
| 3414 |
PyErr_Clear(); |
| 3415 |
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); |
| 3416 |
if (!__Pyx_RefNanny) |
| 3417 |
Py_FatalError("failed to import 'refnanny' module"); |
| 3418 |
} |
| 3419 |
#endif |
| 3420 |
__Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_test_async_gen_exception_04(void)", 0); |
| 3421 |
if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) |
| 3422 |
#ifdef __Pxy_PyFrame_Initialize_Offsets |
| 3423 |
__Pxy_PyFrame_Initialize_Offsets(); |
| 3424 |
#endif |
| 3425 |
__pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) |
| 3426 |
__pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) |
| 3427 |
__pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) |
| 3428 |
#ifdef __Pyx_CyFunction_USED |
| 3429 |
if (__pyx_CyFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) |
| 3430 |
#endif |
| 3431 |
#ifdef __Pyx_FusedFunction_USED |
| 3432 |
if (__pyx_FusedFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) |
| 3433 |
#endif |
| 3434 |
#ifdef __Pyx_Coroutine_USED |
| 3435 |
if (__pyx_Coroutine_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) |
| 3436 |
#endif |
| 3437 |
#ifdef __Pyx_Generator_USED |
| 3438 |
if (__pyx_Generator_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) |
| 3439 |
#endif |
| 3440 |
#ifdef __Pyx_AsyncGen_USED |
| 3441 |
if (__pyx_AsyncGen_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) |
| 3442 |
#endif |
| 3443 |
#ifdef __Pyx_StopAsyncIteration_USED |
| 3444 |
if (__pyx_StopAsyncIteration_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) |
| 3445 |
#endif |
| 3446 |
|
| 3447 |
|
| 3448 |
#if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS |
| 3449 |
PyEval_InitThreads(); |
| 3450 |
#endif |
| 3451 |
|
| 3452 |
if (__Pyx_InitConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) |
| 3453 |
stringtab_initialized = 1; |
| 3454 |
if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) |
| 3455 |
#if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) |
| 3456 |
if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) |
| 3457 |
#endif |
| 3458 |
if (__pyx_module_is_main_test_async_gen_exception_04) { |
| 3459 |
if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) |
| 3460 |
} |
| 3461 |
#if PY_MAJOR_VERSION >= 3 |
| 3462 |
{ |
| 3463 |
PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) |
| 3464 |
if (!PyDict_GetItemString(modules, "test_async_gen_exception_04")) { |
| 3465 |
if (unlikely((PyDict_SetItemString(modules, "test_async_gen_exception_04", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) |
| 3466 |
} |
| 3467 |
} |
| 3468 |
#endif |
| 3469 |
|
| 3470 |
if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) |
| 3471 |
|
| 3472 |
if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) |
| 3473 |
|
| 3474 |
(void)__Pyx_modinit_global_init_code(); |
| 3475 |
(void)__Pyx_modinit_variable_export_code(); |
| 3476 |
(void)__Pyx_modinit_function_export_code(); |
| 3477 |
if (unlikely((__Pyx_modinit_type_init_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error) |
| 3478 |
(void)__Pyx_modinit_type_import_code(); |
| 3479 |
(void)__Pyx_modinit_variable_import_code(); |
| 3480 |
(void)__Pyx_modinit_function_import_code(); |
| 3481 |
|
| 3482 |
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) |
| 3483 |
if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) |
| 3484 |
#endif |
| 3485 |
|
| 3486 |
|
| 3487 |
|
| 3488 |
|
| 3489 |
|
| 3490 |
|
| 3491 |
if (PyDict_SetItem(__pyx_d, __pyx_n_s_ZERO, __pyx_int_0) < 0) __PYX_ERR(0, 1, __pyx_L1_error) |
| 3492 |
|
| 3493 |
|
| 3494 |
|
| 3495 |
|
| 3496 |
|
| 3497 |
|
| 3498 |
|
| 3499 |
|
| 3500 |
__pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_27test_async_gen_exception_04_1gen, __Pyx_CYFUNCTION_COROUTINE, __pyx_n_s_gen, NULL, __pyx_n_s_test_async_gen_exception_04, __pyx_d, ((PyObject *)__pyx_codeobj_)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3, __pyx_L1_error) |
| 3501 |
__Pyx_GOTREF(__pyx_t_2); |
| 3502 |
if (PyDict_SetItem(__pyx_d, __pyx_n_s_gen, __pyx_t_2) < 0) __PYX_ERR(0, 3, __pyx_L1_error) |
| 3503 |
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 3504 |
|
| 3505 |
|
| 3506 |
|
| 3507 |
|
| 3508 |
|
| 3509 |
|
| 3510 |
|
| 3511 |
|
| 3512 |
__pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_27test_async_gen_exception_04_4test_last_yield, 0, __pyx_n_s_test_last_yield, NULL, __pyx_n_s_test_async_gen_exception_04, __pyx_d, ((PyObject *)__pyx_codeobj__3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 7, __pyx_L1_error) |
| 3513 |
__Pyx_GOTREF(__pyx_t_2); |
| 3514 |
if (PyDict_SetItem(__pyx_d, __pyx_n_s_test_last_yield, __pyx_t_2) < 0) __PYX_ERR(0, 7, __pyx_L1_error) |
| 3515 |
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 3516 |
|
| 3517 |
|
| 3518 |
|
| 3519 |
|
| 3520 |
|
| 3521 |
|
| 3522 |
__pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error) |
| 3523 |
__Pyx_GOTREF(__pyx_t_2); |
| 3524 |
if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error) |
| 3525 |
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; |
| 3526 |
|
| 3527 |
|
| 3528 |
|
| 3529 |
goto __pyx_L0; |
| 3530 |
__pyx_L1_error:; |
| 3531 |
__Pyx_XDECREF(__pyx_t_2); |
| 3532 |
if (__pyx_m) { |
| 3533 |
if (__pyx_d && stringtab_initialized) { |
| 3534 |
__Pyx_AddTraceback("init test_async_gen_exception_04", __pyx_clineno, __pyx_lineno, __pyx_filename); |
| 3535 |
} |
| 3536 |
#if !CYTHON_USE_MODULE_STATE |
| 3537 |
Py_CLEAR(__pyx_m); |
| 3538 |
#else |
| 3539 |
Py_DECREF(__pyx_m); |
| 3540 |
if (pystate_addmodule_run) { |
| 3541 |
PyObject *tp, *value, *tb; |
| 3542 |
PyErr_Fetch(&tp, &value, &tb); |
| 3543 |
PyState_RemoveModule(&__pyx_moduledef); |
| 3544 |
PyErr_Restore(tp, value, tb); |
| 3545 |
} |
| 3546 |
#endif |
| 3547 |
} else if (!PyErr_Occurred()) { |
| 3548 |
PyErr_SetString(PyExc_ImportError, "init test_async_gen_exception_04"); |
| 3549 |
} |
| 3550 |
__pyx_L0:; |
| 3551 |
__Pyx_RefNannyFinishContext(); |
| 3552 |
#if CYTHON_PEP489_MULTI_PHASE_INIT |
| 3553 |
return (__pyx_m != NULL) ? 0 : -1; |
| 3554 |
#elif PY_MAJOR_VERSION >= 3 |
| 3555 |
return __pyx_m; |
| 3556 |
#else |
| 3557 |
return; |
| 3558 |
#endif |
| 3559 |
} |
| 3560 |
|
| 3561 |
|
| 3562 |
|
| 3563 |
|
| 3564 |
#ifdef _MSC_VER |
| 3565 |
#pragma warning( push ) |
| 3566 |
|
| 3567 |
|
| 3568 |
|
| 3569 |
|
| 3570 |
#pragma warning( disable : 4127 ) |
| 3571 |
#endif |
| 3572 |
|
| 3573 |
|
| 3574 |
|
| 3575 |
|
| 3576 |
|
| 3577 |
|
| 3578 |
|
| 3579 |
#if CYTHON_REFNANNY |
| 3580 |
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { |
| 3581 |
PyObject *m = NULL, *p = NULL; |
| 3582 |
void *r = NULL; |
| 3583 |
m = PyImport_ImportModule(modname); |
| 3584 |
if (!m) goto end; |
| 3585 |
p = PyObject_GetAttrString(m, "RefNannyAPI"); |
| 3586 |
if (!p) goto end; |
| 3587 |
r = PyLong_AsVoidPtr(p); |
| 3588 |
end: |
| 3589 |
Py_XDECREF(p); |
| 3590 |
Py_XDECREF(m); |
| 3591 |
return (__Pyx_RefNannyAPIStruct *)r; |
| 3592 |
} |
| 3593 |
#endif |
| 3594 |
|
| 3595 |
|
| 3596 |
#if CYTHON_FAST_THREAD_STATE |
| 3597 |
static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { |
| 3598 |
Py_ssize_t i, n; |
| 3599 |
n = PyTuple_GET_SIZE(tuple); |
| 3600 |
#if PY_MAJOR_VERSION >= 3 |
| 3601 |
for (i=0; i<n; i++) { |
| 3602 |
if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1; |
| 3603 |
} |
| 3604 |
#endif |
| 3605 |
for (i=0; i<n; i++) { |
| 3606 |
if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1; |
| 3607 |
} |
| 3608 |
return 0; |
| 3609 |
} |
| 3610 |
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) { |
| 3611 |
PyObject *exc_type = tstate->curexc_type; |
| 3612 |
if (exc_type == err) return 1; |
| 3613 |
if (unlikely(!exc_type)) return 0; |
| 3614 |
if (unlikely(PyTuple_Check(err))) |
| 3615 |
return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); |
| 3616 |
return __Pyx_PyErr_GivenExceptionMatches(exc_type, err); |
| 3617 |
} |
| 3618 |
#endif |
| 3619 |
|
| 3620 |
|
| 3621 |
#if CYTHON_FAST_THREAD_STATE |
| 3622 |
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { |
| 3623 |
PyObject *tmp_type, *tmp_value, *tmp_tb; |
| 3624 |
tmp_type = tstate->curexc_type; |
| 3625 |
tmp_value = tstate->curexc_value; |
| 3626 |
tmp_tb = tstate->curexc_traceback; |
| 3627 |
tstate->curexc_type = type; |
| 3628 |
tstate->curexc_value = value; |
| 3629 |
tstate->curexc_traceback = tb; |
| 3630 |
Py_XDECREF(tmp_type); |
| 3631 |
Py_XDECREF(tmp_value); |
| 3632 |
Py_XDECREF(tmp_tb); |
| 3633 |
} |
| 3634 |
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { |
| 3635 |
*type = tstate->curexc_type; |
| 3636 |
*value = tstate->curexc_value; |
| 3637 |
*tb = tstate->curexc_traceback; |
| 3638 |
tstate->curexc_type = 0; |
| 3639 |
tstate->curexc_value = 0; |
| 3640 |
tstate->curexc_traceback = 0; |
| 3641 |
} |
| 3642 |
#endif |
| 3643 |
|
| 3644 |
|
| 3645 |
#if CYTHON_USE_TYPE_SLOTS |
| 3646 |
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { |
| 3647 |
PyTypeObject* tp = Py_TYPE(obj); |
| 3648 |
if (likely(tp->tp_getattro)) |
| 3649 |
return tp->tp_getattro(obj, attr_name); |
| 3650 |
#if PY_MAJOR_VERSION < 3 |
| 3651 |
if (likely(tp->tp_getattr)) |
| 3652 |
return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); |
| 3653 |
#endif |
| 3654 |
return PyObject_GetAttr(obj, attr_name); |
| 3655 |
} |
| 3656 |
#endif |
| 3657 |
|
| 3658 |
|
| 3659 |
static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { |
| 3660 |
__Pyx_PyThreadState_declare |
| 3661 |
__Pyx_PyThreadState_assign |
| 3662 |
if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) |
| 3663 |
__Pyx_PyErr_Clear(); |
| 3664 |
} |
| 3665 |
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { |
| 3666 |
PyObject *result; |
| 3667 |
#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 |
| 3668 |
PyTypeObject* tp = Py_TYPE(obj); |
| 3669 |
if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { |
| 3670 |
return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); |
| 3671 |
} |
| 3672 |
#endif |
| 3673 |
result = __Pyx_PyObject_GetAttrStr(obj, attr_name); |
| 3674 |
if (unlikely(!result)) { |
| 3675 |
__Pyx_PyObject_GetAttrStr_ClearAttributeError(); |
| 3676 |
} |
| 3677 |
return result; |
| 3678 |
} |
| 3679 |
|
| 3680 |
|
| 3681 |
static PyObject *__Pyx_GetBuiltinName(PyObject *name) { |
| 3682 |
PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_b, name); |
| 3683 |
if (unlikely(!result) && !PyErr_Occurred()) { |
| 3684 |
PyErr_Format(PyExc_NameError, |
| 3685 |
#if PY_MAJOR_VERSION >= 3 |
| 3686 |
"name '%U' is not defined", name); |
| 3687 |
#else |
| 3688 |
"name '%.200s' is not defined", PyString_AS_STRING(name)); |
| 3689 |
#endif |
| 3690 |
} |
| 3691 |
return result; |
| 3692 |
} |
| 3693 |
|
| 3694 |
|
| 3695 |
#if CYTHON_COMPILING_IN_CPYTHON |
| 3696 |
static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) { |
| 3697 |
PyObject *v; |
| 3698 |
Py_ssize_t i; |
| 3699 |
for (i = 0; i < length; i++) { |
| 3700 |
v = dest[i] = src[i]; |
| 3701 |
Py_INCREF(v); |
| 3702 |
} |
| 3703 |
} |
| 3704 |
static CYTHON_INLINE PyObject * |
| 3705 |
__Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n) |
| 3706 |
{ |
| 3707 |
PyObject *res; |
| 3708 |
if (n <= 0) { |
| 3709 |
Py_INCREF(__pyx_empty_tuple); |
| 3710 |
return __pyx_empty_tuple; |
| 3711 |
} |
| 3712 |
res = PyTuple_New(n); |
| 3713 |
if (unlikely(res == NULL)) return NULL; |
| 3714 |
__Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n); |
| 3715 |
return res; |
| 3716 |
} |
| 3717 |
static CYTHON_INLINE PyObject * |
| 3718 |
__Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n) |
| 3719 |
{ |
| 3720 |
PyObject *res; |
| 3721 |
if (n <= 0) { |
| 3722 |
return PyList_New(0); |
| 3723 |
} |
| 3724 |
res = PyList_New(n); |
| 3725 |
if (unlikely(res == NULL)) return NULL; |
| 3726 |
__Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n); |
| 3727 |
return res; |
| 3728 |
} |
| 3729 |
#endif |
| 3730 |
|
| 3731 |
|
| 3732 |
static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { |
| 3733 |
#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API |
| 3734 |
return PyObject_RichCompareBool(s1, s2, equals); |
| 3735 |
#else |
| 3736 |
if (s1 == s2) { |
| 3737 |
return (equals == Py_EQ); |
| 3738 |
} else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { |
| 3739 |
const char *ps1, *ps2; |
| 3740 |
Py_ssize_t length = PyBytes_GET_SIZE(s1); |
| 3741 |
if (length != PyBytes_GET_SIZE(s2)) |
| 3742 |
return (equals == Py_NE); |
| 3743 |
ps1 = PyBytes_AS_STRING(s1); |
| 3744 |
ps2 = PyBytes_AS_STRING(s2); |
| 3745 |
if (ps1[0] != ps2[0]) { |
| 3746 |
return (equals == Py_NE); |
| 3747 |
} else if (length == 1) { |
| 3748 |
return (equals == Py_EQ); |
| 3749 |
} else { |
| 3750 |
int result; |
| 3751 |
#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000) |
| 3752 |
Py_hash_t hash1, hash2; |
| 3753 |
hash1 = ((PyBytesObject*)s1)->ob_shash; |
| 3754 |
hash2 = ((PyBytesObject*)s2)->ob_shash; |
| 3755 |
if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { |
| 3756 |
return (equals == Py_NE); |
| 3757 |
} |
| 3758 |
#endif |
| 3759 |
result = memcmp(ps1, ps2, (size_t)length); |
| 3760 |
return (equals == Py_EQ) ? (result == 0) : (result != 0); |
| 3761 |
} |
| 3762 |
} else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { |
| 3763 |
return (equals == Py_NE); |
| 3764 |
} else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { |
| 3765 |
return (equals == Py_NE); |
| 3766 |
} else { |
| 3767 |
int result; |
| 3768 |
PyObject* py_result = PyObject_RichCompare(s1, s2, equals); |
| 3769 |
if (!py_result) |
| 3770 |
return -1; |
| 3771 |
result = __Pyx_PyObject_IsTrue(py_result); |
| 3772 |
Py_DECREF(py_result); |
| 3773 |
return result; |
| 3774 |
} |
| 3775 |
#endif |
| 3776 |
} |
| 3777 |
|
| 3778 |
|
| 3779 |
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { |
| 3780 |
#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API |
| 3781 |
return PyObject_RichCompareBool(s1, s2, equals); |
| 3782 |
#else |
| 3783 |
#if PY_MAJOR_VERSION < 3 |
| 3784 |
PyObject* owned_ref = NULL; |
| 3785 |
#endif |
| 3786 |
int s1_is_unicode, s2_is_unicode; |
| 3787 |
if (s1 == s2) { |
| 3788 |
goto return_eq; |
| 3789 |
} |
| 3790 |
s1_is_unicode = PyUnicode_CheckExact(s1); |
| 3791 |
s2_is_unicode = PyUnicode_CheckExact(s2); |
| 3792 |
#if PY_MAJOR_VERSION < 3 |
| 3793 |
if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) { |
| 3794 |
owned_ref = PyUnicode_FromObject(s2); |
| 3795 |
if (unlikely(!owned_ref)) |
| 3796 |
return -1; |
| 3797 |
s2 = owned_ref; |
| 3798 |
s2_is_unicode = 1; |
| 3799 |
} else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) { |
| 3800 |
owned_ref = PyUnicode_FromObject(s1); |
| 3801 |
if (unlikely(!owned_ref)) |
| 3802 |
return -1; |
| 3803 |
s1 = owned_ref; |
| 3804 |
s1_is_unicode = 1; |
| 3805 |
} else if (((!s2_is_unicode) & (!s1_is_unicode))) { |
| 3806 |
return __Pyx_PyBytes_Equals(s1, s2, equals); |
| 3807 |
} |
| 3808 |
#endif |
| 3809 |
if (s1_is_unicode & s2_is_unicode) { |
| 3810 |
Py_ssize_t length; |
| 3811 |
int kind; |
| 3812 |
void *data1, *data2; |
| 3813 |
if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) |
| 3814 |
return -1; |
| 3815 |
length = __Pyx_PyUnicode_GET_LENGTH(s1); |
| 3816 |
if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { |
| 3817 |
goto return_ne; |
| 3818 |
} |
| 3819 |
#if CYTHON_USE_UNICODE_INTERNALS |
| 3820 |
{ |
| 3821 |
Py_hash_t hash1, hash2; |
| 3822 |
#if CYTHON_PEP393_ENABLED |
| 3823 |
hash1 = ((PyASCIIObject*)s1)->hash; |
| 3824 |
hash2 = ((PyASCIIObject*)s2)->hash; |
| 3825 |
#else |
| 3826 |
hash1 = ((PyUnicodeObject*)s1)->hash; |
| 3827 |
hash2 = ((PyUnicodeObject*)s2)->hash; |
| 3828 |
#endif |
| 3829 |
if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { |
| 3830 |
goto return_ne; |
| 3831 |
} |
| 3832 |
} |
| 3833 |
#endif |
| 3834 |
kind = __Pyx_PyUnicode_KIND(s1); |
| 3835 |
if (kind != __Pyx_PyUnicode_KIND(s2)) { |
| 3836 |
goto return_ne; |
| 3837 |
} |
| 3838 |
data1 = __Pyx_PyUnicode_DATA(s1); |
| 3839 |
data2 = __Pyx_PyUnicode_DATA(s2); |
| 3840 |
if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { |
| 3841 |
goto return_ne; |
| 3842 |
} else if (length == 1) { |
| 3843 |
goto return_eq; |
| 3844 |
} else { |
| 3845 |
int result = memcmp(data1, data2, (size_t)(length * kind)); |
| 3846 |
#if PY_MAJOR_VERSION < 3 |
| 3847 |
Py_XDECREF(owned_ref); |
| 3848 |
#endif |
| 3849 |
return (equals == Py_EQ) ? (result == 0) : (result != 0); |
| 3850 |
} |
| 3851 |
} else if ((s1 == Py_None) & s2_is_unicode) { |
| 3852 |
goto return_ne; |
| 3853 |
} else if ((s2 == Py_None) & s1_is_unicode) { |
| 3854 |
goto return_ne; |
| 3855 |
} else { |
| 3856 |
int result; |
| 3857 |
PyObject* py_result = PyObject_RichCompare(s1, s2, equals); |
| 3858 |
#if PY_MAJOR_VERSION < 3 |
| 3859 |
Py_XDECREF(owned_ref); |
| 3860 |
#endif |
| 3861 |
if (!py_result) |
| 3862 |
return -1; |
| 3863 |
result = __Pyx_PyObject_IsTrue(py_result); |
| 3864 |
Py_DECREF(py_result); |
| 3865 |
return result; |
| 3866 |
} |
| 3867 |
return_eq: |
| 3868 |
#if PY_MAJOR_VERSION < 3 |
| 3869 |
Py_XDECREF(owned_ref); |
| 3870 |
#endif |
| 3871 |
return (equals == Py_EQ); |
| 3872 |
return_ne: |
| 3873 |
#if PY_MAJOR_VERSION < 3 |
| 3874 |
Py_XDECREF(owned_ref); |
| 3875 |
#endif |
| 3876 |
return (equals == Py_NE); |
| 3877 |
#endif |
| 3878 |
} |
| 3879 |
|
| 3880 |
|
| 3881 |
#if CYTHON_METH_FASTCALL |
| 3882 |
static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s) |
| 3883 |
{ |
| 3884 |
Py_ssize_t i, n = PyTuple_GET_SIZE(kwnames); |
| 3885 |
for (i = 0; i < n; i++) |
| 3886 |
{ |
| 3887 |
if (s == PyTuple_GET_ITEM(kwnames, i)) return kwvalues[i]; |
| 3888 |
} |
| 3889 |
for (i = 0; i < n; i++) |
| 3890 |
{ |
| 3891 |
int eq = __Pyx_PyUnicode_Equals(s, PyTuple_GET_ITEM(kwnames, i), Py_EQ); |
| 3892 |
if (unlikely(eq != 0)) { |
| 3893 |
if (unlikely(eq < 0)) return NULL; |
| 3894 |
return kwvalues[i]; |
| 3895 |
} |
| 3896 |
} |
| 3897 |
return NULL; |
| 3898 |
} |
| 3899 |
#endif |
| 3900 |
|
| 3901 |
|
| 3902 |
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS |
| 3903 |
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { |
| 3904 |
PyObject *dict = Py_TYPE(obj)->tp_dict; |
| 3905 |
return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; |
| 3906 |
} |
| 3907 |
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { |
| 3908 |
PyObject **dictptr = NULL; |
| 3909 |
Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; |
| 3910 |
if (offset) { |
| 3911 |
#if CYTHON_COMPILING_IN_CPYTHON |
| 3912 |
dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); |
| 3913 |
#else |
| 3914 |
dictptr = _PyObject_GetDictPtr(obj); |
| 3915 |
#endif |
| 3916 |
} |
| 3917 |
return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; |
| 3918 |
} |
| 3919 |
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { |
| 3920 |
PyObject *dict = Py_TYPE(obj)->tp_dict; |
| 3921 |
if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) |
| 3922 |
return 0; |
| 3923 |
return obj_dict_version == __Pyx_get_object_dict_version(obj); |
| 3924 |
} |
| 3925 |
#endif |
| 3926 |
|
| 3927 |
|
| 3928 |
#if CYTHON_USE_DICT_VERSIONS |
| 3929 |
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) |
| 3930 |
#else |
| 3931 |
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) |
| 3932 |
#endif |
| 3933 |
{ |
| 3934 |
PyObject *result; |
| 3935 |
#if !CYTHON_AVOID_BORROWED_REFS |
| 3936 |
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 |
| 3937 |
result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); |
| 3938 |
__PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) |
| 3939 |
if (likely(result)) { |
| 3940 |
return __Pyx_NewRef(result); |
| 3941 |
} else if (unlikely(PyErr_Occurred())) { |
| 3942 |
return NULL; |
| 3943 |
} |
| 3944 |
#elif CYTHON_COMPILING_IN_LIMITED_API |
| 3945 |
if (unlikely(!__pyx_m)) { |
| 3946 |
return NULL; |
| 3947 |
} |
| 3948 |
result = PyObject_GetAttr(__pyx_m, name); |
| 3949 |
if (likely(result)) { |
| 3950 |
return result; |
| 3951 |
} |
| 3952 |
#else |
| 3953 |
result = PyDict_GetItem(__pyx_d, name); |
| 3954 |
__PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) |
| 3955 |
if (likely(result)) { |
| 3956 |
return __Pyx_NewRef(result); |
| 3957 |
} |
| 3958 |
#endif |
| 3959 |
#else |
| 3960 |
result = PyObject_GetItem(__pyx_d, name); |
| 3961 |
__PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) |
| 3962 |
if (likely(result)) { |
| 3963 |
return __Pyx_NewRef(result); |
| 3964 |
} |
| 3965 |
PyErr_Clear(); |
| 3966 |
#endif |
| 3967 |
return __Pyx_GetBuiltinName(name); |
| 3968 |
} |
| 3969 |
|
| 3970 |
|
| 3971 |
#if PY_VERSION_HEX < 0x030500B1 |
| 3972 |
#if CYTHON_USE_TYPE_SPECS |
| 3973 |
#error Using async coroutines with type specs requires Python 3.5 or later. |
| 3974 |
#else |
| 3975 |
static PyTypeObject __Pyx__PyExc_StopAsyncIteration_type = { |
| 3976 |
PyVarObject_HEAD_INIT(0, 0) |
| 3977 |
"StopAsyncIteration", |
| 3978 |
sizeof(PyBaseExceptionObject), |
| 3979 |
0, |
| 3980 |
0, |
| 3981 |
0, |
| 3982 |
0, |
| 3983 |
0, |
| 3984 |
0, |
| 3985 |
0, |
| 3986 |
0, |
| 3987 |
0, |
| 3988 |
0, |
| 3989 |
0, |
| 3990 |
0, |
| 3991 |
0, |
| 3992 |
0, |
| 3993 |
0, |
| 3994 |
0, |
| 3995 |
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, |
| 3996 |
PyDoc_STR("Signal the end from iterator.__anext__()."), |
| 3997 |
0, |
| 3998 |
0, |
| 3999 |
0, |
| 4000 |
0, |
| 4001 |
0, |
| 4002 |
0, |
| 4003 |
0, |
| 4004 |
0, |
| 4005 |
0, |
| 4006 |
0, |
| 4007 |
0, |
| 4008 |
0, |
| 4009 |
0, |
| 4010 |
0, |
| 4011 |
0, |
| 4012 |
0, |
| 4013 |
0, |
| 4014 |
0, |
| 4015 |
0, |
| 4016 |
0, |
| 4017 |
0, |
| 4018 |
0, |
| 4019 |
0, |
| 4020 |
0, |
| 4021 |
0, |
| 4022 |
0, |
| 4023 |
#if PY_VERSION_HEX >= 0x030400a1 |
| 4024 |
0, |
| 4025 |
#endif |
| 4026 |
#if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000 |
| 4027 |
0, |
| 4028 |
#endif |
| 4029 |
}; |
| 4030 |
#endif |
| 4031 |
#endif |
| 4032 |
static int __pyx_StopAsyncIteration_init(PyObject *module) { |
| 4033 |
CYTHON_UNUSED_VAR(module); |
| 4034 |
#if PY_VERSION_HEX >= 0x030500B1 |
| 4035 |
__Pyx_PyExc_StopAsyncIteration = PyExc_StopAsyncIteration; |
| 4036 |
#else |
| 4037 |
PyObject *builtins = PyEval_GetBuiltins(); |
| 4038 |
if (likely(builtins)) { |
| 4039 |
PyObject *exc = PyMapping_GetItemString(builtins, (char*) "StopAsyncIteration"); |
| 4040 |
if (exc) { |
| 4041 |
__Pyx_PyExc_StopAsyncIteration = exc; |
| 4042 |
return 0; |
| 4043 |
} |
| 4044 |
} |
| 4045 |
PyErr_Clear(); |
| 4046 |
__Pyx__PyExc_StopAsyncIteration_type.tp_traverse = ((PyTypeObject*)PyExc_BaseException)->tp_traverse; |
| 4047 |
__Pyx__PyExc_StopAsyncIteration_type.tp_clear = ((PyTypeObject*)PyExc_BaseException)->tp_clear; |
| 4048 |
__Pyx__PyExc_StopAsyncIteration_type.tp_dictoffset = ((PyTypeObject*)PyExc_BaseException)->tp_dictoffset; |
| 4049 |
__Pyx__PyExc_StopAsyncIteration_type.tp_base = (PyTypeObject*)PyExc_Exception; |
| 4050 |
__Pyx_PyExc_StopAsyncIteration = (PyObject*) __Pyx_FetchCommonType(&__Pyx__PyExc_StopAsyncIteration_type); |
| 4051 |
if (unlikely(!__Pyx_PyExc_StopAsyncIteration)) |
| 4052 |
return -1; |
| 4053 |
if (likely(builtins) && unlikely(PyMapping_SetItemString(builtins, (char*) "StopAsyncIteration", __Pyx_PyExc_StopAsyncIteration) < 0)) |
| 4054 |
return -1; |
| 4055 |
#endif |
| 4056 |
return 0; |
| 4057 |
} |
| 4058 |
|
| 4059 |
|
| 4060 |
#if CYTHON_FAST_THREAD_STATE |
| 4061 |
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) |
| 4062 |
#else |
| 4063 |
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) |
| 4064 |
#endif |
| 4065 |
{ |
| 4066 |
PyObject *local_type, *local_value, *local_tb; |
| 4067 |
#if CYTHON_FAST_THREAD_STATE |
| 4068 |
PyObject *tmp_type, *tmp_value, *tmp_tb; |
| 4069 |
local_type = tstate->curexc_type; |
| 4070 |
local_value = tstate->curexc_value; |
| 4071 |
local_tb = tstate->curexc_traceback; |
| 4072 |
tstate->curexc_type = 0; |
| 4073 |
tstate->curexc_value = 0; |
| 4074 |
tstate->curexc_traceback = 0; |
| 4075 |
#else |
| 4076 |
PyErr_Fetch(&local_type, &local_value, &local_tb); |
| 4077 |
#endif |
| 4078 |
PyErr_NormalizeException(&local_type, &local_value, &local_tb); |
| 4079 |
#if CYTHON_FAST_THREAD_STATE |
| 4080 |
if (unlikely(tstate->curexc_type)) |
| 4081 |
#else |
| 4082 |
if (unlikely(PyErr_Occurred())) |
| 4083 |
#endif |
| 4084 |
goto bad; |
| 4085 |
#if PY_MAJOR_VERSION >= 3 |
| 4086 |
if (local_tb) { |
| 4087 |
if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) |
| 4088 |
goto bad; |
| 4089 |
} |
| 4090 |
#endif |
| 4091 |
Py_XINCREF(local_tb); |
| 4092 |
Py_XINCREF(local_type); |
| 4093 |
Py_XINCREF(local_value); |
| 4094 |
*type = local_type; |
| 4095 |
*value = local_value; |
| 4096 |
*tb = local_tb; |
| 4097 |
#if CYTHON_FAST_THREAD_STATE |
| 4098 |
#if CYTHON_USE_EXC_INFO_STACK |
| 4099 |
{ |
| 4100 |
_PyErr_StackItem *exc_info = tstate->exc_info; |
| 4101 |
#if PY_VERSION_HEX >= 0x030B00a4 |
| 4102 |
tmp_value = exc_info->exc_value; |
| 4103 |
exc_info->exc_value = local_value; |
| 4104 |
tmp_type = NULL; |
| 4105 |
tmp_tb = NULL; |
| 4106 |
Py_XDECREF(local_type); |
| 4107 |
Py_XDECREF(local_tb); |
| 4108 |
#else |
| 4109 |
tmp_type = exc_info->exc_type; |
| 4110 |
tmp_value = exc_info->exc_value; |
| 4111 |
tmp_tb = exc_info->exc_traceback; |
| 4112 |
exc_info->exc_type = local_type; |
| 4113 |
exc_info->exc_value = local_value; |
| 4114 |
exc_info->exc_traceback = local_tb; |
| 4115 |
#endif |
| 4116 |
} |
| 4117 |
#else |
| 4118 |
tmp_type = tstate->exc_type; |
| 4119 |
tmp_value = tstate->exc_value; |
| 4120 |
tmp_tb = tstate->exc_traceback; |
| 4121 |
tstate->exc_type = local_type; |
| 4122 |
tstate->exc_value = local_value; |
| 4123 |
tstate->exc_traceback = local_tb; |
| 4124 |
#endif |
| 4125 |
Py_XDECREF(tmp_type); |
| 4126 |
Py_XDECREF(tmp_value); |
| 4127 |
Py_XDECREF(tmp_tb); |
| 4128 |
#else |
| 4129 |
PyErr_SetExcInfo(local_type, local_value, local_tb); |
| 4130 |
#endif |
| 4131 |
return 0; |
| 4132 |
bad: |
| 4133 |
*type = 0; |
| 4134 |
*value = 0; |
| 4135 |
*tb = 0; |
| 4136 |
Py_XDECREF(local_type); |
| 4137 |
Py_XDECREF(local_value); |
| 4138 |
Py_XDECREF(local_tb); |
| 4139 |
return -1; |
| 4140 |
} |
| 4141 |
|
| 4142 |
|
| 4143 |
static void __Pyx_Generator_Replace_StopIteration(int in_async_gen) { |
| 4144 |
PyObject *exc, *val, *tb, *cur_exc; |
| 4145 |
__Pyx_PyThreadState_declare |
| 4146 |
#ifdef __Pyx_StopAsyncIteration_USED |
| 4147 |
int is_async_stopiteration = 0; |
| 4148 |
#endif |
| 4149 |
CYTHON_MAYBE_UNUSED_VAR(in_async_gen); |
| 4150 |
cur_exc = PyErr_Occurred(); |
| 4151 |
if (likely(!__Pyx_PyErr_GivenExceptionMatches(cur_exc, PyExc_StopIteration))) { |
| 4152 |
#ifdef __Pyx_StopAsyncIteration_USED |
| 4153 |
if (in_async_gen && unlikely(__Pyx_PyErr_GivenExceptionMatches(cur_exc, __Pyx_PyExc_StopAsyncIteration))) { |
| 4154 |
is_async_stopiteration = 1; |
| 4155 |
} else |
| 4156 |
#endif |
| 4157 |
return; |
| 4158 |
} |
| 4159 |
__Pyx_PyThreadState_assign |
| 4160 |
__Pyx_GetException(&exc, &val, &tb); |
| 4161 |
Py_XDECREF(exc); |
| 4162 |
Py_XDECREF(val); |
| 4163 |
Py_XDECREF(tb); |
| 4164 |
PyErr_SetString(PyExc_RuntimeError, |
| 4165 |
#ifdef __Pyx_StopAsyncIteration_USED |
| 4166 |
is_async_stopiteration ? "async generator raised StopAsyncIteration" : |
| 4167 |
in_async_gen ? "async generator raised StopIteration" : |
| 4168 |
#endif |
| 4169 |
"generator raised StopIteration"); |
| 4170 |
} |
| 4171 |
|
| 4172 |
|
| 4173 |
static void __Pyx_RaiseDoubleKeywordsError( |
| 4174 |
const char* func_name, |
| 4175 |
PyObject* kw_name) |
| 4176 |
{ |
| 4177 |
PyErr_Format(PyExc_TypeError, |
| 4178 |
#if PY_MAJOR_VERSION >= 3 |
| 4179 |
"%s() got multiple values for keyword argument '%U'", func_name, kw_name); |
| 4180 |
#else |
| 4181 |
"%s() got multiple values for keyword argument '%s'", func_name, |
| 4182 |
PyString_AsString(kw_name)); |
| 4183 |
#endif |
| 4184 |
} |
| 4185 |
|
| 4186 |
|
| 4187 |
static int __Pyx_ParseOptionalKeywords( |
| 4188 |
PyObject *kwds, |
| 4189 |
PyObject *const *kwvalues, |
| 4190 |
PyObject **argnames[], |
| 4191 |
PyObject *kwds2, |
| 4192 |
PyObject *values[], |
| 4193 |
Py_ssize_t num_pos_args, |
| 4194 |
const char* function_name) |
| 4195 |
{ |
| 4196 |
PyObject *key = 0, *value = 0; |
| 4197 |
Py_ssize_t pos = 0; |
| 4198 |
PyObject*** name; |
| 4199 |
PyObject*** first_kw_arg = argnames + num_pos_args; |
| 4200 |
int kwds_is_tuple = CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds)); |
| 4201 |
while (1) { |
| 4202 |
if (kwds_is_tuple) { |
| 4203 |
if (pos >= PyTuple_GET_SIZE(kwds)) break; |
| 4204 |
key = PyTuple_GET_ITEM(kwds, pos); |
| 4205 |
value = kwvalues[pos]; |
| 4206 |
pos++; |
| 4207 |
} |
| 4208 |
else |
| 4209 |
{ |
| 4210 |
if (!PyDict_Next(kwds, &pos, &key, &value)) break; |
| 4211 |
} |
| 4212 |
name = first_kw_arg; |
| 4213 |
while (*name && (**name != key)) name++; |
| 4214 |
if (*name) { |
| 4215 |
values[name-argnames] = value; |
| 4216 |
continue; |
| 4217 |
} |
| 4218 |
name = first_kw_arg; |
| 4219 |
#if PY_MAJOR_VERSION < 3 |
| 4220 |
if (likely(PyString_Check(key))) { |
| 4221 |
while (*name) { |
| 4222 |
if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) |
| 4223 |
&& _PyString_Eq(**name, key)) { |
| 4224 |
values[name-argnames] = value; |
| 4225 |
break; |
| 4226 |
} |
| 4227 |
name++; |
| 4228 |
} |
| 4229 |
if (*name) continue; |
| 4230 |
else { |
| 4231 |
PyObject*** argname = argnames; |
| 4232 |
while (argname != first_kw_arg) { |
| 4233 |
if ((**argname == key) || ( |
| 4234 |
(CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) |
| 4235 |
&& _PyString_Eq(**argname, key))) { |
| 4236 |
goto arg_passed_twice; |
| 4237 |
} |
| 4238 |
argname++; |
| 4239 |
} |
| 4240 |
} |
| 4241 |
} else |
| 4242 |
#endif |
| 4243 |
if (likely(PyUnicode_Check(key))) { |
| 4244 |
while (*name) { |
| 4245 |
int cmp = ( |
| 4246 |
#if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 |
| 4247 |
(__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : |
| 4248 |
#endif |
| 4249 |
PyUnicode_Compare(**name, key) |
| 4250 |
); |
| 4251 |
if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; |
| 4252 |
if (cmp == 0) { |
| 4253 |
values[name-argnames] = value; |
| 4254 |
break; |
| 4255 |
} |
| 4256 |
name++; |
| 4257 |
} |
| 4258 |
if (*name) continue; |
| 4259 |
else { |
| 4260 |
PyObject*** argname = argnames; |
| 4261 |
while (argname != first_kw_arg) { |
| 4262 |
int cmp = (**argname == key) ? 0 : |
| 4263 |
#if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 |
| 4264 |
(__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : |
| 4265 |
#endif |
| 4266 |
PyUnicode_Compare(**argname, key); |
| 4267 |
if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; |
| 4268 |
if (cmp == 0) goto arg_passed_twice; |
| 4269 |
argname++; |
| 4270 |
} |
| 4271 |
} |
| 4272 |
} else |
| 4273 |
goto invalid_keyword_type; |
| 4274 |
if (kwds2) { |
| 4275 |
if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; |
| 4276 |
} else { |
| 4277 |
goto invalid_keyword; |
| 4278 |
} |
| 4279 |
} |
| 4280 |
return 0; |
| 4281 |
arg_passed_twice: |
| 4282 |
__Pyx_RaiseDoubleKeywordsError(function_name, key); |
| 4283 |
goto bad; |
| 4284 |
invalid_keyword_type: |
| 4285 |
PyErr_Format(PyExc_TypeError, |
| 4286 |
"%.200s() keywords must be strings", function_name); |
| 4287 |
goto bad; |
| 4288 |
invalid_keyword: |
| 4289 |
#if PY_MAJOR_VERSION < 3 |
| 4290 |
PyErr_Format(PyExc_TypeError, |
| 4291 |
"%.200s() got an unexpected keyword argument '%.200s'", |
| 4292 |
function_name, PyString_AsString(key)); |
| 4293 |
#else |
| 4294 |
PyErr_Format(PyExc_TypeError, |
| 4295 |
"%s() got an unexpected keyword argument '%U'", |
| 4296 |
function_name, key); |
| 4297 |
#endif |
| 4298 |
bad: |
| 4299 |
return -1; |
| 4300 |
} |
| 4301 |
|
| 4302 |
|
| 4303 |
static void __Pyx_RaiseArgtupleInvalid( |
| 4304 |
const char* func_name, |
| 4305 |
int exact, |
| 4306 |
Py_ssize_t num_min, |
| 4307 |
Py_ssize_t num_max, |
| 4308 |
Py_ssize_t num_found) |
| 4309 |
{ |
| 4310 |
Py_ssize_t num_expected; |
| 4311 |
const char *more_or_less; |
| 4312 |
if (num_found < num_min) { |
| 4313 |
num_expected = num_min; |
| 4314 |
more_or_less = "at least"; |
| 4315 |
} else { |
| 4316 |
num_expected = num_max; |
| 4317 |
more_or_less = "at most"; |
| 4318 |
} |
| 4319 |
if (exact) { |
| 4320 |
more_or_less = "exactly"; |
| 4321 |
} |
| 4322 |
PyErr_Format(PyExc_TypeError, |
| 4323 |
"%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", |
| 4324 |
func_name, more_or_less, num_expected, |
| 4325 |
(num_expected == 1) ? "" : "s", num_found); |
| 4326 |
} |
| 4327 |
|
| 4328 |
|
| 4329 |
#if CYTHON_FAST_PYCALL && !CYTHON_VECTORCALL |
| 4330 |
static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, |
| 4331 |
PyObject *globals) { |
| 4332 |
PyFrameObject *f; |
| 4333 |
PyThreadState *tstate = __Pyx_PyThreadState_Current; |
| 4334 |
PyObject **fastlocals; |
| 4335 |
Py_ssize_t i; |
| 4336 |
PyObject *result; |
| 4337 |
assert(globals != NULL); |
| 4338 |
|
| 4339 |
|
| 4340 |
|
| 4341 |
|
| 4342 |
assert(tstate != NULL); |
| 4343 |
f = PyFrame_New(tstate, co, globals, NULL); |
| 4344 |
if (f == NULL) { |
| 4345 |
return NULL; |
| 4346 |
} |
| 4347 |
fastlocals = __Pyx_PyFrame_GetLocalsplus(f); |
| 4348 |
for (i = 0; i < na; i++) { |
| 4349 |
Py_INCREF(*args); |
| 4350 |
fastlocals[i] = *args++; |
| 4351 |
} |
| 4352 |
result = PyEval_EvalFrameEx(f,0); |
| 4353 |
++tstate->recursion_depth; |
| 4354 |
Py_DECREF(f); |
| 4355 |
--tstate->recursion_depth; |
| 4356 |
return result; |
| 4357 |
} |
| 4358 |
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) { |
| 4359 |
PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); |
| 4360 |
PyObject *globals = PyFunction_GET_GLOBALS(func); |
| 4361 |
PyObject *argdefs = PyFunction_GET_DEFAULTS(func); |
| 4362 |
PyObject *closure; |
| 4363 |
#if PY_MAJOR_VERSION >= 3 |
| 4364 |
PyObject *kwdefs; |
| 4365 |
#endif |
| 4366 |
PyObject *kwtuple, **k; |
| 4367 |
PyObject **d; |
| 4368 |
Py_ssize_t nd; |
| 4369 |
Py_ssize_t nk; |
| 4370 |
PyObject *result; |
| 4371 |
assert(kwargs == NULL || PyDict_Check(kwargs)); |
| 4372 |
nk = kwargs ? PyDict_Size(kwargs) : 0; |
| 4373 |
if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) { |
| 4374 |
return NULL; |
| 4375 |
} |
| 4376 |
if ( |
| 4377 |
#if PY_MAJOR_VERSION >= 3 |
| 4378 |
co->co_kwonlyargcount == 0 && |
| 4379 |
#endif |
| 4380 |
likely(kwargs == NULL || nk == 0) && |
| 4381 |
co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { |
| 4382 |
if (argdefs == NULL && co->co_argcount == nargs) { |
| 4383 |
result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); |
| 4384 |
goto done; |
| 4385 |
} |
| 4386 |
else if (nargs == 0 && argdefs != NULL |
| 4387 |
&& co->co_argcount == Py_SIZE(argdefs)) { |
| 4388 |
|
| 4389 |
|
| 4390 |
args = &PyTuple_GET_ITEM(argdefs, 0); |
| 4391 |
result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); |
| 4392 |
goto done; |
| 4393 |
} |
| 4394 |
} |
| 4395 |
if (kwargs != NULL) { |
| 4396 |
Py_ssize_t pos, i; |
| 4397 |
kwtuple = PyTuple_New(2 * nk); |
| 4398 |
if (kwtuple == NULL) { |
| 4399 |
result = NULL; |
| 4400 |
goto done; |
| 4401 |
} |
| 4402 |
k = &PyTuple_GET_ITEM(kwtuple, 0); |
| 4403 |
pos = i = 0; |
| 4404 |
while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { |
| 4405 |
Py_INCREF(k[i]); |
| 4406 |
Py_INCREF(k[i+1]); |
| 4407 |
i += 2; |
| 4408 |
} |
| 4409 |
nk = i / 2; |
| 4410 |
} |
| 4411 |
else { |
| 4412 |
kwtuple = NULL; |
| 4413 |
k = NULL; |
| 4414 |
} |
| 4415 |
closure = PyFunction_GET_CLOSURE(func); |
| 4416 |
#if PY_MAJOR_VERSION >= 3 |
| 4417 |
kwdefs = PyFunction_GET_KW_DEFAULTS(func); |
| 4418 |
#endif |
| 4419 |
if (argdefs != NULL) { |
| 4420 |
d = &PyTuple_GET_ITEM(argdefs, 0); |
| 4421 |
nd = Py_SIZE(argdefs); |
| 4422 |
} |
| 4423 |
else { |
| 4424 |
d = NULL; |
| 4425 |
nd = 0; |
| 4426 |
} |
| 4427 |
#if PY_MAJOR_VERSION >= 3 |
| 4428 |
result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, |
| 4429 |
args, (int)nargs, |
| 4430 |
k, (int)nk, |
| 4431 |
d, (int)nd, kwdefs, closure); |
| 4432 |
#else |
| 4433 |
result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, |
| 4434 |
args, (int)nargs, |
| 4435 |
k, (int)nk, |
| 4436 |
d, (int)nd, closure); |
| 4437 |
#endif |
| 4438 |
Py_XDECREF(kwtuple); |
| 4439 |
done: |
| 4440 |
Py_LeaveRecursiveCall(); |
| 4441 |
return result; |
| 4442 |
} |
| 4443 |
#endif |
| 4444 |
|
| 4445 |
|
| 4446 |
#if CYTHON_COMPILING_IN_CPYTHON |
| 4447 |
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { |
| 4448 |
PyObject *result; |
| 4449 |
ternaryfunc call = Py_TYPE(func)->tp_call; |
| 4450 |
if (unlikely(!call)) |
| 4451 |
return PyObject_Call(func, arg, kw); |
| 4452 |
if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) |
| 4453 |
return NULL; |
| 4454 |
result = (*call)(func, arg, kw); |
| 4455 |
Py_LeaveRecursiveCall(); |
| 4456 |
if (unlikely(!result) && unlikely(!PyErr_Occurred())) { |
| 4457 |
PyErr_SetString( |
| 4458 |
PyExc_SystemError, |
| 4459 |
"NULL result without error in PyObject_Call"); |
| 4460 |
} |
| 4461 |
return result; |
| 4462 |
} |
| 4463 |
#endif |
| 4464 |
|
| 4465 |
|
| 4466 |
#if CYTHON_COMPILING_IN_CPYTHON |
| 4467 |
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { |
| 4468 |
PyObject *self, *result; |
| 4469 |
PyCFunction cfunc; |
| 4470 |
cfunc = PyCFunction_GET_FUNCTION(func); |
| 4471 |
self = PyCFunction_GET_SELF(func); |
| 4472 |
if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) |
| 4473 |
return NULL; |
| 4474 |
result = cfunc(self, arg); |
| 4475 |
Py_LeaveRecursiveCall(); |
| 4476 |
if (unlikely(!result) && unlikely(!PyErr_Occurred())) { |
| 4477 |
PyErr_SetString( |
| 4478 |
PyExc_SystemError, |
| 4479 |
"NULL result without error in PyObject_Call"); |
| 4480 |
} |
| 4481 |
return result; |
| 4482 |
} |
| 4483 |
#endif |
| 4484 |
|
| 4485 |
|
| 4486 |
static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs) { |
| 4487 |
PyObject *argstuple; |
| 4488 |
PyObject *result; |
| 4489 |
size_t i; |
| 4490 |
argstuple = PyTuple_New((Py_ssize_t)nargs); |
| 4491 |
if (unlikely(!argstuple)) return NULL; |
| 4492 |
for (i = 0; i < nargs; i++) { |
| 4493 |
Py_INCREF(args[i]); |
| 4494 |
PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]); |
| 4495 |
} |
| 4496 |
result = __Pyx_PyObject_Call(func, argstuple, kwargs); |
| 4497 |
Py_DECREF(argstuple); |
| 4498 |
return result; |
| 4499 |
} |
| 4500 |
static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t _nargs, PyObject *kwargs) { |
| 4501 |
Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs); |
| 4502 |
#if CYTHON_COMPILING_IN_CPYTHON |
| 4503 |
if (nargs == 0 && kwargs == NULL) { |
| 4504 |
#if defined(__Pyx_CyFunction_USED) && defined(NDEBUG) |
| 4505 |
if (__Pyx_IsCyOrPyCFunction(func)) |
| 4506 |
#else |
| 4507 |
if (PyCFunction_Check(func)) |
| 4508 |
#endif |
| 4509 |
{ |
| 4510 |
if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { |
| 4511 |
return __Pyx_PyObject_CallMethO(func, NULL); |
| 4512 |
} |
| 4513 |
} |
| 4514 |
} |
| 4515 |
else if (nargs == 1 && kwargs == NULL) { |
| 4516 |
if (PyCFunction_Check(func)) |
| 4517 |
{ |
| 4518 |
if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { |
| 4519 |
return __Pyx_PyObject_CallMethO(func, args[0]); |
| 4520 |
} |
| 4521 |
} |
| 4522 |
} |
| 4523 |
#endif |
| 4524 |
#if PY_VERSION_HEX < 0x030800B1 |
| 4525 |
#if CYTHON_FAST_PYCCALL |
| 4526 |
if (PyCFunction_Check(func)) { |
| 4527 |
if (kwargs) { |
| 4528 |
return _PyCFunction_FastCallDict(func, args, nargs, kwargs); |
| 4529 |
} else { |
| 4530 |
return _PyCFunction_FastCallKeywords(func, args, nargs, NULL); |
| 4531 |
} |
| 4532 |
} |
| 4533 |
#if PY_VERSION_HEX >= 0x030700A1 |
| 4534 |
if (!kwargs && __Pyx_IS_TYPE(func, &PyMethodDescr_Type)) { |
| 4535 |
return _PyMethodDescr_FastCallKeywords(func, args, nargs, NULL); |
| 4536 |
} |
| 4537 |
#endif |
| 4538 |
#endif |
| 4539 |
#if CYTHON_FAST_PYCALL |
| 4540 |
if (PyFunction_Check(func)) { |
| 4541 |
return __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs); |
| 4542 |
} |
| 4543 |
#endif |
| 4544 |
#endif |
| 4545 |
#if CYTHON_VECTORCALL |
| 4546 |
vectorcallfunc f = _PyVectorcall_Function(func); |
| 4547 |
if (f) { |
| 4548 |
return f(func, args, (size_t)nargs, kwargs); |
| 4549 |
} |
| 4550 |
#elif defined(__Pyx_CyFunction_USED) && CYTHON_BACKPORT_VECTORCALL |
| 4551 |
if (__Pyx_CyFunction_CheckExact(func)) { |
| 4552 |
__pyx_vectorcallfunc f = __Pyx_CyFunction_func_vectorcall(func); |
| 4553 |
if (f) return f(func, args, (size_t)nargs, kwargs); |
| 4554 |
} |
| 4555 |
#endif |
| 4556 |
if (nargs == 0) { |
| 4557 |
return __Pyx_PyObject_Call(func, __pyx_empty_tuple, kwargs); |
| 4558 |
} |
| 4559 |
return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs); |
| 4560 |
} |
| 4561 |
|
| 4562 |
|
| 4563 |
static PyObject *__Pyx_PyIter_Next2Default(PyObject* defval) { |
| 4564 |
PyObject* exc_type; |
| 4565 |
__Pyx_PyThreadState_declare |
| 4566 |
__Pyx_PyThreadState_assign |
| 4567 |
exc_type = __Pyx_PyErr_Occurred(); |
| 4568 |
if (unlikely(exc_type)) { |
| 4569 |
if (!defval || unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) |
| 4570 |
return NULL; |
| 4571 |
__Pyx_PyErr_Clear(); |
| 4572 |
Py_INCREF(defval); |
| 4573 |
return defval; |
| 4574 |
} |
| 4575 |
if (defval) { |
| 4576 |
Py_INCREF(defval); |
| 4577 |
return defval; |
| 4578 |
} |
| 4579 |
__Pyx_PyErr_SetNone(PyExc_StopIteration); |
| 4580 |
return NULL; |
| 4581 |
} |
| 4582 |
static void __Pyx_PyIter_Next_ErrorNoIterator(PyObject *iterator) { |
| 4583 |
__Pyx_TypeName iterator_type_name = __Pyx_PyType_GetName(Py_TYPE(iterator)); |
| 4584 |
PyErr_Format(PyExc_TypeError, |
| 4585 |
__Pyx_FMT_TYPENAME " object is not an iterator", iterator_type_name); |
| 4586 |
__Pyx_DECREF_TypeName(iterator_type_name); |
| 4587 |
} |
| 4588 |
static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject* iterator, PyObject* defval) { |
| 4589 |
PyObject* next; |
| 4590 |
iternextfunc iternext = Py_TYPE(iterator)->tp_iternext; |
| 4591 |
if (likely(iternext)) { |
| 4592 |
#if 1 || CYTHON_USE_TYPE_SLOTS |
| 4593 |
next = iternext(iterator); |
| 4594 |
if (likely(next)) |
| 4595 |
return next; |
| 4596 |
#ifndef PYPY_VERSION |
| 4597 |
if (unlikely(iternext == &_PyObject_NextNotImplemented)) |
| 4598 |
return NULL; |
| 4599 |
#endif |
| 4600 |
#else |
| 4601 |
next = PyIter_Next(iterator); |
| 4602 |
if (likely(next)) |
| 4603 |
return next; |
| 4604 |
#endif |
| 4605 |
} else if (CYTHON_USE_TYPE_SLOTS || unlikely(!PyIter_Check(iterator))) { |
| 4606 |
__Pyx_PyIter_Next_ErrorNoIterator(iterator); |
| 4607 |
return NULL; |
| 4608 |
} |
| 4609 |
#if !CYTHON_USE_TYPE_SLOTS |
| 4610 |
else { |
| 4611 |
next = PyIter_Next(iterator); |
| 4612 |
if (likely(next)) |
| 4613 |
return next; |
| 4614 |
} |
| 4615 |
#endif |
| 4616 |
return __Pyx_PyIter_Next2Default(defval); |
| 4617 |
} |
| 4618 |
|
| 4619 |
|
| 4620 |
#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE |
| 4621 |
static _PyErr_StackItem * |
| 4622 |
__Pyx_PyErr_GetTopmostException(PyThreadState *tstate) |
| 4623 |
{ |
| 4624 |
_PyErr_StackItem *exc_info = tstate->exc_info; |
| 4625 |
while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) && |
| 4626 |
exc_info->previous_item != NULL) |
| 4627 |
{ |
| 4628 |
exc_info = exc_info->previous_item; |
| 4629 |
} |
| 4630 |
return exc_info; |
| 4631 |
} |
| 4632 |
#endif |
| 4633 |
|
| 4634 |
|
| 4635 |
#if CYTHON_FAST_THREAD_STATE |
| 4636 |
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { |
| 4637 |
#if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 |
| 4638 |
_PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); |
| 4639 |
PyObject *exc_value = exc_info->exc_value; |
| 4640 |
if (exc_value == NULL || exc_value == Py_None) { |
| 4641 |
*value = NULL; |
| 4642 |
*type = NULL; |
| 4643 |
*tb = NULL; |
| 4644 |
} else { |
| 4645 |
*value = exc_value; |
| 4646 |
Py_INCREF(*value); |
| 4647 |
*type = (PyObject*) Py_TYPE(exc_value); |
| 4648 |
Py_INCREF(*type); |
| 4649 |
*tb = PyException_GetTraceback(exc_value); |
| 4650 |
} |
| 4651 |
#elif CYTHON_USE_EXC_INFO_STACK |
| 4652 |
_PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); |
| 4653 |
*type = exc_info->exc_type; |
| 4654 |
*value = exc_info->exc_value; |
| 4655 |
*tb = exc_info->exc_traceback; |
| 4656 |
Py_XINCREF(*type); |
| 4657 |
Py_XINCREF(*value); |
| 4658 |
Py_XINCREF(*tb); |
| 4659 |
#else |
| 4660 |
*type = tstate->exc_type; |
| 4661 |
*value = tstate->exc_value; |
| 4662 |
*tb = tstate->exc_traceback; |
| 4663 |
Py_XINCREF(*type); |
| 4664 |
Py_XINCREF(*value); |
| 4665 |
Py_XINCREF(*tb); |
| 4666 |
#endif |
| 4667 |
} |
| 4668 |
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { |
| 4669 |
#if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 |
| 4670 |
_PyErr_StackItem *exc_info = tstate->exc_info; |
| 4671 |
PyObject *tmp_value = exc_info->exc_value; |
| 4672 |
exc_info->exc_value = value; |
| 4673 |
Py_XDECREF(tmp_value); |
| 4674 |
Py_XDECREF(type); |
| 4675 |
Py_XDECREF(tb); |
| 4676 |
#else |
| 4677 |
PyObject *tmp_type, *tmp_value, *tmp_tb; |
| 4678 |
#if CYTHON_USE_EXC_INFO_STACK |
| 4679 |
_PyErr_StackItem *exc_info = tstate->exc_info; |
| 4680 |
tmp_type = exc_info->exc_type; |
| 4681 |
tmp_value = exc_info->exc_value; |
| 4682 |
tmp_tb = exc_info->exc_traceback; |
| 4683 |
exc_info->exc_type = type; |
| 4684 |
exc_info->exc_value = value; |
| 4685 |
exc_info->exc_traceback = tb; |
| 4686 |
#else |
| 4687 |
tmp_type = tstate->exc_type; |
| 4688 |
tmp_value = tstate->exc_value; |
| 4689 |
tmp_tb = tstate->exc_traceback; |
| 4690 |
tstate->exc_type = type; |
| 4691 |
tstate->exc_value = value; |
| 4692 |
tstate->exc_traceback = tb; |
| 4693 |
#endif |
| 4694 |
Py_XDECREF(tmp_type); |
| 4695 |
Py_XDECREF(tmp_value); |
| 4696 |
Py_XDECREF(tmp_tb); |
| 4697 |
#endif |
| 4698 |
} |
| 4699 |
#endif |
| 4700 |
|
| 4701 |
|
| 4702 |
static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { |
| 4703 |
PyObject *r; |
| 4704 |
if (unlikely(!j)) return NULL; |
| 4705 |
r = PyObject_GetItem(o, j); |
| 4706 |
Py_DECREF(j); |
| 4707 |
return r; |
| 4708 |
} |
| 4709 |
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, |
| 4710 |
CYTHON_NCP_UNUSED int wraparound, |
| 4711 |
CYTHON_NCP_UNUSED int boundscheck) { |
| 4712 |
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS |
| 4713 |
Py_ssize_t wrapped_i = i; |
| 4714 |
if (wraparound & unlikely(i < 0)) { |
| 4715 |
wrapped_i += PyList_GET_SIZE(o); |
| 4716 |
} |
| 4717 |
if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) { |
| 4718 |
PyObject *r = PyList_GET_ITEM(o, wrapped_i); |
| 4719 |
Py_INCREF(r); |
| 4720 |
return r; |
| 4721 |
} |
| 4722 |
return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); |
| 4723 |
#else |
| 4724 |
return PySequence_GetItem(o, i); |
| 4725 |
#endif |
| 4726 |
} |
| 4727 |
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, |
| 4728 |
CYTHON_NCP_UNUSED int wraparound, |
| 4729 |
CYTHON_NCP_UNUSED int boundscheck) { |
| 4730 |
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS |
| 4731 |
Py_ssize_t wrapped_i = i; |
| 4732 |
if (wraparound & unlikely(i < 0)) { |
| 4733 |
wrapped_i += PyTuple_GET_SIZE(o); |
| 4734 |
} |
| 4735 |
if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) { |
| 4736 |
PyObject *r = PyTuple_GET_ITEM(o, wrapped_i); |
| 4737 |
Py_INCREF(r); |
| 4738 |
return r; |
| 4739 |
} |
| 4740 |
return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); |
| 4741 |
#else |
| 4742 |
return PySequence_GetItem(o, i); |
| 4743 |
#endif |
| 4744 |
} |
| 4745 |
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, |
| 4746 |
CYTHON_NCP_UNUSED int wraparound, |
| 4747 |
CYTHON_NCP_UNUSED int boundscheck) { |
| 4748 |
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS |
| 4749 |
if (is_list || PyList_CheckExact(o)) { |
| 4750 |
Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); |
| 4751 |
if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) { |
| 4752 |
PyObject *r = PyList_GET_ITEM(o, n); |
| 4753 |
Py_INCREF(r); |
| 4754 |
return r; |
| 4755 |
} |
| 4756 |
} |
| 4757 |
else if (PyTuple_CheckExact(o)) { |
| 4758 |
Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); |
| 4759 |
if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) { |
| 4760 |
PyObject *r = PyTuple_GET_ITEM(o, n); |
| 4761 |
Py_INCREF(r); |
| 4762 |
return r; |
| 4763 |
} |
| 4764 |
} else { |
| 4765 |
PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping; |
| 4766 |
PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence; |
| 4767 |
if (mm && mm->mp_subscript) { |
| 4768 |
PyObject *r, *key = PyInt_FromSsize_t(i); |
| 4769 |
if (unlikely(!key)) return NULL; |
| 4770 |
r = mm->mp_subscript(o, key); |
| 4771 |
Py_DECREF(key); |
| 4772 |
return r; |
| 4773 |
} |
| 4774 |
if (likely(sm && sm->sq_item)) { |
| 4775 |
if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) { |
| 4776 |
Py_ssize_t l = sm->sq_length(o); |
| 4777 |
if (likely(l >= 0)) { |
| 4778 |
i += l; |
| 4779 |
} else { |
| 4780 |
if (!PyErr_ExceptionMatches(PyExc_OverflowError)) |
| 4781 |
return NULL; |
| 4782 |
PyErr_Clear(); |
| 4783 |
} |
| 4784 |
} |
| 4785 |
return sm->sq_item(o, i); |
| 4786 |
} |
| 4787 |
} |
| 4788 |
#else |
| 4789 |
if (is_list || PySequence_Check(o)) { |
| 4790 |
return PySequence_GetItem(o, i); |
| 4791 |
} |
| 4792 |
#endif |
| 4793 |
return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); |
| 4794 |
} |
| 4795 |
|
| 4796 |
|
| 4797 |
#if CYTHON_FAST_THREAD_STATE |
| 4798 |
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { |
| 4799 |
PyObject *tmp_type, *tmp_value, *tmp_tb; |
| 4800 |
#if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4 |
| 4801 |
_PyErr_StackItem *exc_info = tstate->exc_info; |
| 4802 |
tmp_value = exc_info->exc_value; |
| 4803 |
exc_info->exc_value = *value; |
| 4804 |
if (tmp_value == NULL || tmp_value == Py_None) { |
| 4805 |
Py_XDECREF(tmp_value); |
| 4806 |
tmp_value = NULL; |
| 4807 |
tmp_type = NULL; |
| 4808 |
tmp_tb = NULL; |
| 4809 |
} else { |
| 4810 |
tmp_type = (PyObject*) Py_TYPE(tmp_value); |
| 4811 |
Py_INCREF(tmp_type); |
| 4812 |
tmp_tb = PyException_GetTraceback(tmp_value); |
| 4813 |
} |
| 4814 |
#elif CYTHON_USE_EXC_INFO_STACK |
| 4815 |
_PyErr_StackItem *exc_info = tstate->exc_info; |
| 4816 |
tmp_type = exc_info->exc_type; |
| 4817 |
tmp_value = exc_info->exc_value; |
| 4818 |
tmp_tb = exc_info->exc_traceback; |
| 4819 |
exc_info->exc_type = *type; |
| 4820 |
exc_info->exc_value = *value; |
| 4821 |
exc_info->exc_traceback = *tb; |
| 4822 |
#else |
| 4823 |
tmp_type = tstate->exc_type; |
| 4824 |
tmp_value = tstate->exc_value; |
| 4825 |
tmp_tb = tstate->exc_traceback; |
| 4826 |
tstate->exc_type = *type; |
| 4827 |
tstate->exc_value = *value; |
| 4828 |
tstate->exc_traceback = *tb; |
| 4829 |
#endif |
| 4830 |
*type = tmp_type; |
| 4831 |
*value = tmp_value; |
| 4832 |
*tb = tmp_tb; |
| 4833 |
} |
| 4834 |
#else |
| 4835 |
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) { |
| 4836 |
PyObject *tmp_type, *tmp_value, *tmp_tb; |
| 4837 |
PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb); |
| 4838 |
PyErr_SetExcInfo(*type, *value, *tb); |
| 4839 |
*type = tmp_type; |
| 4840 |
*value = tmp_value; |
| 4841 |
*tb = tmp_tb; |
| 4842 |
} |
| 4843 |
#endif |
| 4844 |
|
| 4845 |
|
| 4846 |
#if CYTHON_USE_TYPE_SPECS |
| 4847 |
static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) { |
| 4848 |
#if PY_VERSION_HEX > 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API |
| 4849 |
CYTHON_UNUSED_VAR(spec); |
| 4850 |
CYTHON_UNUSED_VAR(type); |
| 4851 |
#else |
| 4852 |
const PyType_Slot *slot = spec->slots; |
| 4853 |
while (slot && slot->slot && slot->slot != Py_tp_members) |
| 4854 |
slot++; |
| 4855 |
if (slot && slot->slot == Py_tp_members) { |
| 4856 |
int changed = 0; |
| 4857 |
#if !(PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON) |
| 4858 |
const |
| 4859 |
#endif |
| 4860 |
PyMemberDef *memb = (PyMemberDef*) slot->pfunc; |
| 4861 |
while (memb && memb->name) { |
| 4862 |
if (memb->name[0] == '_' && memb->name[1] == '_') { |
| 4863 |
#if PY_VERSION_HEX < 0x030900b1 |
| 4864 |
if (strcmp(memb->name, "__weaklistoffset__") == 0) { |
| 4865 |
assert(memb->type == T_PYSSIZET); |
| 4866 |
assert(memb->flags == READONLY); |
| 4867 |
type->tp_weaklistoffset = memb->offset; |
| 4868 |
changed = 1; |
| 4869 |
} |
| 4870 |
else if (strcmp(memb->name, "__dictoffset__") == 0) { |
| 4871 |
assert(memb->type == T_PYSSIZET); |
| 4872 |
assert(memb->flags == READONLY); |
| 4873 |
type->tp_dictoffset = memb->offset; |
| 4874 |
changed = 1; |
| 4875 |
} |
| 4876 |
#if CYTHON_METH_FASTCALL |
| 4877 |
else if (strcmp(memb->name, "__vectorcalloffset__") == 0) { |
| 4878 |
assert(memb->type == T_PYSSIZET); |
| 4879 |
assert(memb->flags == READONLY); |
| 4880 |
#if PY_VERSION_HEX >= 0x030800b4 |
| 4881 |
type->tp_vectorcall_offset = memb->offset; |
| 4882 |
#else |
| 4883 |
type->tp_print = (printfunc) memb->offset; |
| 4884 |
#endif |
| 4885 |
changed = 1; |
| 4886 |
} |
| 4887 |
#endif |
| 4888 |
#else |
| 4889 |
if ((0)); |
| 4890 |
#endif |
| 4891 |
#if PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON |
| 4892 |
else if (strcmp(memb->name, "__module__") == 0) { |
| 4893 |
PyObject *descr; |
| 4894 |
assert(memb->type == T_OBJECT); |
| 4895 |
assert(memb->flags == 0 || memb->flags == READONLY); |
| 4896 |
descr = PyDescr_NewMember(type, memb); |
| 4897 |
if (unlikely(!descr)) |
| 4898 |
return -1; |
| 4899 |
if (unlikely(PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr) < 0)) { |
| 4900 |
Py_DECREF(descr); |
| 4901 |
return -1; |
| 4902 |
} |
| 4903 |
Py_DECREF(descr); |
| 4904 |
changed = 1; |
| 4905 |
} |
| 4906 |
#endif |
| 4907 |
} |
| 4908 |
memb++; |
| 4909 |
} |
| 4910 |
if (changed) |
| 4911 |
PyType_Modified(type); |
| 4912 |
} |
| 4913 |
#endif |
| 4914 |
return 0; |
| 4915 |
} |
| 4916 |
#endif |
| 4917 |
|
| 4918 |
|
| 4919 |
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { |
| 4920 |
PyObject *arg = NULL; |
| 4921 |
return __Pyx_PyObject_FastCall(func, (&arg)+1, 0 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); |
| 4922 |
} |
| 4923 |
|
| 4924 |
|
| 4925 |
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { |
| 4926 |
PyObject *args[2] = {NULL, arg}; |
| 4927 |
return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); |
| 4928 |
} |
| 4929 |
|
| 4930 |
|
| 4931 |
static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) { |
| 4932 |
PyObject *attr; |
| 4933 |
#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP |
| 4934 |
__Pyx_TypeName type_name; |
| 4935 |
PyTypeObject *tp = Py_TYPE(obj); |
| 4936 |
PyObject *descr; |
| 4937 |
descrgetfunc f = NULL; |
| 4938 |
PyObject **dictptr, *dict; |
| 4939 |
int meth_found = 0; |
| 4940 |
assert (*method == NULL); |
| 4941 |
if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) { |
| 4942 |
attr = __Pyx_PyObject_GetAttrStr(obj, name); |
| 4943 |
goto try_unpack; |
| 4944 |
} |
| 4945 |
if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) { |
| 4946 |
return 0; |
| 4947 |
} |
| 4948 |
descr = _PyType_Lookup(tp, name); |
| 4949 |
if (likely(descr != NULL)) { |
| 4950 |
Py_INCREF(descr); |
| 4951 |
#if defined(Py_TPFLAGS_METHOD_DESCRIPTOR) && Py_TPFLAGS_METHOD_DESCRIPTOR |
| 4952 |
if (__Pyx_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR)) |
| 4953 |
#elif PY_MAJOR_VERSION >= 3 |
| 4954 |
#ifdef __Pyx_CyFunction_USED |
| 4955 |
if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr))) |
| 4956 |
#else |
| 4957 |
if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type))) |
| 4958 |
#endif |
| 4959 |
#else |
| 4960 |
#ifdef __Pyx_CyFunction_USED |
| 4961 |
if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr))) |
| 4962 |
#else |
| 4963 |
if (likely(PyFunction_Check(descr))) |
| 4964 |
#endif |
| 4965 |
#endif |
| 4966 |
{ |
| 4967 |
meth_found = 1; |
| 4968 |
} else { |
| 4969 |
f = Py_TYPE(descr)->tp_descr_get; |
| 4970 |
if (f != NULL && PyDescr_IsData(descr)) { |
| 4971 |
attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); |
| 4972 |
Py_DECREF(descr); |
| 4973 |
goto try_unpack; |
| 4974 |
} |
| 4975 |
} |
| 4976 |
} |
| 4977 |
dictptr = _PyObject_GetDictPtr(obj); |
| 4978 |
if (dictptr != NULL && (dict = *dictptr) != NULL) { |
| 4979 |
Py_INCREF(dict); |
| 4980 |
attr = __Pyx_PyDict_GetItemStr(dict, name); |
| 4981 |
if (attr != NULL) { |
| 4982 |
Py_INCREF(attr); |
| 4983 |
Py_DECREF(dict); |
| 4984 |
Py_XDECREF(descr); |
| 4985 |
goto try_unpack; |
| 4986 |
} |
| 4987 |
Py_DECREF(dict); |
| 4988 |
} |
| 4989 |
if (meth_found) { |
| 4990 |
*method = descr; |
| 4991 |
return 1; |
| 4992 |
} |
| 4993 |
if (f != NULL) { |
| 4994 |
attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); |
| 4995 |
Py_DECREF(descr); |
| 4996 |
goto try_unpack; |
| 4997 |
} |
| 4998 |
if (likely(descr != NULL)) { |
| 4999 |
*method = descr; |
| 5000 |
return 0; |
| 5001 |
} |
| 5002 |
type_name = __Pyx_PyType_GetName(tp); |
| 5003 |
PyErr_Format(PyExc_AttributeError, |
| 5004 |
#if PY_MAJOR_VERSION >= 3 |
| 5005 |
"'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'", |
| 5006 |
type_name, name); |
| 5007 |
#else |
| 5008 |
"'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'", |
| 5009 |
type_name, PyString_AS_STRING(name)); |
| 5010 |
#endif |
| 5011 |
__Pyx_DECREF_TypeName(type_name); |
| 5012 |
return 0; |
| 5013 |
#else |
| 5014 |
attr = __Pyx_PyObject_GetAttrStr(obj, name); |
| 5015 |
goto try_unpack; |
| 5016 |
#endif |
| 5017 |
try_unpack: |
| 5018 |
#if CYTHON_UNPACK_METHODS |
| 5019 |
if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) { |
| 5020 |
PyObject *function = PyMethod_GET_FUNCTION(attr); |
| 5021 |
Py_INCREF(function); |
| 5022 |
Py_DECREF(attr); |
| 5023 |
*method = function; |
| 5024 |
return 1; |
| 5025 |
} |
| 5026 |
#endif |
| 5027 |
*method = attr; |
| 5028 |
return 0; |
| 5029 |
} |
| 5030 |
|
| 5031 |
|
| 5032 |
static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) { |
| 5033 |
PyObject *method = NULL, *result = NULL; |
| 5034 |
int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); |
| 5035 |
if (likely(is_method)) { |
| 5036 |
result = __Pyx_PyObject_CallOneArg(method, obj); |
| 5037 |
Py_DECREF(method); |
| 5038 |
return result; |
| 5039 |
} |
| 5040 |
if (unlikely(!method)) goto bad; |
| 5041 |
result = __Pyx_PyObject_CallNoArg(method); |
| 5042 |
Py_DECREF(method); |
| 5043 |
bad: |
| 5044 |
return result; |
| 5045 |
} |
| 5046 |
|
| 5047 |
|
| 5048 |
#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS |
| 5049 |
static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases) { |
| 5050 |
Py_ssize_t i, n = PyTuple_GET_SIZE(bases); |
| 5051 |
for (i = 1; i < n; i++) |
| 5052 |
{ |
| 5053 |
PyObject *b0 = PyTuple_GET_ITEM(bases, i); |
| 5054 |
PyTypeObject *b; |
| 5055 |
#if PY_MAJOR_VERSION < 3 |
| 5056 |
if (PyClass_Check(b0)) |
| 5057 |
{ |
| 5058 |
PyErr_Format(PyExc_TypeError, "base class '%.200s' is an old-style class", |
| 5059 |
PyString_AS_STRING(((PyClassObject*)b0)->cl_name)); |
| 5060 |
return -1; |
| 5061 |
} |
| 5062 |
#endif |
| 5063 |
b = (PyTypeObject*) b0; |
| 5064 |
if (!__Pyx_PyType_HasFeature(b, Py_TPFLAGS_HEAPTYPE)) |
| 5065 |
{ |
| 5066 |
__Pyx_TypeName b_name = __Pyx_PyType_GetName(b); |
| 5067 |
PyErr_Format(PyExc_TypeError, |
| 5068 |
"base class '" __Pyx_FMT_TYPENAME "' is not a heap type", b_name); |
| 5069 |
__Pyx_DECREF_TypeName(b_name); |
| 5070 |
return -1; |
| 5071 |
} |
| 5072 |
if (dictoffset == 0 && b->tp_dictoffset) |
| 5073 |
{ |
| 5074 |
__Pyx_TypeName b_name = __Pyx_PyType_GetName(b); |
| 5075 |
PyErr_Format(PyExc_TypeError, |
| 5076 |
"extension type '%.200s' has no __dict__ slot, " |
| 5077 |
"but base type '" __Pyx_FMT_TYPENAME "' has: " |
| 5078 |
"either add 'cdef dict __dict__' to the extension type " |
| 5079 |
"or add '__slots__ = [...]' to the base type", |
| 5080 |
type_name, b_name); |
| 5081 |
__Pyx_DECREF_TypeName(b_name); |
| 5082 |
return -1; |
| 5083 |
} |
| 5084 |
} |
| 5085 |
return 0; |
| 5086 |
} |
| 5087 |
#endif |
| 5088 |
|
| 5089 |
|
| 5090 |
static int __Pyx_PyType_Ready(PyTypeObject *t) { |
| 5091 |
#if CYTHON_USE_TYPE_SPECS || !(CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API) || defined(PYSTON_MAJOR_VERSION) |
| 5092 |
(void)__Pyx_PyObject_CallMethod0; |
| 5093 |
#if CYTHON_USE_TYPE_SPECS |
| 5094 |
(void)__Pyx_validate_bases_tuple; |
| 5095 |
#endif |
| 5096 |
return PyType_Ready(t); |
| 5097 |
#else |
| 5098 |
int r; |
| 5099 |
PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*); |
| 5100 |
if (bases && unlikely(__Pyx_validate_bases_tuple(t->tp_name, t->tp_dictoffset, bases) == -1)) |
| 5101 |
return -1; |
| 5102 |
#if PY_VERSION_HEX >= 0x03050000 && !defined(PYSTON_MAJOR_VERSION) |
| 5103 |
{ |
| 5104 |
int gc_was_enabled; |
| 5105 |
#if PY_VERSION_HEX >= 0x030A00b1 |
| 5106 |
gc_was_enabled = PyGC_Disable(); |
| 5107 |
(void)__Pyx_PyObject_CallMethod0; |
| 5108 |
#else |
| 5109 |
PyObject *ret, *py_status; |
| 5110 |
PyObject *gc = NULL; |
| 5111 |
#if PY_VERSION_HEX >= 0x030700a1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM+0 >= 0x07030400) |
| 5112 |
gc = PyImport_GetModule(__pyx_kp_u_gc); |
| 5113 |
#endif |
| 5114 |
if (unlikely(!gc)) gc = PyImport_Import(__pyx_kp_u_gc); |
| 5115 |
if (unlikely(!gc)) return -1; |
| 5116 |
py_status = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_isenabled); |
| 5117 |
if (unlikely(!py_status)) { |
| 5118 |
Py_DECREF(gc); |
| 5119 |
return -1; |
| 5120 |
} |
| 5121 |
gc_was_enabled = __Pyx_PyObject_IsTrue(py_status); |
| 5122 |
Py_DECREF(py_status); |
| 5123 |
if (gc_was_enabled > 0) { |
| 5124 |
ret = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_disable); |
| 5125 |
if (unlikely(!ret)) { |
| 5126 |
Py_DECREF(gc); |
| 5127 |
return -1; |
| 5128 |
} |
| 5129 |
Py_DECREF(ret); |
| 5130 |
} else if (unlikely(gc_was_enabled == -1)) { |
| 5131 |
Py_DECREF(gc); |
| 5132 |
return -1; |
| 5133 |
} |
| 5134 |
#endif |
| 5135 |
t->tp_flags |= Py_TPFLAGS_HEAPTYPE; |
| 5136 |
#if PY_VERSION_HEX >= 0x030A0000 |
| 5137 |
t->tp_flags |= Py_TPFLAGS_IMMUTABLETYPE; |
| 5138 |
#endif |
| 5139 |
#else |
| 5140 |
(void)__Pyx_PyObject_CallMethod0; |
| 5141 |
#endif |
| 5142 |
r = PyType_Ready(t); |
| 5143 |
#if PY_VERSION_HEX >= 0x03050000 && !defined(PYSTON_MAJOR_VERSION) |
| 5144 |
t->tp_flags &= ~Py_TPFLAGS_HEAPTYPE; |
| 5145 |
#if PY_VERSION_HEX >= 0x030A00b1 |
| 5146 |
if (gc_was_enabled) |
| 5147 |
PyGC_Enable(); |
| 5148 |
#else |
| 5149 |
if (gc_was_enabled) { |
| 5150 |
PyObject *tp, *v, *tb; |
| 5151 |
PyErr_Fetch(&tp, &v, &tb); |
| 5152 |
ret = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_enable); |
| 5153 |
if (likely(ret || r == -1)) { |
| 5154 |
Py_XDECREF(ret); |
| 5155 |
PyErr_Restore(tp, v, tb); |
| 5156 |
} else { |
| 5157 |
Py_XDECREF(tp); |
| 5158 |
Py_XDECREF(v); |
| 5159 |
Py_XDECREF(tb); |
| 5160 |
r = -1; |
| 5161 |
} |
| 5162 |
} |
| 5163 |
Py_DECREF(gc); |
| 5164 |
#endif |
| 5165 |
} |
| 5166 |
#endif |
| 5167 |
return r; |
| 5168 |
#endif |
| 5169 |
} |
| 5170 |
|
| 5171 |
|
| 5172 |
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 |
| 5173 |
static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) { |
| 5174 |
__Pyx_TypeName type_name = __Pyx_PyType_GetName(tp); |
| 5175 |
PyErr_Format(PyExc_AttributeError, |
| 5176 |
#if PY_MAJOR_VERSION >= 3 |
| 5177 |
"'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'", |
| 5178 |
type_name, attr_name); |
| 5179 |
#else |
| 5180 |
"'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'", |
| 5181 |
type_name, PyString_AS_STRING(attr_name)); |
| 5182 |
#endif |
| 5183 |
__Pyx_DECREF_TypeName(type_name); |
| 5184 |
return NULL; |
| 5185 |
} |
| 5186 |
static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) { |
| 5187 |
PyObject *descr; |
| 5188 |
PyTypeObject *tp = Py_TYPE(obj); |
| 5189 |
if (unlikely(!PyString_Check(attr_name))) { |
| 5190 |
return PyObject_GenericGetAttr(obj, attr_name); |
| 5191 |
} |
| 5192 |
assert(!tp->tp_dictoffset); |
| 5193 |
descr = _PyType_Lookup(tp, attr_name); |
| 5194 |
if (unlikely(!descr)) { |
| 5195 |
return __Pyx_RaiseGenericGetAttributeError(tp, attr_name); |
| 5196 |
} |
| 5197 |
Py_INCREF(descr); |
| 5198 |
#if PY_MAJOR_VERSION < 3 |
| 5199 |
if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS))) |
| 5200 |
#endif |
| 5201 |
{ |
| 5202 |
descrgetfunc f = Py_TYPE(descr)->tp_descr_get; |
| 5203 |
if (unlikely(f)) { |
| 5204 |
PyObject *res = f(descr, obj, (PyObject *)tp); |
| 5205 |
Py_DECREF(descr); |
| 5206 |
return res; |
| 5207 |
} |
| 5208 |
} |
| 5209 |
return descr; |
| 5210 |
} |
| 5211 |
#endif |
| 5212 |
|
| 5213 |
|
| 5214 |
static PyObject *__Pyx_FetchSharedCythonABIModule(void) { |
| 5215 |
PyObject *abi_module = PyImport_AddModule((char*) __PYX_ABI_MODULE_NAME); |
| 5216 |
if (unlikely(!abi_module)) return NULL; |
| 5217 |
Py_INCREF(abi_module); |
| 5218 |
return abi_module; |
| 5219 |
} |
| 5220 |
|
| 5221 |
|
| 5222 |
static int __Pyx_VerifyCachedType(PyObject *cached_type, |
| 5223 |
const char *name, |
| 5224 |
Py_ssize_t basicsize, |
| 5225 |
Py_ssize_t expected_basicsize) { |
| 5226 |
if (!PyType_Check(cached_type)) { |
| 5227 |
PyErr_Format(PyExc_TypeError, |
| 5228 |
"Shared Cython type %.200s is not a type object", name); |
| 5229 |
return -1; |
| 5230 |
} |
| 5231 |
if (basicsize != expected_basicsize) { |
| 5232 |
PyErr_Format(PyExc_TypeError, |
| 5233 |
"Shared Cython type %.200s has the wrong size, try recompiling", |
| 5234 |
name); |
| 5235 |
return -1; |
| 5236 |
} |
| 5237 |
return 0; |
| 5238 |
} |
| 5239 |
#if !CYTHON_USE_TYPE_SPECS |
| 5240 |
static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { |
| 5241 |
PyObject* abi_module; |
| 5242 |
const char* object_name; |
| 5243 |
PyTypeObject *cached_type = NULL; |
| 5244 |
abi_module = __Pyx_FetchSharedCythonABIModule(); |
| 5245 |
if (!abi_module) return NULL; |
| 5246 |
object_name = strrchr(type->tp_name, '.'); |
| 5247 |
object_name = object_name ? object_name+1 : type->tp_name; |
| 5248 |
cached_type = (PyTypeObject*) PyObject_GetAttrString(abi_module, object_name); |
| 5249 |
if (cached_type) { |
| 5250 |
if (__Pyx_VerifyCachedType( |
| 5251 |
(PyObject *)cached_type, |
| 5252 |
object_name, |
| 5253 |
cached_type->tp_basicsize, |
| 5254 |
type->tp_basicsize) < 0) { |
| 5255 |
goto bad; |
| 5256 |
} |
| 5257 |
goto done; |
| 5258 |
} |
| 5259 |
if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; |
| 5260 |
PyErr_Clear(); |
| 5261 |
if (PyType_Ready(type) < 0) goto bad; |
| 5262 |
if (PyObject_SetAttrString(abi_module, object_name, (PyObject *)type) < 0) |
| 5263 |
goto bad; |
| 5264 |
Py_INCREF(type); |
| 5265 |
cached_type = type; |
| 5266 |
done: |
| 5267 |
Py_DECREF(abi_module); |
| 5268 |
return cached_type; |
| 5269 |
bad: |
| 5270 |
Py_XDECREF(cached_type); |
| 5271 |
cached_type = NULL; |
| 5272 |
goto done; |
| 5273 |
} |
| 5274 |
#else |
| 5275 |
static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases) { |
| 5276 |
PyObject *abi_module, *cached_type = NULL; |
| 5277 |
const char* object_name = strrchr(spec->name, '.'); |
| 5278 |
object_name = object_name ? object_name+1 : spec->name; |
| 5279 |
abi_module = __Pyx_FetchSharedCythonABIModule(); |
| 5280 |
if (!abi_module) return NULL; |
| 5281 |
cached_type = PyObject_GetAttrString(abi_module, object_name); |
| 5282 |
if (cached_type) { |
| 5283 |
Py_ssize_t basicsize; |
| 5284 |
#if CYTHON_COMPILING_IN_LIMITED_API |
| 5285 |
PyObject *py_basicsize; |
| 5286 |
py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__"); |
| 5287 |
if (unlikely(!py_basicsize)) goto bad; |
| 5288 |
basicsize = PyLong_AsSsize_t(py_basicsize); |
| 5289 |
Py_DECREF(py_basicsize); |
| 5290 |
py_basicsize = 0; |
| 5291 |
if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; |
| 5292 |
#else |
| 5293 |
basicsize = likely(PyType_Check(cached_type)) ? ((PyTypeObject*) cached_type)->tp_basicsize : -1; |
| 5294 |
#endif |
| 5295 |
if (__Pyx_VerifyCachedType( |
| 5296 |
cached_type, |
| 5297 |
object_name, |
| 5298 |
basicsize, |
| 5299 |
spec->basicsize) < 0) { |
| 5300 |
goto bad; |
| 5301 |
} |
| 5302 |
goto done; |
| 5303 |
} |
| 5304 |
if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; |
| 5305 |
PyErr_Clear(); |
| 5306 |
CYTHON_UNUSED_VAR(module); |
| 5307 |
cached_type = __Pyx_PyType_FromModuleAndSpec(abi_module, spec, bases); |
| 5308 |
if (unlikely(!cached_type)) goto bad; |
| 5309 |
if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad; |
| 5310 |
if (PyObject_SetAttrString(abi_module, object_name, cached_type) < 0) goto bad; |
| 5311 |
done: |
| 5312 |
Py_DECREF(abi_module); |
| 5313 |
assert(cached_type == NULL || PyType_Check(cached_type)); |
| 5314 |
return (PyTypeObject *) cached_type; |
| 5315 |
bad: |
| 5316 |
Py_XDECREF(cached_type); |
| 5317 |
cached_type = NULL; |
| 5318 |
goto done; |
| 5319 |
} |
| 5320 |
#endif |
| 5321 |
|
| 5322 |
|
| 5323 |
#if CYTHON_METH_FASTCALL |
| 5324 |
static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) |
| 5325 |
{ |
| 5326 |
PyObject *res = NULL; |
| 5327 |
PyObject *kwnames; |
| 5328 |
PyObject **newargs; |
| 5329 |
PyObject **kwvalues; |
| 5330 |
Py_ssize_t i, pos; |
| 5331 |
size_t j; |
| 5332 |
PyObject *key, *value; |
| 5333 |
unsigned long keys_are_strings; |
| 5334 |
Py_ssize_t nkw = PyDict_GET_SIZE(kw); |
| 5335 |
newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0])); |
| 5336 |
if (unlikely(newargs == NULL)) { |
| 5337 |
PyErr_NoMemory(); |
| 5338 |
return NULL; |
| 5339 |
} |
| 5340 |
for (j = 0; j < nargs; j++) newargs[j] = args[j]; |
| 5341 |
kwnames = PyTuple_New(nkw); |
| 5342 |
if (unlikely(kwnames == NULL)) { |
| 5343 |
PyMem_Free(newargs); |
| 5344 |
return NULL; |
| 5345 |
} |
| 5346 |
kwvalues = newargs + nargs; |
| 5347 |
pos = i = 0; |
| 5348 |
keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS; |
| 5349 |
while (PyDict_Next(kw, &pos, &key, &value)) { |
| 5350 |
keys_are_strings &= Py_TYPE(key)->tp_flags; |
| 5351 |
Py_INCREF(key); |
| 5352 |
Py_INCREF(value); |
| 5353 |
PyTuple_SET_ITEM(kwnames, i, key); |
| 5354 |
kwvalues[i] = value; |
| 5355 |
i++; |
| 5356 |
} |
| 5357 |
if (unlikely(!keys_are_strings)) { |
| 5358 |
PyErr_SetString(PyExc_TypeError, "keywords must be strings"); |
| 5359 |
goto cleanup; |
| 5360 |
} |
| 5361 |
res = vc(func, newargs, nargs, kwnames); |
| 5362 |
cleanup: |
| 5363 |
Py_DECREF(kwnames); |
| 5364 |
for (i = 0; i < nkw; i++) |
| 5365 |
Py_DECREF(kwvalues[i]); |
| 5366 |
PyMem_Free(newargs); |
| 5367 |
return res; |
| 5368 |
} |
| 5369 |
static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw) |
| 5370 |
{ |
| 5371 |
if (likely(kw == NULL) || PyDict_GET_SIZE(kw) == 0) { |
| 5372 |
return vc(func, args, nargs, NULL); |
| 5373 |
} |
| 5374 |
return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw); |
| 5375 |
} |
| 5376 |
#endif |
| 5377 |
|
| 5378 |
|
| 5379 |
static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) { |
| 5380 |
#if PY_VERSION_HEX < 0x030900B1 |
| 5381 |
__Pyx_Py_XDECREF_SET( |
| 5382 |
__Pyx_CyFunction_GetClassObj(f), |
| 5383 |
((classobj) ? __Pyx_NewRef(classobj) : NULL)); |
| 5384 |
#else |
| 5385 |
__Pyx_Py_XDECREF_SET( |
| 5386 |
((PyCMethodObject *) (f))->mm_class, |
| 5387 |
(PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL)); |
| 5388 |
#endif |
| 5389 |
} |
| 5390 |
static PyObject * |
| 5391 |
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure) |
| 5392 |
{ |
| 5393 |
CYTHON_UNUSED_VAR(closure); |
| 5394 |
if (unlikely(op->func_doc == NULL)) { |
| 5395 |
if (((PyCFunctionObject*)op)->m_ml->ml_doc) { |
| 5396 |
#if PY_MAJOR_VERSION >= 3 |
| 5397 |
op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); |
| 5398 |
#else |
| 5399 |
op->func_doc = PyString_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); |
| 5400 |
#endif |
| 5401 |
if (unlikely(op->func_doc == NULL)) |
| 5402 |
return NULL; |
| 5403 |
} else { |
| 5404 |
Py_INCREF(Py_None); |
| 5405 |
return Py_None; |
| 5406 |
} |
| 5407 |
} |
| 5408 |
Py_INCREF(op->func_doc); |
| 5409 |
return op->func_doc; |
| 5410 |
} |
| 5411 |
static int |
| 5412 |
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context) |
| 5413 |
{ |
| 5414 |
CYTHON_UNUSED_VAR(context); |
| 5415 |
if (value == NULL) { |
| 5416 |
value = Py_None; |
| 5417 |
} |
| 5418 |
Py_INCREF(value); |
| 5419 |
__Pyx_Py_XDECREF_SET(op->func_doc, value); |
| 5420 |
return 0; |
| 5421 |
} |
| 5422 |
static PyObject * |
| 5423 |
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context) |
| 5424 |
{ |
| 5425 |
CYTHON_UNUSED_VAR(context); |
| 5426 |
if (unlikely(op->func_name == NULL)) { |
| 5427 |
#if PY_MAJOR_VERSION >= 3 |
| 5428 |
op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); |
| 5429 |
#else |
| 5430 |
op->func_name = PyString_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); |
| 5431 |
#endif |
| 5432 |
if (unlikely(op->func_name == NULL)) |
| 5433 |
return NULL; |
| 5434 |
} |
| 5435 |
Py_INCREF(op->func_name); |
| 5436 |
return op->func_name; |
| 5437 |
} |
| 5438 |
static int |
| 5439 |
__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context) |
| 5440 |
{ |
| 5441 |
CYTHON_UNUSED_VAR(context); |
| 5442 |
#if PY_MAJOR_VERSION >= 3 |
| 5443 |
if (unlikely(value == NULL || !PyUnicode_Check(value))) |
| 5444 |
#else |
| 5445 |
if (unlikely(value == NULL || !PyString_Check(value))) |
| 5446 |
#endif |
| 5447 |
{ |
| 5448 |
PyErr_SetString(PyExc_TypeError, |
| 5449 |
"__name__ must be set to a string object"); |
| 5450 |
return -1; |
| 5451 |
} |
| 5452 |
Py_INCREF(value); |
| 5453 |
__Pyx_Py_XDECREF_SET(op->func_name, value); |
| 5454 |
return 0; |
| 5455 |
} |
| 5456 |
static PyObject * |
| 5457 |
__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context) |
| 5458 |
{ |
| 5459 |
CYTHON_UNUSED_VAR(context); |
| 5460 |
Py_INCREF(op->func_qualname); |
| 5461 |
return op->func_qualname; |
| 5462 |
} |
| 5463 |
static int |
| 5464 |
__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context) |
| 5465 |
{ |
| 5466 |
CYTHON_UNUSED_VAR(context); |
| 5467 |
#if PY_MAJOR_VERSION >= 3 |
| 5468 |
if (unlikely(value == NULL || !PyUnicode_Check(value))) |
| 5469 |
#else |
| 5470 |
if (unlikely(value == NULL || !PyString_Check(value))) |
| 5471 |
#endif |
| 5472 |
{ |
| 5473 |
PyErr_SetString(PyExc_TypeError, |
| 5474 |
"__qualname__ must be set to a string object"); |
| 5475 |
return -1; |
| 5476 |
} |
| 5477 |
Py_INCREF(value); |
| 5478 |
__Pyx_Py_XDECREF_SET(op->func_qualname, value); |
| 5479 |
return 0; |
| 5480 |
} |
| 5481 |
static PyObject * |
| 5482 |
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context) |
| 5483 |
{ |
| 5484 |
CYTHON_UNUSED_VAR(context); |
| 5485 |
if (unlikely(op->func_dict == NULL)) { |
| 5486 |
op->func_dict = PyDict_New(); |
| 5487 |
if (unlikely(op->func_dict == NULL)) |
| 5488 |
return NULL; |
| 5489 |
} |
| 5490 |
Py_INCREF(op->func_dict); |
| 5491 |
return op->func_dict; |
| 5492 |
} |
| 5493 |
static int |
| 5494 |
__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, void *context) |
| 5495 |
{ |
| 5496 |
CYTHON_UNUSED_VAR(context); |
| 5497 |
if (unlikely(value == NULL)) { |
| 5498 |
PyErr_SetString(PyExc_TypeError, |
| 5499 |
"function's dictionary may not be deleted"); |
| 5500 |
return -1; |
| 5501 |
} |
| 5502 |
if (unlikely(!PyDict_Check(value))) { |
| 5503 |
PyErr_SetString(PyExc_TypeError, |
| 5504 |
"setting function's dictionary to a non-dict"); |
| 5505 |
return -1; |
| 5506 |
} |
| 5507 |
Py_INCREF(value); |
| 5508 |
__Pyx_Py_XDECREF_SET(op->func_dict, value); |
| 5509 |
return 0; |
| 5510 |
} |
| 5511 |
static PyObject * |
| 5512 |
__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context) |
| 5513 |
{ |
| 5514 |
CYTHON_UNUSED_VAR(context); |
| 5515 |
Py_INCREF(op->func_globals); |
| 5516 |
return op->func_globals; |
| 5517 |
} |
| 5518 |
static PyObject * |
| 5519 |
__Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context) |
| 5520 |
{ |
| 5521 |
CYTHON_UNUSED_VAR(op); |
| 5522 |
CYTHON_UNUSED_VAR(context); |
| 5523 |
Py_INCREF(Py_None); |
| 5524 |
return Py_None; |
| 5525 |
} |
| 5526 |
static PyObject * |
| 5527 |
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context) |
| 5528 |
{ |
| 5529 |
PyObject* result = (op->func_code) ? op->func_code : Py_None; |
| 5530 |
CYTHON_UNUSED_VAR(context); |
| 5531 |
Py_INCREF(result); |
| 5532 |
return result; |
| 5533 |
} |
| 5534 |
static int |
| 5535 |
__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { |
| 5536 |
int result = 0; |
| 5537 |
PyObject *res = op->defaults_getter((PyObject *) op); |
| 5538 |
if (unlikely(!res)) |
| 5539 |
return -1; |
| 5540 |
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS |
| 5541 |
op->defaults_tuple = PyTuple_GET_ITEM(res, 0); |
| 5542 |
Py_INCREF(op->defaults_tuple); |
| 5543 |
op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); |
| 5544 |
Py_INCREF(op->defaults_kwdict); |
| 5545 |
#else |
| 5546 |
op->defaults_tuple = PySequence_ITEM(res, 0); |
| 5547 |
if (unlikely(!op->defaults_tuple)) result = -1; |
| 5548 |
else { |
| 5549 |
op->defaults_kwdict = PySequence_ITEM(res, 1); |
| 5550 |
if (unlikely(!op->defaults_kwdict)) result = -1; |
| 5551 |
} |
| 5552 |
#endif |
| 5553 |
Py_DECREF(res); |
| 5554 |
return result; |
| 5555 |
} |
| 5556 |
static int |
| 5557 |
__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { |
| 5558 |
CYTHON_UNUSED_VAR(context); |
| 5559 |
if (!value) { |
| 5560 |
value = Py_None; |
| 5561 |
} else if (unlikely(value != Py_None && !PyTuple_Check(value))) { |
| 5562 |
PyErr_SetString(PyExc_TypeError, |
| 5563 |
"__defaults__ must be set to a tuple object"); |
| 5564 |
return -1; |
| 5565 |
} |
| 5566 |
PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not " |
| 5567 |
"currently affect the values used in function calls", 1); |
| 5568 |
Py_INCREF(value); |
| 5569 |
__Pyx_Py_XDECREF_SET(op->defaults_tuple, value); |
| 5570 |
return 0; |
| 5571 |
} |
| 5572 |
static PyObject * |
| 5573 |
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) { |
| 5574 |
PyObject* result = op->defaults_tuple; |
| 5575 |
CYTHON_UNUSED_VAR(context); |
| 5576 |
if (unlikely(!result)) { |
| 5577 |
if (op->defaults_getter) { |
| 5578 |
if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; |
| 5579 |
result = op->defaults_tuple; |
| 5580 |
} else { |
| 5581 |
result = Py_None; |
| 5582 |
} |
| 5583 |
} |
| 5584 |
Py_INCREF(result); |
| 5585 |
return result; |
| 5586 |
} |
| 5587 |
static int |
| 5588 |
__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) { |
| 5589 |
CYTHON_UNUSED_VAR(context); |
| 5590 |
if (!value) { |
| 5591 |
value = Py_None; |
| 5592 |
} else if (unlikely(value != Py_None && !PyDict_Check(value))) { |
| 5593 |
PyErr_SetString(PyExc_TypeError, |
| 5594 |
"__kwdefaults__ must be set to a dict object"); |
| 5595 |
return -1; |
| 5596 |
} |
| 5597 |
PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not " |
| 5598 |
"currently affect the values used in function calls", 1); |
| 5599 |
Py_INCREF(value); |
| 5600 |
__Pyx_Py_XDECREF_SET(op->defaults_kwdict, value); |
| 5601 |
return 0; |
| 5602 |
} |
| 5603 |
static PyObject * |
| 5604 |
__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) { |
| 5605 |
PyObject* result = op->defaults_kwdict; |
| 5606 |
CYTHON_UNUSED_VAR(context); |
| 5607 |
if (unlikely(!result)) { |
| 5608 |
if (op->defaults_getter) { |
| 5609 |
if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL; |
| 5610 |
result = op->defaults_kwdict; |
| 5611 |
} else { |
| 5612 |
result = Py_None; |
| 5613 |
} |
| 5614 |
} |
| 5615 |
Py_INCREF(result); |
| 5616 |
return result; |
| 5617 |
} |
| 5618 |
static int |
| 5619 |
__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) { |
| 5620 |
CYTHON_UNUSED_VAR(context); |
| 5621 |
if (!value || value == Py_None) { |
| 5622 |
value = NULL; |
| 5623 |
} else if (unlikely(!PyDict_Check(value))) { |
| 5624 |
PyErr_SetString(PyExc_TypeError, |
| 5625 |
"__annotations__ must be set to a dict object"); |
| 5626 |
return -1; |
| 5627 |
} |
| 5628 |
Py_XINCREF(value); |
| 5629 |
__Pyx_Py_XDECREF_SET(op->func_annotations, value); |
| 5630 |
return 0; |
| 5631 |
} |
| 5632 |
static PyObject * |
| 5633 |
__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) { |
| 5634 |
PyObject* result = op->func_annotations; |
| 5635 |
CYTHON_UNUSED_VAR(context); |
| 5636 |
if (unlikely(!result)) { |
| 5637 |
result = PyDict_New(); |
| 5638 |
if (unlikely(!result)) return NULL; |
| 5639 |
op->func_annotations = result; |
| 5640 |
} |
| 5641 |
Py_INCREF(result); |
| 5642 |
return result; |
| 5643 |
} |
| 5644 |
static PyObject * |
| 5645 |
__Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) { |
| 5646 |
int is_coroutine; |
| 5647 |
CYTHON_UNUSED_VAR(context); |
| 5648 |
if (op->func_is_coroutine) { |
| 5649 |
return __Pyx_NewRef(op->func_is_coroutine); |
| 5650 |
} |
| 5651 |
is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE; |
| 5652 |
#if PY_VERSION_HEX >= 0x03050000 |
| 5653 |
if (is_coroutine) { |
| 5654 |
PyObject *module, *fromlist, *marker = __pyx_n_s_is_coroutine; |
| 5655 |
fromlist = PyList_New(1); |
| 5656 |
if (unlikely(!fromlist)) return NULL; |
| 5657 |
Py_INCREF(marker); |
| 5658 |
PyList_SET_ITEM(fromlist, 0, marker); |
| 5659 |
module = PyImport_ImportModuleLevelObject(__pyx_n_s_asyncio_coroutines, NULL, NULL, fromlist, 0); |
| 5660 |
Py_DECREF(fromlist); |
| 5661 |
if (unlikely(!module)) goto ignore; |
| 5662 |
op->func_is_coroutine = __Pyx_PyObject_GetAttrStr(module, marker); |
| 5663 |
Py_DECREF(module); |
| 5664 |
if (likely(op->func_is_coroutine)) { |
| 5665 |
return __Pyx_NewRef(op->func_is_coroutine); |
| 5666 |
} |
| 5667 |
ignore: |
| 5668 |
PyErr_Clear(); |
| 5669 |
} |
| 5670 |
#endif |
| 5671 |
op->func_is_coroutine = __Pyx_PyBool_FromLong(is_coroutine); |
| 5672 |
return __Pyx_NewRef(op->func_is_coroutine); |
| 5673 |
} |
| 5674 |
static PyGetSetDef __pyx_CyFunction_getsets[] = { |
| 5675 |
{(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, |
| 5676 |
{(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, |
| 5677 |
{(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, |
| 5678 |
{(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, |
| 5679 |
{(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, |
| 5680 |
{(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, |
| 5681 |
{(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, |
| 5682 |
{(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, |
| 5683 |
{(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, |
| 5684 |
{(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, |
| 5685 |
{(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, |
| 5686 |
{(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, |
| 5687 |
{(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, |
| 5688 |
{(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, |
| 5689 |
{(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, |
| 5690 |
{(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, |
| 5691 |
{(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, |
| 5692 |
{(char *) "_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0}, |
| 5693 |
{0, 0, 0, 0, 0} |
| 5694 |
}; |
| 5695 |
static PyMemberDef __pyx_CyFunction_members[] = { |
| 5696 |
{(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0}, |
| 5697 |
#if CYTHON_USE_TYPE_SPECS |
| 5698 |
{(char *) "__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0}, |
| 5699 |
#if CYTHON_METH_FASTCALL |
| 5700 |
#if CYTHON_BACKPORT_VECTORCALL |
| 5701 |
{(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0}, |
| 5702 |
#else |
| 5703 |
{(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0}, |
| 5704 |
#endif |
| 5705 |
#endif |
| 5706 |
#if PY_VERSION_HEX < 0x030500A0 |
| 5707 |
{(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0}, |
| 5708 |
#else |
| 5709 |
{(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0}, |
| 5710 |
#endif |
| 5711 |
#endif |
| 5712 |
{0, 0, 0, 0, 0} |
| 5713 |
}; |
| 5714 |
static PyObject * |
| 5715 |
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args) |
| 5716 |
{ |
| 5717 |
CYTHON_UNUSED_VAR(args); |
| 5718 |
#if PY_MAJOR_VERSION >= 3 |
| 5719 |
Py_INCREF(m->func_qualname); |
| 5720 |
return m->func_qualname; |
| 5721 |
#else |
| 5722 |
return PyString_FromString(((PyCFunctionObject*)m)->m_ml->ml_name); |
| 5723 |
#endif |
| 5724 |
} |
| 5725 |
static PyMethodDef __pyx_CyFunction_methods[] = { |
| 5726 |
{"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, |
| 5727 |
{0, 0, 0, 0} |
| 5728 |
}; |
| 5729 |
#if PY_VERSION_HEX < 0x030500A0 |
| 5730 |
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist) |
| 5731 |
#else |
| 5732 |
#define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist) |
| 5733 |
#endif |
| 5734 |
static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname, |
| 5735 |
PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { |
| 5736 |
PyCFunctionObject *cf = (PyCFunctionObject*) op; |
| 5737 |
if (unlikely(op == NULL)) |
| 5738 |
return NULL; |
| 5739 |
op->flags = flags; |
| 5740 |
__Pyx_CyFunction_weakreflist(op) = NULL; |
| 5741 |
cf->m_ml = ml; |
| 5742 |
cf->m_self = (PyObject *) op; |
| 5743 |
Py_XINCREF(closure); |
| 5744 |
op->func_closure = closure; |
| 5745 |
Py_XINCREF(module); |
| 5746 |
cf->m_module = module; |
| 5747 |
op->func_dict = NULL; |
| 5748 |
op->func_name = NULL; |
| 5749 |
Py_INCREF(qualname); |
| 5750 |
op->func_qualname = qualname; |
| 5751 |
op->func_doc = NULL; |
| 5752 |
#if PY_VERSION_HEX < 0x030900B1 |
| 5753 |
op->func_classobj = NULL; |
| 5754 |
#else |
| 5755 |
((PyCMethodObject*)op)->mm_class = NULL; |
| 5756 |
#endif |
| 5757 |
op->func_globals = globals; |
| 5758 |
Py_INCREF(op->func_globals); |
| 5759 |
Py_XINCREF(code); |
| 5760 |
op->func_code = code; |
| 5761 |
op->defaults_pyobjects = 0; |
| 5762 |
op->defaults_size = 0; |
| 5763 |
op->defaults = NULL; |
| 5764 |
op->defaults_tuple = NULL; |
| 5765 |
op->defaults_kwdict = NULL; |
| 5766 |
op->defaults_getter = NULL; |
| 5767 |
op->func_annotations = NULL; |
| 5768 |
op->func_is_coroutine = NULL; |
| 5769 |
#if CYTHON_METH_FASTCALL |
| 5770 |
switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) { |
| 5771 |
case METH_NOARGS: |
| 5772 |
__Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS; |
| 5773 |
break; |
| 5774 |
case METH_O: |
| 5775 |
__Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O; |
| 5776 |
break; |
| 5777 |
case METH_METHOD | METH_FASTCALL | METH_KEYWORDS: |
| 5778 |
__Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD; |
| 5779 |
break; |
| 5780 |
case METH_FASTCALL | METH_KEYWORDS: |
| 5781 |
__Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS; |
| 5782 |
break; |
| 5783 |
case METH_VARARGS | METH_KEYWORDS: |
| 5784 |
__Pyx_CyFunction_func_vectorcall(op) = NULL; |
| 5785 |
break; |
| 5786 |
default: |
| 5787 |
PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); |
| 5788 |
Py_DECREF(op); |
| 5789 |
return NULL; |
| 5790 |
} |
| 5791 |
#endif |
| 5792 |
return (PyObject *) op; |
| 5793 |
} |
| 5794 |
static int |
| 5795 |
__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) |
| 5796 |
{ |
| 5797 |
Py_CLEAR(m->func_closure); |
| 5798 |
Py_CLEAR(((PyCFunctionObject*)m)->m_module); |
| 5799 |
Py_CLEAR(m->func_dict); |
| 5800 |
Py_CLEAR(m->func_name); |
| 5801 |
Py_CLEAR(m->func_qualname); |
| 5802 |
Py_CLEAR(m->func_doc); |
| 5803 |
Py_CLEAR(m->func_globals); |
| 5804 |
Py_CLEAR(m->func_code); |
| 5805 |
#if PY_VERSION_HEX < 0x030900B1 |
| 5806 |
Py_CLEAR(__Pyx_CyFunction_GetClassObj(m)); |
| 5807 |
#else |
| 5808 |
{ |
| 5809 |
PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class; |
| 5810 |
((PyCMethodObject *) (m))->mm_class = NULL; |
| 5811 |
Py_XDECREF(cls); |
| 5812 |
} |
| 5813 |
#endif |
| 5814 |
Py_CLEAR(m->defaults_tuple); |
| 5815 |
Py_CLEAR(m->defaults_kwdict); |
| 5816 |
Py_CLEAR(m->func_annotations); |
| 5817 |
Py_CLEAR(m->func_is_coroutine); |
| 5818 |
if (m->defaults) { |
| 5819 |
PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); |
| 5820 |
int i; |
| 5821 |
for (i = 0; i < m->defaults_pyobjects; i++) |
| 5822 |
Py_XDECREF(pydefaults[i]); |
| 5823 |
PyObject_Free(m->defaults); |
| 5824 |
m->defaults = NULL; |
| 5825 |
} |
| 5826 |
return 0; |
| 5827 |
} |
| 5828 |
static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m) |
| 5829 |
{ |
| 5830 |
if (__Pyx_CyFunction_weakreflist(m) != NULL) |
| 5831 |
PyObject_ClearWeakRefs((PyObject *) m); |
| 5832 |
__Pyx_CyFunction_clear(m); |
| 5833 |
__Pyx_PyHeapTypeObject_GC_Del(m); |
| 5834 |
} |
| 5835 |
static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) |
| 5836 |
{ |
| 5837 |
PyObject_GC_UnTrack(m); |
| 5838 |
__Pyx__CyFunction_dealloc(m); |
| 5839 |
} |
| 5840 |
static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) |
| 5841 |
{ |
| 5842 |
Py_VISIT(m->func_closure); |
| 5843 |
Py_VISIT(((PyCFunctionObject*)m)->m_module); |
| 5844 |
Py_VISIT(m->func_dict); |
| 5845 |
Py_VISIT(m->func_name); |
| 5846 |
Py_VISIT(m->func_qualname); |
| 5847 |
Py_VISIT(m->func_doc); |
| 5848 |
Py_VISIT(m->func_globals); |
| 5849 |
Py_VISIT(m->func_code); |
| 5850 |
Py_VISIT(__Pyx_CyFunction_GetClassObj(m)); |
| 5851 |
Py_VISIT(m->defaults_tuple); |
| 5852 |
Py_VISIT(m->defaults_kwdict); |
| 5853 |
Py_VISIT(m->func_is_coroutine); |
| 5854 |
if (m->defaults) { |
| 5855 |
PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); |
| 5856 |
int i; |
| 5857 |
for (i = 0; i < m->defaults_pyobjects; i++) |
| 5858 |
Py_VISIT(pydefaults[i]); |
| 5859 |
} |
| 5860 |
return 0; |
| 5861 |
} |
| 5862 |
static PyObject* |
| 5863 |
__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) |
| 5864 |
{ |
| 5865 |
#if PY_MAJOR_VERSION >= 3 |
| 5866 |
return PyUnicode_FromFormat("<cyfunction %U at %p>", |
| 5867 |
op->func_qualname, (void *)op); |
| 5868 |
#else |
| 5869 |
return PyString_FromFormat("<cyfunction %s at %p>", |
| 5870 |
PyString_AsString(op->func_qualname), (void *)op); |
| 5871 |
#endif |
| 5872 |
} |
| 5873 |
static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) { |
| 5874 |
PyCFunctionObject* f = (PyCFunctionObject*)func; |
| 5875 |
PyCFunction meth = f->m_ml->ml_meth; |
| 5876 |
Py_ssize_t size; |
| 5877 |
switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { |
| 5878 |
case METH_VARARGS: |
| 5879 |
if (likely(kw == NULL || PyDict_Size(kw) == 0)) |
| 5880 |
return (*meth)(self, arg); |
| 5881 |
break; |
| 5882 |
case METH_VARARGS | METH_KEYWORDS: |
| 5883 |
return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw); |
| 5884 |
case METH_NOARGS: |
| 5885 |
if (likely(kw == NULL || PyDict_Size(kw) == 0)) { |
| 5886 |
size = PyTuple_GET_SIZE(arg); |
| 5887 |
if (likely(size == 0)) |
| 5888 |
return (*meth)(self, NULL); |
| 5889 |
PyErr_Format(PyExc_TypeError, |
| 5890 |
"%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", |
| 5891 |
f->m_ml->ml_name, size); |
| 5892 |
return NULL; |
| 5893 |
} |
| 5894 |
break; |
| 5895 |
case METH_O: |
| 5896 |
if (likely(kw == NULL || PyDict_Size(kw) == 0)) { |
| 5897 |
size = PyTuple_GET_SIZE(arg); |
| 5898 |
if (likely(size == 1)) { |
| 5899 |
PyObject *result, *arg0; |
| 5900 |
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS |
| 5901 |
arg0 = PyTuple_GET_ITEM(arg, 0); |
| 5902 |
#else |
| 5903 |
arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL; |
| 5904 |
#endif |
| 5905 |
result = (*meth)(self, arg0); |
| 5906 |
#if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) |
| 5907 |
Py_DECREF(arg0); |
| 5908 |
#endif |
| 5909 |
return result; |
| 5910 |
} |
| 5911 |
PyErr_Format(PyExc_TypeError, |
| 5912 |
"%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", |
| 5913 |
f->m_ml->ml_name, size); |
| 5914 |
return NULL; |
| 5915 |
} |
| 5916 |
break; |
| 5917 |
default: |
| 5918 |
PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); |
| 5919 |
return NULL; |
| 5920 |
} |
| 5921 |
PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", |
| 5922 |
f->m_ml->ml_name); |
| 5923 |
return NULL; |
| 5924 |
} |
| 5925 |
static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { |
| 5926 |
return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw); |
| 5927 |
} |
| 5928 |
static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) { |
| 5929 |
PyObject *result; |
| 5930 |
__pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func; |
| 5931 |
#if CYTHON_METH_FASTCALL |
| 5932 |
__pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc); |
| 5933 |
if (vc) { |
| 5934 |
#if CYTHON_ASSUME_SAFE_MACROS |
| 5935 |
return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw); |
| 5936 |
#else |
| 5937 |
(void) &__Pyx_PyVectorcall_FastCallDict; |
| 5938 |
return PyVectorcall_Call(func, args, kw); |
| 5939 |
#endif |
| 5940 |
} |
| 5941 |
#endif |
| 5942 |
if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { |
| 5943 |
Py_ssize_t argc; |
| 5944 |
PyObject *new_args; |
| 5945 |
PyObject *self; |
| 5946 |
argc = PyTuple_GET_SIZE(args); |
| 5947 |
new_args = PyTuple_GetSlice(args, 1, argc); |
| 5948 |
if (unlikely(!new_args)) |
| 5949 |
return NULL; |
| 5950 |
self = PyTuple_GetItem(args, 0); |
| 5951 |
if (unlikely(!self)) { |
| 5952 |
Py_DECREF(new_args); |
| 5953 |
#if PY_MAJOR_VERSION > 2 |
| 5954 |
PyErr_Format(PyExc_TypeError, |
| 5955 |
"unbound method %.200S() needs an argument", |
| 5956 |
cyfunc->func_qualname); |
| 5957 |
#else |
| 5958 |
PyErr_SetString(PyExc_TypeError, |
| 5959 |
"unbound method needs an argument"); |
| 5960 |
#endif |
| 5961 |
return NULL; |
| 5962 |
} |
| 5963 |
result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw); |
| 5964 |
Py_DECREF(new_args); |
| 5965 |
} else { |
| 5966 |
result = __Pyx_CyFunction_Call(func, args, kw); |
| 5967 |
} |
| 5968 |
return result; |
| 5969 |
} |
| 5970 |
#if CYTHON_METH_FASTCALL |
| 5971 |
static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames) |
| 5972 |
{ |
| 5973 |
int ret = 0; |
| 5974 |
if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { |
| 5975 |
if (unlikely(nargs < 1)) { |
| 5976 |
PyErr_Format(PyExc_TypeError, "%.200s() needs an argument", |
| 5977 |
((PyCFunctionObject*)cyfunc)->m_ml->ml_name); |
| 5978 |
return -1; |
| 5979 |
} |
| 5980 |
ret = 1; |
| 5981 |
} |
| 5982 |
if (unlikely(kwnames) && unlikely(PyTuple_GET_SIZE(kwnames))) { |
| 5983 |
PyErr_Format(PyExc_TypeError, |
| 5984 |
"%.200s() takes no keyword arguments", ((PyCFunctionObject*)cyfunc)->m_ml->ml_name); |
| 5985 |
return -1; |
| 5986 |
} |
| 5987 |
return ret; |
| 5988 |
} |
| 5989 |
static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) |
| 5990 |
{ |
| 5991 |
__pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; |
| 5992 |
PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; |
| 5993 |
#if CYTHON_BACKPORT_VECTORCALL |
| 5994 |
Py_ssize_t nargs = (Py_ssize_t)nargsf; |
| 5995 |
#else |
| 5996 |
Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); |
| 5997 |
#endif |
| 5998 |
PyObject *self; |
| 5999 |
switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { |
| 6000 |
case 1: |
| 6001 |
self = args[0]; |
| 6002 |
args += 1; |
| 6003 |
nargs -= 1; |
| 6004 |
break; |
| 6005 |
case 0: |
| 6006 |
self = ((PyCFunctionObject*)cyfunc)->m_self; |
| 6007 |
break; |
| 6008 |
default: |
| 6009 |
return NULL; |
| 6010 |
} |
| 6011 |
if (unlikely(nargs != 0)) { |
| 6012 |
PyErr_Format(PyExc_TypeError, |
| 6013 |
"%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", |
| 6014 |
def->ml_name, nargs); |
| 6015 |
return NULL; |
| 6016 |
} |
| 6017 |
return def->ml_meth(self, NULL); |
| 6018 |
} |
| 6019 |
static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) |
| 6020 |
{ |
| 6021 |
__pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; |
| 6022 |
PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; |
| 6023 |
#if CYTHON_BACKPORT_VECTORCALL |
| 6024 |
Py_ssize_t nargs = (Py_ssize_t)nargsf; |
| 6025 |
#else |
| 6026 |
Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); |
| 6027 |
#endif |
| 6028 |
PyObject *self; |
| 6029 |
switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { |
| 6030 |
case 1: |
| 6031 |
self = args[0]; |
| 6032 |
args += 1; |
| 6033 |
nargs -= 1; |
| 6034 |
break; |
| 6035 |
case 0: |
| 6036 |
self = ((PyCFunctionObject*)cyfunc)->m_self; |
| 6037 |
break; |
| 6038 |
default: |
| 6039 |
return NULL; |
| 6040 |
} |
| 6041 |
if (unlikely(nargs != 1)) { |
| 6042 |
PyErr_Format(PyExc_TypeError, |
| 6043 |
"%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", |
| 6044 |
def->ml_name, nargs); |
| 6045 |
return NULL; |
| 6046 |
} |
| 6047 |
return def->ml_meth(self, args[0]); |
| 6048 |
} |
| 6049 |
static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) |
| 6050 |
{ |
| 6051 |
__pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; |
| 6052 |
PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; |
| 6053 |
#if CYTHON_BACKPORT_VECTORCALL |
| 6054 |
Py_ssize_t nargs = (Py_ssize_t)nargsf; |
| 6055 |
#else |
| 6056 |
Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); |
| 6057 |
#endif |
| 6058 |
PyObject *self; |
| 6059 |
switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { |
| 6060 |
case 1: |
| 6061 |
self = args[0]; |
| 6062 |
args += 1; |
| 6063 |
nargs -= 1; |
| 6064 |
break; |
| 6065 |
case 0: |
| 6066 |
self = ((PyCFunctionObject*)cyfunc)->m_self; |
| 6067 |
break; |
| 6068 |
default: |
| 6069 |
return NULL; |
| 6070 |
} |
| 6071 |
return ((_PyCFunctionFastWithKeywords)(void(*)(void))def->ml_meth)(self, args, nargs, kwnames); |
| 6072 |
} |
| 6073 |
static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames) |
| 6074 |
{ |
| 6075 |
__pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func; |
| 6076 |
PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; |
| 6077 |
PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc); |
| 6078 |
#if CYTHON_BACKPORT_VECTORCALL |
| 6079 |
Py_ssize_t nargs = (Py_ssize_t)nargsf; |
| 6080 |
#else |
| 6081 |
Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); |
| 6082 |
#endif |
| 6083 |
PyObject *self; |
| 6084 |
switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { |
| 6085 |
case 1: |
| 6086 |
self = args[0]; |
| 6087 |
args += 1; |
| 6088 |
nargs -= 1; |
| 6089 |
break; |
| 6090 |
case 0: |
| 6091 |
self = ((PyCFunctionObject*)cyfunc)->m_self; |
| 6092 |
break; |
| 6093 |
default: |
| 6094 |
return NULL; |
| 6095 |
} |
| 6096 |
return ((__Pyx_PyCMethod)(void(*)(void))def->ml_meth)(self, cls, args, (size_t)nargs, kwnames); |
| 6097 |
} |
| 6098 |
#endif |
| 6099 |
#if CYTHON_USE_TYPE_SPECS |
| 6100 |
static PyType_Slot __pyx_CyFunctionType_slots[] = { |
| 6101 |
{Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc}, |
| 6102 |
{Py_tp_repr, (void *)__Pyx_CyFunction_repr}, |
| 6103 |
{Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod}, |
| 6104 |
{Py_tp_traverse, (void *)__Pyx_CyFunction_traverse}, |
| 6105 |
{Py_tp_clear, (void *)__Pyx_CyFunction_clear}, |
| 6106 |
{Py_tp_methods, (void *)__pyx_CyFunction_methods}, |
| 6107 |
{Py_tp_members, (void *)__pyx_CyFunction_members}, |
| 6108 |
{Py_tp_getset, (void *)__pyx_CyFunction_getsets}, |
| 6109 |
{Py_tp_descr_get, (void *)__Pyx_PyMethod_New}, |
| 6110 |
{0, 0}, |
| 6111 |
}; |
| 6112 |
static PyType_Spec __pyx_CyFunctionType_spec = { |
| 6113 |
__PYX_TYPE_MODULE_PREFIX "cython_function_or_method", |
| 6114 |
sizeof(__pyx_CyFunctionObject), |
| 6115 |
0, |
| 6116 |
#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR |
| 6117 |
Py_TPFLAGS_METHOD_DESCRIPTOR | |
| 6118 |
#endif |
| 6119 |
#if (defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL) |
| 6120 |
_Py_TPFLAGS_HAVE_VECTORCALL | |
| 6121 |
#endif |
| 6122 |
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, |
| 6123 |
__pyx_CyFunctionType_slots |
| 6124 |
}; |
| 6125 |
#else |
| 6126 |
static PyTypeObject __pyx_CyFunctionType_type = { |
| 6127 |
PyVarObject_HEAD_INIT(0, 0) |
| 6128 |
__PYX_TYPE_MODULE_PREFIX "cython_function_or_method", |
| 6129 |
sizeof(__pyx_CyFunctionObject), |
| 6130 |
0, |
| 6131 |
(destructor) __Pyx_CyFunction_dealloc, |
| 6132 |
#if !CYTHON_METH_FASTCALL |
| 6133 |
0, |
| 6134 |
#elif CYTHON_BACKPORT_VECTORCALL |
| 6135 |
(printfunc)offsetof(__pyx_CyFunctionObject, func_vectorcall), |
| 6136 |
#else |
| 6137 |
offsetof(PyCFunctionObject, vectorcall), |
| 6138 |
#endif |
| 6139 |
0, |
| 6140 |
0, |
| 6141 |
#if PY_MAJOR_VERSION < 3 |
| 6142 |
0, |
| 6143 |
#else |
| 6144 |
0, |
| 6145 |
#endif |
| 6146 |
(reprfunc) __Pyx_CyFunction_repr, |
| 6147 |
0, |
| 6148 |
0, |
| 6149 |
0, |
| 6150 |
0, |
| 6151 |
__Pyx_CyFunction_CallAsMethod, |
| 6152 |
0, |
| 6153 |
0, |
| 6154 |
0, |
| 6155 |
0, |
| 6156 |
#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR |
| 6157 |
Py_TPFLAGS_METHOD_DESCRIPTOR | |
| 6158 |
#endif |
| 6159 |
#ifdef _Py_TPFLAGS_HAVE_VECTORCALL |
| 6160 |
_Py_TPFLAGS_HAVE_VECTORCALL | |
| 6161 |
#endif |
| 6162 |
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, |
| 6163 |
0, |
| 6164 |
(traverseproc) __Pyx_CyFunction_traverse, |
| 6165 |
(inquiry) __Pyx_CyFunction_clear, |
| 6166 |
0, |
| 6167 |
#if PY_VERSION_HEX < 0x030500A0 |
| 6168 |
offsetof(__pyx_CyFunctionObject, func_weakreflist), |
| 6169 |
#else |
| 6170 |
offsetof(PyCFunctionObject, m_weakreflist), |
| 6171 |
#endif |
| 6172 |
0, |
| 6173 |
0, |
| 6174 |
__pyx_CyFunction_methods, |
| 6175 |
__pyx_CyFunction_members, |
| 6176 |
__pyx_CyFunction_getsets, |
| 6177 |
0, |
| 6178 |
0, |
| 6179 |
__Pyx_PyMethod_New, |
| 6180 |
0, |
| 6181 |
offsetof(__pyx_CyFunctionObject, func_dict), |
| 6182 |
0, |
| 6183 |
0, |
| 6184 |
0, |
| 6185 |
0, |
| 6186 |
0, |
| 6187 |
0, |
| 6188 |
0, |
| 6189 |
0, |
| 6190 |
0, |
| 6191 |
0, |
| 6192 |
0, |
| 6193 |
0, |
| 6194 |
#if PY_VERSION_HEX >= 0x030400a1 |
| 6195 |
0, |
| 6196 |
#endif |
| 6197 |
#if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) |
| 6198 |
0, |
| 6199 |
#endif |
| 6200 |
#if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 |
| 6201 |
0, |
| 6202 |
#endif |
| 6203 |
#if PY_VERSION_HEX >= 0x030C0000 |
| 6204 |
0, |
| 6205 |
#endif |
| 6206 |
#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 |
| 6207 |
0, |
| 6208 |
#endif |
| 6209 |
}; |
| 6210 |
#endif |
| 6211 |
static int __pyx_CyFunction_init(PyObject *module) { |
| 6212 |
#if CYTHON_USE_TYPE_SPECS |
| 6213 |
__pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx_CyFunctionType_spec, NULL); |
| 6214 |
#else |
| 6215 |
CYTHON_UNUSED_VAR(module); |
| 6216 |
__pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type); |
| 6217 |
#endif |
| 6218 |
if (unlikely(__pyx_CyFunctionType == NULL)) { |
| 6219 |
return -1; |
| 6220 |
} |
| 6221 |
return 0; |
| 6222 |
} |
| 6223 |
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) { |
| 6224 |
__pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; |
| 6225 |
m->defaults = PyObject_Malloc(size); |
| 6226 |
if (unlikely(!m->defaults)) |
| 6227 |
return PyErr_NoMemory(); |
| 6228 |
memset(m->defaults, 0, size); |
| 6229 |
m->defaults_pyobjects = pyobjects; |
| 6230 |
m->defaults_size = size; |
| 6231 |
return m->defaults; |
| 6232 |
} |
| 6233 |
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { |
| 6234 |
__pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; |
| 6235 |
m->defaults_tuple = tuple; |
| 6236 |
Py_INCREF(tuple); |
| 6237 |
} |
| 6238 |
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { |
| 6239 |
__pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; |
| 6240 |
m->defaults_kwdict = dict; |
| 6241 |
Py_INCREF(dict); |
| 6242 |
} |
| 6243 |
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { |
| 6244 |
__pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; |
| 6245 |
m->func_annotations = dict; |
| 6246 |
Py_INCREF(dict); |
| 6247 |
} |
| 6248 |
|
| 6249 |
|
| 6250 |
static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname, |
| 6251 |
PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { |
| 6252 |
PyObject *op = __Pyx_CyFunction_Init( |
| 6253 |
PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType), |
| 6254 |
ml, flags, qualname, closure, module, globals, code |
| 6255 |
); |
| 6256 |
if (likely(op)) { |
| 6257 |
PyObject_GC_Track(op); |
| 6258 |
} |
| 6259 |
return op; |
| 6260 |
} |
| 6261 |
|
| 6262 |
|
| 6263 |
#ifndef CYTHON_CLINE_IN_TRACEBACK |
| 6264 |
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { |
| 6265 |
PyObject *use_cline; |
| 6266 |
PyObject *ptype, *pvalue, *ptraceback; |
| 6267 |
#if CYTHON_COMPILING_IN_CPYTHON |
| 6268 |
PyObject **cython_runtime_dict; |
| 6269 |
#endif |
| 6270 |
CYTHON_MAYBE_UNUSED_VAR(tstate); |
| 6271 |
if (unlikely(!__pyx_cython_runtime)) { |
| 6272 |
return c_line; |
| 6273 |
} |
| 6274 |
__Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); |
| 6275 |
#if CYTHON_COMPILING_IN_CPYTHON |
| 6276 |
cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime); |
| 6277 |
if (likely(cython_runtime_dict)) { |
| 6278 |
__PYX_PY_DICT_LOOKUP_IF_MODIFIED( |
| 6279 |
use_cline, *cython_runtime_dict, |
| 6280 |
__Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback)) |
| 6281 |
} else |
| 6282 |
#endif |
| 6283 |
{ |
| 6284 |
PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStrNoError(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); |
| 6285 |
if (use_cline_obj) { |
| 6286 |
use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True; |
| 6287 |
Py_DECREF(use_cline_obj); |
| 6288 |
} else { |
| 6289 |
PyErr_Clear(); |
| 6290 |
use_cline = NULL; |
| 6291 |
} |
| 6292 |
} |
| 6293 |
if (!use_cline) { |
| 6294 |
c_line = 0; |
| 6295 |
(void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); |
| 6296 |
} |
| 6297 |
else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { |
| 6298 |
c_line = 0; |
| 6299 |
} |
| 6300 |
__Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); |
| 6301 |
return c_line; |
| 6302 |
} |
| 6303 |
#endif |
| 6304 |
|
| 6305 |
|
| 6306 |
#if !CYTHON_COMPILING_IN_LIMITED_API |
| 6307 |
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { |
| 6308 |
int start = 0, mid = 0, end = count - 1; |
| 6309 |
if (end >= 0 && code_line > entries[end].code_line) { |
| 6310 |
return count; |
| 6311 |
} |
| 6312 |
while (start < end) { |
| 6313 |
mid = start + (end - start) / 2; |
| 6314 |
if (code_line < entries[mid].code_line) { |
| 6315 |
end = mid; |
| 6316 |
} else if (code_line > entries[mid].code_line) { |
| 6317 |
start = mid + 1; |
| 6318 |
} else { |
| 6319 |
return mid; |
| 6320 |
} |
| 6321 |
} |
| 6322 |
if (code_line <= entries[mid].code_line) { |
| 6323 |
return mid; |
| 6324 |
} else { |
| 6325 |
return mid + 1; |
| 6326 |
} |
| 6327 |
} |
| 6328 |
static PyCodeObject *__pyx_find_code_object(int code_line) { |
| 6329 |
PyCodeObject* code_object; |
| 6330 |
int pos; |
| 6331 |
if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { |
| 6332 |
return NULL; |
| 6333 |
} |
| 6334 |
pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); |
| 6335 |
if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { |
| 6336 |
return NULL; |
| 6337 |
} |
| 6338 |
code_object = __pyx_code_cache.entries[pos].code_object; |
| 6339 |
Py_INCREF(code_object); |
| 6340 |
return code_object; |
| 6341 |
} |
| 6342 |
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { |
| 6343 |
int pos, i; |
| 6344 |
__Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; |
| 6345 |
if (unlikely(!code_line)) { |
| 6346 |
return; |
| 6347 |
} |
| 6348 |
if (unlikely(!entries)) { |
| 6349 |
entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); |
| 6350 |
if (likely(entries)) { |
| 6351 |
__pyx_code_cache.entries = entries; |
| 6352 |
__pyx_code_cache.max_count = 64; |
| 6353 |
__pyx_code_cache.count = 1; |
| 6354 |
entries[0].code_line = code_line; |
| 6355 |
entries[0].code_object = code_object; |
| 6356 |
Py_INCREF(code_object); |
| 6357 |
} |
| 6358 |
return; |
| 6359 |
} |
| 6360 |
pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); |
| 6361 |
if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { |
| 6362 |
PyCodeObject* tmp = entries[pos].code_object; |
| 6363 |
entries[pos].code_object = code_object; |
| 6364 |
Py_DECREF(tmp); |
| 6365 |
return; |
| 6366 |
} |
| 6367 |
if (__pyx_code_cache.count == __pyx_code_cache.max_count) { |
| 6368 |
int new_max = __pyx_code_cache.max_count + 64; |
| 6369 |
entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( |
| 6370 |
__pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry)); |
| 6371 |
if (unlikely(!entries)) { |
| 6372 |
return; |
| 6373 |
} |
| 6374 |
__pyx_code_cache.entries = entries; |
| 6375 |
__pyx_code_cache.max_count = new_max; |
| 6376 |
} |
| 6377 |
for (i=__pyx_code_cache.count; i>pos; i--) { |
| 6378 |
entries[i] = entries[i-1]; |
| 6379 |
} |
| 6380 |
entries[pos].code_line = code_line; |
| 6381 |
entries[pos].code_object = code_object; |
| 6382 |
__pyx_code_cache.count++; |
| 6383 |
Py_INCREF(code_object); |
| 6384 |
} |
| 6385 |
#endif |
| 6386 |
|
| 6387 |
|
| 6388 |
#include "compile.h" |
| 6389 |
#include "frameobject.h" |
| 6390 |
#include "traceback.h" |
| 6391 |
#if PY_VERSION_HEX >= 0x030b00a6 && !defined(PYPY_VERSION) |
| 6392 |
#ifndef Py_BUILD_CORE |
| 6393 |
#define Py_BUILD_CORE 1 |
| 6394 |
#endif |
| 6395 |
#include "internal/pycore_frame.h" |
| 6396 |
#endif |
| 6397 |
#if CYTHON_COMPILING_IN_LIMITED_API |
| 6398 |
static void __Pyx_AddTraceback(const char *funcname, int c_line, |
| 6399 |
int py_line, const char *filename) { |
| 6400 |
if (c_line) { |
| 6401 |
(void) __pyx_cfilenm; |
| 6402 |
(void) __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line); |
| 6403 |
} |
| 6404 |
_PyTraceback_Add(funcname, filename, py_line); |
| 6405 |
} |
| 6406 |
#else |
| 6407 |
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( |
| 6408 |
const char *funcname, int c_line, |
| 6409 |
int py_line, const char *filename) { |
| 6410 |
PyCodeObject *py_code = NULL; |
| 6411 |
PyObject *py_funcname = NULL; |
| 6412 |
#if PY_MAJOR_VERSION < 3 |
| 6413 |
PyObject *py_srcfile = NULL; |
| 6414 |
py_srcfile = PyString_FromString(filename); |
| 6415 |
if (!py_srcfile) goto bad; |
| 6416 |
#endif |
| 6417 |
if (c_line) { |
| 6418 |
#if PY_MAJOR_VERSION < 3 |
| 6419 |
py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); |
| 6420 |
if (!py_funcname) goto bad; |
| 6421 |
#else |
| 6422 |
py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); |
| 6423 |
if (!py_funcname) goto bad; |
| 6424 |
funcname = PyUnicode_AsUTF8(py_funcname); |
| 6425 |
if (!funcname) goto bad; |
| 6426 |
#endif |
| 6427 |
} |
| 6428 |
else { |
| 6429 |
#if PY_MAJOR_VERSION < 3 |
| 6430 |
py_funcname = PyString_FromString(funcname); |
| 6431 |
if (!py_funcname) goto bad; |
| 6432 |
#endif |
| 6433 |
} |
| 6434 |
#if PY_MAJOR_VERSION < 3 |
| 6435 |
py_code = __Pyx_PyCode_New( |
| 6436 |
0, |
| 6437 |
0, |
| 6438 |
0, |
| 6439 |
0, |
| 6440 |
0, |
| 6441 |
0, |
| 6442 |
__pyx_empty_bytes, |
| 6443 |
__pyx_empty_tuple, |
| 6444 |
__pyx_empty_tuple, |
| 6445 |
__pyx_empty_tuple, |
| 6446 |
__pyx_empty_tuple, |
| 6447 |
__pyx_empty_tuple, |
| 6448 |
py_srcfile, |
| 6449 |
py_funcname, |
| 6450 |
py_line, |
| 6451 |
__pyx_empty_bytes |
| 6452 |
); |
| 6453 |
Py_DECREF(py_srcfile); |
| 6454 |
#else |
| 6455 |
py_code = PyCode_NewEmpty(filename, funcname, py_line); |
| 6456 |
#endif |
| 6457 |
Py_XDECREF(py_funcname); |
| 6458 |
return py_code; |
| 6459 |
bad: |
| 6460 |
Py_XDECREF(py_funcname); |
| 6461 |
#if PY_MAJOR_VERSION < 3 |
| 6462 |
Py_XDECREF(py_srcfile); |
| 6463 |
#endif |
| 6464 |
return NULL; |
| 6465 |
} |
| 6466 |
static void __Pyx_AddTraceback(const char *funcname, int c_line, |
| 6467 |
int py_line, const char *filename) { |
| 6468 |
PyCodeObject *py_code = 0; |
| 6469 |
PyFrameObject *py_frame = 0; |
| 6470 |
PyThreadState *tstate = __Pyx_PyThreadState_Current; |
| 6471 |
PyObject *ptype, *pvalue, *ptraceback; |
| 6472 |
if (c_line) { |
| 6473 |
c_line = __Pyx_CLineForTraceback(tstate, c_line); |
| 6474 |
} |
| 6475 |
py_code = __pyx_find_code_object(c_line ? -c_line : py_line); |
| 6476 |
if (!py_code) { |
| 6477 |
__Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); |
| 6478 |
py_code = __Pyx_CreateCodeObjectForTraceback( |
| 6479 |
funcname, c_line, py_line, filename); |
| 6480 |
if (!py_code) { |
| 6481 |
|
| 6482 |
|
| 6483 |
Py_XDECREF(ptype); |
| 6484 |
Py_XDECREF(pvalue); |
| 6485 |
Py_XDECREF(ptraceback); |
| 6486 |
goto bad; |
| 6487 |
} |
| 6488 |
__Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); |
| 6489 |
__pyx_insert_code_object(c_line ? -c_line : py_line, py_code); |
| 6490 |
} |
| 6491 |
py_frame = PyFrame_New( |
| 6492 |
tstate, |
| 6493 |
py_code, |
| 6494 |
__pyx_d, |
| 6495 |
0 |
| 6496 |
); |
| 6497 |
if (!py_frame) goto bad; |
| 6498 |
__Pyx_PyFrame_SetLineNumber(py_frame, py_line); |
| 6499 |
PyTraceBack_Here(py_frame); |
| 6500 |
bad: |
| 6501 |
Py_XDECREF(py_code); |
| 6502 |
Py_XDECREF(py_frame); |
| 6503 |
} |
| 6504 |
#endif |
| 6505 |
|
| 6506 |
|
| 6507 |
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { |
| 6508 |
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC |
| 6509 |
#pragma GCC diagnostic push |
| 6510 |
#pragma GCC diagnostic ignored "-Wconversion" |
| 6511 |
#endif |
| 6512 |
const long neg_one = (long) -1, const_zero = (long) 0; |
| 6513 |
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC |
| 6514 |
#pragma GCC diagnostic pop |
| 6515 |
#endif |
| 6516 |
const int is_unsigned = neg_one > const_zero; |
| 6517 |
if (is_unsigned) { |
| 6518 |
if (sizeof(long) < sizeof(long)) { |
| 6519 |
return PyInt_FromLong((long) value); |
| 6520 |
} else if (sizeof(long) <= sizeof(unsigned long)) { |
| 6521 |
return PyLong_FromUnsignedLong((unsigned long) value); |
| 6522 |
#ifdef HAVE_LONG_LONG |
| 6523 |
} else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { |
| 6524 |
return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); |
| 6525 |
#endif |
| 6526 |
} |
| 6527 |
} else { |
| 6528 |
if (sizeof(long) <= sizeof(long)) { |
| 6529 |
return PyInt_FromLong((long) value); |
| 6530 |
#ifdef HAVE_LONG_LONG |
| 6531 |
} else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { |
| 6532 |
return PyLong_FromLongLong((PY_LONG_LONG) value); |
| 6533 |
#endif |
| 6534 |
} |
| 6535 |
} |
| 6536 |
{ |
| 6537 |
int one = 1; int little = (int)*(unsigned char *)&one; |
| 6538 |
unsigned char *bytes = (unsigned char *)&value; |
| 6539 |
return _PyLong_FromByteArray(bytes, sizeof(long), |
| 6540 |
little, !is_unsigned); |
| 6541 |
} |
| 6542 |
} |
| 6543 |
|
| 6544 |
|
| 6545 |
#if CYTHON_COMPILING_IN_LIMITED_API |
| 6546 |
static __Pyx_TypeName |
| 6547 |
__Pyx_PyType_GetName(PyTypeObject* tp) |
| 6548 |
{ |
| 6549 |
PyObject *name = __Pyx_PyObject_GetAttrStr((PyObject *)tp, |
| 6550 |
__pyx_n_s_name); |
| 6551 |
if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) { |
| 6552 |
PyErr_Clear(); |
| 6553 |
Py_XSETREF(name, __Pyx_NewRef(__pyx_n_s__4)); |
| 6554 |
} |
| 6555 |
return name; |
| 6556 |
} |
| 6557 |
#endif |
| 6558 |
|
| 6559 |
|
| 6560 |
#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ |
| 6561 |
__PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) |
| 6562 |
#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ |
| 6563 |
__PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) |
| 6564 |
#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ |
| 6565 |
{\ |
| 6566 |
func_type value = func_value;\ |
| 6567 |
if (sizeof(target_type) < sizeof(func_type)) {\ |
| 6568 |
if (unlikely(value != (func_type) (target_type) value)) {\ |
| 6569 |
func_type zero = 0;\ |
| 6570 |
if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ |
| 6571 |
return (target_type) -1;\ |
| 6572 |
if (is_unsigned && unlikely(value < zero))\ |
| 6573 |
goto raise_neg_overflow;\ |
| 6574 |
else\ |
| 6575 |
goto raise_overflow;\ |
| 6576 |
}\ |
| 6577 |
}\ |
| 6578 |
return (target_type) value;\ |
| 6579 |
} |
| 6580 |
|
| 6581 |
|
| 6582 |
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { |
| 6583 |
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC |
| 6584 |
#pragma GCC diagnostic push |
| 6585 |
#pragma GCC diagnostic ignored "-Wconversion" |
| 6586 |
#endif |
| 6587 |
const long neg_one = (long) -1, const_zero = (long) 0; |
| 6588 |
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC |
| 6589 |
#pragma GCC diagnostic pop |
| 6590 |
#endif |
| 6591 |
const int is_unsigned = neg_one > const_zero; |
| 6592 |
#if PY_MAJOR_VERSION < 3 |
| 6593 |
if (likely(PyInt_Check(x))) { |
| 6594 |
if ((sizeof(long) < sizeof(long))) { |
| 6595 |
__PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) |
| 6596 |
} else { |
| 6597 |
long val = PyInt_AS_LONG(x); |
| 6598 |
if (is_unsigned && unlikely(val < 0)) { |
| 6599 |
goto raise_neg_overflow; |
| 6600 |
} |
| 6601 |
return (long) val; |
| 6602 |
} |
| 6603 |
} else |
| 6604 |
#endif |
| 6605 |
if (likely(PyLong_Check(x))) { |
| 6606 |
if (is_unsigned) { |
| 6607 |
#if CYTHON_USE_PYLONG_INTERNALS |
| 6608 |
if (unlikely(__Pyx_PyLong_IsNeg(x))) { |
| 6609 |
goto raise_neg_overflow; |
| 6610 |
} else if (__Pyx_PyLong_IsCompact(x)) { |
| 6611 |
__PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) |
| 6612 |
} else { |
| 6613 |
const digit* digits = __Pyx_PyLong_Digits(x); |
| 6614 |
assert(__Pyx_PyLong_DigitCount(x) > 1); |
| 6615 |
switch (__Pyx_PyLong_DigitCount(x)) { |
| 6616 |
case 2: |
| 6617 |
if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { |
| 6618 |
if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { |
| 6619 |
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) |
| 6620 |
} else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) { |
| 6621 |
return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); |
| 6622 |
} |
| 6623 |
} |
| 6624 |
break; |
| 6625 |
case 3: |
| 6626 |
if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { |
| 6627 |
if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { |
| 6628 |
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) |
| 6629 |
} else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) { |
| 6630 |
return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); |
| 6631 |
} |
| 6632 |
} |
| 6633 |
break; |
| 6634 |
case 4: |
| 6635 |
if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { |
| 6636 |
if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { |
| 6637 |
__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]))) |
| 6638 |
} else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) { |
| 6639 |
return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); |
| 6640 |
} |
| 6641 |
} |
| 6642 |
break; |
| 6643 |
} |
| 6644 |
} |
| 6645 |
#endif |
| 6646 |
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 |
| 6647 |
if (unlikely(Py_SIZE(x) < 0)) { |
| 6648 |
goto raise_neg_overflow; |
| 6649 |
} |
| 6650 |
#else |
| 6651 |
{ |
| 6652 |
int result = PyObject_RichCompareBool(x, Py_False, Py_LT); |
| 6653 |
if (unlikely(result < 0)) |
| 6654 |
return (long) -1; |
| 6655 |
if (unlikely(result == 1)) |
| 6656 |
goto raise_neg_overflow; |
| 6657 |
} |
| 6658 |
#endif |
| 6659 |
if ((sizeof(long) <= sizeof(unsigned long))) { |
| 6660 |
__PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) |
| 6661 |
#ifdef HAVE_LONG_LONG |
| 6662 |
} else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) { |
| 6663 |
__PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) |
| 6664 |
#endif |
| 6665 |
} |
| 6666 |
} else { |
| 6667 |
#if CYTHON_USE_PYLONG_INTERNALS |
| 6668 |
if (__Pyx_PyLong_IsCompact(x)) { |
| 6669 |
__PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) |
| 6670 |
} else { |
| 6671 |
const digit* digits = __Pyx_PyLong_Digits(x); |
| 6672 |
assert(__Pyx_PyLong_DigitCount(x) > 1); |
| 6673 |
switch (__Pyx_PyLong_SignedDigitCount(x)) { |
| 6674 |
case -2: |
| 6675 |
if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) { |
| 6676 |
if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { |
| 6677 |
__PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) |
| 6678 |
} else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { |
| 6679 |
return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); |
| 6680 |
} |
| 6681 |
} |
| 6682 |
break; |
| 6683 |
case 2: |
| 6684 |
if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) { |
| 6685 |
if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { |
| 6686 |
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) |
| 6687 |
} else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { |
| 6688 |
return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); |
| 6689 |
} |
| 6690 |
} |
| 6691 |
break; |
| 6692 |
case -3: |
| 6693 |
if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) { |
| 6694 |
if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { |
| 6695 |
__PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) |
| 6696 |
} else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { |
| 6697 |
return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); |
| 6698 |
} |
| 6699 |
} |
| 6700 |
break; |
| 6701 |
case 3: |
| 6702 |
if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) { |
| 6703 |
if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { |
| 6704 |
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) |
| 6705 |
} else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { |
| 6706 |
return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); |
| 6707 |
} |
| 6708 |
} |
| 6709 |
break; |
| 6710 |
case -4: |
| 6711 |
if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) { |
| 6712 |
if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { |
| 6713 |
__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]))) |
| 6714 |
} else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { |
| 6715 |
return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); |
| 6716 |
} |
| 6717 |
} |
| 6718 |
break; |
| 6719 |
case 4: |
| 6720 |
if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) { |
| 6721 |
if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { |
| 6722 |
__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]))) |
| 6723 |
} else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) { |
| 6724 |
return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); |
| 6725 |
} |
| 6726 |
} |
| 6727 |
break; |
| 6728 |
} |
| 6729 |
} |
| 6730 |
#endif |
| 6731 |
if ((sizeof(long) <= sizeof(long))) { |
| 6732 |
__PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) |
| 6733 |
#ifdef HAVE_LONG_LONG |
| 6734 |
} else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) { |
| 6735 |
__PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) |
| 6736 |
#endif |
| 6737 |
} |
| 6738 |
} |
| 6739 |
{ |
| 6740 |
#if (CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) && !defined(_PyLong_AsByteArray) |
| 6741 |
PyErr_SetString(PyExc_RuntimeError, |
| 6742 |
"_PyLong_AsByteArray() not available, cannot convert large numbers"); |
| 6743 |
#else |
| 6744 |
long val; |
| 6745 |
PyObject *v = __Pyx_PyNumber_IntOrLong(x); |
| 6746 |
#if PY_MAJOR_VERSION < 3 |
| 6747 |
if (likely(v) && !PyLong_Check(v)) { |
| 6748 |
PyObject *tmp = v; |
| 6749 |
v = PyNumber_Long(tmp); |
| 6750 |
Py_DECREF(tmp); |
| 6751 |
} |
| 6752 |
#endif |
| 6753 |
if (likely(v)) { |
| 6754 |
int one = 1; int is_little = (int)*(unsigned char *)&one; |
| 6755 |
unsigned char *bytes = (unsigned char *)&val; |
| 6756 |
int ret = _PyLong_AsByteArray((PyLongObject *)v, |
| 6757 |
bytes, sizeof(val), |
| 6758 |
is_little, !is_unsigned); |
| 6759 |
Py_DECREF(v); |
| 6760 |
if (likely(!ret)) |
| 6761 |
return val; |
| 6762 |
} |
| 6763 |
#endif |
| 6764 |
return (long) -1; |
| 6765 |
} |
| 6766 |
} else { |
| 6767 |
long val; |
| 6768 |
PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); |
| 6769 |
if (!tmp) return (long) -1; |
| 6770 |
val = __Pyx_PyInt_As_long(tmp); |
| 6771 |
Py_DECREF(tmp); |
| 6772 |
return val; |
| 6773 |
} |
| 6774 |
raise_overflow: |
| 6775 |
PyErr_SetString(PyExc_OverflowError, |
| 6776 |
"value too large to convert to long"); |
| 6777 |
return (long) -1; |
| 6778 |
raise_neg_overflow: |
| 6779 |
PyErr_SetString(PyExc_OverflowError, |
| 6780 |
"can't convert negative value to long"); |
| 6781 |
return (long) -1; |
| 6782 |
} |
| 6783 |
|
| 6784 |
|
| 6785 |
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { |
| 6786 |
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC |
| 6787 |
#pragma GCC diagnostic push |
| 6788 |
#pragma GCC diagnostic ignored "-Wconversion" |
| 6789 |
#endif |
| 6790 |
const int neg_one = (int) -1, const_zero = (int) 0; |
| 6791 |
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC |
| 6792 |
#pragma GCC diagnostic pop |
| 6793 |
#endif |
| 6794 |
const int is_unsigned = neg_one > const_zero; |
| 6795 |
#if PY_MAJOR_VERSION < 3 |
| 6796 |
if (likely(PyInt_Check(x))) { |
| 6797 |
if ((sizeof(int) < sizeof(long))) { |
| 6798 |
__PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) |
| 6799 |
} else { |
| 6800 |
long val = PyInt_AS_LONG(x); |
| 6801 |
if (is_unsigned && unlikely(val < 0)) { |
| 6802 |
goto raise_neg_overflow; |
| 6803 |
} |
| 6804 |
return (int) val; |
| 6805 |
} |
| 6806 |
} else |
| 6807 |
#endif |
| 6808 |
if (likely(PyLong_Check(x))) { |
| 6809 |
if (is_unsigned) { |
| 6810 |
#if CYTHON_USE_PYLONG_INTERNALS |
| 6811 |
if (unlikely(__Pyx_PyLong_IsNeg(x))) { |
| 6812 |
goto raise_neg_overflow; |
| 6813 |
} else if (__Pyx_PyLong_IsCompact(x)) { |
| 6814 |
__PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x)) |
| 6815 |
} else { |
| 6816 |
const digit* digits = __Pyx_PyLong_Digits(x); |
| 6817 |
assert(__Pyx_PyLong_DigitCount(x) > 1); |
| 6818 |
switch (__Pyx_PyLong_DigitCount(x)) { |
| 6819 |
case 2: |
| 6820 |
if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { |
| 6821 |
if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { |
| 6822 |
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) |
| 6823 |
} else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) { |
| 6824 |
return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); |
| 6825 |
} |
| 6826 |
} |
| 6827 |
break; |
| 6828 |
case 3: |
| 6829 |
if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { |
| 6830 |
if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { |
| 6831 |
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) |
| 6832 |
} else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) { |
| 6833 |
return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); |
| 6834 |
} |
| 6835 |
} |
| 6836 |
break; |
| 6837 |
case 4: |
| 6838 |
if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { |
| 6839 |
if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { |
| 6840 |
__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]))) |
| 6841 |
} else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) { |
| 6842 |
return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); |
| 6843 |
} |
| 6844 |
} |
| 6845 |
break; |
| 6846 |
} |
| 6847 |
} |
| 6848 |
#endif |
| 6849 |
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7 |
| 6850 |
if (unlikely(Py_SIZE(x) < 0)) { |
| 6851 |
goto raise_neg_overflow; |
| 6852 |
} |
| 6853 |
#else |
| 6854 |
{ |
| 6855 |
int result = PyObject_RichCompareBool(x, Py_False, Py_LT); |
| 6856 |
if (unlikely(result < 0)) |
| 6857 |
return (int) -1; |
| 6858 |
if (unlikely(result == 1)) |
| 6859 |
goto raise_neg_overflow; |
| 6860 |
} |
| 6861 |
#endif |
| 6862 |
if ((sizeof(int) <= sizeof(unsigned long))) { |
| 6863 |
__PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) |
| 6864 |
#ifdef HAVE_LONG_LONG |
| 6865 |
} else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) { |
| 6866 |
__PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) |
| 6867 |
#endif |
| 6868 |
} |
| 6869 |
} else { |
| 6870 |
#if CYTHON_USE_PYLONG_INTERNALS |
| 6871 |
if (__Pyx_PyLong_IsCompact(x)) { |
| 6872 |
__PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x)) |
| 6873 |
} else { |
| 6874 |
const digit* digits = __Pyx_PyLong_Digits(x); |
| 6875 |
assert(__Pyx_PyLong_DigitCount(x) > 1); |
| 6876 |
switch (__Pyx_PyLong_SignedDigitCount(x)) { |
| 6877 |
case -2: |
| 6878 |
if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) { |
| 6879 |
if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { |
| 6880 |
__PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) |
| 6881 |
} else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { |
| 6882 |
return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); |
| 6883 |
} |
| 6884 |
} |
| 6885 |
break; |
| 6886 |
case 2: |
| 6887 |
if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) { |
| 6888 |
if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) { |
| 6889 |
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) |
| 6890 |
} else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { |
| 6891 |
return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); |
| 6892 |
} |
| 6893 |
} |
| 6894 |
break; |
| 6895 |
case -3: |
| 6896 |
if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) { |
| 6897 |
if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { |
| 6898 |
__PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) |
| 6899 |
} else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { |
| 6900 |
return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); |
| 6901 |
} |
| 6902 |
} |
| 6903 |
break; |
| 6904 |
case 3: |
| 6905 |
if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) { |
| 6906 |
if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) { |
| 6907 |
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) |
| 6908 |
} else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { |
| 6909 |
return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); |
| 6910 |
} |
| 6911 |
} |
| 6912 |
break; |
| 6913 |
case -4: |
| 6914 |
if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) { |
| 6915 |
if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { |
| 6916 |
__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]))) |
| 6917 |
} else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { |
| 6918 |
return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); |
| 6919 |
} |
| 6920 |
} |
| 6921 |
break; |
| 6922 |
case 4: |
| 6923 |
if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) { |
| 6924 |
if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) { |
| 6925 |
__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]))) |
| 6926 |
} else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) { |
| 6927 |
return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); |
| 6928 |
} |
| 6929 |
} |
| 6930 |
break; |
| 6931 |
} |
| 6932 |
} |
| 6933 |
#endif |
| 6934 |
if ((sizeof(int) <= sizeof(long))) { |
| 6935 |
__PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) |
| 6936 |
#ifdef HAVE_LONG_LONG |
| 6937 |
} else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) { |
| 6938 |
__PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) |
| 6939 |
#endif |
| 6940 |
} |
| 6941 |
} |
| 6942 |
{ |
| 6943 |
#if (CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) && !defined(_PyLong_AsByteArray) |
| 6944 |
PyErr_SetString(PyExc_RuntimeError, |
| 6945 |
"_PyLong_AsByteArray() not available, cannot convert large numbers"); |
| 6946 |
#else |
| 6947 |
int val; |
| 6948 |
PyObject *v = __Pyx_PyNumber_IntOrLong(x); |
| 6949 |
#if PY_MAJOR_VERSION < 3 |
| 6950 |
if (likely(v) && !PyLong_Check(v)) { |
| 6951 |
PyObject *tmp = v; |
| 6952 |
v = PyNumber_Long(tmp); |
| 6953 |
Py_DECREF(tmp); |
| 6954 |
} |
| 6955 |
#endif |
| 6956 |
if (likely(v)) { |
| 6957 |
int one = 1; int is_little = (int)*(unsigned char *)&one; |
| 6958 |
unsigned char *bytes = (unsigned char *)&val; |
| 6959 |
int ret = _PyLong_AsByteArray((PyLongObject *)v, |
| 6960 |
bytes, sizeof(val), |
| 6961 |
is_little, !is_unsigned); |
| 6962 |
Py_DECREF(v); |
| 6963 |
if (likely(!ret)) |
| 6964 |
return val; |
| 6965 |
} |
| 6966 |
#endif |
| 6967 |
return (int) -1; |
| 6968 |
} |
| 6969 |
} else { |
| 6970 |
int val; |
| 6971 |
PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); |
| 6972 |
if (!tmp) return (int) -1; |
| 6973 |
val = __Pyx_PyInt_As_int(tmp); |
| 6974 |
Py_DECREF(tmp); |
| 6975 |
return val; |
| 6976 |
} |
| 6977 |
raise_overflow: |
| 6978 |
PyErr_SetString(PyExc_OverflowError, |
| 6979 |
"value too large to convert to int"); |
| 6980 |
return (int) -1; |
| 6981 |
raise_neg_overflow: |
| 6982 |
PyErr_SetString(PyExc_OverflowError, |
| 6983 |
"can't convert negative value to int"); |
| 6984 |
return (int) -1; |
| 6985 |
} |
| 6986 |
|
| 6987 |
|
| 6988 |
#if CYTHON_COMPILING_IN_CPYTHON |
| 6989 |
static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { |
| 6990 |
while (a) { |
| 6991 |
a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*); |
| 6992 |
if (a == b) |
| 6993 |
return 1; |
| 6994 |
} |
| 6995 |
return b == &PyBaseObject_Type; |
| 6996 |
} |
| 6997 |
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { |
| 6998 |
PyObject *mro; |
| 6999 |
if (a == b) return 1; |
| 7000 |
mro = a->tp_mro; |
| 7001 |
if (likely(mro)) { |
| 7002 |
Py_ssize_t i, n; |
| 7003 |
n = PyTuple_GET_SIZE(mro); |
| 7004 |
for (i = 0; i < n; i++) { |
| 7005 |
if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) |
| 7006 |
return 1; |
| 7007 |
} |
| 7008 |
return 0; |
| 7009 |
} |
| 7010 |
return __Pyx_InBases(a, b); |
| 7011 |
} |
| 7012 |
static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) { |
| 7013 |
PyObject *mro; |
| 7014 |
if (cls == a || cls == b) return 1; |
| 7015 |
mro = cls->tp_mro; |
| 7016 |
if (likely(mro)) { |
| 7017 |
Py_ssize_t i, n; |
| 7018 |
n = PyTuple_GET_SIZE(mro); |
| 7019 |
for (i = 0; i < n; i++) { |
| 7020 |
PyObject *base = PyTuple_GET_ITEM(mro, i); |
| 7021 |
if (base == (PyObject *)a || base == (PyObject *)b) |
| 7022 |
return 1; |
| 7023 |
} |
| 7024 |
return 0; |
| 7025 |
} |
| 7026 |
return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b); |
| 7027 |
} |
| 7028 |
#if PY_MAJOR_VERSION == 2 |
| 7029 |
static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { |
| 7030 |
PyObject *exception, *value, *tb; |
| 7031 |
int res; |
| 7032 |
__Pyx_PyThreadState_declare |
| 7033 |
__Pyx_PyThreadState_assign |
| 7034 |
__Pyx_ErrFetch(&exception, &value, &tb); |
| 7035 |
res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0; |
| 7036 |
if (unlikely(res == -1)) { |
| 7037 |
PyErr_WriteUnraisable(err); |
| 7038 |
res = 0; |
| 7039 |
} |
| 7040 |
if (!res) { |
| 7041 |
res = PyObject_IsSubclass(err, exc_type2); |
| 7042 |
if (unlikely(res == -1)) { |
| 7043 |
PyErr_WriteUnraisable(err); |
| 7044 |
res = 0; |
| 7045 |
} |
| 7046 |
} |
| 7047 |
__Pyx_ErrRestore(exception, value, tb); |
| 7048 |
return res; |
| 7049 |
} |
| 7050 |
#else |
| 7051 |
static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { |
| 7052 |
if (exc_type1) { |
| 7053 |
return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2); |
| 7054 |
} else { |
| 7055 |
return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); |
| 7056 |
} |
| 7057 |
} |
| 7058 |
#endif |
| 7059 |
static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { |
| 7060 |
Py_ssize_t i, n; |
| 7061 |
assert(PyExceptionClass_Check(exc_type)); |
| 7062 |
n = PyTuple_GET_SIZE(tuple); |
| 7063 |
#if PY_MAJOR_VERSION >= 3 |
| 7064 |
for (i=0; i<n; i++) { |
| 7065 |
if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1; |
| 7066 |
} |
| 7067 |
#endif |
| 7068 |
for (i=0; i<n; i++) { |
| 7069 |
PyObject *t = PyTuple_GET_ITEM(tuple, i); |
| 7070 |
#if PY_MAJOR_VERSION < 3 |
| 7071 |
if (likely(exc_type == t)) return 1; |
| 7072 |
#endif |
| 7073 |
if (likely(PyExceptionClass_Check(t))) { |
| 7074 |
if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1; |
| 7075 |
} else { |
| 7076 |
} |
| 7077 |
} |
| 7078 |
return 0; |
| 7079 |
} |
| 7080 |
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) { |
| 7081 |
if (likely(err == exc_type)) return 1; |
| 7082 |
if (likely(PyExceptionClass_Check(err))) { |
| 7083 |
if (likely(PyExceptionClass_Check(exc_type))) { |
| 7084 |
return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type); |
| 7085 |
} else if (likely(PyTuple_Check(exc_type))) { |
| 7086 |
return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type); |
| 7087 |
} else { |
| 7088 |
} |
| 7089 |
} |
| 7090 |
return PyErr_GivenExceptionMatches(err, exc_type); |
| 7091 |
} |
| 7092 |
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) { |
| 7093 |
assert(PyExceptionClass_Check(exc_type1)); |
| 7094 |
assert(PyExceptionClass_Check(exc_type2)); |
| 7095 |
if (likely(err == exc_type1 || err == exc_type2)) return 1; |
| 7096 |
if (likely(PyExceptionClass_Check(err))) { |
| 7097 |
return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2); |
| 7098 |
} |
| 7099 |
return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2)); |
| 7100 |
} |
| 7101 |
#endif |
| 7102 |
|
| 7103 |
|
| 7104 |
#if PY_VERSION_HEX < 0x030600B0 |
| 7105 |
static int __Pyx_async_gen_init_hooks(__pyx_PyAsyncGenObject *o) { |
| 7106 |
#if 0 |
| 7107 |
PyThreadState *tstate; |
| 7108 |
PyObject *finalizer; |
| 7109 |
PyObject *firstiter; |
| 7110 |
#endif |
| 7111 |
if (likely(o->ag_hooks_inited)) { |
| 7112 |
return 0; |
| 7113 |
} |
| 7114 |
o->ag_hooks_inited = 1; |
| 7115 |
#if 0 |
| 7116 |
tstate = __Pyx_PyThreadState_Current; |
| 7117 |
finalizer = tstate->async_gen_finalizer; |
| 7118 |
if (finalizer) { |
| 7119 |
Py_INCREF(finalizer); |
| 7120 |
o->ag_finalizer = finalizer; |
| 7121 |
} |
| 7122 |
firstiter = tstate->async_gen_firstiter; |
| 7123 |
if (firstiter) { |
| 7124 |
PyObject *res; |
| 7125 |
Py_INCREF(firstiter); |
| 7126 |
res = __Pyx_PyObject_CallOneArg(firstiter, (PyObject*)o); |
| 7127 |
Py_DECREF(firstiter); |
| 7128 |
if (res == NULL) { |
| 7129 |
return 1; |
| 7130 |
} |
| 7131 |
Py_DECREF(res); |
| 7132 |
} |
| 7133 |
#endif |
| 7134 |
return 0; |
| 7135 |
} |
| 7136 |
#endif |
| 7137 |
|
| 7138 |
|
| 7139 |
#if PY_MAJOR_VERSION < 3 |
| 7140 |
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { |
| 7141 |
__Pyx_PyThreadState_declare |
| 7142 |
CYTHON_UNUSED_VAR(cause); |
| 7143 |
Py_XINCREF(type); |
| 7144 |
if (!value || value == Py_None) |
| 7145 |
value = NULL; |
| 7146 |
else |
| 7147 |
Py_INCREF(value); |
| 7148 |
if (!tb || tb == Py_None) |
| 7149 |
tb = NULL; |
| 7150 |
else { |
| 7151 |
Py_INCREF(tb); |
| 7152 |
if (!PyTraceBack_Check(tb)) { |
| 7153 |
PyErr_SetString(PyExc_TypeError, |
| 7154 |
"raise: arg 3 must be a traceback or None"); |
| 7155 |
goto raise_error; |
| 7156 |
} |
| 7157 |
} |
| 7158 |
if (PyType_Check(type)) { |
| 7159 |
#if CYTHON_COMPILING_IN_PYPY |
| 7160 |
if (!value) { |
| 7161 |
Py_INCREF(Py_None); |
| 7162 |
value = Py_None; |
| 7163 |
} |
| 7164 |
#endif |
| 7165 |
PyErr_NormalizeException(&type, &value, &tb); |
| 7166 |
} else { |
| 7167 |
if (value) { |
| 7168 |
PyErr_SetString(PyExc_TypeError, |
| 7169 |
"instance exception may not have a separate value"); |
| 7170 |
goto raise_error; |
| 7171 |
} |
| 7172 |
value = type; |
| 7173 |
type = (PyObject*) Py_TYPE(type); |
| 7174 |
Py_INCREF(type); |
| 7175 |
if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { |
| 7176 |
PyErr_SetString(PyExc_TypeError, |
| 7177 |
"raise: exception class must be a subclass of BaseException"); |
| 7178 |
goto raise_error; |
| 7179 |
} |
| 7180 |
} |
| 7181 |
__Pyx_PyThreadState_assign |
| 7182 |
__Pyx_ErrRestore(type, value, tb); |
| 7183 |
return; |
| 7184 |
raise_error: |
| 7185 |
Py_XDECREF(value); |
| 7186 |
Py_XDECREF(type); |
| 7187 |
Py_XDECREF(tb); |
| 7188 |
return; |
| 7189 |
} |
| 7190 |
#else |
| 7191 |
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { |
| 7192 |
PyObject* owned_instance = NULL; |
| 7193 |
if (tb == Py_None) { |
| 7194 |
tb = 0; |
| 7195 |
} else if (tb && !PyTraceBack_Check(tb)) { |
| 7196 |
PyErr_SetString(PyExc_TypeError, |
| 7197 |
"raise: arg 3 must be a traceback or None"); |
| 7198 |
goto bad; |
| 7199 |
} |
| 7200 |
if (value == Py_None) |
| 7201 |
value = 0; |
| 7202 |
if (PyExceptionInstance_Check(type)) { |
| 7203 |
if (value) { |
| 7204 |
PyErr_SetString(PyExc_TypeError, |
| 7205 |
"instance exception may not have a separate value"); |
| 7206 |
goto bad; |
| 7207 |
} |
| 7208 |
value = type; |
| 7209 |
type = (PyObject*) Py_TYPE(value); |
| 7210 |
} else if (PyExceptionClass_Check(type)) { |
| 7211 |
PyObject *instance_class = NULL; |
| 7212 |
if (value && PyExceptionInstance_Check(value)) { |
| 7213 |
instance_class = (PyObject*) Py_TYPE(value); |
| 7214 |
if (instance_class != type) { |
| 7215 |
int is_subclass = PyObject_IsSubclass(instance_class, type); |
| 7216 |
if (!is_subclass) { |
| 7217 |
instance_class = NULL; |
| 7218 |
} else if (unlikely(is_subclass == -1)) { |
| 7219 |
goto bad; |
| 7220 |
} else { |
| 7221 |
type = instance_class; |
| 7222 |
} |
| 7223 |
} |
| 7224 |
} |
| 7225 |
if (!instance_class) { |
| 7226 |
PyObject *args; |
| 7227 |
if (!value) |
| 7228 |
args = PyTuple_New(0); |
| 7229 |
else if (PyTuple_Check(value)) { |
| 7230 |
Py_INCREF(value); |
| 7231 |
args = value; |
| 7232 |
} else |
| 7233 |
args = PyTuple_Pack(1, value); |
| 7234 |
if (!args) |
| 7235 |
goto bad; |
| 7236 |
owned_instance = PyObject_Call(type, args, NULL); |
| 7237 |
Py_DECREF(args); |
| 7238 |
if (!owned_instance) |
| 7239 |
goto bad; |
| 7240 |
value = owned_instance; |
| 7241 |
if (!PyExceptionInstance_Check(value)) { |
| 7242 |
PyErr_Format(PyExc_TypeError, |
| 7243 |
"calling %R should have returned an instance of " |
| 7244 |
"BaseException, not %R", |
| 7245 |
type, Py_TYPE(value)); |
| 7246 |
goto bad; |
| 7247 |
} |
| 7248 |
} |
| 7249 |
} else { |
| 7250 |
PyErr_SetString(PyExc_TypeError, |
| 7251 |
"raise: exception class must be a subclass of BaseException"); |
| 7252 |
goto bad; |
| 7253 |
} |
| 7254 |
if (cause) { |
| 7255 |
PyObject *fixed_cause; |
| 7256 |
if (cause == Py_None) { |
| 7257 |
fixed_cause = NULL; |
| 7258 |
} else if (PyExceptionClass_Check(cause)) { |
| 7259 |
fixed_cause = PyObject_CallObject(cause, NULL); |
| 7260 |
if (fixed_cause == NULL) |
| 7261 |
goto bad; |
| 7262 |
} else if (PyExceptionInstance_Check(cause)) { |
| 7263 |
fixed_cause = cause; |
| 7264 |
Py_INCREF(fixed_cause); |
| 7265 |
} else { |
| 7266 |
PyErr_SetString(PyExc_TypeError, |
| 7267 |
"exception causes must derive from " |
| 7268 |
"BaseException"); |
| 7269 |
goto bad; |
| 7270 |
} |
| 7271 |
PyException_SetCause(value, fixed_cause); |
| 7272 |
} |
| 7273 |
PyErr_SetObject(type, value); |
| 7274 |
if (tb) { |
| 7275 |
#if CYTHON_FAST_THREAD_STATE |
| 7276 |
PyThreadState *tstate = __Pyx_PyThreadState_Current; |
| 7277 |
PyObject* tmp_tb = tstate->curexc_traceback; |
| 7278 |
if (tb != tmp_tb) { |
| 7279 |
Py_INCREF(tb); |
| 7280 |
tstate->curexc_traceback = tb; |
| 7281 |
Py_XDECREF(tmp_tb); |
| 7282 |
} |
| 7283 |
#else |
| 7284 |
PyObject *tmp_type, *tmp_value, *tmp_tb; |
| 7285 |
PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); |
| 7286 |
Py_INCREF(tb); |
| 7287 |
PyErr_Restore(tmp_type, tmp_value, tb); |
| 7288 |
Py_XDECREF(tmp_tb); |
| 7289 |
#endif |
| 7290 |
} |
| 7291 |
bad: |
| 7292 |
Py_XDECREF(owned_instance); |
| 7293 |
return; |
| 7294 |
} |
| 7295 |
#endif |
| 7296 |
|
| 7297 |
|
| 7298 |
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { |
| 7299 |
PyObject *args[3] = {NULL, arg1, arg2}; |
| 7300 |
return __Pyx_PyObject_FastCall(function, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); |
| 7301 |
} |
| 7302 |
|
| 7303 |
|
| 7304 |
static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) { |
| 7305 |
PyObject *result = __Pyx_PyObject_CallOneArg(method, arg); |
| 7306 |
Py_DECREF(method); |
| 7307 |
return result; |
| 7308 |
} |
| 7309 |
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) { |
| 7310 |
PyObject *method = NULL, *result; |
| 7311 |
int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); |
| 7312 |
if (likely(is_method)) { |
| 7313 |
result = __Pyx_PyObject_Call2Args(method, obj, arg); |
| 7314 |
Py_DECREF(method); |
| 7315 |
return result; |
| 7316 |
} |
| 7317 |
if (unlikely(!method)) return NULL; |
| 7318 |
return __Pyx__PyObject_CallMethod1(method, arg); |
| 7319 |
} |
| 7320 |
|
| 7321 |
|
| 7322 |
#include <frameobject.h> |
| 7323 |
#if PY_VERSION_HEX >= 0x030b00a6 && !defined(PYPY_VERSION) |
| 7324 |
#ifndef Py_BUILD_CORE |
| 7325 |
#define Py_BUILD_CORE 1 |
| 7326 |
#endif |
| 7327 |
#include "internal/pycore_frame.h" |
| 7328 |
#endif |
| 7329 |
#define __Pyx_Coroutine_Undelegate(gen) Py_CLEAR((gen)->yieldfrom) |
| 7330 |
static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *__pyx_tstate, PyObject **pvalue) { |
| 7331 |
PyObject *et, *ev, *tb; |
| 7332 |
PyObject *value = NULL; |
| 7333 |
CYTHON_UNUSED_VAR(__pyx_tstate); |
| 7334 |
__Pyx_ErrFetch(&et, &ev, &tb); |
| 7335 |
if (!et) { |
| 7336 |
Py_XDECREF(tb); |
| 7337 |
Py_XDECREF(ev); |
| 7338 |
Py_INCREF(Py_None); |
| 7339 |
*pvalue = Py_None; |
| 7340 |
return 0; |
| 7341 |
} |
| 7342 |
if (likely(et == PyExc_StopIteration)) { |
| 7343 |
if (!ev) { |
| 7344 |
Py_INCREF(Py_None); |
| 7345 |
value = Py_None; |
| 7346 |
} |
| 7347 |
#if PY_VERSION_HEX >= 0x030300A0 |
| 7348 |
else if (likely(__Pyx_IS_TYPE(ev, (PyTypeObject*)PyExc_StopIteration))) { |
| 7349 |
value = ((PyStopIterationObject *)ev)->value; |
| 7350 |
Py_INCREF(value); |
| 7351 |
Py_DECREF(ev); |
| 7352 |
} |
| 7353 |
#endif |
| 7354 |
else if (unlikely(PyTuple_Check(ev))) { |
| 7355 |
if (PyTuple_GET_SIZE(ev) >= 1) { |
| 7356 |
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS |
| 7357 |
value = PyTuple_GET_ITEM(ev, 0); |
| 7358 |
Py_INCREF(value); |
| 7359 |
#else |
| 7360 |
value = PySequence_ITEM(ev, 0); |
| 7361 |
#endif |
| 7362 |
} else { |
| 7363 |
Py_INCREF(Py_None); |
| 7364 |
value = Py_None; |
| 7365 |
} |
| 7366 |
Py_DECREF(ev); |
| 7367 |
} |
| 7368 |
else if (!__Pyx_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) { |
| 7369 |
value = ev; |
| 7370 |
} |
| 7371 |
if (likely(value)) { |
| 7372 |
Py_XDECREF(tb); |
| 7373 |
Py_DECREF(et); |
| 7374 |
*pvalue = value; |
| 7375 |
return 0; |
| 7376 |
} |
| 7377 |
} else if (!__Pyx_PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) { |
| 7378 |
__Pyx_ErrRestore(et, ev, tb); |
| 7379 |
return -1; |
| 7380 |
} |
| 7381 |
PyErr_NormalizeException(&et, &ev, &tb); |
| 7382 |
if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) { |
| 7383 |
__Pyx_ErrRestore(et, ev, tb); |
| 7384 |
return -1; |
| 7385 |
} |
| 7386 |
Py_XDECREF(tb); |
| 7387 |
Py_DECREF(et); |
| 7388 |
#if PY_VERSION_HEX >= 0x030300A0 |
| 7389 |
value = ((PyStopIterationObject *)ev)->value; |
| 7390 |
Py_INCREF(value); |
| 7391 |
Py_DECREF(ev); |
| 7392 |
#else |
| 7393 |
{ |
| 7394 |
PyObject* args = __Pyx_PyObject_GetAttrStr(ev, __pyx_n_s_args); |
| 7395 |
Py_DECREF(ev); |
| 7396 |
if (likely(args)) { |
| 7397 |
value = PySequence_GetItem(args, 0); |
| 7398 |
Py_DECREF(args); |
| 7399 |
} |
| 7400 |
if (unlikely(!value)) { |
| 7401 |
__Pyx_ErrRestore(NULL, NULL, NULL); |
| 7402 |
Py_INCREF(Py_None); |
| 7403 |
value = Py_None; |
| 7404 |
} |
| 7405 |
} |
| 7406 |
#endif |
| 7407 |
*pvalue = value; |
| 7408 |
return 0; |
| 7409 |
} |
| 7410 |
static CYTHON_INLINE |
| 7411 |
void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *exc_state) { |
| 7412 |
#if PY_VERSION_HEX >= 0x030B00a4 |
| 7413 |
Py_CLEAR(exc_state->exc_value); |
| 7414 |
#else |
| 7415 |
PyObject *t, *v, *tb; |
| 7416 |
t = exc_state->exc_type; |
| 7417 |
v = exc_state->exc_value; |
| 7418 |
tb = exc_state->exc_traceback; |
| 7419 |
exc_state->exc_type = NULL; |
| 7420 |
exc_state->exc_value = NULL; |
| 7421 |
exc_state->exc_traceback = NULL; |
| 7422 |
Py_XDECREF(t); |
| 7423 |
Py_XDECREF(v); |
| 7424 |
Py_XDECREF(tb); |
| 7425 |
#endif |
| 7426 |
} |
| 7427 |
#define __Pyx_Coroutine_AlreadyRunningError(gen) (__Pyx__Coroutine_AlreadyRunningError(gen), (PyObject*)NULL) |
| 7428 |
static void __Pyx__Coroutine_AlreadyRunningError(__pyx_CoroutineObject *gen) { |
| 7429 |
const char *msg; |
| 7430 |
CYTHON_MAYBE_UNUSED_VAR(gen); |
| 7431 |
if ((0)) { |
| 7432 |
#ifdef __Pyx_Coroutine_USED |
| 7433 |
} else if (__Pyx_Coroutine_Check((PyObject*)gen)) { |
| 7434 |
msg = "coroutine already executing"; |
| 7435 |
#endif |
| 7436 |
#ifdef __Pyx_AsyncGen_USED |
| 7437 |
} else if (__Pyx_AsyncGen_CheckExact((PyObject*)gen)) { |
| 7438 |
msg = "async generator already executing"; |
| 7439 |
#endif |
| 7440 |
} else { |
| 7441 |
msg = "generator already executing"; |
| 7442 |
} |
| 7443 |
PyErr_SetString(PyExc_ValueError, msg); |
| 7444 |
} |
| 7445 |
#define __Pyx_Coroutine_NotStartedError(gen) (__Pyx__Coroutine_NotStartedError(gen), (PyObject*)NULL) |
| 7446 |
static void __Pyx__Coroutine_NotStartedError(PyObject *gen) { |
| 7447 |
const char *msg; |
| 7448 |
CYTHON_MAYBE_UNUSED_VAR(gen); |
| 7449 |
if ((0)) { |
| 7450 |
#ifdef __Pyx_Coroutine_USED |
| 7451 |
} else if (__Pyx_Coroutine_Check(gen)) { |
| 7452 |
msg = "can't send non-None value to a just-started coroutine"; |
| 7453 |
#endif |
| 7454 |
#ifdef __Pyx_AsyncGen_USED |
| 7455 |
} else if (__Pyx_AsyncGen_CheckExact(gen)) { |
| 7456 |
msg = "can't send non-None value to a just-started async generator"; |
| 7457 |
#endif |
| 7458 |
} else { |
| 7459 |
msg = "can't send non-None value to a just-started generator"; |
| 7460 |
} |
| 7461 |
PyErr_SetString(PyExc_TypeError, msg); |
| 7462 |
} |
| 7463 |
#define __Pyx_Coroutine_AlreadyTerminatedError(gen, value, closing) (__Pyx__Coroutine_AlreadyTerminatedError(gen, value, closing), (PyObject*)NULL) |
| 7464 |
static void __Pyx__Coroutine_AlreadyTerminatedError(PyObject *gen, PyObject *value, int closing) { |
| 7465 |
CYTHON_MAYBE_UNUSED_VAR(gen); |
| 7466 |
CYTHON_MAYBE_UNUSED_VAR(closing); |
| 7467 |
#ifdef __Pyx_Coroutine_USED |
| 7468 |
if (!closing && __Pyx_Coroutine_Check(gen)) { |
| 7469 |
PyErr_SetString(PyExc_RuntimeError, "cannot reuse already awaited coroutine"); |
| 7470 |
} else |
| 7471 |
#endif |
| 7472 |
if (value) { |
| 7473 |
#ifdef __Pyx_AsyncGen_USED |
| 7474 |
if (__Pyx_AsyncGen_CheckExact(gen)) |
| 7475 |
PyErr_SetNone(__Pyx_PyExc_StopAsyncIteration); |
| 7476 |
else |
| 7477 |
#endif |
| 7478 |
PyErr_SetNone(PyExc_StopIteration); |
| 7479 |
} |
| 7480 |
} |
| 7481 |
static |
| 7482 |
PyObject *__Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, int closing) { |
| 7483 |
__Pyx_PyThreadState_declare |
| 7484 |
PyThreadState *tstate; |
| 7485 |
__Pyx_ExcInfoStruct *exc_state; |
| 7486 |
PyObject *retval; |
| 7487 |
assert(!self->is_running); |
| 7488 |
if (unlikely(self->resume_label == 0)) { |
| 7489 |
if (unlikely(value && value != Py_None)) { |
| 7490 |
return __Pyx_Coroutine_NotStartedError((PyObject*)self); |
| 7491 |
} |
| 7492 |
} |
| 7493 |
if (unlikely(self->resume_label == -1)) { |
| 7494 |
return __Pyx_Coroutine_AlreadyTerminatedError((PyObject*)self, value, closing); |
| 7495 |
} |
| 7496 |
#if CYTHON_FAST_THREAD_STATE |
| 7497 |
__Pyx_PyThreadState_assign |
| 7498 |
tstate = __pyx_tstate; |
| 7499 |
#else |
| 7500 |
tstate = __Pyx_PyThreadState_Current; |
| 7501 |
#endif |
| 7502 |
exc_state = &self->gi_exc_state; |
| 7503 |
if (exc_state->exc_value) { |
| 7504 |
#if CYTHON_COMPILING_IN_PYPY |
| 7505 |
#else |
| 7506 |
PyObject *exc_tb; |
| 7507 |
#if PY_VERSION_HEX >= 0x030B00a4 |
| 7508 |
exc_tb = PyException_GetTraceback(exc_state->exc_value); |
| 7509 |
#else |
| 7510 |
exc_tb = exc_state->exc_traceback; |
| 7511 |
#endif |
| 7512 |
if (exc_tb) { |
| 7513 |
PyTracebackObject *tb = (PyTracebackObject *) exc_tb; |
| 7514 |
PyFrameObject *f = tb->tb_frame; |
| 7515 |
assert(f->f_back == NULL); |
| 7516 |
#if PY_VERSION_HEX >= 0x030B00A1 |
| 7517 |
f->f_back = PyThreadState_GetFrame(tstate); |
| 7518 |
#else |
| 7519 |
Py_XINCREF(tstate->frame); |
| 7520 |
f->f_back = tstate->frame; |
| 7521 |
#endif |
| 7522 |
#if PY_VERSION_HEX >= 0x030B00a4 |
| 7523 |
Py_DECREF(exc_tb); |
| 7524 |
#endif |
| 7525 |
} |
| 7526 |
#endif |
| 7527 |
} |
| 7528 |
#if CYTHON_USE_EXC_INFO_STACK |
| 7529 |
exc_state->previous_item = tstate->exc_info; |
| 7530 |
tstate->exc_info = exc_state; |
| 7531 |
#else |
| 7532 |
if (exc_state->exc_type) { |
| 7533 |
__Pyx_ExceptionSwap(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback); |
| 7534 |
} else { |
| 7535 |
__Pyx_Coroutine_ExceptionClear(exc_state); |
| 7536 |
__Pyx_ExceptionSave(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback); |
| 7537 |
} |
| 7538 |
#endif |
| 7539 |
self->is_running = 1; |
| 7540 |
retval = self->body(self, tstate, value); |
| 7541 |
self->is_running = 0; |
| 7542 |
#if CYTHON_USE_EXC_INFO_STACK |
| 7543 |
exc_state = &self->gi_exc_state; |
| 7544 |
tstate->exc_info = exc_state->previous_item; |
| 7545 |
exc_state->previous_item = NULL; |
| 7546 |
__Pyx_Coroutine_ResetFrameBackpointer(exc_state); |
| 7547 |
#endif |
| 7548 |
return retval; |
| 7549 |
} |
| 7550 |
static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state) { |
| 7551 |
#if CYTHON_COMPILING_IN_PYPY |
| 7552 |
CYTHON_UNUSED_VAR(exc_state); |
| 7553 |
#else |
| 7554 |
PyObject *exc_tb; |
| 7555 |
#if PY_VERSION_HEX >= 0x030B00a4 |
| 7556 |
if (!exc_state->exc_value) return; |
| 7557 |
exc_tb = PyException_GetTraceback(exc_state->exc_value); |
| 7558 |
#else |
| 7559 |
exc_tb = exc_state->exc_traceback; |
| 7560 |
#endif |
| 7561 |
if (likely(exc_tb)) { |
| 7562 |
PyTracebackObject *tb = (PyTracebackObject *) exc_tb; |
| 7563 |
PyFrameObject *f = tb->tb_frame; |
| 7564 |
Py_CLEAR(f->f_back); |
| 7565 |
#if PY_VERSION_HEX >= 0x030B00a4 |
| 7566 |
Py_DECREF(exc_tb); |
| 7567 |
#endif |
| 7568 |
} |
| 7569 |
#endif |
| 7570 |
} |
| 7571 |
static CYTHON_INLINE |
| 7572 |
PyObject *__Pyx_Coroutine_MethodReturn(PyObject* gen, PyObject *retval) { |
| 7573 |
CYTHON_MAYBE_UNUSED_VAR(gen); |
| 7574 |
if (unlikely(!retval)) { |
| 7575 |
__Pyx_PyThreadState_declare |
| 7576 |
__Pyx_PyThreadState_assign |
| 7577 |
if (!__Pyx_PyErr_Occurred()) { |
| 7578 |
PyObject *exc = PyExc_StopIteration; |
| 7579 |
#ifdef __Pyx_AsyncGen_USED |
| 7580 |
if (__Pyx_AsyncGen_CheckExact(gen)) |
| 7581 |
exc = __Pyx_PyExc_StopAsyncIteration; |
| 7582 |
#endif |
| 7583 |
__Pyx_PyErr_SetNone(exc); |
| 7584 |
} |
| 7585 |
} |
| 7586 |
return retval; |
| 7587 |
} |
| 7588 |
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3) |
| 7589 |
static CYTHON_INLINE |
| 7590 |
PyObject *__Pyx_PyGen_Send(PyGenObject *gen, PyObject *arg) { |
| 7591 |
#if PY_VERSION_HEX <= 0x030A00A1 |
| 7592 |
return _PyGen_Send(gen, arg); |
| 7593 |
#else |
| 7594 |
PyObject *result; |
| 7595 |
if (PyIter_Send((PyObject*)gen, arg ? arg : Py_None, &result) == PYGEN_RETURN) { |
| 7596 |
if (PyAsyncGen_CheckExact(gen)) { |
| 7597 |
assert(result == Py_None); |
| 7598 |
PyErr_SetNone(PyExc_StopAsyncIteration); |
| 7599 |
} |
| 7600 |
else if (result == Py_None) { |
| 7601 |
PyErr_SetNone(PyExc_StopIteration); |
| 7602 |
} |
| 7603 |
else { |
| 7604 |
_PyGen_SetStopIterationValue(result); |
| 7605 |
} |
| 7606 |
Py_CLEAR(result); |
| 7607 |
} |
| 7608 |
return result; |
| 7609 |
#endif |
| 7610 |
} |
| 7611 |
#endif |
| 7612 |
static CYTHON_INLINE |
| 7613 |
PyObject *__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen) { |
| 7614 |
PyObject *ret; |
| 7615 |
PyObject *val = NULL; |
| 7616 |
__Pyx_Coroutine_Undelegate(gen); |
| 7617 |
__Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, &val); |
| 7618 |
ret = __Pyx_Coroutine_SendEx(gen, val, 0); |
| 7619 |
Py_XDECREF(val); |
| 7620 |
return ret; |
| 7621 |
} |
| 7622 |
static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) { |
| 7623 |
PyObject *retval; |
| 7624 |
__pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self; |
| 7625 |
PyObject *yf = gen->yieldfrom; |
| 7626 |
if (unlikely(gen->is_running)) |
| 7627 |
return __Pyx_Coroutine_AlreadyRunningError(gen); |
| 7628 |
if (yf) { |
| 7629 |
PyObject *ret; |
| 7630 |
gen->is_running = 1; |
| 7631 |
#ifdef __Pyx_Generator_USED |
| 7632 |
if (__Pyx_Generator_CheckExact(yf)) { |
| 7633 |
ret = __Pyx_Coroutine_Send(yf, value); |
| 7634 |
} else |
| 7635 |
#endif |
| 7636 |
#ifdef __Pyx_Coroutine_USED |
| 7637 |
if (__Pyx_Coroutine_Check(yf)) { |
| 7638 |
ret = __Pyx_Coroutine_Send(yf, value); |
| 7639 |
} else |
| 7640 |
#endif |
| 7641 |
#ifdef __Pyx_AsyncGen_USED |
| 7642 |
if (__pyx_PyAsyncGenASend_CheckExact(yf)) { |
| 7643 |
ret = __Pyx_async_gen_asend_send(yf, value); |
| 7644 |
} else |
| 7645 |
#endif |
| 7646 |
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3) |
| 7647 |
if (PyGen_CheckExact(yf)) { |
| 7648 |
ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value); |
| 7649 |
} else |
| 7650 |
#endif |
| 7651 |
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03050000 && defined(PyCoro_CheckExact) && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3) |
| 7652 |
if (PyCoro_CheckExact(yf)) { |
| 7653 |
ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value); |
| 7654 |
} else |
| 7655 |
#endif |
| 7656 |
{ |
| 7657 |
if (value == Py_None) |
| 7658 |
ret = __Pyx_PyObject_GetIterNextFunc(yf)(yf); |
| 7659 |
else |
| 7660 |
ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s_send, value); |
| 7661 |
} |
| 7662 |
gen->is_running = 0; |
| 7663 |
if (likely(ret)) { |
| 7664 |
return ret; |
| 7665 |
} |
| 7666 |
retval = __Pyx_Coroutine_FinishDelegation(gen); |
| 7667 |
} else { |
| 7668 |
retval = __Pyx_Coroutine_SendEx(gen, value, 0); |
| 7669 |
} |
| 7670 |
return __Pyx_Coroutine_MethodReturn(self, retval); |
| 7671 |
} |
| 7672 |
static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) { |
| 7673 |
PyObject *retval = NULL; |
| 7674 |
int err = 0; |
| 7675 |
#ifdef __Pyx_Generator_USED |
| 7676 |
if (__Pyx_Generator_CheckExact(yf)) { |
| 7677 |
retval = __Pyx_Coroutine_Close(yf); |
| 7678 |
if (!retval) |
| 7679 |
return -1; |
| 7680 |
} else |
| 7681 |
#endif |
| 7682 |
#ifdef __Pyx_Coroutine_USED |
| 7683 |
if (__Pyx_Coroutine_Check(yf)) { |
| 7684 |
retval = __Pyx_Coroutine_Close(yf); |
| 7685 |
if (!retval) |
| 7686 |
return -1; |
| 7687 |
} else |
| 7688 |
if (__Pyx_CoroutineAwait_CheckExact(yf)) { |
| 7689 |
retval = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf, NULL); |
| 7690 |
if (!retval) |
| 7691 |
return -1; |
| 7692 |
} else |
| 7693 |
#endif |
| 7694 |
#ifdef __Pyx_AsyncGen_USED |
| 7695 |
if (__pyx_PyAsyncGenASend_CheckExact(yf)) { |
| 7696 |
retval = __Pyx_async_gen_asend_close(yf, NULL); |
| 7697 |
} else |
| 7698 |
if (__pyx_PyAsyncGenAThrow_CheckExact(yf)) { |
| 7699 |
retval = __Pyx_async_gen_athrow_close(yf, NULL); |
| 7700 |
} else |
| 7701 |
#endif |
| 7702 |
{ |
| 7703 |
PyObject *meth; |
| 7704 |
gen->is_running = 1; |
| 7705 |
meth = __Pyx_PyObject_GetAttrStrNoError(yf, __pyx_n_s_close); |
| 7706 |
if (unlikely(!meth)) { |
| 7707 |
if (unlikely(PyErr_Occurred())) { |
| 7708 |
PyErr_WriteUnraisable(yf); |
| 7709 |
} |
| 7710 |
} else { |
| 7711 |
retval = __Pyx_PyObject_CallNoArg(meth); |
| 7712 |
Py_DECREF(meth); |
| 7713 |
if (unlikely(!retval)) |
| 7714 |
err = -1; |
| 7715 |
} |
| 7716 |
gen->is_running = 0; |
| 7717 |
} |
| 7718 |
Py_XDECREF(retval); |
| 7719 |
return err; |
| 7720 |
} |
| 7721 |
static PyObject *__Pyx_Generator_Next(PyObject *self) { |
| 7722 |
__pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self; |
| 7723 |
PyObject *yf = gen->yieldfrom; |
| 7724 |
if (unlikely(gen->is_running)) |
| 7725 |
return __Pyx_Coroutine_AlreadyRunningError(gen); |
| 7726 |
if (yf) { |
| 7727 |
PyObject *ret; |
| 7728 |
gen->is_running = 1; |
| 7729 |
#ifdef __Pyx_Generator_USED |
| 7730 |
if (__Pyx_Generator_CheckExact(yf)) { |
| 7731 |
ret = __Pyx_Generator_Next(yf); |
| 7732 |
} else |
| 7733 |
#endif |
| 7734 |
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3) |
| 7735 |
if (PyGen_CheckExact(yf)) { |
| 7736 |
ret = __Pyx_PyGen_Send((PyGenObject*)yf, NULL); |
| 7737 |
} else |
| 7738 |
#endif |
| 7739 |
#ifdef __Pyx_Coroutine_USED |
| 7740 |
if (__Pyx_Coroutine_Check(yf)) { |
| 7741 |
ret = __Pyx_Coroutine_Send(yf, Py_None); |
| 7742 |
} else |
| 7743 |
#endif |
| 7744 |
ret = __Pyx_PyObject_GetIterNextFunc(yf)(yf); |
| 7745 |
gen->is_running = 0; |
| 7746 |
if (likely(ret)) { |
| 7747 |
return ret; |
| 7748 |
} |
| 7749 |
return __Pyx_Coroutine_FinishDelegation(gen); |
| 7750 |
} |
| 7751 |
return __Pyx_Coroutine_SendEx(gen, Py_None, 0); |
| 7752 |
} |
| 7753 |
static PyObject *__Pyx_Coroutine_Close_Method(PyObject *self, PyObject *arg) { |
| 7754 |
CYTHON_UNUSED_VAR(arg); |
| 7755 |
return __Pyx_Coroutine_Close(self); |
| 7756 |
} |
| 7757 |
static PyObject *__Pyx_Coroutine_Close(PyObject *self) { |
| 7758 |
__pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; |
| 7759 |
PyObject *retval, *raised_exception; |
| 7760 |
PyObject *yf = gen->yieldfrom; |
| 7761 |
int err = 0; |
| 7762 |
if (unlikely(gen->is_running)) |
| 7763 |
return __Pyx_Coroutine_AlreadyRunningError(gen); |
| 7764 |
if (yf) { |
| 7765 |
Py_INCREF(yf); |
| 7766 |
err = __Pyx_Coroutine_CloseIter(gen, yf); |
| 7767 |
__Pyx_Coroutine_Undelegate(gen); |
| 7768 |
Py_DECREF(yf); |
| 7769 |
} |
| 7770 |
if (err == 0) |
| 7771 |
PyErr_SetNone(PyExc_GeneratorExit); |
| 7772 |
retval = __Pyx_Coroutine_SendEx(gen, NULL, 1); |
| 7773 |
if (unlikely(retval)) { |
| 7774 |
const char *msg; |
| 7775 |
Py_DECREF(retval); |
| 7776 |
if ((0)) { |
| 7777 |
#ifdef __Pyx_Coroutine_USED |
| 7778 |
} else if (__Pyx_Coroutine_Check(self)) { |
| 7779 |
msg = "coroutine ignored GeneratorExit"; |
| 7780 |
#endif |
| 7781 |
#ifdef __Pyx_AsyncGen_USED |
| 7782 |
} else if (__Pyx_AsyncGen_CheckExact(self)) { |
| 7783 |
#if PY_VERSION_HEX < 0x03060000 |
| 7784 |
msg = "async generator ignored GeneratorExit - might require Python 3.6+ finalisation (PEP 525)"; |
| 7785 |
#else |
| 7786 |
msg = "async generator ignored GeneratorExit"; |
| 7787 |
#endif |
| 7788 |
#endif |
| 7789 |
} else { |
| 7790 |
msg = "generator ignored GeneratorExit"; |
| 7791 |
} |
| 7792 |
PyErr_SetString(PyExc_RuntimeError, msg); |
| 7793 |
return NULL; |
| 7794 |
} |
| 7795 |
raised_exception = PyErr_Occurred(); |
| 7796 |
if (likely(!raised_exception || __Pyx_PyErr_GivenExceptionMatches2(raised_exception, PyExc_GeneratorExit, PyExc_StopIteration))) { |
| 7797 |
if (raised_exception) PyErr_Clear(); |
| 7798 |
Py_INCREF(Py_None); |
| 7799 |
return Py_None; |
| 7800 |
} |
| 7801 |
return NULL; |
| 7802 |
} |
| 7803 |
static PyObject *__Pyx__Coroutine_Throw(PyObject *self, PyObject *typ, PyObject *val, PyObject *tb, |
| 7804 |
PyObject *args, int close_on_genexit) { |
| 7805 |
__pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; |
| 7806 |
PyObject *yf = gen->yieldfrom; |
| 7807 |
if (unlikely(gen->is_running)) |
| 7808 |
return __Pyx_Coroutine_AlreadyRunningError(gen); |
| 7809 |
if (yf) { |
| 7810 |
PyObject *ret; |
| 7811 |
Py_INCREF(yf); |
| 7812 |
if (__Pyx_PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit) && close_on_genexit) { |
| 7813 |
int err = __Pyx_Coroutine_CloseIter(gen, yf); |
| 7814 |
Py_DECREF(yf); |
| 7815 |
__Pyx_Coroutine_Undelegate(gen); |
| 7816 |
if (err < 0) |
| 7817 |
return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0)); |
| 7818 |
goto throw_here; |
| 7819 |
} |
| 7820 |
gen->is_running = 1; |
| 7821 |
if (0 |
| 7822 |
#ifdef __Pyx_Generator_USED |
| 7823 |
|| __Pyx_Generator_CheckExact(yf) |
| 7824 |
#endif |
| 7825 |
#ifdef __Pyx_Coroutine_USED |
| 7826 |
|| __Pyx_Coroutine_Check(yf) |
| 7827 |
#endif |
| 7828 |
) { |
| 7829 |
ret = __Pyx__Coroutine_Throw(yf, typ, val, tb, args, close_on_genexit); |
| 7830 |
#ifdef __Pyx_Coroutine_USED |
| 7831 |
} else if (__Pyx_CoroutineAwait_CheckExact(yf)) { |
| 7832 |
ret = __Pyx__Coroutine_Throw(((__pyx_CoroutineAwaitObject*)yf)->coroutine, typ, val, tb, args, close_on_genexit); |
| 7833 |
#endif |
| 7834 |
} else { |
| 7835 |
PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(yf, __pyx_n_s_throw); |
| 7836 |
if (unlikely(!meth)) { |
| 7837 |
Py_DECREF(yf); |
| 7838 |
if (unlikely(PyErr_Occurred())) { |
| 7839 |
gen->is_running = 0; |
| 7840 |
return NULL; |
| 7841 |
} |
| 7842 |
__Pyx_Coroutine_Undelegate(gen); |
| 7843 |
gen->is_running = 0; |
| 7844 |
goto throw_here; |
| 7845 |
} |
| 7846 |
if (likely(args)) { |
| 7847 |
ret = __Pyx_PyObject_Call(meth, args, NULL); |
| 7848 |
} else { |
| 7849 |
PyObject *cargs[4] = {NULL, typ, val, tb}; |
| 7850 |
ret = __Pyx_PyObject_FastCall(meth, cargs+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); |
| 7851 |
} |
| 7852 |
Py_DECREF(meth); |
| 7853 |
} |
| 7854 |
gen->is_running = 0; |
| 7855 |
Py_DECREF(yf); |
| 7856 |
if (!ret) { |
| 7857 |
ret = __Pyx_Coroutine_FinishDelegation(gen); |
| 7858 |
} |
| 7859 |
return __Pyx_Coroutine_MethodReturn(self, ret); |
| 7860 |
} |
| 7861 |
throw_here: |
| 7862 |
__Pyx_Raise(typ, val, tb, NULL); |
| 7863 |
return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0)); |
| 7864 |
} |
| 7865 |
static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) { |
| 7866 |
PyObject *typ; |
| 7867 |
PyObject *val = NULL; |
| 7868 |
PyObject *tb = NULL; |
| 7869 |
if (unlikely(!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb))) |
| 7870 |
return NULL; |
| 7871 |
return __Pyx__Coroutine_Throw(self, typ, val, tb, args, 1); |
| 7872 |
} |
| 7873 |
static CYTHON_INLINE int __Pyx_Coroutine_traverse_excstate(__Pyx_ExcInfoStruct *exc_state, visitproc visit, void *arg) { |
| 7874 |
#if PY_VERSION_HEX >= 0x030B00a4 |
| 7875 |
Py_VISIT(exc_state->exc_value); |
| 7876 |
#else |
| 7877 |
Py_VISIT(exc_state->exc_type); |
| 7878 |
Py_VISIT(exc_state->exc_value); |
| 7879 |
Py_VISIT(exc_state->exc_traceback); |
| 7880 |
#endif |
| 7881 |
return 0; |
| 7882 |
} |
| 7883 |
static int __Pyx_Coroutine_traverse(__pyx_CoroutineObject *gen, visitproc visit, void *arg) { |
| 7884 |
Py_VISIT(gen->closure); |
| 7885 |
Py_VISIT(gen->classobj); |
| 7886 |
Py_VISIT(gen->yieldfrom); |
| 7887 |
return __Pyx_Coroutine_traverse_excstate(&gen->gi_exc_state, visit, arg); |
| 7888 |
} |
| 7889 |
static int __Pyx_Coroutine_clear(PyObject *self) { |
| 7890 |
__pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; |
| 7891 |
Py_CLEAR(gen->closure); |
| 7892 |
Py_CLEAR(gen->classobj); |
| 7893 |
Py_CLEAR(gen->yieldfrom); |
| 7894 |
__Pyx_Coroutine_ExceptionClear(&gen->gi_exc_state); |
| 7895 |
#ifdef __Pyx_AsyncGen_USED |
| 7896 |
if (__Pyx_AsyncGen_CheckExact(self)) { |
| 7897 |
Py_CLEAR(((__pyx_PyAsyncGenObject*)gen)->ag_finalizer); |
| 7898 |
} |
| 7899 |
#endif |
| 7900 |
Py_CLEAR(gen->gi_code); |
| 7901 |
Py_CLEAR(gen->gi_frame); |
| 7902 |
Py_CLEAR(gen->gi_name); |
| 7903 |
Py_CLEAR(gen->gi_qualname); |
| 7904 |
Py_CLEAR(gen->gi_modulename); |
| 7905 |
return 0; |
| 7906 |
} |
| 7907 |
static void __Pyx_Coroutine_dealloc(PyObject *self) { |
| 7908 |
__pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; |
| 7909 |
PyObject_GC_UnTrack(gen); |
| 7910 |
if (gen->gi_weakreflist != NULL) |
| 7911 |
PyObject_ClearWeakRefs(self); |
| 7912 |
if (gen->resume_label >= 0) { |
| 7913 |
PyObject_GC_Track(self); |
| 7914 |
#if PY_VERSION_HEX >= 0x030400a1 && CYTHON_USE_TP_FINALIZE |
| 7915 |
if (unlikely(PyObject_CallFinalizerFromDealloc(self))) |
| 7916 |
#else |
| 7917 |
Py_TYPE(gen)->tp_del(self); |
| 7918 |
if (unlikely(Py_REFCNT(self) > 0)) |
| 7919 |
#endif |
| 7920 |
{ |
| 7921 |
return; |
| 7922 |
} |
| 7923 |
PyObject_GC_UnTrack(self); |
| 7924 |
} |
| 7925 |
#ifdef __Pyx_AsyncGen_USED |
| 7926 |
if (__Pyx_AsyncGen_CheckExact(self)) { |
| 7927 |
|
| 7928 |
|
| 7929 |
|
| 7930 |
Py_CLEAR(((__pyx_PyAsyncGenObject*)self)->ag_finalizer); |
| 7931 |
} |
| 7932 |
#endif |
| 7933 |
__Pyx_Coroutine_clear(self); |
| 7934 |
__Pyx_PyHeapTypeObject_GC_Del(gen); |
| 7935 |
} |
| 7936 |
static void __Pyx_Coroutine_del(PyObject *self) { |
| 7937 |
PyObject *error_type, *error_value, *error_traceback; |
| 7938 |
__pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; |
| 7939 |
__Pyx_PyThreadState_declare |
| 7940 |
if (gen->resume_label < 0) { |
| 7941 |
return; |
| 7942 |
} |
| 7943 |
#if !CYTHON_USE_TP_FINALIZE |
| 7944 |
assert(self->ob_refcnt == 0); |
| 7945 |
__Pyx_SET_REFCNT(self, 1); |
| 7946 |
#endif |
| 7947 |
__Pyx_PyThreadState_assign |
| 7948 |
__Pyx_ErrFetch(&error_type, &error_value, &error_traceback); |
| 7949 |
#ifdef __Pyx_AsyncGen_USED |
| 7950 |
if (__Pyx_AsyncGen_CheckExact(self)) { |
| 7951 |
__pyx_PyAsyncGenObject *agen = (__pyx_PyAsyncGenObject*)self; |
| 7952 |
PyObject *finalizer = agen->ag_finalizer; |
| 7953 |
if (finalizer && !agen->ag_closed) { |
| 7954 |
PyObject *res = __Pyx_PyObject_CallOneArg(finalizer, self); |
| 7955 |
if (unlikely(!res)) { |
| 7956 |
PyErr_WriteUnraisable(self); |
| 7957 |
} else { |
| 7958 |
Py_DECREF(res); |
| 7959 |
} |
| 7960 |
__Pyx_ErrRestore(error_type, error_value, error_traceback); |
| 7961 |
return; |
| 7962 |
} |
| 7963 |
} |
| 7964 |
#endif |
| 7965 |
if (unlikely(gen->resume_label == 0 && !error_value)) { |
| 7966 |
#ifdef __Pyx_Coroutine_USED |
| 7967 |
#ifdef __Pyx_Generator_USED |
| 7968 |
if (!__Pyx_Generator_CheckExact(self)) |
| 7969 |
#endif |
| 7970 |
{ |
| 7971 |
PyObject_GC_UnTrack(self); |
| 7972 |
#if PY_MAJOR_VERSION >= 3 || defined(PyErr_WarnFormat) |
| 7973 |
if (unlikely(PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "coroutine '%.50S' was never awaited", gen->gi_qualname) < 0)) |
| 7974 |
PyErr_WriteUnraisable(self); |
| 7975 |
#else |
| 7976 |
{PyObject *msg; |
| 7977 |
char *cmsg; |
| 7978 |
#if CYTHON_COMPILING_IN_PYPY |
| 7979 |
msg = NULL; |
| 7980 |
cmsg = (char*) "coroutine was never awaited"; |
| 7981 |
#else |
| 7982 |
char *cname; |
| 7983 |
PyObject *qualname; |
| 7984 |
qualname = gen->gi_qualname; |
| 7985 |
cname = PyString_AS_STRING(qualname); |
| 7986 |
msg = PyString_FromFormat("coroutine '%.50s' was never awaited", cname); |
| 7987 |
if (unlikely(!msg)) { |
| 7988 |
PyErr_Clear(); |
| 7989 |
cmsg = (char*) "coroutine was never awaited"; |
| 7990 |
} else { |
| 7991 |
cmsg = PyString_AS_STRING(msg); |
| 7992 |
} |
| 7993 |
#endif |
| 7994 |
if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, cmsg, 1) < 0)) |
| 7995 |
PyErr_WriteUnraisable(self); |
| 7996 |
Py_XDECREF(msg);} |
| 7997 |
#endif |
| 7998 |
PyObject_GC_Track(self); |
| 7999 |
} |
| 8000 |
#endif |
| 8001 |
} else { |
| 8002 |
PyObject *res = __Pyx_Coroutine_Close(self); |
| 8003 |
if (unlikely(!res)) { |
| 8004 |
if (PyErr_Occurred()) |
| 8005 |
PyErr_WriteUnraisable(self); |
| 8006 |
} else { |
| 8007 |
Py_DECREF(res); |
| 8008 |
} |
| 8009 |
} |
| 8010 |
__Pyx_ErrRestore(error_type, error_value, error_traceback); |
| 8011 |
#if !CYTHON_USE_TP_FINALIZE |
| 8012 |
assert(Py_REFCNT(self) > 0); |
| 8013 |
if (likely(--self->ob_refcnt == 0)) { |
| 8014 |
return; |
| 8015 |
} |
| 8016 |
{ |
| 8017 |
Py_ssize_t refcnt = Py_REFCNT(self); |
| 8018 |
_Py_NewReference(self); |
| 8019 |
__Pyx_SET_REFCNT(self, refcnt); |
| 8020 |
} |
| 8021 |
#if CYTHON_COMPILING_IN_CPYTHON |
| 8022 |
assert(PyType_IS_GC(Py_TYPE(self)) && |
| 8023 |
_Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED); |
| 8024 |
_Py_DEC_REFTOTAL; |
| 8025 |
#endif |
| 8026 |
#ifdef COUNT_ALLOCS |
| 8027 |
--Py_TYPE(self)->tp_frees; |
| 8028 |
--Py_TYPE(self)->tp_allocs; |
| 8029 |
#endif |
| 8030 |
#endif |
| 8031 |
} |
| 8032 |
static PyObject * |
| 8033 |
__Pyx_Coroutine_get_name(__pyx_CoroutineObject *self, void *context) |
| 8034 |
{ |
| 8035 |
PyObject *name = self->gi_name; |
| 8036 |
CYTHON_UNUSED_VAR(context); |
| 8037 |
if (unlikely(!name)) name = Py_None; |
| 8038 |
Py_INCREF(name); |
| 8039 |
return name; |
| 8040 |
} |
| 8041 |
static int |
| 8042 |
__Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value, void *context) |
| 8043 |
{ |
| 8044 |
CYTHON_UNUSED_VAR(context); |
| 8045 |
#if PY_MAJOR_VERSION >= 3 |
| 8046 |
if (unlikely(value == NULL || !PyUnicode_Check(value))) |
| 8047 |
#else |
| 8048 |
if (unlikely(value == NULL || !PyString_Check(value))) |
| 8049 |
#endif |
| 8050 |
{ |
| 8051 |
PyErr_SetString(PyExc_TypeError, |
| 8052 |
"__name__ must be set to a string object"); |
| 8053 |
return -1; |
| 8054 |
} |
| 8055 |
Py_INCREF(value); |
| 8056 |
__Pyx_Py_XDECREF_SET(self->gi_name, value); |
| 8057 |
return 0; |
| 8058 |
} |
| 8059 |
static PyObject * |
| 8060 |
__Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self, void *context) |
| 8061 |
{ |
| 8062 |
PyObject *name = self->gi_qualname; |
| 8063 |
CYTHON_UNUSED_VAR(context); |
| 8064 |
if (unlikely(!name)) name = Py_None; |
| 8065 |
Py_INCREF(name); |
| 8066 |
return name; |
| 8067 |
} |
| 8068 |
static int |
| 8069 |
__Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value, void *context) |
| 8070 |
{ |
| 8071 |
CYTHON_UNUSED_VAR(context); |
| 8072 |
#if PY_MAJOR_VERSION >= 3 |
| 8073 |
if (unlikely(value == NULL || !PyUnicode_Check(value))) |
| 8074 |
#else |
| 8075 |
if (unlikely(value == NULL || !PyString_Check(value))) |
| 8076 |
#endif |
| 8077 |
{ |
| 8078 |
PyErr_SetString(PyExc_TypeError, |
| 8079 |
"__qualname__ must be set to a string object"); |
| 8080 |
return -1; |
| 8081 |
} |
| 8082 |
Py_INCREF(value); |
| 8083 |
__Pyx_Py_XDECREF_SET(self->gi_qualname, value); |
| 8084 |
return 0; |
| 8085 |
} |
| 8086 |
static PyObject * |
| 8087 |
__Pyx_Coroutine_get_frame(__pyx_CoroutineObject *self, void *context) |
| 8088 |
{ |
| 8089 |
PyObject *frame = self->gi_frame; |
| 8090 |
CYTHON_UNUSED_VAR(context); |
| 8091 |
if (!frame) { |
| 8092 |
if (unlikely(!self->gi_code)) { |
| 8093 |
Py_RETURN_NONE; |
| 8094 |
} |
| 8095 |
frame = (PyObject *) PyFrame_New( |
| 8096 |
PyThreadState_Get(), |
| 8097 |
(PyCodeObject*) self->gi_code, |
| 8098 |
__pyx_d, |
| 8099 |
0 |
| 8100 |
); |
| 8101 |
if (unlikely(!frame)) |
| 8102 |
return NULL; |
| 8103 |
self->gi_frame = frame; |
| 8104 |
} |
| 8105 |
Py_INCREF(frame); |
| 8106 |
return frame; |
| 8107 |
} |
| 8108 |
static __pyx_CoroutineObject *__Pyx__Coroutine_New( |
| 8109 |
PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, |
| 8110 |
PyObject *name, PyObject *qualname, PyObject *module_name) { |
| 8111 |
__pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type); |
| 8112 |
if (unlikely(!gen)) |
| 8113 |
return NULL; |
| 8114 |
return __Pyx__Coroutine_NewInit(gen, body, code, closure, name, qualname, module_name); |
| 8115 |
} |
| 8116 |
static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit( |
| 8117 |
__pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure, |
| 8118 |
PyObject *name, PyObject *qualname, PyObject *module_name) { |
| 8119 |
gen->body = body; |
| 8120 |
gen->closure = closure; |
| 8121 |
Py_XINCREF(closure); |
| 8122 |
gen->is_running = 0; |
| 8123 |
gen->resume_label = 0; |
| 8124 |
gen->classobj = NULL; |
| 8125 |
gen->yieldfrom = NULL; |
| 8126 |
#if PY_VERSION_HEX >= 0x030B00a4 |
| 8127 |
gen->gi_exc_state.exc_value = NULL; |
| 8128 |
#else |
| 8129 |
gen->gi_exc_state.exc_type = NULL; |
| 8130 |
gen->gi_exc_state.exc_value = NULL; |
| 8131 |
gen->gi_exc_state.exc_traceback = NULL; |
| 8132 |
#endif |
| 8133 |
#if CYTHON_USE_EXC_INFO_STACK |
| 8134 |
gen->gi_exc_state.previous_item = NULL; |
| 8135 |
#endif |
| 8136 |
gen->gi_weakreflist = NULL; |
| 8137 |
Py_XINCREF(qualname); |
| 8138 |
gen->gi_qualname = qualname; |
| 8139 |
Py_XINCREF(name); |
| 8140 |
gen->gi_name = name; |
| 8141 |
Py_XINCREF(module_name); |
| 8142 |
gen->gi_modulename = module_name; |
| 8143 |
Py_XINCREF(code); |
| 8144 |
gen->gi_code = code; |
| 8145 |
gen->gi_frame = NULL; |
| 8146 |
PyObject_GC_Track(gen); |
| 8147 |
return gen; |
| 8148 |
} |
| 8149 |
|
| 8150 |
|
| 8151 |
static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code) { |
| 8152 |
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) |
| 8153 |
int result; |
| 8154 |
PyObject *globals, *result_obj; |
| 8155 |
globals = PyDict_New(); if (unlikely(!globals)) goto ignore; |
| 8156 |
result = PyDict_SetItemString(globals, "_cython_coroutine_type", |
| 8157 |
#ifdef __Pyx_Coroutine_USED |
| 8158 |
(PyObject*)__pyx_CoroutineType); |
| 8159 |
#else |
| 8160 |
Py_None); |
| 8161 |
#endif |
| 8162 |
if (unlikely(result < 0)) goto ignore; |
| 8163 |
result = PyDict_SetItemString(globals, "_cython_generator_type", |
| 8164 |
#ifdef __Pyx_Generator_USED |
| 8165 |
(PyObject*)__pyx_GeneratorType); |
| 8166 |
#else |
| 8167 |
Py_None); |
| 8168 |
#endif |
| 8169 |
if (unlikely(result < 0)) goto ignore; |
| 8170 |
if (unlikely(PyDict_SetItemString(globals, "_module", module) < 0)) goto ignore; |
| 8171 |
if (unlikely(PyDict_SetItemString(globals, "__builtins__", __pyx_b) < 0)) goto ignore; |
| 8172 |
result_obj = PyRun_String(py_code, Py_file_input, globals, globals); |
| 8173 |
if (unlikely(!result_obj)) goto ignore; |
| 8174 |
Py_DECREF(result_obj); |
| 8175 |
Py_DECREF(globals); |
| 8176 |
return module; |
| 8177 |
ignore: |
| 8178 |
Py_XDECREF(globals); |
| 8179 |
PyErr_WriteUnraisable(module); |
| 8180 |
if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, "Cython module failed to patch module with custom type", 1) < 0)) { |
| 8181 |
Py_DECREF(module); |
| 8182 |
module = NULL; |
| 8183 |
} |
| 8184 |
#else |
| 8185 |
py_code++; |
| 8186 |
#endif |
| 8187 |
return module; |
| 8188 |
} |
| 8189 |
|
| 8190 |
|
| 8191 |
#ifndef CYTHON_REGISTER_ABCS |
| 8192 |
#define CYTHON_REGISTER_ABCS 1 |
| 8193 |
#endif |
| 8194 |
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) |
| 8195 |
static PyObject* __Pyx_patch_abc_module(PyObject *module); |
| 8196 |
static PyObject* __Pyx_patch_abc_module(PyObject *module) { |
| 8197 |
module = __Pyx_Coroutine_patch_module( |
| 8198 |
module, "" |
| 8199 |
"if _cython_generator_type is not None:\n" |
| 8200 |
" try: Generator = _module.Generator\n" |
| 8201 |
" except AttributeError: pass\n" |
| 8202 |
" else: Generator.register(_cython_generator_type)\n" |
| 8203 |
"if _cython_coroutine_type is not None:\n" |
| 8204 |
" try: Coroutine = _module.Coroutine\n" |
| 8205 |
" except AttributeError: pass\n" |
| 8206 |
" else: Coroutine.register(_cython_coroutine_type)\n" |
| 8207 |
); |
| 8208 |
return module; |
| 8209 |
} |
| 8210 |
#endif |
| 8211 |
static int __Pyx_patch_abc(void) { |
| 8212 |
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) |
| 8213 |
static int abc_patched = 0; |
| 8214 |
if (CYTHON_REGISTER_ABCS && !abc_patched) { |
| 8215 |
PyObject *module; |
| 8216 |
module = PyImport_ImportModule((PY_MAJOR_VERSION >= 3) ? "collections.abc" : "collections"); |
| 8217 |
if (unlikely(!module)) { |
| 8218 |
PyErr_WriteUnraisable(NULL); |
| 8219 |
if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, |
| 8220 |
((PY_MAJOR_VERSION >= 3) ? |
| 8221 |
"Cython module failed to register with collections.abc module" : |
| 8222 |
"Cython module failed to register with collections module"), 1) < 0)) { |
| 8223 |
return -1; |
| 8224 |
} |
| 8225 |
} else { |
| 8226 |
module = __Pyx_patch_abc_module(module); |
| 8227 |
abc_patched = 1; |
| 8228 |
if (unlikely(!module)) |
| 8229 |
return -1; |
| 8230 |
Py_DECREF(module); |
| 8231 |
} |
| 8232 |
module = PyImport_ImportModule("backports_abc"); |
| 8233 |
if (module) { |
| 8234 |
module = __Pyx_patch_abc_module(module); |
| 8235 |
Py_XDECREF(module); |
| 8236 |
} |
| 8237 |
if (!module) { |
| 8238 |
PyErr_Clear(); |
| 8239 |
} |
| 8240 |
} |
| 8241 |
#else |
| 8242 |
if ((0)) __Pyx_Coroutine_patch_module(NULL, NULL); |
| 8243 |
#endif |
| 8244 |
return 0; |
| 8245 |
} |
| 8246 |
|
| 8247 |
|
| 8248 |
static void __Pyx_CoroutineAwait_dealloc(PyObject *self) { |
| 8249 |
PyObject_GC_UnTrack(self); |
| 8250 |
Py_CLEAR(((__pyx_CoroutineAwaitObject*)self)->coroutine); |
| 8251 |
__Pyx_PyHeapTypeObject_GC_Del(self); |
| 8252 |
} |
| 8253 |
static int __Pyx_CoroutineAwait_traverse(__pyx_CoroutineAwaitObject *self, visitproc visit, void *arg) { |
| 8254 |
Py_VISIT(self->coroutine); |
| 8255 |
return 0; |
| 8256 |
} |
| 8257 |
static int __Pyx_CoroutineAwait_clear(__pyx_CoroutineAwaitObject *self) { |
| 8258 |
Py_CLEAR(self->coroutine); |
| 8259 |
return 0; |
| 8260 |
} |
| 8261 |
static PyObject *__Pyx_CoroutineAwait_Next(__pyx_CoroutineAwaitObject *self) { |
| 8262 |
return __Pyx_Generator_Next(self->coroutine); |
| 8263 |
} |
| 8264 |
static PyObject *__Pyx_CoroutineAwait_Send(__pyx_CoroutineAwaitObject *self, PyObject *value) { |
| 8265 |
return __Pyx_Coroutine_Send(self->coroutine, value); |
| 8266 |
} |
| 8267 |
static PyObject *__Pyx_CoroutineAwait_Throw(__pyx_CoroutineAwaitObject *self, PyObject *args) { |
| 8268 |
return __Pyx_Coroutine_Throw(self->coroutine, args); |
| 8269 |
} |
| 8270 |
static PyObject *__Pyx_CoroutineAwait_Close(__pyx_CoroutineAwaitObject *self, PyObject *arg) { |
| 8271 |
CYTHON_UNUSED_VAR(arg); |
| 8272 |
return __Pyx_Coroutine_Close(self->coroutine); |
| 8273 |
} |
| 8274 |
static PyObject *__Pyx_CoroutineAwait_self(PyObject *self) { |
| 8275 |
Py_INCREF(self); |
| 8276 |
return self; |
| 8277 |
} |
| 8278 |
#if !CYTHON_COMPILING_IN_PYPY |
| 8279 |
static PyObject *__Pyx_CoroutineAwait_no_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { |
| 8280 |
CYTHON_UNUSED_VAR(type); |
| 8281 |
CYTHON_UNUSED_VAR(args); |
| 8282 |
CYTHON_UNUSED_VAR(kwargs); |
| 8283 |
PyErr_SetString(PyExc_TypeError, "cannot instantiate type, use 'await coroutine' instead"); |
| 8284 |
return NULL; |
| 8285 |
} |
| 8286 |
#endif |
| 8287 |
static PyObject *__Pyx_CoroutineAwait_reduce_ex(__pyx_CoroutineAwaitObject *self, PyObject *arg) { |
| 8288 |
CYTHON_UNUSED_VAR(arg); |
| 8289 |
PyErr_Format(PyExc_TypeError, "cannot pickle '%.200s' object", |
| 8290 |
Py_TYPE(self)->tp_name); |
| 8291 |
return NULL; |
| 8292 |
} |
| 8293 |
static PyMethodDef __pyx_CoroutineAwait_methods[] = { |
| 8294 |
{"send", (PyCFunction) __Pyx_CoroutineAwait_Send, METH_O, |
| 8295 |
(char*) PyDoc_STR("send(arg) -> send 'arg' into coroutine,\nreturn next yielded value or raise StopIteration.")}, |
| 8296 |
{"throw", (PyCFunction) __Pyx_CoroutineAwait_Throw, METH_VARARGS, |
| 8297 |
(char*) PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in coroutine,\nreturn next yielded value or raise StopIteration.")}, |
| 8298 |
{"close", (PyCFunction) __Pyx_CoroutineAwait_Close, METH_NOARGS, |
| 8299 |
(char*) PyDoc_STR("close() -> raise GeneratorExit inside coroutine.")}, |
| 8300 |
{"__reduce_ex__", (PyCFunction) __Pyx_CoroutineAwait_reduce_ex, METH_O, 0}, |
| 8301 |
{"__reduce__", (PyCFunction) __Pyx_CoroutineAwait_reduce_ex, METH_NOARGS, 0}, |
| 8302 |
{0, 0, 0, 0} |
| 8303 |
}; |
| 8304 |
#if CYTHON_USE_TYPE_SPECS |
| 8305 |
static PyType_Slot __pyx_CoroutineAwaitType_slots[] = { |
| 8306 |
{Py_tp_dealloc, (void *)__Pyx_CoroutineAwait_dealloc}, |
| 8307 |
{Py_tp_traverse, (void *)__Pyx_CoroutineAwait_traverse}, |
| 8308 |
{Py_tp_clear, (void *)__Pyx_CoroutineAwait_clear}, |
| 8309 |
#if !CYTHON_COMPILING_IN_PYPY |
| 8310 |
{Py_tp_new, (void *)__Pyx_CoroutineAwait_no_new}, |
| 8311 |
#endif |
| 8312 |
{Py_tp_methods, (void *)__pyx_CoroutineAwait_methods}, |
| 8313 |
{Py_tp_iter, (void *)__Pyx_CoroutineAwait_self}, |
| 8314 |
{Py_tp_iternext, (void *)__Pyx_CoroutineAwait_Next}, |
| 8315 |
{0, 0}, |
| 8316 |
}; |
| 8317 |
static PyType_Spec __pyx_CoroutineAwaitType_spec = { |
| 8318 |
__PYX_TYPE_MODULE_PREFIX "coroutine_wrapper", |
| 8319 |
sizeof(__pyx_CoroutineAwaitObject), |
| 8320 |
0, |
| 8321 |
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, |
| 8322 |
__pyx_CoroutineAwaitType_slots |
| 8323 |
}; |
| 8324 |
#else |
| 8325 |
static PyTypeObject __pyx_CoroutineAwaitType_type = { |
| 8326 |
PyVarObject_HEAD_INIT(0, 0) |
| 8327 |
__PYX_TYPE_MODULE_PREFIX "coroutine_wrapper", |
| 8328 |
sizeof(__pyx_CoroutineAwaitObject), |
| 8329 |
0, |
| 8330 |
(destructor) __Pyx_CoroutineAwait_dealloc, |
| 8331 |
0, |
| 8332 |
0, |
| 8333 |
0, |
| 8334 |
0, |
| 8335 |
0, |
| 8336 |
0, |
| 8337 |
0, |
| 8338 |
0, |
| 8339 |
0, |
| 8340 |
0, |
| 8341 |
0, |
| 8342 |
0, |
| 8343 |
0, |
| 8344 |
0, |
| 8345 |
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, |
| 8346 |
PyDoc_STR("A wrapper object implementing __await__ for coroutines."), |
| 8347 |
(traverseproc) __Pyx_CoroutineAwait_traverse, |
| 8348 |
(inquiry) __Pyx_CoroutineAwait_clear, |
| 8349 |
0, |
| 8350 |
0, |
| 8351 |
__Pyx_CoroutineAwait_self, |
| 8352 |
(iternextfunc) __Pyx_CoroutineAwait_Next, |
| 8353 |
__pyx_CoroutineAwait_methods, |
| 8354 |
0 , |
| 8355 |
0 , |
| 8356 |
0, |
| 8357 |
0, |
| 8358 |
0, |
| 8359 |
0, |
| 8360 |
0, |
| 8361 |
0, |
| 8362 |
0, |
| 8363 |
#if !CYTHON_COMPILING_IN_PYPY |
| 8364 |
__Pyx_CoroutineAwait_no_new, |
| 8365 |
#else |
| 8366 |
0, |
| 8367 |
#endif |
| 8368 |
0, |
| 8369 |
0, |
| 8370 |
0, |
| 8371 |
0, |
| 8372 |
0, |
| 8373 |
0, |
| 8374 |
0, |
| 8375 |
0, |
| 8376 |
0, |
| 8377 |
#if PY_VERSION_HEX >= 0x030400a1 |
| 8378 |
0, |
| 8379 |
#endif |
| 8380 |
#if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) |
| 8381 |
0, |
| 8382 |
#endif |
| 8383 |
#if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 |
| 8384 |
0, |
| 8385 |
#endif |
| 8386 |
#if PY_VERSION_HEX >= 0x030C0000 |
| 8387 |
0, |
| 8388 |
#endif |
| 8389 |
#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 |
| 8390 |
0, |
| 8391 |
#endif |
| 8392 |
}; |
| 8393 |
#endif |
| 8394 |
#if PY_VERSION_HEX < 0x030500B1 || defined(__Pyx_IterableCoroutine_USED) || CYTHON_USE_ASYNC_SLOTS |
| 8395 |
static CYTHON_INLINE PyObject *__Pyx__Coroutine_await(PyObject *coroutine) { |
| 8396 |
__pyx_CoroutineAwaitObject *await = PyObject_GC_New(__pyx_CoroutineAwaitObject, __pyx_CoroutineAwaitType); |
| 8397 |
if (unlikely(!await)) return NULL; |
| 8398 |
Py_INCREF(coroutine); |
| 8399 |
await->coroutine = coroutine; |
| 8400 |
PyObject_GC_Track(await); |
| 8401 |
return (PyObject*)await; |
| 8402 |
} |
| 8403 |
#endif |
| 8404 |
#if PY_VERSION_HEX < 0x030500B1 |
| 8405 |
static PyObject *__Pyx_Coroutine_await_method(PyObject *coroutine, PyObject *arg) { |
| 8406 |
CYTHON_UNUSED_VAR(arg); |
| 8407 |
return __Pyx__Coroutine_await(coroutine); |
| 8408 |
} |
| 8409 |
#endif |
| 8410 |
#if defined(__Pyx_IterableCoroutine_USED) || CYTHON_USE_ASYNC_SLOTS |
| 8411 |
static PyObject *__Pyx_Coroutine_await(PyObject *coroutine) { |
| 8412 |
if (unlikely(!coroutine || !__Pyx_Coroutine_Check(coroutine))) { |
| 8413 |
PyErr_SetString(PyExc_TypeError, "invalid input, expected coroutine"); |
| 8414 |
return NULL; |
| 8415 |
} |
| 8416 |
return __Pyx__Coroutine_await(coroutine); |
| 8417 |
} |
| 8418 |
#endif |
| 8419 |
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 && PY_VERSION_HEX < 0x030500B1 |
| 8420 |
static PyObject *__Pyx_Coroutine_compare(PyObject *obj, PyObject *other, int op) { |
| 8421 |
PyObject* result; |
| 8422 |
switch (op) { |
| 8423 |
case Py_EQ: result = (other == obj) ? Py_True : Py_False; break; |
| 8424 |
case Py_NE: result = (other != obj) ? Py_True : Py_False; break; |
| 8425 |
default: |
| 8426 |
result = Py_NotImplemented; |
| 8427 |
} |
| 8428 |
Py_INCREF(result); |
| 8429 |
return result; |
| 8430 |
} |
| 8431 |
#endif |
| 8432 |
static PyMethodDef __pyx_Coroutine_methods[] = { |
| 8433 |
{"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O, |
| 8434 |
(char*) PyDoc_STR("send(arg) -> send 'arg' into coroutine,\nreturn next iterated value or raise StopIteration.")}, |
| 8435 |
{"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS, |
| 8436 |
(char*) PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in coroutine,\nreturn next iterated value or raise StopIteration.")}, |
| 8437 |
{"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS, |
| 8438 |
(char*) PyDoc_STR("close() -> raise GeneratorExit inside coroutine.")}, |
| 8439 |
#if PY_VERSION_HEX < 0x030500B1 |
| 8440 |
{"__await__", (PyCFunction) __Pyx_Coroutine_await_method, METH_NOARGS, |
| 8441 |
(char*) PyDoc_STR("__await__() -> return an iterator to be used in await expression.")}, |
| 8442 |
#endif |
| 8443 |
{0, 0, 0, 0} |
| 8444 |
}; |
| 8445 |
static PyMemberDef __pyx_Coroutine_memberlist[] = { |
| 8446 |
{(char *) "cr_running", T_BOOL, offsetof(__pyx_CoroutineObject, is_running), READONLY, NULL}, |
| 8447 |
{(char*) "cr_await", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY, |
| 8448 |
(char*) PyDoc_STR("object being awaited, or None")}, |
| 8449 |
{(char*) "cr_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL}, |
| 8450 |
{(char *) "__module__", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_modulename), 0, 0}, |
| 8451 |
#if CYTHON_USE_TYPE_SPECS |
| 8452 |
{(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CoroutineObject, gi_weakreflist), READONLY, 0}, |
| 8453 |
#endif |
| 8454 |
{0, 0, 0, 0, 0} |
| 8455 |
}; |
| 8456 |
static PyGetSetDef __pyx_Coroutine_getsets[] = { |
| 8457 |
{(char *) "__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name, |
| 8458 |
(char*) PyDoc_STR("name of the coroutine"), 0}, |
| 8459 |
{(char *) "__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname, |
| 8460 |
(char*) PyDoc_STR("qualified name of the coroutine"), 0}, |
| 8461 |
{(char *) "cr_frame", (getter)__Pyx_Coroutine_get_frame, NULL, |
| 8462 |
(char*) PyDoc_STR("Frame of the coroutine"), 0}, |
| 8463 |
{0, 0, 0, 0, 0} |
| 8464 |
}; |
| 8465 |
#if CYTHON_USE_TYPE_SPECS |
| 8466 |
static PyType_Slot __pyx_CoroutineType_slots[] = { |
| 8467 |
{Py_tp_dealloc, (void *)__Pyx_Coroutine_dealloc}, |
| 8468 |
{Py_am_await, (void *)&__Pyx_Coroutine_await}, |
| 8469 |
{Py_tp_traverse, (void *)__Pyx_Coroutine_traverse}, |
| 8470 |
{Py_tp_methods, (void *)__pyx_Coroutine_methods}, |
| 8471 |
{Py_tp_members, (void *)__pyx_Coroutine_memberlist}, |
| 8472 |
{Py_tp_getset, (void *)__pyx_Coroutine_getsets}, |
| 8473 |
{Py_tp_getattro, (void *) __Pyx_PyObject_GenericGetAttrNoDict}, |
| 8474 |
#if CYTHON_USE_TP_FINALIZE |
| 8475 |
{Py_tp_finalize, (void *)__Pyx_Coroutine_del}, |
| 8476 |
#endif |
| 8477 |
{0, 0}, |
| 8478 |
}; |
| 8479 |
static PyType_Spec __pyx_CoroutineType_spec = { |
| 8480 |
__PYX_TYPE_MODULE_PREFIX "coroutine", |
| 8481 |
sizeof(__pyx_CoroutineObject), |
| 8482 |
0, |
| 8483 |
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE, |
| 8484 |
__pyx_CoroutineType_slots |
| 8485 |
}; |
| 8486 |
#else |
| 8487 |
#if CYTHON_USE_ASYNC_SLOTS |
| 8488 |
static __Pyx_PyAsyncMethodsStruct __pyx_Coroutine_as_async = { |
| 8489 |
__Pyx_Coroutine_await, |
| 8490 |
0, |
| 8491 |
0, |
| 8492 |
#if PY_VERSION_HEX >= 0x030A00A3 |
| 8493 |
0, |
| 8494 |
#endif |
| 8495 |
}; |
| 8496 |
#endif |
| 8497 |
static PyTypeObject __pyx_CoroutineType_type = { |
| 8498 |
PyVarObject_HEAD_INIT(0, 0) |
| 8499 |
__PYX_TYPE_MODULE_PREFIX "coroutine", |
| 8500 |
sizeof(__pyx_CoroutineObject), |
| 8501 |
0, |
| 8502 |
(destructor) __Pyx_Coroutine_dealloc, |
| 8503 |
0, |
| 8504 |
0, |
| 8505 |
0, |
| 8506 |
#if CYTHON_USE_ASYNC_SLOTS |
| 8507 |
&__pyx_Coroutine_as_async, |
| 8508 |
#else |
| 8509 |
0, |
| 8510 |
#endif |
| 8511 |
0, |
| 8512 |
0, |
| 8513 |
0, |
| 8514 |
0, |
| 8515 |
0, |
| 8516 |
0, |
| 8517 |
0, |
| 8518 |
0, |
| 8519 |
0, |
| 8520 |
0, |
| 8521 |
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE, |
| 8522 |
0, |
| 8523 |
(traverseproc) __Pyx_Coroutine_traverse, |
| 8524 |
0, |
| 8525 |
#if CYTHON_USE_ASYNC_SLOTS && CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 && PY_VERSION_HEX < 0x030500B1 |
| 8526 |
__Pyx_Coroutine_compare, |
| 8527 |
#else |
| 8528 |
0, |
| 8529 |
#endif |
| 8530 |
offsetof(__pyx_CoroutineObject, gi_weakreflist), |
| 8531 |
0, |
| 8532 |
0, |
| 8533 |
__pyx_Coroutine_methods, |
| 8534 |
__pyx_Coroutine_memberlist, |
| 8535 |
__pyx_Coroutine_getsets, |
| 8536 |
0, |
| 8537 |
0, |
| 8538 |
0, |
| 8539 |
0, |
| 8540 |
0, |
| 8541 |
0, |
| 8542 |
0, |
| 8543 |
0, |
| 8544 |
0, |
| 8545 |
0, |
| 8546 |
0, |
| 8547 |
0, |
| 8548 |
0, |
| 8549 |
0, |
| 8550 |
0, |
| 8551 |
#if CYTHON_USE_TP_FINALIZE |
| 8552 |
0, |
| 8553 |
#else |
| 8554 |
__Pyx_Coroutine_del, |
| 8555 |
#endif |
| 8556 |
0, |
| 8557 |
#if CYTHON_USE_TP_FINALIZE |
| 8558 |
__Pyx_Coroutine_del, |
| 8559 |
#elif PY_VERSION_HEX >= 0x030400a1 |
| 8560 |
0, |
| 8561 |
#endif |
| 8562 |
#if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) |
| 8563 |
0, |
| 8564 |
#endif |
| 8565 |
#if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 |
| 8566 |
0, |
| 8567 |
#endif |
| 8568 |
#if PY_VERSION_HEX >= 0x030C0000 |
| 8569 |
0, |
| 8570 |
#endif |
| 8571 |
#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 |
| 8572 |
0, |
| 8573 |
#endif |
| 8574 |
}; |
| 8575 |
#endif |
| 8576 |
static int __pyx_Coroutine_init(PyObject *module) { |
| 8577 |
CYTHON_MAYBE_UNUSED_VAR(module); |
| 8578 |
#if CYTHON_USE_TYPE_SPECS |
| 8579 |
__pyx_CoroutineType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx_CoroutineType_spec, NULL); |
| 8580 |
#else |
| 8581 |
__pyx_CoroutineType_type.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; |
| 8582 |
__pyx_CoroutineType = __Pyx_FetchCommonType(&__pyx_CoroutineType_type); |
| 8583 |
#endif |
| 8584 |
if (unlikely(!__pyx_CoroutineType)) |
| 8585 |
return -1; |
| 8586 |
#ifdef __Pyx_IterableCoroutine_USED |
| 8587 |
if (unlikely(__pyx_IterableCoroutine_init(module) == -1)) |
| 8588 |
return -1; |
| 8589 |
#endif |
| 8590 |
#if CYTHON_USE_TYPE_SPECS |
| 8591 |
__pyx_CoroutineAwaitType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx_CoroutineAwaitType_spec, NULL); |
| 8592 |
#else |
| 8593 |
__pyx_CoroutineAwaitType = __Pyx_FetchCommonType(&__pyx_CoroutineAwaitType_type); |
| 8594 |
#endif |
| 8595 |
if (unlikely(!__pyx_CoroutineAwaitType)) |
| 8596 |
return -1; |
| 8597 |
return 0; |
| 8598 |
} |
| 8599 |
|
| 8600 |
|
| 8601 |
static void __Pyx__ReturnWithStopIteration(PyObject* value) { |
| 8602 |
PyObject *exc, *args; |
| 8603 |
#if CYTHON_COMPILING_IN_CPYTHON |
| 8604 |
__Pyx_PyThreadState_declare |
| 8605 |
if ((PY_VERSION_HEX >= 0x03030000 && PY_VERSION_HEX < 0x030500B1) |
| 8606 |
|| unlikely(PyTuple_Check(value) || PyExceptionInstance_Check(value))) { |
| 8607 |
args = PyTuple_New(1); |
| 8608 |
if (unlikely(!args)) return; |
| 8609 |
Py_INCREF(value); |
| 8610 |
PyTuple_SET_ITEM(args, 0, value); |
| 8611 |
exc = PyType_Type.tp_call(PyExc_StopIteration, args, NULL); |
| 8612 |
Py_DECREF(args); |
| 8613 |
if (!exc) return; |
| 8614 |
} else { |
| 8615 |
Py_INCREF(value); |
| 8616 |
exc = value; |
| 8617 |
} |
| 8618 |
#if CYTHON_FAST_THREAD_STATE |
| 8619 |
__Pyx_PyThreadState_assign |
| 8620 |
#if CYTHON_USE_EXC_INFO_STACK |
| 8621 |
if (!__pyx_tstate->exc_info->exc_value) |
| 8622 |
#else |
| 8623 |
if (!__pyx_tstate->exc_type) |
| 8624 |
#endif |
| 8625 |
{ |
| 8626 |
Py_INCREF(PyExc_StopIteration); |
| 8627 |
__Pyx_ErrRestore(PyExc_StopIteration, exc, NULL); |
| 8628 |
return; |
| 8629 |
} |
| 8630 |
#endif |
| 8631 |
#else |
| 8632 |
args = PyTuple_Pack(1, value); |
| 8633 |
if (unlikely(!args)) return; |
| 8634 |
exc = PyObject_Call(PyExc_StopIteration, args, NULL); |
| 8635 |
Py_DECREF(args); |
| 8636 |
if (unlikely(!exc)) return; |
| 8637 |
#endif |
| 8638 |
PyErr_SetObject(PyExc_StopIteration, exc); |
| 8639 |
Py_DECREF(exc); |
| 8640 |
} |
| 8641 |
|
| 8642 |
|
| 8643 |
PyDoc_STRVAR(__Pyx_async_gen_send_doc, |
| 8644 |
"send(arg) -> send 'arg' into generator,\n\ |
| 8645 |
return next yielded value or raise StopIteration."); |
| 8646 |
PyDoc_STRVAR(__Pyx_async_gen_close_doc, |
| 8647 |
"close() -> raise GeneratorExit inside generator."); |
| 8648 |
PyDoc_STRVAR(__Pyx_async_gen_throw_doc, |
| 8649 |
"throw(typ[,val[,tb]]) -> raise exception in generator,\n\ |
| 8650 |
return next yielded value or raise StopIteration."); |
| 8651 |
PyDoc_STRVAR(__Pyx_async_gen_await_doc, |
| 8652 |
"__await__() -> return a representation that can be passed into the 'await' expression."); |
| 8653 |
static PyObject *__Pyx_async_gen_asend_new(__pyx_PyAsyncGenObject *, PyObject *); |
| 8654 |
static PyObject *__Pyx_async_gen_athrow_new(__pyx_PyAsyncGenObject *, PyObject *); |
| 8655 |
static const char *__Pyx_NON_INIT_CORO_MSG = "can't send non-None value to a just-started coroutine"; |
| 8656 |
static const char *__Pyx_ASYNC_GEN_IGNORED_EXIT_MSG = "async generator ignored GeneratorExit"; |
| 8657 |
static const char *__Pyx_ASYNC_GEN_CANNOT_REUSE_SEND_MSG = "cannot reuse already awaited __anext__()/asend()"; |
| 8658 |
static const char *__Pyx_ASYNC_GEN_CANNOT_REUSE_CLOSE_MSG = "cannot reuse already awaited aclose()/athrow()"; |
| 8659 |
typedef enum { |
| 8660 |
__PYX_AWAITABLE_STATE_INIT, |
| 8661 |
__PYX_AWAITABLE_STATE_ITER, |
| 8662 |
__PYX_AWAITABLE_STATE_CLOSED, |
| 8663 |
} __pyx_AwaitableState; |
| 8664 |
typedef struct { |
| 8665 |
PyObject_HEAD |
| 8666 |
__pyx_PyAsyncGenObject *ags_gen; |
| 8667 |
PyObject *ags_sendval; |
| 8668 |
__pyx_AwaitableState ags_state; |
| 8669 |
} __pyx_PyAsyncGenASend; |
| 8670 |
typedef struct { |
| 8671 |
PyObject_HEAD |
| 8672 |
__pyx_PyAsyncGenObject *agt_gen; |
| 8673 |
PyObject *agt_args; |
| 8674 |
__pyx_AwaitableState agt_state; |
| 8675 |
} __pyx_PyAsyncGenAThrow; |
| 8676 |
typedef struct { |
| 8677 |
PyObject_HEAD |
| 8678 |
PyObject *agw_val; |
| 8679 |
} __pyx__PyAsyncGenWrappedValue; |
| 8680 |
#ifndef _PyAsyncGen_MAXFREELIST |
| 8681 |
#define _PyAsyncGen_MAXFREELIST 80 |
| 8682 |
#endif |
| 8683 |
static __pyx__PyAsyncGenWrappedValue *__Pyx_ag_value_freelist[_PyAsyncGen_MAXFREELIST]; |
| 8684 |
static int __Pyx_ag_value_freelist_free = 0; |
| 8685 |
static __pyx_PyAsyncGenASend *__Pyx_ag_asend_freelist[_PyAsyncGen_MAXFREELIST]; |
| 8686 |
static int __Pyx_ag_asend_freelist_free = 0; |
| 8687 |
#define __pyx__PyAsyncGenWrappedValue_CheckExact(o)\ |
| 8688 |
__Pyx_IS_TYPE(o, __pyx__PyAsyncGenWrappedValueType) |
| 8689 |
static int |
| 8690 |
__Pyx_async_gen_traverse(__pyx_PyAsyncGenObject *gen, visitproc visit, void *arg) |
| 8691 |
{ |
| 8692 |
Py_VISIT(gen->ag_finalizer); |
| 8693 |
return __Pyx_Coroutine_traverse((__pyx_CoroutineObject*)gen, visit, arg); |
| 8694 |
} |
| 8695 |
static PyObject * |
| 8696 |
__Pyx_async_gen_repr(__pyx_CoroutineObject *o) |
| 8697 |
{ |
| 8698 |
return PyUnicode_FromFormat("<async_generator object %S at %p>", |
| 8699 |
o->gi_qualname ? o->gi_qualname : Py_None, o); |
| 8700 |
} |
| 8701 |
#if PY_VERSION_HEX >= 0x030600B0 |
| 8702 |
static int |
| 8703 |
__Pyx_async_gen_init_hooks(__pyx_PyAsyncGenObject *o) |
| 8704 |
{ |
| 8705 |
#if CYTHON_COMPILING_IN_CPYTHON |
| 8706 |
PyThreadState *tstate; |
| 8707 |
#endif |
| 8708 |
PyObject *finalizer; |
| 8709 |
PyObject *firstiter; |
| 8710 |
if (o->ag_hooks_inited) { |
| 8711 |
return 0; |
| 8712 |
} |
| 8713 |
o->ag_hooks_inited = 1; |
| 8714 |
#if CYTHON_COMPILING_IN_CPYTHON |
| 8715 |
tstate = __Pyx_PyThreadState_Current; |
| 8716 |
finalizer = tstate->async_gen_finalizer; |
| 8717 |
#else |
| 8718 |
finalizer = _PyEval_GetAsyncGenFinalizer(); |
| 8719 |
#endif |
| 8720 |
if (finalizer) { |
| 8721 |
Py_INCREF(finalizer); |
| 8722 |
o->ag_finalizer = finalizer; |
| 8723 |
} |
| 8724 |
#if CYTHON_COMPILING_IN_CPYTHON |
| 8725 |
firstiter = tstate->async_gen_firstiter; |
| 8726 |
#else |
| 8727 |
firstiter = _PyEval_GetAsyncGenFirstiter(); |
| 8728 |
#endif |
| 8729 |
if (firstiter) { |
| 8730 |
PyObject *res; |
| 8731 |
#if CYTHON_UNPACK_METHODS |
| 8732 |
PyObject *self; |
| 8733 |
#endif |
| 8734 |
Py_INCREF(firstiter); |
| 8735 |
#if CYTHON_UNPACK_METHODS |
| 8736 |
if (likely(PyMethod_Check(firstiter)) && likely((self = PyMethod_GET_SELF(firstiter)) != NULL)) { |
| 8737 |
PyObject *function = PyMethod_GET_FUNCTION(firstiter); |
| 8738 |
res = __Pyx_PyObject_Call2Args(function, self, (PyObject*)o); |
| 8739 |
} else |
| 8740 |
#endif |
| 8741 |
res = __Pyx_PyObject_CallOneArg(firstiter, (PyObject*)o); |
| 8742 |
Py_DECREF(firstiter); |
| 8743 |
if (unlikely(res == NULL)) { |
| 8744 |
return 1; |
| 8745 |
} |
| 8746 |
Py_DECREF(res); |
| 8747 |
} |
| 8748 |
return 0; |
| 8749 |
} |
| 8750 |
#endif |
| 8751 |
static PyObject * |
| 8752 |
__Pyx_async_gen_anext(PyObject *g) |
| 8753 |
{ |
| 8754 |
__pyx_PyAsyncGenObject *o = (__pyx_PyAsyncGenObject*) g; |
| 8755 |
if (unlikely(__Pyx_async_gen_init_hooks(o))) { |
| 8756 |
return NULL; |
| 8757 |
} |
| 8758 |
return __Pyx_async_gen_asend_new(o, NULL); |
| 8759 |
} |
| 8760 |
static PyObject * |
| 8761 |
__Pyx_async_gen_anext_method(PyObject *g, PyObject *arg) { |
| 8762 |
CYTHON_UNUSED_VAR(arg); |
| 8763 |
return __Pyx_async_gen_anext(g); |
| 8764 |
} |
| 8765 |
static PyObject * |
| 8766 |
__Pyx_async_gen_asend(__pyx_PyAsyncGenObject *o, PyObject *arg) |
| 8767 |
{ |
| 8768 |
if (unlikely(__Pyx_async_gen_init_hooks(o))) { |
| 8769 |
return NULL; |
| 8770 |
} |
| 8771 |
return __Pyx_async_gen_asend_new(o, arg); |
| 8772 |
} |
| 8773 |
static PyObject * |
| 8774 |
__Pyx_async_gen_aclose(__pyx_PyAsyncGenObject *o, PyObject *arg) |
| 8775 |
{ |
| 8776 |
CYTHON_UNUSED_VAR(arg); |
| 8777 |
if (unlikely(__Pyx_async_gen_init_hooks(o))) { |
| 8778 |
return NULL; |
| 8779 |
} |
| 8780 |
return __Pyx_async_gen_athrow_new(o, NULL); |
| 8781 |
} |
| 8782 |
static PyObject * |
| 8783 |
__Pyx_async_gen_athrow(__pyx_PyAsyncGenObject *o, PyObject *args) |
| 8784 |
{ |
| 8785 |
if (unlikely(__Pyx_async_gen_init_hooks(o))) { |
| 8786 |
return NULL; |
| 8787 |
} |
| 8788 |
return __Pyx_async_gen_athrow_new(o, args); |
| 8789 |
} |
| 8790 |
static PyObject * |
| 8791 |
__Pyx_async_gen_self_method(PyObject *g, PyObject *arg) { |
| 8792 |
CYTHON_UNUSED_VAR(arg); |
| 8793 |
return __Pyx_NewRef(g); |
| 8794 |
} |
| 8795 |
static PyGetSetDef __Pyx_async_gen_getsetlist[] = { |
| 8796 |
{(char*) "__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name, |
| 8797 |
(char*) PyDoc_STR("name of the async generator"), 0}, |
| 8798 |
{(char*) "__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname, |
| 8799 |
(char*) PyDoc_STR("qualified name of the async generator"), 0}, |
| 8800 |
{0, 0, 0, 0, 0} |
| 8801 |
}; |
| 8802 |
static PyMemberDef __Pyx_async_gen_memberlist[] = { |
| 8803 |
{(char*) "ag_running", T_BOOL, offsetof(__pyx_PyAsyncGenObject, ag_running_async), READONLY, NULL}, |
| 8804 |
{(char*) "ag_await", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY, |
| 8805 |
(char*) PyDoc_STR("object being awaited on, or None")}, |
| 8806 |
{(char *) "__module__", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_modulename), 0, 0}, |
| 8807 |
#if CYTHON_USE_TYPE_SPECS |
| 8808 |
{(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CoroutineObject, gi_weakreflist), READONLY, 0}, |
| 8809 |
#endif |
| 8810 |
{0, 0, 0, 0, 0} |
| 8811 |
}; |
| 8812 |
PyDoc_STRVAR(__Pyx_async_aclose_doc, |
| 8813 |
"aclose() -> raise GeneratorExit inside generator."); |
| 8814 |
PyDoc_STRVAR(__Pyx_async_asend_doc, |
| 8815 |
"asend(v) -> send 'v' in generator."); |
| 8816 |
PyDoc_STRVAR(__Pyx_async_athrow_doc, |
| 8817 |
"athrow(typ[,val[,tb]]) -> raise exception in generator."); |
| 8818 |
PyDoc_STRVAR(__Pyx_async_aiter_doc, |
| 8819 |
"__aiter__(v) -> return an asynchronous iterator."); |
| 8820 |
PyDoc_STRVAR(__Pyx_async_anext_doc, |
| 8821 |
"__anext__(v) -> continue asynchronous iteration and return the next element."); |
| 8822 |
static PyMethodDef __Pyx_async_gen_methods[] = { |
| 8823 |
{"asend", (PyCFunction)__Pyx_async_gen_asend, METH_O, __Pyx_async_asend_doc}, |
| 8824 |
{"athrow",(PyCFunction)__Pyx_async_gen_athrow, METH_VARARGS, __Pyx_async_athrow_doc}, |
| 8825 |
{"aclose", (PyCFunction)__Pyx_async_gen_aclose, METH_NOARGS, __Pyx_async_aclose_doc}, |
| 8826 |
{"__aiter__", (PyCFunction)__Pyx_async_gen_self_method, METH_NOARGS, __Pyx_async_aiter_doc}, |
| 8827 |
{"__anext__", (PyCFunction)__Pyx_async_gen_anext_method, METH_NOARGS, __Pyx_async_anext_doc}, |
| 8828 |
{0, 0, 0, 0} |
| 8829 |
}; |
| 8830 |
#if CYTHON_USE_TYPE_SPECS |
| 8831 |
static PyType_Slot __pyx_AsyncGenType_slots[] = { |
| 8832 |
{Py_tp_dealloc, (void *)__Pyx_Coroutine_dealloc}, |
| 8833 |
{Py_am_aiter, (void *)PyObject_SelfIter}, |
| 8834 |
{Py_am_anext, (void *)__Pyx_async_gen_anext}, |
| 8835 |
{Py_tp_repr, (void *)__Pyx_async_gen_repr}, |
| 8836 |
{Py_tp_traverse, (void *)__Pyx_async_gen_traverse}, |
| 8837 |
{Py_tp_methods, (void *)__Pyx_async_gen_methods}, |
| 8838 |
{Py_tp_members, (void *)__Pyx_async_gen_memberlist}, |
| 8839 |
{Py_tp_getset, (void *)__Pyx_async_gen_getsetlist}, |
| 8840 |
#if CYTHON_USE_TP_FINALIZE |
| 8841 |
{Py_tp_finalize, (void *)__Pyx_Coroutine_del}, |
| 8842 |
#endif |
| 8843 |
{0, 0}, |
| 8844 |
}; |
| 8845 |
static PyType_Spec __pyx_AsyncGenType_spec = { |
| 8846 |
__PYX_TYPE_MODULE_PREFIX "async_generator", |
| 8847 |
sizeof(__pyx_PyAsyncGenObject), |
| 8848 |
0, |
| 8849 |
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE, |
| 8850 |
__pyx_AsyncGenType_slots |
| 8851 |
}; |
| 8852 |
#else |
| 8853 |
#if CYTHON_USE_ASYNC_SLOTS |
| 8854 |
static __Pyx_PyAsyncMethodsStruct __Pyx_async_gen_as_async = { |
| 8855 |
0, |
| 8856 |
PyObject_SelfIter, |
| 8857 |
(unaryfunc)__Pyx_async_gen_anext, |
| 8858 |
#if PY_VERSION_HEX >= 0x030A00A3 |
| 8859 |
0, |
| 8860 |
#endif |
| 8861 |
}; |
| 8862 |
#endif |
| 8863 |
static PyTypeObject __pyx_AsyncGenType_type = { |
| 8864 |
PyVarObject_HEAD_INIT(0, 0) |
| 8865 |
"async_generator", |
| 8866 |
sizeof(__pyx_PyAsyncGenObject), |
| 8867 |
0, |
| 8868 |
(destructor)__Pyx_Coroutine_dealloc, |
| 8869 |
0, |
| 8870 |
0, |
| 8871 |
0, |
| 8872 |
#if CYTHON_USE_ASYNC_SLOTS |
| 8873 |
&__Pyx_async_gen_as_async, |
| 8874 |
#else |
| 8875 |
0, |
| 8876 |
#endif |
| 8877 |
(reprfunc)__Pyx_async_gen_repr, |
| 8878 |
0, |
| 8879 |
0, |
| 8880 |
0, |
| 8881 |
0, |
| 8882 |
0, |
| 8883 |
0, |
| 8884 |
0, |
| 8885 |
0, |
| 8886 |
0, |
| 8887 |
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | |
| 8888 |
Py_TPFLAGS_HAVE_FINALIZE, |
| 8889 |
0, |
| 8890 |
(traverseproc)__Pyx_async_gen_traverse, |
| 8891 |
0, |
| 8892 |
#if CYTHON_USE_ASYNC_SLOTS && CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 && PY_VERSION_HEX < 0x030500B1 |
| 8893 |
__Pyx_Coroutine_compare, |
| 8894 |
#else |
| 8895 |
0, |
| 8896 |
#endif |
| 8897 |
offsetof(__pyx_CoroutineObject, gi_weakreflist), |
| 8898 |
0, |
| 8899 |
0, |
| 8900 |
__Pyx_async_gen_methods, |
| 8901 |
__Pyx_async_gen_memberlist, |
| 8902 |
__Pyx_async_gen_getsetlist, |
| 8903 |
0, |
| 8904 |
0, |
| 8905 |
0, |
| 8906 |
0, |
| 8907 |
0, |
| 8908 |
0, |
| 8909 |
0, |
| 8910 |
0, |
| 8911 |
0, |
| 8912 |
0, |
| 8913 |
0, |
| 8914 |
0, |
| 8915 |
0, |
| 8916 |
0, |
| 8917 |
0, |
| 8918 |
#if CYTHON_USE_TP_FINALIZE |
| 8919 |
0, |
| 8920 |
#else |
| 8921 |
__Pyx_Coroutine_del, |
| 8922 |
#endif |
| 8923 |
0, |
| 8924 |
#if CYTHON_USE_TP_FINALIZE |
| 8925 |
__Pyx_Coroutine_del, |
| 8926 |
#elif PY_VERSION_HEX >= 0x030400a1 |
| 8927 |
0, |
| 8928 |
#endif |
| 8929 |
#if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) |
| 8930 |
0, |
| 8931 |
#endif |
| 8932 |
#if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 |
| 8933 |
0, |
| 8934 |
#endif |
| 8935 |
#if PY_VERSION_HEX >= 0x030C0000 |
| 8936 |
0, |
| 8937 |
#endif |
| 8938 |
#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 |
| 8939 |
0, |
| 8940 |
#endif |
| 8941 |
}; |
| 8942 |
#endif |
| 8943 |
static int |
| 8944 |
__Pyx_PyAsyncGen_ClearFreeLists(void) |
| 8945 |
{ |
| 8946 |
int ret = __Pyx_ag_value_freelist_free + __Pyx_ag_asend_freelist_free; |
| 8947 |
while (__Pyx_ag_value_freelist_free) { |
| 8948 |
__pyx__PyAsyncGenWrappedValue *o; |
| 8949 |
o = __Pyx_ag_value_freelist[--__Pyx_ag_value_freelist_free]; |
| 8950 |
assert(__pyx__PyAsyncGenWrappedValue_CheckExact(o)); |
| 8951 |
__Pyx_PyHeapTypeObject_GC_Del(o); |
| 8952 |
} |
| 8953 |
while (__Pyx_ag_asend_freelist_free) { |
| 8954 |
__pyx_PyAsyncGenASend *o; |
| 8955 |
o = __Pyx_ag_asend_freelist[--__Pyx_ag_asend_freelist_free]; |
| 8956 |
assert(__Pyx_IS_TYPE(o, __pyx__PyAsyncGenASendType)); |
| 8957 |
__Pyx_PyHeapTypeObject_GC_Del(o); |
| 8958 |
} |
| 8959 |
return ret; |
| 8960 |
} |
| 8961 |
static void |
| 8962 |
__Pyx_PyAsyncGen_Fini(void) |
| 8963 |
{ |
| 8964 |
__Pyx_PyAsyncGen_ClearFreeLists(); |
| 8965 |
} |
| 8966 |
static PyObject * |
| 8967 |
__Pyx_async_gen_unwrap_value(__pyx_PyAsyncGenObject *gen, PyObject *result) |
| 8968 |
{ |
| 8969 |
if (result == NULL) { |
| 8970 |
PyObject *exc_type = PyErr_Occurred(); |
| 8971 |
if (!exc_type) { |
| 8972 |
PyErr_SetNone(__Pyx_PyExc_StopAsyncIteration); |
| 8973 |
gen->ag_closed = 1; |
| 8974 |
} else if (__Pyx_PyErr_GivenExceptionMatches2(exc_type, __Pyx_PyExc_StopAsyncIteration, PyExc_GeneratorExit)) { |
| 8975 |
gen->ag_closed = 1; |
| 8976 |
} |
| 8977 |
gen->ag_running_async = 0; |
| 8978 |
return NULL; |
| 8979 |
} |
| 8980 |
if (__pyx__PyAsyncGenWrappedValue_CheckExact(result)) { |
| 8981 |
__Pyx_ReturnWithStopIteration(((__pyx__PyAsyncGenWrappedValue*)result)->agw_val); |
| 8982 |
Py_DECREF(result); |
| 8983 |
gen->ag_running_async = 0; |
| 8984 |
return NULL; |
| 8985 |
} |
| 8986 |
return result; |
| 8987 |
} |
| 8988 |
static void |
| 8989 |
__Pyx_async_gen_asend_dealloc(__pyx_PyAsyncGenASend *o) |
| 8990 |
{ |
| 8991 |
PyObject_GC_UnTrack((PyObject *)o); |
| 8992 |
Py_CLEAR(o->ags_gen); |
| 8993 |
Py_CLEAR(o->ags_sendval); |
| 8994 |
if (likely(__Pyx_ag_asend_freelist_free < _PyAsyncGen_MAXFREELIST)) { |
| 8995 |
assert(__pyx_PyAsyncGenASend_CheckExact(o)); |
| 8996 |
__Pyx_ag_asend_freelist[__Pyx_ag_asend_freelist_free++] = o; |
| 8997 |
} else { |
| 8998 |
__Pyx_PyHeapTypeObject_GC_Del(o); |
| 8999 |
} |
| 9000 |
} |
| 9001 |
static int |
| 9002 |
__Pyx_async_gen_asend_traverse(__pyx_PyAsyncGenASend *o, visitproc visit, void *arg) |
| 9003 |
{ |
| 9004 |
Py_VISIT(o->ags_gen); |
| 9005 |
Py_VISIT(o->ags_sendval); |
| 9006 |
return 0; |
| 9007 |
} |
| 9008 |
static PyObject * |
| 9009 |
__Pyx_async_gen_asend_send(PyObject *g, PyObject *arg) |
| 9010 |
{ |
| 9011 |
__pyx_PyAsyncGenASend *o = (__pyx_PyAsyncGenASend*) g; |
| 9012 |
PyObject *result; |
| 9013 |
if (unlikely(o->ags_state == __PYX_AWAITABLE_STATE_CLOSED)) { |
| 9014 |
PyErr_SetString(PyExc_RuntimeError, __Pyx_ASYNC_GEN_CANNOT_REUSE_SEND_MSG); |
| 9015 |
return NULL; |
| 9016 |
} |
| 9017 |
if (o->ags_state == __PYX_AWAITABLE_STATE_INIT) { |
| 9018 |
if (unlikely(o->ags_gen->ag_running_async)) { |
| 9019 |
PyErr_SetString( |
| 9020 |
PyExc_RuntimeError, |
| 9021 |
"anext(): asynchronous generator is already running"); |
| 9022 |
return NULL; |
| 9023 |
} |
| 9024 |
if (arg == NULL || arg == Py_None) { |
| 9025 |
arg = o->ags_sendval ? o->ags_sendval : Py_None; |
| 9026 |
} |
| 9027 |
o->ags_state = __PYX_AWAITABLE_STATE_ITER; |
| 9028 |
} |
| 9029 |
o->ags_gen->ag_running_async = 1; |
| 9030 |
result = __Pyx_Coroutine_Send((PyObject*)o->ags_gen, arg); |
| 9031 |
result = __Pyx_async_gen_unwrap_value(o->ags_gen, result); |
| 9032 |
if (result == NULL) { |
| 9033 |
o->ags_state = __PYX_AWAITABLE_STATE_CLOSED; |
| 9034 |
} |
| 9035 |
return result; |
| 9036 |
} |
| 9037 |
static CYTHON_INLINE PyObject * |
| 9038 |
__Pyx_async_gen_asend_iternext(PyObject *o) |
| 9039 |
{ |
| 9040 |
return __Pyx_async_gen_asend_send(o, Py_None); |
| 9041 |
} |
| 9042 |
static PyObject * |
| 9043 |
__Pyx_async_gen_asend_throw(__pyx_PyAsyncGenASend *o, PyObject *args) |
| 9044 |
{ |
| 9045 |
PyObject *result; |
| 9046 |
if (unlikely(o->ags_state == __PYX_AWAITABLE_STATE_CLOSED)) { |
| 9047 |
PyErr_SetString(PyExc_RuntimeError, __Pyx_ASYNC_GEN_CANNOT_REUSE_SEND_MSG); |
| 9048 |
return NULL; |
| 9049 |
} |
| 9050 |
result = __Pyx_Coroutine_Throw((PyObject*)o->ags_gen, args); |
| 9051 |
result = __Pyx_async_gen_unwrap_value(o->ags_gen, result); |
| 9052 |
if (result == NULL) { |
| 9053 |
o->ags_state = __PYX_AWAITABLE_STATE_CLOSED; |
| 9054 |
} |
| 9055 |
return result; |
| 9056 |
} |
| 9057 |
static PyObject * |
| 9058 |
__Pyx_async_gen_asend_close(PyObject *g, PyObject *args) |
| 9059 |
{ |
| 9060 |
__pyx_PyAsyncGenASend *o = (__pyx_PyAsyncGenASend*) g; |
| 9061 |
CYTHON_UNUSED_VAR(args); |
| 9062 |
o->ags_state = __PYX_AWAITABLE_STATE_CLOSED; |
| 9063 |
Py_RETURN_NONE; |
| 9064 |
} |
| 9065 |
static PyMethodDef __Pyx_async_gen_asend_methods[] = { |
| 9066 |
{"send", (PyCFunction)__Pyx_async_gen_asend_send, METH_O, __Pyx_async_gen_send_doc}, |
| 9067 |
{"throw", (PyCFunction)__Pyx_async_gen_asend_throw, METH_VARARGS, __Pyx_async_gen_throw_doc}, |
| 9068 |
{"close", (PyCFunction)__Pyx_async_gen_asend_close, METH_NOARGS, __Pyx_async_gen_close_doc}, |
| 9069 |
{"__await__", (PyCFunction)__Pyx_async_gen_self_method, METH_NOARGS, __Pyx_async_gen_await_doc}, |
| 9070 |
{0, 0, 0, 0} |
| 9071 |
}; |
| 9072 |
#if CYTHON_USE_TYPE_SPECS |
| 9073 |
static PyType_Slot __pyx__PyAsyncGenASendType_slots[] = { |
| 9074 |
{Py_tp_dealloc, (void *)__Pyx_async_gen_asend_dealloc}, |
| 9075 |
{Py_am_await, (void *)PyObject_SelfIter}, |
| 9076 |
{Py_tp_traverse, (void *)__Pyx_async_gen_asend_traverse}, |
| 9077 |
{Py_tp_methods, (void *)__Pyx_async_gen_asend_methods}, |
| 9078 |
{Py_tp_iter, (void *)PyObject_SelfIter}, |
| 9079 |
{Py_tp_iternext, (void *)__Pyx_async_gen_asend_iternext}, |
| 9080 |
{0, 0}, |
| 9081 |
}; |
| 9082 |
static PyType_Spec __pyx__PyAsyncGenASendType_spec = { |
| 9083 |
__PYX_TYPE_MODULE_PREFIX "async_generator_asend", |
| 9084 |
sizeof(__pyx_PyAsyncGenASend), |
| 9085 |
0, |
| 9086 |
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, |
| 9087 |
__pyx__PyAsyncGenASendType_slots |
| 9088 |
}; |
| 9089 |
#else |
| 9090 |
#if CYTHON_USE_ASYNC_SLOTS |
| 9091 |
static __Pyx_PyAsyncMethodsStruct __Pyx_async_gen_asend_as_async = { |
| 9092 |
PyObject_SelfIter, |
| 9093 |
0, |
| 9094 |
0, |
| 9095 |
#if PY_VERSION_HEX >= 0x030A00A3 |
| 9096 |
0, |
| 9097 |
#endif |
| 9098 |
}; |
| 9099 |
#endif |
| 9100 |
static PyTypeObject __pyx__PyAsyncGenASendType_type = { |
| 9101 |
PyVarObject_HEAD_INIT(0, 0) |
| 9102 |
"async_generator_asend", |
| 9103 |
sizeof(__pyx_PyAsyncGenASend), |
| 9104 |
0, |
| 9105 |
(destructor)__Pyx_async_gen_asend_dealloc, |
| 9106 |
0, |
| 9107 |
0, |
| 9108 |
0, |
| 9109 |
#if CYTHON_USE_ASYNC_SLOTS |
| 9110 |
&__Pyx_async_gen_asend_as_async, |
| 9111 |
#else |
| 9112 |
0, |
| 9113 |
#endif |
| 9114 |
0, |
| 9115 |
0, |
| 9116 |
0, |
| 9117 |
0, |
| 9118 |
0, |
| 9119 |
0, |
| 9120 |
0, |
| 9121 |
0, |
| 9122 |
0, |
| 9123 |
0, |
| 9124 |
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, |
| 9125 |
0, |
| 9126 |
(traverseproc)__Pyx_async_gen_asend_traverse, |
| 9127 |
0, |
| 9128 |
#if CYTHON_USE_ASYNC_SLOTS && CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 && PY_VERSION_HEX < 0x030500B1 |
| 9129 |
__Pyx_Coroutine_compare, |
| 9130 |
#else |
| 9131 |
0, |
| 9132 |
#endif |
| 9133 |
0, |
| 9134 |
PyObject_SelfIter, |
| 9135 |
(iternextfunc)__Pyx_async_gen_asend_iternext, |
| 9136 |
__Pyx_async_gen_asend_methods, |
| 9137 |
0, |
| 9138 |
0, |
| 9139 |
0, |
| 9140 |
0, |
| 9141 |
0, |
| 9142 |
0, |
| 9143 |
0, |
| 9144 |
0, |
| 9145 |
0, |
| 9146 |
0, |
| 9147 |
0, |
| 9148 |
0, |
| 9149 |
0, |
| 9150 |
0, |
| 9151 |
0, |
| 9152 |
0, |
| 9153 |
0, |
| 9154 |
0, |
| 9155 |
0, |
| 9156 |
#if PY_VERSION_HEX >= 0x030400a1 |
| 9157 |
0, |
| 9158 |
#endif |
| 9159 |
#if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) |
| 9160 |
0, |
| 9161 |
#endif |
| 9162 |
#if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 |
| 9163 |
0, |
| 9164 |
#endif |
| 9165 |
#if PY_VERSION_HEX >= 0x030C0000 |
| 9166 |
0, |
| 9167 |
#endif |
| 9168 |
#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 |
| 9169 |
0, |
| 9170 |
#endif |
| 9171 |
}; |
| 9172 |
#endif |
| 9173 |
static PyObject * |
| 9174 |
__Pyx_async_gen_asend_new(__pyx_PyAsyncGenObject *gen, PyObject *sendval) |
| 9175 |
{ |
| 9176 |
__pyx_PyAsyncGenASend *o; |
| 9177 |
if (likely(__Pyx_ag_asend_freelist_free)) { |
| 9178 |
__Pyx_ag_asend_freelist_free--; |
| 9179 |
o = __Pyx_ag_asend_freelist[__Pyx_ag_asend_freelist_free]; |
| 9180 |
_Py_NewReference((PyObject *)o); |
| 9181 |
} else { |
| 9182 |
o = PyObject_GC_New(__pyx_PyAsyncGenASend, __pyx__PyAsyncGenASendType); |
| 9183 |
if (unlikely(o == NULL)) { |
| 9184 |
return NULL; |
| 9185 |
} |
| 9186 |
} |
| 9187 |
Py_INCREF(gen); |
| 9188 |
o->ags_gen = gen; |
| 9189 |
Py_XINCREF(sendval); |
| 9190 |
o->ags_sendval = sendval; |
| 9191 |
o->ags_state = __PYX_AWAITABLE_STATE_INIT; |
| 9192 |
PyObject_GC_Track((PyObject*)o); |
| 9193 |
return (PyObject*)o; |
| 9194 |
} |
| 9195 |
static void |
| 9196 |
__Pyx_async_gen_wrapped_val_dealloc(__pyx__PyAsyncGenWrappedValue *o) |
| 9197 |
{ |
| 9198 |
PyObject_GC_UnTrack((PyObject *)o); |
| 9199 |
Py_CLEAR(o->agw_val); |
| 9200 |
if (likely(__Pyx_ag_value_freelist_free < _PyAsyncGen_MAXFREELIST)) { |
| 9201 |
assert(__pyx__PyAsyncGenWrappedValue_CheckExact(o)); |
| 9202 |
__Pyx_ag_value_freelist[__Pyx_ag_value_freelist_free++] = o; |
| 9203 |
} else { |
| 9204 |
__Pyx_PyHeapTypeObject_GC_Del(o); |
| 9205 |
} |
| 9206 |
} |
| 9207 |
static int |
| 9208 |
__Pyx_async_gen_wrapped_val_traverse(__pyx__PyAsyncGenWrappedValue *o, |
| 9209 |
visitproc visit, void *arg) |
| 9210 |
{ |
| 9211 |
Py_VISIT(o->agw_val); |
| 9212 |
return 0; |
| 9213 |
} |
| 9214 |
#if CYTHON_USE_TYPE_SPECS |
| 9215 |
static PyType_Slot __pyx__PyAsyncGenWrappedValueType_slots[] = { |
| 9216 |
{Py_tp_dealloc, (void *)__Pyx_async_gen_wrapped_val_dealloc}, |
| 9217 |
{Py_tp_traverse, (void *)__Pyx_async_gen_wrapped_val_traverse}, |
| 9218 |
{0, 0}, |
| 9219 |
}; |
| 9220 |
static PyType_Spec __pyx__PyAsyncGenWrappedValueType_spec = { |
| 9221 |
__PYX_TYPE_MODULE_PREFIX "async_generator_wrapped_value", |
| 9222 |
sizeof(__pyx__PyAsyncGenWrappedValue), |
| 9223 |
0, |
| 9224 |
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, |
| 9225 |
__pyx__PyAsyncGenWrappedValueType_slots |
| 9226 |
}; |
| 9227 |
#else |
| 9228 |
static PyTypeObject __pyx__PyAsyncGenWrappedValueType_type = { |
| 9229 |
PyVarObject_HEAD_INIT(0, 0) |
| 9230 |
"async_generator_wrapped_value", |
| 9231 |
sizeof(__pyx__PyAsyncGenWrappedValue), |
| 9232 |
0, |
| 9233 |
(destructor)__Pyx_async_gen_wrapped_val_dealloc, |
| 9234 |
0, |
| 9235 |
0, |
| 9236 |
0, |
| 9237 |
0, |
| 9238 |
0, |
| 9239 |
0, |
| 9240 |
0, |
| 9241 |
0, |
| 9242 |
0, |
| 9243 |
0, |
| 9244 |
0, |
| 9245 |
0, |
| 9246 |
0, |
| 9247 |
0, |
| 9248 |
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, |
| 9249 |
0, |
| 9250 |
(traverseproc)__Pyx_async_gen_wrapped_val_traverse, |
| 9251 |
0, |
| 9252 |
0, |
| 9253 |
0, |
| 9254 |
0, |
| 9255 |
0, |
| 9256 |
0, |
| 9257 |
0, |
| 9258 |
0, |
| 9259 |
0, |
| 9260 |
0, |
| 9261 |
0, |
| 9262 |
0, |
| 9263 |
0, |
| 9264 |
0, |
| 9265 |
0, |
| 9266 |
0, |
| 9267 |
0, |
| 9268 |
0, |
| 9269 |
0, |
| 9270 |
0, |
| 9271 |
0, |
| 9272 |
0, |
| 9273 |
0, |
| 9274 |
0, |
| 9275 |
0, |
| 9276 |
#if PY_VERSION_HEX >= 0x030400a1 |
| 9277 |
0, |
| 9278 |
#endif |
| 9279 |
#if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) |
| 9280 |
0, |
| 9281 |
#endif |
| 9282 |
#if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 |
| 9283 |
0, |
| 9284 |
#endif |
| 9285 |
#if PY_VERSION_HEX >= 0x030C0000 |
| 9286 |
0, |
| 9287 |
#endif |
| 9288 |
#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 |
| 9289 |
0, |
| 9290 |
#endif |
| 9291 |
}; |
| 9292 |
#endif |
| 9293 |
static PyObject * |
| 9294 |
__Pyx__PyAsyncGenValueWrapperNew(PyObject *val) |
| 9295 |
{ |
| 9296 |
__pyx__PyAsyncGenWrappedValue *o; |
| 9297 |
assert(val); |
| 9298 |
if (likely(__Pyx_ag_value_freelist_free)) { |
| 9299 |
__Pyx_ag_value_freelist_free--; |
| 9300 |
o = __Pyx_ag_value_freelist[__Pyx_ag_value_freelist_free]; |
| 9301 |
assert(__pyx__PyAsyncGenWrappedValue_CheckExact(o)); |
| 9302 |
_Py_NewReference((PyObject*)o); |
| 9303 |
} else { |
| 9304 |
o = PyObject_GC_New(__pyx__PyAsyncGenWrappedValue, __pyx__PyAsyncGenWrappedValueType); |
| 9305 |
if (unlikely(!o)) { |
| 9306 |
Py_DECREF(val); |
| 9307 |
return NULL; |
| 9308 |
} |
| 9309 |
} |
| 9310 |
o->agw_val = val; |
| 9311 |
PyObject_GC_Track((PyObject*)o); |
| 9312 |
return (PyObject*)o; |
| 9313 |
} |
| 9314 |
static void |
| 9315 |
__Pyx_async_gen_athrow_dealloc(__pyx_PyAsyncGenAThrow *o) |
| 9316 |
{ |
| 9317 |
PyObject_GC_UnTrack((PyObject *)o); |
| 9318 |
Py_CLEAR(o->agt_gen); |
| 9319 |
Py_CLEAR(o->agt_args); |
| 9320 |
__Pyx_PyHeapTypeObject_GC_Del(o); |
| 9321 |
} |
| 9322 |
static int |
| 9323 |
__Pyx_async_gen_athrow_traverse(__pyx_PyAsyncGenAThrow *o, visitproc visit, void *arg) |
| 9324 |
{ |
| 9325 |
Py_VISIT(o->agt_gen); |
| 9326 |
Py_VISIT(o->agt_args); |
| 9327 |
return 0; |
| 9328 |
} |
| 9329 |
static PyObject * |
| 9330 |
__Pyx_async_gen_athrow_send(__pyx_PyAsyncGenAThrow *o, PyObject *arg) |
| 9331 |
{ |
| 9332 |
__pyx_CoroutineObject *gen = (__pyx_CoroutineObject*)o->agt_gen; |
| 9333 |
PyObject *retval, *exc_type; |
| 9334 |
if (unlikely(o->agt_state == __PYX_AWAITABLE_STATE_CLOSED)) { |
| 9335 |
PyErr_SetString(PyExc_RuntimeError, __Pyx_ASYNC_GEN_CANNOT_REUSE_CLOSE_MSG); |
| 9336 |
return NULL; |
| 9337 |
} |
| 9338 |
if (unlikely(gen->resume_label == -1)) { |
| 9339 |
o->agt_state = __PYX_AWAITABLE_STATE_CLOSED; |
| 9340 |
PyErr_SetNone(PyExc_StopIteration); |
| 9341 |
return NULL; |
| 9342 |
} |
| 9343 |
if (o->agt_state == __PYX_AWAITABLE_STATE_INIT) { |
| 9344 |
if (unlikely(o->agt_gen->ag_running_async)) { |
| 9345 |
o->agt_state = __PYX_AWAITABLE_STATE_CLOSED; |
| 9346 |
if (o->agt_args == NULL) { |
| 9347 |
PyErr_SetString( |
| 9348 |
PyExc_RuntimeError, |
| 9349 |
"aclose(): asynchronous generator is already running"); |
| 9350 |
} else { |
| 9351 |
PyErr_SetString( |
| 9352 |
PyExc_RuntimeError, |
| 9353 |
"athrow(): asynchronous generator is already running"); |
| 9354 |
} |
| 9355 |
return NULL; |
| 9356 |
} |
| 9357 |
if (unlikely(o->agt_gen->ag_closed)) { |
| 9358 |
o->agt_state = __PYX_AWAITABLE_STATE_CLOSED; |
| 9359 |
PyErr_SetNone(__Pyx_PyExc_StopAsyncIteration); |
| 9360 |
return NULL; |
| 9361 |
} |
| 9362 |
if (unlikely(arg != Py_None)) { |
| 9363 |
PyErr_SetString(PyExc_RuntimeError, __Pyx_NON_INIT_CORO_MSG); |
| 9364 |
return NULL; |
| 9365 |
} |
| 9366 |
o->agt_state = __PYX_AWAITABLE_STATE_ITER; |
| 9367 |
o->agt_gen->ag_running_async = 1; |
| 9368 |
if (o->agt_args == NULL) { |
| 9369 |
o->agt_gen->ag_closed = 1; |
| 9370 |
retval = __Pyx__Coroutine_Throw((PyObject*)gen, |
| 9371 |
PyExc_GeneratorExit, NULL, NULL, NULL, 0); |
| 9372 |
if (retval && __pyx__PyAsyncGenWrappedValue_CheckExact(retval)) { |
| 9373 |
Py_DECREF(retval); |
| 9374 |
goto yield_close; |
| 9375 |
} |
| 9376 |
} else { |
| 9377 |
PyObject *typ; |
| 9378 |
PyObject *tb = NULL; |
| 9379 |
PyObject *val = NULL; |
| 9380 |
if (unlikely(!PyArg_UnpackTuple(o->agt_args, "athrow", 1, 3, &typ, &val, &tb))) { |
| 9381 |
return NULL; |
| 9382 |
} |
| 9383 |
retval = __Pyx__Coroutine_Throw((PyObject*)gen, |
| 9384 |
typ, val, tb, o->agt_args, 0); |
| 9385 |
retval = __Pyx_async_gen_unwrap_value(o->agt_gen, retval); |
| 9386 |
} |
| 9387 |
if (retval == NULL) { |
| 9388 |
goto check_error; |
| 9389 |
} |
| 9390 |
return retval; |
| 9391 |
} |
| 9392 |
assert (o->agt_state == __PYX_AWAITABLE_STATE_ITER); |
| 9393 |
retval = __Pyx_Coroutine_Send((PyObject *)gen, arg); |
| 9394 |
if (o->agt_args) { |
| 9395 |
return __Pyx_async_gen_unwrap_value(o->agt_gen, retval); |
| 9396 |
} else { |
| 9397 |
if (retval) { |
| 9398 |
if (unlikely(__pyx__PyAsyncGenWrappedValue_CheckExact(retval))) { |
| 9399 |
Py_DECREF(retval); |
| 9400 |
goto yield_close; |
| 9401 |
} |
| 9402 |
else { |
| 9403 |
return retval; |
| 9404 |
} |
| 9405 |
} |
| 9406 |
else { |
| 9407 |
goto check_error; |
| 9408 |
} |
| 9409 |
} |
| 9410 |
yield_close: |
| 9411 |
o->agt_gen->ag_running_async = 0; |
| 9412 |
o->agt_state = __PYX_AWAITABLE_STATE_CLOSED; |
| 9413 |
PyErr_SetString( |
| 9414 |
PyExc_RuntimeError, __Pyx_ASYNC_GEN_IGNORED_EXIT_MSG); |
| 9415 |
return NULL; |
| 9416 |
check_error: |
| 9417 |
o->agt_gen->ag_running_async = 0; |
| 9418 |
o->agt_state = __PYX_AWAITABLE_STATE_CLOSED; |
| 9419 |
exc_type = PyErr_Occurred(); |
| 9420 |
if (__Pyx_PyErr_GivenExceptionMatches2(exc_type, __Pyx_PyExc_StopAsyncIteration, PyExc_GeneratorExit)) { |
| 9421 |
if (o->agt_args == NULL) { |
| 9422 |
PyErr_Clear(); |
| 9423 |
PyErr_SetNone(PyExc_StopIteration); |
| 9424 |
} |
| 9425 |
} |
| 9426 |
return NULL; |
| 9427 |
} |
| 9428 |
static PyObject * |
| 9429 |
__Pyx_async_gen_athrow_throw(__pyx_PyAsyncGenAThrow *o, PyObject *args) |
| 9430 |
{ |
| 9431 |
PyObject *retval; |
| 9432 |
if (unlikely(o->agt_state == __PYX_AWAITABLE_STATE_CLOSED)) { |
| 9433 |
PyErr_SetString(PyExc_RuntimeError, __Pyx_ASYNC_GEN_CANNOT_REUSE_CLOSE_MSG); |
| 9434 |
return NULL; |
| 9435 |
} |
| 9436 |
retval = __Pyx_Coroutine_Throw((PyObject*)o->agt_gen, args); |
| 9437 |
if (o->agt_args) { |
| 9438 |
return __Pyx_async_gen_unwrap_value(o->agt_gen, retval); |
| 9439 |
} else { |
| 9440 |
PyObject *exc_type; |
| 9441 |
if (unlikely(retval && __pyx__PyAsyncGenWrappedValue_CheckExact(retval))) { |
| 9442 |
o->agt_gen->ag_running_async = 0; |
| 9443 |
o->agt_state = __PYX_AWAITABLE_STATE_CLOSED; |
| 9444 |
Py_DECREF(retval); |
| 9445 |
PyErr_SetString(PyExc_RuntimeError, __Pyx_ASYNC_GEN_IGNORED_EXIT_MSG); |
| 9446 |
return NULL; |
| 9447 |
} |
| 9448 |
exc_type = PyErr_Occurred(); |
| 9449 |
if (__Pyx_PyErr_GivenExceptionMatches2(exc_type, __Pyx_PyExc_StopAsyncIteration, PyExc_GeneratorExit)) { |
| 9450 |
PyErr_Clear(); |
| 9451 |
PyErr_SetNone(PyExc_StopIteration); |
| 9452 |
} |
| 9453 |
return retval; |
| 9454 |
} |
| 9455 |
} |
| 9456 |
static PyObject * |
| 9457 |
__Pyx_async_gen_athrow_iternext(__pyx_PyAsyncGenAThrow *o) |
| 9458 |
{ |
| 9459 |
return __Pyx_async_gen_athrow_send(o, Py_None); |
| 9460 |
} |
| 9461 |
static PyObject * |
| 9462 |
__Pyx_async_gen_athrow_close(PyObject *g, PyObject *args) |
| 9463 |
{ |
| 9464 |
__pyx_PyAsyncGenAThrow *o = (__pyx_PyAsyncGenAThrow*) g; |
| 9465 |
CYTHON_UNUSED_VAR(args); |
| 9466 |
o->agt_state = __PYX_AWAITABLE_STATE_CLOSED; |
| 9467 |
Py_RETURN_NONE; |
| 9468 |
} |
| 9469 |
static PyMethodDef __Pyx_async_gen_athrow_methods[] = { |
| 9470 |
{"send", (PyCFunction)__Pyx_async_gen_athrow_send, METH_O, __Pyx_async_gen_send_doc}, |
| 9471 |
{"throw", (PyCFunction)__Pyx_async_gen_athrow_throw, METH_VARARGS, __Pyx_async_gen_throw_doc}, |
| 9472 |
{"close", (PyCFunction)__Pyx_async_gen_athrow_close, METH_NOARGS, __Pyx_async_gen_close_doc}, |
| 9473 |
{"__await__", (PyCFunction)__Pyx_async_gen_self_method, METH_NOARGS, __Pyx_async_gen_await_doc}, |
| 9474 |
{0, 0, 0, 0} |
| 9475 |
}; |
| 9476 |
#if CYTHON_USE_TYPE_SPECS |
| 9477 |
static PyType_Slot __pyx__PyAsyncGenAThrowType_slots[] = { |
| 9478 |
{Py_tp_dealloc, (void *)__Pyx_async_gen_athrow_dealloc}, |
| 9479 |
{Py_am_await, (void *)PyObject_SelfIter}, |
| 9480 |
{Py_tp_traverse, (void *)__Pyx_async_gen_athrow_traverse}, |
| 9481 |
{Py_tp_iter, (void *)PyObject_SelfIter}, |
| 9482 |
{Py_tp_iternext, (void *)__Pyx_async_gen_athrow_iternext}, |
| 9483 |
{Py_tp_methods, (void *)__Pyx_async_gen_athrow_methods}, |
| 9484 |
{Py_tp_getattro, (void *)__Pyx_PyObject_GenericGetAttrNoDict}, |
| 9485 |
{0, 0}, |
| 9486 |
}; |
| 9487 |
static PyType_Spec __pyx__PyAsyncGenAThrowType_spec = { |
| 9488 |
__PYX_TYPE_MODULE_PREFIX "async_generator_athrow", |
| 9489 |
sizeof(__pyx_PyAsyncGenAThrow), |
| 9490 |
0, |
| 9491 |
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, |
| 9492 |
__pyx__PyAsyncGenAThrowType_slots |
| 9493 |
}; |
| 9494 |
#else |
| 9495 |
#if CYTHON_USE_ASYNC_SLOTS |
| 9496 |
static __Pyx_PyAsyncMethodsStruct __Pyx_async_gen_athrow_as_async = { |
| 9497 |
PyObject_SelfIter, |
| 9498 |
0, |
| 9499 |
0, |
| 9500 |
#if PY_VERSION_HEX >= 0x030A00A3 |
| 9501 |
0, |
| 9502 |
#endif |
| 9503 |
}; |
| 9504 |
#endif |
| 9505 |
static PyTypeObject __pyx__PyAsyncGenAThrowType_type = { |
| 9506 |
PyVarObject_HEAD_INIT(0, 0) |
| 9507 |
"async_generator_athrow", |
| 9508 |
sizeof(__pyx_PyAsyncGenAThrow), |
| 9509 |
0, |
| 9510 |
(destructor)__Pyx_async_gen_athrow_dealloc, |
| 9511 |
0, |
| 9512 |
0, |
| 9513 |
0, |
| 9514 |
#if CYTHON_USE_ASYNC_SLOTS |
| 9515 |
&__Pyx_async_gen_athrow_as_async, |
| 9516 |
#else |
| 9517 |
0, |
| 9518 |
#endif |
| 9519 |
0, |
| 9520 |
0, |
| 9521 |
0, |
| 9522 |
0, |
| 9523 |
0, |
| 9524 |
0, |
| 9525 |
0, |
| 9526 |
0, |
| 9527 |
0, |
| 9528 |
0, |
| 9529 |
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, |
| 9530 |
0, |
| 9531 |
(traverseproc)__Pyx_async_gen_athrow_traverse, |
| 9532 |
0, |
| 9533 |
#if CYTHON_USE_ASYNC_SLOTS && CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 && PY_VERSION_HEX < 0x030500B1 |
| 9534 |
__Pyx_Coroutine_compare, |
| 9535 |
#else |
| 9536 |
0, |
| 9537 |
#endif |
| 9538 |
0, |
| 9539 |
PyObject_SelfIter, |
| 9540 |
(iternextfunc)__Pyx_async_gen_athrow_iternext, |
| 9541 |
__Pyx_async_gen_athrow_methods, |
| 9542 |
0, |
| 9543 |
0, |
| 9544 |
0, |
| 9545 |
0, |
| 9546 |
0, |
| 9547 |
0, |
| 9548 |
0, |
| 9549 |
0, |
| 9550 |
0, |
| 9551 |
0, |
| 9552 |
0, |
| 9553 |
0, |
| 9554 |
0, |
| 9555 |
0, |
| 9556 |
0, |
| 9557 |
0, |
| 9558 |
0, |
| 9559 |
0, |
| 9560 |
0, |
| 9561 |
#if PY_VERSION_HEX >= 0x030400a1 |
| 9562 |
0, |
| 9563 |
#endif |
| 9564 |
#if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) |
| 9565 |
0, |
| 9566 |
#endif |
| 9567 |
#if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 |
| 9568 |
0, |
| 9569 |
#endif |
| 9570 |
#if PY_VERSION_HEX >= 0x030C0000 |
| 9571 |
0, |
| 9572 |
#endif |
| 9573 |
#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 |
| 9574 |
0, |
| 9575 |
#endif |
| 9576 |
}; |
| 9577 |
#endif |
| 9578 |
static PyObject * |
| 9579 |
__Pyx_async_gen_athrow_new(__pyx_PyAsyncGenObject *gen, PyObject *args) |
| 9580 |
{ |
| 9581 |
__pyx_PyAsyncGenAThrow *o; |
| 9582 |
o = PyObject_GC_New(__pyx_PyAsyncGenAThrow, __pyx__PyAsyncGenAThrowType); |
| 9583 |
if (unlikely(o == NULL)) { |
| 9584 |
return NULL; |
| 9585 |
} |
| 9586 |
o->agt_gen = gen; |
| 9587 |
o->agt_args = args; |
| 9588 |
o->agt_state = __PYX_AWAITABLE_STATE_INIT; |
| 9589 |
Py_INCREF(gen); |
| 9590 |
Py_XINCREF(args); |
| 9591 |
PyObject_GC_Track((PyObject*)o); |
| 9592 |
return (PyObject*)o; |
| 9593 |
} |
| 9594 |
static int __pyx_AsyncGen_init(PyObject *module) { |
| 9595 |
#if CYTHON_USE_TYPE_SPECS |
| 9596 |
__pyx_AsyncGenType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx_AsyncGenType_spec, NULL); |
| 9597 |
#else |
| 9598 |
CYTHON_MAYBE_UNUSED_VAR(module); |
| 9599 |
__pyx_AsyncGenType_type.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; |
| 9600 |
__pyx_AsyncGenType = __Pyx_FetchCommonType(&__pyx_AsyncGenType_type); |
| 9601 |
#endif |
| 9602 |
if (unlikely(!__pyx_AsyncGenType)) |
| 9603 |
return -1; |
| 9604 |
#if CYTHON_USE_TYPE_SPECS |
| 9605 |
__pyx__PyAsyncGenAThrowType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx__PyAsyncGenAThrowType_spec, NULL); |
| 9606 |
#else |
| 9607 |
__pyx__PyAsyncGenAThrowType_type.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; |
| 9608 |
__pyx__PyAsyncGenAThrowType = __Pyx_FetchCommonType(&__pyx__PyAsyncGenAThrowType_type); |
| 9609 |
#endif |
| 9610 |
if (unlikely(!__pyx__PyAsyncGenAThrowType)) |
| 9611 |
return -1; |
| 9612 |
#if CYTHON_USE_TYPE_SPECS |
| 9613 |
__pyx__PyAsyncGenWrappedValueType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx__PyAsyncGenWrappedValueType_spec, NULL); |
| 9614 |
#else |
| 9615 |
__pyx__PyAsyncGenWrappedValueType_type.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; |
| 9616 |
__pyx__PyAsyncGenWrappedValueType = __Pyx_FetchCommonType(&__pyx__PyAsyncGenWrappedValueType_type); |
| 9617 |
#endif |
| 9618 |
if (unlikely(!__pyx__PyAsyncGenWrappedValueType)) |
| 9619 |
return -1; |
| 9620 |
#if CYTHON_USE_TYPE_SPECS |
| 9621 |
__pyx__PyAsyncGenASendType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx__PyAsyncGenASendType_spec, NULL); |
| 9622 |
#else |
| 9623 |
__pyx__PyAsyncGenASendType_type.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict; |
| 9624 |
__pyx__PyAsyncGenASendType = __Pyx_FetchCommonType(&__pyx__PyAsyncGenASendType_type); |
| 9625 |
#endif |
| 9626 |
if (unlikely(!__pyx__PyAsyncGenASendType)) |
| 9627 |
return -1; |
| 9628 |
return 0; |
| 9629 |
} |
| 9630 |
|
| 9631 |
|
| 9632 |
|
| 9633 |
|
| 9634 |
|
| 9635 |
static int __Pyx_check_binary_version(void) { |
| 9636 |
char ctversion[5]; |
| 9637 |
int same=1, i, found_dot; |
| 9638 |
const char* rt_from_call = Py_GetVersion(); |
| 9639 |
PyOS_snprintf(ctversion, 5, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); |
| 9640 |
found_dot = 0; |
| 9641 |
for (i = 0; i < 4; i++) { |
| 9642 |
if (!ctversion[i]) { |
| 9643 |
same = (rt_from_call[i] < '0' || rt_from_call[i] > '9'); |
| 9644 |
break; |
| 9645 |
} |
| 9646 |
if (rt_from_call[i] != ctversion[i]) { |
| 9647 |
same = 0; |
| 9648 |
break; |
| 9649 |
} |
| 9650 |
} |
| 9651 |
if (!same) { |
| 9652 |
char rtversion[5] = {'\0'}; |
| 9653 |
char message[200]; |
| 9654 |
for (i=0; i<4; ++i) { |
| 9655 |
if (rt_from_call[i] == '.') { |
| 9656 |
if (found_dot) break; |
| 9657 |
found_dot = 1; |
| 9658 |
} else if (rt_from_call[i] < '0' || rt_from_call[i] > '9') { |
| 9659 |
break; |
| 9660 |
} |
| 9661 |
rtversion[i] = rt_from_call[i]; |
| 9662 |
} |
| 9663 |
PyOS_snprintf(message, sizeof(message), |
| 9664 |
"compile time version %s of module '%.100s' " |
| 9665 |
"does not match runtime version %s", |
| 9666 |
ctversion, __Pyx_MODULE_NAME, rtversion); |
| 9667 |
return PyErr_WarnEx(NULL, message, 1); |
| 9668 |
} |
| 9669 |
return 0; |
| 9670 |
} |
| 9671 |
|
| 9672 |
|
| 9673 |
#if PY_MAJOR_VERSION >= 3 |
| 9674 |
static int __Pyx_InitString(__Pyx_StringTabEntry t, PyObject **str) { |
| 9675 |
if (t.is_unicode | t.is_str) { |
| 9676 |
if (t.intern) { |
| 9677 |
*str = PyUnicode_InternFromString(t.s); |
| 9678 |
} else if (t.encoding) { |
| 9679 |
*str = PyUnicode_Decode(t.s, t.n - 1, t.encoding, NULL); |
| 9680 |
} else { |
| 9681 |
*str = PyUnicode_FromStringAndSize(t.s, t.n - 1); |
| 9682 |
} |
| 9683 |
} else { |
| 9684 |
*str = PyBytes_FromStringAndSize(t.s, t.n - 1); |
| 9685 |
} |
| 9686 |
if (!*str) |
| 9687 |
return -1; |
| 9688 |
if (PyObject_Hash(*str) == -1) |
| 9689 |
return -1; |
| 9690 |
return 0; |
| 9691 |
} |
| 9692 |
#endif |
| 9693 |
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { |
| 9694 |
while (t->p) { |
| 9695 |
#if PY_MAJOR_VERSION >= 3 |
| 9696 |
__Pyx_InitString(*t, t->p); |
| 9697 |
#else |
| 9698 |
if (t->is_unicode) { |
| 9699 |
*t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); |
| 9700 |
} else if (t->intern) { |
| 9701 |
*t->p = PyString_InternFromString(t->s); |
| 9702 |
} else { |
| 9703 |
*t->p = PyString_FromStringAndSize(t->s, t->n - 1); |
| 9704 |
} |
| 9705 |
if (!*t->p) |
| 9706 |
return -1; |
| 9707 |
if (PyObject_Hash(*t->p) == -1) |
| 9708 |
return -1; |
| 9709 |
#endif |
| 9710 |
++t; |
| 9711 |
} |
| 9712 |
return 0; |
| 9713 |
} |
| 9714 |
|
| 9715 |
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { |
| 9716 |
return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str)); |
| 9717 |
} |
| 9718 |
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) { |
| 9719 |
Py_ssize_t ignore; |
| 9720 |
return __Pyx_PyObject_AsStringAndSize(o, &ignore); |
| 9721 |
} |
| 9722 |
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT |
| 9723 |
#if !CYTHON_PEP393_ENABLED |
| 9724 |
static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { |
| 9725 |
char* defenc_c; |
| 9726 |
PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); |
| 9727 |
if (!defenc) return NULL; |
| 9728 |
defenc_c = PyBytes_AS_STRING(defenc); |
| 9729 |
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII |
| 9730 |
{ |
| 9731 |
char* end = defenc_c + PyBytes_GET_SIZE(defenc); |
| 9732 |
char* c; |
| 9733 |
for (c = defenc_c; c < end; c++) { |
| 9734 |
if ((unsigned char) (*c) >= 128) { |
| 9735 |
PyUnicode_AsASCIIString(o); |
| 9736 |
return NULL; |
| 9737 |
} |
| 9738 |
} |
| 9739 |
} |
| 9740 |
#endif |
| 9741 |
*length = PyBytes_GET_SIZE(defenc); |
| 9742 |
return defenc_c; |
| 9743 |
} |
| 9744 |
#else |
| 9745 |
static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { |
| 9746 |
if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL; |
| 9747 |
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII |
| 9748 |
if (likely(PyUnicode_IS_ASCII(o))) { |
| 9749 |
*length = PyUnicode_GET_LENGTH(o); |
| 9750 |
return PyUnicode_AsUTF8(o); |
| 9751 |
} else { |
| 9752 |
PyUnicode_AsASCIIString(o); |
| 9753 |
return NULL; |
| 9754 |
} |
| 9755 |
#else |
| 9756 |
return PyUnicode_AsUTF8AndSize(o, length); |
| 9757 |
#endif |
| 9758 |
} |
| 9759 |
#endif |
| 9760 |
#endif |
| 9761 |
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { |
| 9762 |
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT |
| 9763 |
if ( |
| 9764 |
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII |
| 9765 |
__Pyx_sys_getdefaultencoding_not_ascii && |
| 9766 |
#endif |
| 9767 |
PyUnicode_Check(o)) { |
| 9768 |
return __Pyx_PyUnicode_AsStringAndSize(o, length); |
| 9769 |
} else |
| 9770 |
#endif |
| 9771 |
#if (!CYTHON_COMPILING_IN_PYPY && !CYTHON_COMPILING_IN_LIMITED_API) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) |
| 9772 |
if (PyByteArray_Check(o)) { |
| 9773 |
*length = PyByteArray_GET_SIZE(o); |
| 9774 |
return PyByteArray_AS_STRING(o); |
| 9775 |
} else |
| 9776 |
#endif |
| 9777 |
{ |
| 9778 |
char* result; |
| 9779 |
int r = PyBytes_AsStringAndSize(o, &result, length); |
| 9780 |
if (unlikely(r < 0)) { |
| 9781 |
return NULL; |
| 9782 |
} else { |
| 9783 |
return result; |
| 9784 |
} |
| 9785 |
} |
| 9786 |
} |
| 9787 |
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { |
| 9788 |
int is_true = x == Py_True; |
| 9789 |
if (is_true | (x == Py_False) | (x == Py_None)) return is_true; |
| 9790 |
else return PyObject_IsTrue(x); |
| 9791 |
} |
| 9792 |
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { |
| 9793 |
int retval; |
| 9794 |
if (unlikely(!x)) return -1; |
| 9795 |
retval = __Pyx_PyObject_IsTrue(x); |
| 9796 |
Py_DECREF(x); |
| 9797 |
return retval; |
| 9798 |
} |
| 9799 |
static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) { |
| 9800 |
__Pyx_TypeName result_type_name = __Pyx_PyType_GetName(Py_TYPE(result)); |
| 9801 |
#if PY_MAJOR_VERSION >= 3 |
| 9802 |
if (PyLong_Check(result)) { |
| 9803 |
if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, |
| 9804 |
"__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). " |
| 9805 |
"The ability to return an instance of a strict subclass of int is deprecated, " |
| 9806 |
"and may be removed in a future version of Python.", |
| 9807 |
result_type_name)) { |
| 9808 |
__Pyx_DECREF_TypeName(result_type_name); |
| 9809 |
Py_DECREF(result); |
| 9810 |
return NULL; |
| 9811 |
} |
| 9812 |
__Pyx_DECREF_TypeName(result_type_name); |
| 9813 |
return result; |
| 9814 |
} |
| 9815 |
#endif |
| 9816 |
PyErr_Format(PyExc_TypeError, |
| 9817 |
"__%.4s__ returned non-%.4s (type " __Pyx_FMT_TYPENAME ")", |
| 9818 |
type_name, type_name, result_type_name); |
| 9819 |
__Pyx_DECREF_TypeName(result_type_name); |
| 9820 |
Py_DECREF(result); |
| 9821 |
return NULL; |
| 9822 |
} |
| 9823 |
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) { |
| 9824 |
#if CYTHON_USE_TYPE_SLOTS |
| 9825 |
PyNumberMethods *m; |
| 9826 |
#endif |
| 9827 |
const char *name = NULL; |
| 9828 |
PyObject *res = NULL; |
| 9829 |
#if PY_MAJOR_VERSION < 3 |
| 9830 |
if (likely(PyInt_Check(x) || PyLong_Check(x))) |
| 9831 |
#else |
| 9832 |
if (likely(PyLong_Check(x))) |
| 9833 |
#endif |
| 9834 |
return __Pyx_NewRef(x); |
| 9835 |
#if CYTHON_USE_TYPE_SLOTS |
| 9836 |
m = Py_TYPE(x)->tp_as_number; |
| 9837 |
#if PY_MAJOR_VERSION < 3 |
| 9838 |
if (m && m->nb_int) { |
| 9839 |
name = "int"; |
| 9840 |
res = m->nb_int(x); |
| 9841 |
} |
| 9842 |
else if (m && m->nb_long) { |
| 9843 |
name = "long"; |
| 9844 |
res = m->nb_long(x); |
| 9845 |
} |
| 9846 |
#else |
| 9847 |
if (likely(m && m->nb_int)) { |
| 9848 |
name = "int"; |
| 9849 |
res = m->nb_int(x); |
| 9850 |
} |
| 9851 |
#endif |
| 9852 |
#else |
| 9853 |
if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) { |
| 9854 |
res = PyNumber_Int(x); |
| 9855 |
} |
| 9856 |
#endif |
| 9857 |
if (likely(res)) { |
| 9858 |
#if PY_MAJOR_VERSION < 3 |
| 9859 |
if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) { |
| 9860 |
#else |
| 9861 |
if (unlikely(!PyLong_CheckExact(res))) { |
| 9862 |
#endif |
| 9863 |
return __Pyx_PyNumber_IntOrLongWrongResultType(res, name); |
| 9864 |
} |
| 9865 |
} |
| 9866 |
else if (!PyErr_Occurred()) { |
| 9867 |
PyErr_SetString(PyExc_TypeError, |
| 9868 |
"an integer is required"); |
| 9869 |
} |
| 9870 |
return res; |
| 9871 |
} |
| 9872 |
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { |
| 9873 |
Py_ssize_t ival; |
| 9874 |
PyObject *x; |
| 9875 |
#if PY_MAJOR_VERSION < 3 |
| 9876 |
if (likely(PyInt_CheckExact(b))) { |
| 9877 |
if (sizeof(Py_ssize_t) >= sizeof(long)) |
| 9878 |
return PyInt_AS_LONG(b); |
| 9879 |
else |
| 9880 |
return PyInt_AsSsize_t(b); |
| 9881 |
} |
| 9882 |
#endif |
| 9883 |
if (likely(PyLong_CheckExact(b))) { |
| 9884 |
#if CYTHON_USE_PYLONG_INTERNALS |
| 9885 |
if (likely(__Pyx_PyLong_IsCompact(b))) { |
| 9886 |
return __Pyx_PyLong_CompactValue(b); |
| 9887 |
} else { |
| 9888 |
const digit* digits = __Pyx_PyLong_Digits(b); |
| 9889 |
const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b); |
| 9890 |
switch (size) { |
| 9891 |
case 2: |
| 9892 |
if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { |
| 9893 |
return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); |
| 9894 |
} |
| 9895 |
break; |
| 9896 |
case -2: |
| 9897 |
if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { |
| 9898 |
return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); |
| 9899 |
} |
| 9900 |
break; |
| 9901 |
case 3: |
| 9902 |
if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { |
| 9903 |
return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); |
| 9904 |
} |
| 9905 |
break; |
| 9906 |
case -3: |
| 9907 |
if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { |
| 9908 |
return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); |
| 9909 |
} |
| 9910 |
break; |
| 9911 |
case 4: |
| 9912 |
if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { |
| 9913 |
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])); |
| 9914 |
} |
| 9915 |
break; |
| 9916 |
case -4: |
| 9917 |
if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { |
| 9918 |
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])); |
| 9919 |
} |
| 9920 |
break; |
| 9921 |
} |
| 9922 |
} |
| 9923 |
#endif |
| 9924 |
return PyLong_AsSsize_t(b); |
| 9925 |
} |
| 9926 |
x = PyNumber_Index(b); |
| 9927 |
if (!x) return -1; |
| 9928 |
ival = PyInt_AsSsize_t(x); |
| 9929 |
Py_DECREF(x); |
| 9930 |
return ival; |
| 9931 |
} |
| 9932 |
static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) { |
| 9933 |
if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) { |
| 9934 |
return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o); |
| 9935 |
#if PY_MAJOR_VERSION < 3 |
| 9936 |
} else if (likely(PyInt_CheckExact(o))) { |
| 9937 |
return PyInt_AS_LONG(o); |
| 9938 |
#endif |
| 9939 |
} else { |
| 9940 |
Py_ssize_t ival; |
| 9941 |
PyObject *x; |
| 9942 |
x = PyNumber_Index(o); |
| 9943 |
if (!x) return -1; |
| 9944 |
ival = PyInt_AsLong(x); |
| 9945 |
Py_DECREF(x); |
| 9946 |
return ival; |
| 9947 |
} |
| 9948 |
} |
| 9949 |
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { |
| 9950 |
return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False); |
| 9951 |
} |
| 9952 |
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { |
| 9953 |
return PyInt_FromSize_t(ival); |
| 9954 |
} |
| 9955 |
|
| 9956 |
|
| 9957 |
|
| 9958 |
#ifdef _MSC_VER |
| 9959 |
#pragma warning( pop ) |
| 9960 |
#endif |
| 9961 |
|
| 9962 |
|
| 9963 |
|
| 9964 |
|
| 9965 |
#endif |