CYCLUS
Loading...
Searching...
No Matches
pymodule.cc
Go to the documentation of this file.
1/* Generated by Cython 3.0.11 */
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_11" __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 0x03000BF0
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 #undef CYTHON_USE_FREELISTS
123 #define CYTHON_USE_FREELISTS 0
124#elif defined(PYPY_VERSION)
125 #define CYTHON_COMPILING_IN_PYPY 1
126 #define CYTHON_COMPILING_IN_CPYTHON 0
127 #define CYTHON_COMPILING_IN_LIMITED_API 0
128 #define CYTHON_COMPILING_IN_GRAAL 0
129 #define CYTHON_COMPILING_IN_NOGIL 0
130 #undef CYTHON_USE_TYPE_SLOTS
131 #define CYTHON_USE_TYPE_SLOTS 0
132 #ifndef CYTHON_USE_TYPE_SPECS
133 #define CYTHON_USE_TYPE_SPECS 0
134 #endif
135 #undef CYTHON_USE_PYTYPE_LOOKUP
136 #define CYTHON_USE_PYTYPE_LOOKUP 0
137 #if PY_VERSION_HEX < 0x03050000
138 #undef CYTHON_USE_ASYNC_SLOTS
139 #define CYTHON_USE_ASYNC_SLOTS 0
140 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
141 #define CYTHON_USE_ASYNC_SLOTS 1
142 #endif
143 #undef CYTHON_USE_PYLIST_INTERNALS
144 #define CYTHON_USE_PYLIST_INTERNALS 0
145 #undef CYTHON_USE_UNICODE_INTERNALS
146 #define CYTHON_USE_UNICODE_INTERNALS 0
147 #undef CYTHON_USE_UNICODE_WRITER
148 #define CYTHON_USE_UNICODE_WRITER 0
149 #undef CYTHON_USE_PYLONG_INTERNALS
150 #define CYTHON_USE_PYLONG_INTERNALS 0
151 #undef CYTHON_AVOID_BORROWED_REFS
152 #define CYTHON_AVOID_BORROWED_REFS 1
153 #undef CYTHON_ASSUME_SAFE_MACROS
154 #define CYTHON_ASSUME_SAFE_MACROS 0
155 #undef CYTHON_UNPACK_METHODS
156 #define CYTHON_UNPACK_METHODS 0
157 #undef CYTHON_FAST_THREAD_STATE
158 #define CYTHON_FAST_THREAD_STATE 0
159 #undef CYTHON_FAST_GIL
160 #define CYTHON_FAST_GIL 0
161 #undef CYTHON_METH_FASTCALL
162 #define CYTHON_METH_FASTCALL 0
163 #undef CYTHON_FAST_PYCALL
164 #define CYTHON_FAST_PYCALL 0
165 #ifndef CYTHON_PEP487_INIT_SUBCLASS
166 #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3)
167 #endif
168 #if PY_VERSION_HEX < 0x03090000
169 #undef CYTHON_PEP489_MULTI_PHASE_INIT
170 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
171 #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT)
172 #define CYTHON_PEP489_MULTI_PHASE_INIT 1
173 #endif
174 #undef CYTHON_USE_MODULE_STATE
175 #define CYTHON_USE_MODULE_STATE 0
176 #undef CYTHON_USE_TP_FINALIZE
177 #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1 && PYPY_VERSION_NUM >= 0x07030C00)
178 #undef CYTHON_USE_DICT_VERSIONS
179 #define CYTHON_USE_DICT_VERSIONS 0
180 #undef CYTHON_USE_EXC_INFO_STACK
181 #define CYTHON_USE_EXC_INFO_STACK 0
182 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
183 #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
184 #endif
185 #undef CYTHON_USE_FREELISTS
186 #define CYTHON_USE_FREELISTS 0
187#elif defined(CYTHON_LIMITED_API)
188 #ifdef Py_LIMITED_API
189 #undef __PYX_LIMITED_VERSION_HEX
190 #define __PYX_LIMITED_VERSION_HEX Py_LIMITED_API
191 #endif
192 #define CYTHON_COMPILING_IN_PYPY 0
193 #define CYTHON_COMPILING_IN_CPYTHON 0
194 #define CYTHON_COMPILING_IN_LIMITED_API 1
195 #define CYTHON_COMPILING_IN_GRAAL 0
196 #define CYTHON_COMPILING_IN_NOGIL 0
197 #undef CYTHON_CLINE_IN_TRACEBACK
198 #define CYTHON_CLINE_IN_TRACEBACK 0
199 #undef CYTHON_USE_TYPE_SLOTS
200 #define CYTHON_USE_TYPE_SLOTS 0
201 #undef CYTHON_USE_TYPE_SPECS
202 #define CYTHON_USE_TYPE_SPECS 1
203 #undef CYTHON_USE_PYTYPE_LOOKUP
204 #define CYTHON_USE_PYTYPE_LOOKUP 0
205 #undef CYTHON_USE_ASYNC_SLOTS
206 #define CYTHON_USE_ASYNC_SLOTS 0
207 #undef CYTHON_USE_PYLIST_INTERNALS
208 #define CYTHON_USE_PYLIST_INTERNALS 0
209 #undef CYTHON_USE_UNICODE_INTERNALS
210 #define CYTHON_USE_UNICODE_INTERNALS 0
211 #ifndef CYTHON_USE_UNICODE_WRITER
212 #define CYTHON_USE_UNICODE_WRITER 0
213 #endif
214 #undef CYTHON_USE_PYLONG_INTERNALS
215 #define CYTHON_USE_PYLONG_INTERNALS 0
216 #ifndef CYTHON_AVOID_BORROWED_REFS
217 #define CYTHON_AVOID_BORROWED_REFS 0
218 #endif
219 #undef CYTHON_ASSUME_SAFE_MACROS
220 #define CYTHON_ASSUME_SAFE_MACROS 0
221 #undef CYTHON_UNPACK_METHODS
222 #define CYTHON_UNPACK_METHODS 0
223 #undef CYTHON_FAST_THREAD_STATE
224 #define CYTHON_FAST_THREAD_STATE 0
225 #undef CYTHON_FAST_GIL
226 #define CYTHON_FAST_GIL 0
227 #undef CYTHON_METH_FASTCALL
228 #define CYTHON_METH_FASTCALL 0
229 #undef CYTHON_FAST_PYCALL
230 #define CYTHON_FAST_PYCALL 0
231 #ifndef CYTHON_PEP487_INIT_SUBCLASS
232 #define CYTHON_PEP487_INIT_SUBCLASS 1
233 #endif
234 #undef CYTHON_PEP489_MULTI_PHASE_INIT
235 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
236 #undef CYTHON_USE_MODULE_STATE
237 #define CYTHON_USE_MODULE_STATE 1
238 #ifndef CYTHON_USE_TP_FINALIZE
239 #define CYTHON_USE_TP_FINALIZE 0
240 #endif
241 #undef CYTHON_USE_DICT_VERSIONS
242 #define CYTHON_USE_DICT_VERSIONS 0
243 #undef CYTHON_USE_EXC_INFO_STACK
244 #define CYTHON_USE_EXC_INFO_STACK 0
245 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
246 #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
247 #endif
248 #undef CYTHON_USE_FREELISTS
249 #define CYTHON_USE_FREELISTS 0
250#elif defined(Py_GIL_DISABLED) || defined(Py_NOGIL)
251 #define CYTHON_COMPILING_IN_PYPY 0
252 #define CYTHON_COMPILING_IN_CPYTHON 0
253 #define CYTHON_COMPILING_IN_LIMITED_API 0
254 #define CYTHON_COMPILING_IN_GRAAL 0
255 #define CYTHON_COMPILING_IN_NOGIL 1
256 #ifndef CYTHON_USE_TYPE_SLOTS
257 #define CYTHON_USE_TYPE_SLOTS 1
258 #endif
259 #ifndef CYTHON_USE_TYPE_SPECS
260 #define CYTHON_USE_TYPE_SPECS 0
261 #endif
262 #undef CYTHON_USE_PYTYPE_LOOKUP
263 #define CYTHON_USE_PYTYPE_LOOKUP 0
264 #ifndef CYTHON_USE_ASYNC_SLOTS
265 #define CYTHON_USE_ASYNC_SLOTS 1
266 #endif
267 #ifndef CYTHON_USE_PYLONG_INTERNALS
268 #define CYTHON_USE_PYLONG_INTERNALS 0
269 #endif
270 #undef CYTHON_USE_PYLIST_INTERNALS
271 #define CYTHON_USE_PYLIST_INTERNALS 0
272 #ifndef CYTHON_USE_UNICODE_INTERNALS
273 #define CYTHON_USE_UNICODE_INTERNALS 1
274 #endif
275 #undef CYTHON_USE_UNICODE_WRITER
276 #define CYTHON_USE_UNICODE_WRITER 0
277 #ifndef CYTHON_AVOID_BORROWED_REFS
278 #define CYTHON_AVOID_BORROWED_REFS 0
279 #endif
280 #ifndef CYTHON_ASSUME_SAFE_MACROS
281 #define CYTHON_ASSUME_SAFE_MACROS 1
282 #endif
283 #ifndef CYTHON_UNPACK_METHODS
284 #define CYTHON_UNPACK_METHODS 1
285 #endif
286 #undef CYTHON_FAST_THREAD_STATE
287 #define CYTHON_FAST_THREAD_STATE 0
288 #undef CYTHON_FAST_GIL
289 #define CYTHON_FAST_GIL 0
290 #ifndef CYTHON_METH_FASTCALL
291 #define CYTHON_METH_FASTCALL 1
292 #endif
293 #undef CYTHON_FAST_PYCALL
294 #define CYTHON_FAST_PYCALL 0
295 #ifndef CYTHON_PEP487_INIT_SUBCLASS
296 #define CYTHON_PEP487_INIT_SUBCLASS 1
297 #endif
298 #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
299 #define CYTHON_PEP489_MULTI_PHASE_INIT 1
300 #endif
301 #ifndef CYTHON_USE_MODULE_STATE
302 #define CYTHON_USE_MODULE_STATE 0
303 #endif
304 #ifndef CYTHON_USE_TP_FINALIZE
305 #define CYTHON_USE_TP_FINALIZE 1
306 #endif
307 #undef CYTHON_USE_DICT_VERSIONS
308 #define CYTHON_USE_DICT_VERSIONS 0
309 #undef CYTHON_USE_EXC_INFO_STACK
310 #define CYTHON_USE_EXC_INFO_STACK 0
311 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
312 #define CYTHON_UPDATE_DESCRIPTOR_DOC 1
313 #endif
314 #ifndef CYTHON_USE_FREELISTS
315 #define CYTHON_USE_FREELISTS 0
316 #endif
317#else
318 #define CYTHON_COMPILING_IN_PYPY 0
319 #define CYTHON_COMPILING_IN_CPYTHON 1
320 #define CYTHON_COMPILING_IN_LIMITED_API 0
321 #define CYTHON_COMPILING_IN_GRAAL 0
322 #define CYTHON_COMPILING_IN_NOGIL 0
323 #ifndef CYTHON_USE_TYPE_SLOTS
324 #define CYTHON_USE_TYPE_SLOTS 1
325 #endif
326 #ifndef CYTHON_USE_TYPE_SPECS
327 #define CYTHON_USE_TYPE_SPECS 0
328 #endif
329 #ifndef CYTHON_USE_PYTYPE_LOOKUP
330 #define CYTHON_USE_PYTYPE_LOOKUP 1
331 #endif
332 #if PY_MAJOR_VERSION < 3
333 #undef CYTHON_USE_ASYNC_SLOTS
334 #define CYTHON_USE_ASYNC_SLOTS 0
335 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
336 #define CYTHON_USE_ASYNC_SLOTS 1
337 #endif
338 #ifndef CYTHON_USE_PYLONG_INTERNALS
339 #define CYTHON_USE_PYLONG_INTERNALS 1
340 #endif
341 #ifndef CYTHON_USE_PYLIST_INTERNALS
342 #define CYTHON_USE_PYLIST_INTERNALS 1
343 #endif
344 #ifndef CYTHON_USE_UNICODE_INTERNALS
345 #define CYTHON_USE_UNICODE_INTERNALS 1
346 #endif
347 #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2
348 #undef CYTHON_USE_UNICODE_WRITER
349 #define CYTHON_USE_UNICODE_WRITER 0
350 #elif !defined(CYTHON_USE_UNICODE_WRITER)
351 #define CYTHON_USE_UNICODE_WRITER 1
352 #endif
353 #ifndef CYTHON_AVOID_BORROWED_REFS
354 #define CYTHON_AVOID_BORROWED_REFS 0
355 #endif
356 #ifndef CYTHON_ASSUME_SAFE_MACROS
357 #define CYTHON_ASSUME_SAFE_MACROS 1
358 #endif
359 #ifndef CYTHON_UNPACK_METHODS
360 #define CYTHON_UNPACK_METHODS 1
361 #endif
362 #ifndef CYTHON_FAST_THREAD_STATE
363 #define CYTHON_FAST_THREAD_STATE 1
364 #endif
365 #ifndef CYTHON_FAST_GIL
366 #define CYTHON_FAST_GIL (PY_MAJOR_VERSION < 3 || PY_VERSION_HEX >= 0x03060000 && PY_VERSION_HEX < 0x030C00A6)
367 #endif
368 #ifndef CYTHON_METH_FASTCALL
369 #define CYTHON_METH_FASTCALL (PY_VERSION_HEX >= 0x030700A1)
370 #endif
371 #ifndef CYTHON_FAST_PYCALL
372 #define CYTHON_FAST_PYCALL 1
373 #endif
374 #ifndef CYTHON_PEP487_INIT_SUBCLASS
375 #define CYTHON_PEP487_INIT_SUBCLASS 1
376 #endif
377 #if PY_VERSION_HEX < 0x03050000
378 #undef CYTHON_PEP489_MULTI_PHASE_INIT
379 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
380 #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT)
381 #define CYTHON_PEP489_MULTI_PHASE_INIT 1
382 #endif
383 #ifndef CYTHON_USE_MODULE_STATE
384 #define CYTHON_USE_MODULE_STATE 0
385 #endif
386 #if PY_VERSION_HEX < 0x030400a1
387 #undef CYTHON_USE_TP_FINALIZE
388 #define CYTHON_USE_TP_FINALIZE 0
389 #elif !defined(CYTHON_USE_TP_FINALIZE)
390 #define CYTHON_USE_TP_FINALIZE 1
391 #endif
392 #if PY_VERSION_HEX < 0x030600B1
393 #undef CYTHON_USE_DICT_VERSIONS
394 #define CYTHON_USE_DICT_VERSIONS 0
395 #elif !defined(CYTHON_USE_DICT_VERSIONS)
396 #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX < 0x030C00A5)
397 #endif
398 #if PY_VERSION_HEX < 0x030700A3
399 #undef CYTHON_USE_EXC_INFO_STACK
400 #define CYTHON_USE_EXC_INFO_STACK 0
401 #elif !defined(CYTHON_USE_EXC_INFO_STACK)
402 #define CYTHON_USE_EXC_INFO_STACK 1
403 #endif
404 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
405 #define CYTHON_UPDATE_DESCRIPTOR_DOC 1
406 #endif
407 #ifndef CYTHON_USE_FREELISTS
408 #define CYTHON_USE_FREELISTS 1
409 #endif
410#endif
411#if !defined(CYTHON_FAST_PYCCALL)
412#define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
413#endif
414#if !defined(CYTHON_VECTORCALL)
415#define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL && PY_VERSION_HEX >= 0x030800B1)
416#endif
417#define CYTHON_BACKPORT_VECTORCALL (CYTHON_METH_FASTCALL && PY_VERSION_HEX < 0x030800B1)
418#if CYTHON_USE_PYLONG_INTERNALS
419 #if PY_MAJOR_VERSION < 3
420 #include "longintrepr.h"
421 #endif
422 #undef SHIFT
423 #undef BASE
424 #undef MASK
425 #ifdef SIZEOF_VOID_P
426 enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
427 #endif
428#endif
429#ifndef __has_attribute
430 #define __has_attribute(x) 0
431#endif
432#ifndef __has_cpp_attribute
433 #define __has_cpp_attribute(x) 0
434#endif
435#ifndef CYTHON_RESTRICT
436 #if defined(__GNUC__)
437 #define CYTHON_RESTRICT __restrict__
438 #elif defined(_MSC_VER) && _MSC_VER >= 1400
439 #define CYTHON_RESTRICT __restrict
440 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
441 #define CYTHON_RESTRICT restrict
442 #else
443 #define CYTHON_RESTRICT
444 #endif
445#endif
446#ifndef CYTHON_UNUSED
447 #if defined(__cplusplus)
448 /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17
449 * but leads to warnings with -pedantic, since it is a C++17 feature */
450 #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
451 #if __has_cpp_attribute(maybe_unused)
452 #define CYTHON_UNUSED [[maybe_unused]]
453 #endif
454 #endif
455 #endif
456#endif
457#ifndef CYTHON_UNUSED
458# if defined(__GNUC__)
459# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
460# define CYTHON_UNUSED __attribute__ ((__unused__))
461# else
462# define CYTHON_UNUSED
463# endif
464# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
465# define CYTHON_UNUSED __attribute__ ((__unused__))
466# else
467# define CYTHON_UNUSED
468# endif
469#endif
470#ifndef CYTHON_UNUSED_VAR
471# if defined(__cplusplus)
472 template<class T> void CYTHON_UNUSED_VAR( const T& ) { }
473# else
474# define CYTHON_UNUSED_VAR(x) (void)(x)
475# endif
476#endif
477#ifndef CYTHON_MAYBE_UNUSED_VAR
478 #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x)
479#endif
480#ifndef CYTHON_NCP_UNUSED
481# if CYTHON_COMPILING_IN_CPYTHON
482# define CYTHON_NCP_UNUSED
483# else
484# define CYTHON_NCP_UNUSED CYTHON_UNUSED
485# endif
486#endif
487#ifndef CYTHON_USE_CPP_STD_MOVE
488 #if defined(__cplusplus) && (\
489 __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600))
490 #define CYTHON_USE_CPP_STD_MOVE 1
491 #else
492 #define CYTHON_USE_CPP_STD_MOVE 0
493 #endif
494#endif
495#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
496#ifdef _MSC_VER
497 #ifndef _MSC_STDINT_H_
498 #if _MSC_VER < 1300
499 typedef unsigned char uint8_t;
500 typedef unsigned short uint16_t;
501 typedef unsigned int uint32_t;
502 #else
503 typedef unsigned __int8 uint8_t;
504 typedef unsigned __int16 uint16_t;
505 typedef unsigned __int32 uint32_t;
506 #endif
507 #endif
508 #if _MSC_VER < 1300
509 #ifdef _WIN64
510 typedef unsigned long long __pyx_uintptr_t;
511 #else
512 typedef unsigned int __pyx_uintptr_t;
513 #endif
514 #else
515 #ifdef _WIN64
516 typedef unsigned __int64 __pyx_uintptr_t;
517 #else
518 typedef unsigned __int32 __pyx_uintptr_t;
519 #endif
520 #endif
521#else
522 #include <stdint.h>
523 typedef uintptr_t __pyx_uintptr_t;
524#endif
525#ifndef CYTHON_FALLTHROUGH
526 #if defined(__cplusplus)
527 /* for clang __has_cpp_attribute(fallthrough) is true even before C++17
528 * but leads to warnings with -pedantic, since it is a C++17 feature */
529 #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
530 #if __has_cpp_attribute(fallthrough)
531 #define CYTHON_FALLTHROUGH [[fallthrough]]
532 #endif
533 #endif
534 #ifndef CYTHON_FALLTHROUGH
535 #if __has_cpp_attribute(clang::fallthrough)
536 #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
537 #elif __has_cpp_attribute(gnu::fallthrough)
538 #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
539 #endif
540 #endif
541 #endif
542 #ifndef CYTHON_FALLTHROUGH
543 #if __has_attribute(fallthrough)
544 #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
545 #else
546 #define CYTHON_FALLTHROUGH
547 #endif
548 #endif
549 #if defined(__clang__) && defined(__apple_build_version__)
550 #if __apple_build_version__ < 7000000
551 #undef CYTHON_FALLTHROUGH
552 #define CYTHON_FALLTHROUGH
553 #endif
554 #endif
555#endif
556#ifdef __cplusplus
557 template <typename T>
558 struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);};
559 #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL<type>::value)
560#else
561 #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0)
562#endif
563#if CYTHON_COMPILING_IN_PYPY == 1
564 #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x030A0000)
565#else
566 #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000)
567#endif
568#define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer))
569
570#ifndef __cplusplus
571 #error "Cython files generated with the C++ option must be compiled with a C++ compiler."
572#endif
573#ifndef CYTHON_INLINE
574 #if defined(__clang__)
575 #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
576 #else
577 #define CYTHON_INLINE inline
578 #endif
579#endif
580template<typename T>
581void __Pyx_call_destructor(T& x) {
582 x.~T();
583}
584template<typename T>
585class __Pyx_FakeReference {
586 public:
587 __Pyx_FakeReference() : ptr(NULL) { }
588 __Pyx_FakeReference(const T& ref) : ptr(const_cast<T*>(&ref)) { }
589 T *operator->() { return ptr; }
590 T *operator&() { return ptr; }
591 operator T&() { return *ptr; }
592 template<typename U> bool operator ==(const U& other) const { return *ptr == other; }
593 template<typename U> bool operator !=(const U& other) const { return *ptr != other; }
594 template<typename U> bool operator==(const __Pyx_FakeReference<U>& other) const { return *ptr == *other.ptr; }
595 template<typename U> bool operator!=(const __Pyx_FakeReference<U>& other) const { return *ptr != *other.ptr; }
596 private:
597 T *ptr;
598};
599
600#define __PYX_BUILD_PY_SSIZE_T "n"
601#define CYTHON_FORMAT_SSIZE_T "z"
602#if PY_MAJOR_VERSION < 3
603 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
604 #define __Pyx_DefaultClassType PyClass_Type
605 #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
606 PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
607#else
608 #define __Pyx_BUILTIN_MODULE_NAME "builtins"
609 #define __Pyx_DefaultClassType PyType_Type
610#if CYTHON_COMPILING_IN_LIMITED_API
611 static CYTHON_INLINE PyObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f,
612 PyObject *code, PyObject *c, PyObject* n, PyObject *v,
613 PyObject *fv, PyObject *cell, PyObject* fn,
614 PyObject *name, int fline, PyObject *lnos) {
615 PyObject *exception_table = NULL;
616 PyObject *types_module=NULL, *code_type=NULL, *result=NULL;
617 #if __PYX_LIMITED_VERSION_HEX < 0x030B0000
618 PyObject *version_info;
619 PyObject *py_minor_version = NULL;
620 #endif
621 long minor_version = 0;
622 PyObject *type, *value, *traceback;
623 PyErr_Fetch(&type, &value, &traceback);
624 #if __PYX_LIMITED_VERSION_HEX >= 0x030B0000
625 minor_version = 11;
626 #else
627 if (!(version_info = PySys_GetObject("version_info"))) goto end;
628 if (!(py_minor_version = PySequence_GetItem(version_info, 1))) goto end;
629 minor_version = PyLong_AsLong(py_minor_version);
630 Py_DECREF(py_minor_version);
631 if (minor_version == -1 && PyErr_Occurred()) goto end;
632 #endif
633 if (!(types_module = PyImport_ImportModule("types"))) goto end;
634 if (!(code_type = PyObject_GetAttrString(types_module, "CodeType"))) goto end;
635 if (minor_version <= 7) {
636 (void)p;
637 result = PyObject_CallFunction(code_type, "iiiiiOOOOOOiOO", a, k, l, s, f, code,
638 c, n, v, fn, name, fline, lnos, fv, cell);
639 } else if (minor_version <= 10) {
640 result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOiOO", a,p, k, l, s, f, code,
641 c, n, v, fn, name, fline, lnos, fv, cell);
642 } else {
643 if (!(exception_table = PyBytes_FromStringAndSize(NULL, 0))) goto end;
644 result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOOiOO", a,p, k, l, s, f, code,
645 c, n, v, fn, name, name, fline, lnos, exception_table, fv, cell);
646 }
647 end:
648 Py_XDECREF(code_type);
649 Py_XDECREF(exception_table);
650 Py_XDECREF(types_module);
651 if (type) {
652 PyErr_Restore(type, value, traceback);
653 }
654 return result;
655 }
656 #ifndef CO_OPTIMIZED
657 #define CO_OPTIMIZED 0x0001
658 #endif
659 #ifndef CO_NEWLOCALS
660 #define CO_NEWLOCALS 0x0002
661 #endif
662 #ifndef CO_VARARGS
663 #define CO_VARARGS 0x0004
664 #endif
665 #ifndef CO_VARKEYWORDS
666 #define CO_VARKEYWORDS 0x0008
667 #endif
668 #ifndef CO_ASYNC_GENERATOR
669 #define CO_ASYNC_GENERATOR 0x0200
670 #endif
671 #ifndef CO_GENERATOR
672 #define CO_GENERATOR 0x0020
673 #endif
674 #ifndef CO_COROUTINE
675 #define CO_COROUTINE 0x0080
676 #endif
677#elif PY_VERSION_HEX >= 0x030B0000
678 static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f,
679 PyObject *code, PyObject *c, PyObject* n, PyObject *v,
680 PyObject *fv, PyObject *cell, PyObject* fn,
681 PyObject *name, int fline, PyObject *lnos) {
682 PyCodeObject *result;
683 PyObject *empty_bytes = PyBytes_FromStringAndSize("", 0);
684 if (!empty_bytes) return NULL;
685 result =
686 #if PY_VERSION_HEX >= 0x030C0000
687 PyUnstable_Code_NewWithPosOnlyArgs
688 #else
689 PyCode_NewWithPosOnlyArgs
690 #endif
691 (a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, name, fline, lnos, empty_bytes);
692 Py_DECREF(empty_bytes);
693 return result;
694 }
695#elif PY_VERSION_HEX >= 0x030800B2 && !CYTHON_COMPILING_IN_PYPY
696 #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
697 PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
698#else
699 #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
700 PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
701#endif
702#endif
703#if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE)
704 #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type)
705#else
706 #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type))
707#endif
708#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is)
709 #define __Pyx_Py_Is(x, y) Py_Is(x, y)
710#else
711 #define __Pyx_Py_Is(x, y) ((x) == (y))
712#endif
713#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone)
714 #define __Pyx_Py_IsNone(ob) Py_IsNone(ob)
715#else
716 #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None)
717#endif
718#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue)
719 #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob)
720#else
721 #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True)
722#endif
723#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse)
724 #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob)
725#else
726 #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False)
727#endif
728#define __Pyx_NoneAsNull(obj) (__Pyx_Py_IsNone(obj) ? NULL : (obj))
729#if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY
730 #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o)
731#else
732 #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o)
733#endif
734#ifndef CO_COROUTINE
735 #define CO_COROUTINE 0x80
736#endif
737#ifndef CO_ASYNC_GENERATOR
738 #define CO_ASYNC_GENERATOR 0x200
739#endif
740#ifndef Py_TPFLAGS_CHECKTYPES
741 #define Py_TPFLAGS_CHECKTYPES 0
742#endif
743#ifndef Py_TPFLAGS_HAVE_INDEX
744 #define Py_TPFLAGS_HAVE_INDEX 0
745#endif
746#ifndef Py_TPFLAGS_HAVE_NEWBUFFER
747 #define Py_TPFLAGS_HAVE_NEWBUFFER 0
748#endif
749#ifndef Py_TPFLAGS_HAVE_FINALIZE
750 #define Py_TPFLAGS_HAVE_FINALIZE 0
751#endif
752#ifndef Py_TPFLAGS_SEQUENCE
753 #define Py_TPFLAGS_SEQUENCE 0
754#endif
755#ifndef Py_TPFLAGS_MAPPING
756 #define Py_TPFLAGS_MAPPING 0
757#endif
758#ifndef METH_STACKLESS
759 #define METH_STACKLESS 0
760#endif
761#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
762 #ifndef METH_FASTCALL
763 #define METH_FASTCALL 0x80
764 #endif
765 typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
766 typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
767 Py_ssize_t nargs, PyObject *kwnames);
768#else
769 #if PY_VERSION_HEX >= 0x030d00A4
770 # define __Pyx_PyCFunctionFast PyCFunctionFast
771 # define __Pyx_PyCFunctionFastWithKeywords PyCFunctionFastWithKeywords
772 #else
773 # define __Pyx_PyCFunctionFast _PyCFunctionFast
774 # define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
775 #endif
776#endif
777#if CYTHON_METH_FASTCALL
778 #define __Pyx_METH_FASTCALL METH_FASTCALL
779 #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast
780 #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords
781#else
782 #define __Pyx_METH_FASTCALL METH_VARARGS
783 #define __Pyx_PyCFunction_FastCall PyCFunction
784 #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords
785#endif
786#if CYTHON_VECTORCALL
787 #define __pyx_vectorcallfunc vectorcallfunc
788 #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET
789 #define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n))
790#elif CYTHON_BACKPORT_VECTORCALL
791 typedef PyObject *(*__pyx_vectorcallfunc)(PyObject *callable, PyObject *const *args,
792 size_t nargsf, PyObject *kwnames);
793 #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET ((size_t)1 << (8 * sizeof(size_t) - 1))
794 #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(((size_t)(n)) & ~__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET))
795#else
796 #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0
797 #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n))
798#endif
799#if PY_MAJOR_VERSION >= 0x030900B1
800#define __Pyx_PyCFunction_CheckExact(func) PyCFunction_CheckExact(func)
801#else
802#define __Pyx_PyCFunction_CheckExact(func) PyCFunction_Check(func)
803#endif
804#define __Pyx_CyOrPyCFunction_Check(func) PyCFunction_Check(func)
805#if CYTHON_COMPILING_IN_CPYTHON
806#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) (((PyCFunctionObject*)(func))->m_ml->ml_meth)
807#elif !CYTHON_COMPILING_IN_LIMITED_API
808#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) PyCFunction_GET_FUNCTION(func)
809#endif
810#if CYTHON_COMPILING_IN_CPYTHON
811#define __Pyx_CyOrPyCFunction_GET_FLAGS(func) (((PyCFunctionObject*)(func))->m_ml->ml_flags)
812static CYTHON_INLINE PyObject* __Pyx_CyOrPyCFunction_GET_SELF(PyObject *func) {
813 return (__Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_STATIC) ? NULL : ((PyCFunctionObject*)func)->m_self;
814}
815#endif
816static CYTHON_INLINE int __Pyx__IsSameCFunction(PyObject *func, void *cfunc) {
817#if CYTHON_COMPILING_IN_LIMITED_API
818 return PyCFunction_Check(func) && PyCFunction_GetFunction(func) == (PyCFunction) cfunc;
819#else
820 return PyCFunction_Check(func) && PyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc;
821#endif
822}
823#define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCFunction(func, cfunc)
824#if __PYX_LIMITED_VERSION_HEX < 0x030900B1
825 #define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b))
826 typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *);
827#else
828 #define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b)
829 #define __Pyx_PyCMethod PyCMethod
830#endif
831#ifndef METH_METHOD
832 #define METH_METHOD 0x200
833#endif
834#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
835 #define PyObject_Malloc(s) PyMem_Malloc(s)
836 #define PyObject_Free(p) PyMem_Free(p)
837 #define PyObject_Realloc(p) PyMem_Realloc(p)
838#endif
839#if CYTHON_COMPILING_IN_LIMITED_API
840 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
841 #define __Pyx_PyFrame_SetLineNumber(frame, lineno)
842#else
843 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
844 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
845#endif
846#if CYTHON_COMPILING_IN_LIMITED_API
847 #define __Pyx_PyThreadState_Current PyThreadState_Get()
848#elif !CYTHON_FAST_THREAD_STATE
849 #define __Pyx_PyThreadState_Current PyThreadState_GET()
850#elif PY_VERSION_HEX >= 0x030d00A1
851 #define __Pyx_PyThreadState_Current PyThreadState_GetUnchecked()
852#elif PY_VERSION_HEX >= 0x03060000
853 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
854#elif PY_VERSION_HEX >= 0x03000000
855 #define __Pyx_PyThreadState_Current PyThreadState_GET()
856#else
857 #define __Pyx_PyThreadState_Current _PyThreadState_Current
858#endif
859#if CYTHON_COMPILING_IN_LIMITED_API
860static CYTHON_INLINE void *__Pyx_PyModule_GetState(PyObject *op)
861{
862 void *result;
863 result = PyModule_GetState(op);
864 if (!result)
865 Py_FatalError("Couldn't find the module state");
866 return result;
867}
868#endif
869#define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE(obj), name, func_ctype)
870#if CYTHON_COMPILING_IN_LIMITED_API
871 #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name))
872#else
873 #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name)
874#endif
875#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
876#include "pythread.h"
877#define Py_tss_NEEDS_INIT 0
878typedef int Py_tss_t;
879static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
880 *key = PyThread_create_key();
881 return 0;
882}
883static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
884 Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
885 *key = Py_tss_NEEDS_INIT;
886 return key;
887}
888static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
889 PyObject_Free(key);
890}
891static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
892 return *key != Py_tss_NEEDS_INIT;
893}
894static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
895 PyThread_delete_key(*key);
896 *key = Py_tss_NEEDS_INIT;
897}
898static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
899 return PyThread_set_key_value(*key, value);
900}
901static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
902 return PyThread_get_key_value(*key);
903}
904#endif
905#if PY_MAJOR_VERSION < 3
906 #if CYTHON_COMPILING_IN_PYPY
907 #if PYPY_VERSION_NUM < 0x07030600
908 #if defined(__cplusplus) && __cplusplus >= 201402L
909 [[deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")]]
910 #elif defined(__GNUC__) || defined(__clang__)
911 __attribute__ ((__deprecated__("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")))
912 #elif defined(_MSC_VER)
913 __declspec(deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6"))
914 #endif
915 static CYTHON_INLINE int PyGILState_Check(void) {
916 return 0;
917 }
918 #else // PYPY_VERSION_NUM < 0x07030600
919 #endif // PYPY_VERSION_NUM < 0x07030600
920 #else
921 static CYTHON_INLINE int PyGILState_Check(void) {
922 PyThreadState * tstate = _PyThreadState_Current;
923 return tstate && (tstate == PyGILState_GetThisThreadState());
924 }
925 #endif
926#endif
927#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000 || defined(_PyDict_NewPresized)
928#define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
929#else
930#define __Pyx_PyDict_NewPresized(n) PyDict_New()
931#endif
932#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
933 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
934 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
935#else
936 #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
937 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
938#endif
939#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030600B4 && PY_VERSION_HEX < 0x030d0000 && CYTHON_USE_UNICODE_INTERNALS
940#define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
941static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) {
942 PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name);
943 if (res == NULL) PyErr_Clear();
944 return res;
945}
946#elif PY_MAJOR_VERSION >= 3 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000)
947#define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError
948#define __Pyx_PyDict_GetItemStr PyDict_GetItem
949#else
950static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) {
951#if CYTHON_COMPILING_IN_PYPY
952 return PyDict_GetItem(dict, name);
953#else
954 PyDictEntry *ep;
955 PyDictObject *mp = (PyDictObject*) dict;
956 long hash = ((PyStringObject *) name)->ob_shash;
957 assert(hash != -1);
958 ep = (mp->ma_lookup)(mp, name, hash);
959 if (ep == NULL) {
960 return NULL;
961 }
962 return ep->me_value;
963#endif
964}
965#define __Pyx_PyDict_GetItemStr PyDict_GetItem
966#endif
967#if CYTHON_USE_TYPE_SLOTS
968 #define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags)
969 #define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0)
970 #define __Pyx_PyObject_GetIterNextFunc(obj) (Py_TYPE(obj)->tp_iternext)
971#else
972 #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp))
973 #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature)
974 #define __Pyx_PyObject_GetIterNextFunc(obj) PyIter_Next
975#endif
976#if CYTHON_COMPILING_IN_LIMITED_API
977 #define __Pyx_SetItemOnTypeDict(tp, k, v) PyObject_GenericSetAttr((PyObject*)tp, k, v)
978#else
979 #define __Pyx_SetItemOnTypeDict(tp, k, v) PyDict_SetItem(tp->tp_dict, k, v)
980#endif
981#if CYTHON_USE_TYPE_SPECS && PY_VERSION_HEX >= 0x03080000
982#define __Pyx_PyHeapTypeObject_GC_Del(obj) {\
983 PyTypeObject *type = Py_TYPE((PyObject*)obj);\
984 assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\
985 PyObject_GC_Del(obj);\
986 Py_DECREF(type);\
987}
988#else
989#define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj)
990#endif
991#if CYTHON_COMPILING_IN_LIMITED_API
992 #define CYTHON_PEP393_ENABLED 1
993 #define __Pyx_PyUnicode_READY(op) (0)
994 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GetLength(u)
995 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i)
996 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111U)
997 #define __Pyx_PyUnicode_KIND(u) ((void)u, (0))
998 #define __Pyx_PyUnicode_DATA(u) ((void*)u)
999 #define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i))
1000 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u))
1001#elif PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
1002 #define CYTHON_PEP393_ENABLED 1
1003 #if PY_VERSION_HEX >= 0x030C0000
1004 #define __Pyx_PyUnicode_READY(op) (0)
1005 #else
1006 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
1007 0 : _PyUnicode_Ready((PyObject *)(op)))
1008 #endif
1009 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
1010 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
1011 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
1012 #define __Pyx_PyUnicode_KIND(u) ((int)PyUnicode_KIND(u))
1013 #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
1014 #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
1015 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, (Py_UCS4) ch)
1016 #if PY_VERSION_HEX >= 0x030C0000
1017 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u))
1018 #else
1019 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
1020 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
1021 #else
1022 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
1023 #endif
1024 #endif
1025#else
1026 #define CYTHON_PEP393_ENABLED 0
1027 #define PyUnicode_1BYTE_KIND 1
1028 #define PyUnicode_2BYTE_KIND 2
1029 #define PyUnicode_4BYTE_KIND 4
1030 #define __Pyx_PyUnicode_READY(op) (0)
1031 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
1032 #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
1033 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535U : 1114111U)
1034 #define __Pyx_PyUnicode_KIND(u) ((int)sizeof(Py_UNICODE))
1035 #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
1036 #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
1037 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = (Py_UNICODE) ch)
1038 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
1039#endif
1040#if CYTHON_COMPILING_IN_PYPY
1041 #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
1042 #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
1043#else
1044 #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
1045 #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
1046 PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
1047#endif
1048#if CYTHON_COMPILING_IN_PYPY
1049 #if !defined(PyUnicode_DecodeUnicodeEscape)
1050 #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors)
1051 #endif
1052 #if !defined(PyUnicode_Contains) || (PY_MAJOR_VERSION == 2 && PYPY_VERSION_NUM < 0x07030500)
1053 #undef PyUnicode_Contains
1054 #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
1055 #endif
1056 #if !defined(PyByteArray_Check)
1057 #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
1058 #endif
1059 #if !defined(PyObject_Format)
1060 #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
1061 #endif
1062#endif
1063#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))
1064#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
1065#if PY_MAJOR_VERSION >= 3
1066 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
1067#else
1068 #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
1069#endif
1070#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
1071 #define PyObject_ASCII(o) PyObject_Repr(o)
1072#endif
1073#if PY_MAJOR_VERSION >= 3
1074 #define PyBaseString_Type PyUnicode_Type
1075 #define PyStringObject PyUnicodeObject
1076 #define PyString_Type PyUnicode_Type
1077 #define PyString_Check PyUnicode_Check
1078 #define PyString_CheckExact PyUnicode_CheckExact
1079#ifndef PyObject_Unicode
1080 #define PyObject_Unicode PyObject_Str
1081#endif
1082#endif
1083#if PY_MAJOR_VERSION >= 3
1084 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
1085 #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
1086#else
1087 #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
1088 #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
1089#endif
1090#if CYTHON_COMPILING_IN_CPYTHON
1091 #define __Pyx_PySequence_ListKeepNew(obj)\
1092 (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj))
1093#else
1094 #define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj)
1095#endif
1096#ifndef PySet_CheckExact
1097 #define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type)
1098#endif
1099#if PY_VERSION_HEX >= 0x030900A4
1100 #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
1101 #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
1102#else
1103 #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
1104 #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
1105#endif
1106#if CYTHON_ASSUME_SAFE_MACROS
1107 #define __Pyx_PySequence_ITEM(o, i) PySequence_ITEM(o, i)
1108 #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
1109 #define __Pyx_PyTuple_SET_ITEM(o, i, v) (PyTuple_SET_ITEM(o, i, v), (0))
1110 #define __Pyx_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0))
1111 #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_GET_SIZE(o)
1112 #define __Pyx_PyList_GET_SIZE(o) PyList_GET_SIZE(o)
1113 #define __Pyx_PySet_GET_SIZE(o) PySet_GET_SIZE(o)
1114 #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_GET_SIZE(o)
1115 #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_GET_SIZE(o)
1116#else
1117 #define __Pyx_PySequence_ITEM(o, i) PySequence_GetItem(o, i)
1118 #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
1119 #define __Pyx_PyTuple_SET_ITEM(o, i, v) PyTuple_SetItem(o, i, v)
1120 #define __Pyx_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v)
1121 #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_Size(o)
1122 #define __Pyx_PyList_GET_SIZE(o) PyList_Size(o)
1123 #define __Pyx_PySet_GET_SIZE(o) PySet_Size(o)
1124 #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_Size(o)
1125 #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_Size(o)
1126#endif
1127#if __PYX_LIMITED_VERSION_HEX >= 0x030d00A1
1128 #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name)
1129#else
1130 static CYTHON_INLINE PyObject *__Pyx_PyImport_AddModuleRef(const char *name) {
1131 PyObject *module = PyImport_AddModule(name);
1132 Py_XINCREF(module);
1133 return module;
1134 }
1135#endif
1136#if PY_MAJOR_VERSION >= 3
1137 #define PyIntObject PyLongObject
1138 #define PyInt_Type PyLong_Type
1139 #define PyInt_Check(op) PyLong_Check(op)
1140 #define PyInt_CheckExact(op) PyLong_CheckExact(op)
1141 #define __Pyx_Py3Int_Check(op) PyLong_Check(op)
1142 #define __Pyx_Py3Int_CheckExact(op) PyLong_CheckExact(op)
1143 #define PyInt_FromString PyLong_FromString
1144 #define PyInt_FromUnicode PyLong_FromUnicode
1145 #define PyInt_FromLong PyLong_FromLong
1146 #define PyInt_FromSize_t PyLong_FromSize_t
1147 #define PyInt_FromSsize_t PyLong_FromSsize_t
1148 #define PyInt_AsLong PyLong_AsLong
1149 #define PyInt_AS_LONG PyLong_AS_LONG
1150 #define PyInt_AsSsize_t PyLong_AsSsize_t
1151 #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
1152 #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
1153 #define PyNumber_Int PyNumber_Long
1154#else
1155 #define __Pyx_Py3Int_Check(op) (PyLong_Check(op) || PyInt_Check(op))
1156 #define __Pyx_Py3Int_CheckExact(op) (PyLong_CheckExact(op) || PyInt_CheckExact(op))
1157#endif
1158#if PY_MAJOR_VERSION >= 3
1159 #define PyBoolObject PyLongObject
1160#endif
1161#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
1162 #ifndef PyUnicode_InternFromString
1163 #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
1164 #endif
1165#endif
1166#if PY_VERSION_HEX < 0x030200A4
1167 typedef long Py_hash_t;
1168 #define __Pyx_PyInt_FromHash_t PyInt_FromLong
1169 #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t
1170#else
1171 #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
1172 #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t
1173#endif
1174#if CYTHON_USE_ASYNC_SLOTS
1175 #if PY_VERSION_HEX >= 0x030500B1
1176 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
1177 #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
1178 #else
1179 #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
1180 #endif
1181#else
1182 #define __Pyx_PyType_AsAsync(obj) NULL
1183#endif
1184#ifndef __Pyx_PyAsyncMethodsStruct
1185 typedef struct {
1186 unaryfunc am_await;
1187 unaryfunc am_aiter;
1188 unaryfunc am_anext;
1189 } __Pyx_PyAsyncMethodsStruct;
1190#endif
1191
1192#if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)
1193 #if !defined(_USE_MATH_DEFINES)
1194 #define _USE_MATH_DEFINES
1195 #endif
1196#endif
1197#include <math.h>
1198#ifdef NAN
1199#define __PYX_NAN() ((float) NAN)
1200#else
1201static CYTHON_INLINE float __PYX_NAN() {
1202 float value;
1203 memset(&value, 0xFF, sizeof(value));
1204 return value;
1205}
1206#endif
1207#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
1208#define __Pyx_truncl trunc
1209#else
1210#define __Pyx_truncl truncl
1211#endif
1212
1213#define __PYX_MARK_ERR_POS(f_index, lineno) \
1214 { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
1215#define __PYX_ERR(f_index, lineno, Ln_error) \
1216 { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
1217
1218#ifdef CYTHON_EXTERN_C
1219 #undef __PYX_EXTERN_C
1220 #define __PYX_EXTERN_C CYTHON_EXTERN_C
1221#elif defined(__PYX_EXTERN_C)
1222 #ifdef _MSC_VER
1223 #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.")
1224 #else
1225 #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.
1226 #endif
1227#else
1228 #define __PYX_EXTERN_C extern "C++"
1229#endif
1230
1231#define __PYX_HAVE__pymodule
1232#define __PYX_HAVE_API__pymodule
1233/* Early includes */
1234#include <string.h>
1235#include <string>
1236#include "ios"
1237#include "new"
1238#include "stdexcept"
1239#include "typeinfo"
1240#include <typeinfo>
1241#include "cyclus.h"
1242#include "agent.h"
1243#include "region.h"
1244#include "institution.h"
1245#include "facility.h"
1246#include "toolkit/timeseries.h"
1247#include <stdio.h>
1248#ifdef _OPENMP
1249#include <omp.h>
1250#endif /* _OPENMP */
1251
1252#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
1253#define CYTHON_WITHOUT_ASSERTIONS
1254#endif
1255
1256typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
1257 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
1258
1259#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
1260#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
1261#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
1262#define __PYX_DEFAULT_STRING_ENCODING ""
1263#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
1264#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
1265#define __Pyx_uchar_cast(c) ((unsigned char)c)
1266#define __Pyx_long_cast(x) ((long)x)
1267#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
1268 (sizeof(type) < sizeof(Py_ssize_t)) ||\
1269 (sizeof(type) > sizeof(Py_ssize_t) &&\
1270 likely(v < (type)PY_SSIZE_T_MAX ||\
1271 v == (type)PY_SSIZE_T_MAX) &&\
1272 (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
1273 v == (type)PY_SSIZE_T_MIN))) ||\
1274 (sizeof(type) == sizeof(Py_ssize_t) &&\
1275 (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
1276 v == (type)PY_SSIZE_T_MAX))) )
1277static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
1278 return (size_t) i < (size_t) limit;
1279}
1280#if defined (__cplusplus) && __cplusplus >= 201103L
1281 #include <cstdlib>
1282 #define __Pyx_sst_abs(value) std::abs(value)
1283#elif SIZEOF_INT >= SIZEOF_SIZE_T
1284 #define __Pyx_sst_abs(value) abs(value)
1285#elif SIZEOF_LONG >= SIZEOF_SIZE_T
1286 #define __Pyx_sst_abs(value) labs(value)
1287#elif defined (_MSC_VER)
1288 #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
1289#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
1290 #define __Pyx_sst_abs(value) llabs(value)
1291#elif defined (__GNUC__)
1292 #define __Pyx_sst_abs(value) __builtin_llabs(value)
1293#else
1294 #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
1295#endif
1296static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s);
1297static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
1298static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
1299static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char*);
1300#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
1301#define __Pyx_PyBytes_FromString PyBytes_FromString
1302#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
1303static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
1304#if PY_MAJOR_VERSION < 3
1305 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
1306 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
1307#else
1308 #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
1309 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
1310#endif
1311#define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
1312#define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
1313#define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
1314#define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
1315#define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
1316#define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
1317#define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
1318#define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
1319#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
1320#define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
1321#define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
1322#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
1323#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
1324#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
1325#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
1326#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
1327#define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o)
1328#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
1329#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
1330#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
1331static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
1332static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
1333static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
1334static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
1335#define __Pyx_PySequence_Tuple(obj)\
1336 (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
1337static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
1338static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
1339static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*);
1340#if CYTHON_ASSUME_SAFE_MACROS
1341#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
1342#else
1343#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
1344#endif
1345#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
1346#if PY_MAJOR_VERSION >= 3
1347#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
1348#else
1349#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
1350#endif
1351#if CYTHON_USE_PYLONG_INTERNALS
1352 #if PY_VERSION_HEX >= 0x030C00A7
1353 #ifndef _PyLong_SIGN_MASK
1354 #define _PyLong_SIGN_MASK 3
1355 #endif
1356 #ifndef _PyLong_NON_SIZE_BITS
1357 #define _PyLong_NON_SIZE_BITS 3
1358 #endif
1359 #define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK)
1360 #define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0)
1361 #define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x))
1362 #define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1)
1363 #define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0)
1364 #define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0])
1365 #define __Pyx_PyLong_DigitCount(x) ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS))
1366 #define __Pyx_PyLong_SignedDigitCount(x)\
1367 ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x))
1368 #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue)
1369 #define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x)
1370 #define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x)
1371 #else
1372 #define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS))
1373 #define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0])
1374 #endif
1375 typedef Py_ssize_t __Pyx_compact_pylong;
1376 typedef size_t __Pyx_compact_upylong;
1377 #else
1378 #define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0)
1379 #define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0)
1380 #define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0)
1381 #define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0)
1382 #define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0])
1383 #define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x))
1384 #define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x)
1385 #define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1)
1386 #define __Pyx_PyLong_CompactValue(x)\
1387 ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0]))
1388 typedef sdigit __Pyx_compact_pylong;
1389 typedef digit __Pyx_compact_upylong;
1390 #endif
1391 #if PY_VERSION_HEX >= 0x030C00A5
1392 #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit)
1393 #else
1394 #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit)
1395 #endif
1396#endif
1397#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
1398#include <string.h>
1399static int __Pyx_sys_getdefaultencoding_not_ascii;
1400static int __Pyx_init_sys_getdefaultencoding_params(void) {
1401 PyObject* sys;
1402 PyObject* default_encoding = NULL;
1403 PyObject* ascii_chars_u = NULL;
1404 PyObject* ascii_chars_b = NULL;
1405 const char* default_encoding_c;
1406 sys = PyImport_ImportModule("sys");
1407 if (!sys) goto bad;
1408 default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
1409 Py_DECREF(sys);
1410 if (!default_encoding) goto bad;
1411 default_encoding_c = PyBytes_AsString(default_encoding);
1412 if (!default_encoding_c) goto bad;
1413 if (strcmp(default_encoding_c, "ascii") == 0) {
1414 __Pyx_sys_getdefaultencoding_not_ascii = 0;
1415 } else {
1416 char ascii_chars[128];
1417 int c;
1418 for (c = 0; c < 128; c++) {
1419 ascii_chars[c] = (char) c;
1420 }
1421 __Pyx_sys_getdefaultencoding_not_ascii = 1;
1422 ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
1423 if (!ascii_chars_u) goto bad;
1424 ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
1425 if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
1426 PyErr_Format(
1427 PyExc_ValueError,
1428 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
1429 default_encoding_c);
1430 goto bad;
1431 }
1432 Py_DECREF(ascii_chars_u);
1433 Py_DECREF(ascii_chars_b);
1434 }
1435 Py_DECREF(default_encoding);
1436 return 0;
1437bad:
1438 Py_XDECREF(default_encoding);
1439 Py_XDECREF(ascii_chars_u);
1440 Py_XDECREF(ascii_chars_b);
1441 return -1;
1442}
1443#endif
1444#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
1445#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
1446#else
1447#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
1448#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
1449#include <string.h>
1450static char* __PYX_DEFAULT_STRING_ENCODING;
1451static int __Pyx_init_sys_getdefaultencoding_params(void) {
1452 PyObject* sys;
1453 PyObject* default_encoding = NULL;
1454 char* default_encoding_c;
1455 sys = PyImport_ImportModule("sys");
1456 if (!sys) goto bad;
1457 default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
1458 Py_DECREF(sys);
1459 if (!default_encoding) goto bad;
1460 default_encoding_c = PyBytes_AsString(default_encoding);
1461 if (!default_encoding_c) goto bad;
1462 __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
1463 if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
1464 strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
1465 Py_DECREF(default_encoding);
1466 return 0;
1467bad:
1468 Py_XDECREF(default_encoding);
1469 return -1;
1470}
1471#endif
1472#endif
1473
1474
1475/* Test for GCC > 2.95 */
1476#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
1477 #define likely(x) __builtin_expect(!!(x), 1)
1478 #define unlikely(x) __builtin_expect(!!(x), 0)
1479#else /* !__GNUC__ or GCC < 2.95 */
1480 #define likely(x) (x)
1481 #define unlikely(x) (x)
1482#endif /* __GNUC__ */
1483static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
1484
1485#if !CYTHON_USE_MODULE_STATE
1486static PyObject *__pyx_m = NULL;
1487#endif
1488static int __pyx_lineno;
1489static int __pyx_clineno = 0;
1490static const char * __pyx_cfilenm = __FILE__;
1491static const char *__pyx_filename;
1492
1493/* #### Code section: filename_table ### */
1494
1495static const char *__pyx_f[] = {
1496 "pymodule.pyx",
1497 "<stringsource>",
1498 "type.pxd",
1499};
1500/* #### Code section: utility_code_proto_before_types ### */
1501/* ForceInitThreads.proto */
1502#ifndef __PYX_FORCE_INIT_THREADS
1503 #define __PYX_FORCE_INIT_THREADS 0
1504#endif
1505
1506/* #### Code section: numeric_typedefs ### */
1507/* #### Code section: complex_type_declarations ### */
1508/* #### Code section: type_declarations ### */
1509
1510/*--- Type declarations ---*/
1511
1512/* "pymodule.pxd":19
1513 * cdef cppclass Agent
1514 *
1515 * ctypedef Agent* agent_ptr # <<<<<<<<<<<<<<
1516 *
1517 * cdef extern from "region.h" namespace "cyclus":
1518 */
1519typedef cyclus::Agent *__pyx_t_8pymodule_agent_ptr;
1520
1521/* "pymodule.pxd":25
1522 * cdef cppclass Region
1523 *
1524 * ctypedef Region* region_ptr # <<<<<<<<<<<<<<
1525 *
1526 * cdef extern from "institution.h" namespace "cyclus":
1527 */
1528typedef cyclus::Region *__pyx_t_8pymodule_region_ptr;
1529
1530/* "pymodule.pxd":31
1531 * cdef cppclass Institution
1532 *
1533 * ctypedef Institution* institution_ptr # <<<<<<<<<<<<<<
1534 *
1535 * cdef extern from "facility.h" namespace "cyclus":
1536 */
1537typedef cyclus::Institution *__pyx_t_8pymodule_institution_ptr;
1538
1539/* "pymodule.pxd":37
1540 * cdef cppclass Facility
1541 *
1542 * ctypedef Facility* facility_ptr # <<<<<<<<<<<<<<
1543 *
1544 * cdef extern from "toolkit/timeseries.h" namespace "cyclus::toolkit":
1545 */
1546typedef cyclus::Facility *__pyx_t_8pymodule_facility_ptr;
1547/* #### Code section: utility_code_proto ### */
1548
1549/* --- Runtime support code (head) --- */
1550/* Refnanny.proto */
1551#ifndef CYTHON_REFNANNY
1552 #define CYTHON_REFNANNY 0
1553#endif
1554#if CYTHON_REFNANNY
1555 typedef struct {
1556 void (*INCREF)(void*, PyObject*, Py_ssize_t);
1557 void (*DECREF)(void*, PyObject*, Py_ssize_t);
1558 void (*GOTREF)(void*, PyObject*, Py_ssize_t);
1559 void (*GIVEREF)(void*, PyObject*, Py_ssize_t);
1560 void* (*SetupContext)(const char*, Py_ssize_t, const char*);
1561 void (*FinishContext)(void**);
1562 } __Pyx_RefNannyAPIStruct;
1563 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1564 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
1565 #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1566#ifdef WITH_THREAD
1567 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1568 if (acquire_gil) {\
1569 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1570 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\
1571 PyGILState_Release(__pyx_gilstate_save);\
1572 } else {\
1573 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\
1574 }
1575 #define __Pyx_RefNannyFinishContextNogil() {\
1576 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1577 __Pyx_RefNannyFinishContext();\
1578 PyGILState_Release(__pyx_gilstate_save);\
1579 }
1580#else
1581 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1582 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__))
1583 #define __Pyx_RefNannyFinishContextNogil() __Pyx_RefNannyFinishContext()
1584#endif
1585 #define __Pyx_RefNannyFinishContextNogil() {\
1586 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1587 __Pyx_RefNannyFinishContext();\
1588 PyGILState_Release(__pyx_gilstate_save);\
1589 }
1590 #define __Pyx_RefNannyFinishContext()\
1591 __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1592 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
1593 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
1594 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
1595 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
1596 #define __Pyx_XINCREF(r) do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0)
1597 #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0)
1598 #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0)
1599 #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0)
1600#else
1601 #define __Pyx_RefNannyDeclarations
1602 #define __Pyx_RefNannySetupContext(name, acquire_gil)
1603 #define __Pyx_RefNannyFinishContextNogil()
1604 #define __Pyx_RefNannyFinishContext()
1605 #define __Pyx_INCREF(r) Py_INCREF(r)
1606 #define __Pyx_DECREF(r) Py_DECREF(r)
1607 #define __Pyx_GOTREF(r)
1608 #define __Pyx_GIVEREF(r)
1609 #define __Pyx_XINCREF(r) Py_XINCREF(r)
1610 #define __Pyx_XDECREF(r) Py_XDECREF(r)
1611 #define __Pyx_XGOTREF(r)
1612 #define __Pyx_XGIVEREF(r)
1613#endif
1614#define __Pyx_Py_XDECREF_SET(r, v) do {\
1615 PyObject *tmp = (PyObject *) r;\
1616 r = v; Py_XDECREF(tmp);\
1617 } while (0)
1618#define __Pyx_XDECREF_SET(r, v) do {\
1619 PyObject *tmp = (PyObject *) r;\
1620 r = v; __Pyx_XDECREF(tmp);\
1621 } while (0)
1622#define __Pyx_DECREF_SET(r, v) do {\
1623 PyObject *tmp = (PyObject *) r;\
1624 r = v; __Pyx_DECREF(tmp);\
1625 } while (0)
1626#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1627#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1628
1629/* PyErrExceptionMatches.proto */
1630#if CYTHON_FAST_THREAD_STATE
1631#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1632static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1633#else
1634#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
1635#endif
1636
1637/* PyThreadStateGet.proto */
1638#if CYTHON_FAST_THREAD_STATE
1639#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
1640#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
1641#if PY_VERSION_HEX >= 0x030C00A6
1642#define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL)
1643#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL)
1644#else
1645#define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL)
1646#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type)
1647#endif
1648#else
1649#define __Pyx_PyThreadState_declare
1650#define __Pyx_PyThreadState_assign
1651#define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL)
1652#define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred()
1653#endif
1654
1655/* PyErrFetchRestore.proto */
1656#if CYTHON_FAST_THREAD_STATE
1657#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1658#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1659#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1660#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1661#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1662static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1663static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1664#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6
1665#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1666#else
1667#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1668#endif
1669#else
1670#define __Pyx_PyErr_Clear() PyErr_Clear()
1671#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1672#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1673#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1674#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
1675#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
1676#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1677#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1678#endif
1679
1680/* PyObjectGetAttrStr.proto */
1681#if CYTHON_USE_TYPE_SLOTS
1682static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1683#else
1684#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1685#endif
1686
1687/* PyObjectGetAttrStrNoError.proto */
1688static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
1689
1690/* GetBuiltinName.proto */
1691static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1692
1693/* PyFunctionFastCall.proto */
1694#if CYTHON_FAST_PYCALL
1695#if !CYTHON_VECTORCALL
1696#define __Pyx_PyFunction_FastCall(func, args, nargs)\
1697 __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1698static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1699#endif
1700#define __Pyx_BUILD_ASSERT_EXPR(cond)\
1701 (sizeof(char [1 - 2*!(cond)]) - 1)
1702#ifndef Py_MEMBER_SIZE
1703#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1704#endif
1705#if !CYTHON_VECTORCALL
1706#if PY_VERSION_HEX >= 0x03080000
1707 #include "frameobject.h"
1708#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API
1709 #ifndef Py_BUILD_CORE
1710 #define Py_BUILD_CORE 1
1711 #endif
1712 #include "internal/pycore_frame.h"
1713#endif
1714 #define __Pxy_PyFrame_Initialize_Offsets()
1715 #define __Pyx_PyFrame_GetLocalsplus(frame) ((frame)->f_localsplus)
1716#else
1717 static size_t __pyx_pyframe_localsplus_offset = 0;
1718 #include "frameobject.h"
1719 #define __Pxy_PyFrame_Initialize_Offsets()\
1720 ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1721 (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1722 #define __Pyx_PyFrame_GetLocalsplus(frame)\
1723 (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1724#endif
1725#endif
1726#endif
1727
1728/* PyObjectCall.proto */
1729#if CYTHON_COMPILING_IN_CPYTHON
1730static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1731#else
1732#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1733#endif
1734
1735/* PyObjectCallMethO.proto */
1736#if CYTHON_COMPILING_IN_CPYTHON
1737static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1738#endif
1739
1740/* PyObjectFastCall.proto */
1741#define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL)
1742static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs);
1743
1744/* MoveIfSupported.proto */
1745#if CYTHON_USE_CPP_STD_MOVE
1746 #include <utility>
1747 #define __PYX_STD_MOVE_IF_SUPPORTED(x) std::move(x)
1748#else
1749 #define __PYX_STD_MOVE_IF_SUPPORTED(x) x
1750#endif
1751
1752/* PyDictVersioning.proto */
1753#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1754#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
1755#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
1756#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1757 (version_var) = __PYX_GET_DICT_VERSION(dict);\
1758 (cache_var) = (value);
1759#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1760 static PY_UINT64_T __pyx_dict_version = 0;\
1761 static PyObject *__pyx_dict_cached_value = NULL;\
1762 if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1763 (VAR) = __pyx_dict_cached_value;\
1764 } else {\
1765 (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1766 __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1767 }\
1768}
1769static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1770static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1771static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1772#else
1773#define __PYX_GET_DICT_VERSION(dict) (0)
1774#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1775#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
1776#endif
1777
1778/* GetModuleGlobalName.proto */
1779#if CYTHON_USE_DICT_VERSIONS
1780#define __Pyx_GetModuleGlobalName(var, name) do {\
1781 static PY_UINT64_T __pyx_dict_version = 0;\
1782 static PyObject *__pyx_dict_cached_value = NULL;\
1783 (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1784 (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1785 __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1786} while(0)
1787#define __Pyx_GetModuleGlobalNameUncached(var, name) do {\
1788 PY_UINT64_T __pyx_dict_version;\
1789 PyObject *__pyx_dict_cached_value;\
1790 (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1791} while(0)
1792static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1793#else
1794#define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1795#define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1796static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1797#endif
1798
1799/* GetTopmostException.proto */
1800#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE
1801static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1802#endif
1803
1804/* SaveResetException.proto */
1805#if CYTHON_FAST_THREAD_STATE
1806#define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1807static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1808#define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1809static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1810#else
1811#define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
1812#define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
1813#endif
1814
1815/* GetException.proto */
1816#if CYTHON_FAST_THREAD_STATE
1817#define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
1818static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1819#else
1820static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1821#endif
1822
1823/* RaiseTooManyValuesToUnpack.proto */
1824static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1825
1826/* RaiseNeedMoreValuesToUnpack.proto */
1827static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1828
1829/* IterFinish.proto */
1830static CYTHON_INLINE int __Pyx_IterFinish(void);
1831
1832/* UnpackItemEndCheck.proto */
1833static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
1834
1835/* IncludeStringH.proto */
1836#include <string.h>
1837
1838/* BytesEquals.proto */
1839static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
1840
1841/* UnicodeEquals.proto */
1842static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
1843
1844/* TypeImport.proto */
1845#ifndef __PYX_HAVE_RT_ImportType_proto_3_0_11
1846#define __PYX_HAVE_RT_ImportType_proto_3_0_11
1847#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
1848#include <stdalign.h>
1849#endif
1850#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L
1851#define __PYX_GET_STRUCT_ALIGNMENT_3_0_11(s) alignof(s)
1852#else
1853#define __PYX_GET_STRUCT_ALIGNMENT_3_0_11(s) sizeof(void*)
1854#endif
1855enum __Pyx_ImportType_CheckSize_3_0_11 {
1856 __Pyx_ImportType_CheckSize_Error_3_0_11 = 0,
1857 __Pyx_ImportType_CheckSize_Warn_3_0_11 = 1,
1858 __Pyx_ImportType_CheckSize_Ignore_3_0_11 = 2
1859};
1860static PyTypeObject *__Pyx_ImportType_3_0_11(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_11 check_size);
1861#endif
1862
1863/* Import.proto */
1864static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1865
1866/* ImportFrom.proto */
1867static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
1868
1869/* ImportDottedModule.proto */
1870static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple);
1871#if PY_MAJOR_VERSION >= 3
1872static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple);
1873#endif
1874
1875/* CLineInTraceback.proto */
1876#ifdef CYTHON_CLINE_IN_TRACEBACK
1877#define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1878#else
1879static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1880#endif
1881
1882/* CodeObjectCache.proto */
1883#if !CYTHON_COMPILING_IN_LIMITED_API
1884typedef struct {
1885 PyCodeObject* code_object;
1886 int code_line;
1887} __Pyx_CodeObjectCacheEntry;
1888struct __Pyx_CodeObjectCache {
1889 int count;
1890 int max_count;
1891 __Pyx_CodeObjectCacheEntry* entries;
1892};
1893static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1894static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1895static PyCodeObject *__pyx_find_code_object(int code_line);
1896static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1897#endif
1898
1899/* AddTraceback.proto */
1900static void __Pyx_AddTraceback(const char *funcname, int c_line,
1901 int py_line, const char *filename);
1902
1903/* CppExceptionConversion.proto */
1904#ifndef __Pyx_CppExn2PyErr
1905#include <new>
1906#include <typeinfo>
1907#include <stdexcept>
1908#include <ios>
1909static void __Pyx_CppExn2PyErr() {
1910 try {
1911 if (PyErr_Occurred())
1912 ; // let the latest Python exn pass through and ignore the current one
1913 else
1914 throw;
1915 } catch (const std::bad_alloc& exn) {
1916 PyErr_SetString(PyExc_MemoryError, exn.what());
1917 } catch (const std::bad_cast& exn) {
1918 PyErr_SetString(PyExc_TypeError, exn.what());
1919 } catch (const std::bad_typeid& exn) {
1920 PyErr_SetString(PyExc_TypeError, exn.what());
1921 } catch (const std::domain_error& exn) {
1922 PyErr_SetString(PyExc_ValueError, exn.what());
1923 } catch (const std::invalid_argument& exn) {
1924 PyErr_SetString(PyExc_ValueError, exn.what());
1925 } catch (const std::ios_base::failure& exn) {
1926 PyErr_SetString(PyExc_IOError, exn.what());
1927 } catch (const std::out_of_range& exn) {
1928 PyErr_SetString(PyExc_IndexError, exn.what());
1929 } catch (const std::overflow_error& exn) {
1930 PyErr_SetString(PyExc_OverflowError, exn.what());
1931 } catch (const std::range_error& exn) {
1932 PyErr_SetString(PyExc_ArithmeticError, exn.what());
1933 } catch (const std::underflow_error& exn) {
1934 PyErr_SetString(PyExc_ArithmeticError, exn.what());
1935 } catch (const std::exception& exn) {
1936 PyErr_SetString(PyExc_RuntimeError, exn.what());
1937 }
1938 catch (...)
1939 {
1940 PyErr_SetString(PyExc_RuntimeError, "Unknown exception");
1941 }
1942}
1943#endif
1944
1945/* GCCDiagnostics.proto */
1946#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
1947#define __Pyx_HAS_GCC_DIAGNOSTIC
1948#endif
1949
1950/* CIntToPy.proto */
1951static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
1952
1953/* FormatTypeName.proto */
1954#if CYTHON_COMPILING_IN_LIMITED_API
1955typedef PyObject *__Pyx_TypeName;
1956#define __Pyx_FMT_TYPENAME "%U"
1957static __Pyx_TypeName __Pyx_PyType_GetName(PyTypeObject* tp);
1958#define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj)
1959#else
1960typedef const char *__Pyx_TypeName;
1961#define __Pyx_FMT_TYPENAME "%.200s"
1962#define __Pyx_PyType_GetName(tp) ((tp)->tp_name)
1963#define __Pyx_DECREF_TypeName(obj)
1964#endif
1965
1966/* CIntToPy.proto */
1967static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1968
1969/* CIntFromPy.proto */
1970static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
1971
1972/* CIntFromPy.proto */
1973static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
1974
1975/* FastTypeChecks.proto */
1976#if CYTHON_COMPILING_IN_CPYTHON
1977#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1978#define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2)
1979static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1980static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b);
1981static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1982static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1983#else
1984#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1985#define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2))
1986#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1987#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1988#endif
1989#define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2)
1990#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1991
1992/* CheckBinaryVersion.proto */
1993static unsigned long __Pyx_get_runtime_version(void);
1994static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer);
1995
1996/* FunctionExport.proto */
1997static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig);
1998
1999/* InitStrings.proto */
2000static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
2001
2002/* #### Code section: module_declarations ### */
2003
2004/* Module declarations from "libc.string" */
2005
2006/* Module declarations from "libcpp.string" */
2007
2008/* Module declarations from "libcpp" */
2009
2010/* Module declarations from "libcpp.typeinfo" */
2011
2012/* Module declarations from "cpython.pycapsule" */
2013
2014/* Module declarations from "libcpp.cast" */
2015
2016/* Module declarations from "libc.stdio" */
2017
2018/* Module declarations from "__builtin__" */
2019
2020/* Module declarations from "cpython.type" */
2021
2022/* Module declarations from "cpython" */
2023
2024/* Module declarations from "cpython.object" */
2025
2026/* Module declarations from "cpython.exc" */
2027
2028/* Module declarations from "pymodule" */
2029static std::string __pyx_f_8pymodule_str_py_to_cpp(PyObject *); /*proto*/
2030static PyObject *__pyx_f_8pymodule_std_string_to_py(std::string); /*proto*/
2031__PYX_EXTERN_C std::string CyclusPyFindModule(std::string); /*proto*/
2032__PYX_EXTERN_C cyclus::Agent *CyclusMakePyAgent(std::string, std::string, void *); /*proto*/
2034__PYX_EXTERN_C void CyclusClearPyAgentRefs(void); /*proto*/
2035__PYX_EXTERN_C void CyclusPyDelAgent(int); /*proto*/
2036__PYX_EXTERN_C void CyclusPyCallListeners(std::string, cyclus::Agent *, void *, int, boost::spirit::hold_any); /*proto*/
2037static CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_6libcpp_6string_std__in_string(std::string const &); /*proto*/
2038static CYTHON_INLINE PyObject *__pyx_convert_PyUnicode_string_to_py_6libcpp_6string_std__in_string(std::string const &); /*proto*/
2039static CYTHON_INLINE PyObject *__pyx_convert_PyStr_string_to_py_6libcpp_6string_std__in_string(std::string const &); /*proto*/
2040static CYTHON_INLINE PyObject *__pyx_convert_PyBytes_string_to_py_6libcpp_6string_std__in_string(std::string const &); /*proto*/
2041static CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_6libcpp_6string_std__in_string(std::string const &); /*proto*/
2042/* #### Code section: typeinfo ### */
2043/* #### Code section: before_global_var ### */
2044#define __Pyx_MODULE_NAME "pymodule"
2045extern int __pyx_module_is_main_pymodule;
2046int __pyx_module_is_main_pymodule = 0;
2047
2048/* Implementation of "pymodule" */
2049/* #### Code section: global_var ### */
2050static PyObject *__pyx_builtin_ImportError;
2051/* #### Code section: string_decls ### */
2052static const char __pyx_k_[] = ".";
2053static const char __pyx_k__3[] = "*";
2054static const char __pyx_k__5[] = "?";
2055static const char __pyx_k_py[] = "<py>";
2056static const char __pyx_k_ts[] = "ts";
2057static const char __pyx_k_lib[] = "lib";
2058static const char __pyx_k_Inst[] = "Inst";
2059static const char __pyx_k_file[] = "__file__";
2060static const char __pyx_k_main[] = "__main__";
2061static const char __pyx_k_name[] = "__name__";
2062static const char __pyx_k_spec[] = "__spec__";
2063static const char __pyx_k_test[] = "__test__";
2064static const char __pyx_k_Region[] = "Region";
2065static const char __pyx_k_cyclib[] = "cyclib";
2066static const char __pyx_k_cyclus[] = "cyclus";
2067static const char __pyx_k_decode[] = "decode";
2068static const char __pyx_k_encode[] = "encode";
2069static const char __pyx_k_import[] = "__import__";
2070static const char __pyx_k_Facility[] = "Facility";
2071static const char __pyx_k_del_agent[] = "_del_agent";
2072static const char __pyx_k_importlib[] = "importlib";
2073static const char __pyx_k_cyclus_lib[] = "cyclus.lib";
2074static const char __pyx_k_typesystem[] = "typesystem";
2075static const char __pyx_k_ImportError[] = "ImportError";
2076static const char __pyx_k_initializing[] = "_initializing";
2077static const char __pyx_k_import_module[] = "import_module";
2078static const char __pyx_k_make_py_agent[] = "make_py_agent";
2079static const char __pyx_k_call_listeners[] = "call_listeners";
2080static const char __pyx_k_init_from_agent[] = "init_from_agent";
2081static const char __pyx_k_clear_agent_refs[] = "_clear_agent_refs";
2082static const char __pyx_k_capsule_any_to_py[] = "capsule_any_to_py";
2083static const char __pyx_k_cyclus_typesystem[] = "cyclus.typesystem";
2084static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
2085static const char __pyx_k_capsule_agent_to_py[] = "capsule_agent_to_py";
2086static const char __pyx_k_Cyclus_Python_module_loading_too[] = "Cyclus Python module loading tools.";
2087/* #### Code section: decls ### */
2088/* #### Code section: late_includes ### */
2089/* #### Code section: module_state ### */
2090typedef struct {
2091 PyObject *__pyx_d;
2092 PyObject *__pyx_b;
2093 PyObject *__pyx_cython_runtime;
2094 PyObject *__pyx_empty_tuple;
2095 PyObject *__pyx_empty_bytes;
2096 PyObject *__pyx_empty_unicode;
2097 #ifdef __Pyx_CyFunction_USED
2098 PyTypeObject *__pyx_CyFunctionType;
2099 #endif
2100 #ifdef __Pyx_FusedFunction_USED
2101 PyTypeObject *__pyx_FusedFunctionType;
2102 #endif
2103 #ifdef __Pyx_Generator_USED
2104 PyTypeObject *__pyx_GeneratorType;
2105 #endif
2106 #ifdef __Pyx_IterableCoroutine_USED
2107 PyTypeObject *__pyx_IterableCoroutineType;
2108 #endif
2109 #ifdef __Pyx_Coroutine_USED
2110 PyTypeObject *__pyx_CoroutineAwaitType;
2111 #endif
2112 #ifdef __Pyx_Coroutine_USED
2113 PyTypeObject *__pyx_CoroutineType;
2114 #endif
2115 #if CYTHON_USE_MODULE_STATE
2116 #endif
2117 #if CYTHON_USE_MODULE_STATE
2118 #endif
2119 #if CYTHON_USE_MODULE_STATE
2120 #endif
2121 #if CYTHON_USE_MODULE_STATE
2122 #endif
2123 #if CYTHON_USE_MODULE_STATE
2124 #endif
2125 #if CYTHON_USE_MODULE_STATE
2126 #endif
2127 #if CYTHON_USE_MODULE_STATE
2128 #endif
2129 #if CYTHON_USE_MODULE_STATE
2130 #endif
2131 #if CYTHON_USE_MODULE_STATE
2132 #endif
2133 PyTypeObject *__pyx_ptype_7cpython_4type_type;
2134 #if CYTHON_USE_MODULE_STATE
2135 #endif
2136 #if CYTHON_USE_MODULE_STATE
2137 #endif
2138 #if CYTHON_USE_MODULE_STATE
2139 #endif
2140 #if CYTHON_USE_MODULE_STATE
2141 #endif
2142 PyObject *__pyx_kp_u_;
2143 PyObject *__pyx_n_u_Facility;
2144 PyObject *__pyx_n_s_ImportError;
2145 PyObject *__pyx_n_u_Inst;
2146 PyObject *__pyx_n_u_Region;
2147 PyObject *__pyx_n_s__3;
2148 PyObject *__pyx_n_s__5;
2149 PyObject *__pyx_n_s_call_listeners;
2150 PyObject *__pyx_n_s_capsule_agent_to_py;
2151 PyObject *__pyx_n_s_capsule_any_to_py;
2152 PyObject *__pyx_n_s_clear_agent_refs;
2153 PyObject *__pyx_n_s_cline_in_traceback;
2154 PyObject *__pyx_n_s_cyclib;
2155 PyObject *__pyx_n_s_cyclus;
2156 PyObject *__pyx_n_s_cyclus_lib;
2157 PyObject *__pyx_n_s_cyclus_typesystem;
2158 PyObject *__pyx_n_s_decode;
2159 PyObject *__pyx_n_s_del_agent;
2160 PyObject *__pyx_n_s_encode;
2161 PyObject *__pyx_n_s_file;
2162 PyObject *__pyx_n_s_import;
2163 PyObject *__pyx_n_s_import_module;
2164 PyObject *__pyx_n_s_importlib;
2165 PyObject *__pyx_n_s_init_from_agent;
2166 PyObject *__pyx_n_s_initializing;
2167 PyObject *__pyx_n_s_lib;
2168 PyObject *__pyx_n_s_main;
2169 PyObject *__pyx_n_s_make_py_agent;
2170 PyObject *__pyx_n_s_name;
2171 PyObject *__pyx_kp_u_py;
2172 PyObject *__pyx_n_s_spec;
2173 PyObject *__pyx_n_s_test;
2174 PyObject *__pyx_n_s_ts;
2175 PyObject *__pyx_n_s_typesystem;
2176 PyObject *__pyx_tuple__2;
2177 PyObject *__pyx_tuple__4;
2178} __pyx_mstate;
2179
2180#if CYTHON_USE_MODULE_STATE
2181#ifdef __cplusplus
2182namespace {
2183 extern struct PyModuleDef __pyx_moduledef;
2184} /* anonymous namespace */
2185#else
2186static struct PyModuleDef __pyx_moduledef;
2187#endif
2188
2189#define __pyx_mstate(o) ((__pyx_mstate *)__Pyx_PyModule_GetState(o))
2190
2191#define __pyx_mstate_global (__pyx_mstate(PyState_FindModule(&__pyx_moduledef)))
2192
2193#define __pyx_m (PyState_FindModule(&__pyx_moduledef))
2194#else
2195static __pyx_mstate __pyx_mstate_global_static =
2196#ifdef __cplusplus
2197 {};
2198#else
2199 {0};
2200#endif
2201static __pyx_mstate *__pyx_mstate_global = &__pyx_mstate_global_static;
2202#endif
2203/* #### Code section: module_state_clear ### */
2204#if CYTHON_USE_MODULE_STATE
2205static int __pyx_m_clear(PyObject *m) {
2206 __pyx_mstate *clear_module_state = __pyx_mstate(m);
2207 if (!clear_module_state) return 0;
2208 Py_CLEAR(clear_module_state->__pyx_d);
2209 Py_CLEAR(clear_module_state->__pyx_b);
2210 Py_CLEAR(clear_module_state->__pyx_cython_runtime);
2211 Py_CLEAR(clear_module_state->__pyx_empty_tuple);
2212 Py_CLEAR(clear_module_state->__pyx_empty_bytes);
2213 Py_CLEAR(clear_module_state->__pyx_empty_unicode);
2214 #ifdef __Pyx_CyFunction_USED
2215 Py_CLEAR(clear_module_state->__pyx_CyFunctionType);
2216 #endif
2217 #ifdef __Pyx_FusedFunction_USED
2218 Py_CLEAR(clear_module_state->__pyx_FusedFunctionType);
2219 #endif
2220 Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4type_type);
2221 Py_CLEAR(clear_module_state->__pyx_kp_u_);
2222 Py_CLEAR(clear_module_state->__pyx_n_u_Facility);
2223 Py_CLEAR(clear_module_state->__pyx_n_s_ImportError);
2224 Py_CLEAR(clear_module_state->__pyx_n_u_Inst);
2225 Py_CLEAR(clear_module_state->__pyx_n_u_Region);
2226 Py_CLEAR(clear_module_state->__pyx_n_s__3);
2227 Py_CLEAR(clear_module_state->__pyx_n_s__5);
2228 Py_CLEAR(clear_module_state->__pyx_n_s_call_listeners);
2229 Py_CLEAR(clear_module_state->__pyx_n_s_capsule_agent_to_py);
2230 Py_CLEAR(clear_module_state->__pyx_n_s_capsule_any_to_py);
2231 Py_CLEAR(clear_module_state->__pyx_n_s_clear_agent_refs);
2232 Py_CLEAR(clear_module_state->__pyx_n_s_cline_in_traceback);
2233 Py_CLEAR(clear_module_state->__pyx_n_s_cyclib);
2234 Py_CLEAR(clear_module_state->__pyx_n_s_cyclus);
2235 Py_CLEAR(clear_module_state->__pyx_n_s_cyclus_lib);
2236 Py_CLEAR(clear_module_state->__pyx_n_s_cyclus_typesystem);
2237 Py_CLEAR(clear_module_state->__pyx_n_s_decode);
2238 Py_CLEAR(clear_module_state->__pyx_n_s_del_agent);
2239 Py_CLEAR(clear_module_state->__pyx_n_s_encode);
2240 Py_CLEAR(clear_module_state->__pyx_n_s_file);
2241 Py_CLEAR(clear_module_state->__pyx_n_s_import);
2242 Py_CLEAR(clear_module_state->__pyx_n_s_import_module);
2243 Py_CLEAR(clear_module_state->__pyx_n_s_importlib);
2244 Py_CLEAR(clear_module_state->__pyx_n_s_init_from_agent);
2245 Py_CLEAR(clear_module_state->__pyx_n_s_initializing);
2246 Py_CLEAR(clear_module_state->__pyx_n_s_lib);
2247 Py_CLEAR(clear_module_state->__pyx_n_s_main);
2248 Py_CLEAR(clear_module_state->__pyx_n_s_make_py_agent);
2249 Py_CLEAR(clear_module_state->__pyx_n_s_name);
2250 Py_CLEAR(clear_module_state->__pyx_kp_u_py);
2251 Py_CLEAR(clear_module_state->__pyx_n_s_spec);
2252 Py_CLEAR(clear_module_state->__pyx_n_s_test);
2253 Py_CLEAR(clear_module_state->__pyx_n_s_ts);
2254 Py_CLEAR(clear_module_state->__pyx_n_s_typesystem);
2255 Py_CLEAR(clear_module_state->__pyx_tuple__2);
2256 Py_CLEAR(clear_module_state->__pyx_tuple__4);
2257 return 0;
2258}
2259#endif
2260/* #### Code section: module_state_traverse ### */
2261#if CYTHON_USE_MODULE_STATE
2262static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
2263 __pyx_mstate *traverse_module_state = __pyx_mstate(m);
2264 if (!traverse_module_state) return 0;
2265 Py_VISIT(traverse_module_state->__pyx_d);
2266 Py_VISIT(traverse_module_state->__pyx_b);
2267 Py_VISIT(traverse_module_state->__pyx_cython_runtime);
2268 Py_VISIT(traverse_module_state->__pyx_empty_tuple);
2269 Py_VISIT(traverse_module_state->__pyx_empty_bytes);
2270 Py_VISIT(traverse_module_state->__pyx_empty_unicode);
2271 #ifdef __Pyx_CyFunction_USED
2272 Py_VISIT(traverse_module_state->__pyx_CyFunctionType);
2273 #endif
2274 #ifdef __Pyx_FusedFunction_USED
2275 Py_VISIT(traverse_module_state->__pyx_FusedFunctionType);
2276 #endif
2277 Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4type_type);
2278 Py_VISIT(traverse_module_state->__pyx_kp_u_);
2279 Py_VISIT(traverse_module_state->__pyx_n_u_Facility);
2280 Py_VISIT(traverse_module_state->__pyx_n_s_ImportError);
2281 Py_VISIT(traverse_module_state->__pyx_n_u_Inst);
2282 Py_VISIT(traverse_module_state->__pyx_n_u_Region);
2283 Py_VISIT(traverse_module_state->__pyx_n_s__3);
2284 Py_VISIT(traverse_module_state->__pyx_n_s__5);
2285 Py_VISIT(traverse_module_state->__pyx_n_s_call_listeners);
2286 Py_VISIT(traverse_module_state->__pyx_n_s_capsule_agent_to_py);
2287 Py_VISIT(traverse_module_state->__pyx_n_s_capsule_any_to_py);
2288 Py_VISIT(traverse_module_state->__pyx_n_s_clear_agent_refs);
2289 Py_VISIT(traverse_module_state->__pyx_n_s_cline_in_traceback);
2290 Py_VISIT(traverse_module_state->__pyx_n_s_cyclib);
2291 Py_VISIT(traverse_module_state->__pyx_n_s_cyclus);
2292 Py_VISIT(traverse_module_state->__pyx_n_s_cyclus_lib);
2293 Py_VISIT(traverse_module_state->__pyx_n_s_cyclus_typesystem);
2294 Py_VISIT(traverse_module_state->__pyx_n_s_decode);
2295 Py_VISIT(traverse_module_state->__pyx_n_s_del_agent);
2296 Py_VISIT(traverse_module_state->__pyx_n_s_encode);
2297 Py_VISIT(traverse_module_state->__pyx_n_s_file);
2298 Py_VISIT(traverse_module_state->__pyx_n_s_import);
2299 Py_VISIT(traverse_module_state->__pyx_n_s_import_module);
2300 Py_VISIT(traverse_module_state->__pyx_n_s_importlib);
2301 Py_VISIT(traverse_module_state->__pyx_n_s_init_from_agent);
2302 Py_VISIT(traverse_module_state->__pyx_n_s_initializing);
2303 Py_VISIT(traverse_module_state->__pyx_n_s_lib);
2304 Py_VISIT(traverse_module_state->__pyx_n_s_main);
2305 Py_VISIT(traverse_module_state->__pyx_n_s_make_py_agent);
2306 Py_VISIT(traverse_module_state->__pyx_n_s_name);
2307 Py_VISIT(traverse_module_state->__pyx_kp_u_py);
2308 Py_VISIT(traverse_module_state->__pyx_n_s_spec);
2309 Py_VISIT(traverse_module_state->__pyx_n_s_test);
2310 Py_VISIT(traverse_module_state->__pyx_n_s_ts);
2311 Py_VISIT(traverse_module_state->__pyx_n_s_typesystem);
2312 Py_VISIT(traverse_module_state->__pyx_tuple__2);
2313 Py_VISIT(traverse_module_state->__pyx_tuple__4);
2314 return 0;
2315}
2316#endif
2317/* #### Code section: module_state_defines ### */
2318#define __pyx_d __pyx_mstate_global->__pyx_d
2319#define __pyx_b __pyx_mstate_global->__pyx_b
2320#define __pyx_cython_runtime __pyx_mstate_global->__pyx_cython_runtime
2321#define __pyx_empty_tuple __pyx_mstate_global->__pyx_empty_tuple
2322#define __pyx_empty_bytes __pyx_mstate_global->__pyx_empty_bytes
2323#define __pyx_empty_unicode __pyx_mstate_global->__pyx_empty_unicode
2324#ifdef __Pyx_CyFunction_USED
2325#define __pyx_CyFunctionType __pyx_mstate_global->__pyx_CyFunctionType
2326#endif
2327#ifdef __Pyx_FusedFunction_USED
2328#define __pyx_FusedFunctionType __pyx_mstate_global->__pyx_FusedFunctionType
2329#endif
2330#ifdef __Pyx_Generator_USED
2331#define __pyx_GeneratorType __pyx_mstate_global->__pyx_GeneratorType
2332#endif
2333#ifdef __Pyx_IterableCoroutine_USED
2334#define __pyx_IterableCoroutineType __pyx_mstate_global->__pyx_IterableCoroutineType
2335#endif
2336#ifdef __Pyx_Coroutine_USED
2337#define __pyx_CoroutineAwaitType __pyx_mstate_global->__pyx_CoroutineAwaitType
2338#endif
2339#ifdef __Pyx_Coroutine_USED
2340#define __pyx_CoroutineType __pyx_mstate_global->__pyx_CoroutineType
2341#endif
2342#if CYTHON_USE_MODULE_STATE
2343#endif
2344#if CYTHON_USE_MODULE_STATE
2345#endif
2346#if CYTHON_USE_MODULE_STATE
2347#endif
2348#if CYTHON_USE_MODULE_STATE
2349#endif
2350#if CYTHON_USE_MODULE_STATE
2351#endif
2352#if CYTHON_USE_MODULE_STATE
2353#endif
2354#if CYTHON_USE_MODULE_STATE
2355#endif
2356#if CYTHON_USE_MODULE_STATE
2357#endif
2358#if CYTHON_USE_MODULE_STATE
2359#endif
2360#define __pyx_ptype_7cpython_4type_type __pyx_mstate_global->__pyx_ptype_7cpython_4type_type
2361#if CYTHON_USE_MODULE_STATE
2362#endif
2363#if CYTHON_USE_MODULE_STATE
2364#endif
2365#if CYTHON_USE_MODULE_STATE
2366#endif
2367#if CYTHON_USE_MODULE_STATE
2368#endif
2369#define __pyx_kp_u_ __pyx_mstate_global->__pyx_kp_u_
2370#define __pyx_n_u_Facility __pyx_mstate_global->__pyx_n_u_Facility
2371#define __pyx_n_s_ImportError __pyx_mstate_global->__pyx_n_s_ImportError
2372#define __pyx_n_u_Inst __pyx_mstate_global->__pyx_n_u_Inst
2373#define __pyx_n_u_Region __pyx_mstate_global->__pyx_n_u_Region
2374#define __pyx_n_s__3 __pyx_mstate_global->__pyx_n_s__3
2375#define __pyx_n_s__5 __pyx_mstate_global->__pyx_n_s__5
2376#define __pyx_n_s_call_listeners __pyx_mstate_global->__pyx_n_s_call_listeners
2377#define __pyx_n_s_capsule_agent_to_py __pyx_mstate_global->__pyx_n_s_capsule_agent_to_py
2378#define __pyx_n_s_capsule_any_to_py __pyx_mstate_global->__pyx_n_s_capsule_any_to_py
2379#define __pyx_n_s_clear_agent_refs __pyx_mstate_global->__pyx_n_s_clear_agent_refs
2380#define __pyx_n_s_cline_in_traceback __pyx_mstate_global->__pyx_n_s_cline_in_traceback
2381#define __pyx_n_s_cyclib __pyx_mstate_global->__pyx_n_s_cyclib
2382#define __pyx_n_s_cyclus __pyx_mstate_global->__pyx_n_s_cyclus
2383#define __pyx_n_s_cyclus_lib __pyx_mstate_global->__pyx_n_s_cyclus_lib
2384#define __pyx_n_s_cyclus_typesystem __pyx_mstate_global->__pyx_n_s_cyclus_typesystem
2385#define __pyx_n_s_decode __pyx_mstate_global->__pyx_n_s_decode
2386#define __pyx_n_s_del_agent __pyx_mstate_global->__pyx_n_s_del_agent
2387#define __pyx_n_s_encode __pyx_mstate_global->__pyx_n_s_encode
2388#define __pyx_n_s_file __pyx_mstate_global->__pyx_n_s_file
2389#define __pyx_n_s_import __pyx_mstate_global->__pyx_n_s_import
2390#define __pyx_n_s_import_module __pyx_mstate_global->__pyx_n_s_import_module
2391#define __pyx_n_s_importlib __pyx_mstate_global->__pyx_n_s_importlib
2392#define __pyx_n_s_init_from_agent __pyx_mstate_global->__pyx_n_s_init_from_agent
2393#define __pyx_n_s_initializing __pyx_mstate_global->__pyx_n_s_initializing
2394#define __pyx_n_s_lib __pyx_mstate_global->__pyx_n_s_lib
2395#define __pyx_n_s_main __pyx_mstate_global->__pyx_n_s_main
2396#define __pyx_n_s_make_py_agent __pyx_mstate_global->__pyx_n_s_make_py_agent
2397#define __pyx_n_s_name __pyx_mstate_global->__pyx_n_s_name
2398#define __pyx_kp_u_py __pyx_mstate_global->__pyx_kp_u_py
2399#define __pyx_n_s_spec __pyx_mstate_global->__pyx_n_s_spec
2400#define __pyx_n_s_test __pyx_mstate_global->__pyx_n_s_test
2401#define __pyx_n_s_ts __pyx_mstate_global->__pyx_n_s_ts
2402#define __pyx_n_s_typesystem __pyx_mstate_global->__pyx_n_s_typesystem
2403#define __pyx_tuple__2 __pyx_mstate_global->__pyx_tuple__2
2404#define __pyx_tuple__4 __pyx_mstate_global->__pyx_tuple__4
2405/* #### Code section: module_code ### */
2406
2407/* "string.to_py":31
2408 *
2409 * @cname("__pyx_convert_PyObject_string_to_py_6libcpp_6string_std__in_string")
2410 * cdef inline object __pyx_convert_PyObject_string_to_py_6libcpp_6string_std__in_string(const string& s): # <<<<<<<<<<<<<<
2411 * return __Pyx_PyObject_FromStringAndSize(s.data(), s.size())
2412 * cdef extern from *:
2413 */
2414
2415static CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_6libcpp_6string_std__in_string(std::string const &__pyx_v_s) {
2416 PyObject *__pyx_r = NULL;
2417 __Pyx_RefNannyDeclarations
2418 PyObject *__pyx_t_1 = NULL;
2419 int __pyx_lineno = 0;
2420 const char *__pyx_filename = NULL;
2421 int __pyx_clineno = 0;
2422 __Pyx_RefNannySetupContext("__pyx_convert_PyObject_string_to_py_6libcpp_6string_std__in_string", 1);
2423
2424 /* "string.to_py":32
2425 * @cname("__pyx_convert_PyObject_string_to_py_6libcpp_6string_std__in_string")
2426 * cdef inline object __pyx_convert_PyObject_string_to_py_6libcpp_6string_std__in_string(const string& s):
2427 * return __Pyx_PyObject_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<<
2428 * cdef extern from *:
2429 * cdef object __Pyx_PyUnicode_FromStringAndSize(const char*, size_t)
2430 */
2431 __Pyx_XDECREF(__pyx_r);
2432 __pyx_t_1 = __Pyx_PyObject_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 32, __pyx_L1_error)
2433 __Pyx_GOTREF(__pyx_t_1);
2434 __pyx_r = __pyx_t_1;
2435 __pyx_t_1 = 0;
2436 goto __pyx_L0;
2437
2438 /* "string.to_py":31
2439 *
2440 * @cname("__pyx_convert_PyObject_string_to_py_6libcpp_6string_std__in_string")
2441 * cdef inline object __pyx_convert_PyObject_string_to_py_6libcpp_6string_std__in_string(const string& s): # <<<<<<<<<<<<<<
2442 * return __Pyx_PyObject_FromStringAndSize(s.data(), s.size())
2443 * cdef extern from *:
2444 */
2445
2446 /* function exit code */
2447 __pyx_L1_error:;
2448 __Pyx_XDECREF(__pyx_t_1);
2449 __Pyx_AddTraceback("string.to_py.__pyx_convert_PyObject_string_to_py_6libcpp_6string_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
2450 __pyx_r = 0;
2451 __pyx_L0:;
2452 __Pyx_XGIVEREF(__pyx_r);
2453 __Pyx_RefNannyFinishContext();
2454 return __pyx_r;
2455}
2456
2457/* "string.to_py":37
2458 *
2459 * @cname("__pyx_convert_PyUnicode_string_to_py_6libcpp_6string_std__in_string")
2460 * cdef inline object __pyx_convert_PyUnicode_string_to_py_6libcpp_6string_std__in_string(const string& s): # <<<<<<<<<<<<<<
2461 * return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size())
2462 * cdef extern from *:
2463 */
2464
2465static CYTHON_INLINE PyObject *__pyx_convert_PyUnicode_string_to_py_6libcpp_6string_std__in_string(std::string const &__pyx_v_s) {
2466 PyObject *__pyx_r = NULL;
2467 __Pyx_RefNannyDeclarations
2468 PyObject *__pyx_t_1 = NULL;
2469 int __pyx_lineno = 0;
2470 const char *__pyx_filename = NULL;
2471 int __pyx_clineno = 0;
2472 __Pyx_RefNannySetupContext("__pyx_convert_PyUnicode_string_to_py_6libcpp_6string_std__in_string", 1);
2473
2474 /* "string.to_py":38
2475 * @cname("__pyx_convert_PyUnicode_string_to_py_6libcpp_6string_std__in_string")
2476 * cdef inline object __pyx_convert_PyUnicode_string_to_py_6libcpp_6string_std__in_string(const string& s):
2477 * return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<<
2478 * cdef extern from *:
2479 * cdef object __Pyx_PyStr_FromStringAndSize(const char*, size_t)
2480 */
2481 __Pyx_XDECREF(__pyx_r);
2482 __pyx_t_1 = __Pyx_PyUnicode_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 38, __pyx_L1_error)
2483 __Pyx_GOTREF(__pyx_t_1);
2484 __pyx_r = __pyx_t_1;
2485 __pyx_t_1 = 0;
2486 goto __pyx_L0;
2487
2488 /* "string.to_py":37
2489 *
2490 * @cname("__pyx_convert_PyUnicode_string_to_py_6libcpp_6string_std__in_string")
2491 * cdef inline object __pyx_convert_PyUnicode_string_to_py_6libcpp_6string_std__in_string(const string& s): # <<<<<<<<<<<<<<
2492 * return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size())
2493 * cdef extern from *:
2494 */
2495
2496 /* function exit code */
2497 __pyx_L1_error:;
2498 __Pyx_XDECREF(__pyx_t_1);
2499 __Pyx_AddTraceback("string.to_py.__pyx_convert_PyUnicode_string_to_py_6libcpp_6string_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
2500 __pyx_r = 0;
2501 __pyx_L0:;
2502 __Pyx_XGIVEREF(__pyx_r);
2503 __Pyx_RefNannyFinishContext();
2504 return __pyx_r;
2505}
2506
2507/* "string.to_py":43
2508 *
2509 * @cname("__pyx_convert_PyStr_string_to_py_6libcpp_6string_std__in_string")
2510 * cdef inline object __pyx_convert_PyStr_string_to_py_6libcpp_6string_std__in_string(const string& s): # <<<<<<<<<<<<<<
2511 * return __Pyx_PyStr_FromStringAndSize(s.data(), s.size())
2512 * cdef extern from *:
2513 */
2514
2515static CYTHON_INLINE PyObject *__pyx_convert_PyStr_string_to_py_6libcpp_6string_std__in_string(std::string const &__pyx_v_s) {
2516 PyObject *__pyx_r = NULL;
2517 __Pyx_RefNannyDeclarations
2518 PyObject *__pyx_t_1 = NULL;
2519 int __pyx_lineno = 0;
2520 const char *__pyx_filename = NULL;
2521 int __pyx_clineno = 0;
2522 __Pyx_RefNannySetupContext("__pyx_convert_PyStr_string_to_py_6libcpp_6string_std__in_string", 1);
2523
2524 /* "string.to_py":44
2525 * @cname("__pyx_convert_PyStr_string_to_py_6libcpp_6string_std__in_string")
2526 * cdef inline object __pyx_convert_PyStr_string_to_py_6libcpp_6string_std__in_string(const string& s):
2527 * return __Pyx_PyStr_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<<
2528 * cdef extern from *:
2529 * cdef object __Pyx_PyBytes_FromStringAndSize(const char*, size_t)
2530 */
2531 __Pyx_XDECREF(__pyx_r);
2532 __pyx_t_1 = __Pyx_PyStr_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 44, __pyx_L1_error)
2533 __Pyx_GOTREF(__pyx_t_1);
2534 __pyx_r = __pyx_t_1;
2535 __pyx_t_1 = 0;
2536 goto __pyx_L0;
2537
2538 /* "string.to_py":43
2539 *
2540 * @cname("__pyx_convert_PyStr_string_to_py_6libcpp_6string_std__in_string")
2541 * cdef inline object __pyx_convert_PyStr_string_to_py_6libcpp_6string_std__in_string(const string& s): # <<<<<<<<<<<<<<
2542 * return __Pyx_PyStr_FromStringAndSize(s.data(), s.size())
2543 * cdef extern from *:
2544 */
2545
2546 /* function exit code */
2547 __pyx_L1_error:;
2548 __Pyx_XDECREF(__pyx_t_1);
2549 __Pyx_AddTraceback("string.to_py.__pyx_convert_PyStr_string_to_py_6libcpp_6string_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
2550 __pyx_r = 0;
2551 __pyx_L0:;
2552 __Pyx_XGIVEREF(__pyx_r);
2553 __Pyx_RefNannyFinishContext();
2554 return __pyx_r;
2555}
2556
2557/* "string.to_py":49
2558 *
2559 * @cname("__pyx_convert_PyBytes_string_to_py_6libcpp_6string_std__in_string")
2560 * cdef inline object __pyx_convert_PyBytes_string_to_py_6libcpp_6string_std__in_string(const string& s): # <<<<<<<<<<<<<<
2561 * return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size())
2562 * cdef extern from *:
2563 */
2564
2565static CYTHON_INLINE PyObject *__pyx_convert_PyBytes_string_to_py_6libcpp_6string_std__in_string(std::string const &__pyx_v_s) {
2566 PyObject *__pyx_r = NULL;
2567 __Pyx_RefNannyDeclarations
2568 PyObject *__pyx_t_1 = NULL;
2569 int __pyx_lineno = 0;
2570 const char *__pyx_filename = NULL;
2571 int __pyx_clineno = 0;
2572 __Pyx_RefNannySetupContext("__pyx_convert_PyBytes_string_to_py_6libcpp_6string_std__in_string", 1);
2573
2574 /* "string.to_py":50
2575 * @cname("__pyx_convert_PyBytes_string_to_py_6libcpp_6string_std__in_string")
2576 * cdef inline object __pyx_convert_PyBytes_string_to_py_6libcpp_6string_std__in_string(const string& s):
2577 * return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<<
2578 * cdef extern from *:
2579 * cdef object __Pyx_PyByteArray_FromStringAndSize(const char*, size_t)
2580 */
2581 __Pyx_XDECREF(__pyx_r);
2582 __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 50, __pyx_L1_error)
2583 __Pyx_GOTREF(__pyx_t_1);
2584 __pyx_r = __pyx_t_1;
2585 __pyx_t_1 = 0;
2586 goto __pyx_L0;
2587
2588 /* "string.to_py":49
2589 *
2590 * @cname("__pyx_convert_PyBytes_string_to_py_6libcpp_6string_std__in_string")
2591 * cdef inline object __pyx_convert_PyBytes_string_to_py_6libcpp_6string_std__in_string(const string& s): # <<<<<<<<<<<<<<
2592 * return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size())
2593 * cdef extern from *:
2594 */
2595
2596 /* function exit code */
2597 __pyx_L1_error:;
2598 __Pyx_XDECREF(__pyx_t_1);
2599 __Pyx_AddTraceback("string.to_py.__pyx_convert_PyBytes_string_to_py_6libcpp_6string_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
2600 __pyx_r = 0;
2601 __pyx_L0:;
2602 __Pyx_XGIVEREF(__pyx_r);
2603 __Pyx_RefNannyFinishContext();
2604 return __pyx_r;
2605}
2606
2607/* "string.to_py":55
2608 *
2609 * @cname("__pyx_convert_PyByteArray_string_to_py_6libcpp_6string_std__in_string")
2610 * cdef inline object __pyx_convert_PyByteArray_string_to_py_6libcpp_6string_std__in_string(const string& s): # <<<<<<<<<<<<<<
2611 * return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size())
2612 *
2613 */
2614
2615static CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_6libcpp_6string_std__in_string(std::string const &__pyx_v_s) {
2616 PyObject *__pyx_r = NULL;
2617 __Pyx_RefNannyDeclarations
2618 PyObject *__pyx_t_1 = NULL;
2619 int __pyx_lineno = 0;
2620 const char *__pyx_filename = NULL;
2621 int __pyx_clineno = 0;
2622 __Pyx_RefNannySetupContext("__pyx_convert_PyByteArray_string_to_py_6libcpp_6string_std__in_string", 1);
2623
2624 /* "string.to_py":56
2625 * @cname("__pyx_convert_PyByteArray_string_to_py_6libcpp_6string_std__in_string")
2626 * cdef inline object __pyx_convert_PyByteArray_string_to_py_6libcpp_6string_std__in_string(const string& s):
2627 * return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<<
2628 *
2629 */
2630 __Pyx_XDECREF(__pyx_r);
2631 __pyx_t_1 = __Pyx_PyByteArray_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 56, __pyx_L1_error)
2632 __Pyx_GOTREF(__pyx_t_1);
2633 __pyx_r = __pyx_t_1;
2634 __pyx_t_1 = 0;
2635 goto __pyx_L0;
2636
2637 /* "string.to_py":55
2638 *
2639 * @cname("__pyx_convert_PyByteArray_string_to_py_6libcpp_6string_std__in_string")
2640 * cdef inline object __pyx_convert_PyByteArray_string_to_py_6libcpp_6string_std__in_string(const string& s): # <<<<<<<<<<<<<<
2641 * return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size())
2642 *
2643 */
2644
2645 /* function exit code */
2646 __pyx_L1_error:;
2647 __Pyx_XDECREF(__pyx_t_1);
2648 __Pyx_AddTraceback("string.to_py.__pyx_convert_PyByteArray_string_to_py_6libcpp_6string_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
2649 __pyx_r = 0;
2650 __pyx_L0:;
2651 __Pyx_XGIVEREF(__pyx_r);
2652 __Pyx_RefNannyFinishContext();
2653 return __pyx_r;
2654}
2655
2656/* "pymodule.pyx":13
2657 * import cyclus.typesystem as ts
2658 *
2659 * cdef object std_string_to_py(std_string x): # <<<<<<<<<<<<<<
2660 * pyx = x
2661 * pyx = pyx.decode()
2662 */
2663
2664static PyObject *__pyx_f_8pymodule_std_string_to_py(std::string __pyx_v_x) {
2665 PyObject *__pyx_v_pyx = NULL;
2666 PyObject *__pyx_r = NULL;
2667 __Pyx_RefNannyDeclarations
2668 PyObject *__pyx_t_1 = NULL;
2669 PyObject *__pyx_t_2 = NULL;
2670 PyObject *__pyx_t_3 = NULL;
2671 unsigned int __pyx_t_4;
2672 int __pyx_lineno = 0;
2673 const char *__pyx_filename = NULL;
2674 int __pyx_clineno = 0;
2675 __Pyx_RefNannySetupContext("std_string_to_py", 1);
2676
2677 /* "pymodule.pyx":14
2678 *
2679 * cdef object std_string_to_py(std_string x):
2680 * pyx = x # <<<<<<<<<<<<<<
2681 * pyx = pyx.decode()
2682 * return pyx
2683 */
2684 __pyx_t_1 = __pyx_convert_PyBytes_string_to_py_6libcpp_6string_std__in_string(__pyx_v_x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error)
2685 __Pyx_GOTREF(__pyx_t_1);
2686 __pyx_v_pyx = __pyx_t_1;
2687 __pyx_t_1 = 0;
2688
2689 /* "pymodule.pyx":15
2690 * cdef object std_string_to_py(std_string x):
2691 * pyx = x
2692 * pyx = pyx.decode() # <<<<<<<<<<<<<<
2693 * return pyx
2694 *
2695 */
2696 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_pyx, __pyx_n_s_decode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error)
2697 __Pyx_GOTREF(__pyx_t_2);
2698 __pyx_t_3 = NULL;
2699 __pyx_t_4 = 0;
2700 #if CYTHON_UNPACK_METHODS
2701 if (likely(PyMethod_Check(__pyx_t_2))) {
2702 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
2703 if (likely(__pyx_t_3)) {
2704 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
2705 __Pyx_INCREF(__pyx_t_3);
2706 __Pyx_INCREF(function);
2707 __Pyx_DECREF_SET(__pyx_t_2, function);
2708 __pyx_t_4 = 1;
2709 }
2710 }
2711 #endif
2712 {
2713 PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
2714 __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
2715 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
2716 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)
2717 __Pyx_GOTREF(__pyx_t_1);
2718 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2719 }
2720 __Pyx_DECREF_SET(__pyx_v_pyx, __pyx_t_1);
2721 __pyx_t_1 = 0;
2722
2723 /* "pymodule.pyx":16
2724 * pyx = x
2725 * pyx = pyx.decode()
2726 * return pyx # <<<<<<<<<<<<<<
2727 *
2728 *
2729 */
2730 __Pyx_XDECREF(__pyx_r);
2731 __Pyx_INCREF(__pyx_v_pyx);
2732 __pyx_r = __pyx_v_pyx;
2733 goto __pyx_L0;
2734
2735 /* "pymodule.pyx":13
2736 * import cyclus.typesystem as ts
2737 *
2738 * cdef object std_string_to_py(std_string x): # <<<<<<<<<<<<<<
2739 * pyx = x
2740 * pyx = pyx.decode()
2741 */
2742
2743 /* function exit code */
2744 __pyx_L1_error:;
2745 __Pyx_XDECREF(__pyx_t_1);
2746 __Pyx_XDECREF(__pyx_t_2);
2747 __Pyx_XDECREF(__pyx_t_3);
2748 __Pyx_AddTraceback("pymodule.std_string_to_py", __pyx_clineno, __pyx_lineno, __pyx_filename);
2749 __pyx_r = 0;
2750 __pyx_L0:;
2751 __Pyx_XDECREF(__pyx_v_pyx);
2752 __Pyx_XGIVEREF(__pyx_r);
2753 __Pyx_RefNannyFinishContext();
2754 return __pyx_r;
2755}
2756
2757/* "pymodule.pyx":19
2758 *
2759 *
2760 * cdef std_string str_py_to_cpp(object x): # <<<<<<<<<<<<<<
2761 * cdef std_string s
2762 * x = x.encode()
2763 */
2764
2765static std::string __pyx_f_8pymodule_str_py_to_cpp(PyObject *__pyx_v_x) {
2766 std::string __pyx_v_s;
2767 std::string __pyx_r;
2768 __Pyx_RefNannyDeclarations
2769 PyObject *__pyx_t_1 = NULL;
2770 PyObject *__pyx_t_2 = NULL;
2771 PyObject *__pyx_t_3 = NULL;
2772 unsigned int __pyx_t_4;
2773 char const *__pyx_t_5;
2774 std::string __pyx_t_6;
2775 int __pyx_lineno = 0;
2776 const char *__pyx_filename = NULL;
2777 int __pyx_clineno = 0;
2778 __Pyx_RefNannySetupContext("str_py_to_cpp", 0);
2779 __Pyx_INCREF(__pyx_v_x);
2780
2781 /* "pymodule.pyx":21
2782 * cdef std_string str_py_to_cpp(object x):
2783 * cdef std_string s
2784 * x = x.encode() # <<<<<<<<<<<<<<
2785 * s = std_string(<const char*> x)
2786 * return s
2787 */
2788 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_x, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 21, __pyx_L1_error)
2789 __Pyx_GOTREF(__pyx_t_2);
2790 __pyx_t_3 = NULL;
2791 __pyx_t_4 = 0;
2792 #if CYTHON_UNPACK_METHODS
2793 if (likely(PyMethod_Check(__pyx_t_2))) {
2794 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
2795 if (likely(__pyx_t_3)) {
2796 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
2797 __Pyx_INCREF(__pyx_t_3);
2798 __Pyx_INCREF(function);
2799 __Pyx_DECREF_SET(__pyx_t_2, function);
2800 __pyx_t_4 = 1;
2801 }
2802 }
2803 #endif
2804 {
2805 PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
2806 __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
2807 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
2808 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 21, __pyx_L1_error)
2809 __Pyx_GOTREF(__pyx_t_1);
2810 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2811 }
2812 __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
2813 __pyx_t_1 = 0;
2814
2815 /* "pymodule.pyx":22
2816 * cdef std_string s
2817 * x = x.encode()
2818 * s = std_string(<const char*> x) # <<<<<<<<<<<<<<
2819 * return s
2820 *
2821 */
2822 __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_x); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 22, __pyx_L1_error)
2823 try {
2824 __pyx_t_6 = std::string(((char const *)__pyx_t_5));
2825 } catch(...) {
2826 __Pyx_CppExn2PyErr();
2827 __PYX_ERR(0, 22, __pyx_L1_error)
2828 }
2829 __pyx_v_s = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_6);
2830
2831 /* "pymodule.pyx":23
2832 * x = x.encode()
2833 * s = std_string(<const char*> x)
2834 * return s # <<<<<<<<<<<<<<
2835 *
2836 *
2837 */
2838 __pyx_r = __pyx_v_s;
2839 goto __pyx_L0;
2840
2841 /* "pymodule.pyx":19
2842 *
2843 *
2844 * cdef std_string str_py_to_cpp(object x): # <<<<<<<<<<<<<<
2845 * cdef std_string s
2846 * x = x.encode()
2847 */
2848
2849 /* function exit code */
2850 __pyx_L1_error:;
2851 __Pyx_XDECREF(__pyx_t_1);
2852 __Pyx_XDECREF(__pyx_t_2);
2853 __Pyx_XDECREF(__pyx_t_3);
2854 __Pyx_AddTraceback("pymodule.str_py_to_cpp", __pyx_clineno, __pyx_lineno, __pyx_filename);
2855 __Pyx_pretend_to_initialize(&__pyx_r);
2856 __pyx_L0:;
2857 __Pyx_XDECREF(__pyx_v_x);
2858 __Pyx_RefNannyFinishContext();
2859 return __pyx_r;
2860}
2861
2862/* "pymodule.pyx":26
2863 *
2864 *
2865 * cdef public api std_string py_find_module "CyclusPyFindModule" (std_string cpp_lib) except *: # <<<<<<<<<<<<<<
2866 * """Finds a Python module and returns a string of the form '<py>:modulepath'"""
2867 * lib = std_string_to_py(cpp_lib)
2868 */
2869
2870std::string CyclusPyFindModule(std::string __pyx_v_cpp_lib) {
2871 PyObject *__pyx_v_lib = NULL;
2872 PyObject *__pyx_v_mod = NULL;
2873 std::string __pyx_v_rtn;
2874 std::string __pyx_r;
2875 __Pyx_RefNannyDeclarations
2876 PyObject *__pyx_t_1 = NULL;
2877 PyObject *__pyx_t_2 = NULL;
2878 PyObject *__pyx_t_3 = NULL;
2879 PyObject *__pyx_t_4 = NULL;
2880 PyObject *__pyx_t_5 = NULL;
2881 PyObject *__pyx_t_6 = NULL;
2882 unsigned int __pyx_t_7;
2883 int __pyx_t_8;
2884 std::string __pyx_t_9;
2885 int __pyx_lineno = 0;
2886 const char *__pyx_filename = NULL;
2887 int __pyx_clineno = 0;
2888 __Pyx_RefNannySetupContext("py_find_module", 1);
2889
2890 /* "pymodule.pyx":28
2891 * cdef public api std_string py_find_module "CyclusPyFindModule" (std_string cpp_lib) except *:
2892 * """Finds a Python module and returns a string of the form '<py>:modulepath'"""
2893 * lib = std_string_to_py(cpp_lib) # <<<<<<<<<<<<<<
2894 * try:
2895 * mod = import_module(lib)
2896 */
2897 __pyx_t_1 = __pyx_f_8pymodule_std_string_to_py(__pyx_v_cpp_lib); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 28, __pyx_L1_error)
2898 __Pyx_GOTREF(__pyx_t_1);
2899 __pyx_v_lib = __pyx_t_1;
2900 __pyx_t_1 = 0;
2901
2902 /* "pymodule.pyx":29
2903 * """Finds a Python module and returns a string of the form '<py>:modulepath'"""
2904 * lib = std_string_to_py(cpp_lib)
2905 * try: # <<<<<<<<<<<<<<
2906 * mod = import_module(lib)
2907 * except ImportError:
2908 */
2909 {
2910 __Pyx_PyThreadState_declare
2911 __Pyx_PyThreadState_assign
2912 __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
2913 __Pyx_XGOTREF(__pyx_t_2);
2914 __Pyx_XGOTREF(__pyx_t_3);
2915 __Pyx_XGOTREF(__pyx_t_4);
2916 /*try:*/ {
2917
2918 /* "pymodule.pyx":30
2919 * lib = std_string_to_py(cpp_lib)
2920 * try:
2921 * mod = import_module(lib) # <<<<<<<<<<<<<<
2922 * except ImportError:
2923 * return std_string(b"")
2924 */
2925 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_import_module); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 30, __pyx_L3_error)
2926 __Pyx_GOTREF(__pyx_t_5);
2927 __pyx_t_6 = NULL;
2928 __pyx_t_7 = 0;
2929 #if CYTHON_UNPACK_METHODS
2930 if (unlikely(PyMethod_Check(__pyx_t_5))) {
2931 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
2932 if (likely(__pyx_t_6)) {
2933 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
2934 __Pyx_INCREF(__pyx_t_6);
2935 __Pyx_INCREF(function);
2936 __Pyx_DECREF_SET(__pyx_t_5, function);
2937 __pyx_t_7 = 1;
2938 }
2939 }
2940 #endif
2941 {
2942 PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_lib};
2943 __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
2944 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
2945 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 30, __pyx_L3_error)
2946 __Pyx_GOTREF(__pyx_t_1);
2947 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2948 }
2949 __pyx_v_mod = __pyx_t_1;
2950 __pyx_t_1 = 0;
2951
2952 /* "pymodule.pyx":29
2953 * """Finds a Python module and returns a string of the form '<py>:modulepath'"""
2954 * lib = std_string_to_py(cpp_lib)
2955 * try: # <<<<<<<<<<<<<<
2956 * mod = import_module(lib)
2957 * except ImportError:
2958 */
2959 }
2960 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
2961 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
2962 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
2963 goto __pyx_L8_try_end;
2964 __pyx_L3_error:;
2965 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
2966 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
2967 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
2968
2969 /* "pymodule.pyx":31
2970 * try:
2971 * mod = import_module(lib)
2972 * except ImportError: # <<<<<<<<<<<<<<
2973 * return std_string(b"")
2974 * PyErr_CheckSignals()
2975 */
2976 __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ImportError);
2977 if (__pyx_t_8) {
2978 __Pyx_AddTraceback("pymodule.py_find_module", __pyx_clineno, __pyx_lineno, __pyx_filename);
2979 if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_5, &__pyx_t_6) < 0) __PYX_ERR(0, 31, __pyx_L5_except_error)
2980 __Pyx_XGOTREF(__pyx_t_1);
2981 __Pyx_XGOTREF(__pyx_t_5);
2982 __Pyx_XGOTREF(__pyx_t_6);
2983
2984 /* "pymodule.pyx":32
2985 * mod = import_module(lib)
2986 * except ImportError:
2987 * return std_string(b"") # <<<<<<<<<<<<<<
2988 * PyErr_CheckSignals()
2989 * cdef std_string rtn = str_py_to_cpp("<py>" + mod.__file__)
2990 */
2991 try {
2992 __pyx_t_9 = std::string(((char const *)""));
2993 } catch(...) {
2994 __Pyx_CppExn2PyErr();
2995 __PYX_ERR(0, 32, __pyx_L5_except_error)
2996 }
2997 __pyx_r = __pyx_t_9;
2998 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2999 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3000 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3001 goto __pyx_L6_except_return;
3002 }
3003 goto __pyx_L5_except_error;
3004
3005 /* "pymodule.pyx":29
3006 * """Finds a Python module and returns a string of the form '<py>:modulepath'"""
3007 * lib = std_string_to_py(cpp_lib)
3008 * try: # <<<<<<<<<<<<<<
3009 * mod = import_module(lib)
3010 * except ImportError:
3011 */
3012 __pyx_L5_except_error:;
3013 __Pyx_XGIVEREF(__pyx_t_2);
3014 __Pyx_XGIVEREF(__pyx_t_3);
3015 __Pyx_XGIVEREF(__pyx_t_4);
3016 __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
3017 goto __pyx_L1_error;
3018 __pyx_L6_except_return:;
3019 __Pyx_XGIVEREF(__pyx_t_2);
3020 __Pyx_XGIVEREF(__pyx_t_3);
3021 __Pyx_XGIVEREF(__pyx_t_4);
3022 __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
3023 goto __pyx_L0;
3024 __pyx_L8_try_end:;
3025 }
3026
3027 /* "pymodule.pyx":33
3028 * except ImportError:
3029 * return std_string(b"")
3030 * PyErr_CheckSignals() # <<<<<<<<<<<<<<
3031 * cdef std_string rtn = str_py_to_cpp("<py>" + mod.__file__)
3032 * return rtn
3033 */
3034 __pyx_t_8 = PyErr_CheckSignals(); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 33, __pyx_L1_error)
3035
3036 /* "pymodule.pyx":34
3037 * return std_string(b"")
3038 * PyErr_CheckSignals()
3039 * cdef std_string rtn = str_py_to_cpp("<py>" + mod.__file__) # <<<<<<<<<<<<<<
3040 * return rtn
3041 *
3042 */
3043 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_mod, __pyx_n_s_file); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 34, __pyx_L1_error)
3044 __Pyx_GOTREF(__pyx_t_6);
3045 __pyx_t_5 = PyNumber_Add(__pyx_kp_u_py, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 34, __pyx_L1_error)
3046 __Pyx_GOTREF(__pyx_t_5);
3047 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3048 __pyx_t_9 = __pyx_f_8pymodule_str_py_to_cpp(__pyx_t_5); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 34, __pyx_L1_error)
3049 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3050 __pyx_v_rtn = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_9);
3051
3052 /* "pymodule.pyx":35
3053 * PyErr_CheckSignals()
3054 * cdef std_string rtn = str_py_to_cpp("<py>" + mod.__file__)
3055 * return rtn # <<<<<<<<<<<<<<
3056 *
3057 *
3058 */
3059 __pyx_r = __pyx_v_rtn;
3060 goto __pyx_L0;
3061
3062 /* "pymodule.pyx":26
3063 *
3064 *
3065 * cdef public api std_string py_find_module "CyclusPyFindModule" (std_string cpp_lib) except *: # <<<<<<<<<<<<<<
3066 * """Finds a Python module and returns a string of the form '<py>:modulepath'"""
3067 * lib = std_string_to_py(cpp_lib)
3068 */
3069
3070 /* function exit code */
3071 __pyx_L1_error:;
3072 __Pyx_XDECREF(__pyx_t_1);
3073 __Pyx_XDECREF(__pyx_t_5);
3074 __Pyx_XDECREF(__pyx_t_6);
3075 __Pyx_AddTraceback("pymodule.py_find_module", __pyx_clineno, __pyx_lineno, __pyx_filename);
3076 __Pyx_pretend_to_initialize(&__pyx_r);
3077 __pyx_L0:;
3078 __Pyx_XDECREF(__pyx_v_lib);
3079 __Pyx_XDECREF(__pyx_v_mod);
3080 __Pyx_RefNannyFinishContext();
3081 return __pyx_r;
3082}
3083
3084/* "pymodule.pyx":38
3085 *
3086 *
3087 * cdef public api Agent* make_py_agent "CyclusMakePyAgent" (std_string cpp_lib, # <<<<<<<<<<<<<<
3088 * std_string cpp_agent,
3089 * void* cpp_ctx) except *:
3090 */
3091
3092cyclus::Agent *CyclusMakePyAgent(std::string __pyx_v_cpp_lib, std::string __pyx_v_cpp_agent, void *__pyx_v_cpp_ctx) {
3093 PyObject *__pyx_v_libname = NULL;
3094 PyObject *__pyx_v_agentname = NULL;
3095 PyObject *__pyx_v_ctx = NULL;
3096 PyObject *__pyx_v_a = NULL;
3097 PyObject *__pyx_v_kind = NULL;
3098 void *__pyx_v_avoid;
3099 cyclus::Agent *__pyx_v_rtn;
3100 cyclus::Agent *__pyx_r;
3101 __Pyx_RefNannyDeclarations
3102 PyObject *__pyx_t_1 = NULL;
3103 PyObject *__pyx_t_2 = NULL;
3104 PyObject *__pyx_t_3 = NULL;
3105 unsigned int __pyx_t_4;
3106 PyObject *__pyx_t_5 = NULL;
3107 PyObject *(*__pyx_t_6)(PyObject *);
3108 void *__pyx_t_7;
3109 int __pyx_t_8;
3110 __pyx_t_8pymodule_agent_ptr __pyx_t_9;
3111 int __pyx_t_10;
3112 int __pyx_lineno = 0;
3113 const char *__pyx_filename = NULL;
3114 int __pyx_clineno = 0;
3115 __Pyx_RefNannySetupContext("make_py_agent", 1);
3116
3117 /* "pymodule.pyx":42
3118 * void* cpp_ctx) except *:
3119 * """Makes a new Python agent instance."""
3120 * libname = std_string_to_py(cpp_lib) # <<<<<<<<<<<<<<
3121 * agentname = std_string_to_py(cpp_agent)
3122 * ctx = PyCapsule_New(cpp_ctx, <char*> b"ctx", NULL)
3123 */
3124 __pyx_t_1 = __pyx_f_8pymodule_std_string_to_py(__pyx_v_cpp_lib); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error)
3125 __Pyx_GOTREF(__pyx_t_1);
3126 __pyx_v_libname = __pyx_t_1;
3127 __pyx_t_1 = 0;
3128
3129 /* "pymodule.pyx":43
3130 * """Makes a new Python agent instance."""
3131 * libname = std_string_to_py(cpp_lib)
3132 * agentname = std_string_to_py(cpp_agent) # <<<<<<<<<<<<<<
3133 * ctx = PyCapsule_New(cpp_ctx, <char*> b"ctx", NULL)
3134 * a, kind = cyclib.make_py_agent(libname, agentname, ctx)
3135 */
3136 __pyx_t_1 = __pyx_f_8pymodule_std_string_to_py(__pyx_v_cpp_agent); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 43, __pyx_L1_error)
3137 __Pyx_GOTREF(__pyx_t_1);
3138 __pyx_v_agentname = __pyx_t_1;
3139 __pyx_t_1 = 0;
3140
3141 /* "pymodule.pyx":44
3142 * libname = std_string_to_py(cpp_lib)
3143 * agentname = std_string_to_py(cpp_agent)
3144 * ctx = PyCapsule_New(cpp_ctx, <char*> b"ctx", NULL) # <<<<<<<<<<<<<<
3145 * a, kind = cyclib.make_py_agent(libname, agentname, ctx)
3146 * cdef void* avoid = PyCapsule_GetPointer(a, <char*> b"agent")
3147 */
3148 __pyx_t_1 = PyCapsule_New(__pyx_v_cpp_ctx, ((char *)((char *)"ctx")), NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error)
3149 __Pyx_GOTREF(__pyx_t_1);
3150 __pyx_v_ctx = __pyx_t_1;
3151 __pyx_t_1 = 0;
3152
3153 /* "pymodule.pyx":45
3154 * agentname = std_string_to_py(cpp_agent)
3155 * ctx = PyCapsule_New(cpp_ctx, <char*> b"ctx", NULL)
3156 * a, kind = cyclib.make_py_agent(libname, agentname, ctx) # <<<<<<<<<<<<<<
3157 * cdef void* avoid = PyCapsule_GetPointer(a, <char*> b"agent")
3158 * cdef Agent* rtn
3159 */
3160 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_cyclib); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error)
3161 __Pyx_GOTREF(__pyx_t_2);
3162 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_make_py_agent); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 45, __pyx_L1_error)
3163 __Pyx_GOTREF(__pyx_t_3);
3164 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3165 __pyx_t_2 = NULL;
3166 __pyx_t_4 = 0;
3167 #if CYTHON_UNPACK_METHODS
3168 if (unlikely(PyMethod_Check(__pyx_t_3))) {
3169 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
3170 if (likely(__pyx_t_2)) {
3171 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
3172 __Pyx_INCREF(__pyx_t_2);
3173 __Pyx_INCREF(function);
3174 __Pyx_DECREF_SET(__pyx_t_3, function);
3175 __pyx_t_4 = 1;
3176 }
3177 }
3178 #endif
3179 {
3180 PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_v_libname, __pyx_v_agentname, __pyx_v_ctx};
3181 __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 3+__pyx_t_4);
3182 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
3183 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error)
3184 __Pyx_GOTREF(__pyx_t_1);
3185 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3186 }
3187 if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
3188 PyObject* sequence = __pyx_t_1;
3189 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
3190 if (unlikely(size != 2)) {
3191 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
3192 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
3193 __PYX_ERR(0, 45, __pyx_L1_error)
3194 }
3195 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3196 if (likely(PyTuple_CheckExact(sequence))) {
3197 __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
3198 __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
3199 } else {
3200 __pyx_t_3 = PyList_GET_ITEM(sequence, 0);
3201 __pyx_t_2 = PyList_GET_ITEM(sequence, 1);
3202 }
3203 __Pyx_INCREF(__pyx_t_3);
3204 __Pyx_INCREF(__pyx_t_2);
3205 #else
3206 __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 45, __pyx_L1_error)
3207 __Pyx_GOTREF(__pyx_t_3);
3208 __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error)
3209 __Pyx_GOTREF(__pyx_t_2);
3210 #endif
3211 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3212 } else {
3213 Py_ssize_t index = -1;
3214 __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 45, __pyx_L1_error)
3215 __Pyx_GOTREF(__pyx_t_5);
3216 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3217 __pyx_t_6 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_5);
3218 index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
3219 __Pyx_GOTREF(__pyx_t_3);
3220 index = 1; __pyx_t_2 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
3221 __Pyx_GOTREF(__pyx_t_2);
3222 if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) __PYX_ERR(0, 45, __pyx_L1_error)
3223 __pyx_t_6 = NULL;
3224 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3225 goto __pyx_L4_unpacking_done;
3226 __pyx_L3_unpacking_failed:;
3227 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3228 __pyx_t_6 = NULL;
3229 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
3230 __PYX_ERR(0, 45, __pyx_L1_error)
3231 __pyx_L4_unpacking_done:;
3232 }
3233 __pyx_v_a = __pyx_t_3;
3234 __pyx_t_3 = 0;
3235 __pyx_v_kind = __pyx_t_2;
3236 __pyx_t_2 = 0;
3237
3238 /* "pymodule.pyx":46
3239 * ctx = PyCapsule_New(cpp_ctx, <char*> b"ctx", NULL)
3240 * a, kind = cyclib.make_py_agent(libname, agentname, ctx)
3241 * cdef void* avoid = PyCapsule_GetPointer(a, <char*> b"agent") # <<<<<<<<<<<<<<
3242 * cdef Agent* rtn
3243 * if kind == "Region":
3244 */
3245 __pyx_t_7 = PyCapsule_GetPointer(__pyx_v_a, ((char *)((char *)"agent"))); if (unlikely(__pyx_t_7 == ((void *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 46, __pyx_L1_error)
3246 __pyx_v_avoid = __pyx_t_7;
3247
3248 /* "pymodule.pyx":48
3249 * cdef void* avoid = PyCapsule_GetPointer(a, <char*> b"agent")
3250 * cdef Agent* rtn
3251 * if kind == "Region": # <<<<<<<<<<<<<<
3252 * rtn = dynamic_cast[agent_ptr](reinterpret_cast[region_ptr](avoid))
3253 * elif kind == "Inst":
3254 */
3255 __pyx_t_8 = (__Pyx_PyUnicode_Equals(__pyx_v_kind, __pyx_n_u_Region, Py_EQ)); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 48, __pyx_L1_error)
3256 if (__pyx_t_8) {
3257
3258 /* "pymodule.pyx":49
3259 * cdef Agent* rtn
3260 * if kind == "Region":
3261 * rtn = dynamic_cast[agent_ptr](reinterpret_cast[region_ptr](avoid)) # <<<<<<<<<<<<<<
3262 * elif kind == "Inst":
3263 * rtn = dynamic_cast[agent_ptr](reinterpret_cast[institution_ptr](avoid))
3264 */
3265 try {
3266 __pyx_t_9 = dynamic_cast<__pyx_t_8pymodule_agent_ptr>(reinterpret_cast<__pyx_t_8pymodule_region_ptr>(__pyx_v_avoid));
3267 } catch(...) {
3268 __Pyx_CppExn2PyErr();
3269 __PYX_ERR(0, 49, __pyx_L1_error)
3270 }
3271 __pyx_v_rtn = __pyx_t_9;
3272
3273 /* "pymodule.pyx":48
3274 * cdef void* avoid = PyCapsule_GetPointer(a, <char*> b"agent")
3275 * cdef Agent* rtn
3276 * if kind == "Region": # <<<<<<<<<<<<<<
3277 * rtn = dynamic_cast[agent_ptr](reinterpret_cast[region_ptr](avoid))
3278 * elif kind == "Inst":
3279 */
3280 goto __pyx_L5;
3281 }
3282
3283 /* "pymodule.pyx":50
3284 * if kind == "Region":
3285 * rtn = dynamic_cast[agent_ptr](reinterpret_cast[region_ptr](avoid))
3286 * elif kind == "Inst": # <<<<<<<<<<<<<<
3287 * rtn = dynamic_cast[agent_ptr](reinterpret_cast[institution_ptr](avoid))
3288 * elif kind == "Facility":
3289 */
3290 __pyx_t_8 = (__Pyx_PyUnicode_Equals(__pyx_v_kind, __pyx_n_u_Inst, Py_EQ)); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 50, __pyx_L1_error)
3291 if (__pyx_t_8) {
3292
3293 /* "pymodule.pyx":51
3294 * rtn = dynamic_cast[agent_ptr](reinterpret_cast[region_ptr](avoid))
3295 * elif kind == "Inst":
3296 * rtn = dynamic_cast[agent_ptr](reinterpret_cast[institution_ptr](avoid)) # <<<<<<<<<<<<<<
3297 * elif kind == "Facility":
3298 * rtn = dynamic_cast[agent_ptr](reinterpret_cast[facility_ptr](avoid))
3299 */
3300 try {
3301 __pyx_t_9 = dynamic_cast<__pyx_t_8pymodule_agent_ptr>(reinterpret_cast<__pyx_t_8pymodule_institution_ptr>(__pyx_v_avoid));
3302 } catch(...) {
3303 __Pyx_CppExn2PyErr();
3304 __PYX_ERR(0, 51, __pyx_L1_error)
3305 }
3306 __pyx_v_rtn = __pyx_t_9;
3307
3308 /* "pymodule.pyx":50
3309 * if kind == "Region":
3310 * rtn = dynamic_cast[agent_ptr](reinterpret_cast[region_ptr](avoid))
3311 * elif kind == "Inst": # <<<<<<<<<<<<<<
3312 * rtn = dynamic_cast[agent_ptr](reinterpret_cast[institution_ptr](avoid))
3313 * elif kind == "Facility":
3314 */
3315 goto __pyx_L5;
3316 }
3317
3318 /* "pymodule.pyx":52
3319 * elif kind == "Inst":
3320 * rtn = dynamic_cast[agent_ptr](reinterpret_cast[institution_ptr](avoid))
3321 * elif kind == "Facility": # <<<<<<<<<<<<<<
3322 * rtn = dynamic_cast[agent_ptr](reinterpret_cast[facility_ptr](avoid))
3323 * else:
3324 */
3325 __pyx_t_8 = (__Pyx_PyUnicode_Equals(__pyx_v_kind, __pyx_n_u_Facility, Py_EQ)); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 52, __pyx_L1_error)
3326 if (__pyx_t_8) {
3327
3328 /* "pymodule.pyx":53
3329 * rtn = dynamic_cast[agent_ptr](reinterpret_cast[institution_ptr](avoid))
3330 * elif kind == "Facility":
3331 * rtn = dynamic_cast[agent_ptr](reinterpret_cast[facility_ptr](avoid)) # <<<<<<<<<<<<<<
3332 * else:
3333 * rtn = dynamic_cast[agent_ptr](reinterpret_cast[agent_ptr](avoid))
3334 */
3335 try {
3336 __pyx_t_9 = dynamic_cast<__pyx_t_8pymodule_agent_ptr>(reinterpret_cast<__pyx_t_8pymodule_facility_ptr>(__pyx_v_avoid));
3337 } catch(...) {
3338 __Pyx_CppExn2PyErr();
3339 __PYX_ERR(0, 53, __pyx_L1_error)
3340 }
3341 __pyx_v_rtn = __pyx_t_9;
3342
3343 /* "pymodule.pyx":52
3344 * elif kind == "Inst":
3345 * rtn = dynamic_cast[agent_ptr](reinterpret_cast[institution_ptr](avoid))
3346 * elif kind == "Facility": # <<<<<<<<<<<<<<
3347 * rtn = dynamic_cast[agent_ptr](reinterpret_cast[facility_ptr](avoid))
3348 * else:
3349 */
3350 goto __pyx_L5;
3351 }
3352
3353 /* "pymodule.pyx":55
3354 * rtn = dynamic_cast[agent_ptr](reinterpret_cast[facility_ptr](avoid))
3355 * else:
3356 * rtn = dynamic_cast[agent_ptr](reinterpret_cast[agent_ptr](avoid)) # <<<<<<<<<<<<<<
3357 * PyErr_CheckSignals()
3358 * return rtn
3359 */
3360 /*else*/ {
3361 try {
3362 __pyx_t_9 = dynamic_cast<__pyx_t_8pymodule_agent_ptr>(reinterpret_cast<__pyx_t_8pymodule_agent_ptr>(__pyx_v_avoid));
3363 } catch(...) {
3364 __Pyx_CppExn2PyErr();
3365 __PYX_ERR(0, 55, __pyx_L1_error)
3366 }
3367 __pyx_v_rtn = __pyx_t_9;
3368 }
3369 __pyx_L5:;
3370
3371 /* "pymodule.pyx":56
3372 * else:
3373 * rtn = dynamic_cast[agent_ptr](reinterpret_cast[agent_ptr](avoid))
3374 * PyErr_CheckSignals() # <<<<<<<<<<<<<<
3375 * return rtn
3376 *
3377 */
3378 __pyx_t_10 = PyErr_CheckSignals(); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 56, __pyx_L1_error)
3379
3380 /* "pymodule.pyx":57
3381 * rtn = dynamic_cast[agent_ptr](reinterpret_cast[agent_ptr](avoid))
3382 * PyErr_CheckSignals()
3383 * return rtn # <<<<<<<<<<<<<<
3384 *
3385 *
3386 */
3387 __pyx_r = __pyx_v_rtn;
3388 goto __pyx_L0;
3389
3390 /* "pymodule.pyx":38
3391 *
3392 *
3393 * cdef public api Agent* make_py_agent "CyclusMakePyAgent" (std_string cpp_lib, # <<<<<<<<<<<<<<
3394 * std_string cpp_agent,
3395 * void* cpp_ctx) except *:
3396 */
3397
3398 /* function exit code */
3399 __pyx_L1_error:;
3400 __Pyx_XDECREF(__pyx_t_1);
3401 __Pyx_XDECREF(__pyx_t_2);
3402 __Pyx_XDECREF(__pyx_t_3);
3403 __Pyx_XDECREF(__pyx_t_5);
3404 __Pyx_AddTraceback("pymodule.make_py_agent", __pyx_clineno, __pyx_lineno, __pyx_filename);
3405 __pyx_r = NULL;
3406 __pyx_L0:;
3407 __Pyx_XDECREF(__pyx_v_libname);
3408 __Pyx_XDECREF(__pyx_v_agentname);
3409 __Pyx_XDECREF(__pyx_v_ctx);
3410 __Pyx_XDECREF(__pyx_v_a);
3411 __Pyx_XDECREF(__pyx_v_kind);
3412 __Pyx_RefNannyFinishContext();
3413 return __pyx_r;
3414}
3415
3416/* "pymodule.pyx":60
3417 *
3418 *
3419 * cdef public api void init_from_py_agent "CyclusInitFromPyAgent" (Agent* cpp_src, # <<<<<<<<<<<<<<
3420 * Agent* cpp_dst,
3421 * void* cpp_ctx) except *:
3422 */
3423
3424void CyclusInitFromPyAgent(cyclus::Agent *__pyx_v_cpp_src, cyclus::Agent *__pyx_v_cpp_dst, void *__pyx_v_cpp_ctx) {
3425 PyObject *__pyx_v_ctx = NULL;
3426 PyObject *__pyx_v_src = NULL;
3427 PyObject *__pyx_v_dst = NULL;
3428 PyObject *__pyx_v_py_src = NULL;
3429 PyObject *__pyx_v_py_dst = NULL;
3430 __Pyx_RefNannyDeclarations
3431 PyObject *__pyx_t_1 = NULL;
3432 PyObject *__pyx_t_2 = NULL;
3433 PyObject *__pyx_t_3 = NULL;
3434 unsigned int __pyx_t_4;
3435 int __pyx_t_5;
3436 int __pyx_lineno = 0;
3437 const char *__pyx_filename = NULL;
3438 int __pyx_clineno = 0;
3439 __Pyx_RefNannySetupContext("init_from_py_agent", 1);
3440
3441 /* "pymodule.pyx":66
3442 * normally need to call this. Useful for cloning prototypes.
3443 * """
3444 * ctx = PyCapsule_New(cpp_ctx, <char*> b"ctx", NULL) # <<<<<<<<<<<<<<
3445 * src = PyCapsule_New(cpp_src, <char*> b"agent", NULL)
3446 * dst = PyCapsule_New(cpp_dst, <char*> b"agent", NULL)
3447 */
3448 __pyx_t_1 = PyCapsule_New(__pyx_v_cpp_ctx, ((char *)((char *)"ctx")), NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 66, __pyx_L1_error)
3449 __Pyx_GOTREF(__pyx_t_1);
3450 __pyx_v_ctx = __pyx_t_1;
3451 __pyx_t_1 = 0;
3452
3453 /* "pymodule.pyx":67
3454 * """
3455 * ctx = PyCapsule_New(cpp_ctx, <char*> b"ctx", NULL)
3456 * src = PyCapsule_New(cpp_src, <char*> b"agent", NULL) # <<<<<<<<<<<<<<
3457 * dst = PyCapsule_New(cpp_dst, <char*> b"agent", NULL)
3458 * py_src = cyclib.capsule_agent_to_py(src, ctx)
3459 */
3460 __pyx_t_1 = PyCapsule_New(__pyx_v_cpp_src, ((char *)((char *)"agent")), NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error)
3461 __Pyx_GOTREF(__pyx_t_1);
3462 __pyx_v_src = __pyx_t_1;
3463 __pyx_t_1 = 0;
3464
3465 /* "pymodule.pyx":68
3466 * ctx = PyCapsule_New(cpp_ctx, <char*> b"ctx", NULL)
3467 * src = PyCapsule_New(cpp_src, <char*> b"agent", NULL)
3468 * dst = PyCapsule_New(cpp_dst, <char*> b"agent", NULL) # <<<<<<<<<<<<<<
3469 * py_src = cyclib.capsule_agent_to_py(src, ctx)
3470 * py_dst = cyclib.capsule_agent_to_py(dst, ctx)
3471 */
3472 __pyx_t_1 = PyCapsule_New(__pyx_v_cpp_dst, ((char *)((char *)"agent")), NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error)
3473 __Pyx_GOTREF(__pyx_t_1);
3474 __pyx_v_dst = __pyx_t_1;
3475 __pyx_t_1 = 0;
3476
3477 /* "pymodule.pyx":69
3478 * src = PyCapsule_New(cpp_src, <char*> b"agent", NULL)
3479 * dst = PyCapsule_New(cpp_dst, <char*> b"agent", NULL)
3480 * py_src = cyclib.capsule_agent_to_py(src, ctx) # <<<<<<<<<<<<<<
3481 * py_dst = cyclib.capsule_agent_to_py(dst, ctx)
3482 * py_dst.init_from_agent(py_src)
3483 */
3484 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_cyclib); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __pyx_L1_error)
3485 __Pyx_GOTREF(__pyx_t_2);
3486 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_capsule_agent_to_py); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 69, __pyx_L1_error)
3487 __Pyx_GOTREF(__pyx_t_3);
3488 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3489 __pyx_t_2 = NULL;
3490 __pyx_t_4 = 0;
3491 #if CYTHON_UNPACK_METHODS
3492 if (unlikely(PyMethod_Check(__pyx_t_3))) {
3493 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
3494 if (likely(__pyx_t_2)) {
3495 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
3496 __Pyx_INCREF(__pyx_t_2);
3497 __Pyx_INCREF(function);
3498 __Pyx_DECREF_SET(__pyx_t_3, function);
3499 __pyx_t_4 = 1;
3500 }
3501 }
3502 #endif
3503 {
3504 PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_src, __pyx_v_ctx};
3505 __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 2+__pyx_t_4);
3506 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
3507 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error)
3508 __Pyx_GOTREF(__pyx_t_1);
3509 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3510 }
3511 __pyx_v_py_src = __pyx_t_1;
3512 __pyx_t_1 = 0;
3513
3514 /* "pymodule.pyx":70
3515 * dst = PyCapsule_New(cpp_dst, <char*> b"agent", NULL)
3516 * py_src = cyclib.capsule_agent_to_py(src, ctx)
3517 * py_dst = cyclib.capsule_agent_to_py(dst, ctx) # <<<<<<<<<<<<<<
3518 * py_dst.init_from_agent(py_src)
3519 * PyErr_CheckSignals()
3520 */
3521 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_cyclib); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 70, __pyx_L1_error)
3522 __Pyx_GOTREF(__pyx_t_3);
3523 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_capsule_agent_to_py); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 70, __pyx_L1_error)
3524 __Pyx_GOTREF(__pyx_t_2);
3525 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3526 __pyx_t_3 = NULL;
3527 __pyx_t_4 = 0;
3528 #if CYTHON_UNPACK_METHODS
3529 if (unlikely(PyMethod_Check(__pyx_t_2))) {
3530 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
3531 if (likely(__pyx_t_3)) {
3532 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
3533 __Pyx_INCREF(__pyx_t_3);
3534 __Pyx_INCREF(function);
3535 __Pyx_DECREF_SET(__pyx_t_2, function);
3536 __pyx_t_4 = 1;
3537 }
3538 }
3539 #endif
3540 {
3541 PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_dst, __pyx_v_ctx};
3542 __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 2+__pyx_t_4);
3543 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3544 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error)
3545 __Pyx_GOTREF(__pyx_t_1);
3546 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3547 }
3548 __pyx_v_py_dst = __pyx_t_1;
3549 __pyx_t_1 = 0;
3550
3551 /* "pymodule.pyx":71
3552 * py_src = cyclib.capsule_agent_to_py(src, ctx)
3553 * py_dst = cyclib.capsule_agent_to_py(dst, ctx)
3554 * py_dst.init_from_agent(py_src) # <<<<<<<<<<<<<<
3555 * PyErr_CheckSignals()
3556 *
3557 */
3558 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_py_dst, __pyx_n_s_init_from_agent); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 71, __pyx_L1_error)
3559 __Pyx_GOTREF(__pyx_t_2);
3560 __pyx_t_3 = NULL;
3561 __pyx_t_4 = 0;
3562 #if CYTHON_UNPACK_METHODS
3563 if (likely(PyMethod_Check(__pyx_t_2))) {
3564 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
3565 if (likely(__pyx_t_3)) {
3566 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
3567 __Pyx_INCREF(__pyx_t_3);
3568 __Pyx_INCREF(function);
3569 __Pyx_DECREF_SET(__pyx_t_2, function);
3570 __pyx_t_4 = 1;
3571 }
3572 }
3573 #endif
3574 {
3575 PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_py_src};
3576 __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
3577 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3578 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 71, __pyx_L1_error)
3579 __Pyx_GOTREF(__pyx_t_1);
3580 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3581 }
3582 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3583
3584 /* "pymodule.pyx":72
3585 * py_dst = cyclib.capsule_agent_to_py(dst, ctx)
3586 * py_dst.init_from_agent(py_src)
3587 * PyErr_CheckSignals() # <<<<<<<<<<<<<<
3588 *
3589 *
3590 */
3591 __pyx_t_5 = PyErr_CheckSignals(); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 72, __pyx_L1_error)
3592
3593 /* "pymodule.pyx":60
3594 *
3595 *
3596 * cdef public api void init_from_py_agent "CyclusInitFromPyAgent" (Agent* cpp_src, # <<<<<<<<<<<<<<
3597 * Agent* cpp_dst,
3598 * void* cpp_ctx) except *:
3599 */
3600
3601 /* function exit code */
3602 goto __pyx_L0;
3603 __pyx_L1_error:;
3604 __Pyx_XDECREF(__pyx_t_1);
3605 __Pyx_XDECREF(__pyx_t_2);
3606 __Pyx_XDECREF(__pyx_t_3);
3607 __Pyx_AddTraceback("pymodule.init_from_py_agent", __pyx_clineno, __pyx_lineno, __pyx_filename);
3608 __pyx_L0:;
3609 __Pyx_XDECREF(__pyx_v_ctx);
3610 __Pyx_XDECREF(__pyx_v_src);
3611 __Pyx_XDECREF(__pyx_v_dst);
3612 __Pyx_XDECREF(__pyx_v_py_src);
3613 __Pyx_XDECREF(__pyx_v_py_dst);
3614 __Pyx_RefNannyFinishContext();
3615}
3616
3617/* "pymodule.pyx":75
3618 *
3619 *
3620 * cdef public api void clear_pyagent_refs "CyclusClearPyAgentRefs" () except *: # <<<<<<<<<<<<<<
3621 * """Clears the cache of agent referencess"""
3622 * cyclib._clear_agent_refs()
3623 */
3624
3625void CyclusClearPyAgentRefs(void) {
3626 __Pyx_RefNannyDeclarations
3627 PyObject *__pyx_t_1 = NULL;
3628 PyObject *__pyx_t_2 = NULL;
3629 PyObject *__pyx_t_3 = NULL;
3630 unsigned int __pyx_t_4;
3631 int __pyx_t_5;
3632 int __pyx_lineno = 0;
3633 const char *__pyx_filename = NULL;
3634 int __pyx_clineno = 0;
3635 __Pyx_RefNannySetupContext("clear_pyagent_refs", 1);
3636
3637 /* "pymodule.pyx":77
3638 * cdef public api void clear_pyagent_refs "CyclusClearPyAgentRefs" () except *:
3639 * """Clears the cache of agent referencess"""
3640 * cyclib._clear_agent_refs() # <<<<<<<<<<<<<<
3641 * PyErr_CheckSignals()
3642 *
3643 */
3644 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_cyclib); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 77, __pyx_L1_error)
3645 __Pyx_GOTREF(__pyx_t_2);
3646 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_clear_agent_refs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 77, __pyx_L1_error)
3647 __Pyx_GOTREF(__pyx_t_3);
3648 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3649 __pyx_t_2 = NULL;
3650 __pyx_t_4 = 0;
3651 #if CYTHON_UNPACK_METHODS
3652 if (unlikely(PyMethod_Check(__pyx_t_3))) {
3653 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
3654 if (likely(__pyx_t_2)) {
3655 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
3656 __Pyx_INCREF(__pyx_t_2);
3657 __Pyx_INCREF(function);
3658 __Pyx_DECREF_SET(__pyx_t_3, function);
3659 __pyx_t_4 = 1;
3660 }
3661 }
3662 #endif
3663 {
3664 PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
3665 __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
3666 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
3667 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 77, __pyx_L1_error)
3668 __Pyx_GOTREF(__pyx_t_1);
3669 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3670 }
3671 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3672
3673 /* "pymodule.pyx":78
3674 * """Clears the cache of agent referencess"""
3675 * cyclib._clear_agent_refs()
3676 * PyErr_CheckSignals() # <<<<<<<<<<<<<<
3677 *
3678 *
3679 */
3680 __pyx_t_5 = PyErr_CheckSignals(); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 78, __pyx_L1_error)
3681
3682 /* "pymodule.pyx":75
3683 *
3684 *
3685 * cdef public api void clear_pyagent_refs "CyclusClearPyAgentRefs" () except *: # <<<<<<<<<<<<<<
3686 * """Clears the cache of agent referencess"""
3687 * cyclib._clear_agent_refs()
3688 */
3689
3690 /* function exit code */
3691 goto __pyx_L0;
3692 __pyx_L1_error:;
3693 __Pyx_XDECREF(__pyx_t_1);
3694 __Pyx_XDECREF(__pyx_t_2);
3695 __Pyx_XDECREF(__pyx_t_3);
3696 __Pyx_AddTraceback("pymodule.clear_pyagent_refs", __pyx_clineno, __pyx_lineno, __pyx_filename);
3697 __pyx_L0:;
3698 __Pyx_RefNannyFinishContext();
3699}
3700
3701/* "pymodule.pyx":81
3702 *
3703 *
3704 * cdef public api void py_del_agent "CyclusPyDelAgent" (int i) except *: # <<<<<<<<<<<<<<
3705 * """Clears the cache of a single agent ref"""
3706 * cyclib._del_agent(i)
3707 */
3708
3709void CyclusPyDelAgent(int __pyx_v_i) {
3710 __Pyx_RefNannyDeclarations
3711 PyObject *__pyx_t_1 = NULL;
3712 PyObject *__pyx_t_2 = NULL;
3713 PyObject *__pyx_t_3 = NULL;
3714 PyObject *__pyx_t_4 = NULL;
3715 unsigned int __pyx_t_5;
3716 int __pyx_t_6;
3717 int __pyx_lineno = 0;
3718 const char *__pyx_filename = NULL;
3719 int __pyx_clineno = 0;
3720 __Pyx_RefNannySetupContext("py_del_agent", 1);
3721
3722 /* "pymodule.pyx":83
3723 * cdef public api void py_del_agent "CyclusPyDelAgent" (int i) except *:
3724 * """Clears the cache of a single agent ref"""
3725 * cyclib._del_agent(i) # <<<<<<<<<<<<<<
3726 * PyErr_CheckSignals()
3727 *
3728 */
3729 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_cyclib); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __pyx_L1_error)
3730 __Pyx_GOTREF(__pyx_t_2);
3731 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_del_agent); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 83, __pyx_L1_error)
3732 __Pyx_GOTREF(__pyx_t_3);
3733 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3734 __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __pyx_L1_error)
3735 __Pyx_GOTREF(__pyx_t_2);
3736 __pyx_t_4 = NULL;
3737 __pyx_t_5 = 0;
3738 #if CYTHON_UNPACK_METHODS
3739 if (unlikely(PyMethod_Check(__pyx_t_3))) {
3740 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
3741 if (likely(__pyx_t_4)) {
3742 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
3743 __Pyx_INCREF(__pyx_t_4);
3744 __Pyx_INCREF(function);
3745 __Pyx_DECREF_SET(__pyx_t_3, function);
3746 __pyx_t_5 = 1;
3747 }
3748 }
3749 #endif
3750 {
3751 PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_2};
3752 __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
3753 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
3754 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3755 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L1_error)
3756 __Pyx_GOTREF(__pyx_t_1);
3757 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3758 }
3759 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3760
3761 /* "pymodule.pyx":84
3762 * """Clears the cache of a single agent ref"""
3763 * cyclib._del_agent(i)
3764 * PyErr_CheckSignals() # <<<<<<<<<<<<<<
3765 *
3766 *
3767 */
3768 __pyx_t_6 = PyErr_CheckSignals(); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 84, __pyx_L1_error)
3769
3770 /* "pymodule.pyx":81
3771 *
3772 *
3773 * cdef public api void py_del_agent "CyclusPyDelAgent" (int i) except *: # <<<<<<<<<<<<<<
3774 * """Clears the cache of a single agent ref"""
3775 * cyclib._del_agent(i)
3776 */
3777
3778 /* function exit code */
3779 goto __pyx_L0;
3780 __pyx_L1_error:;
3781 __Pyx_XDECREF(__pyx_t_1);
3782 __Pyx_XDECREF(__pyx_t_2);
3783 __Pyx_XDECREF(__pyx_t_3);
3784 __Pyx_XDECREF(__pyx_t_4);
3785 __Pyx_AddTraceback("pymodule.py_del_agent", __pyx_clineno, __pyx_lineno, __pyx_filename);
3786 __pyx_L0:;
3787 __Pyx_RefNannyFinishContext();
3788}
3789
3790/* "pymodule.pyx":87
3791 *
3792 *
3793 * cdef public api void py_call_listeners "CyclusPyCallListeners" (std_string cpp_tsname, # <<<<<<<<<<<<<<
3794 * Agent* cpp_agent, void* cpp_ctx, int time, hold_any cpp_value) except *:
3795 * """Calls the python time series listeners
3796 */
3797
3798void CyclusPyCallListeners(std::string __pyx_v_cpp_tsname, cyclus::Agent *__pyx_v_cpp_agent, void *__pyx_v_cpp_ctx, int __pyx_v_time, boost::spirit::hold_any __pyx_v_cpp_value) {
3799 PyObject *__pyx_v_ctx = NULL;
3800 PyObject *__pyx_v_agent = NULL;
3801 PyObject *__pyx_v_value = NULL;
3802 PyObject *__pyx_v_py_tsname = NULL;
3803 PyObject *__pyx_v_py_agent = NULL;
3804 PyObject *__pyx_v_py_value = NULL;
3805 __Pyx_RefNannyDeclarations
3806 PyObject *__pyx_t_1 = NULL;
3807 PyObject *__pyx_t_2 = NULL;
3808 PyObject *__pyx_t_3 = NULL;
3809 unsigned int __pyx_t_4;
3810 PyObject *__pyx_t_5 = NULL;
3811 int __pyx_t_6;
3812 int __pyx_lineno = 0;
3813 const char *__pyx_filename = NULL;
3814 int __pyx_clineno = 0;
3815 __Pyx_RefNannySetupContext("py_call_listeners", 1);
3816
3817 /* "pymodule.pyx":91
3818 * """Calls the python time series listeners
3819 * """
3820 * ctx = PyCapsule_New(cpp_ctx, <char*> b"ctx", NULL) # <<<<<<<<<<<<<<
3821 * agent = PyCapsule_New(cpp_agent, <char*> b"agent", NULL)
3822 * value = PyCapsule_New(&cpp_value, <char*> b"value", NULL)
3823 */
3824 __pyx_t_1 = PyCapsule_New(__pyx_v_cpp_ctx, ((char *)((char *)"ctx")), NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error)
3825 __Pyx_GOTREF(__pyx_t_1);
3826 __pyx_v_ctx = __pyx_t_1;
3827 __pyx_t_1 = 0;
3828
3829 /* "pymodule.pyx":92
3830 * """
3831 * ctx = PyCapsule_New(cpp_ctx, <char*> b"ctx", NULL)
3832 * agent = PyCapsule_New(cpp_agent, <char*> b"agent", NULL) # <<<<<<<<<<<<<<
3833 * value = PyCapsule_New(&cpp_value, <char*> b"value", NULL)
3834 * py_tsname = std_string_to_py(cpp_tsname)
3835 */
3836 __pyx_t_1 = PyCapsule_New(__pyx_v_cpp_agent, ((char *)((char *)"agent")), NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 92, __pyx_L1_error)
3837 __Pyx_GOTREF(__pyx_t_1);
3838 __pyx_v_agent = __pyx_t_1;
3839 __pyx_t_1 = 0;
3840
3841 /* "pymodule.pyx":93
3842 * ctx = PyCapsule_New(cpp_ctx, <char*> b"ctx", NULL)
3843 * agent = PyCapsule_New(cpp_agent, <char*> b"agent", NULL)
3844 * value = PyCapsule_New(&cpp_value, <char*> b"value", NULL) # <<<<<<<<<<<<<<
3845 * py_tsname = std_string_to_py(cpp_tsname)
3846 * py_agent = cyclib.capsule_agent_to_py(agent, ctx)
3847 */
3848 __pyx_t_1 = PyCapsule_New((&__pyx_v_cpp_value), ((char *)((char *)"value")), NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 93, __pyx_L1_error)
3849 __Pyx_GOTREF(__pyx_t_1);
3850 __pyx_v_value = __pyx_t_1;
3851 __pyx_t_1 = 0;
3852
3853 /* "pymodule.pyx":94
3854 * agent = PyCapsule_New(cpp_agent, <char*> b"agent", NULL)
3855 * value = PyCapsule_New(&cpp_value, <char*> b"value", NULL)
3856 * py_tsname = std_string_to_py(cpp_tsname) # <<<<<<<<<<<<<<
3857 * py_agent = cyclib.capsule_agent_to_py(agent, ctx)
3858 * py_value = ts.capsule_any_to_py(value)
3859 */
3860 __pyx_t_1 = __pyx_f_8pymodule_std_string_to_py(__pyx_v_cpp_tsname); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 94, __pyx_L1_error)
3861 __Pyx_GOTREF(__pyx_t_1);
3862 __pyx_v_py_tsname = __pyx_t_1;
3863 __pyx_t_1 = 0;
3864
3865 /* "pymodule.pyx":95
3866 * value = PyCapsule_New(&cpp_value, <char*> b"value", NULL)
3867 * py_tsname = std_string_to_py(cpp_tsname)
3868 * py_agent = cyclib.capsule_agent_to_py(agent, ctx) # <<<<<<<<<<<<<<
3869 * py_value = ts.capsule_any_to_py(value)
3870 * cyclib.call_listeners(py_tsname, py_agent, time, py_value)
3871 */
3872 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_cyclib); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 95, __pyx_L1_error)
3873 __Pyx_GOTREF(__pyx_t_2);
3874 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_capsule_agent_to_py); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 95, __pyx_L1_error)
3875 __Pyx_GOTREF(__pyx_t_3);
3876 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3877 __pyx_t_2 = NULL;
3878 __pyx_t_4 = 0;
3879 #if CYTHON_UNPACK_METHODS
3880 if (unlikely(PyMethod_Check(__pyx_t_3))) {
3881 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
3882 if (likely(__pyx_t_2)) {
3883 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
3884 __Pyx_INCREF(__pyx_t_2);
3885 __Pyx_INCREF(function);
3886 __Pyx_DECREF_SET(__pyx_t_3, function);
3887 __pyx_t_4 = 1;
3888 }
3889 }
3890 #endif
3891 {
3892 PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_agent, __pyx_v_ctx};
3893 __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 2+__pyx_t_4);
3894 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
3895 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 95, __pyx_L1_error)
3896 __Pyx_GOTREF(__pyx_t_1);
3897 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3898 }
3899 __pyx_v_py_agent = __pyx_t_1;
3900 __pyx_t_1 = 0;
3901
3902 /* "pymodule.pyx":96
3903 * py_tsname = std_string_to_py(cpp_tsname)
3904 * py_agent = cyclib.capsule_agent_to_py(agent, ctx)
3905 * py_value = ts.capsule_any_to_py(value) # <<<<<<<<<<<<<<
3906 * cyclib.call_listeners(py_tsname, py_agent, time, py_value)
3907 * PyErr_CheckSignals()
3908 */
3909 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_ts); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 96, __pyx_L1_error)
3910 __Pyx_GOTREF(__pyx_t_3);
3911 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_capsule_any_to_py); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 96, __pyx_L1_error)
3912 __Pyx_GOTREF(__pyx_t_2);
3913 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3914 __pyx_t_3 = NULL;
3915 __pyx_t_4 = 0;
3916 #if CYTHON_UNPACK_METHODS
3917 if (unlikely(PyMethod_Check(__pyx_t_2))) {
3918 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
3919 if (likely(__pyx_t_3)) {
3920 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
3921 __Pyx_INCREF(__pyx_t_3);
3922 __Pyx_INCREF(function);
3923 __Pyx_DECREF_SET(__pyx_t_2, function);
3924 __pyx_t_4 = 1;
3925 }
3926 }
3927 #endif
3928 {
3929 PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_value};
3930 __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
3931 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3932 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error)
3933 __Pyx_GOTREF(__pyx_t_1);
3934 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3935 }
3936 __pyx_v_py_value = __pyx_t_1;
3937 __pyx_t_1 = 0;
3938
3939 /* "pymodule.pyx":97
3940 * py_agent = cyclib.capsule_agent_to_py(agent, ctx)
3941 * py_value = ts.capsule_any_to_py(value)
3942 * cyclib.call_listeners(py_tsname, py_agent, time, py_value) # <<<<<<<<<<<<<<
3943 * PyErr_CheckSignals()
3944 */
3945 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_cyclib); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 97, __pyx_L1_error)
3946 __Pyx_GOTREF(__pyx_t_2);
3947 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_call_listeners); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 97, __pyx_L1_error)
3948 __Pyx_GOTREF(__pyx_t_3);
3949 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3950 __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_time); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 97, __pyx_L1_error)
3951 __Pyx_GOTREF(__pyx_t_2);
3952 __pyx_t_5 = NULL;
3953 __pyx_t_4 = 0;
3954 #if CYTHON_UNPACK_METHODS
3955 if (unlikely(PyMethod_Check(__pyx_t_3))) {
3956 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
3957 if (likely(__pyx_t_5)) {
3958 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
3959 __Pyx_INCREF(__pyx_t_5);
3960 __Pyx_INCREF(function);
3961 __Pyx_DECREF_SET(__pyx_t_3, function);
3962 __pyx_t_4 = 1;
3963 }
3964 }
3965 #endif
3966 {
3967 PyObject *__pyx_callargs[5] = {__pyx_t_5, __pyx_v_py_tsname, __pyx_v_py_agent, __pyx_t_2, __pyx_v_py_value};
3968 __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 4+__pyx_t_4);
3969 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
3970 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3971 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error)
3972 __Pyx_GOTREF(__pyx_t_1);
3973 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3974 }
3975 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3976
3977 /* "pymodule.pyx":98
3978 * py_value = ts.capsule_any_to_py(value)
3979 * cyclib.call_listeners(py_tsname, py_agent, time, py_value)
3980 * PyErr_CheckSignals() # <<<<<<<<<<<<<<
3981 */
3982 __pyx_t_6 = PyErr_CheckSignals(); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 98, __pyx_L1_error)
3983
3984 /* "pymodule.pyx":87
3985 *
3986 *
3987 * cdef public api void py_call_listeners "CyclusPyCallListeners" (std_string cpp_tsname, # <<<<<<<<<<<<<<
3988 * Agent* cpp_agent, void* cpp_ctx, int time, hold_any cpp_value) except *:
3989 * """Calls the python time series listeners
3990 */
3991
3992 /* function exit code */
3993 goto __pyx_L0;
3994 __pyx_L1_error:;
3995 __Pyx_XDECREF(__pyx_t_1);
3996 __Pyx_XDECREF(__pyx_t_2);
3997 __Pyx_XDECREF(__pyx_t_3);
3998 __Pyx_XDECREF(__pyx_t_5);
3999 __Pyx_AddTraceback("pymodule.py_call_listeners", __pyx_clineno, __pyx_lineno, __pyx_filename);
4000 __pyx_L0:;
4001 __Pyx_XDECREF(__pyx_v_ctx);
4002 __Pyx_XDECREF(__pyx_v_agent);
4003 __Pyx_XDECREF(__pyx_v_value);
4004 __Pyx_XDECREF(__pyx_v_py_tsname);
4005 __Pyx_XDECREF(__pyx_v_py_agent);
4006 __Pyx_XDECREF(__pyx_v_py_value);
4007 __Pyx_RefNannyFinishContext();
4008}
4009
4010static PyMethodDef __pyx_methods[] = {
4011 {0, 0, 0, 0}
4012};
4013#ifndef CYTHON_SMALL_CODE
4014#if defined(__clang__)
4015 #define CYTHON_SMALL_CODE
4016#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
4017 #define CYTHON_SMALL_CODE __attribute__((cold))
4018#else
4019 #define CYTHON_SMALL_CODE
4020#endif
4021#endif
4022/* #### Code section: pystring_table ### */
4023
4024static int __Pyx_CreateStringTabAndInitStrings(void) {
4025 __Pyx_StringTabEntry __pyx_string_tab[] = {
4026 {&__pyx_kp_u_, __pyx_k_, sizeof(__pyx_k_), 0, 1, 0, 0},
4027 {&__pyx_n_u_Facility, __pyx_k_Facility, sizeof(__pyx_k_Facility), 0, 1, 0, 1},
4028 {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
4029 {&__pyx_n_u_Inst, __pyx_k_Inst, sizeof(__pyx_k_Inst), 0, 1, 0, 1},
4030 {&__pyx_n_u_Region, __pyx_k_Region, sizeof(__pyx_k_Region), 0, 1, 0, 1},
4031 {&__pyx_n_s__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 0, 1, 1},
4032 {&__pyx_n_s__5, __pyx_k__5, sizeof(__pyx_k__5), 0, 0, 1, 1},
4033 {&__pyx_n_s_call_listeners, __pyx_k_call_listeners, sizeof(__pyx_k_call_listeners), 0, 0, 1, 1},
4034 {&__pyx_n_s_capsule_agent_to_py, __pyx_k_capsule_agent_to_py, sizeof(__pyx_k_capsule_agent_to_py), 0, 0, 1, 1},
4035 {&__pyx_n_s_capsule_any_to_py, __pyx_k_capsule_any_to_py, sizeof(__pyx_k_capsule_any_to_py), 0, 0, 1, 1},
4036 {&__pyx_n_s_clear_agent_refs, __pyx_k_clear_agent_refs, sizeof(__pyx_k_clear_agent_refs), 0, 0, 1, 1},
4037 {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
4038 {&__pyx_n_s_cyclib, __pyx_k_cyclib, sizeof(__pyx_k_cyclib), 0, 0, 1, 1},
4039 {&__pyx_n_s_cyclus, __pyx_k_cyclus, sizeof(__pyx_k_cyclus), 0, 0, 1, 1},
4040 {&__pyx_n_s_cyclus_lib, __pyx_k_cyclus_lib, sizeof(__pyx_k_cyclus_lib), 0, 0, 1, 1},
4041 {&__pyx_n_s_cyclus_typesystem, __pyx_k_cyclus_typesystem, sizeof(__pyx_k_cyclus_typesystem), 0, 0, 1, 1},
4042 {&__pyx_n_s_decode, __pyx_k_decode, sizeof(__pyx_k_decode), 0, 0, 1, 1},
4043 {&__pyx_n_s_del_agent, __pyx_k_del_agent, sizeof(__pyx_k_del_agent), 0, 0, 1, 1},
4044 {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
4045 {&__pyx_n_s_file, __pyx_k_file, sizeof(__pyx_k_file), 0, 0, 1, 1},
4046 {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
4047 {&__pyx_n_s_import_module, __pyx_k_import_module, sizeof(__pyx_k_import_module), 0, 0, 1, 1},
4048 {&__pyx_n_s_importlib, __pyx_k_importlib, sizeof(__pyx_k_importlib), 0, 0, 1, 1},
4049 {&__pyx_n_s_init_from_agent, __pyx_k_init_from_agent, sizeof(__pyx_k_init_from_agent), 0, 0, 1, 1},
4050 {&__pyx_n_s_initializing, __pyx_k_initializing, sizeof(__pyx_k_initializing), 0, 0, 1, 1},
4051 {&__pyx_n_s_lib, __pyx_k_lib, sizeof(__pyx_k_lib), 0, 0, 1, 1},
4052 {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
4053 {&__pyx_n_s_make_py_agent, __pyx_k_make_py_agent, sizeof(__pyx_k_make_py_agent), 0, 0, 1, 1},
4054 {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
4055 {&__pyx_kp_u_py, __pyx_k_py, sizeof(__pyx_k_py), 0, 1, 0, 0},
4056 {&__pyx_n_s_spec, __pyx_k_spec, sizeof(__pyx_k_spec), 0, 0, 1, 1},
4057 {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
4058 {&__pyx_n_s_ts, __pyx_k_ts, sizeof(__pyx_k_ts), 0, 0, 1, 1},
4059 {&__pyx_n_s_typesystem, __pyx_k_typesystem, sizeof(__pyx_k_typesystem), 0, 0, 1, 1},
4060 {0, 0, 0, 0, 0, 0, 0}
4061 };
4062 return __Pyx_InitStrings(__pyx_string_tab);
4063}
4064/* #### Code section: cached_builtins ### */
4065static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
4066 __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(0, 31, __pyx_L1_error)
4067 return 0;
4068 __pyx_L1_error:;
4069 return -1;
4070}
4071/* #### Code section: cached_constants ### */
4072
4073static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
4074 __Pyx_RefNannyDeclarations
4075 __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
4076
4077 /* "pymodule.pyx":10
4078 * from importlib import import_module
4079 *
4080 * import cyclus.lib as cyclib # <<<<<<<<<<<<<<
4081 * import cyclus.typesystem as ts
4082 *
4083 */
4084 __pyx_tuple__2 = PyTuple_Pack(2, __pyx_n_s_cyclus, __pyx_n_s_lib); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 10, __pyx_L1_error)
4085 __Pyx_GOTREF(__pyx_tuple__2);
4086 __Pyx_GIVEREF(__pyx_tuple__2);
4087
4088 /* "pymodule.pyx":11
4089 *
4090 * import cyclus.lib as cyclib
4091 * import cyclus.typesystem as ts # <<<<<<<<<<<<<<
4092 *
4093 * cdef object std_string_to_py(std_string x):
4094 */
4095 __pyx_tuple__4 = PyTuple_Pack(2, __pyx_n_s_cyclus, __pyx_n_s_typesystem); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 11, __pyx_L1_error)
4096 __Pyx_GOTREF(__pyx_tuple__4);
4097 __Pyx_GIVEREF(__pyx_tuple__4);
4098 __Pyx_RefNannyFinishContext();
4099 return 0;
4100 __pyx_L1_error:;
4101 __Pyx_RefNannyFinishContext();
4102 return -1;
4103}
4104/* #### Code section: init_constants ### */
4105
4106static CYTHON_SMALL_CODE int __Pyx_InitConstants(void) {
4107 if (__Pyx_CreateStringTabAndInitStrings() < 0) __PYX_ERR(0, 1, __pyx_L1_error);
4108 return 0;
4109 __pyx_L1_error:;
4110 return -1;
4111}
4112/* #### Code section: init_globals ### */
4113
4114static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
4115 return 0;
4116}
4117/* #### Code section: init_module ### */
4118
4119static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
4120static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
4121static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
4122static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
4123static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
4124static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
4125static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
4126
4127static int __Pyx_modinit_global_init_code(void) {
4128 __Pyx_RefNannyDeclarations
4129 __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
4130 /*--- Global init code ---*/
4131 __Pyx_RefNannyFinishContext();
4132 return 0;
4133}
4134
4135static int __Pyx_modinit_variable_export_code(void) {
4136 __Pyx_RefNannyDeclarations
4137 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
4138 /*--- Variable export code ---*/
4139 __Pyx_RefNannyFinishContext();
4140 return 0;
4141}
4142
4143static int __Pyx_modinit_function_export_code(void) {
4144 __Pyx_RefNannyDeclarations
4145 int __pyx_lineno = 0;
4146 const char *__pyx_filename = NULL;
4147 int __pyx_clineno = 0;
4148 __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
4149 /*--- Function export code ---*/
4150 if (__Pyx_ExportFunction("str_py_to_cpp", (void (*)(void))__pyx_f_8pymodule_str_py_to_cpp, "std::string (PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4151 if (__Pyx_ExportFunction("std_string_to_py", (void (*)(void))__pyx_f_8pymodule_std_string_to_py, "PyObject *(std::string)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4152 if (__Pyx_ExportFunction("py_find_module", (void (*)(void))CyclusPyFindModule, "std::string (std::string)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4153 if (__Pyx_ExportFunction("make_py_agent", (void (*)(void))CyclusMakePyAgent, "cyclus::Agent *(std::string, std::string, void *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4154 if (__Pyx_ExportFunction("init_from_py_agent", (void (*)(void))CyclusInitFromPyAgent, "void (cyclus::Agent *, cyclus::Agent *, void *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4155 if (__Pyx_ExportFunction("clear_pyagent_refs", (void (*)(void))CyclusClearPyAgentRefs, "void (void)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4156 if (__Pyx_ExportFunction("py_del_agent", (void (*)(void))CyclusPyDelAgent, "void (int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4157 if (__Pyx_ExportFunction("py_call_listeners", (void (*)(void))CyclusPyCallListeners, "void (std::string, cyclus::Agent *, void *, int, boost::spirit::hold_any)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4158 __Pyx_RefNannyFinishContext();
4159 return 0;
4160 __pyx_L1_error:;
4161 __Pyx_RefNannyFinishContext();
4162 return -1;
4163}
4164
4165static int __Pyx_modinit_type_init_code(void) {
4166 __Pyx_RefNannyDeclarations
4167 __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
4168 /*--- Type init code ---*/
4169 __Pyx_RefNannyFinishContext();
4170 return 0;
4171}
4172
4173static int __Pyx_modinit_type_import_code(void) {
4174 __Pyx_RefNannyDeclarations
4175 PyObject *__pyx_t_1 = NULL;
4176 int __pyx_lineno = 0;
4177 const char *__pyx_filename = NULL;
4178 int __pyx_clineno = 0;
4179 __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
4180 /*--- Type import code ---*/
4181 __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 9, __pyx_L1_error)
4182 __Pyx_GOTREF(__pyx_t_1);
4183 __pyx_ptype_7cpython_4type_type = __Pyx_ImportType_3_0_11(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
4184 #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
4185 sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(PyTypeObject),
4186 #elif CYTHON_COMPILING_IN_LIMITED_API
4187 sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(PyTypeObject),
4188 #else
4189 sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(PyHeapTypeObject),
4190 #endif
4191 __Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(2, 9, __pyx_L1_error)
4192 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4193 __Pyx_RefNannyFinishContext();
4194 return 0;
4195 __pyx_L1_error:;
4196 __Pyx_XDECREF(__pyx_t_1);
4197 __Pyx_RefNannyFinishContext();
4198 return -1;
4199}
4200
4201static int __Pyx_modinit_variable_import_code(void) {
4202 __Pyx_RefNannyDeclarations
4203 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
4204 /*--- Variable import code ---*/
4205 __Pyx_RefNannyFinishContext();
4206 return 0;
4207}
4208
4209static int __Pyx_modinit_function_import_code(void) {
4210 __Pyx_RefNannyDeclarations
4211 __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
4212 /*--- Function import code ---*/
4213 __Pyx_RefNannyFinishContext();
4214 return 0;
4215}
4216
4217
4218#if PY_MAJOR_VERSION >= 3
4219#if CYTHON_PEP489_MULTI_PHASE_INIT
4220static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
4221static int __pyx_pymod_exec_pymodule(PyObject* module); /*proto*/
4222static PyModuleDef_Slot __pyx_moduledef_slots[] = {
4223 {Py_mod_create, (void*)__pyx_pymod_create},
4224 {Py_mod_exec, (void*)__pyx_pymod_exec_pymodule},
4225 {0, NULL}
4226};
4227#endif
4228
4229#ifdef __cplusplus
4230namespace {
4231 struct PyModuleDef __pyx_moduledef =
4232 #else
4233 static struct PyModuleDef __pyx_moduledef =
4234 #endif
4235 {
4236 PyModuleDef_HEAD_INIT,
4237 "pymodule",
4238 __pyx_k_Cyclus_Python_module_loading_too, /* m_doc */
4239 #if CYTHON_PEP489_MULTI_PHASE_INIT
4240 0, /* m_size */
4241 #elif CYTHON_USE_MODULE_STATE
4242 sizeof(__pyx_mstate), /* m_size */
4243 #else
4244 -1, /* m_size */
4245 #endif
4246 __pyx_methods /* m_methods */,
4247 #if CYTHON_PEP489_MULTI_PHASE_INIT
4248 __pyx_moduledef_slots, /* m_slots */
4249 #else
4250 NULL, /* m_reload */
4251 #endif
4252 #if CYTHON_USE_MODULE_STATE
4253 __pyx_m_traverse, /* m_traverse */
4254 __pyx_m_clear, /* m_clear */
4255 NULL /* m_free */
4256 #else
4257 NULL, /* m_traverse */
4258 NULL, /* m_clear */
4259 NULL /* m_free */
4260 #endif
4261 };
4262 #ifdef __cplusplus
4263} /* anonymous namespace */
4264#endif
4265#endif
4266
4267#ifndef CYTHON_NO_PYINIT_EXPORT
4268#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
4269#elif PY_MAJOR_VERSION < 3
4270#ifdef __cplusplus
4271#define __Pyx_PyMODINIT_FUNC extern "C" void
4272#else
4273#define __Pyx_PyMODINIT_FUNC void
4274#endif
4275#else
4276#ifdef __cplusplus
4277#define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
4278#else
4279#define __Pyx_PyMODINIT_FUNC PyObject *
4280#endif
4281#endif
4282
4283
4284#if PY_MAJOR_VERSION < 3
4285__Pyx_PyMODINIT_FUNC initpymodule(void) CYTHON_SMALL_CODE; /*proto*/
4286__Pyx_PyMODINIT_FUNC initpymodule(void)
4287#else
4288__Pyx_PyMODINIT_FUNC PyInit_pymodule(void) CYTHON_SMALL_CODE; /*proto*/
4289__Pyx_PyMODINIT_FUNC PyInit_pymodule(void)
4290#if CYTHON_PEP489_MULTI_PHASE_INIT
4291{
4292 return PyModuleDef_Init(&__pyx_moduledef);
4293}
4294static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
4295 #if PY_VERSION_HEX >= 0x030700A1
4296 static PY_INT64_T main_interpreter_id = -1;
4297 PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
4298 if (main_interpreter_id == -1) {
4299 main_interpreter_id = current_id;
4300 return (unlikely(current_id == -1)) ? -1 : 0;
4301 } else if (unlikely(main_interpreter_id != current_id))
4302 #else
4303 static PyInterpreterState *main_interpreter = NULL;
4304 PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
4305 if (!main_interpreter) {
4306 main_interpreter = current_interpreter;
4307 } else if (unlikely(main_interpreter != current_interpreter))
4308 #endif
4309 {
4310 PyErr_SetString(
4311 PyExc_ImportError,
4312 "Interpreter change detected - this module can only be loaded into one interpreter per process.");
4313 return -1;
4314 }
4315 return 0;
4316}
4317#if CYTHON_COMPILING_IN_LIMITED_API
4318static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *module, const char* from_name, const char* to_name, int allow_none)
4319#else
4320static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none)
4321#endif
4322{
4323 PyObject *value = PyObject_GetAttrString(spec, from_name);
4324 int result = 0;
4325 if (likely(value)) {
4326 if (allow_none || value != Py_None) {
4327#if CYTHON_COMPILING_IN_LIMITED_API
4328 result = PyModule_AddObject(module, to_name, value);
4329#else
4330 result = PyDict_SetItemString(moddict, to_name, value);
4331#endif
4332 }
4333 Py_DECREF(value);
4334 } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
4335 PyErr_Clear();
4336 } else {
4337 result = -1;
4338 }
4339 return result;
4340}
4341static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) {
4342 PyObject *module = NULL, *moddict, *modname;
4343 CYTHON_UNUSED_VAR(def);
4344 if (__Pyx_check_single_interpreter())
4345 return NULL;
4346 if (__pyx_m)
4347 return __Pyx_NewRef(__pyx_m);
4348 modname = PyObject_GetAttrString(spec, "name");
4349 if (unlikely(!modname)) goto bad;
4350 module = PyModule_NewObject(modname);
4351 Py_DECREF(modname);
4352 if (unlikely(!module)) goto bad;
4353#if CYTHON_COMPILING_IN_LIMITED_API
4354 moddict = module;
4355#else
4356 moddict = PyModule_GetDict(module);
4357 if (unlikely(!moddict)) goto bad;
4358#endif
4359 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
4360 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
4361 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
4362 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
4363 return module;
4364bad:
4365 Py_XDECREF(module);
4366 return NULL;
4367}
4368
4369
4370static CYTHON_SMALL_CODE int __pyx_pymod_exec_pymodule(PyObject *__pyx_pyinit_module)
4371#endif
4372#endif
4373{
4374 int stringtab_initialized = 0;
4375 #if CYTHON_USE_MODULE_STATE
4376 int pystate_addmodule_run = 0;
4377 #endif
4378 PyObject *__pyx_t_1 = NULL;
4379 PyObject *__pyx_t_2 = NULL;
4380 PyObject *__pyx_t_3 = NULL;
4381 int __pyx_lineno = 0;
4382 const char *__pyx_filename = NULL;
4383 int __pyx_clineno = 0;
4384 __Pyx_RefNannyDeclarations
4385 #if CYTHON_PEP489_MULTI_PHASE_INIT
4386 if (__pyx_m) {
4387 if (__pyx_m == __pyx_pyinit_module) return 0;
4388 PyErr_SetString(PyExc_RuntimeError, "Module 'pymodule' has already been imported. Re-initialisation is not supported.");
4389 return -1;
4390 }
4391 #elif PY_MAJOR_VERSION >= 3
4392 if (__pyx_m) return __Pyx_NewRef(__pyx_m);
4393 #endif
4394 /*--- Module creation code ---*/
4395 #if CYTHON_PEP489_MULTI_PHASE_INIT
4396 __pyx_m = __pyx_pyinit_module;
4397 Py_INCREF(__pyx_m);
4398 #else
4399 #if PY_MAJOR_VERSION < 3
4400 __pyx_m = Py_InitModule4("pymodule", __pyx_methods, __pyx_k_Cyclus_Python_module_loading_too, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
4401 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
4402 #elif CYTHON_USE_MODULE_STATE
4403 __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
4404 {
4405 int add_module_result = PyState_AddModule(__pyx_t_1, &__pyx_moduledef);
4406 __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to "pymodule" pseudovariable */
4407 if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
4408 pystate_addmodule_run = 1;
4409 }
4410 #else
4411 __pyx_m = PyModule_Create(&__pyx_moduledef);
4412 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
4413 #endif
4414 #endif
4415 CYTHON_UNUSED_VAR(__pyx_t_1);
4416 __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
4417 Py_INCREF(__pyx_d);
4418 __pyx_b = __Pyx_PyImport_AddModuleRef(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
4419 __pyx_cython_runtime = __Pyx_PyImport_AddModuleRef((const char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
4420 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4421 #if CYTHON_REFNANNY
4422__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
4423if (!__Pyx_RefNanny) {
4424 PyErr_Clear();
4425 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
4426 if (!__Pyx_RefNanny)
4427 Py_FatalError("failed to import 'refnanny' module");
4428}
4429#endif
4430 __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_pymodule(void)", 0);
4431 if (__Pyx_check_binary_version(__PYX_LIMITED_VERSION_HEX, __Pyx_get_runtime_version(), CYTHON_COMPILING_IN_LIMITED_API) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4432 #ifdef __Pxy_PyFrame_Initialize_Offsets
4433 __Pxy_PyFrame_Initialize_Offsets();
4434 #endif
4435 __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
4436 __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
4437 __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
4438 #ifdef __Pyx_CyFunction_USED
4439 if (__pyx_CyFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4440 #endif
4441 #ifdef __Pyx_FusedFunction_USED
4442 if (__pyx_FusedFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4443 #endif
4444 #ifdef __Pyx_Coroutine_USED
4445 if (__pyx_Coroutine_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4446 #endif
4447 #ifdef __Pyx_Generator_USED
4448 if (__pyx_Generator_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4449 #endif
4450 #ifdef __Pyx_AsyncGen_USED
4451 if (__pyx_AsyncGen_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4452 #endif
4453 #ifdef __Pyx_StopAsyncIteration_USED
4454 if (__pyx_StopAsyncIteration_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4455 #endif
4456 /*--- Library function declarations ---*/
4457 /*--- Threads initialization code ---*/
4458 #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
4459 PyEval_InitThreads();
4460 #endif
4461 /*--- Initialize various global constants etc. ---*/
4462 if (__Pyx_InitConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4463 stringtab_initialized = 1;
4464 if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4465 #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
4466 if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4467 #endif
4468 if (__pyx_module_is_main_pymodule) {
4469 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4470 }
4471 #if PY_MAJOR_VERSION >= 3
4472 {
4473 PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
4474 if (!PyDict_GetItemString(modules, "pymodule")) {
4475 if (unlikely((PyDict_SetItemString(modules, "pymodule", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
4476 }
4477 }
4478 #endif
4479 /*--- Builtin init code ---*/
4480 if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4481 /*--- Constants init code ---*/
4482 if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4483 /*--- Global type/function init code ---*/
4484 (void)__Pyx_modinit_global_init_code();
4485 (void)__Pyx_modinit_variable_export_code();
4486 if (unlikely((__Pyx_modinit_function_export_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
4487 (void)__Pyx_modinit_type_init_code();
4488 if (unlikely((__Pyx_modinit_type_import_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
4489 (void)__Pyx_modinit_variable_import_code();
4490 (void)__Pyx_modinit_function_import_code();
4491 /*--- Execution code ---*/
4492 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
4493 if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4494 #endif
4495
4496 /* "pymodule.pyx":8
4497 * from cpython.pycapsule cimport PyCapsule_New, PyCapsule_GetPointer
4498 *
4499 * from importlib import import_module # <<<<<<<<<<<<<<
4500 *
4501 * import cyclus.lib as cyclib
4502 */
4503 __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 8, __pyx_L1_error)
4504 __Pyx_GOTREF(__pyx_t_2);
4505 __Pyx_INCREF(__pyx_n_s_import_module);
4506 __Pyx_GIVEREF(__pyx_n_s_import_module);
4507 if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_import_module)) __PYX_ERR(0, 8, __pyx_L1_error);
4508 __pyx_t_3 = __Pyx_Import(__pyx_n_s_importlib, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 8, __pyx_L1_error)
4509 __Pyx_GOTREF(__pyx_t_3);
4510 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4511 __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_import_module); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 8, __pyx_L1_error)
4512 __Pyx_GOTREF(__pyx_t_2);
4513 if (PyDict_SetItem(__pyx_d, __pyx_n_s_import_module, __pyx_t_2) < 0) __PYX_ERR(0, 8, __pyx_L1_error)
4514 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4515 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4516
4517 /* "pymodule.pyx":10
4518 * from importlib import import_module
4519 *
4520 * import cyclus.lib as cyclib # <<<<<<<<<<<<<<
4521 * import cyclus.typesystem as ts
4522 *
4523 */
4524 __pyx_t_3 = __Pyx_ImportDottedModule(__pyx_n_s_cyclus_lib, __pyx_tuple__2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 10, __pyx_L1_error)
4525 __Pyx_GOTREF(__pyx_t_3);
4526 if (PyDict_SetItem(__pyx_d, __pyx_n_s_cyclib, __pyx_t_3) < 0) __PYX_ERR(0, 10, __pyx_L1_error)
4527 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4528
4529 /* "pymodule.pyx":11
4530 *
4531 * import cyclus.lib as cyclib
4532 * import cyclus.typesystem as ts # <<<<<<<<<<<<<<
4533 *
4534 * cdef object std_string_to_py(std_string x):
4535 */
4536 __pyx_t_3 = __Pyx_ImportDottedModule(__pyx_n_s_cyclus_typesystem, __pyx_tuple__4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 11, __pyx_L1_error)
4537 __Pyx_GOTREF(__pyx_t_3);
4538 if (PyDict_SetItem(__pyx_d, __pyx_n_s_ts, __pyx_t_3) < 0) __PYX_ERR(0, 11, __pyx_L1_error)
4539 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4540
4541 /* "pymodule.pyx":1
4542 * """Cyclus Python module loading tools.""" # <<<<<<<<<<<<<<
4543 * from __future__ import print_function, unicode_literals
4544 * from libcpp.cast cimport reinterpret_cast, dynamic_cast
4545 */
4546 __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1, __pyx_L1_error)
4547 __Pyx_GOTREF(__pyx_t_3);
4548 if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_3) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4549 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4550
4551 /*--- Wrapped vars code ---*/
4552
4553 goto __pyx_L0;
4554 __pyx_L1_error:;
4555 __Pyx_XDECREF(__pyx_t_2);
4556 __Pyx_XDECREF(__pyx_t_3);
4557 if (__pyx_m) {
4558 if (__pyx_d && stringtab_initialized) {
4559 __Pyx_AddTraceback("init pymodule", __pyx_clineno, __pyx_lineno, __pyx_filename);
4560 }
4561 #if !CYTHON_USE_MODULE_STATE
4562 Py_CLEAR(__pyx_m);
4563 #else
4564 Py_DECREF(__pyx_m);
4565 if (pystate_addmodule_run) {
4566 PyObject *tp, *value, *tb;
4567 PyErr_Fetch(&tp, &value, &tb);
4568 PyState_RemoveModule(&__pyx_moduledef);
4569 PyErr_Restore(tp, value, tb);
4570 }
4571 #endif
4572 } else if (!PyErr_Occurred()) {
4573 PyErr_SetString(PyExc_ImportError, "init pymodule");
4574 }
4575 __pyx_L0:;
4576 __Pyx_RefNannyFinishContext();
4577 #if CYTHON_PEP489_MULTI_PHASE_INIT
4578 return (__pyx_m != NULL) ? 0 : -1;
4579 #elif PY_MAJOR_VERSION >= 3
4580 return __pyx_m;
4581 #else
4582 return;
4583 #endif
4584}
4585/* #### Code section: cleanup_globals ### */
4586/* #### Code section: cleanup_module ### */
4587/* #### Code section: main_method ### */
4588/* #### Code section: utility_code_pragmas ### */
4589#ifdef _MSC_VER
4590#pragma warning( push )
4591/* Warning 4127: conditional expression is constant
4592 * Cython uses constant conditional expressions to allow in inline functions to be optimized at
4593 * compile-time, so this warning is not useful
4594 */
4595#pragma warning( disable : 4127 )
4596#endif
4597
4598
4599
4600/* #### Code section: utility_code_def ### */
4601
4602/* --- Runtime support code --- */
4603/* Refnanny */
4604#if CYTHON_REFNANNY
4605static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
4606 PyObject *m = NULL, *p = NULL;
4607 void *r = NULL;
4608 m = PyImport_ImportModule(modname);
4609 if (!m) goto end;
4610 p = PyObject_GetAttrString(m, "RefNannyAPI");
4611 if (!p) goto end;
4612 r = PyLong_AsVoidPtr(p);
4613end:
4614 Py_XDECREF(p);
4615 Py_XDECREF(m);
4616 return (__Pyx_RefNannyAPIStruct *)r;
4617}
4618#endif
4619
4620/* PyErrExceptionMatches */
4621#if CYTHON_FAST_THREAD_STATE
4622static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
4623 Py_ssize_t i, n;
4624 n = PyTuple_GET_SIZE(tuple);
4625#if PY_MAJOR_VERSION >= 3
4626 for (i=0; i<n; i++) {
4627 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
4628 }
4629#endif
4630 for (i=0; i<n; i++) {
4631 if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
4632 }
4633 return 0;
4634}
4635static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
4636 int result;
4637 PyObject *exc_type;
4638#if PY_VERSION_HEX >= 0x030C00A6
4639 PyObject *current_exception = tstate->current_exception;
4640 if (unlikely(!current_exception)) return 0;
4641 exc_type = (PyObject*) Py_TYPE(current_exception);
4642 if (exc_type == err) return 1;
4643#else
4644 exc_type = tstate->curexc_type;
4645 if (exc_type == err) return 1;
4646 if (unlikely(!exc_type)) return 0;
4647#endif
4648 #if CYTHON_AVOID_BORROWED_REFS
4649 Py_INCREF(exc_type);
4650 #endif
4651 if (unlikely(PyTuple_Check(err))) {
4652 result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
4653 } else {
4654 result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
4655 }
4656 #if CYTHON_AVOID_BORROWED_REFS
4657 Py_DECREF(exc_type);
4658 #endif
4659 return result;
4660}
4661#endif
4662
4663/* PyErrFetchRestore */
4664#if CYTHON_FAST_THREAD_STATE
4665static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
4666#if PY_VERSION_HEX >= 0x030C00A6
4667 PyObject *tmp_value;
4668 assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value)));
4669 if (value) {
4670 #if CYTHON_COMPILING_IN_CPYTHON
4671 if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb))
4672 #endif
4673 PyException_SetTraceback(value, tb);
4674 }
4675 tmp_value = tstate->current_exception;
4676 tstate->current_exception = value;
4677 Py_XDECREF(tmp_value);
4678 Py_XDECREF(type);
4679 Py_XDECREF(tb);
4680#else
4681 PyObject *tmp_type, *tmp_value, *tmp_tb;
4682 tmp_type = tstate->curexc_type;
4683 tmp_value = tstate->curexc_value;
4684 tmp_tb = tstate->curexc_traceback;
4685 tstate->curexc_type = type;
4686 tstate->curexc_value = value;
4687 tstate->curexc_traceback = tb;
4688 Py_XDECREF(tmp_type);
4689 Py_XDECREF(tmp_value);
4690 Py_XDECREF(tmp_tb);
4691#endif
4692}
4693static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
4694#if PY_VERSION_HEX >= 0x030C00A6
4695 PyObject* exc_value;
4696 exc_value = tstate->current_exception;
4697 tstate->current_exception = 0;
4698 *value = exc_value;
4699 *type = NULL;
4700 *tb = NULL;
4701 if (exc_value) {
4702 *type = (PyObject*) Py_TYPE(exc_value);
4703 Py_INCREF(*type);
4704 #if CYTHON_COMPILING_IN_CPYTHON
4705 *tb = ((PyBaseExceptionObject*) exc_value)->traceback;
4706 Py_XINCREF(*tb);
4707 #else
4708 *tb = PyException_GetTraceback(exc_value);
4709 #endif
4710 }
4711#else
4712 *type = tstate->curexc_type;
4713 *value = tstate->curexc_value;
4714 *tb = tstate->curexc_traceback;
4715 tstate->curexc_type = 0;
4716 tstate->curexc_value = 0;
4717 tstate->curexc_traceback = 0;
4718#endif
4719}
4720#endif
4721
4722/* PyObjectGetAttrStr */
4723#if CYTHON_USE_TYPE_SLOTS
4724static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
4725 PyTypeObject* tp = Py_TYPE(obj);
4726 if (likely(tp->tp_getattro))
4727 return tp->tp_getattro(obj, attr_name);
4728#if PY_MAJOR_VERSION < 3
4729 if (likely(tp->tp_getattr))
4730 return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
4731#endif
4732 return PyObject_GetAttr(obj, attr_name);
4733}
4734#endif
4735
4736/* PyObjectGetAttrStrNoError */
4737#if __PYX_LIMITED_VERSION_HEX < 0x030d00A1
4738static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
4739 __Pyx_PyThreadState_declare
4740 __Pyx_PyThreadState_assign
4741 if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
4742 __Pyx_PyErr_Clear();
4743}
4744#endif
4745static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
4746 PyObject *result;
4747#if __PYX_LIMITED_VERSION_HEX >= 0x030d00A1
4748 (void) PyObject_GetOptionalAttr(obj, attr_name, &result);
4749 return result;
4750#else
4751#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
4752 PyTypeObject* tp = Py_TYPE(obj);
4753 if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
4754 return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
4755 }
4756#endif
4757 result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
4758 if (unlikely(!result)) {
4759 __Pyx_PyObject_GetAttrStr_ClearAttributeError();
4760 }
4761 return result;
4762#endif
4763}
4764
4765/* GetBuiltinName */
4766static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
4767 PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_b, name);
4768 if (unlikely(!result) && !PyErr_Occurred()) {
4769 PyErr_Format(PyExc_NameError,
4770#if PY_MAJOR_VERSION >= 3
4771 "name '%U' is not defined", name);
4772#else
4773 "name '%.200s' is not defined", PyString_AS_STRING(name));
4774#endif
4775 }
4776 return result;
4777}
4778
4779/* PyFunctionFastCall */
4780#if CYTHON_FAST_PYCALL && !CYTHON_VECTORCALL
4781static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
4782 PyObject *globals) {
4783 PyFrameObject *f;
4784 PyThreadState *tstate = __Pyx_PyThreadState_Current;
4785 PyObject **fastlocals;
4786 Py_ssize_t i;
4787 PyObject *result;
4788 assert(globals != NULL);
4789 /* XXX Perhaps we should create a specialized
4790 PyFrame_New() that doesn't take locals, but does
4791 take builtins without sanity checking them.
4792 */
4793 assert(tstate != NULL);
4794 f = PyFrame_New(tstate, co, globals, NULL);
4795 if (f == NULL) {
4796 return NULL;
4797 }
4798 fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
4799 for (i = 0; i < na; i++) {
4800 Py_INCREF(*args);
4801 fastlocals[i] = *args++;
4802 }
4803 result = PyEval_EvalFrameEx(f,0);
4804 ++tstate->recursion_depth;
4805 Py_DECREF(f);
4806 --tstate->recursion_depth;
4807 return result;
4808}
4809static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
4810 PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
4811 PyObject *globals = PyFunction_GET_GLOBALS(func);
4812 PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
4813 PyObject *closure;
4814#if PY_MAJOR_VERSION >= 3
4815 PyObject *kwdefs;
4816#endif
4817 PyObject *kwtuple, **k;
4818 PyObject **d;
4819 Py_ssize_t nd;
4820 Py_ssize_t nk;
4821 PyObject *result;
4822 assert(kwargs == NULL || PyDict_Check(kwargs));
4823 nk = kwargs ? PyDict_Size(kwargs) : 0;
4824 #if PY_MAJOR_VERSION < 3
4825 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) {
4826 return NULL;
4827 }
4828 #else
4829 if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) {
4830 return NULL;
4831 }
4832 #endif
4833 if (
4834#if PY_MAJOR_VERSION >= 3
4835 co->co_kwonlyargcount == 0 &&
4836#endif
4837 likely(kwargs == NULL || nk == 0) &&
4838 co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
4839 if (argdefs == NULL && co->co_argcount == nargs) {
4840 result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
4841 goto done;
4842 }
4843 else if (nargs == 0 && argdefs != NULL
4844 && co->co_argcount == Py_SIZE(argdefs)) {
4845 /* function called with no arguments, but all parameters have
4846 a default value: use default values as arguments .*/
4847 args = &PyTuple_GET_ITEM(argdefs, 0);
4848 result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
4849 goto done;
4850 }
4851 }
4852 if (kwargs != NULL) {
4853 Py_ssize_t pos, i;
4854 kwtuple = PyTuple_New(2 * nk);
4855 if (kwtuple == NULL) {
4856 result = NULL;
4857 goto done;
4858 }
4859 k = &PyTuple_GET_ITEM(kwtuple, 0);
4860 pos = i = 0;
4861 while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
4862 Py_INCREF(k[i]);
4863 Py_INCREF(k[i+1]);
4864 i += 2;
4865 }
4866 nk = i / 2;
4867 }
4868 else {
4869 kwtuple = NULL;
4870 k = NULL;
4871 }
4872 closure = PyFunction_GET_CLOSURE(func);
4873#if PY_MAJOR_VERSION >= 3
4874 kwdefs = PyFunction_GET_KW_DEFAULTS(func);
4875#endif
4876 if (argdefs != NULL) {
4877 d = &PyTuple_GET_ITEM(argdefs, 0);
4878 nd = Py_SIZE(argdefs);
4879 }
4880 else {
4881 d = NULL;
4882 nd = 0;
4883 }
4884#if PY_MAJOR_VERSION >= 3
4885 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
4886 args, (int)nargs,
4887 k, (int)nk,
4888 d, (int)nd, kwdefs, closure);
4889#else
4890 result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
4891 args, (int)nargs,
4892 k, (int)nk,
4893 d, (int)nd, closure);
4894#endif
4895 Py_XDECREF(kwtuple);
4896done:
4897 Py_LeaveRecursiveCall();
4898 return result;
4899}
4900#endif
4901
4902/* PyObjectCall */
4903#if CYTHON_COMPILING_IN_CPYTHON
4904static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
4905 PyObject *result;
4906 ternaryfunc call = Py_TYPE(func)->tp_call;
4907 if (unlikely(!call))
4908 return PyObject_Call(func, arg, kw);
4909 #if PY_MAJOR_VERSION < 3
4910 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
4911 return NULL;
4912 #else
4913 if (unlikely(Py_EnterRecursiveCall(" while calling a Python object")))
4914 return NULL;
4915 #endif
4916 result = (*call)(func, arg, kw);
4917 Py_LeaveRecursiveCall();
4918 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
4919 PyErr_SetString(
4920 PyExc_SystemError,
4921 "NULL result without error in PyObject_Call");
4922 }
4923 return result;
4924}
4925#endif
4926
4927/* PyObjectCallMethO */
4928#if CYTHON_COMPILING_IN_CPYTHON
4929static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
4930 PyObject *self, *result;
4931 PyCFunction cfunc;
4932 cfunc = __Pyx_CyOrPyCFunction_GET_FUNCTION(func);
4933 self = __Pyx_CyOrPyCFunction_GET_SELF(func);
4934 #if PY_MAJOR_VERSION < 3
4935 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
4936 return NULL;
4937 #else
4938 if (unlikely(Py_EnterRecursiveCall(" while calling a Python object")))
4939 return NULL;
4940 #endif
4941 result = cfunc(self, arg);
4942 Py_LeaveRecursiveCall();
4943 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
4944 PyErr_SetString(
4945 PyExc_SystemError,
4946 "NULL result without error in PyObject_Call");
4947 }
4948 return result;
4949}
4950#endif
4951
4952/* PyObjectFastCall */
4953#if PY_VERSION_HEX < 0x03090000 || CYTHON_COMPILING_IN_LIMITED_API
4954static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs) {
4955 PyObject *argstuple;
4956 PyObject *result = 0;
4957 size_t i;
4958 argstuple = PyTuple_New((Py_ssize_t)nargs);
4959 if (unlikely(!argstuple)) return NULL;
4960 for (i = 0; i < nargs; i++) {
4961 Py_INCREF(args[i]);
4962 if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) < 0) goto bad;
4963 }
4964 result = __Pyx_PyObject_Call(func, argstuple, kwargs);
4965 bad:
4966 Py_DECREF(argstuple);
4967 return result;
4968}
4969#endif
4970static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t _nargs, PyObject *kwargs) {
4971 Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs);
4972#if CYTHON_COMPILING_IN_CPYTHON
4973 if (nargs == 0 && kwargs == NULL) {
4974 if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_NOARGS))
4975 return __Pyx_PyObject_CallMethO(func, NULL);
4976 }
4977 else if (nargs == 1 && kwargs == NULL) {
4978 if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_O))
4979 return __Pyx_PyObject_CallMethO(func, args[0]);
4980 }
4981#endif
4982 #if PY_VERSION_HEX < 0x030800B1
4983 #if CYTHON_FAST_PYCCALL
4984 if (PyCFunction_Check(func)) {
4985 if (kwargs) {
4986 return _PyCFunction_FastCallDict(func, args, nargs, kwargs);
4987 } else {
4988 return _PyCFunction_FastCallKeywords(func, args, nargs, NULL);
4989 }
4990 }
4991 #if PY_VERSION_HEX >= 0x030700A1
4992 if (!kwargs && __Pyx_IS_TYPE(func, &PyMethodDescr_Type)) {
4993 return _PyMethodDescr_FastCallKeywords(func, args, nargs, NULL);
4994 }
4995 #endif
4996 #endif
4997 #if CYTHON_FAST_PYCALL
4998 if (PyFunction_Check(func)) {
4999 return __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs);
5000 }
5001 #endif
5002 #endif
5003 if (kwargs == NULL) {
5004 #if CYTHON_VECTORCALL
5005 #if PY_VERSION_HEX < 0x03090000
5006 vectorcallfunc f = _PyVectorcall_Function(func);
5007 #else
5008 vectorcallfunc f = PyVectorcall_Function(func);
5009 #endif
5010 if (f) {
5011 return f(func, args, (size_t)nargs, NULL);
5012 }
5013 #elif defined(__Pyx_CyFunction_USED) && CYTHON_BACKPORT_VECTORCALL
5014 if (__Pyx_CyFunction_CheckExact(func)) {
5015 __pyx_vectorcallfunc f = __Pyx_CyFunction_func_vectorcall(func);
5016 if (f) return f(func, args, (size_t)nargs, NULL);
5017 }
5018 #endif
5019 }
5020 if (nargs == 0) {
5021 return __Pyx_PyObject_Call(func, __pyx_empty_tuple, kwargs);
5022 }
5023 #if PY_VERSION_HEX >= 0x03090000 && !CYTHON_COMPILING_IN_LIMITED_API
5024 return PyObject_VectorcallDict(func, args, (size_t)nargs, kwargs);
5025 #else
5026 return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs);
5027 #endif
5028}
5029
5030/* PyDictVersioning */
5031#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
5032static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
5033 PyObject *dict = Py_TYPE(obj)->tp_dict;
5034 return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
5035}
5036static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
5037 PyObject **dictptr = NULL;
5038 Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
5039 if (offset) {
5040#if CYTHON_COMPILING_IN_CPYTHON
5041 dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
5042#else
5043 dictptr = _PyObject_GetDictPtr(obj);
5044#endif
5045 }
5046 return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
5047}
5048static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
5049 PyObject *dict = Py_TYPE(obj)->tp_dict;
5050 if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
5051 return 0;
5052 return obj_dict_version == __Pyx_get_object_dict_version(obj);
5053}
5054#endif
5055
5056/* GetModuleGlobalName */
5057#if CYTHON_USE_DICT_VERSIONS
5058static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
5059#else
5060static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
5061#endif
5062{
5063 PyObject *result;
5064#if !CYTHON_AVOID_BORROWED_REFS
5065#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && PY_VERSION_HEX < 0x030d0000
5066 result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
5067 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
5068 if (likely(result)) {
5069 return __Pyx_NewRef(result);
5070 } else if (unlikely(PyErr_Occurred())) {
5071 return NULL;
5072 }
5073#elif CYTHON_COMPILING_IN_LIMITED_API
5074 if (unlikely(!__pyx_m)) {
5075 return NULL;
5076 }
5077 result = PyObject_GetAttr(__pyx_m, name);
5078 if (likely(result)) {
5079 return result;
5080 }
5081#else
5082 result = PyDict_GetItem(__pyx_d, name);
5083 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
5084 if (likely(result)) {
5085 return __Pyx_NewRef(result);
5086 }
5087#endif
5088#else
5089 result = PyObject_GetItem(__pyx_d, name);
5090 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
5091 if (likely(result)) {
5092 return __Pyx_NewRef(result);
5093 }
5094 PyErr_Clear();
5095#endif
5096 return __Pyx_GetBuiltinName(name);
5097}
5098
5099/* GetTopmostException */
5100#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE
5101static _PyErr_StackItem *
5102__Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
5103{
5104 _PyErr_StackItem *exc_info = tstate->exc_info;
5105 while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) &&
5106 exc_info->previous_item != NULL)
5107 {
5108 exc_info = exc_info->previous_item;
5109 }
5110 return exc_info;
5111}
5112#endif
5113
5114/* SaveResetException */
5115#if CYTHON_FAST_THREAD_STATE
5116static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
5117 #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
5118 _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
5119 PyObject *exc_value = exc_info->exc_value;
5120 if (exc_value == NULL || exc_value == Py_None) {
5121 *value = NULL;
5122 *type = NULL;
5123 *tb = NULL;
5124 } else {
5125 *value = exc_value;
5126 Py_INCREF(*value);
5127 *type = (PyObject*) Py_TYPE(exc_value);
5128 Py_INCREF(*type);
5129 *tb = PyException_GetTraceback(exc_value);
5130 }
5131 #elif CYTHON_USE_EXC_INFO_STACK
5132 _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
5133 *type = exc_info->exc_type;
5134 *value = exc_info->exc_value;
5135 *tb = exc_info->exc_traceback;
5136 Py_XINCREF(*type);
5137 Py_XINCREF(*value);
5138 Py_XINCREF(*tb);
5139 #else
5140 *type = tstate->exc_type;
5141 *value = tstate->exc_value;
5142 *tb = tstate->exc_traceback;
5143 Py_XINCREF(*type);
5144 Py_XINCREF(*value);
5145 Py_XINCREF(*tb);
5146 #endif
5147}
5148static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
5149 #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
5150 _PyErr_StackItem *exc_info = tstate->exc_info;
5151 PyObject *tmp_value = exc_info->exc_value;
5152 exc_info->exc_value = value;
5153 Py_XDECREF(tmp_value);
5154 Py_XDECREF(type);
5155 Py_XDECREF(tb);
5156 #else
5157 PyObject *tmp_type, *tmp_value, *tmp_tb;
5158 #if CYTHON_USE_EXC_INFO_STACK
5159 _PyErr_StackItem *exc_info = tstate->exc_info;
5160 tmp_type = exc_info->exc_type;
5161 tmp_value = exc_info->exc_value;
5162 tmp_tb = exc_info->exc_traceback;
5163 exc_info->exc_type = type;
5164 exc_info->exc_value = value;
5165 exc_info->exc_traceback = tb;
5166 #else
5167 tmp_type = tstate->exc_type;
5168 tmp_value = tstate->exc_value;
5169 tmp_tb = tstate->exc_traceback;
5170 tstate->exc_type = type;
5171 tstate->exc_value = value;
5172 tstate->exc_traceback = tb;
5173 #endif
5174 Py_XDECREF(tmp_type);
5175 Py_XDECREF(tmp_value);
5176 Py_XDECREF(tmp_tb);
5177 #endif
5178}
5179#endif
5180
5181/* GetException */
5182#if CYTHON_FAST_THREAD_STATE
5183static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
5184#else
5185static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
5186#endif
5187{
5188 PyObject *local_type = NULL, *local_value, *local_tb = NULL;
5189#if CYTHON_FAST_THREAD_STATE
5190 PyObject *tmp_type, *tmp_value, *tmp_tb;
5191 #if PY_VERSION_HEX >= 0x030C00A6
5192 local_value = tstate->current_exception;
5193 tstate->current_exception = 0;
5194 if (likely(local_value)) {
5195 local_type = (PyObject*) Py_TYPE(local_value);
5196 Py_INCREF(local_type);
5197 local_tb = PyException_GetTraceback(local_value);
5198 }
5199 #else
5200 local_type = tstate->curexc_type;
5201 local_value = tstate->curexc_value;
5202 local_tb = tstate->curexc_traceback;
5203 tstate->curexc_type = 0;
5204 tstate->curexc_value = 0;
5205 tstate->curexc_traceback = 0;
5206 #endif
5207#else
5208 PyErr_Fetch(&local_type, &local_value, &local_tb);
5209#endif
5210 PyErr_NormalizeException(&local_type, &local_value, &local_tb);
5211#if CYTHON_FAST_THREAD_STATE && PY_VERSION_HEX >= 0x030C00A6
5212 if (unlikely(tstate->current_exception))
5213#elif CYTHON_FAST_THREAD_STATE
5214 if (unlikely(tstate->curexc_type))
5215#else
5216 if (unlikely(PyErr_Occurred()))
5217#endif
5218 goto bad;
5219 #if PY_MAJOR_VERSION >= 3
5220 if (local_tb) {
5221 if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
5222 goto bad;
5223 }
5224 #endif
5225 Py_XINCREF(local_tb);
5226 Py_XINCREF(local_type);
5227 Py_XINCREF(local_value);
5228 *type = local_type;
5229 *value = local_value;
5230 *tb = local_tb;
5231#if CYTHON_FAST_THREAD_STATE
5232 #if CYTHON_USE_EXC_INFO_STACK
5233 {
5234 _PyErr_StackItem *exc_info = tstate->exc_info;
5235 #if PY_VERSION_HEX >= 0x030B00a4
5236 tmp_value = exc_info->exc_value;
5237 exc_info->exc_value = local_value;
5238 tmp_type = NULL;
5239 tmp_tb = NULL;
5240 Py_XDECREF(local_type);
5241 Py_XDECREF(local_tb);
5242 #else
5243 tmp_type = exc_info->exc_type;
5244 tmp_value = exc_info->exc_value;
5245 tmp_tb = exc_info->exc_traceback;
5246 exc_info->exc_type = local_type;
5247 exc_info->exc_value = local_value;
5248 exc_info->exc_traceback = local_tb;
5249 #endif
5250 }
5251 #else
5252 tmp_type = tstate->exc_type;
5253 tmp_value = tstate->exc_value;
5254 tmp_tb = tstate->exc_traceback;
5255 tstate->exc_type = local_type;
5256 tstate->exc_value = local_value;
5257 tstate->exc_traceback = local_tb;
5258 #endif
5259 Py_XDECREF(tmp_type);
5260 Py_XDECREF(tmp_value);
5261 Py_XDECREF(tmp_tb);
5262#else
5263 PyErr_SetExcInfo(local_type, local_value, local_tb);
5264#endif
5265 return 0;
5266bad:
5267 *type = 0;
5268 *value = 0;
5269 *tb = 0;
5270 Py_XDECREF(local_type);
5271 Py_XDECREF(local_value);
5272 Py_XDECREF(local_tb);
5273 return -1;
5274}
5275
5276/* RaiseTooManyValuesToUnpack */
5277static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
5278 PyErr_Format(PyExc_ValueError,
5279 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
5280}
5281
5282/* RaiseNeedMoreValuesToUnpack */
5283static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
5284 PyErr_Format(PyExc_ValueError,
5285 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
5286 index, (index == 1) ? "" : "s");
5287}
5288
5289/* IterFinish */
5290static CYTHON_INLINE int __Pyx_IterFinish(void) {
5291 PyObject* exc_type;
5292 __Pyx_PyThreadState_declare
5293 __Pyx_PyThreadState_assign
5294 exc_type = __Pyx_PyErr_CurrentExceptionType();
5295 if (unlikely(exc_type)) {
5296 if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))
5297 return -1;
5298 __Pyx_PyErr_Clear();
5299 return 0;
5300 }
5301 return 0;
5302}
5303
5304/* UnpackItemEndCheck */
5305static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
5306 if (unlikely(retval)) {
5307 Py_DECREF(retval);
5308 __Pyx_RaiseTooManyValuesError(expected);
5309 return -1;
5310 }
5311 return __Pyx_IterFinish();
5312}
5313
5314/* BytesEquals */
5315static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
5316#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API
5317 return PyObject_RichCompareBool(s1, s2, equals);
5318#else
5319 if (s1 == s2) {
5320 return (equals == Py_EQ);
5321 } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
5322 const char *ps1, *ps2;
5323 Py_ssize_t length = PyBytes_GET_SIZE(s1);
5324 if (length != PyBytes_GET_SIZE(s2))
5325 return (equals == Py_NE);
5326 ps1 = PyBytes_AS_STRING(s1);
5327 ps2 = PyBytes_AS_STRING(s2);
5328 if (ps1[0] != ps2[0]) {
5329 return (equals == Py_NE);
5330 } else if (length == 1) {
5331 return (equals == Py_EQ);
5332 } else {
5333 int result;
5334#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000)
5335 Py_hash_t hash1, hash2;
5336 hash1 = ((PyBytesObject*)s1)->ob_shash;
5337 hash2 = ((PyBytesObject*)s2)->ob_shash;
5338 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
5339 return (equals == Py_NE);
5340 }
5341#endif
5342 result = memcmp(ps1, ps2, (size_t)length);
5343 return (equals == Py_EQ) ? (result == 0) : (result != 0);
5344 }
5345 } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
5346 return (equals == Py_NE);
5347 } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
5348 return (equals == Py_NE);
5349 } else {
5350 int result;
5351 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
5352 if (!py_result)
5353 return -1;
5354 result = __Pyx_PyObject_IsTrue(py_result);
5355 Py_DECREF(py_result);
5356 return result;
5357 }
5358#endif
5359}
5360
5361/* UnicodeEquals */
5362static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
5363#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API
5364 return PyObject_RichCompareBool(s1, s2, equals);
5365#else
5366#if PY_MAJOR_VERSION < 3
5367 PyObject* owned_ref = NULL;
5368#endif
5369 int s1_is_unicode, s2_is_unicode;
5370 if (s1 == s2) {
5371 goto return_eq;
5372 }
5373 s1_is_unicode = PyUnicode_CheckExact(s1);
5374 s2_is_unicode = PyUnicode_CheckExact(s2);
5375#if PY_MAJOR_VERSION < 3
5376 if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
5377 owned_ref = PyUnicode_FromObject(s2);
5378 if (unlikely(!owned_ref))
5379 return -1;
5380 s2 = owned_ref;
5381 s2_is_unicode = 1;
5382 } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
5383 owned_ref = PyUnicode_FromObject(s1);
5384 if (unlikely(!owned_ref))
5385 return -1;
5386 s1 = owned_ref;
5387 s1_is_unicode = 1;
5388 } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
5389 return __Pyx_PyBytes_Equals(s1, s2, equals);
5390 }
5391#endif
5392 if (s1_is_unicode & s2_is_unicode) {
5393 Py_ssize_t length;
5394 int kind;
5395 void *data1, *data2;
5396 if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
5397 return -1;
5398 length = __Pyx_PyUnicode_GET_LENGTH(s1);
5399 if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
5400 goto return_ne;
5401 }
5402#if CYTHON_USE_UNICODE_INTERNALS
5403 {
5404 Py_hash_t hash1, hash2;
5405 #if CYTHON_PEP393_ENABLED
5406 hash1 = ((PyASCIIObject*)s1)->hash;
5407 hash2 = ((PyASCIIObject*)s2)->hash;
5408 #else
5409 hash1 = ((PyUnicodeObject*)s1)->hash;
5410 hash2 = ((PyUnicodeObject*)s2)->hash;
5411 #endif
5412 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
5413 goto return_ne;
5414 }
5415 }
5416#endif
5417 kind = __Pyx_PyUnicode_KIND(s1);
5418 if (kind != __Pyx_PyUnicode_KIND(s2)) {
5419 goto return_ne;
5420 }
5421 data1 = __Pyx_PyUnicode_DATA(s1);
5422 data2 = __Pyx_PyUnicode_DATA(s2);
5423 if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
5424 goto return_ne;
5425 } else if (length == 1) {
5426 goto return_eq;
5427 } else {
5428 int result = memcmp(data1, data2, (size_t)(length * kind));
5429 #if PY_MAJOR_VERSION < 3
5430 Py_XDECREF(owned_ref);
5431 #endif
5432 return (equals == Py_EQ) ? (result == 0) : (result != 0);
5433 }
5434 } else if ((s1 == Py_None) & s2_is_unicode) {
5435 goto return_ne;
5436 } else if ((s2 == Py_None) & s1_is_unicode) {
5437 goto return_ne;
5438 } else {
5439 int result;
5440 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
5441 #if PY_MAJOR_VERSION < 3
5442 Py_XDECREF(owned_ref);
5443 #endif
5444 if (!py_result)
5445 return -1;
5446 result = __Pyx_PyObject_IsTrue(py_result);
5447 Py_DECREF(py_result);
5448 return result;
5449 }
5450return_eq:
5451 #if PY_MAJOR_VERSION < 3
5452 Py_XDECREF(owned_ref);
5453 #endif
5454 return (equals == Py_EQ);
5455return_ne:
5456 #if PY_MAJOR_VERSION < 3
5457 Py_XDECREF(owned_ref);
5458 #endif
5459 return (equals == Py_NE);
5460#endif
5461}
5462
5463/* TypeImport */
5464#ifndef __PYX_HAVE_RT_ImportType_3_0_11
5465#define __PYX_HAVE_RT_ImportType_3_0_11
5466static PyTypeObject *__Pyx_ImportType_3_0_11(PyObject *module, const char *module_name, const char *class_name,
5467 size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_11 check_size)
5468{
5469 PyObject *result = 0;
5470 char warning[200];
5471 Py_ssize_t basicsize;
5472 Py_ssize_t itemsize;
5473#if CYTHON_COMPILING_IN_LIMITED_API
5474 PyObject *py_basicsize;
5475 PyObject *py_itemsize;
5476#endif
5477 result = PyObject_GetAttrString(module, class_name);
5478 if (!result)
5479 goto bad;
5480 if (!PyType_Check(result)) {
5481 PyErr_Format(PyExc_TypeError,
5482 "%.200s.%.200s is not a type object",
5483 module_name, class_name);
5484 goto bad;
5485 }
5486#if !CYTHON_COMPILING_IN_LIMITED_API
5487 basicsize = ((PyTypeObject *)result)->tp_basicsize;
5488 itemsize = ((PyTypeObject *)result)->tp_itemsize;
5489#else
5490 py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
5491 if (!py_basicsize)
5492 goto bad;
5493 basicsize = PyLong_AsSsize_t(py_basicsize);
5494 Py_DECREF(py_basicsize);
5495 py_basicsize = 0;
5496 if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
5497 goto bad;
5498 py_itemsize = PyObject_GetAttrString(result, "__itemsize__");
5499 if (!py_itemsize)
5500 goto bad;
5501 itemsize = PyLong_AsSsize_t(py_itemsize);
5502 Py_DECREF(py_itemsize);
5503 py_itemsize = 0;
5504 if (itemsize == (Py_ssize_t)-1 && PyErr_Occurred())
5505 goto bad;
5506#endif
5507 if (itemsize) {
5508 if (size % alignment) {
5509 alignment = size % alignment;
5510 }
5511 if (itemsize < (Py_ssize_t)alignment)
5512 itemsize = (Py_ssize_t)alignment;
5513 }
5514 if ((size_t)(basicsize + itemsize) < size) {
5515 PyErr_Format(PyExc_ValueError,
5516 "%.200s.%.200s size changed, may indicate binary incompatibility. "
5517 "Expected %zd from C header, got %zd from PyObject",
5518 module_name, class_name, size, basicsize+itemsize);
5519 goto bad;
5520 }
5521 if (check_size == __Pyx_ImportType_CheckSize_Error_3_0_11 &&
5522 ((size_t)basicsize > size || (size_t)(basicsize + itemsize) < size)) {
5523 PyErr_Format(PyExc_ValueError,
5524 "%.200s.%.200s size changed, may indicate binary incompatibility. "
5525 "Expected %zd from C header, got %zd-%zd from PyObject",
5526 module_name, class_name, size, basicsize, basicsize+itemsize);
5527 goto bad;
5528 }
5529 else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_0_11 && (size_t)basicsize > size) {
5530 PyOS_snprintf(warning, sizeof(warning),
5531 "%s.%s size changed, may indicate binary incompatibility. "
5532 "Expected %zd from C header, got %zd from PyObject",
5533 module_name, class_name, size, basicsize);
5534 if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
5535 }
5536 return (PyTypeObject *)result;
5537bad:
5538 Py_XDECREF(result);
5539 return NULL;
5540}
5541#endif
5542
5543/* Import */
5544static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
5545 PyObject *module = 0;
5546 PyObject *empty_dict = 0;
5547 PyObject *empty_list = 0;
5548 #if PY_MAJOR_VERSION < 3
5549 PyObject *py_import;
5550 py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
5551 if (unlikely(!py_import))
5552 goto bad;
5553 if (!from_list) {
5554 empty_list = PyList_New(0);
5555 if (unlikely(!empty_list))
5556 goto bad;
5557 from_list = empty_list;
5558 }
5559 #endif
5560 empty_dict = PyDict_New();
5561 if (unlikely(!empty_dict))
5562 goto bad;
5563 {
5564 #if PY_MAJOR_VERSION >= 3
5565 if (level == -1) {
5566 if (strchr(__Pyx_MODULE_NAME, '.') != NULL) {
5567 module = PyImport_ImportModuleLevelObject(
5568 name, __pyx_d, empty_dict, from_list, 1);
5569 if (unlikely(!module)) {
5570 if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError)))
5571 goto bad;
5572 PyErr_Clear();
5573 }
5574 }
5575 level = 0;
5576 }
5577 #endif
5578 if (!module) {
5579 #if PY_MAJOR_VERSION < 3
5580 PyObject *py_level = PyInt_FromLong(level);
5581 if (unlikely(!py_level))
5582 goto bad;
5583 module = PyObject_CallFunctionObjArgs(py_import,
5584 name, __pyx_d, empty_dict, from_list, py_level, (PyObject *)NULL);
5585 Py_DECREF(py_level);
5586 #else
5587 module = PyImport_ImportModuleLevelObject(
5588 name, __pyx_d, empty_dict, from_list, level);
5589 #endif
5590 }
5591 }
5592bad:
5593 Py_XDECREF(empty_dict);
5594 Py_XDECREF(empty_list);
5595 #if PY_MAJOR_VERSION < 3
5596 Py_XDECREF(py_import);
5597 #endif
5598 return module;
5599}
5600
5601/* ImportFrom */
5602static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
5603 PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
5604 if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
5605 const char* module_name_str = 0;
5606 PyObject* module_name = 0;
5607 PyObject* module_dot = 0;
5608 PyObject* full_name = 0;
5609 PyErr_Clear();
5610 module_name_str = PyModule_GetName(module);
5611 if (unlikely(!module_name_str)) { goto modbad; }
5612 module_name = PyUnicode_FromString(module_name_str);
5613 if (unlikely(!module_name)) { goto modbad; }
5614 module_dot = PyUnicode_Concat(module_name, __pyx_kp_u_);
5615 if (unlikely(!module_dot)) { goto modbad; }
5616 full_name = PyUnicode_Concat(module_dot, name);
5617 if (unlikely(!full_name)) { goto modbad; }
5618 #if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400)
5619 {
5620 PyObject *modules = PyImport_GetModuleDict();
5621 if (unlikely(!modules))
5622 goto modbad;
5623 value = PyObject_GetItem(modules, full_name);
5624 }
5625 #else
5626 value = PyImport_GetModule(full_name);
5627 #endif
5628 modbad:
5629 Py_XDECREF(full_name);
5630 Py_XDECREF(module_dot);
5631 Py_XDECREF(module_name);
5632 }
5633 if (unlikely(!value)) {
5634 PyErr_Format(PyExc_ImportError,
5635 #if PY_MAJOR_VERSION < 3
5636 "cannot import name %.230s", PyString_AS_STRING(name));
5637 #else
5638 "cannot import name %S", name);
5639 #endif
5640 }
5641 return value;
5642}
5643
5644/* ImportDottedModule */
5645#if PY_MAJOR_VERSION >= 3
5646static PyObject *__Pyx__ImportDottedModule_Error(PyObject *name, PyObject *parts_tuple, Py_ssize_t count) {
5647 PyObject *partial_name = NULL, *slice = NULL, *sep = NULL;
5648 if (unlikely(PyErr_Occurred())) {
5649 PyErr_Clear();
5650 }
5651 if (likely(PyTuple_GET_SIZE(parts_tuple) == count)) {
5652 partial_name = name;
5653 } else {
5654 slice = PySequence_GetSlice(parts_tuple, 0, count);
5655 if (unlikely(!slice))
5656 goto bad;
5657 sep = PyUnicode_FromStringAndSize(".", 1);
5658 if (unlikely(!sep))
5659 goto bad;
5660 partial_name = PyUnicode_Join(sep, slice);
5661 }
5662 PyErr_Format(
5663#if PY_MAJOR_VERSION < 3
5664 PyExc_ImportError,
5665 "No module named '%s'", PyString_AS_STRING(partial_name));
5666#else
5667#if PY_VERSION_HEX >= 0x030600B1
5668 PyExc_ModuleNotFoundError,
5669#else
5670 PyExc_ImportError,
5671#endif
5672 "No module named '%U'", partial_name);
5673#endif
5674bad:
5675 Py_XDECREF(sep);
5676 Py_XDECREF(slice);
5677 Py_XDECREF(partial_name);
5678 return NULL;
5679}
5680#endif
5681#if PY_MAJOR_VERSION >= 3
5682static PyObject *__Pyx__ImportDottedModule_Lookup(PyObject *name) {
5683 PyObject *imported_module;
5684#if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400)
5685 PyObject *modules = PyImport_GetModuleDict();
5686 if (unlikely(!modules))
5687 return NULL;
5688 imported_module = __Pyx_PyDict_GetItemStr(modules, name);
5689 Py_XINCREF(imported_module);
5690#else
5691 imported_module = PyImport_GetModule(name);
5692#endif
5693 return imported_module;
5694}
5695#endif
5696#if PY_MAJOR_VERSION >= 3
5697static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple) {
5698 Py_ssize_t i, nparts;
5699 nparts = PyTuple_GET_SIZE(parts_tuple);
5700 for (i=1; i < nparts && module; i++) {
5701 PyObject *part, *submodule;
5702#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5703 part = PyTuple_GET_ITEM(parts_tuple, i);
5704#else
5705 part = PySequence_ITEM(parts_tuple, i);
5706#endif
5707 submodule = __Pyx_PyObject_GetAttrStrNoError(module, part);
5708#if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
5709 Py_DECREF(part);
5710#endif
5711 Py_DECREF(module);
5712 module = submodule;
5713 }
5714 if (unlikely(!module)) {
5715 return __Pyx__ImportDottedModule_Error(name, parts_tuple, i);
5716 }
5717 return module;
5718}
5719#endif
5720static PyObject *__Pyx__ImportDottedModule(PyObject *name, PyObject *parts_tuple) {
5721#if PY_MAJOR_VERSION < 3
5722 PyObject *module, *from_list, *star = __pyx_n_s__3;
5723 CYTHON_UNUSED_VAR(parts_tuple);
5724 from_list = PyList_New(1);
5725 if (unlikely(!from_list))
5726 return NULL;
5727 Py_INCREF(star);
5728 PyList_SET_ITEM(from_list, 0, star);
5729 module = __Pyx_Import(name, from_list, 0);
5730 Py_DECREF(from_list);
5731 return module;
5732#else
5733 PyObject *imported_module;
5734 PyObject *module = __Pyx_Import(name, NULL, 0);
5735 if (!parts_tuple || unlikely(!module))
5736 return module;
5737 imported_module = __Pyx__ImportDottedModule_Lookup(name);
5738 if (likely(imported_module)) {
5739 Py_DECREF(module);
5740 return imported_module;
5741 }
5742 PyErr_Clear();
5743 return __Pyx_ImportDottedModule_WalkParts(module, name, parts_tuple);
5744#endif
5745}
5746static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple) {
5747#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030400B1
5748 PyObject *module = __Pyx__ImportDottedModule_Lookup(name);
5749 if (likely(module)) {
5750 PyObject *spec = __Pyx_PyObject_GetAttrStrNoError(module, __pyx_n_s_spec);
5751 if (likely(spec)) {
5752 PyObject *unsafe = __Pyx_PyObject_GetAttrStrNoError(spec, __pyx_n_s_initializing);
5753 if (likely(!unsafe || !__Pyx_PyObject_IsTrue(unsafe))) {
5754 Py_DECREF(spec);
5755 spec = NULL;
5756 }
5757 Py_XDECREF(unsafe);
5758 }
5759 if (likely(!spec)) {
5760 PyErr_Clear();
5761 return module;
5762 }
5763 Py_DECREF(spec);
5764 Py_DECREF(module);
5765 } else if (PyErr_Occurred()) {
5766 PyErr_Clear();
5767 }
5768#endif
5769 return __Pyx__ImportDottedModule(name, parts_tuple);
5770}
5771
5772/* CLineInTraceback */
5773#ifndef CYTHON_CLINE_IN_TRACEBACK
5774static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) {
5775 PyObject *use_cline;
5776 PyObject *ptype, *pvalue, *ptraceback;
5777#if CYTHON_COMPILING_IN_CPYTHON
5778 PyObject **cython_runtime_dict;
5779#endif
5780 CYTHON_MAYBE_UNUSED_VAR(tstate);
5781 if (unlikely(!__pyx_cython_runtime)) {
5782 return c_line;
5783 }
5784 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
5785#if CYTHON_COMPILING_IN_CPYTHON
5786 cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
5787 if (likely(cython_runtime_dict)) {
5788 __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
5789 use_cline, *cython_runtime_dict,
5790 __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
5791 } else
5792#endif
5793 {
5794 PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStrNoError(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
5795 if (use_cline_obj) {
5796 use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
5797 Py_DECREF(use_cline_obj);
5798 } else {
5799 PyErr_Clear();
5800 use_cline = NULL;
5801 }
5802 }
5803 if (!use_cline) {
5804 c_line = 0;
5805 (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
5806 }
5807 else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
5808 c_line = 0;
5809 }
5810 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
5811 return c_line;
5812}
5813#endif
5814
5815/* CodeObjectCache */
5816#if !CYTHON_COMPILING_IN_LIMITED_API
5817static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
5818 int start = 0, mid = 0, end = count - 1;
5819 if (end >= 0 && code_line > entries[end].code_line) {
5820 return count;
5821 }
5822 while (start < end) {
5823 mid = start + (end - start) / 2;
5824 if (code_line < entries[mid].code_line) {
5825 end = mid;
5826 } else if (code_line > entries[mid].code_line) {
5827 start = mid + 1;
5828 } else {
5829 return mid;
5830 }
5831 }
5832 if (code_line <= entries[mid].code_line) {
5833 return mid;
5834 } else {
5835 return mid + 1;
5836 }
5837}
5838static PyCodeObject *__pyx_find_code_object(int code_line) {
5839 PyCodeObject* code_object;
5840 int pos;
5841 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
5842 return NULL;
5843 }
5844 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
5845 if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
5846 return NULL;
5847 }
5848 code_object = __pyx_code_cache.entries[pos].code_object;
5849 Py_INCREF(code_object);
5850 return code_object;
5851}
5852static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
5853 int pos, i;
5854 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
5855 if (unlikely(!code_line)) {
5856 return;
5857 }
5858 if (unlikely(!entries)) {
5859 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
5860 if (likely(entries)) {
5861 __pyx_code_cache.entries = entries;
5862 __pyx_code_cache.max_count = 64;
5863 __pyx_code_cache.count = 1;
5864 entries[0].code_line = code_line;
5865 entries[0].code_object = code_object;
5866 Py_INCREF(code_object);
5867 }
5868 return;
5869 }
5870 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
5871 if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
5872 PyCodeObject* tmp = entries[pos].code_object;
5873 entries[pos].code_object = code_object;
5874 Py_DECREF(tmp);
5875 return;
5876 }
5877 if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
5878 int new_max = __pyx_code_cache.max_count + 64;
5879 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
5880 __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
5881 if (unlikely(!entries)) {
5882 return;
5883 }
5884 __pyx_code_cache.entries = entries;
5885 __pyx_code_cache.max_count = new_max;
5886 }
5887 for (i=__pyx_code_cache.count; i>pos; i--) {
5888 entries[i] = entries[i-1];
5889 }
5890 entries[pos].code_line = code_line;
5891 entries[pos].code_object = code_object;
5892 __pyx_code_cache.count++;
5893 Py_INCREF(code_object);
5894}
5895#endif
5896
5897/* AddTraceback */
5898#include "compile.h"
5899#include "frameobject.h"
5900#include "traceback.h"
5901#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API
5902 #ifndef Py_BUILD_CORE
5903 #define Py_BUILD_CORE 1
5904 #endif
5905 #include "internal/pycore_frame.h"
5906#endif
5907#if CYTHON_COMPILING_IN_LIMITED_API
5908static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict,
5909 PyObject *firstlineno, PyObject *name) {
5910 PyObject *replace = NULL;
5911 if (unlikely(PyDict_SetItemString(scratch_dict, "co_firstlineno", firstlineno))) return NULL;
5912 if (unlikely(PyDict_SetItemString(scratch_dict, "co_name", name))) return NULL;
5913 replace = PyObject_GetAttrString(code, "replace");
5914 if (likely(replace)) {
5915 PyObject *result;
5916 result = PyObject_Call(replace, __pyx_empty_tuple, scratch_dict);
5917 Py_DECREF(replace);
5918 return result;
5919 }
5920 PyErr_Clear();
5921 #if __PYX_LIMITED_VERSION_HEX < 0x030780000
5922 {
5923 PyObject *compiled = NULL, *result = NULL;
5924 if (unlikely(PyDict_SetItemString(scratch_dict, "code", code))) return NULL;
5925 if (unlikely(PyDict_SetItemString(scratch_dict, "type", (PyObject*)(&PyType_Type)))) return NULL;
5926 compiled = Py_CompileString(
5927 "out = type(code)(\n"
5928 " code.co_argcount, code.co_kwonlyargcount, code.co_nlocals, code.co_stacksize,\n"
5929 " code.co_flags, code.co_code, code.co_consts, code.co_names,\n"
5930 " code.co_varnames, code.co_filename, co_name, co_firstlineno,\n"
5931 " code.co_lnotab)\n", "<dummy>", Py_file_input);
5932 if (!compiled) return NULL;
5933 result = PyEval_EvalCode(compiled, scratch_dict, scratch_dict);
5934 Py_DECREF(compiled);
5935 if (!result) PyErr_Print();
5936 Py_DECREF(result);
5937 result = PyDict_GetItemString(scratch_dict, "out");
5938 if (result) Py_INCREF(result);
5939 return result;
5940 }
5941 #else
5942 return NULL;
5943 #endif
5944}
5945static void __Pyx_AddTraceback(const char *funcname, int c_line,
5946 int py_line, const char *filename) {
5947 PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL;
5948 PyObject *replace = NULL, *getframe = NULL, *frame = NULL;
5949 PyObject *exc_type, *exc_value, *exc_traceback;
5950 int success = 0;
5951 if (c_line) {
5952 (void) __pyx_cfilenm;
5953 (void) __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line);
5954 }
5955 PyErr_Fetch(&exc_type, &exc_value, &exc_traceback);
5956 code_object = Py_CompileString("_getframe()", filename, Py_eval_input);
5957 if (unlikely(!code_object)) goto bad;
5958 py_py_line = PyLong_FromLong(py_line);
5959 if (unlikely(!py_py_line)) goto bad;
5960 py_funcname = PyUnicode_FromString(funcname);
5961 if (unlikely(!py_funcname)) goto bad;
5962 dict = PyDict_New();
5963 if (unlikely(!dict)) goto bad;
5964 {
5965 PyObject *old_code_object = code_object;
5966 code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname);
5967 Py_DECREF(old_code_object);
5968 }
5969 if (unlikely(!code_object)) goto bad;
5970 getframe = PySys_GetObject("_getframe");
5971 if (unlikely(!getframe)) goto bad;
5972 if (unlikely(PyDict_SetItemString(dict, "_getframe", getframe))) goto bad;
5973 frame = PyEval_EvalCode(code_object, dict, dict);
5974 if (unlikely(!frame) || frame == Py_None) goto bad;
5975 success = 1;
5976 bad:
5977 PyErr_Restore(exc_type, exc_value, exc_traceback);
5978 Py_XDECREF(code_object);
5979 Py_XDECREF(py_py_line);
5980 Py_XDECREF(py_funcname);
5981 Py_XDECREF(dict);
5982 Py_XDECREF(replace);
5983 if (success) {
5984 PyTraceBack_Here(
5985 (struct _frame*)frame);
5986 }
5987 Py_XDECREF(frame);
5988}
5989#else
5990static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
5991 const char *funcname, int c_line,
5992 int py_line, const char *filename) {
5993 PyCodeObject *py_code = NULL;
5994 PyObject *py_funcname = NULL;
5995 #if PY_MAJOR_VERSION < 3
5996 PyObject *py_srcfile = NULL;
5997 py_srcfile = PyString_FromString(filename);
5998 if (!py_srcfile) goto bad;
5999 #endif
6000 if (c_line) {
6001 #if PY_MAJOR_VERSION < 3
6002 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
6003 if (!py_funcname) goto bad;
6004 #else
6005 py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
6006 if (!py_funcname) goto bad;
6007 funcname = PyUnicode_AsUTF8(py_funcname);
6008 if (!funcname) goto bad;
6009 #endif
6010 }
6011 else {
6012 #if PY_MAJOR_VERSION < 3
6013 py_funcname = PyString_FromString(funcname);
6014 if (!py_funcname) goto bad;
6015 #endif
6016 }
6017 #if PY_MAJOR_VERSION < 3
6018 py_code = __Pyx_PyCode_New(
6019 0,
6020 0,
6021 0,
6022 0,
6023 0,
6024 0,
6025 __pyx_empty_bytes, /*PyObject *code,*/
6026 __pyx_empty_tuple, /*PyObject *consts,*/
6027 __pyx_empty_tuple, /*PyObject *names,*/
6028 __pyx_empty_tuple, /*PyObject *varnames,*/
6029 __pyx_empty_tuple, /*PyObject *freevars,*/
6030 __pyx_empty_tuple, /*PyObject *cellvars,*/
6031 py_srcfile, /*PyObject *filename,*/
6032 py_funcname, /*PyObject *name,*/
6033 py_line,
6034 __pyx_empty_bytes /*PyObject *lnotab*/
6035 );
6036 Py_DECREF(py_srcfile);
6037 #else
6038 py_code = PyCode_NewEmpty(filename, funcname, py_line);
6039 #endif
6040 Py_XDECREF(py_funcname);
6041 return py_code;
6042bad:
6043 Py_XDECREF(py_funcname);
6044 #if PY_MAJOR_VERSION < 3
6045 Py_XDECREF(py_srcfile);
6046 #endif
6047 return NULL;
6048}
6049static void __Pyx_AddTraceback(const char *funcname, int c_line,
6050 int py_line, const char *filename) {
6051 PyCodeObject *py_code = 0;
6052 PyFrameObject *py_frame = 0;
6053 PyThreadState *tstate = __Pyx_PyThreadState_Current;
6054 PyObject *ptype, *pvalue, *ptraceback;
6055 if (c_line) {
6056 c_line = __Pyx_CLineForTraceback(tstate, c_line);
6057 }
6058 py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
6059 if (!py_code) {
6060 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
6061 py_code = __Pyx_CreateCodeObjectForTraceback(
6062 funcname, c_line, py_line, filename);
6063 if (!py_code) {
6064 /* If the code object creation fails, then we should clear the
6065 fetched exception references and propagate the new exception */
6066 Py_XDECREF(ptype);
6067 Py_XDECREF(pvalue);
6068 Py_XDECREF(ptraceback);
6069 goto bad;
6070 }
6071 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
6072 __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
6073 }
6074 py_frame = PyFrame_New(
6075 tstate, /*PyThreadState *tstate,*/
6076 py_code, /*PyCodeObject *code,*/
6077 __pyx_d, /*PyObject *globals,*/
6078 0 /*PyObject *locals*/
6079 );
6080 if (!py_frame) goto bad;
6081 __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
6082 PyTraceBack_Here(py_frame);
6083bad:
6084 Py_XDECREF(py_code);
6085 Py_XDECREF(py_frame);
6086}
6087#endif
6088
6089/* CIntToPy */
6090static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
6091#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
6092#pragma GCC diagnostic push
6093#pragma GCC diagnostic ignored "-Wconversion"
6094#endif
6095 const int neg_one = (int) -1, const_zero = (int) 0;
6096#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
6097#pragma GCC diagnostic pop
6098#endif
6099 const int is_unsigned = neg_one > const_zero;
6100 if (is_unsigned) {
6101 if (sizeof(int) < sizeof(long)) {
6102 return PyInt_FromLong((long) value);
6103 } else if (sizeof(int) <= sizeof(unsigned long)) {
6104 return PyLong_FromUnsignedLong((unsigned long) value);
6105#ifdef HAVE_LONG_LONG
6106 } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
6107 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
6108#endif
6109 }
6110 } else {
6111 if (sizeof(int) <= sizeof(long)) {
6112 return PyInt_FromLong((long) value);
6113#ifdef HAVE_LONG_LONG
6114 } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
6115 return PyLong_FromLongLong((PY_LONG_LONG) value);
6116#endif
6117 }
6118 }
6119 {
6120 unsigned char *bytes = (unsigned char *)&value;
6121#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
6122 if (is_unsigned) {
6123 return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
6124 } else {
6125 return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
6126 }
6127#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
6128 int one = 1; int little = (int)*(unsigned char *)&one;
6129 return _PyLong_FromByteArray(bytes, sizeof(int),
6130 little, !is_unsigned);
6131#else
6132 int one = 1; int little = (int)*(unsigned char *)&one;
6133 PyObject *from_bytes, *result = NULL;
6134 PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL;
6135 from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
6136 if (!from_bytes) return NULL;
6137 py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(int));
6138 if (!py_bytes) goto limited_bad;
6139 order_str = PyUnicode_FromString(little ? "little" : "big");
6140 if (!order_str) goto limited_bad;
6141 arg_tuple = PyTuple_Pack(2, py_bytes, order_str);
6142 if (!arg_tuple) goto limited_bad;
6143 if (!is_unsigned) {
6144 kwds = PyDict_New();
6145 if (!kwds) goto limited_bad;
6146 if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad;
6147 }
6148 result = PyObject_Call(from_bytes, arg_tuple, kwds);
6149 limited_bad:
6150 Py_XDECREF(kwds);
6151 Py_XDECREF(arg_tuple);
6152 Py_XDECREF(order_str);
6153 Py_XDECREF(py_bytes);
6154 Py_XDECREF(from_bytes);
6155 return result;
6156#endif
6157 }
6158}
6159
6160/* FormatTypeName */
6161#if CYTHON_COMPILING_IN_LIMITED_API
6162static __Pyx_TypeName
6163__Pyx_PyType_GetName(PyTypeObject* tp)
6164{
6165 PyObject *name = __Pyx_PyObject_GetAttrStr((PyObject *)tp,
6166 __pyx_n_s_name);
6167 if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) {
6168 PyErr_Clear();
6169 Py_XDECREF(name);
6170 name = __Pyx_NewRef(__pyx_n_s__5);
6171 }
6172 return name;
6173}
6174#endif
6175
6176/* CIntToPy */
6177static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
6178#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
6179#pragma GCC diagnostic push
6180#pragma GCC diagnostic ignored "-Wconversion"
6181#endif
6182 const long neg_one = (long) -1, const_zero = (long) 0;
6183#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
6184#pragma GCC diagnostic pop
6185#endif
6186 const int is_unsigned = neg_one > const_zero;
6187 if (is_unsigned) {
6188 if (sizeof(long) < sizeof(long)) {
6189 return PyInt_FromLong((long) value);
6190 } else if (sizeof(long) <= sizeof(unsigned long)) {
6191 return PyLong_FromUnsignedLong((unsigned long) value);
6192#ifdef HAVE_LONG_LONG
6193 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
6194 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
6195#endif
6196 }
6197 } else {
6198 if (sizeof(long) <= sizeof(long)) {
6199 return PyInt_FromLong((long) value);
6200#ifdef HAVE_LONG_LONG
6201 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
6202 return PyLong_FromLongLong((PY_LONG_LONG) value);
6203#endif
6204 }
6205 }
6206 {
6207 unsigned char *bytes = (unsigned char *)&value;
6208#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
6209 if (is_unsigned) {
6210 return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
6211 } else {
6212 return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
6213 }
6214#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
6215 int one = 1; int little = (int)*(unsigned char *)&one;
6216 return _PyLong_FromByteArray(bytes, sizeof(long),
6217 little, !is_unsigned);
6218#else
6219 int one = 1; int little = (int)*(unsigned char *)&one;
6220 PyObject *from_bytes, *result = NULL;
6221 PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL;
6222 from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
6223 if (!from_bytes) return NULL;
6224 py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long));
6225 if (!py_bytes) goto limited_bad;
6226 order_str = PyUnicode_FromString(little ? "little" : "big");
6227 if (!order_str) goto limited_bad;
6228 arg_tuple = PyTuple_Pack(2, py_bytes, order_str);
6229 if (!arg_tuple) goto limited_bad;
6230 if (!is_unsigned) {
6231 kwds = PyDict_New();
6232 if (!kwds) goto limited_bad;
6233 if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad;
6234 }
6235 result = PyObject_Call(from_bytes, arg_tuple, kwds);
6236 limited_bad:
6237 Py_XDECREF(kwds);
6238 Py_XDECREF(arg_tuple);
6239 Py_XDECREF(order_str);
6240 Py_XDECREF(py_bytes);
6241 Py_XDECREF(from_bytes);
6242 return result;
6243#endif
6244 }
6245}
6246
6247/* CIntFromPyVerify */
6248#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
6249 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
6250#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
6251 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
6252#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
6253 {\
6254 func_type value = func_value;\
6255 if (sizeof(target_type) < sizeof(func_type)) {\
6256 if (unlikely(value != (func_type) (target_type) value)) {\
6257 func_type zero = 0;\
6258 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
6259 return (target_type) -1;\
6260 if (is_unsigned && unlikely(value < zero))\
6261 goto raise_neg_overflow;\
6262 else\
6263 goto raise_overflow;\
6264 }\
6265 }\
6266 return (target_type) value;\
6267 }
6268
6269/* CIntFromPy */
6270static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
6271#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
6272#pragma GCC diagnostic push
6273#pragma GCC diagnostic ignored "-Wconversion"
6274#endif
6275 const long neg_one = (long) -1, const_zero = (long) 0;
6276#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
6277#pragma GCC diagnostic pop
6278#endif
6279 const int is_unsigned = neg_one > const_zero;
6280#if PY_MAJOR_VERSION < 3
6281 if (likely(PyInt_Check(x))) {
6282 if ((sizeof(long) < sizeof(long))) {
6283 __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
6284 } else {
6285 long val = PyInt_AS_LONG(x);
6286 if (is_unsigned && unlikely(val < 0)) {
6287 goto raise_neg_overflow;
6288 }
6289 return (long) val;
6290 }
6291 }
6292#endif
6293 if (unlikely(!PyLong_Check(x))) {
6294 long val;
6295 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
6296 if (!tmp) return (long) -1;
6297 val = __Pyx_PyInt_As_long(tmp);
6298 Py_DECREF(tmp);
6299 return val;
6300 }
6301 if (is_unsigned) {
6302#if CYTHON_USE_PYLONG_INTERNALS
6303 if (unlikely(__Pyx_PyLong_IsNeg(x))) {
6304 goto raise_neg_overflow;
6305 } else if (__Pyx_PyLong_IsCompact(x)) {
6306 __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
6307 } else {
6308 const digit* digits = __Pyx_PyLong_Digits(x);
6309 assert(__Pyx_PyLong_DigitCount(x) > 1);
6310 switch (__Pyx_PyLong_DigitCount(x)) {
6311 case 2:
6312 if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
6313 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
6314 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6315 } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) {
6316 return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
6317 }
6318 }
6319 break;
6320 case 3:
6321 if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
6322 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
6323 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6324 } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) {
6325 return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
6326 }
6327 }
6328 break;
6329 case 4:
6330 if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
6331 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
6332 __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])))
6333 } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) {
6334 return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
6335 }
6336 }
6337 break;
6338 }
6339 }
6340#endif
6341#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
6342 if (unlikely(Py_SIZE(x) < 0)) {
6343 goto raise_neg_overflow;
6344 }
6345#else
6346 {
6347 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
6348 if (unlikely(result < 0))
6349 return (long) -1;
6350 if (unlikely(result == 1))
6351 goto raise_neg_overflow;
6352 }
6353#endif
6354 if ((sizeof(long) <= sizeof(unsigned long))) {
6355 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
6356#ifdef HAVE_LONG_LONG
6357 } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) {
6358 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
6359#endif
6360 }
6361 } else {
6362#if CYTHON_USE_PYLONG_INTERNALS
6363 if (__Pyx_PyLong_IsCompact(x)) {
6364 __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
6365 } else {
6366 const digit* digits = __Pyx_PyLong_Digits(x);
6367 assert(__Pyx_PyLong_DigitCount(x) > 1);
6368 switch (__Pyx_PyLong_SignedDigitCount(x)) {
6369 case -2:
6370 if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) {
6371 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
6372 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6373 } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
6374 return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
6375 }
6376 }
6377 break;
6378 case 2:
6379 if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
6380 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
6381 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6382 } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
6383 return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
6384 }
6385 }
6386 break;
6387 case -3:
6388 if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
6389 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
6390 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6391 } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
6392 return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
6393 }
6394 }
6395 break;
6396 case 3:
6397 if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
6398 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
6399 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6400 } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
6401 return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
6402 }
6403 }
6404 break;
6405 case -4:
6406 if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
6407 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
6408 __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])))
6409 } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
6410 return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
6411 }
6412 }
6413 break;
6414 case 4:
6415 if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
6416 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
6417 __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])))
6418 } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
6419 return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
6420 }
6421 }
6422 break;
6423 }
6424 }
6425#endif
6426 if ((sizeof(long) <= sizeof(long))) {
6427 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
6428#ifdef HAVE_LONG_LONG
6429 } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) {
6430 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
6431#endif
6432 }
6433 }
6434 {
6435 long val;
6436 int ret = -1;
6437#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
6438 Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
6439 x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
6440 if (unlikely(bytes_copied == -1)) {
6441 } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
6442 goto raise_overflow;
6443 } else {
6444 ret = 0;
6445 }
6446#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
6447 int one = 1; int is_little = (int)*(unsigned char *)&one;
6448 unsigned char *bytes = (unsigned char *)&val;
6449 ret = _PyLong_AsByteArray((PyLongObject *)x,
6450 bytes, sizeof(val),
6451 is_little, !is_unsigned);
6452#else
6453 PyObject *v;
6454 PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
6455 int bits, remaining_bits, is_negative = 0;
6456 int chunk_size = (sizeof(long) < 8) ? 30 : 62;
6457 if (likely(PyLong_CheckExact(x))) {
6458 v = __Pyx_NewRef(x);
6459 } else {
6460 v = PyNumber_Long(x);
6461 if (unlikely(!v)) return (long) -1;
6462 assert(PyLong_CheckExact(v));
6463 }
6464 {
6465 int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
6466 if (unlikely(result < 0)) {
6467 Py_DECREF(v);
6468 return (long) -1;
6469 }
6470 is_negative = result == 1;
6471 }
6472 if (is_unsigned && unlikely(is_negative)) {
6473 Py_DECREF(v);
6474 goto raise_neg_overflow;
6475 } else if (is_negative) {
6476 stepval = PyNumber_Invert(v);
6477 Py_DECREF(v);
6478 if (unlikely(!stepval))
6479 return (long) -1;
6480 } else {
6481 stepval = v;
6482 }
6483 v = NULL;
6484 val = (long) 0;
6485 mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
6486 shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
6487 for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) {
6488 PyObject *tmp, *digit;
6489 long idigit;
6490 digit = PyNumber_And(stepval, mask);
6491 if (unlikely(!digit)) goto done;
6492 idigit = PyLong_AsLong(digit);
6493 Py_DECREF(digit);
6494 if (unlikely(idigit < 0)) goto done;
6495 val |= ((long) idigit) << bits;
6496 tmp = PyNumber_Rshift(stepval, shift);
6497 if (unlikely(!tmp)) goto done;
6498 Py_DECREF(stepval); stepval = tmp;
6499 }
6500 Py_DECREF(shift); shift = NULL;
6501 Py_DECREF(mask); mask = NULL;
6502 {
6503 long idigit = PyLong_AsLong(stepval);
6504 if (unlikely(idigit < 0)) goto done;
6505 remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1);
6506 if (unlikely(idigit >= (1L << remaining_bits)))
6507 goto raise_overflow;
6508 val |= ((long) idigit) << bits;
6509 }
6510 if (!is_unsigned) {
6511 if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1))))
6512 goto raise_overflow;
6513 if (is_negative)
6514 val = ~val;
6515 }
6516 ret = 0;
6517 done:
6518 Py_XDECREF(shift);
6519 Py_XDECREF(mask);
6520 Py_XDECREF(stepval);
6521#endif
6522 if (unlikely(ret))
6523 return (long) -1;
6524 return val;
6525 }
6526raise_overflow:
6527 PyErr_SetString(PyExc_OverflowError,
6528 "value too large to convert to long");
6529 return (long) -1;
6530raise_neg_overflow:
6531 PyErr_SetString(PyExc_OverflowError,
6532 "can't convert negative value to long");
6533 return (long) -1;
6534}
6535
6536/* CIntFromPy */
6537static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
6538#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
6539#pragma GCC diagnostic push
6540#pragma GCC diagnostic ignored "-Wconversion"
6541#endif
6542 const int neg_one = (int) -1, const_zero = (int) 0;
6543#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
6544#pragma GCC diagnostic pop
6545#endif
6546 const int is_unsigned = neg_one > const_zero;
6547#if PY_MAJOR_VERSION < 3
6548 if (likely(PyInt_Check(x))) {
6549 if ((sizeof(int) < sizeof(long))) {
6550 __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
6551 } else {
6552 long val = PyInt_AS_LONG(x);
6553 if (is_unsigned && unlikely(val < 0)) {
6554 goto raise_neg_overflow;
6555 }
6556 return (int) val;
6557 }
6558 }
6559#endif
6560 if (unlikely(!PyLong_Check(x))) {
6561 int val;
6562 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
6563 if (!tmp) return (int) -1;
6564 val = __Pyx_PyInt_As_int(tmp);
6565 Py_DECREF(tmp);
6566 return val;
6567 }
6568 if (is_unsigned) {
6569#if CYTHON_USE_PYLONG_INTERNALS
6570 if (unlikely(__Pyx_PyLong_IsNeg(x))) {
6571 goto raise_neg_overflow;
6572 } else if (__Pyx_PyLong_IsCompact(x)) {
6573 __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
6574 } else {
6575 const digit* digits = __Pyx_PyLong_Digits(x);
6576 assert(__Pyx_PyLong_DigitCount(x) > 1);
6577 switch (__Pyx_PyLong_DigitCount(x)) {
6578 case 2:
6579 if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
6580 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
6581 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6582 } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) {
6583 return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
6584 }
6585 }
6586 break;
6587 case 3:
6588 if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
6589 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
6590 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6591 } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) {
6592 return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
6593 }
6594 }
6595 break;
6596 case 4:
6597 if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
6598 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
6599 __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])))
6600 } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) {
6601 return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
6602 }
6603 }
6604 break;
6605 }
6606 }
6607#endif
6608#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
6609 if (unlikely(Py_SIZE(x) < 0)) {
6610 goto raise_neg_overflow;
6611 }
6612#else
6613 {
6614 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
6615 if (unlikely(result < 0))
6616 return (int) -1;
6617 if (unlikely(result == 1))
6618 goto raise_neg_overflow;
6619 }
6620#endif
6621 if ((sizeof(int) <= sizeof(unsigned long))) {
6622 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
6623#ifdef HAVE_LONG_LONG
6624 } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) {
6625 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
6626#endif
6627 }
6628 } else {
6629#if CYTHON_USE_PYLONG_INTERNALS
6630 if (__Pyx_PyLong_IsCompact(x)) {
6631 __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
6632 } else {
6633 const digit* digits = __Pyx_PyLong_Digits(x);
6634 assert(__Pyx_PyLong_DigitCount(x) > 1);
6635 switch (__Pyx_PyLong_SignedDigitCount(x)) {
6636 case -2:
6637 if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) {
6638 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
6639 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6640 } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
6641 return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
6642 }
6643 }
6644 break;
6645 case 2:
6646 if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
6647 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
6648 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6649 } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
6650 return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
6651 }
6652 }
6653 break;
6654 case -3:
6655 if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
6656 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
6657 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6658 } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
6659 return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
6660 }
6661 }
6662 break;
6663 case 3:
6664 if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
6665 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
6666 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6667 } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
6668 return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
6669 }
6670 }
6671 break;
6672 case -4:
6673 if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
6674 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
6675 __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])))
6676 } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
6677 return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
6678 }
6679 }
6680 break;
6681 case 4:
6682 if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
6683 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
6684 __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])))
6685 } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
6686 return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
6687 }
6688 }
6689 break;
6690 }
6691 }
6692#endif
6693 if ((sizeof(int) <= sizeof(long))) {
6694 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
6695#ifdef HAVE_LONG_LONG
6696 } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) {
6697 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
6698#endif
6699 }
6700 }
6701 {
6702 int val;
6703 int ret = -1;
6704#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
6705 Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
6706 x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
6707 if (unlikely(bytes_copied == -1)) {
6708 } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
6709 goto raise_overflow;
6710 } else {
6711 ret = 0;
6712 }
6713#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
6714 int one = 1; int is_little = (int)*(unsigned char *)&one;
6715 unsigned char *bytes = (unsigned char *)&val;
6716 ret = _PyLong_AsByteArray((PyLongObject *)x,
6717 bytes, sizeof(val),
6718 is_little, !is_unsigned);
6719#else
6720 PyObject *v;
6721 PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
6722 int bits, remaining_bits, is_negative = 0;
6723 int chunk_size = (sizeof(long) < 8) ? 30 : 62;
6724 if (likely(PyLong_CheckExact(x))) {
6725 v = __Pyx_NewRef(x);
6726 } else {
6727 v = PyNumber_Long(x);
6728 if (unlikely(!v)) return (int) -1;
6729 assert(PyLong_CheckExact(v));
6730 }
6731 {
6732 int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
6733 if (unlikely(result < 0)) {
6734 Py_DECREF(v);
6735 return (int) -1;
6736 }
6737 is_negative = result == 1;
6738 }
6739 if (is_unsigned && unlikely(is_negative)) {
6740 Py_DECREF(v);
6741 goto raise_neg_overflow;
6742 } else if (is_negative) {
6743 stepval = PyNumber_Invert(v);
6744 Py_DECREF(v);
6745 if (unlikely(!stepval))
6746 return (int) -1;
6747 } else {
6748 stepval = v;
6749 }
6750 v = NULL;
6751 val = (int) 0;
6752 mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
6753 shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
6754 for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) {
6755 PyObject *tmp, *digit;
6756 long idigit;
6757 digit = PyNumber_And(stepval, mask);
6758 if (unlikely(!digit)) goto done;
6759 idigit = PyLong_AsLong(digit);
6760 Py_DECREF(digit);
6761 if (unlikely(idigit < 0)) goto done;
6762 val |= ((int) idigit) << bits;
6763 tmp = PyNumber_Rshift(stepval, shift);
6764 if (unlikely(!tmp)) goto done;
6765 Py_DECREF(stepval); stepval = tmp;
6766 }
6767 Py_DECREF(shift); shift = NULL;
6768 Py_DECREF(mask); mask = NULL;
6769 {
6770 long idigit = PyLong_AsLong(stepval);
6771 if (unlikely(idigit < 0)) goto done;
6772 remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1);
6773 if (unlikely(idigit >= (1L << remaining_bits)))
6774 goto raise_overflow;
6775 val |= ((int) idigit) << bits;
6776 }
6777 if (!is_unsigned) {
6778 if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1))))
6779 goto raise_overflow;
6780 if (is_negative)
6781 val = ~val;
6782 }
6783 ret = 0;
6784 done:
6785 Py_XDECREF(shift);
6786 Py_XDECREF(mask);
6787 Py_XDECREF(stepval);
6788#endif
6789 if (unlikely(ret))
6790 return (int) -1;
6791 return val;
6792 }
6793raise_overflow:
6794 PyErr_SetString(PyExc_OverflowError,
6795 "value too large to convert to int");
6796 return (int) -1;
6797raise_neg_overflow:
6798 PyErr_SetString(PyExc_OverflowError,
6799 "can't convert negative value to int");
6800 return (int) -1;
6801}
6802
6803/* FastTypeChecks */
6804#if CYTHON_COMPILING_IN_CPYTHON
6805static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
6806 while (a) {
6807 a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*);
6808 if (a == b)
6809 return 1;
6810 }
6811 return b == &PyBaseObject_Type;
6812}
6813static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
6814 PyObject *mro;
6815 if (a == b) return 1;
6816 mro = a->tp_mro;
6817 if (likely(mro)) {
6818 Py_ssize_t i, n;
6819 n = PyTuple_GET_SIZE(mro);
6820 for (i = 0; i < n; i++) {
6821 if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
6822 return 1;
6823 }
6824 return 0;
6825 }
6826 return __Pyx_InBases(a, b);
6827}
6828static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) {
6829 PyObject *mro;
6830 if (cls == a || cls == b) return 1;
6831 mro = cls->tp_mro;
6832 if (likely(mro)) {
6833 Py_ssize_t i, n;
6834 n = PyTuple_GET_SIZE(mro);
6835 for (i = 0; i < n; i++) {
6836 PyObject *base = PyTuple_GET_ITEM(mro, i);
6837 if (base == (PyObject *)a || base == (PyObject *)b)
6838 return 1;
6839 }
6840 return 0;
6841 }
6842 return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b);
6843}
6844#if PY_MAJOR_VERSION == 2
6845static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
6846 PyObject *exception, *value, *tb;
6847 int res;
6848 __Pyx_PyThreadState_declare
6849 __Pyx_PyThreadState_assign
6850 __Pyx_ErrFetch(&exception, &value, &tb);
6851 res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
6852 if (unlikely(res == -1)) {
6853 PyErr_WriteUnraisable(err);
6854 res = 0;
6855 }
6856 if (!res) {
6857 res = PyObject_IsSubclass(err, exc_type2);
6858 if (unlikely(res == -1)) {
6859 PyErr_WriteUnraisable(err);
6860 res = 0;
6861 }
6862 }
6863 __Pyx_ErrRestore(exception, value, tb);
6864 return res;
6865}
6866#else
6867static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
6868 if (exc_type1) {
6869 return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2);
6870 } else {
6871 return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
6872 }
6873}
6874#endif
6875static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
6876 Py_ssize_t i, n;
6877 assert(PyExceptionClass_Check(exc_type));
6878 n = PyTuple_GET_SIZE(tuple);
6879#if PY_MAJOR_VERSION >= 3
6880 for (i=0; i<n; i++) {
6881 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
6882 }
6883#endif
6884 for (i=0; i<n; i++) {
6885 PyObject *t = PyTuple_GET_ITEM(tuple, i);
6886 #if PY_MAJOR_VERSION < 3
6887 if (likely(exc_type == t)) return 1;
6888 #endif
6889 if (likely(PyExceptionClass_Check(t))) {
6890 if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
6891 } else {
6892 }
6893 }
6894 return 0;
6895}
6896static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
6897 if (likely(err == exc_type)) return 1;
6898 if (likely(PyExceptionClass_Check(err))) {
6899 if (likely(PyExceptionClass_Check(exc_type))) {
6900 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
6901 } else if (likely(PyTuple_Check(exc_type))) {
6902 return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
6903 } else {
6904 }
6905 }
6906 return PyErr_GivenExceptionMatches(err, exc_type);
6907}
6908static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
6909 assert(PyExceptionClass_Check(exc_type1));
6910 assert(PyExceptionClass_Check(exc_type2));
6911 if (likely(err == exc_type1 || err == exc_type2)) return 1;
6912 if (likely(PyExceptionClass_Check(err))) {
6913 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
6914 }
6915 return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
6916}
6917#endif
6918
6919/* CheckBinaryVersion */
6920static unsigned long __Pyx_get_runtime_version(void) {
6921#if __PYX_LIMITED_VERSION_HEX >= 0x030B00A4
6922 return Py_Version & ~0xFFUL;
6923#else
6924 const char* rt_version = Py_GetVersion();
6925 unsigned long version = 0;
6926 unsigned long factor = 0x01000000UL;
6927 unsigned int digit = 0;
6928 int i = 0;
6929 while (factor) {
6930 while ('0' <= rt_version[i] && rt_version[i] <= '9') {
6931 digit = digit * 10 + (unsigned int) (rt_version[i] - '0');
6932 ++i;
6933 }
6934 version += factor * digit;
6935 if (rt_version[i] != '.')
6936 break;
6937 digit = 0;
6938 factor >>= 8;
6939 ++i;
6940 }
6941 return version;
6942#endif
6943}
6944static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer) {
6945 const unsigned long MAJOR_MINOR = 0xFFFF0000UL;
6946 if ((rt_version & MAJOR_MINOR) == (ct_version & MAJOR_MINOR))
6947 return 0;
6948 if (likely(allow_newer && (rt_version & MAJOR_MINOR) > (ct_version & MAJOR_MINOR)))
6949 return 1;
6950 {
6951 char message[200];
6952 PyOS_snprintf(message, sizeof(message),
6953 "compile time Python version %d.%d "
6954 "of module '%.100s' "
6955 "%s "
6956 "runtime version %d.%d",
6957 (int) (ct_version >> 24), (int) ((ct_version >> 16) & 0xFF),
6958 __Pyx_MODULE_NAME,
6959 (allow_newer) ? "was newer than" : "does not match",
6960 (int) (rt_version >> 24), (int) ((rt_version >> 16) & 0xFF)
6961 );
6962 return PyErr_WarnEx(NULL, message, 1);
6963 }
6964}
6965
6966/* FunctionExport */
6967static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) {
6968 PyObject *d = 0;
6969 PyObject *cobj = 0;
6970 union {
6971 void (*fp)(void);
6972 void *p;
6973 } tmp;
6974 d = PyObject_GetAttrString(__pyx_m, (char *)"__pyx_capi__");
6975 if (!d) {
6976 PyErr_Clear();
6977 d = PyDict_New();
6978 if (!d)
6979 goto bad;
6980 Py_INCREF(d);
6981 if (PyModule_AddObject(__pyx_m, (char *)"__pyx_capi__", d) < 0)
6982 goto bad;
6983 }
6984 tmp.fp = f;
6985 cobj = PyCapsule_New(tmp.p, sig, 0);
6986 if (!cobj)
6987 goto bad;
6988 if (PyDict_SetItemString(d, name, cobj) < 0)
6989 goto bad;
6990 Py_DECREF(cobj);
6991 Py_DECREF(d);
6992 return 0;
6993bad:
6994 Py_XDECREF(cobj);
6995 Py_XDECREF(d);
6996 return -1;
6997}
6998
6999/* InitStrings */
7000#if PY_MAJOR_VERSION >= 3
7001static int __Pyx_InitString(__Pyx_StringTabEntry t, PyObject **str) {
7002 if (t.is_unicode | t.is_str) {
7003 if (t.intern) {
7004 *str = PyUnicode_InternFromString(t.s);
7005 } else if (t.encoding) {
7006 *str = PyUnicode_Decode(t.s, t.n - 1, t.encoding, NULL);
7007 } else {
7008 *str = PyUnicode_FromStringAndSize(t.s, t.n - 1);
7009 }
7010 } else {
7011 *str = PyBytes_FromStringAndSize(t.s, t.n - 1);
7012 }
7013 if (!*str)
7014 return -1;
7015 if (PyObject_Hash(*str) == -1)
7016 return -1;
7017 return 0;
7018}
7019#endif
7020static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
7021 while (t->p) {
7022 #if PY_MAJOR_VERSION >= 3
7023 __Pyx_InitString(*t, t->p);
7024 #else
7025 if (t->is_unicode) {
7026 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
7027 } else if (t->intern) {
7028 *t->p = PyString_InternFromString(t->s);
7029 } else {
7030 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
7031 }
7032 if (!*t->p)
7033 return -1;
7034 if (PyObject_Hash(*t->p) == -1)
7035 return -1;
7036 #endif
7037 ++t;
7038 }
7039 return 0;
7040}
7041
7042#include <string.h>
7043static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s) {
7044 size_t len = strlen(s);
7045 if (unlikely(len > (size_t) PY_SSIZE_T_MAX)) {
7046 PyErr_SetString(PyExc_OverflowError, "byte string is too long");
7047 return -1;
7048 }
7049 return (Py_ssize_t) len;
7050}
7051static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
7052 Py_ssize_t len = __Pyx_ssize_strlen(c_str);
7053 if (unlikely(len < 0)) return NULL;
7054 return __Pyx_PyUnicode_FromStringAndSize(c_str, len);
7055}
7056static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char* c_str) {
7057 Py_ssize_t len = __Pyx_ssize_strlen(c_str);
7058 if (unlikely(len < 0)) return NULL;
7059 return PyByteArray_FromStringAndSize(c_str, len);
7060}
7061static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
7062 Py_ssize_t ignore;
7063 return __Pyx_PyObject_AsStringAndSize(o, &ignore);
7064}
7065#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
7066#if !CYTHON_PEP393_ENABLED
7067static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
7068 char* defenc_c;
7069 PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
7070 if (!defenc) return NULL;
7071 defenc_c = PyBytes_AS_STRING(defenc);
7072#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
7073 {
7074 char* end = defenc_c + PyBytes_GET_SIZE(defenc);
7075 char* c;
7076 for (c = defenc_c; c < end; c++) {
7077 if ((unsigned char) (*c) >= 128) {
7078 PyUnicode_AsASCIIString(o);
7079 return NULL;
7080 }
7081 }
7082 }
7083#endif
7084 *length = PyBytes_GET_SIZE(defenc);
7085 return defenc_c;
7086}
7087#else
7088static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
7089 if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
7090#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
7091 if (likely(PyUnicode_IS_ASCII(o))) {
7092 *length = PyUnicode_GET_LENGTH(o);
7093 return PyUnicode_AsUTF8(o);
7094 } else {
7095 PyUnicode_AsASCIIString(o);
7096 return NULL;
7097 }
7098#else
7099 return PyUnicode_AsUTF8AndSize(o, length);
7100#endif
7101}
7102#endif
7103#endif
7104static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
7105#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
7106 if (
7107#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
7108 __Pyx_sys_getdefaultencoding_not_ascii &&
7109#endif
7110 PyUnicode_Check(o)) {
7111 return __Pyx_PyUnicode_AsStringAndSize(o, length);
7112 } else
7113#endif
7114#if (!CYTHON_COMPILING_IN_PYPY && !CYTHON_COMPILING_IN_LIMITED_API) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
7115 if (PyByteArray_Check(o)) {
7116 *length = PyByteArray_GET_SIZE(o);
7117 return PyByteArray_AS_STRING(o);
7118 } else
7119#endif
7120 {
7121 char* result;
7122 int r = PyBytes_AsStringAndSize(o, &result, length);
7123 if (unlikely(r < 0)) {
7124 return NULL;
7125 } else {
7126 return result;
7127 }
7128 }
7129}
7130static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
7131 int is_true = x == Py_True;
7132 if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
7133 else return PyObject_IsTrue(x);
7134}
7135static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
7136 int retval;
7137 if (unlikely(!x)) return -1;
7138 retval = __Pyx_PyObject_IsTrue(x);
7139 Py_DECREF(x);
7140 return retval;
7141}
7142static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
7143 __Pyx_TypeName result_type_name = __Pyx_PyType_GetName(Py_TYPE(result));
7144#if PY_MAJOR_VERSION >= 3
7145 if (PyLong_Check(result)) {
7146 if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
7147 "__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). "
7148 "The ability to return an instance of a strict subclass of int is deprecated, "
7149 "and may be removed in a future version of Python.",
7150 result_type_name)) {
7151 __Pyx_DECREF_TypeName(result_type_name);
7152 Py_DECREF(result);
7153 return NULL;
7154 }
7155 __Pyx_DECREF_TypeName(result_type_name);
7156 return result;
7157 }
7158#endif
7159 PyErr_Format(PyExc_TypeError,
7160 "__%.4s__ returned non-%.4s (type " __Pyx_FMT_TYPENAME ")",
7161 type_name, type_name, result_type_name);
7162 __Pyx_DECREF_TypeName(result_type_name);
7163 Py_DECREF(result);
7164 return NULL;
7165}
7166static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
7167#if CYTHON_USE_TYPE_SLOTS
7168 PyNumberMethods *m;
7169#endif
7170 const char *name = NULL;
7171 PyObject *res = NULL;
7172#if PY_MAJOR_VERSION < 3
7173 if (likely(PyInt_Check(x) || PyLong_Check(x)))
7174#else
7175 if (likely(PyLong_Check(x)))
7176#endif
7177 return __Pyx_NewRef(x);
7178#if CYTHON_USE_TYPE_SLOTS
7179 m = Py_TYPE(x)->tp_as_number;
7180 #if PY_MAJOR_VERSION < 3
7181 if (m && m->nb_int) {
7182 name = "int";
7183 res = m->nb_int(x);
7184 }
7185 else if (m && m->nb_long) {
7186 name = "long";
7187 res = m->nb_long(x);
7188 }
7189 #else
7190 if (likely(m && m->nb_int)) {
7191 name = "int";
7192 res = m->nb_int(x);
7193 }
7194 #endif
7195#else
7196 if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
7197 res = PyNumber_Int(x);
7198 }
7199#endif
7200 if (likely(res)) {
7201#if PY_MAJOR_VERSION < 3
7202 if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
7203#else
7204 if (unlikely(!PyLong_CheckExact(res))) {
7205#endif
7206 return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
7207 }
7208 }
7209 else if (!PyErr_Occurred()) {
7210 PyErr_SetString(PyExc_TypeError,
7211 "an integer is required");
7212 }
7213 return res;
7214}
7215static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
7216 Py_ssize_t ival;
7217 PyObject *x;
7218#if PY_MAJOR_VERSION < 3
7219 if (likely(PyInt_CheckExact(b))) {
7220 if (sizeof(Py_ssize_t) >= sizeof(long))
7221 return PyInt_AS_LONG(b);
7222 else
7223 return PyInt_AsSsize_t(b);
7224 }
7225#endif
7226 if (likely(PyLong_CheckExact(b))) {
7227 #if CYTHON_USE_PYLONG_INTERNALS
7228 if (likely(__Pyx_PyLong_IsCompact(b))) {
7229 return __Pyx_PyLong_CompactValue(b);
7230 } else {
7231 const digit* digits = __Pyx_PyLong_Digits(b);
7232 const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b);
7233 switch (size) {
7234 case 2:
7235 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
7236 return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
7237 }
7238 break;
7239 case -2:
7240 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
7241 return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
7242 }
7243 break;
7244 case 3:
7245 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
7246 return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
7247 }
7248 break;
7249 case -3:
7250 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
7251 return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
7252 }
7253 break;
7254 case 4:
7255 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
7256 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]));
7257 }
7258 break;
7259 case -4:
7260 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
7261 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]));
7262 }
7263 break;
7264 }
7265 }
7266 #endif
7267 return PyLong_AsSsize_t(b);
7268 }
7269 x = PyNumber_Index(b);
7270 if (!x) return -1;
7271 ival = PyInt_AsSsize_t(x);
7272 Py_DECREF(x);
7273 return ival;
7274}
7275static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) {
7276 if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) {
7277 return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o);
7278#if PY_MAJOR_VERSION < 3
7279 } else if (likely(PyInt_CheckExact(o))) {
7280 return PyInt_AS_LONG(o);
7281#endif
7282 } else {
7283 Py_ssize_t ival;
7284 PyObject *x;
7285 x = PyNumber_Index(o);
7286 if (!x) return -1;
7287 ival = PyInt_AsLong(x);
7288 Py_DECREF(x);
7289 return ival;
7290 }
7291}
7292static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
7293 return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
7294}
7295static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
7296 return PyInt_FromSize_t(ival);
7297}
7298
7299
7300/* #### Code section: utility_code_pragmas_end ### */
7301#ifdef _MSC_VER
7302#pragma warning( pop )
7303#endif
7304
7305
7306
7307/* #### Code section: end ### */
7308#endif /* Py_PYTHON_H */
The abstract base class used by all types of agents that live and interact in a simulation.
Definition agent.h:49
The Facility class is the abstract class/interface used by all facility agents.
Definition facility.h:68
The Institution class is the abstract class/interface used by all institution agents.
Definition institution.h:29
The Region class is the abstract class/interface used by all region agents.
Definition region.h:60
#define __PYX_EXTERN_C
bool operator==(const CapacityConstraint< T > &lhs, const CapacityConstraint< T > &rhs)
CapacityConstraint-CapacityConstraint equality operator.
memset(dest, src, size)
enable_if< has_const_iterator< T >::value, typenameT::const_iterator >::type end(const T &c)
std::string name(int nuc)
Definition pyne.cc:2940
int offset(int dz, int da, int ds=0)
A helper function to compute nuclide id offsets from z-, a-, and s- deltas.
Definition pyne.h:1455
unsigned int hash(std::string s)
Definition pyne.cc:6323
double b(int nuc)
Computes the scattering length [cm] from the coherent and incoherent components.
Definition pyne.cc:11180
void warning(std::string s)
Prints a warning message.
Definition pyne.cc:413
__PYX_EXTERN_C void CyclusPyCallListeners(std::string, cyclus::Agent *, void *, int, boost::spirit::hold_any)
PyMODINIT_FUNC initpymodule(void)
__PYX_EXTERN_C std::string CyclusPyFindModule(std::string)
__PYX_EXTERN_C cyclus::Agent * CyclusMakePyAgent(std::string, std::string, void *)
__PYX_EXTERN_C void CyclusClearPyAgentRefs(void)
__PYX_EXTERN_C void CyclusInitFromPyAgent(cyclus::Agent *, cyclus::Agent *, void *)
__PYX_EXTERN_C void CyclusPyDelAgent(int)