Debian Codegraph @

skfmm/pheap.cpp

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