1 /////////////// CModulePreamble ///////////////
3 #include <stddef.h> /* For offsetof */
5 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
8 #if !defined(WIN32) && !defined(MS_WINDOWS)
21 #define DL_IMPORT(t) t
24 #define DL_EXPORT(t) t
28 #define PY_LONG_LONG LONG_LONG
32 #define Py_HUGE_VAL HUGE_VAL
36 #define CYTHON_COMPILING_IN_PYPY 1
37 #define CYTHON_COMPILING_IN_CPYTHON 0
39 #define CYTHON_COMPILING_IN_PYPY 0
40 #define CYTHON_COMPILING_IN_CPYTHON 1
43 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600
44 #define Py_OptimizeFlag 0
47 #if PY_VERSION_HEX < 0x02050000
48 typedef int Py_ssize_t
;
49 #define PY_SSIZE_T_MAX INT_MAX
50 #define PY_SSIZE_T_MIN INT_MIN
51 #define PY_FORMAT_SIZE_T ""
52 #define CYTHON_FORMAT_SSIZE_T ""
53 #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
54 #define PyInt_AsSsize_t(o) __Pyx_PyInt_As_int(o)
55 #define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \
56 (PyErr_Format(PyExc_TypeError, \
57 "expected index value, got %.200s", Py_TYPE(o)->tp_name), \
59 #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \
61 #define PyIndex_Check __Pyx_PyIndex_Check
62 #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
63 #define __PYX_BUILD_PY_SSIZE_T "i"
65 #define __PYX_BUILD_PY_SSIZE_T "n"
66 #define CYTHON_FORMAT_SSIZE_T "z"
67 #define __Pyx_PyIndex_Check PyIndex_Check
70 #if PY_VERSION_HEX < 0x02060000
71 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
72 #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
73 #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size)
74 #define PyVarObject_HEAD_INIT(type, size) \
75 PyObject_HEAD_INIT(type) size,
76 #define PyType_Modified(t)
88 Py_ssize_t
*suboffsets
;
92 #define PyBUF_SIMPLE 0
93 #define PyBUF_WRITABLE 0x0001
94 #define PyBUF_FORMAT 0x0004
95 #define PyBUF_ND 0x0008
96 #define PyBUF_STRIDES (0x0010 | PyBUF_ND)
97 #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
98 #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
99 #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
100 #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
101 #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE)
102 #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE)
104 typedef int (*getbufferproc
)(PyObject
*, Py_buffer
*, int);
105 typedef void (*releasebufferproc
)(PyObject
*, Py_buffer
*);
108 #if PY_MAJOR_VERSION < 3
109 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
110 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
111 PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
112 #define __Pyx_DefaultClassType PyClass_Type
114 #define __Pyx_BUILTIN_MODULE_NAME "builtins"
115 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
116 PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
117 #define __Pyx_DefaultClassType PyType_Type
120 #if PY_VERSION_HEX < 0x02060000
121 #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict")
124 #if PY_MAJOR_VERSION >= 3
125 #define Py_TPFLAGS_CHECKTYPES 0
126 #define Py_TPFLAGS_HAVE_INDEX 0
129 #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
130 #define Py_TPFLAGS_HAVE_NEWBUFFER 0
133 #if PY_VERSION_HEX < 0x02060000
134 #define Py_TPFLAGS_HAVE_VERSION_TAG 0
136 #if PY_VERSION_HEX < 0x02060000 && !defined(Py_TPFLAGS_IS_ABSTRACT)
137 #define Py_TPFLAGS_IS_ABSTRACT 0
139 #if PY_VERSION_HEX < 0x030400a1 && !defined(Py_TPFLAGS_HAVE_FINALIZE)
140 #define Py_TPFLAGS_HAVE_FINALIZE 0
143 /* new Py3.3 unicode type (PEP 393) */
144 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
145 #define CYTHON_PEP393_ENABLED 1
146 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \
147 0 : _PyUnicode_Ready((PyObject *)(op)))
148 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
149 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
150 #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
151 #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
152 #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
154 #define CYTHON_PEP393_ENABLED 0
155 #define __Pyx_PyUnicode_READY(op) (0)
156 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
157 #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
158 #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
159 #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
160 /* (void)(k) => avoid unused variable warning due to macro: */
161 #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
164 #if CYTHON_COMPILING_IN_PYPY
165 #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
166 #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
168 #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
169 #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ? \
170 PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
173 #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
174 #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
176 #if PY_MAJOR_VERSION >= 3
177 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
179 #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
182 #if PY_MAJOR_VERSION >= 3
183 #define PyBaseString_Type PyUnicode_Type
184 #define PyStringObject PyUnicodeObject
185 #define PyString_Type PyUnicode_Type
186 #define PyString_Check PyUnicode_Check
187 #define PyString_CheckExact PyUnicode_CheckExact
190 #if PY_VERSION_HEX < 0x02060000
191 #define PyBytesObject PyStringObject
192 #define PyBytes_Type PyString_Type
193 #define PyBytes_Check PyString_Check
194 #define PyBytes_CheckExact PyString_CheckExact
195 #define PyBytes_FromString PyString_FromString
196 #define PyBytes_FromStringAndSize PyString_FromStringAndSize
197 #define PyBytes_FromFormat PyString_FromFormat
198 #define PyBytes_DecodeEscape PyString_DecodeEscape
199 #define PyBytes_AsString PyString_AsString
200 #define PyBytes_AsStringAndSize PyString_AsStringAndSize
201 #define PyBytes_Size PyString_Size
202 #define PyBytes_AS_STRING PyString_AS_STRING
203 #define PyBytes_GET_SIZE PyString_GET_SIZE
204 #define PyBytes_Repr PyString_Repr
205 #define PyBytes_Concat PyString_Concat
206 #define PyBytes_ConcatAndDel PyString_ConcatAndDel
209 #if PY_MAJOR_VERSION >= 3
210 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
211 #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
213 #define __Pyx_PyBaseString_Check(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj) || \
214 PyString_Check(obj) || PyUnicode_Check(obj))
215 #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
218 #if PY_VERSION_HEX < 0x02060000
219 #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type)
220 #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type)
222 #ifndef PySet_CheckExact
223 #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
226 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
228 #if PY_MAJOR_VERSION >= 3
229 #define PyIntObject PyLongObject
230 #define PyInt_Type PyLong_Type
231 #define PyInt_Check(op) PyLong_Check(op)
232 #define PyInt_CheckExact(op) PyLong_CheckExact(op)
233 #define PyInt_FromString PyLong_FromString
234 #define PyInt_FromUnicode PyLong_FromUnicode
235 #define PyInt_FromLong PyLong_FromLong
236 #define PyInt_FromSize_t PyLong_FromSize_t
237 #define PyInt_FromSsize_t PyLong_FromSsize_t
238 #define PyInt_AsLong PyLong_AsLong
239 #define PyInt_AS_LONG PyLong_AS_LONG
240 #define PyInt_AsSsize_t PyLong_AsSsize_t
241 #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
242 #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
243 #define PyNumber_Int PyNumber_Long
246 #if PY_MAJOR_VERSION >= 3
247 #define PyBoolObject PyLongObject
250 #if PY_VERSION_HEX < 0x030200A4
251 typedef long Py_hash_t
;
252 #define __Pyx_PyInt_FromHash_t PyInt_FromLong
253 #define __Pyx_PyInt_AsHash_t PyInt_AsLong
255 #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
256 #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
259 #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
260 #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
261 #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
262 #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
264 #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
265 (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
266 (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
267 (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
268 #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
269 (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
270 (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
271 (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
272 #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
273 (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
274 (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
275 (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
278 #if PY_MAJOR_VERSION >= 3
279 #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
282 #if PY_VERSION_HEX < 0x02050000
283 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n)))
284 #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
285 #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n)))
287 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n))
288 #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
289 #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n))
292 #if PY_VERSION_HEX < 0x02050000
293 #define __Pyx_NAMESTR(n) ((char *)(n))
294 #define __Pyx_DOCSTR(n) ((char *)(n))
296 #define __Pyx_NAMESTR(n) (n)
297 #define __Pyx_DOCSTR(n) (n)
300 /* inline attribute */
301 #ifndef CYTHON_INLINE
302 #if defined(__GNUC__)
303 #define CYTHON_INLINE __inline__
304 #elif defined(_MSC_VER)
305 #define CYTHON_INLINE __inline
306 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
307 #define CYTHON_INLINE inline
309 #define CYTHON_INLINE
314 #ifndef CYTHON_RESTRICT
315 #if defined(__GNUC__)
316 #define CYTHON_RESTRICT __restrict__
317 #elif defined(_MSC_VER) && _MSC_VER >= 1400
318 #define CYTHON_RESTRICT __restrict
319 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
320 #define CYTHON_RESTRICT restrict
322 #define CYTHON_RESTRICT
327 #define __PYX_NAN() ((float) NAN)
329 static CYTHON_INLINE
float __PYX_NAN() {
330 /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and
331 a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is
334 memset(&value
, 0xFF, sizeof(value
));
339 // Work around clang bug http://stackoverflow.com/questions/21847816/c-invoke-nested-template-class-destructor
342 void __Pyx_call_destructor(T
* x
) {
347 /////////////// UtilityFunctionPredeclarations.proto ///////////////
349 /* unused attribute */
350 #ifndef CYTHON_UNUSED
351 # if defined(__GNUC__)
352 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
353 # define CYTHON_UNUSED __attribute__ ((__unused__))
355 # define CYTHON_UNUSED
357 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
358 # define CYTHON_UNUSED __attribute__ ((__unused__))
360 # define CYTHON_UNUSED
364 typedef struct {PyObject
**p
; char *s
; const Py_ssize_t n
; const char* encoding
;
365 const char is_unicode
; const char is_str
; const char intern
; } __Pyx_StringTabEntry
; /*proto*/
367 /////////////// ForceInitThreads.proto ///////////////
369 #ifndef __PYX_FORCE_INIT_THREADS
370 #define __PYX_FORCE_INIT_THREADS 0
373 /////////////// InitThreads.init ///////////////
376 PyEval_InitThreads();
379 /////////////// CodeObjectCache.proto ///////////////
383 PyCodeObject
* code_object
;
384 } __Pyx_CodeObjectCacheEntry
;
386 struct __Pyx_CodeObjectCache
{
389 __Pyx_CodeObjectCacheEntry
* entries
;
392 static struct __Pyx_CodeObjectCache __pyx_code_cache
= {0,0,NULL
};
394 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry
* entries
, int count
, int code_line
);
395 static PyCodeObject
*__pyx_find_code_object(int code_line
);
396 static void __pyx_insert_code_object(int code_line
, PyCodeObject
* code_object
);
398 /////////////// CodeObjectCache ///////////////
399 // Note that errors are simply ignored in the code below.
400 // This is just a cache, if a lookup or insertion fails - so what?
402 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry
* entries
, int count
, int code_line
) {
403 int start
= 0, mid
= 0, end
= count
- 1;
404 if (end
>= 0 && code_line
> entries
[end
].code_line
) {
407 while (start
< end
) {
408 mid
= (start
+ end
) / 2;
409 if (code_line
< entries
[mid
].code_line
) {
411 } else if (code_line
> entries
[mid
].code_line
) {
417 if (code_line
<= entries
[mid
].code_line
) {
424 static PyCodeObject
*__pyx_find_code_object(int code_line
) {
425 PyCodeObject
* code_object
;
427 if (unlikely(!code_line
) || unlikely(!__pyx_code_cache
.entries
)) {
430 pos
= __pyx_bisect_code_objects(__pyx_code_cache
.entries
, __pyx_code_cache
.count
, code_line
);
431 if (unlikely(pos
>= __pyx_code_cache
.count
) || unlikely(__pyx_code_cache
.entries
[pos
].code_line
!= code_line
)) {
434 code_object
= __pyx_code_cache
.entries
[pos
].code_object
;
435 Py_INCREF(code_object
);
439 static void __pyx_insert_code_object(int code_line
, PyCodeObject
* code_object
) {
441 __Pyx_CodeObjectCacheEntry
* entries
= __pyx_code_cache
.entries
;
442 if (unlikely(!code_line
)) {
445 if (unlikely(!entries
)) {
446 entries
= (__Pyx_CodeObjectCacheEntry
*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry
));
447 if (likely(entries
)) {
448 __pyx_code_cache
.entries
= entries
;
449 __pyx_code_cache
.max_count
= 64;
450 __pyx_code_cache
.count
= 1;
451 entries
[0].code_line
= code_line
;
452 entries
[0].code_object
= code_object
;
453 Py_INCREF(code_object
);
457 pos
= __pyx_bisect_code_objects(__pyx_code_cache
.entries
, __pyx_code_cache
.count
, code_line
);
458 if ((pos
< __pyx_code_cache
.count
) && unlikely(__pyx_code_cache
.entries
[pos
].code_line
== code_line
)) {
459 PyCodeObject
* tmp
= entries
[pos
].code_object
;
460 entries
[pos
].code_object
= code_object
;
464 if (__pyx_code_cache
.count
== __pyx_code_cache
.max_count
) {
465 int new_max
= __pyx_code_cache
.max_count
+ 64;
466 entries
= (__Pyx_CodeObjectCacheEntry
*)PyMem_Realloc(
467 __pyx_code_cache
.entries
, (size_t)new_max
*sizeof(__Pyx_CodeObjectCacheEntry
));
468 if (unlikely(!entries
)) {
471 __pyx_code_cache
.entries
= entries
;
472 __pyx_code_cache
.max_count
= new_max
;
474 for (i
=__pyx_code_cache
.count
; i
>pos
; i
--) {
475 entries
[i
] = entries
[i
-1];
477 entries
[pos
].code_line
= code_line
;
478 entries
[pos
].code_object
= code_object
;
479 __pyx_code_cache
.count
++;
480 Py_INCREF(code_object
);
483 /////////////// CodeObjectCache.cleanup ///////////////
485 if (__pyx_code_cache
.entries
) {
486 __Pyx_CodeObjectCacheEntry
* entries
= __pyx_code_cache
.entries
;
487 int i
, count
= __pyx_code_cache
.count
;
488 __pyx_code_cache
.count
= 0;
489 __pyx_code_cache
.max_count
= 0;
490 __pyx_code_cache
.entries
= NULL
;
491 for (i
=0; i
<count
; i
++) {
492 Py_DECREF(entries
[i
].code_object
);
497 /////////////// CheckBinaryVersion.proto ///////////////
499 static int __Pyx_check_binary_version(void);
501 /////////////// CheckBinaryVersion ///////////////
503 static int __Pyx_check_binary_version(void) {
504 char ctversion
[4], rtversion
[4];
505 PyOS_snprintf(ctversion
, 4, "%d.%d", PY_MAJOR_VERSION
, PY_MINOR_VERSION
);
506 PyOS_snprintf(rtversion
, 4, "%s", Py_GetVersion());
507 if (ctversion
[0] != rtversion
[0] || ctversion
[2] != rtversion
[2]) {
509 PyOS_snprintf(message
, sizeof(message
),
510 "compiletime version %s of module '%.100s' "
511 "does not match runtime version %s",
512 ctversion
, __Pyx_MODULE_NAME
, rtversion
);
513 #if PY_VERSION_HEX < 0x02050000
514 return PyErr_Warn(NULL
, message
);
516 return PyErr_WarnEx(NULL
, message
, 1);
522 /////////////// Refnanny.proto ///////////////
524 #ifndef CYTHON_REFNANNY
525 #define CYTHON_REFNANNY 0
530 void (*INCREF
)(void*, PyObject
*, int);
531 void (*DECREF
)(void*, PyObject
*, int);
532 void (*GOTREF
)(void*, PyObject
*, int);
533 void (*GIVEREF
)(void*, PyObject
*, int);
534 void* (*SetupContext
)(const char*, int, const char*);
535 void (*FinishContext
)(void**);
536 } __Pyx_RefNannyAPIStruct
;
537 static __Pyx_RefNannyAPIStruct
*__Pyx_RefNanny
= NULL
;
538 static __Pyx_RefNannyAPIStruct
*__Pyx_RefNannyImportAPI(const char *modname
); /*proto*/
539 #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
541 #define __Pyx_RefNannySetupContext(name, acquire_gil) \
543 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \
544 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
545 PyGILState_Release(__pyx_gilstate_save); \
547 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
550 #define __Pyx_RefNannySetupContext(name, acquire_gil) \
551 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
553 #define __Pyx_RefNannyFinishContext() \
554 __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
555 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
556 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
557 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
558 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
559 #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
560 #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
561 #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
562 #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
564 #define __Pyx_RefNannyDeclarations
565 #define __Pyx_RefNannySetupContext(name, acquire_gil)
566 #define __Pyx_RefNannyFinishContext()
567 #define __Pyx_INCREF(r) Py_INCREF(r)
568 #define __Pyx_DECREF(r) Py_DECREF(r)
569 #define __Pyx_GOTREF(r)
570 #define __Pyx_GIVEREF(r)
571 #define __Pyx_XINCREF(r) Py_XINCREF(r)
572 #define __Pyx_XDECREF(r) Py_XDECREF(r)
573 #define __Pyx_XGOTREF(r)
574 #define __Pyx_XGIVEREF(r)
575 #endif /* CYTHON_REFNANNY */
577 #define __Pyx_XDECREF_SET(r, v) do { \
578 PyObject *tmp = (PyObject *) r; \
579 r = v; __Pyx_XDECREF(tmp); \
581 #define __Pyx_DECREF_SET(r, v) do { \
582 PyObject *tmp = (PyObject *) r; \
583 r = v; __Pyx_DECREF(tmp); \
586 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
587 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
589 /////////////// Refnanny ///////////////
592 static __Pyx_RefNannyAPIStruct
*__Pyx_RefNannyImportAPI(const char *modname
) {
593 PyObject
*m
= NULL
, *p
= NULL
;
595 m
= PyImport_ImportModule((char *)modname
);
597 p
= PyObject_GetAttrString(m
, (char *)"RefNannyAPI");
599 r
= PyLong_AsVoidPtr(p
);
603 return (__Pyx_RefNannyAPIStruct
*)r
;
605 #endif /* CYTHON_REFNANNY */
607 /////////////// RegisterModuleCleanup.proto ///////////////
608 //@substitute: naming
610 static void $
{cleanup_cname
}(PyObject
*self
); /*proto*/
611 static int __Pyx_RegisterCleanup(void); /*proto*/
613 /////////////// RegisterModuleCleanup ///////////////
614 //@substitute: naming
615 //@requires: ImportExport.c::ModuleImport
617 #if PY_MAJOR_VERSION < 3
618 static PyObject
* $
{cleanup_cname
}_atexit(PyObject
*module
, CYTHON_UNUSED PyObject
*unused
) {
619 $
{cleanup_cname
}(module
);
620 Py_INCREF(Py_None
); return Py_None
;
623 static int __Pyx_RegisterCleanup(void) {
624 // Don't use Py_AtExit because that has a 32-call limit and is called
625 // after python finalization.
626 // Also, we try to prepend the cleanup function to "atexit._exithandlers"
627 // in Py2 because CPython runs them last-to-first. Being run last allows
628 // user exit code to run before us that may depend on the globals
629 // and cached objects that we are about to clean up.
631 static PyMethodDef cleanup_def
= {
632 __Pyx_NAMESTR("__cleanup"), (PyCFunction
)$
{cleanup_cname
}_atexit
, METH_NOARGS
, 0};
634 PyObject
*cleanup_func
= 0;
635 PyObject
*atexit
= 0;
641 cleanup_func
= PyCFunction_New(&cleanup_def
, 0);
645 atexit
= __Pyx_ImportModule("atexit");
648 reg
= __Pyx_GetAttrString(atexit
, "_exithandlers");
649 if (reg
&& PyList_Check(reg
)) {
658 args
= PyTuple_Pack(3, cleanup_func
, a
, kw
);
663 ret
= PyList_Insert(reg
, 0, args
);
668 reg
= __Pyx_GetAttrString(atexit
, "register");
671 args
= PyTuple_Pack(1, cleanup_func
);
674 res
= PyObject_CallObject(reg
, args
);
680 Py_XDECREF(cleanup_func
);
688 // fake call purely to work around "unused function" warning for __Pyx_ImportModule()
689 static int __Pyx_RegisterCleanup(void) {
690 if (0) __Pyx_ImportModule(NULL
);