1 /* Generated by Cython 0.29.20 */
2
3 #define PY_SSIZE_T_CLEAN
4 #include "Python.h"
5 #ifndef Py_PYTHON_H
6 #error Python headers needed to compile C extensions, please install development version of Python.
7 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
8 #error Cython requires Python 2.6+ or Python 3.3+.
9 #else
10 #define CYTHON_ABI "0_29_20"
11 #define CYTHON_HEX_VERSION 0x001D14F0
12 #define CYTHON_FUTURE_DIVISION 0
13 #include <stddef.h>
14 #ifndef offsetof
15 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
16 #endif
17 #if !defined(WIN32) && !defined(MS_WINDOWS)
18 #ifndef __stdcall
19 #define __stdcall
20 #endif
21 #ifndef __cdecl
22 #define __cdecl
23 #endif
24 #ifndef __fastcall
25 #define __fastcall
26 #endif
27 #endif
28 #ifndef DL_IMPORT
29 #define DL_IMPORT(t) t
30 #endif
31 #ifndef DL_EXPORT
32 #define DL_EXPORT(t) t
33 #endif
34 #define __PYX_COMMA ,
35 #ifndef HAVE_LONG_LONG
36 #if PY_VERSION_HEX >= 0x02070000
37 #define HAVE_LONG_LONG
38 #endif
39 #endif
40 #ifndef PY_LONG_LONG
41 #define PY_LONG_LONG LONG_LONG
42 #endif
43 #ifndef Py_HUGE_VAL
44 #define Py_HUGE_VAL HUGE_VAL
45 #endif
46 #ifdef PYPY_VERSION
47 #define CYTHON_COMPILING_IN_PYPY 1
48 #define CYTHON_COMPILING_IN_PYSTON 0
49 #define CYTHON_COMPILING_IN_CPYTHON 0
50 #undef CYTHON_USE_TYPE_SLOTS
51 #define CYTHON_USE_TYPE_SLOTS 0
52 #undef CYTHON_USE_PYTYPE_LOOKUP
53 #define CYTHON_USE_PYTYPE_LOOKUP 0
54 #if PY_VERSION_HEX < 0x03050000
55 #undef CYTHON_USE_ASYNC_SLOTS
56 #define CYTHON_USE_ASYNC_SLOTS 0
57 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
58 #define CYTHON_USE_ASYNC_SLOTS 1
59 #endif
60 #undef CYTHON_USE_PYLIST_INTERNALS
61 #define CYTHON_USE_PYLIST_INTERNALS 0
62 #undef CYTHON_USE_UNICODE_INTERNALS
63 #define CYTHON_USE_UNICODE_INTERNALS 0
64 #undef CYTHON_USE_UNICODE_WRITER
65 #define CYTHON_USE_UNICODE_WRITER 0
66 #undef CYTHON_USE_PYLONG_INTERNALS
67 #define CYTHON_USE_PYLONG_INTERNALS 0
68 #undef CYTHON_AVOID_BORROWED_REFS
69 #define CYTHON_AVOID_BORROWED_REFS 1
70 #undef CYTHON_ASSUME_SAFE_MACROS
71 #define CYTHON_ASSUME_SAFE_MACROS 0
72 #undef CYTHON_UNPACK_METHODS
73 #define CYTHON_UNPACK_METHODS 0
74 #undef CYTHON_FAST_THREAD_STATE
75 #define CYTHON_FAST_THREAD_STATE 0
76 #undef CYTHON_FAST_PYCALL
77 #define CYTHON_FAST_PYCALL 0
78 #undef CYTHON_PEP489_MULTI_PHASE_INIT
79 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
80 #undef CYTHON_USE_TP_FINALIZE
81 #define CYTHON_USE_TP_FINALIZE 0
82 #undef CYTHON_USE_DICT_VERSIONS
83 #define CYTHON_USE_DICT_VERSIONS 0
84 #undef CYTHON_USE_EXC_INFO_STACK
85 #define CYTHON_USE_EXC_INFO_STACK 0
86 #elif defined(PYSTON_VERSION)
87 #define CYTHON_COMPILING_IN_PYPY 0
88 #define CYTHON_COMPILING_IN_PYSTON 1
89 #define CYTHON_COMPILING_IN_CPYTHON 0
90 #ifndef CYTHON_USE_TYPE_SLOTS
91 #define CYTHON_USE_TYPE_SLOTS 1
92 #endif
93 #undef CYTHON_USE_PYTYPE_LOOKUP
94 #define CYTHON_USE_PYTYPE_LOOKUP 0
95 #undef CYTHON_USE_ASYNC_SLOTS
96 #define CYTHON_USE_ASYNC_SLOTS 0
97 #undef CYTHON_USE_PYLIST_INTERNALS
98 #define CYTHON_USE_PYLIST_INTERNALS 0
99 #ifndef CYTHON_USE_UNICODE_INTERNALS
100 #define CYTHON_USE_UNICODE_INTERNALS 1
101 #endif
102 #undef CYTHON_USE_UNICODE_WRITER
103 #define CYTHON_USE_UNICODE_WRITER 0
104 #undef CYTHON_USE_PYLONG_INTERNALS
105 #define CYTHON_USE_PYLONG_INTERNALS 0
106 #ifndef CYTHON_AVOID_BORROWED_REFS
107 #define CYTHON_AVOID_BORROWED_REFS 0
108 #endif
109 #ifndef CYTHON_ASSUME_SAFE_MACROS
110 #define CYTHON_ASSUME_SAFE_MACROS 1
111 #endif
112 #ifndef CYTHON_UNPACK_METHODS
113 #define CYTHON_UNPACK_METHODS 1
114 #endif
115 #undef CYTHON_FAST_THREAD_STATE
116 #define CYTHON_FAST_THREAD_STATE 0
117 #undef CYTHON_FAST_PYCALL
118 #define CYTHON_FAST_PYCALL 0
119 #undef CYTHON_PEP489_MULTI_PHASE_INIT
120 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
121 #undef CYTHON_USE_TP_FINALIZE
122 #define CYTHON_USE_TP_FINALIZE 0
123 #undef CYTHON_USE_DICT_VERSIONS
124 #define CYTHON_USE_DICT_VERSIONS 0
125 #undef CYTHON_USE_EXC_INFO_STACK
126 #define CYTHON_USE_EXC_INFO_STACK 0
127 #else
128 #define CYTHON_COMPILING_IN_PYPY 0
129 #define CYTHON_COMPILING_IN_PYSTON 0
130 #define CYTHON_COMPILING_IN_CPYTHON 1
131 #ifndef CYTHON_USE_TYPE_SLOTS
132 #define CYTHON_USE_TYPE_SLOTS 1
133 #endif
134 #if PY_VERSION_HEX < 0x02070000
135 #undef CYTHON_USE_PYTYPE_LOOKUP
136 #define CYTHON_USE_PYTYPE_LOOKUP 0
137 #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
138 #define CYTHON_USE_PYTYPE_LOOKUP 1
139 #endif
140 #if PY_MAJOR_VERSION < 3
141 #undef CYTHON_USE_ASYNC_SLOTS
142 #define CYTHON_USE_ASYNC_SLOTS 0
143 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
144 #define CYTHON_USE_ASYNC_SLOTS 1
145 #endif
146 #if PY_VERSION_HEX < 0x02070000
147 #undef CYTHON_USE_PYLONG_INTERNALS
148 #define CYTHON_USE_PYLONG_INTERNALS 0
149 #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
150 #define CYTHON_USE_PYLONG_INTERNALS 1
151 #endif
152 #ifndef CYTHON_USE_PYLIST_INTERNALS
153 #define CYTHON_USE_PYLIST_INTERNALS 1
154 #endif
155 #ifndef CYTHON_USE_UNICODE_INTERNALS
156 #define CYTHON_USE_UNICODE_INTERNALS 1
157 #endif
158 #if PY_VERSION_HEX < 0x030300F0
159 #undef CYTHON_USE_UNICODE_WRITER
160 #define CYTHON_USE_UNICODE_WRITER 0
161 #elif !defined(CYTHON_USE_UNICODE_WRITER)
162 #define CYTHON_USE_UNICODE_WRITER 1
163 #endif
164 #ifndef CYTHON_AVOID_BORROWED_REFS
165 #define CYTHON_AVOID_BORROWED_REFS 0
166 #endif
167 #ifndef CYTHON_ASSUME_SAFE_MACROS
168 #define CYTHON_ASSUME_SAFE_MACROS 1
169 #endif
170 #ifndef CYTHON_UNPACK_METHODS
171 #define CYTHON_UNPACK_METHODS 1
172 #endif
173 #ifndef CYTHON_FAST_THREAD_STATE
174 #define CYTHON_FAST_THREAD_STATE 1
175 #endif
176 #ifndef CYTHON_FAST_PYCALL
177 #define CYTHON_FAST_PYCALL 1
178 #endif
179 #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
180 #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
181 #endif
182 #ifndef CYTHON_USE_TP_FINALIZE
183 #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
184 #endif
185 #ifndef CYTHON_USE_DICT_VERSIONS
186 #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
187 #endif
188 #ifndef CYTHON_USE_EXC_INFO_STACK
189 #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
190 #endif
191 #endif
192 #if !defined(CYTHON_FAST_PYCCALL)
193 #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
194 #endif
195 #if CYTHON_USE_PYLONG_INTERNALS
196 #include "longintrepr.h"
197 #undef SHIFT
198 #undef BASE
199 #undef MASK
200 #ifdef SIZEOF_VOID_P
201 enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
202 #endif
203 #endif
204 #ifndef __has_attribute
205 #define __has_attribute(x) 0
206 #endif
207 #ifndef __has_cpp_attribute
208 #define __has_cpp_attribute(x) 0
209 #endif
210 #ifndef CYTHON_RESTRICT
211 #if defined(__GNUC__)
212 #define CYTHON_RESTRICT __restrict__
213 #elif defined(_MSC_VER) && _MSC_VER >= 1400
214 #define CYTHON_RESTRICT __restrict
215 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
216 #define CYTHON_RESTRICT restrict
217 #else
218 #define CYTHON_RESTRICT
219 #endif
220 #endif
221 #ifndef CYTHON_UNUSED
222 # if defined(__GNUC__)
223 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
224 # define CYTHON_UNUSED __attribute__ ((__unused__))
225 # else
226 # define CYTHON_UNUSED
227 # endif
228 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
229 # define CYTHON_UNUSED __attribute__ ((__unused__))
230 # else
231 # define CYTHON_UNUSED
232 # endif
233 #endif
234 #ifndef CYTHON_MAYBE_UNUSED_VAR
235 # if defined(__cplusplus)
CYTHON_MAYBE_UNUSED_VAR(const T &)236 template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
237 # else
238 # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
239 # endif
240 #endif
241 #ifndef CYTHON_NCP_UNUSED
242 # if CYTHON_COMPILING_IN_CPYTHON
243 # define CYTHON_NCP_UNUSED
244 # else
245 # define CYTHON_NCP_UNUSED CYTHON_UNUSED
246 # endif
247 #endif
248 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
249 #ifdef _MSC_VER
250 #ifndef _MSC_STDINT_H_
251 #if _MSC_VER < 1300
252 typedef unsigned char uint8_t;
253 typedef unsigned int uint32_t;
254 #else
255 typedef unsigned __int8 uint8_t;
256 typedef unsigned __int32 uint32_t;
257 #endif
258 #endif
259 #else
260 #include <stdint.h>
261 #endif
262 #ifndef CYTHON_FALLTHROUGH
263 #if defined(__cplusplus) && __cplusplus >= 201103L
264 #if __has_cpp_attribute(fallthrough)
265 #define CYTHON_FALLTHROUGH [[fallthrough]]
266 #elif __has_cpp_attribute(clang::fallthrough)
267 #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
268 #elif __has_cpp_attribute(gnu::fallthrough)
269 #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
270 #endif
271 #endif
272 #ifndef CYTHON_FALLTHROUGH
273 #if __has_attribute(fallthrough)
274 #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
275 #else
276 #define CYTHON_FALLTHROUGH
277 #endif
278 #endif
279 #if defined(__clang__ ) && defined(__apple_build_version__)
280 #if __apple_build_version__ < 7000000
281 #undef CYTHON_FALLTHROUGH
282 #define CYTHON_FALLTHROUGH
283 #endif
284 #endif
285 #endif
286
287 #ifndef CYTHON_INLINE
288 #if defined(__clang__)
289 #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
290 #elif defined(__GNUC__)
291 #define CYTHON_INLINE __inline__
292 #elif defined(_MSC_VER)
293 #define CYTHON_INLINE __inline
294 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
295 #define CYTHON_INLINE inline
296 #else
297 #define CYTHON_INLINE
298 #endif
299 #endif
300
301 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
302 #define Py_OptimizeFlag 0
303 #endif
304 #define __PYX_BUILD_PY_SSIZE_T "n"
305 #define CYTHON_FORMAT_SSIZE_T "z"
306 #if PY_MAJOR_VERSION < 3
307 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
308 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
309 PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
310 #define __Pyx_DefaultClassType PyClass_Type
311 #else
312 #define __Pyx_BUILTIN_MODULE_NAME "builtins"
313 #if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
314 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
315 PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
316 #else
317 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
318 PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
319 #endif
320 #define __Pyx_DefaultClassType PyType_Type
321 #endif
322 #ifndef Py_TPFLAGS_CHECKTYPES
323 #define Py_TPFLAGS_CHECKTYPES 0
324 #endif
325 #ifndef Py_TPFLAGS_HAVE_INDEX
326 #define Py_TPFLAGS_HAVE_INDEX 0
327 #endif
328 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
329 #define Py_TPFLAGS_HAVE_NEWBUFFER 0
330 #endif
331 #ifndef Py_TPFLAGS_HAVE_FINALIZE
332 #define Py_TPFLAGS_HAVE_FINALIZE 0
333 #endif
334 #ifndef METH_STACKLESS
335 #define METH_STACKLESS 0
336 #endif
337 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
338 #ifndef METH_FASTCALL
339 #define METH_FASTCALL 0x80
340 #endif
341 typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
342 typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
343 Py_ssize_t nargs, PyObject *kwnames);
344 #else
345 #define __Pyx_PyCFunctionFast _PyCFunctionFast
346 #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
347 #endif
348 #if CYTHON_FAST_PYCCALL
349 #define __Pyx_PyFastCFunction_Check(func)\
350 ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
351 #else
352 #define __Pyx_PyFastCFunction_Check(func) 0
353 #endif
354 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
355 #define PyObject_Malloc(s) PyMem_Malloc(s)
356 #define PyObject_Free(p) PyMem_Free(p)
357 #define PyObject_Realloc(p) PyMem_Realloc(p)
358 #endif
359 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
360 #define PyMem_RawMalloc(n) PyMem_Malloc(n)
361 #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n)
362 #define PyMem_RawFree(p) PyMem_Free(p)
363 #endif
364 #if CYTHON_COMPILING_IN_PYSTON
365 #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
366 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
367 #else
368 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
369 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
370 #endif
371 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
372 #define __Pyx_PyThreadState_Current PyThreadState_GET()
373 #elif PY_VERSION_HEX >= 0x03060000
374 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
375 #elif PY_VERSION_HEX >= 0x03000000
376 #define __Pyx_PyThreadState_Current PyThreadState_GET()
377 #else
378 #define __Pyx_PyThreadState_Current _PyThreadState_Current
379 #endif
380 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
381 #include "pythread.h"
382 #define Py_tss_NEEDS_INIT 0
383 typedef int Py_tss_t;
PyThread_tss_create(Py_tss_t * key)384 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
385 *key = PyThread_create_key();
386 return 0;
387 }
PyThread_tss_alloc(void)388 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
389 Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
390 *key = Py_tss_NEEDS_INIT;
391 return key;
392 }
PyThread_tss_free(Py_tss_t * key)393 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
394 PyObject_Free(key);
395 }
PyThread_tss_is_created(Py_tss_t * key)396 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
397 return *key != Py_tss_NEEDS_INIT;
398 }
PyThread_tss_delete(Py_tss_t * key)399 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
400 PyThread_delete_key(*key);
401 *key = Py_tss_NEEDS_INIT;
402 }
PyThread_tss_set(Py_tss_t * key,void * value)403 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
404 return PyThread_set_key_value(*key, value);
405 }
PyThread_tss_get(Py_tss_t * key)406 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
407 return PyThread_get_key_value(*key);
408 }
409 #endif
410 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
411 #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
412 #else
413 #define __Pyx_PyDict_NewPresized(n) PyDict_New()
414 #endif
415 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
416 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
417 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
418 #else
419 #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
420 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
421 #endif
422 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
423 #define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
424 #else
425 #define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name)
426 #endif
427 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
428 #define CYTHON_PEP393_ENABLED 1
429 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
430 0 : _PyUnicode_Ready((PyObject *)(op)))
431 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
432 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
433 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
434 #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
435 #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
436 #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
437 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
438 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
439 #else
440 #define CYTHON_PEP393_ENABLED 0
441 #define PyUnicode_1BYTE_KIND 1
442 #define PyUnicode_2BYTE_KIND 2
443 #define PyUnicode_4BYTE_KIND 4
444 #define __Pyx_PyUnicode_READY(op) (0)
445 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
446 #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
447 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
448 #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
449 #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
450 #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
451 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
452 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
453 #endif
454 #if CYTHON_COMPILING_IN_PYPY
455 #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
456 #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
457 #else
458 #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
459 #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
460 PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
461 #endif
462 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
463 #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
464 #endif
465 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
466 #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
467 #endif
468 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
469 #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
470 #endif
471 #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))
472 #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
473 #if PY_MAJOR_VERSION >= 3
474 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
475 #else
476 #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
477 #endif
478 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
479 #define PyObject_ASCII(o) PyObject_Repr(o)
480 #endif
481 #if PY_MAJOR_VERSION >= 3
482 #define PyBaseString_Type PyUnicode_Type
483 #define PyStringObject PyUnicodeObject
484 #define PyString_Type PyUnicode_Type
485 #define PyString_Check PyUnicode_Check
486 #define PyString_CheckExact PyUnicode_CheckExact
487 #ifndef PyObject_Unicode
488 #define PyObject_Unicode PyObject_Str
489 #endif
490 #endif
491 #if PY_MAJOR_VERSION >= 3
492 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
493 #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
494 #else
495 #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
496 #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
497 #endif
498 #ifndef PySet_CheckExact
499 #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
500 #endif
501 #if PY_VERSION_HEX >= 0x030900A4
502 #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
503 #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
504 #else
505 #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
506 #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
507 #endif
508 #if CYTHON_ASSUME_SAFE_MACROS
509 #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
510 #else
511 #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
512 #endif
513 #if PY_MAJOR_VERSION >= 3
514 #define PyIntObject PyLongObject
515 #define PyInt_Type PyLong_Type
516 #define PyInt_Check(op) PyLong_Check(op)
517 #define PyInt_CheckExact(op) PyLong_CheckExact(op)
518 #define PyInt_FromString PyLong_FromString
519 #define PyInt_FromUnicode PyLong_FromUnicode
520 #define PyInt_FromLong PyLong_FromLong
521 #define PyInt_FromSize_t PyLong_FromSize_t
522 #define PyInt_FromSsize_t PyLong_FromSsize_t
523 #define PyInt_AsLong PyLong_AsLong
524 #define PyInt_AS_LONG PyLong_AS_LONG
525 #define PyInt_AsSsize_t PyLong_AsSsize_t
526 #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
527 #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
528 #define PyNumber_Int PyNumber_Long
529 #endif
530 #if PY_MAJOR_VERSION >= 3
531 #define PyBoolObject PyLongObject
532 #endif
533 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
534 #ifndef PyUnicode_InternFromString
535 #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
536 #endif
537 #endif
538 #if PY_VERSION_HEX < 0x030200A4
539 typedef long Py_hash_t;
540 #define __Pyx_PyInt_FromHash_t PyInt_FromLong
541 #define __Pyx_PyInt_AsHash_t PyInt_AsLong
542 #else
543 #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
544 #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
545 #endif
546 #if PY_MAJOR_VERSION >= 3
547 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func))
548 #else
549 #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
550 #endif
551 #if CYTHON_USE_ASYNC_SLOTS
552 #if PY_VERSION_HEX >= 0x030500B1
553 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
554 #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
555 #else
556 #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
557 #endif
558 #else
559 #define __Pyx_PyType_AsAsync(obj) NULL
560 #endif
561 #ifndef __Pyx_PyAsyncMethodsStruct
562 typedef struct {
563 unaryfunc am_await;
564 unaryfunc am_aiter;
565 unaryfunc am_anext;
566 } __Pyx_PyAsyncMethodsStruct;
567 #endif
568
569 #if defined(WIN32) || defined(MS_WINDOWS)
570 #define _USE_MATH_DEFINES
571 #endif
572 #include <math.h>
573 #ifdef NAN
574 #define __PYX_NAN() ((float) NAN)
575 #else
__PYX_NAN()576 static CYTHON_INLINE float __PYX_NAN() {
577 float value;
578 memset(&value, 0xFF, sizeof(value));
579 return value;
580 }
581 #endif
582 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
583 #define __Pyx_truncl trunc
584 #else
585 #define __Pyx_truncl truncl
586 #endif
587
588 #define __PYX_MARK_ERR_POS(f_index, lineno) \
589 { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
590 #define __PYX_ERR(f_index, lineno, Ln_error) \
591 { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
592
593 #ifndef __PYX_EXTERN_C
594 #ifdef __cplusplus
595 #define __PYX_EXTERN_C extern "C"
596 #else
597 #define __PYX_EXTERN_C extern
598 #endif
599 #endif
600
601 #define __PYX_HAVE__pygame_sdl2__error
602 #define __PYX_HAVE_API__pygame_sdl2__error
603 /* Early includes */
604 #include <stdint.h>
605 #include <string.h>
606 #include <stdio.h>
607 #include <stddef.h>
608 #include "SDL.h"
609 #ifdef _OPENMP
610 #include <omp.h>
611 #endif /* _OPENMP */
612
613 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
614 #define CYTHON_WITHOUT_ASSERTIONS
615 #endif
616
617 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
618 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
619
620 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
621 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
622 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
623 #define __PYX_DEFAULT_STRING_ENCODING ""
624 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
625 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
626 #define __Pyx_uchar_cast(c) ((unsigned char)c)
627 #define __Pyx_long_cast(x) ((long)x)
628 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
629 (sizeof(type) < sizeof(Py_ssize_t)) ||\
630 (sizeof(type) > sizeof(Py_ssize_t) &&\
631 likely(v < (type)PY_SSIZE_T_MAX ||\
632 v == (type)PY_SSIZE_T_MAX) &&\
633 (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
634 v == (type)PY_SSIZE_T_MIN))) ||\
635 (sizeof(type) == sizeof(Py_ssize_t) &&\
636 (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
637 v == (type)PY_SSIZE_T_MAX))) )
__Pyx_is_valid_index(Py_ssize_t i,Py_ssize_t limit)638 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
639 return (size_t) i < (size_t) limit;
640 }
641 #if defined (__cplusplus) && __cplusplus >= 201103L
642 #include <cstdlib>
643 #define __Pyx_sst_abs(value) std::abs(value)
644 #elif SIZEOF_INT >= SIZEOF_SIZE_T
645 #define __Pyx_sst_abs(value) abs(value)
646 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
647 #define __Pyx_sst_abs(value) labs(value)
648 #elif defined (_MSC_VER)
649 #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
650 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
651 #define __Pyx_sst_abs(value) llabs(value)
652 #elif defined (__GNUC__)
653 #define __Pyx_sst_abs(value) __builtin_llabs(value)
654 #else
655 #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
656 #endif
657 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
658 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
659 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
660 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
661 #define __Pyx_PyBytes_FromString PyBytes_FromString
662 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
663 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
664 #if PY_MAJOR_VERSION < 3
665 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
666 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
667 #else
668 #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
669 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
670 #endif
671 #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
672 #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
673 #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
674 #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
675 #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
676 #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
677 #define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s))
678 #define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
679 #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
680 #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
681 #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
682 #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
683 #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
684 #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
685 #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
686 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
__Pyx_Py_UNICODE_strlen(const Py_UNICODE * u)687 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
688 const Py_UNICODE *u_end = u;
689 while (*u_end++) ;
690 return (size_t)(u_end - u - 1);
691 }
692 #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
693 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
694 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
695 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
696 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
697 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
698 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
699 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
700 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
701 #define __Pyx_PySequence_Tuple(obj)\
702 (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
703 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
704 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
705 #if CYTHON_ASSUME_SAFE_MACROS
706 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
707 #else
708 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
709 #endif
710 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
711 #if PY_MAJOR_VERSION >= 3
712 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
713 #else
714 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
715 #endif
716 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
717 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
718 static int __Pyx_sys_getdefaultencoding_not_ascii;
__Pyx_init_sys_getdefaultencoding_params(void)719 static int __Pyx_init_sys_getdefaultencoding_params(void) {
720 PyObject* sys;
721 PyObject* default_encoding = NULL;
722 PyObject* ascii_chars_u = NULL;
723 PyObject* ascii_chars_b = NULL;
724 const char* default_encoding_c;
725 sys = PyImport_ImportModule("sys");
726 if (!sys) goto bad;
727 default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
728 Py_DECREF(sys);
729 if (!default_encoding) goto bad;
730 default_encoding_c = PyBytes_AsString(default_encoding);
731 if (!default_encoding_c) goto bad;
732 if (strcmp(default_encoding_c, "ascii") == 0) {
733 __Pyx_sys_getdefaultencoding_not_ascii = 0;
734 } else {
735 char ascii_chars[128];
736 int c;
737 for (c = 0; c < 128; c++) {
738 ascii_chars[c] = c;
739 }
740 __Pyx_sys_getdefaultencoding_not_ascii = 1;
741 ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
742 if (!ascii_chars_u) goto bad;
743 ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
744 if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
745 PyErr_Format(
746 PyExc_ValueError,
747 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
748 default_encoding_c);
749 goto bad;
750 }
751 Py_DECREF(ascii_chars_u);
752 Py_DECREF(ascii_chars_b);
753 }
754 Py_DECREF(default_encoding);
755 return 0;
756 bad:
757 Py_XDECREF(default_encoding);
758 Py_XDECREF(ascii_chars_u);
759 Py_XDECREF(ascii_chars_b);
760 return -1;
761 }
762 #endif
763 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
764 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
765 #else
766 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
767 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
768 static char* __PYX_DEFAULT_STRING_ENCODING;
__Pyx_init_sys_getdefaultencoding_params(void)769 static int __Pyx_init_sys_getdefaultencoding_params(void) {
770 PyObject* sys;
771 PyObject* default_encoding = NULL;
772 char* default_encoding_c;
773 sys = PyImport_ImportModule("sys");
774 if (!sys) goto bad;
775 default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
776 Py_DECREF(sys);
777 if (!default_encoding) goto bad;
778 default_encoding_c = PyBytes_AsString(default_encoding);
779 if (!default_encoding_c) goto bad;
780 __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
781 if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
782 strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
783 Py_DECREF(default_encoding);
784 return 0;
785 bad:
786 Py_XDECREF(default_encoding);
787 return -1;
788 }
789 #endif
790 #endif
791
792
793 /* Test for GCC > 2.95 */
794 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
795 #define likely(x) __builtin_expect(!!(x), 1)
796 #define unlikely(x) __builtin_expect(!!(x), 0)
797 #else /* !__GNUC__ or GCC < 2.95 */
798 #define likely(x) (x)
799 #define unlikely(x) (x)
800 #endif /* __GNUC__ */
__Pyx_pretend_to_initialize(void * ptr)801 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
802
803 static PyObject *__pyx_m = NULL;
804 static PyObject *__pyx_d;
805 static PyObject *__pyx_b;
806 static PyObject *__pyx_cython_runtime = NULL;
807 static PyObject *__pyx_empty_tuple;
808 static PyObject *__pyx_empty_bytes;
809 static PyObject *__pyx_empty_unicode;
810 static int __pyx_lineno;
811 static int __pyx_clineno = 0;
812 static const char * __pyx_cfilenm= __FILE__;
813 static const char *__pyx_filename;
814
815
816 static const char *__pyx_f[] = {
817 "src/pygame_sdl2/error.pyx",
818 };
819
820 /*--- Type declarations ---*/
821
822 /* --- Runtime support code (head) --- */
823 /* Refnanny.proto */
824 #ifndef CYTHON_REFNANNY
825 #define CYTHON_REFNANNY 0
826 #endif
827 #if CYTHON_REFNANNY
828 typedef struct {
829 void (*INCREF)(void*, PyObject*, int);
830 void (*DECREF)(void*, PyObject*, int);
831 void (*GOTREF)(void*, PyObject*, int);
832 void (*GIVEREF)(void*, PyObject*, int);
833 void* (*SetupContext)(const char*, int, const char*);
834 void (*FinishContext)(void**);
835 } __Pyx_RefNannyAPIStruct;
836 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
837 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
838 #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
839 #ifdef WITH_THREAD
840 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
841 if (acquire_gil) {\
842 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
843 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
844 PyGILState_Release(__pyx_gilstate_save);\
845 } else {\
846 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
847 }
848 #else
849 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
850 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
851 #endif
852 #define __Pyx_RefNannyFinishContext()\
853 __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
854 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
855 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
856 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
857 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
858 #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
859 #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
860 #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
861 #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
862 #else
863 #define __Pyx_RefNannyDeclarations
864 #define __Pyx_RefNannySetupContext(name, acquire_gil)
865 #define __Pyx_RefNannyFinishContext()
866 #define __Pyx_INCREF(r) Py_INCREF(r)
867 #define __Pyx_DECREF(r) Py_DECREF(r)
868 #define __Pyx_GOTREF(r)
869 #define __Pyx_GIVEREF(r)
870 #define __Pyx_XINCREF(r) Py_XINCREF(r)
871 #define __Pyx_XDECREF(r) Py_XDECREF(r)
872 #define __Pyx_XGOTREF(r)
873 #define __Pyx_XGIVEREF(r)
874 #endif
875 #define __Pyx_XDECREF_SET(r, v) do {\
876 PyObject *tmp = (PyObject *) r;\
877 r = v; __Pyx_XDECREF(tmp);\
878 } while (0)
879 #define __Pyx_DECREF_SET(r, v) do {\
880 PyObject *tmp = (PyObject *) r;\
881 r = v; __Pyx_DECREF(tmp);\
882 } while (0)
883 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
884 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
885
886 /* PyObjectGetAttrStr.proto */
887 #if CYTHON_USE_TYPE_SLOTS
888 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
889 #else
890 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
891 #endif
892
893 /* GetBuiltinName.proto */
894 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
895
896 /* RaiseDoubleKeywords.proto */
897 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
898
899 /* ParseKeywords.proto */
900 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
901 PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
902 const char* function_name);
903
904 /* RaiseArgTupleInvalid.proto */
905 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
906 Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
907
908 /* PyCFunctionFastCall.proto */
909 #if CYTHON_FAST_PYCCALL
910 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
911 #else
912 #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
913 #endif
914
915 /* PyFunctionFastCall.proto */
916 #if CYTHON_FAST_PYCALL
917 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
918 __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
919 #if 1 || PY_VERSION_HEX < 0x030600B1
920 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
921 #else
922 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
923 #endif
924 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
925 (sizeof(char [1 - 2*!(cond)]) - 1)
926 #ifndef Py_MEMBER_SIZE
927 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
928 #endif
929 static size_t __pyx_pyframe_localsplus_offset = 0;
930 #include "frameobject.h"
931 #define __Pxy_PyFrame_Initialize_Offsets()\
932 ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
933 (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
934 #define __Pyx_PyFrame_GetLocalsplus(frame)\
935 (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
936 #endif
937
938 /* PyObjectCall.proto */
939 #if CYTHON_COMPILING_IN_CPYTHON
940 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
941 #else
942 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
943 #endif
944
945 /* PyObjectCallMethO.proto */
946 #if CYTHON_COMPILING_IN_CPYTHON
947 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
948 #endif
949
950 /* PyObjectCallOneArg.proto */
951 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
952
953 /* CalculateMetaclass.proto */
954 static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);
955
956 /* FetchCommonType.proto */
957 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
958
959 /* CythonFunctionShared.proto */
960 #define __Pyx_CyFunction_USED 1
961 #define __Pyx_CYFUNCTION_STATICMETHOD 0x01
962 #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02
963 #define __Pyx_CYFUNCTION_CCLASS 0x04
964 #define __Pyx_CyFunction_GetClosure(f)\
965 (((__pyx_CyFunctionObject *) (f))->func_closure)
966 #define __Pyx_CyFunction_GetClassObj(f)\
967 (((__pyx_CyFunctionObject *) (f))->func_classobj)
968 #define __Pyx_CyFunction_Defaults(type, f)\
969 ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
970 #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
971 ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
972 typedef struct {
973 PyCFunctionObject func;
974 #if PY_VERSION_HEX < 0x030500A0
975 PyObject *func_weakreflist;
976 #endif
977 PyObject *func_dict;
978 PyObject *func_name;
979 PyObject *func_qualname;
980 PyObject *func_doc;
981 PyObject *func_globals;
982 PyObject *func_code;
983 PyObject *func_closure;
984 PyObject *func_classobj;
985 void *defaults;
986 int defaults_pyobjects;
987 size_t defaults_size; // used by FusedFunction for copying defaults
988 int flags;
989 PyObject *defaults_tuple;
990 PyObject *defaults_kwdict;
991 PyObject *(*defaults_getter)(PyObject *);
992 PyObject *func_annotations;
993 } __pyx_CyFunctionObject;
994 static PyTypeObject *__pyx_CyFunctionType = 0;
995 #define __Pyx_CyFunction_Check(obj) (__Pyx_TypeCheck(obj, __pyx_CyFunctionType))
996 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml,
997 int flags, PyObject* qualname,
998 PyObject *self,
999 PyObject *module, PyObject *globals,
1000 PyObject* code);
1001 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
1002 size_t size,
1003 int pyobjects);
1004 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
1005 PyObject *tuple);
1006 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
1007 PyObject *dict);
1008 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
1009 PyObject *dict);
1010 static int __pyx_CyFunction_init(void);
1011
1012 /* CythonFunction.proto */
1013 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
1014 int flags, PyObject* qualname,
1015 PyObject *closure,
1016 PyObject *module, PyObject *globals,
1017 PyObject* code);
1018
1019 /* SetNameInClass.proto */
1020 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
1021 #define __Pyx_SetNameInClass(ns, name, value)\
1022 (likely(PyDict_CheckExact(ns)) ? _PyDict_SetItem_KnownHash(ns, name, value, ((PyASCIIObject *) name)->hash) : PyObject_SetItem(ns, name, value))
1023 #elif CYTHON_COMPILING_IN_CPYTHON
1024 #define __Pyx_SetNameInClass(ns, name, value)\
1025 (likely(PyDict_CheckExact(ns)) ? PyDict_SetItem(ns, name, value) : PyObject_SetItem(ns, name, value))
1026 #else
1027 #define __Pyx_SetNameInClass(ns, name, value) PyObject_SetItem(ns, name, value)
1028 #endif
1029
1030 /* Py3ClassCreate.proto */
1031 static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname,
1032 PyObject *mkw, PyObject *modname, PyObject *doc);
1033 static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict,
1034 PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass);
1035
1036 /* PyDictVersioning.proto */
1037 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1038 #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
1039 #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
1040 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1041 (version_var) = __PYX_GET_DICT_VERSION(dict);\
1042 (cache_var) = (value);
1043 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1044 static PY_UINT64_T __pyx_dict_version = 0;\
1045 static PyObject *__pyx_dict_cached_value = NULL;\
1046 if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1047 (VAR) = __pyx_dict_cached_value;\
1048 } else {\
1049 (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1050 __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1051 }\
1052 }
1053 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1054 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1055 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1056 #else
1057 #define __PYX_GET_DICT_VERSION(dict) (0)
1058 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1059 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
1060 #endif
1061
1062 /* PyThreadStateGet.proto */
1063 #if CYTHON_FAST_THREAD_STATE
1064 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
1065 #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
1066 #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
1067 #else
1068 #define __Pyx_PyThreadState_declare
1069 #define __Pyx_PyThreadState_assign
1070 #define __Pyx_PyErr_Occurred() PyErr_Occurred()
1071 #endif
1072
1073 /* PyErrFetchRestore.proto */
1074 #if CYTHON_FAST_THREAD_STATE
1075 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1076 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1077 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1078 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1079 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1080 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1081 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1082 #if CYTHON_COMPILING_IN_CPYTHON
1083 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1084 #else
1085 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1086 #endif
1087 #else
1088 #define __Pyx_PyErr_Clear() PyErr_Clear()
1089 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1090 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1091 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1092 #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
1093 #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
1094 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1095 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1096 #endif
1097
1098 /* CLineInTraceback.proto */
1099 #ifdef CYTHON_CLINE_IN_TRACEBACK
1100 #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1101 #else
1102 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1103 #endif
1104
1105 /* CodeObjectCache.proto */
1106 typedef struct {
1107 PyCodeObject* code_object;
1108 int code_line;
1109 } __Pyx_CodeObjectCacheEntry;
1110 struct __Pyx_CodeObjectCache {
1111 int count;
1112 int max_count;
1113 __Pyx_CodeObjectCacheEntry* entries;
1114 };
1115 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1116 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1117 static PyCodeObject *__pyx_find_code_object(int code_line);
1118 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1119
1120 /* AddTraceback.proto */
1121 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1122 int py_line, const char *filename);
1123
1124 /* CIntToPy.proto */
1125 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1126
1127 /* CIntFromPy.proto */
1128 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
1129
1130 /* CIntFromPy.proto */
1131 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
1132
1133 /* FastTypeChecks.proto */
1134 #if CYTHON_COMPILING_IN_CPYTHON
1135 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1136 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1137 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1138 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1139 #else
1140 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1141 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1142 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1143 #endif
1144 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1145
1146 /* CheckBinaryVersion.proto */
1147 static int __Pyx_check_binary_version(void);
1148
1149 /* InitStrings.proto */
1150 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1151
1152
1153 /* Module declarations from 'libc.stdint' */
1154
1155 /* Module declarations from 'libc.string' */
1156
1157 /* Module declarations from 'libc.stdio' */
1158
1159 /* Module declarations from 'libc.stddef' */
1160
1161 /* Module declarations from 'sdl2' */
1162
1163 /* Module declarations from 'pygame_sdl2.error' */
1164 #define __Pyx_MODULE_NAME "pygame_sdl2.error"
1165 extern int __pyx_module_is_main_pygame_sdl2__error;
1166 int __pyx_module_is_main_pygame_sdl2__error = 0;
1167
1168 /* Implementation of 'pygame_sdl2.error' */
1169 static PyObject *__pyx_builtin_RuntimeError;
1170 static const char __pyx_k_[] = "";
1171 static const char __pyx_k_doc[] = "__doc__";
1172 static const char __pyx_k_init[] = "__init__";
1173 static const char __pyx_k_main[] = "__main__";
1174 static const char __pyx_k_name[] = "__name__";
1175 static const char __pyx_k_self[] = "self";
1176 static const char __pyx_k_test[] = "__test__";
1177 static const char __pyx_k_error[] = "error";
1178 static const char __pyx_k_module[] = "__module__";
1179 static const char __pyx_k_message[] = "message";
1180 static const char __pyx_k_prepare[] = "__prepare__";
1181 static const char __pyx_k_qualname[] = "__qualname__";
1182 static const char __pyx_k_get_error[] = "get_error";
1183 static const char __pyx_k_metaclass[] = "__metaclass__";
1184 static const char __pyx_k_set_error[] = "set_error";
1185 static const char __pyx_k_RuntimeError[] = "RuntimeError";
1186 static const char __pyx_k_error___init[] = "error.__init__";
1187 static const char __pyx_k_pygame_sdl2_error[] = "pygame_sdl2.error";
1188 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
1189 static const char __pyx_k_src_pygame_sdl2_error_pyx[] = "src/pygame_sdl2/error.pyx";
1190 static PyObject *__pyx_kp_s_;
1191 static PyObject *__pyx_n_s_RuntimeError;
1192 static PyObject *__pyx_n_s_cline_in_traceback;
1193 static PyObject *__pyx_n_s_doc;
1194 static PyObject *__pyx_n_s_error;
1195 static PyObject *__pyx_n_s_error___init;
1196 static PyObject *__pyx_n_s_get_error;
1197 static PyObject *__pyx_n_s_init;
1198 static PyObject *__pyx_n_s_main;
1199 static PyObject *__pyx_n_s_message;
1200 static PyObject *__pyx_n_s_metaclass;
1201 static PyObject *__pyx_n_s_module;
1202 static PyObject *__pyx_n_s_name;
1203 static PyObject *__pyx_n_s_prepare;
1204 static PyObject *__pyx_n_s_pygame_sdl2_error;
1205 static PyObject *__pyx_n_s_qualname;
1206 static PyObject *__pyx_n_s_self;
1207 static PyObject *__pyx_n_s_set_error;
1208 static PyObject *__pyx_kp_s_src_pygame_sdl2_error_pyx;
1209 static PyObject *__pyx_n_s_test;
1210 static PyObject *__pyx_pf_11pygame_sdl2_5error_5error___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_message); /* proto */
1211 static PyObject *__pyx_pf_11pygame_sdl2_5error_get_error(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
1212 static PyObject *__pyx_pf_11pygame_sdl2_5error_2set_error(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_message); /* proto */
1213 static PyObject *__pyx_tuple__2;
1214 static PyObject *__pyx_tuple__3;
1215 static PyObject *__pyx_tuple__5;
1216 static PyObject *__pyx_tuple__6;
1217 static PyObject *__pyx_tuple__8;
1218 static PyObject *__pyx_codeobj__4;
1219 static PyObject *__pyx_codeobj__7;
1220 static PyObject *__pyx_codeobj__9;
1221 /* Late includes */
1222
1223 /* "pygame_sdl2/error.pyx":23
1224 * class error(RuntimeError):
1225 *
1226 * def __init__(self, message=None): # <<<<<<<<<<<<<<
1227 * if message is None:
1228 * message = str(SDL_GetError())
1229 */
1230
1231 /* Python wrapper */
1232 static PyObject *__pyx_pw_11pygame_sdl2_5error_5error_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1233 static PyMethodDef __pyx_mdef_11pygame_sdl2_5error_5error_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11pygame_sdl2_5error_5error_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
__pyx_pw_11pygame_sdl2_5error_5error_1__init__(PyObject * __pyx_self,PyObject * __pyx_args,PyObject * __pyx_kwds)1234 static PyObject *__pyx_pw_11pygame_sdl2_5error_5error_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1235 PyObject *__pyx_v_self = 0;
1236 PyObject *__pyx_v_message = 0;
1237 int __pyx_lineno = 0;
1238 const char *__pyx_filename = NULL;
1239 int __pyx_clineno = 0;
1240 PyObject *__pyx_r = 0;
1241 __Pyx_RefNannyDeclarations
1242 __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
1243 {
1244 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_message,0};
1245 PyObject* values[2] = {0,0};
1246 values[1] = ((PyObject *)((PyObject *)Py_None));
1247 if (unlikely(__pyx_kwds)) {
1248 Py_ssize_t kw_args;
1249 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
1250 switch (pos_args) {
1251 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1252 CYTHON_FALLTHROUGH;
1253 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1254 CYTHON_FALLTHROUGH;
1255 case 0: break;
1256 default: goto __pyx_L5_argtuple_error;
1257 }
1258 kw_args = PyDict_Size(__pyx_kwds);
1259 switch (pos_args) {
1260 case 0:
1261 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
1262 else goto __pyx_L5_argtuple_error;
1263 CYTHON_FALLTHROUGH;
1264 case 1:
1265 if (kw_args > 0) {
1266 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_message);
1267 if (value) { values[1] = value; kw_args--; }
1268 }
1269 }
1270 if (unlikely(kw_args > 0)) {
1271 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 23, __pyx_L3_error)
1272 }
1273 } else {
1274 switch (PyTuple_GET_SIZE(__pyx_args)) {
1275 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1276 CYTHON_FALLTHROUGH;
1277 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1278 break;
1279 default: goto __pyx_L5_argtuple_error;
1280 }
1281 }
1282 __pyx_v_self = values[0];
1283 __pyx_v_message = values[1];
1284 }
1285 goto __pyx_L4_argument_unpacking_done;
1286 __pyx_L5_argtuple_error:;
1287 __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 23, __pyx_L3_error)
1288 __pyx_L3_error:;
1289 __Pyx_AddTraceback("pygame_sdl2.error.error.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
1290 __Pyx_RefNannyFinishContext();
1291 return NULL;
1292 __pyx_L4_argument_unpacking_done:;
1293 __pyx_r = __pyx_pf_11pygame_sdl2_5error_5error___init__(__pyx_self, __pyx_v_self, __pyx_v_message);
1294
1295 /* function exit code */
1296 __Pyx_RefNannyFinishContext();
1297 return __pyx_r;
1298 }
1299
__pyx_pf_11pygame_sdl2_5error_5error___init__(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_self,PyObject * __pyx_v_message)1300 static PyObject *__pyx_pf_11pygame_sdl2_5error_5error___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_message) {
1301 PyObject *__pyx_r = NULL;
1302 __Pyx_RefNannyDeclarations
1303 int __pyx_t_1;
1304 int __pyx_t_2;
1305 PyObject *__pyx_t_3 = NULL;
1306 PyObject *__pyx_t_4 = NULL;
1307 PyObject *__pyx_t_5 = NULL;
1308 int __pyx_t_6;
1309 PyObject *__pyx_t_7 = NULL;
1310 int __pyx_lineno = 0;
1311 const char *__pyx_filename = NULL;
1312 int __pyx_clineno = 0;
1313 __Pyx_RefNannySetupContext("__init__", 0);
1314 __Pyx_INCREF(__pyx_v_message);
1315
1316 /* "pygame_sdl2/error.pyx":24
1317 *
1318 * def __init__(self, message=None):
1319 * if message is None: # <<<<<<<<<<<<<<
1320 * message = str(SDL_GetError())
1321 *
1322 */
1323 __pyx_t_1 = (__pyx_v_message == Py_None);
1324 __pyx_t_2 = (__pyx_t_1 != 0);
1325 if (__pyx_t_2) {
1326
1327 /* "pygame_sdl2/error.pyx":25
1328 * def __init__(self, message=None):
1329 * if message is None:
1330 * message = str(SDL_GetError()) # <<<<<<<<<<<<<<
1331 *
1332 * RuntimeError.__init__(self, message)
1333 */
1334 __pyx_t_3 = __Pyx_PyBytes_FromString(SDL_GetError()); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 25, __pyx_L1_error)
1335 __Pyx_GOTREF(__pyx_t_3);
1336 __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 25, __pyx_L1_error)
1337 __Pyx_GOTREF(__pyx_t_4);
1338 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1339 __Pyx_DECREF_SET(__pyx_v_message, __pyx_t_4);
1340 __pyx_t_4 = 0;
1341
1342 /* "pygame_sdl2/error.pyx":24
1343 *
1344 * def __init__(self, message=None):
1345 * if message is None: # <<<<<<<<<<<<<<
1346 * message = str(SDL_GetError())
1347 *
1348 */
1349 }
1350
1351 /* "pygame_sdl2/error.pyx":27
1352 * message = str(SDL_GetError())
1353 *
1354 * RuntimeError.__init__(self, message) # <<<<<<<<<<<<<<
1355 *
1356 * def get_error():
1357 */
1358 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_builtin_RuntimeError, __pyx_n_s_init); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 27, __pyx_L1_error)
1359 __Pyx_GOTREF(__pyx_t_3);
1360 __pyx_t_5 = NULL;
1361 __pyx_t_6 = 0;
1362 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
1363 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
1364 if (likely(__pyx_t_5)) {
1365 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
1366 __Pyx_INCREF(__pyx_t_5);
1367 __Pyx_INCREF(function);
1368 __Pyx_DECREF_SET(__pyx_t_3, function);
1369 __pyx_t_6 = 1;
1370 }
1371 }
1372 #if CYTHON_FAST_PYCALL
1373 if (PyFunction_Check(__pyx_t_3)) {
1374 PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_self, __pyx_v_message};
1375 __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 27, __pyx_L1_error)
1376 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
1377 __Pyx_GOTREF(__pyx_t_4);
1378 } else
1379 #endif
1380 #if CYTHON_FAST_PYCCALL
1381 if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
1382 PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_self, __pyx_v_message};
1383 __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 27, __pyx_L1_error)
1384 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
1385 __Pyx_GOTREF(__pyx_t_4);
1386 } else
1387 #endif
1388 {
1389 __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 27, __pyx_L1_error)
1390 __Pyx_GOTREF(__pyx_t_7);
1391 if (__pyx_t_5) {
1392 __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
1393 }
1394 __Pyx_INCREF(__pyx_v_self);
1395 __Pyx_GIVEREF(__pyx_v_self);
1396 PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_self);
1397 __Pyx_INCREF(__pyx_v_message);
1398 __Pyx_GIVEREF(__pyx_v_message);
1399 PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_message);
1400 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 27, __pyx_L1_error)
1401 __Pyx_GOTREF(__pyx_t_4);
1402 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
1403 }
1404 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1405 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
1406
1407 /* "pygame_sdl2/error.pyx":23
1408 * class error(RuntimeError):
1409 *
1410 * def __init__(self, message=None): # <<<<<<<<<<<<<<
1411 * if message is None:
1412 * message = str(SDL_GetError())
1413 */
1414
1415 /* function exit code */
1416 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
1417 goto __pyx_L0;
1418 __pyx_L1_error:;
1419 __Pyx_XDECREF(__pyx_t_3);
1420 __Pyx_XDECREF(__pyx_t_4);
1421 __Pyx_XDECREF(__pyx_t_5);
1422 __Pyx_XDECREF(__pyx_t_7);
1423 __Pyx_AddTraceback("pygame_sdl2.error.error.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
1424 __pyx_r = NULL;
1425 __pyx_L0:;
1426 __Pyx_XDECREF(__pyx_v_message);
1427 __Pyx_XGIVEREF(__pyx_r);
1428 __Pyx_RefNannyFinishContext();
1429 return __pyx_r;
1430 }
1431
1432 /* "pygame_sdl2/error.pyx":29
1433 * RuntimeError.__init__(self, message)
1434 *
1435 * def get_error(): # <<<<<<<<<<<<<<
1436 * cdef const char *message = SDL_GetError()
1437 *
1438 */
1439
1440 /* Python wrapper */
1441 static PyObject *__pyx_pw_11pygame_sdl2_5error_1get_error(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
1442 static PyMethodDef __pyx_mdef_11pygame_sdl2_5error_1get_error = {"get_error", (PyCFunction)__pyx_pw_11pygame_sdl2_5error_1get_error, METH_NOARGS, 0};
__pyx_pw_11pygame_sdl2_5error_1get_error(PyObject * __pyx_self,CYTHON_UNUSED PyObject * unused)1443 static PyObject *__pyx_pw_11pygame_sdl2_5error_1get_error(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
1444 PyObject *__pyx_r = 0;
1445 __Pyx_RefNannyDeclarations
1446 __Pyx_RefNannySetupContext("get_error (wrapper)", 0);
1447 __pyx_r = __pyx_pf_11pygame_sdl2_5error_get_error(__pyx_self);
1448
1449 /* function exit code */
1450 __Pyx_RefNannyFinishContext();
1451 return __pyx_r;
1452 }
1453
__pyx_pf_11pygame_sdl2_5error_get_error(CYTHON_UNUSED PyObject * __pyx_self)1454 static PyObject *__pyx_pf_11pygame_sdl2_5error_get_error(CYTHON_UNUSED PyObject *__pyx_self) {
1455 char const *__pyx_v_message;
1456 PyObject *__pyx_r = NULL;
1457 __Pyx_RefNannyDeclarations
1458 int __pyx_t_1;
1459 PyObject *__pyx_t_2 = NULL;
1460 PyObject *__pyx_t_3 = NULL;
1461 int __pyx_lineno = 0;
1462 const char *__pyx_filename = NULL;
1463 int __pyx_clineno = 0;
1464 __Pyx_RefNannySetupContext("get_error", 0);
1465
1466 /* "pygame_sdl2/error.pyx":30
1467 *
1468 * def get_error():
1469 * cdef const char *message = SDL_GetError() # <<<<<<<<<<<<<<
1470 *
1471 * if message:
1472 */
1473 __pyx_v_message = SDL_GetError();
1474
1475 /* "pygame_sdl2/error.pyx":32
1476 * cdef const char *message = SDL_GetError()
1477 *
1478 * if message: # <<<<<<<<<<<<<<
1479 * return str(message)
1480 * else:
1481 */
1482 __pyx_t_1 = (__pyx_v_message != 0);
1483 if (__pyx_t_1) {
1484
1485 /* "pygame_sdl2/error.pyx":33
1486 *
1487 * if message:
1488 * return str(message) # <<<<<<<<<<<<<<
1489 * else:
1490 * return ''
1491 */
1492 __Pyx_XDECREF(__pyx_r);
1493 __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_message); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 33, __pyx_L1_error)
1494 __Pyx_GOTREF(__pyx_t_2);
1495 __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 33, __pyx_L1_error)
1496 __Pyx_GOTREF(__pyx_t_3);
1497 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1498 __pyx_r = __pyx_t_3;
1499 __pyx_t_3 = 0;
1500 goto __pyx_L0;
1501
1502 /* "pygame_sdl2/error.pyx":32
1503 * cdef const char *message = SDL_GetError()
1504 *
1505 * if message: # <<<<<<<<<<<<<<
1506 * return str(message)
1507 * else:
1508 */
1509 }
1510
1511 /* "pygame_sdl2/error.pyx":35
1512 * return str(message)
1513 * else:
1514 * return '' # <<<<<<<<<<<<<<
1515 *
1516 * def set_error(message):
1517 */
1518 /*else*/ {
1519 __Pyx_XDECREF(__pyx_r);
1520 __Pyx_INCREF(__pyx_kp_s_);
1521 __pyx_r = __pyx_kp_s_;
1522 goto __pyx_L0;
1523 }
1524
1525 /* "pygame_sdl2/error.pyx":29
1526 * RuntimeError.__init__(self, message)
1527 *
1528 * def get_error(): # <<<<<<<<<<<<<<
1529 * cdef const char *message = SDL_GetError()
1530 *
1531 */
1532
1533 /* function exit code */
1534 __pyx_L1_error:;
1535 __Pyx_XDECREF(__pyx_t_2);
1536 __Pyx_XDECREF(__pyx_t_3);
1537 __Pyx_AddTraceback("pygame_sdl2.error.get_error", __pyx_clineno, __pyx_lineno, __pyx_filename);
1538 __pyx_r = NULL;
1539 __pyx_L0:;
1540 __Pyx_XGIVEREF(__pyx_r);
1541 __Pyx_RefNannyFinishContext();
1542 return __pyx_r;
1543 }
1544
1545 /* "pygame_sdl2/error.pyx":37
1546 * return ''
1547 *
1548 * def set_error(message): # <<<<<<<<<<<<<<
1549 * message = bytes(message)
1550 * SDL_SetError("%s", <char *> message)
1551 */
1552
1553 /* Python wrapper */
1554 static PyObject *__pyx_pw_11pygame_sdl2_5error_3set_error(PyObject *__pyx_self, PyObject *__pyx_v_message); /*proto*/
1555 static PyMethodDef __pyx_mdef_11pygame_sdl2_5error_3set_error = {"set_error", (PyCFunction)__pyx_pw_11pygame_sdl2_5error_3set_error, METH_O, 0};
__pyx_pw_11pygame_sdl2_5error_3set_error(PyObject * __pyx_self,PyObject * __pyx_v_message)1556 static PyObject *__pyx_pw_11pygame_sdl2_5error_3set_error(PyObject *__pyx_self, PyObject *__pyx_v_message) {
1557 PyObject *__pyx_r = 0;
1558 __Pyx_RefNannyDeclarations
1559 __Pyx_RefNannySetupContext("set_error (wrapper)", 0);
1560 __pyx_r = __pyx_pf_11pygame_sdl2_5error_2set_error(__pyx_self, ((PyObject *)__pyx_v_message));
1561
1562 /* function exit code */
1563 __Pyx_RefNannyFinishContext();
1564 return __pyx_r;
1565 }
1566
__pyx_pf_11pygame_sdl2_5error_2set_error(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_message)1567 static PyObject *__pyx_pf_11pygame_sdl2_5error_2set_error(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_message) {
1568 PyObject *__pyx_r = NULL;
1569 __Pyx_RefNannyDeclarations
1570 PyObject *__pyx_t_1 = NULL;
1571 char *__pyx_t_2;
1572 int __pyx_lineno = 0;
1573 const char *__pyx_filename = NULL;
1574 int __pyx_clineno = 0;
1575 __Pyx_RefNannySetupContext("set_error", 0);
1576 __Pyx_INCREF(__pyx_v_message);
1577
1578 /* "pygame_sdl2/error.pyx":38
1579 *
1580 * def set_error(message):
1581 * message = bytes(message) # <<<<<<<<<<<<<<
1582 * SDL_SetError("%s", <char *> message)
1583 */
1584 __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_v_message); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error)
1585 __Pyx_GOTREF(__pyx_t_1);
1586 __Pyx_DECREF_SET(__pyx_v_message, __pyx_t_1);
1587 __pyx_t_1 = 0;
1588
1589 /* "pygame_sdl2/error.pyx":39
1590 * def set_error(message):
1591 * message = bytes(message)
1592 * SDL_SetError("%s", <char *> message) # <<<<<<<<<<<<<<
1593 */
1594 __pyx_t_2 = __Pyx_PyObject_AsWritableString(__pyx_v_message); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 39, __pyx_L1_error)
1595 (void)(SDL_SetError(((char const *)"%s"), ((char *)__pyx_t_2)));
1596
1597 /* "pygame_sdl2/error.pyx":37
1598 * return ''
1599 *
1600 * def set_error(message): # <<<<<<<<<<<<<<
1601 * message = bytes(message)
1602 * SDL_SetError("%s", <char *> message)
1603 */
1604
1605 /* function exit code */
1606 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
1607 goto __pyx_L0;
1608 __pyx_L1_error:;
1609 __Pyx_XDECREF(__pyx_t_1);
1610 __Pyx_AddTraceback("pygame_sdl2.error.set_error", __pyx_clineno, __pyx_lineno, __pyx_filename);
1611 __pyx_r = NULL;
1612 __pyx_L0:;
1613 __Pyx_XDECREF(__pyx_v_message);
1614 __Pyx_XGIVEREF(__pyx_r);
1615 __Pyx_RefNannyFinishContext();
1616 return __pyx_r;
1617 }
1618
1619 static PyMethodDef __pyx_methods[] = {
1620 {0, 0, 0, 0}
1621 };
1622
1623 #if PY_MAJOR_VERSION >= 3
1624 #if CYTHON_PEP489_MULTI_PHASE_INIT
1625 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
1626 static int __pyx_pymod_exec_error(PyObject* module); /*proto*/
1627 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
1628 {Py_mod_create, (void*)__pyx_pymod_create},
1629 {Py_mod_exec, (void*)__pyx_pymod_exec_error},
1630 {0, NULL}
1631 };
1632 #endif
1633
1634 static struct PyModuleDef __pyx_moduledef = {
1635 PyModuleDef_HEAD_INIT,
1636 "pygame_sdl2.error",
1637 0, /* m_doc */
1638 #if CYTHON_PEP489_MULTI_PHASE_INIT
1639 0, /* m_size */
1640 #else
1641 -1, /* m_size */
1642 #endif
1643 __pyx_methods /* m_methods */,
1644 #if CYTHON_PEP489_MULTI_PHASE_INIT
1645 __pyx_moduledef_slots, /* m_slots */
1646 #else
1647 NULL, /* m_reload */
1648 #endif
1649 NULL, /* m_traverse */
1650 NULL, /* m_clear */
1651 NULL /* m_free */
1652 };
1653 #endif
1654 #ifndef CYTHON_SMALL_CODE
1655 #if defined(__clang__)
1656 #define CYTHON_SMALL_CODE
1657 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
1658 #define CYTHON_SMALL_CODE __attribute__((cold))
1659 #else
1660 #define CYTHON_SMALL_CODE
1661 #endif
1662 #endif
1663
1664 static __Pyx_StringTabEntry __pyx_string_tab[] = {
1665 {&__pyx_kp_s_, __pyx_k_, sizeof(__pyx_k_), 0, 0, 1, 0},
1666 {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
1667 {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
1668 {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1},
1669 {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1},
1670 {&__pyx_n_s_error___init, __pyx_k_error___init, sizeof(__pyx_k_error___init), 0, 0, 1, 1},
1671 {&__pyx_n_s_get_error, __pyx_k_get_error, sizeof(__pyx_k_get_error), 0, 0, 1, 1},
1672 {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1},
1673 {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
1674 {&__pyx_n_s_message, __pyx_k_message, sizeof(__pyx_k_message), 0, 0, 1, 1},
1675 {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
1676 {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1},
1677 {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
1678 {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1},
1679 {&__pyx_n_s_pygame_sdl2_error, __pyx_k_pygame_sdl2_error, sizeof(__pyx_k_pygame_sdl2_error), 0, 0, 1, 1},
1680 {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1},
1681 {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1},
1682 {&__pyx_n_s_set_error, __pyx_k_set_error, sizeof(__pyx_k_set_error), 0, 0, 1, 1},
1683 {&__pyx_kp_s_src_pygame_sdl2_error_pyx, __pyx_k_src_pygame_sdl2_error_pyx, sizeof(__pyx_k_src_pygame_sdl2_error_pyx), 0, 0, 1, 0},
1684 {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
1685 {0, 0, 0, 0, 0, 0, 0}
1686 };
__Pyx_InitCachedBuiltins(void)1687 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
1688 __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 21, __pyx_L1_error)
1689 return 0;
1690 __pyx_L1_error:;
1691 return -1;
1692 }
1693
__Pyx_InitCachedConstants(void)1694 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
1695 __Pyx_RefNannyDeclarations
1696 __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
1697
1698 /* "pygame_sdl2/error.pyx":21
1699 * from sdl2 cimport *
1700 *
1701 * class error(RuntimeError): # <<<<<<<<<<<<<<
1702 *
1703 * def __init__(self, message=None):
1704 */
1705 __pyx_tuple__2 = PyTuple_Pack(1, __pyx_builtin_RuntimeError); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 21, __pyx_L1_error)
1706 __Pyx_GOTREF(__pyx_tuple__2);
1707 __Pyx_GIVEREF(__pyx_tuple__2);
1708
1709 /* "pygame_sdl2/error.pyx":23
1710 * class error(RuntimeError):
1711 *
1712 * def __init__(self, message=None): # <<<<<<<<<<<<<<
1713 * if message is None:
1714 * message = str(SDL_GetError())
1715 */
1716 __pyx_tuple__3 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_message); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 23, __pyx_L1_error)
1717 __Pyx_GOTREF(__pyx_tuple__3);
1718 __Pyx_GIVEREF(__pyx_tuple__3);
1719 __pyx_codeobj__4 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__3, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pygame_sdl2_error_pyx, __pyx_n_s_init, 23, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__4)) __PYX_ERR(0, 23, __pyx_L1_error)
1720 __pyx_tuple__5 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 23, __pyx_L1_error)
1721 __Pyx_GOTREF(__pyx_tuple__5);
1722 __Pyx_GIVEREF(__pyx_tuple__5);
1723
1724 /* "pygame_sdl2/error.pyx":29
1725 * RuntimeError.__init__(self, message)
1726 *
1727 * def get_error(): # <<<<<<<<<<<<<<
1728 * cdef const char *message = SDL_GetError()
1729 *
1730 */
1731 __pyx_tuple__6 = PyTuple_Pack(1, __pyx_n_s_message); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 29, __pyx_L1_error)
1732 __Pyx_GOTREF(__pyx_tuple__6);
1733 __Pyx_GIVEREF(__pyx_tuple__6);
1734 __pyx_codeobj__7 = (PyObject*)__Pyx_PyCode_New(0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__6, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pygame_sdl2_error_pyx, __pyx_n_s_get_error, 29, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__7)) __PYX_ERR(0, 29, __pyx_L1_error)
1735
1736 /* "pygame_sdl2/error.pyx":37
1737 * return ''
1738 *
1739 * def set_error(message): # <<<<<<<<<<<<<<
1740 * message = bytes(message)
1741 * SDL_SetError("%s", <char *> message)
1742 */
1743 __pyx_tuple__8 = PyTuple_Pack(1, __pyx_n_s_message); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 37, __pyx_L1_error)
1744 __Pyx_GOTREF(__pyx_tuple__8);
1745 __Pyx_GIVEREF(__pyx_tuple__8);
1746 __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_pygame_sdl2_error_pyx, __pyx_n_s_set_error, 37, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 37, __pyx_L1_error)
1747 __Pyx_RefNannyFinishContext();
1748 return 0;
1749 __pyx_L1_error:;
1750 __Pyx_RefNannyFinishContext();
1751 return -1;
1752 }
1753
__Pyx_InitGlobals(void)1754 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
1755 if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
1756 return 0;
1757 __pyx_L1_error:;
1758 return -1;
1759 }
1760
1761 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
1762 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
1763 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
1764 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
1765 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
1766 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
1767 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
1768
__Pyx_modinit_global_init_code(void)1769 static int __Pyx_modinit_global_init_code(void) {
1770 __Pyx_RefNannyDeclarations
1771 __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
1772 /*--- Global init code ---*/
1773 __Pyx_RefNannyFinishContext();
1774 return 0;
1775 }
1776
__Pyx_modinit_variable_export_code(void)1777 static int __Pyx_modinit_variable_export_code(void) {
1778 __Pyx_RefNannyDeclarations
1779 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
1780 /*--- Variable export code ---*/
1781 __Pyx_RefNannyFinishContext();
1782 return 0;
1783 }
1784
__Pyx_modinit_function_export_code(void)1785 static int __Pyx_modinit_function_export_code(void) {
1786 __Pyx_RefNannyDeclarations
1787 __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
1788 /*--- Function export code ---*/
1789 __Pyx_RefNannyFinishContext();
1790 return 0;
1791 }
1792
__Pyx_modinit_type_init_code(void)1793 static int __Pyx_modinit_type_init_code(void) {
1794 __Pyx_RefNannyDeclarations
1795 __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
1796 /*--- Type init code ---*/
1797 __Pyx_RefNannyFinishContext();
1798 return 0;
1799 }
1800
__Pyx_modinit_type_import_code(void)1801 static int __Pyx_modinit_type_import_code(void) {
1802 __Pyx_RefNannyDeclarations
1803 __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
1804 /*--- Type import code ---*/
1805 __Pyx_RefNannyFinishContext();
1806 return 0;
1807 }
1808
__Pyx_modinit_variable_import_code(void)1809 static int __Pyx_modinit_variable_import_code(void) {
1810 __Pyx_RefNannyDeclarations
1811 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
1812 /*--- Variable import code ---*/
1813 __Pyx_RefNannyFinishContext();
1814 return 0;
1815 }
1816
__Pyx_modinit_function_import_code(void)1817 static int __Pyx_modinit_function_import_code(void) {
1818 __Pyx_RefNannyDeclarations
1819 __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
1820 /*--- Function import code ---*/
1821 __Pyx_RefNannyFinishContext();
1822 return 0;
1823 }
1824
1825
1826 #ifndef CYTHON_NO_PYINIT_EXPORT
1827 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
1828 #elif PY_MAJOR_VERSION < 3
1829 #ifdef __cplusplus
1830 #define __Pyx_PyMODINIT_FUNC extern "C" void
1831 #else
1832 #define __Pyx_PyMODINIT_FUNC void
1833 #endif
1834 #else
1835 #ifdef __cplusplus
1836 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
1837 #else
1838 #define __Pyx_PyMODINIT_FUNC PyObject *
1839 #endif
1840 #endif
1841
1842
1843 #if PY_MAJOR_VERSION < 3
1844 __Pyx_PyMODINIT_FUNC initpygame_sdl2_error(void) CYTHON_SMALL_CODE; /*proto*/
initpygame_sdl2_error(void)1845 __Pyx_PyMODINIT_FUNC initpygame_sdl2_error(void)
1846 #else
1847 __Pyx_PyMODINIT_FUNC PyInit_pygame_sdl2_error(void) CYTHON_SMALL_CODE; /*proto*/
1848 __Pyx_PyMODINIT_FUNC PyInit_pygame_sdl2_error(void)
1849 #if CYTHON_PEP489_MULTI_PHASE_INIT
1850 {
1851 return PyModuleDef_Init(&__pyx_moduledef);
1852 }
1853 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
1854 #if PY_VERSION_HEX >= 0x030700A1
1855 static PY_INT64_T main_interpreter_id = -1;
1856 PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
1857 if (main_interpreter_id == -1) {
1858 main_interpreter_id = current_id;
1859 return (unlikely(current_id == -1)) ? -1 : 0;
1860 } else if (unlikely(main_interpreter_id != current_id))
1861 #else
1862 static PyInterpreterState *main_interpreter = NULL;
1863 PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
1864 if (!main_interpreter) {
1865 main_interpreter = current_interpreter;
1866 } else if (unlikely(main_interpreter != current_interpreter))
1867 #endif
1868 {
1869 PyErr_SetString(
1870 PyExc_ImportError,
1871 "Interpreter change detected - this module can only be loaded into one interpreter per process.");
1872 return -1;
1873 }
1874 return 0;
1875 }
1876 static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) {
1877 PyObject *value = PyObject_GetAttrString(spec, from_name);
1878 int result = 0;
1879 if (likely(value)) {
1880 if (allow_none || value != Py_None) {
1881 result = PyDict_SetItemString(moddict, to_name, value);
1882 }
1883 Py_DECREF(value);
1884 } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
1885 PyErr_Clear();
1886 } else {
1887 result = -1;
1888 }
1889 return result;
1890 }
1891 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
1892 PyObject *module = NULL, *moddict, *modname;
1893 if (__Pyx_check_single_interpreter())
1894 return NULL;
1895 if (__pyx_m)
1896 return __Pyx_NewRef(__pyx_m);
1897 modname = PyObject_GetAttrString(spec, "name");
1898 if (unlikely(!modname)) goto bad;
1899 module = PyModule_NewObject(modname);
1900 Py_DECREF(modname);
1901 if (unlikely(!module)) goto bad;
1902 moddict = PyModule_GetDict(module);
1903 if (unlikely(!moddict)) goto bad;
1904 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
1905 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
1906 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
1907 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
1908 return module;
1909 bad:
1910 Py_XDECREF(module);
1911 return NULL;
1912 }
1913
1914
1915 static CYTHON_SMALL_CODE int __pyx_pymod_exec_error(PyObject *__pyx_pyinit_module)
1916 #endif
1917 #endif
1918 {
1919 PyObject *__pyx_t_1 = NULL;
1920 PyObject *__pyx_t_2 = NULL;
1921 PyObject *__pyx_t_3 = NULL;
1922 int __pyx_lineno = 0;
1923 const char *__pyx_filename = NULL;
1924 int __pyx_clineno = 0;
1925 __Pyx_RefNannyDeclarations
1926 #if CYTHON_PEP489_MULTI_PHASE_INIT
1927 if (__pyx_m) {
1928 if (__pyx_m == __pyx_pyinit_module) return 0;
1929 PyErr_SetString(PyExc_RuntimeError, "Module 'error' has already been imported. Re-initialisation is not supported.");
1930 return -1;
1931 }
1932 #elif PY_MAJOR_VERSION >= 3
1933 if (__pyx_m) return __Pyx_NewRef(__pyx_m);
1934 #endif
1935 #if CYTHON_REFNANNY
1936 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
1937 if (!__Pyx_RefNanny) {
1938 PyErr_Clear();
1939 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
1940 if (!__Pyx_RefNanny)
1941 Py_FatalError("failed to import 'refnanny' module");
1942 }
1943 #endif
1944 __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_error(void)", 0);
1945 if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
1946 #ifdef __Pxy_PyFrame_Initialize_Offsets
1947 __Pxy_PyFrame_Initialize_Offsets();
1948 #endif
1949 __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
1950 __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
1951 __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
1952 #ifdef __Pyx_CyFunction_USED
1953 if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
1954 #endif
1955 #ifdef __Pyx_FusedFunction_USED
1956 if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
1957 #endif
1958 #ifdef __Pyx_Coroutine_USED
1959 if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
1960 #endif
1961 #ifdef __Pyx_Generator_USED
1962 if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
1963 #endif
1964 #ifdef __Pyx_AsyncGen_USED
1965 if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
1966 #endif
1967 #ifdef __Pyx_StopAsyncIteration_USED
1968 if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
1969 #endif
1970 /*--- Library function declarations ---*/
1971 /*--- Threads initialization code ---*/
1972 #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
1973 #ifdef WITH_THREAD /* Python build with threading support? */
1974 PyEval_InitThreads();
1975 #endif
1976 #endif
1977 /*--- Module creation code ---*/
1978 #if CYTHON_PEP489_MULTI_PHASE_INIT
1979 __pyx_m = __pyx_pyinit_module;
1980 Py_INCREF(__pyx_m);
1981 #else
1982 #if PY_MAJOR_VERSION < 3
1983 __pyx_m = Py_InitModule4("pygame_sdl2.error", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
1984 #else
1985 __pyx_m = PyModule_Create(&__pyx_moduledef);
1986 #endif
1987 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
1988 #endif
1989 __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
1990 Py_INCREF(__pyx_d);
1991 __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
1992 Py_INCREF(__pyx_b);
1993 __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
1994 Py_INCREF(__pyx_cython_runtime);
1995 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
1996 /*--- Initialize various global constants etc. ---*/
1997 if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
1998 #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
1999 if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2000 #endif
2001 if (__pyx_module_is_main_pygame_sdl2__error) {
2002 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2003 }
2004 #if PY_MAJOR_VERSION >= 3
2005 {
2006 PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
2007 if (!PyDict_GetItemString(modules, "pygame_sdl2.error")) {
2008 if (unlikely(PyDict_SetItemString(modules, "pygame_sdl2.error", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
2009 }
2010 }
2011 #endif
2012 /*--- Builtin init code ---*/
2013 if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2014 /*--- Constants init code ---*/
2015 if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2016 /*--- Global type/function init code ---*/
2017 (void)__Pyx_modinit_global_init_code();
2018 (void)__Pyx_modinit_variable_export_code();
2019 (void)__Pyx_modinit_function_export_code();
2020 (void)__Pyx_modinit_type_init_code();
2021 (void)__Pyx_modinit_type_import_code();
2022 (void)__Pyx_modinit_variable_import_code();
2023 (void)__Pyx_modinit_function_import_code();
2024 /*--- Execution code ---*/
2025 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
2026 if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2027 #endif
2028
2029 /* "pygame_sdl2/error.pyx":21
2030 * from sdl2 cimport *
2031 *
2032 * class error(RuntimeError): # <<<<<<<<<<<<<<
2033 *
2034 * def __init__(self, message=None):
2035 */
2036 __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 21, __pyx_L1_error)
2037 __Pyx_GOTREF(__pyx_t_1);
2038 __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_tuple__2, __pyx_n_s_error, __pyx_n_s_error, (PyObject *) NULL, __pyx_n_s_pygame_sdl2_error, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 21, __pyx_L1_error)
2039 __Pyx_GOTREF(__pyx_t_2);
2040
2041 /* "pygame_sdl2/error.pyx":23
2042 * class error(RuntimeError):
2043 *
2044 * def __init__(self, message=None): # <<<<<<<<<<<<<<
2045 * if message is None:
2046 * message = str(SDL_GetError())
2047 */
2048 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_11pygame_sdl2_5error_5error_1__init__, 0, __pyx_n_s_error___init, NULL, __pyx_n_s_pygame_sdl2_error, __pyx_d, ((PyObject *)__pyx_codeobj__4)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 23, __pyx_L1_error)
2049 __Pyx_GOTREF(__pyx_t_3);
2050 __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__5);
2051 if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_init, __pyx_t_3) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
2052 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2053
2054 /* "pygame_sdl2/error.pyx":21
2055 * from sdl2 cimport *
2056 *
2057 * class error(RuntimeError): # <<<<<<<<<<<<<<
2058 *
2059 * def __init__(self, message=None):
2060 */
2061 __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_error, __pyx_tuple__2, __pyx_t_2, NULL, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 21, __pyx_L1_error)
2062 __Pyx_GOTREF(__pyx_t_3);
2063 if (PyDict_SetItem(__pyx_d, __pyx_n_s_error, __pyx_t_3) < 0) __PYX_ERR(0, 21, __pyx_L1_error)
2064 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2065 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2066 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2067
2068 /* "pygame_sdl2/error.pyx":29
2069 * RuntimeError.__init__(self, message)
2070 *
2071 * def get_error(): # <<<<<<<<<<<<<<
2072 * cdef const char *message = SDL_GetError()
2073 *
2074 */
2075 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11pygame_sdl2_5error_1get_error, NULL, __pyx_n_s_pygame_sdl2_error); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error)
2076 __Pyx_GOTREF(__pyx_t_1);
2077 if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_error, __pyx_t_1) < 0) __PYX_ERR(0, 29, __pyx_L1_error)
2078 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2079
2080 /* "pygame_sdl2/error.pyx":37
2081 * return ''
2082 *
2083 * def set_error(message): # <<<<<<<<<<<<<<
2084 * message = bytes(message)
2085 * SDL_SetError("%s", <char *> message)
2086 */
2087 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11pygame_sdl2_5error_3set_error, NULL, __pyx_n_s_pygame_sdl2_error); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 37, __pyx_L1_error)
2088 __Pyx_GOTREF(__pyx_t_1);
2089 if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_error, __pyx_t_1) < 0) __PYX_ERR(0, 37, __pyx_L1_error)
2090 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2091
2092 /* "pygame_sdl2/error.pyx":1
2093 * # Copyright 2014 Tom Rothamel <tom@rothamel.us> # <<<<<<<<<<<<<<
2094 * #
2095 * # This software is provided 'as-is', without any express or implied
2096 */
2097 __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
2098 __Pyx_GOTREF(__pyx_t_1);
2099 if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2100 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2101
2102 /*--- Wrapped vars code ---*/
2103
2104 goto __pyx_L0;
2105 __pyx_L1_error:;
2106 __Pyx_XDECREF(__pyx_t_1);
2107 __Pyx_XDECREF(__pyx_t_2);
2108 __Pyx_XDECREF(__pyx_t_3);
2109 if (__pyx_m) {
2110 if (__pyx_d) {
2111 __Pyx_AddTraceback("init pygame_sdl2.error", __pyx_clineno, __pyx_lineno, __pyx_filename);
2112 }
2113 Py_CLEAR(__pyx_m);
2114 } else if (!PyErr_Occurred()) {
2115 PyErr_SetString(PyExc_ImportError, "init pygame_sdl2.error");
2116 }
2117 __pyx_L0:;
2118 __Pyx_RefNannyFinishContext();
2119 #if CYTHON_PEP489_MULTI_PHASE_INIT
2120 return (__pyx_m != NULL) ? 0 : -1;
2121 #elif PY_MAJOR_VERSION >= 3
2122 return __pyx_m;
2123 #else
2124 return;
2125 #endif
2126 }
2127
2128 /* --- Runtime support code --- */
2129 /* Refnanny */
2130 #if CYTHON_REFNANNY
__Pyx_RefNannyImportAPI(const char * modname)2131 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
2132 PyObject *m = NULL, *p = NULL;
2133 void *r = NULL;
2134 m = PyImport_ImportModule(modname);
2135 if (!m) goto end;
2136 p = PyObject_GetAttrString(m, "RefNannyAPI");
2137 if (!p) goto end;
2138 r = PyLong_AsVoidPtr(p);
2139 end:
2140 Py_XDECREF(p);
2141 Py_XDECREF(m);
2142 return (__Pyx_RefNannyAPIStruct *)r;
2143 }
2144 #endif
2145
2146 /* PyObjectGetAttrStr */
2147 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetAttrStr(PyObject * obj,PyObject * attr_name)2148 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
2149 PyTypeObject* tp = Py_TYPE(obj);
2150 if (likely(tp->tp_getattro))
2151 return tp->tp_getattro(obj, attr_name);
2152 #if PY_MAJOR_VERSION < 3
2153 if (likely(tp->tp_getattr))
2154 return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
2155 #endif
2156 return PyObject_GetAttr(obj, attr_name);
2157 }
2158 #endif
2159
2160 /* GetBuiltinName */
__Pyx_GetBuiltinName(PyObject * name)2161 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
2162 PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
2163 if (unlikely(!result)) {
2164 PyErr_Format(PyExc_NameError,
2165 #if PY_MAJOR_VERSION >= 3
2166 "name '%U' is not defined", name);
2167 #else
2168 "name '%.200s' is not defined", PyString_AS_STRING(name));
2169 #endif
2170 }
2171 return result;
2172 }
2173
2174 /* RaiseDoubleKeywords */
__Pyx_RaiseDoubleKeywordsError(const char * func_name,PyObject * kw_name)2175 static void __Pyx_RaiseDoubleKeywordsError(
2176 const char* func_name,
2177 PyObject* kw_name)
2178 {
2179 PyErr_Format(PyExc_TypeError,
2180 #if PY_MAJOR_VERSION >= 3
2181 "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
2182 #else
2183 "%s() got multiple values for keyword argument '%s'", func_name,
2184 PyString_AsString(kw_name));
2185 #endif
2186 }
2187
2188 /* ParseKeywords */
__Pyx_ParseOptionalKeywords(PyObject * kwds,PyObject ** argnames[],PyObject * kwds2,PyObject * values[],Py_ssize_t num_pos_args,const char * function_name)2189 static int __Pyx_ParseOptionalKeywords(
2190 PyObject *kwds,
2191 PyObject **argnames[],
2192 PyObject *kwds2,
2193 PyObject *values[],
2194 Py_ssize_t num_pos_args,
2195 const char* function_name)
2196 {
2197 PyObject *key = 0, *value = 0;
2198 Py_ssize_t pos = 0;
2199 PyObject*** name;
2200 PyObject*** first_kw_arg = argnames + num_pos_args;
2201 while (PyDict_Next(kwds, &pos, &key, &value)) {
2202 name = first_kw_arg;
2203 while (*name && (**name != key)) name++;
2204 if (*name) {
2205 values[name-argnames] = value;
2206 continue;
2207 }
2208 name = first_kw_arg;
2209 #if PY_MAJOR_VERSION < 3
2210 if (likely(PyString_Check(key))) {
2211 while (*name) {
2212 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
2213 && _PyString_Eq(**name, key)) {
2214 values[name-argnames] = value;
2215 break;
2216 }
2217 name++;
2218 }
2219 if (*name) continue;
2220 else {
2221 PyObject*** argname = argnames;
2222 while (argname != first_kw_arg) {
2223 if ((**argname == key) || (
2224 (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
2225 && _PyString_Eq(**argname, key))) {
2226 goto arg_passed_twice;
2227 }
2228 argname++;
2229 }
2230 }
2231 } else
2232 #endif
2233 if (likely(PyUnicode_Check(key))) {
2234 while (*name) {
2235 int cmp = (**name == key) ? 0 :
2236 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
2237 (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
2238 #endif
2239 PyUnicode_Compare(**name, key);
2240 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
2241 if (cmp == 0) {
2242 values[name-argnames] = value;
2243 break;
2244 }
2245 name++;
2246 }
2247 if (*name) continue;
2248 else {
2249 PyObject*** argname = argnames;
2250 while (argname != first_kw_arg) {
2251 int cmp = (**argname == key) ? 0 :
2252 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
2253 (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
2254 #endif
2255 PyUnicode_Compare(**argname, key);
2256 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
2257 if (cmp == 0) goto arg_passed_twice;
2258 argname++;
2259 }
2260 }
2261 } else
2262 goto invalid_keyword_type;
2263 if (kwds2) {
2264 if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
2265 } else {
2266 goto invalid_keyword;
2267 }
2268 }
2269 return 0;
2270 arg_passed_twice:
2271 __Pyx_RaiseDoubleKeywordsError(function_name, key);
2272 goto bad;
2273 invalid_keyword_type:
2274 PyErr_Format(PyExc_TypeError,
2275 "%.200s() keywords must be strings", function_name);
2276 goto bad;
2277 invalid_keyword:
2278 PyErr_Format(PyExc_TypeError,
2279 #if PY_MAJOR_VERSION < 3
2280 "%.200s() got an unexpected keyword argument '%.200s'",
2281 function_name, PyString_AsString(key));
2282 #else
2283 "%s() got an unexpected keyword argument '%U'",
2284 function_name, key);
2285 #endif
2286 bad:
2287 return -1;
2288 }
2289
2290 /* RaiseArgTupleInvalid */
__Pyx_RaiseArgtupleInvalid(const char * func_name,int exact,Py_ssize_t num_min,Py_ssize_t num_max,Py_ssize_t num_found)2291 static void __Pyx_RaiseArgtupleInvalid(
2292 const char* func_name,
2293 int exact,
2294 Py_ssize_t num_min,
2295 Py_ssize_t num_max,
2296 Py_ssize_t num_found)
2297 {
2298 Py_ssize_t num_expected;
2299 const char *more_or_less;
2300 if (num_found < num_min) {
2301 num_expected = num_min;
2302 more_or_less = "at least";
2303 } else {
2304 num_expected = num_max;
2305 more_or_less = "at most";
2306 }
2307 if (exact) {
2308 more_or_less = "exactly";
2309 }
2310 PyErr_Format(PyExc_TypeError,
2311 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
2312 func_name, more_or_less, num_expected,
2313 (num_expected == 1) ? "" : "s", num_found);
2314 }
2315
2316 /* PyCFunctionFastCall */
2317 #if CYTHON_FAST_PYCCALL
__Pyx_PyCFunction_FastCall(PyObject * func_obj,PyObject ** args,Py_ssize_t nargs)2318 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
2319 PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
2320 PyCFunction meth = PyCFunction_GET_FUNCTION(func);
2321 PyObject *self = PyCFunction_GET_SELF(func);
2322 int flags = PyCFunction_GET_FLAGS(func);
2323 assert(PyCFunction_Check(func));
2324 assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
2325 assert(nargs >= 0);
2326 assert(nargs == 0 || args != NULL);
2327 /* _PyCFunction_FastCallDict() must not be called with an exception set,
2328 because it may clear it (directly or indirectly) and so the
2329 caller loses its exception */
2330 assert(!PyErr_Occurred());
2331 if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
2332 return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
2333 } else {
2334 return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
2335 }
2336 }
2337 #endif
2338
2339 /* PyFunctionFastCall */
2340 #if CYTHON_FAST_PYCALL
__Pyx_PyFunction_FastCallNoKw(PyCodeObject * co,PyObject ** args,Py_ssize_t na,PyObject * globals)2341 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
2342 PyObject *globals) {
2343 PyFrameObject *f;
2344 PyThreadState *tstate = __Pyx_PyThreadState_Current;
2345 PyObject **fastlocals;
2346 Py_ssize_t i;
2347 PyObject *result;
2348 assert(globals != NULL);
2349 /* XXX Perhaps we should create a specialized
2350 PyFrame_New() that doesn't take locals, but does
2351 take builtins without sanity checking them.
2352 */
2353 assert(tstate != NULL);
2354 f = PyFrame_New(tstate, co, globals, NULL);
2355 if (f == NULL) {
2356 return NULL;
2357 }
2358 fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
2359 for (i = 0; i < na; i++) {
2360 Py_INCREF(*args);
2361 fastlocals[i] = *args++;
2362 }
2363 result = PyEval_EvalFrameEx(f,0);
2364 ++tstate->recursion_depth;
2365 Py_DECREF(f);
2366 --tstate->recursion_depth;
2367 return result;
2368 }
2369 #if 1 || PY_VERSION_HEX < 0x030600B1
__Pyx_PyFunction_FastCallDict(PyObject * func,PyObject ** args,Py_ssize_t nargs,PyObject * kwargs)2370 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
2371 PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
2372 PyObject *globals = PyFunction_GET_GLOBALS(func);
2373 PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
2374 PyObject *closure;
2375 #if PY_MAJOR_VERSION >= 3
2376 PyObject *kwdefs;
2377 #endif
2378 PyObject *kwtuple, **k;
2379 PyObject **d;
2380 Py_ssize_t nd;
2381 Py_ssize_t nk;
2382 PyObject *result;
2383 assert(kwargs == NULL || PyDict_Check(kwargs));
2384 nk = kwargs ? PyDict_Size(kwargs) : 0;
2385 if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
2386 return NULL;
2387 }
2388 if (
2389 #if PY_MAJOR_VERSION >= 3
2390 co->co_kwonlyargcount == 0 &&
2391 #endif
2392 likely(kwargs == NULL || nk == 0) &&
2393 co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
2394 if (argdefs == NULL && co->co_argcount == nargs) {
2395 result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
2396 goto done;
2397 }
2398 else if (nargs == 0 && argdefs != NULL
2399 && co->co_argcount == Py_SIZE(argdefs)) {
2400 /* function called with no arguments, but all parameters have
2401 a default value: use default values as arguments .*/
2402 args = &PyTuple_GET_ITEM(argdefs, 0);
2403 result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
2404 goto done;
2405 }
2406 }
2407 if (kwargs != NULL) {
2408 Py_ssize_t pos, i;
2409 kwtuple = PyTuple_New(2 * nk);
2410 if (kwtuple == NULL) {
2411 result = NULL;
2412 goto done;
2413 }
2414 k = &PyTuple_GET_ITEM(kwtuple, 0);
2415 pos = i = 0;
2416 while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
2417 Py_INCREF(k[i]);
2418 Py_INCREF(k[i+1]);
2419 i += 2;
2420 }
2421 nk = i / 2;
2422 }
2423 else {
2424 kwtuple = NULL;
2425 k = NULL;
2426 }
2427 closure = PyFunction_GET_CLOSURE(func);
2428 #if PY_MAJOR_VERSION >= 3
2429 kwdefs = PyFunction_GET_KW_DEFAULTS(func);
2430 #endif
2431 if (argdefs != NULL) {
2432 d = &PyTuple_GET_ITEM(argdefs, 0);
2433 nd = Py_SIZE(argdefs);
2434 }
2435 else {
2436 d = NULL;
2437 nd = 0;
2438 }
2439 #if PY_MAJOR_VERSION >= 3
2440 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
2441 args, (int)nargs,
2442 k, (int)nk,
2443 d, (int)nd, kwdefs, closure);
2444 #else
2445 result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
2446 args, (int)nargs,
2447 k, (int)nk,
2448 d, (int)nd, closure);
2449 #endif
2450 Py_XDECREF(kwtuple);
2451 done:
2452 Py_LeaveRecursiveCall();
2453 return result;
2454 }
2455 #endif
2456 #endif
2457
2458 /* PyObjectCall */
2459 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_Call(PyObject * func,PyObject * arg,PyObject * kw)2460 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
2461 PyObject *result;
2462 ternaryfunc call = func->ob_type->tp_call;
2463 if (unlikely(!call))
2464 return PyObject_Call(func, arg, kw);
2465 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
2466 return NULL;
2467 result = (*call)(func, arg, kw);
2468 Py_LeaveRecursiveCall();
2469 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
2470 PyErr_SetString(
2471 PyExc_SystemError,
2472 "NULL result without error in PyObject_Call");
2473 }
2474 return result;
2475 }
2476 #endif
2477
2478 /* PyObjectCallMethO */
2479 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallMethO(PyObject * func,PyObject * arg)2480 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
2481 PyObject *self, *result;
2482 PyCFunction cfunc;
2483 cfunc = PyCFunction_GET_FUNCTION(func);
2484 self = PyCFunction_GET_SELF(func);
2485 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
2486 return NULL;
2487 result = cfunc(self, arg);
2488 Py_LeaveRecursiveCall();
2489 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
2490 PyErr_SetString(
2491 PyExc_SystemError,
2492 "NULL result without error in PyObject_Call");
2493 }
2494 return result;
2495 }
2496 #endif
2497
2498 /* PyObjectCallOneArg */
2499 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx__PyObject_CallOneArg(PyObject * func,PyObject * arg)2500 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
2501 PyObject *result;
2502 PyObject *args = PyTuple_New(1);
2503 if (unlikely(!args)) return NULL;
2504 Py_INCREF(arg);
2505 PyTuple_SET_ITEM(args, 0, arg);
2506 result = __Pyx_PyObject_Call(func, args, NULL);
2507 Py_DECREF(args);
2508 return result;
2509 }
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)2510 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
2511 #if CYTHON_FAST_PYCALL
2512 if (PyFunction_Check(func)) {
2513 return __Pyx_PyFunction_FastCall(func, &arg, 1);
2514 }
2515 #endif
2516 if (likely(PyCFunction_Check(func))) {
2517 if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
2518 return __Pyx_PyObject_CallMethO(func, arg);
2519 #if CYTHON_FAST_PYCCALL
2520 } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
2521 return __Pyx_PyCFunction_FastCall(func, &arg, 1);
2522 #endif
2523 }
2524 }
2525 return __Pyx__PyObject_CallOneArg(func, arg);
2526 }
2527 #else
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)2528 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
2529 PyObject *result;
2530 PyObject *args = PyTuple_Pack(1, arg);
2531 if (unlikely(!args)) return NULL;
2532 result = __Pyx_PyObject_Call(func, args, NULL);
2533 Py_DECREF(args);
2534 return result;
2535 }
2536 #endif
2537
2538 /* CalculateMetaclass */
__Pyx_CalculateMetaclass(PyTypeObject * metaclass,PyObject * bases)2539 static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
2540 Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases);
2541 for (i=0; i < nbases; i++) {
2542 PyTypeObject *tmptype;
2543 PyObject *tmp = PyTuple_GET_ITEM(bases, i);
2544 tmptype = Py_TYPE(tmp);
2545 #if PY_MAJOR_VERSION < 3
2546 if (tmptype == &PyClass_Type)
2547 continue;
2548 #endif
2549 if (!metaclass) {
2550 metaclass = tmptype;
2551 continue;
2552 }
2553 if (PyType_IsSubtype(metaclass, tmptype))
2554 continue;
2555 if (PyType_IsSubtype(tmptype, metaclass)) {
2556 metaclass = tmptype;
2557 continue;
2558 }
2559 PyErr_SetString(PyExc_TypeError,
2560 "metaclass conflict: "
2561 "the metaclass of a derived class "
2562 "must be a (non-strict) subclass "
2563 "of the metaclasses of all its bases");
2564 return NULL;
2565 }
2566 if (!metaclass) {
2567 #if PY_MAJOR_VERSION < 3
2568 metaclass = &PyClass_Type;
2569 #else
2570 metaclass = &PyType_Type;
2571 #endif
2572 }
2573 Py_INCREF((PyObject*) metaclass);
2574 return (PyObject*) metaclass;
2575 }
2576
2577 /* FetchCommonType */
__Pyx_FetchCommonType(PyTypeObject * type)2578 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
2579 PyObject* fake_module;
2580 PyTypeObject* cached_type = NULL;
2581 fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
2582 if (!fake_module) return NULL;
2583 Py_INCREF(fake_module);
2584 cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
2585 if (cached_type) {
2586 if (!PyType_Check((PyObject*)cached_type)) {
2587 PyErr_Format(PyExc_TypeError,
2588 "Shared Cython type %.200s is not a type object",
2589 type->tp_name);
2590 goto bad;
2591 }
2592 if (cached_type->tp_basicsize != type->tp_basicsize) {
2593 PyErr_Format(PyExc_TypeError,
2594 "Shared Cython type %.200s has the wrong size, try recompiling",
2595 type->tp_name);
2596 goto bad;
2597 }
2598 } else {
2599 if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
2600 PyErr_Clear();
2601 if (PyType_Ready(type) < 0) goto bad;
2602 if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
2603 goto bad;
2604 Py_INCREF(type);
2605 cached_type = type;
2606 }
2607 done:
2608 Py_DECREF(fake_module);
2609 return cached_type;
2610 bad:
2611 Py_XDECREF(cached_type);
2612 cached_type = NULL;
2613 goto done;
2614 }
2615
2616 /* CythonFunctionShared */
2617 #include <structmember.h>
2618 static PyObject *
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * closure)2619 __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
2620 {
2621 if (unlikely(op->func_doc == NULL)) {
2622 if (op->func.m_ml->ml_doc) {
2623 #if PY_MAJOR_VERSION >= 3
2624 op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
2625 #else
2626 op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
2627 #endif
2628 if (unlikely(op->func_doc == NULL))
2629 return NULL;
2630 } else {
2631 Py_INCREF(Py_None);
2632 return Py_None;
2633 }
2634 }
2635 Py_INCREF(op->func_doc);
2636 return op->func_doc;
2637 }
2638 static int
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject * op,PyObject * value,CYTHON_UNUSED void * context)2639 __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
2640 {
2641 PyObject *tmp = op->func_doc;
2642 if (value == NULL) {
2643 value = Py_None;
2644 }
2645 Py_INCREF(value);
2646 op->func_doc = value;
2647 Py_XDECREF(tmp);
2648 return 0;
2649 }
2650 static PyObject *
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)2651 __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
2652 {
2653 if (unlikely(op->func_name == NULL)) {
2654 #if PY_MAJOR_VERSION >= 3
2655 op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
2656 #else
2657 op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
2658 #endif
2659 if (unlikely(op->func_name == NULL))
2660 return NULL;
2661 }
2662 Py_INCREF(op->func_name);
2663 return op->func_name;
2664 }
2665 static int
__Pyx_CyFunction_set_name(__pyx_CyFunctionObject * op,PyObject * value,CYTHON_UNUSED void * context)2666 __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
2667 {
2668 PyObject *tmp;
2669 #if PY_MAJOR_VERSION >= 3
2670 if (unlikely(value == NULL || !PyUnicode_Check(value)))
2671 #else
2672 if (unlikely(value == NULL || !PyString_Check(value)))
2673 #endif
2674 {
2675 PyErr_SetString(PyExc_TypeError,
2676 "__name__ must be set to a string object");
2677 return -1;
2678 }
2679 tmp = op->func_name;
2680 Py_INCREF(value);
2681 op->func_name = value;
2682 Py_XDECREF(tmp);
2683 return 0;
2684 }
2685 static PyObject *
__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)2686 __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
2687 {
2688 Py_INCREF(op->func_qualname);
2689 return op->func_qualname;
2690 }
2691 static int
__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject * op,PyObject * value,CYTHON_UNUSED void * context)2692 __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
2693 {
2694 PyObject *tmp;
2695 #if PY_MAJOR_VERSION >= 3
2696 if (unlikely(value == NULL || !PyUnicode_Check(value)))
2697 #else
2698 if (unlikely(value == NULL || !PyString_Check(value)))
2699 #endif
2700 {
2701 PyErr_SetString(PyExc_TypeError,
2702 "__qualname__ must be set to a string object");
2703 return -1;
2704 }
2705 tmp = op->func_qualname;
2706 Py_INCREF(value);
2707 op->func_qualname = value;
2708 Py_XDECREF(tmp);
2709 return 0;
2710 }
2711 static PyObject *
__Pyx_CyFunction_get_self(__pyx_CyFunctionObject * m,CYTHON_UNUSED void * closure)2712 __Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
2713 {
2714 PyObject *self;
2715 self = m->func_closure;
2716 if (self == NULL)
2717 self = Py_None;
2718 Py_INCREF(self);
2719 return self;
2720 }
2721 static PyObject *
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)2722 __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
2723 {
2724 if (unlikely(op->func_dict == NULL)) {
2725 op->func_dict = PyDict_New();
2726 if (unlikely(op->func_dict == NULL))
2727 return NULL;
2728 }
2729 Py_INCREF(op->func_dict);
2730 return op->func_dict;
2731 }
2732 static int
__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject * op,PyObject * value,CYTHON_UNUSED void * context)2733 __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
2734 {
2735 PyObject *tmp;
2736 if (unlikely(value == NULL)) {
2737 PyErr_SetString(PyExc_TypeError,
2738 "function's dictionary may not be deleted");
2739 return -1;
2740 }
2741 if (unlikely(!PyDict_Check(value))) {
2742 PyErr_SetString(PyExc_TypeError,
2743 "setting function's dictionary to a non-dict");
2744 return -1;
2745 }
2746 tmp = op->func_dict;
2747 Py_INCREF(value);
2748 op->func_dict = value;
2749 Py_XDECREF(tmp);
2750 return 0;
2751 }
2752 static PyObject *
__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)2753 __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
2754 {
2755 Py_INCREF(op->func_globals);
2756 return op->func_globals;
2757 }
2758 static PyObject *
__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)2759 __Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
2760 {
2761 Py_INCREF(Py_None);
2762 return Py_None;
2763 }
2764 static PyObject *
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)2765 __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
2766 {
2767 PyObject* result = (op->func_code) ? op->func_code : Py_None;
2768 Py_INCREF(result);
2769 return result;
2770 }
2771 static int
__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject * op)2772 __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
2773 int result = 0;
2774 PyObject *res = op->defaults_getter((PyObject *) op);
2775 if (unlikely(!res))
2776 return -1;
2777 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
2778 op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
2779 Py_INCREF(op->defaults_tuple);
2780 op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
2781 Py_INCREF(op->defaults_kwdict);
2782 #else
2783 op->defaults_tuple = PySequence_ITEM(res, 0);
2784 if (unlikely(!op->defaults_tuple)) result = -1;
2785 else {
2786 op->defaults_kwdict = PySequence_ITEM(res, 1);
2787 if (unlikely(!op->defaults_kwdict)) result = -1;
2788 }
2789 #endif
2790 Py_DECREF(res);
2791 return result;
2792 }
2793 static int
__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject * op,PyObject * value,CYTHON_UNUSED void * context)2794 __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
2795 PyObject* tmp;
2796 if (!value) {
2797 value = Py_None;
2798 } else if (value != Py_None && !PyTuple_Check(value)) {
2799 PyErr_SetString(PyExc_TypeError,
2800 "__defaults__ must be set to a tuple object");
2801 return -1;
2802 }
2803 Py_INCREF(value);
2804 tmp = op->defaults_tuple;
2805 op->defaults_tuple = value;
2806 Py_XDECREF(tmp);
2807 return 0;
2808 }
2809 static PyObject *
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)2810 __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
2811 PyObject* result = op->defaults_tuple;
2812 if (unlikely(!result)) {
2813 if (op->defaults_getter) {
2814 if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
2815 result = op->defaults_tuple;
2816 } else {
2817 result = Py_None;
2818 }
2819 }
2820 Py_INCREF(result);
2821 return result;
2822 }
2823 static int
__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject * op,PyObject * value,CYTHON_UNUSED void * context)2824 __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
2825 PyObject* tmp;
2826 if (!value) {
2827 value = Py_None;
2828 } else if (value != Py_None && !PyDict_Check(value)) {
2829 PyErr_SetString(PyExc_TypeError,
2830 "__kwdefaults__ must be set to a dict object");
2831 return -1;
2832 }
2833 Py_INCREF(value);
2834 tmp = op->defaults_kwdict;
2835 op->defaults_kwdict = value;
2836 Py_XDECREF(tmp);
2837 return 0;
2838 }
2839 static PyObject *
__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)2840 __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
2841 PyObject* result = op->defaults_kwdict;
2842 if (unlikely(!result)) {
2843 if (op->defaults_getter) {
2844 if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
2845 result = op->defaults_kwdict;
2846 } else {
2847 result = Py_None;
2848 }
2849 }
2850 Py_INCREF(result);
2851 return result;
2852 }
2853 static int
__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject * op,PyObject * value,CYTHON_UNUSED void * context)2854 __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
2855 PyObject* tmp;
2856 if (!value || value == Py_None) {
2857 value = NULL;
2858 } else if (!PyDict_Check(value)) {
2859 PyErr_SetString(PyExc_TypeError,
2860 "__annotations__ must be set to a dict object");
2861 return -1;
2862 }
2863 Py_XINCREF(value);
2864 tmp = op->func_annotations;
2865 op->func_annotations = value;
2866 Py_XDECREF(tmp);
2867 return 0;
2868 }
2869 static PyObject *
__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject * op,CYTHON_UNUSED void * context)2870 __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
2871 PyObject* result = op->func_annotations;
2872 if (unlikely(!result)) {
2873 result = PyDict_New();
2874 if (unlikely(!result)) return NULL;
2875 op->func_annotations = result;
2876 }
2877 Py_INCREF(result);
2878 return result;
2879 }
2880 static PyGetSetDef __pyx_CyFunction_getsets[] = {
2881 {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
2882 {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
2883 {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
2884 {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
2885 {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
2886 {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
2887 {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
2888 {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
2889 {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
2890 {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
2891 {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
2892 {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
2893 {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
2894 {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
2895 {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
2896 {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
2897 {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
2898 {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
2899 {0, 0, 0, 0, 0}
2900 };
2901 static PyMemberDef __pyx_CyFunction_members[] = {
2902 {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0},
2903 {0, 0, 0, 0, 0}
2904 };
2905 static PyObject *
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject * m,CYTHON_UNUSED PyObject * args)2906 __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
2907 {
2908 #if PY_MAJOR_VERSION >= 3
2909 return PyUnicode_FromString(m->func.m_ml->ml_name);
2910 #else
2911 return PyString_FromString(m->func.m_ml->ml_name);
2912 #endif
2913 }
2914 static PyMethodDef __pyx_CyFunction_methods[] = {
2915 {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
2916 {0, 0, 0, 0}
2917 };
2918 #if PY_VERSION_HEX < 0x030500A0
2919 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
2920 #else
2921 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
2922 #endif
__Pyx_CyFunction_Init(__pyx_CyFunctionObject * op,PyMethodDef * ml,int flags,PyObject * qualname,PyObject * closure,PyObject * module,PyObject * globals,PyObject * code)2923 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname,
2924 PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
2925 if (unlikely(op == NULL))
2926 return NULL;
2927 op->flags = flags;
2928 __Pyx_CyFunction_weakreflist(op) = NULL;
2929 op->func.m_ml = ml;
2930 op->func.m_self = (PyObject *) op;
2931 Py_XINCREF(closure);
2932 op->func_closure = closure;
2933 Py_XINCREF(module);
2934 op->func.m_module = module;
2935 op->func_dict = NULL;
2936 op->func_name = NULL;
2937 Py_INCREF(qualname);
2938 op->func_qualname = qualname;
2939 op->func_doc = NULL;
2940 op->func_classobj = NULL;
2941 op->func_globals = globals;
2942 Py_INCREF(op->func_globals);
2943 Py_XINCREF(code);
2944 op->func_code = code;
2945 op->defaults_pyobjects = 0;
2946 op->defaults_size = 0;
2947 op->defaults = NULL;
2948 op->defaults_tuple = NULL;
2949 op->defaults_kwdict = NULL;
2950 op->defaults_getter = NULL;
2951 op->func_annotations = NULL;
2952 return (PyObject *) op;
2953 }
2954 static int
__Pyx_CyFunction_clear(__pyx_CyFunctionObject * m)2955 __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
2956 {
2957 Py_CLEAR(m->func_closure);
2958 Py_CLEAR(m->func.m_module);
2959 Py_CLEAR(m->func_dict);
2960 Py_CLEAR(m->func_name);
2961 Py_CLEAR(m->func_qualname);
2962 Py_CLEAR(m->func_doc);
2963 Py_CLEAR(m->func_globals);
2964 Py_CLEAR(m->func_code);
2965 Py_CLEAR(m->func_classobj);
2966 Py_CLEAR(m->defaults_tuple);
2967 Py_CLEAR(m->defaults_kwdict);
2968 Py_CLEAR(m->func_annotations);
2969 if (m->defaults) {
2970 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
2971 int i;
2972 for (i = 0; i < m->defaults_pyobjects; i++)
2973 Py_XDECREF(pydefaults[i]);
2974 PyObject_Free(m->defaults);
2975 m->defaults = NULL;
2976 }
2977 return 0;
2978 }
__Pyx__CyFunction_dealloc(__pyx_CyFunctionObject * m)2979 static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
2980 {
2981 if (__Pyx_CyFunction_weakreflist(m) != NULL)
2982 PyObject_ClearWeakRefs((PyObject *) m);
2983 __Pyx_CyFunction_clear(m);
2984 PyObject_GC_Del(m);
2985 }
__Pyx_CyFunction_dealloc(__pyx_CyFunctionObject * m)2986 static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
2987 {
2988 PyObject_GC_UnTrack(m);
2989 __Pyx__CyFunction_dealloc(m);
2990 }
__Pyx_CyFunction_traverse(__pyx_CyFunctionObject * m,visitproc visit,void * arg)2991 static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
2992 {
2993 Py_VISIT(m->func_closure);
2994 Py_VISIT(m->func.m_module);
2995 Py_VISIT(m->func_dict);
2996 Py_VISIT(m->func_name);
2997 Py_VISIT(m->func_qualname);
2998 Py_VISIT(m->func_doc);
2999 Py_VISIT(m->func_globals);
3000 Py_VISIT(m->func_code);
3001 Py_VISIT(m->func_classobj);
3002 Py_VISIT(m->defaults_tuple);
3003 Py_VISIT(m->defaults_kwdict);
3004 if (m->defaults) {
3005 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
3006 int i;
3007 for (i = 0; i < m->defaults_pyobjects; i++)
3008 Py_VISIT(pydefaults[i]);
3009 }
3010 return 0;
3011 }
__Pyx_CyFunction_descr_get(PyObject * func,PyObject * obj,PyObject * type)3012 static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
3013 {
3014 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
3015 if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
3016 Py_INCREF(func);
3017 return func;
3018 }
3019 if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
3020 if (type == NULL)
3021 type = (PyObject *)(Py_TYPE(obj));
3022 return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
3023 }
3024 if (obj == Py_None)
3025 obj = NULL;
3026 return __Pyx_PyMethod_New(func, obj, type);
3027 }
3028 static PyObject*
__Pyx_CyFunction_repr(__pyx_CyFunctionObject * op)3029 __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
3030 {
3031 #if PY_MAJOR_VERSION >= 3
3032 return PyUnicode_FromFormat("<cyfunction %U at %p>",
3033 op->func_qualname, (void *)op);
3034 #else
3035 return PyString_FromFormat("<cyfunction %s at %p>",
3036 PyString_AsString(op->func_qualname), (void *)op);
3037 #endif
3038 }
__Pyx_CyFunction_CallMethod(PyObject * func,PyObject * self,PyObject * arg,PyObject * kw)3039 static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
3040 PyCFunctionObject* f = (PyCFunctionObject*)func;
3041 PyCFunction meth = f->m_ml->ml_meth;
3042 Py_ssize_t size;
3043 switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
3044 case METH_VARARGS:
3045 if (likely(kw == NULL || PyDict_Size(kw) == 0))
3046 return (*meth)(self, arg);
3047 break;
3048 case METH_VARARGS | METH_KEYWORDS:
3049 return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw);
3050 case METH_NOARGS:
3051 if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
3052 size = PyTuple_GET_SIZE(arg);
3053 if (likely(size == 0))
3054 return (*meth)(self, NULL);
3055 PyErr_Format(PyExc_TypeError,
3056 "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
3057 f->m_ml->ml_name, size);
3058 return NULL;
3059 }
3060 break;
3061 case METH_O:
3062 if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
3063 size = PyTuple_GET_SIZE(arg);
3064 if (likely(size == 1)) {
3065 PyObject *result, *arg0;
3066 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3067 arg0 = PyTuple_GET_ITEM(arg, 0);
3068 #else
3069 arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
3070 #endif
3071 result = (*meth)(self, arg0);
3072 #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
3073 Py_DECREF(arg0);
3074 #endif
3075 return result;
3076 }
3077 PyErr_Format(PyExc_TypeError,
3078 "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
3079 f->m_ml->ml_name, size);
3080 return NULL;
3081 }
3082 break;
3083 default:
3084 PyErr_SetString(PyExc_SystemError, "Bad call flags in "
3085 "__Pyx_CyFunction_Call. METH_OLDARGS is no "
3086 "longer supported!");
3087 return NULL;
3088 }
3089 PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
3090 f->m_ml->ml_name);
3091 return NULL;
3092 }
__Pyx_CyFunction_Call(PyObject * func,PyObject * arg,PyObject * kw)3093 static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
3094 return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw);
3095 }
__Pyx_CyFunction_CallAsMethod(PyObject * func,PyObject * args,PyObject * kw)3096 static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
3097 PyObject *result;
3098 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
3099 if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
3100 Py_ssize_t argc;
3101 PyObject *new_args;
3102 PyObject *self;
3103 argc = PyTuple_GET_SIZE(args);
3104 new_args = PyTuple_GetSlice(args, 1, argc);
3105 if (unlikely(!new_args))
3106 return NULL;
3107 self = PyTuple_GetItem(args, 0);
3108 if (unlikely(!self)) {
3109 Py_DECREF(new_args);
3110 return NULL;
3111 }
3112 result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
3113 Py_DECREF(new_args);
3114 } else {
3115 result = __Pyx_CyFunction_Call(func, args, kw);
3116 }
3117 return result;
3118 }
3119 static PyTypeObject __pyx_CyFunctionType_type = {
3120 PyVarObject_HEAD_INIT(0, 0)
3121 "cython_function_or_method",
3122 sizeof(__pyx_CyFunctionObject),
3123 0,
3124 (destructor) __Pyx_CyFunction_dealloc,
3125 0,
3126 0,
3127 0,
3128 #if PY_MAJOR_VERSION < 3
3129 0,
3130 #else
3131 0,
3132 #endif
3133 (reprfunc) __Pyx_CyFunction_repr,
3134 0,
3135 0,
3136 0,
3137 0,
3138 __Pyx_CyFunction_CallAsMethod,
3139 0,
3140 0,
3141 0,
3142 0,
3143 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
3144 0,
3145 (traverseproc) __Pyx_CyFunction_traverse,
3146 (inquiry) __Pyx_CyFunction_clear,
3147 0,
3148 #if PY_VERSION_HEX < 0x030500A0
3149 offsetof(__pyx_CyFunctionObject, func_weakreflist),
3150 #else
3151 offsetof(PyCFunctionObject, m_weakreflist),
3152 #endif
3153 0,
3154 0,
3155 __pyx_CyFunction_methods,
3156 __pyx_CyFunction_members,
3157 __pyx_CyFunction_getsets,
3158 0,
3159 0,
3160 __Pyx_CyFunction_descr_get,
3161 0,
3162 offsetof(__pyx_CyFunctionObject, func_dict),
3163 0,
3164 0,
3165 0,
3166 0,
3167 0,
3168 0,
3169 0,
3170 0,
3171 0,
3172 0,
3173 0,
3174 0,
3175 #if PY_VERSION_HEX >= 0x030400a1
3176 0,
3177 #endif
3178 #if PY_VERSION_HEX >= 0x030800b1
3179 0,
3180 #endif
3181 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
3182 0,
3183 #endif
3184 };
__pyx_CyFunction_init(void)3185 static int __pyx_CyFunction_init(void) {
3186 __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
3187 if (unlikely(__pyx_CyFunctionType == NULL)) {
3188 return -1;
3189 }
3190 return 0;
3191 }
__Pyx_CyFunction_InitDefaults(PyObject * func,size_t size,int pyobjects)3192 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
3193 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
3194 m->defaults = PyObject_Malloc(size);
3195 if (unlikely(!m->defaults))
3196 return PyErr_NoMemory();
3197 memset(m->defaults, 0, size);
3198 m->defaults_pyobjects = pyobjects;
3199 m->defaults_size = size;
3200 return m->defaults;
3201 }
__Pyx_CyFunction_SetDefaultsTuple(PyObject * func,PyObject * tuple)3202 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
3203 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
3204 m->defaults_tuple = tuple;
3205 Py_INCREF(tuple);
3206 }
__Pyx_CyFunction_SetDefaultsKwDict(PyObject * func,PyObject * dict)3207 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
3208 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
3209 m->defaults_kwdict = dict;
3210 Py_INCREF(dict);
3211 }
__Pyx_CyFunction_SetAnnotationsDict(PyObject * func,PyObject * dict)3212 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
3213 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
3214 m->func_annotations = dict;
3215 Py_INCREF(dict);
3216 }
3217
3218 /* CythonFunction */
__Pyx_CyFunction_New(PyMethodDef * ml,int flags,PyObject * qualname,PyObject * closure,PyObject * module,PyObject * globals,PyObject * code)3219 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname,
3220 PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
3221 PyObject *op = __Pyx_CyFunction_Init(
3222 PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType),
3223 ml, flags, qualname, closure, module, globals, code
3224 );
3225 if (likely(op)) {
3226 PyObject_GC_Track(op);
3227 }
3228 return op;
3229 }
3230
3231 /* Py3ClassCreate */
__Pyx_Py3MetaclassPrepare(PyObject * metaclass,PyObject * bases,PyObject * name,PyObject * qualname,PyObject * mkw,PyObject * modname,PyObject * doc)3232 static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
3233 PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
3234 PyObject *ns;
3235 if (metaclass) {
3236 PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare);
3237 if (prep) {
3238 PyObject *pargs = PyTuple_Pack(2, name, bases);
3239 if (unlikely(!pargs)) {
3240 Py_DECREF(prep);
3241 return NULL;
3242 }
3243 ns = PyObject_Call(prep, pargs, mkw);
3244 Py_DECREF(prep);
3245 Py_DECREF(pargs);
3246 } else {
3247 if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError)))
3248 return NULL;
3249 PyErr_Clear();
3250 ns = PyDict_New();
3251 }
3252 } else {
3253 ns = PyDict_New();
3254 }
3255 if (unlikely(!ns))
3256 return NULL;
3257 if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad;
3258 if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad;
3259 if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad;
3260 return ns;
3261 bad:
3262 Py_DECREF(ns);
3263 return NULL;
3264 }
__Pyx_Py3ClassCreate(PyObject * metaclass,PyObject * name,PyObject * bases,PyObject * dict,PyObject * mkw,int calculate_metaclass,int allow_py2_metaclass)3265 static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
3266 PyObject *dict, PyObject *mkw,
3267 int calculate_metaclass, int allow_py2_metaclass) {
3268 PyObject *result, *margs;
3269 PyObject *owned_metaclass = NULL;
3270 if (allow_py2_metaclass) {
3271 owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass);
3272 if (owned_metaclass) {
3273 metaclass = owned_metaclass;
3274 } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
3275 PyErr_Clear();
3276 } else {
3277 return NULL;
3278 }
3279 }
3280 if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
3281 metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
3282 Py_XDECREF(owned_metaclass);
3283 if (unlikely(!metaclass))
3284 return NULL;
3285 owned_metaclass = metaclass;
3286 }
3287 margs = PyTuple_Pack(3, name, bases, dict);
3288 if (unlikely(!margs)) {
3289 result = NULL;
3290 } else {
3291 result = PyObject_Call(metaclass, margs, mkw);
3292 Py_DECREF(margs);
3293 }
3294 Py_XDECREF(owned_metaclass);
3295 return result;
3296 }
3297
3298 /* PyDictVersioning */
3299 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
__Pyx_get_tp_dict_version(PyObject * obj)3300 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
3301 PyObject *dict = Py_TYPE(obj)->tp_dict;
3302 return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
3303 }
__Pyx_get_object_dict_version(PyObject * obj)3304 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
3305 PyObject **dictptr = NULL;
3306 Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
3307 if (offset) {
3308 #if CYTHON_COMPILING_IN_CPYTHON
3309 dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
3310 #else
3311 dictptr = _PyObject_GetDictPtr(obj);
3312 #endif
3313 }
3314 return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
3315 }
__Pyx_object_dict_version_matches(PyObject * obj,PY_UINT64_T tp_dict_version,PY_UINT64_T obj_dict_version)3316 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
3317 PyObject *dict = Py_TYPE(obj)->tp_dict;
3318 if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
3319 return 0;
3320 return obj_dict_version == __Pyx_get_object_dict_version(obj);
3321 }
3322 #endif
3323
3324 /* PyErrFetchRestore */
3325 #if CYTHON_FAST_THREAD_STATE
__Pyx_ErrRestoreInState(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)3326 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
3327 PyObject *tmp_type, *tmp_value, *tmp_tb;
3328 tmp_type = tstate->curexc_type;
3329 tmp_value = tstate->curexc_value;
3330 tmp_tb = tstate->curexc_traceback;
3331 tstate->curexc_type = type;
3332 tstate->curexc_value = value;
3333 tstate->curexc_traceback = tb;
3334 Py_XDECREF(tmp_type);
3335 Py_XDECREF(tmp_value);
3336 Py_XDECREF(tmp_tb);
3337 }
__Pyx_ErrFetchInState(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)3338 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
3339 *type = tstate->curexc_type;
3340 *value = tstate->curexc_value;
3341 *tb = tstate->curexc_traceback;
3342 tstate->curexc_type = 0;
3343 tstate->curexc_value = 0;
3344 tstate->curexc_traceback = 0;
3345 }
3346 #endif
3347
3348 /* CLineInTraceback */
3349 #ifndef CYTHON_CLINE_IN_TRACEBACK
__Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState * tstate,int c_line)3350 static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
3351 PyObject *use_cline;
3352 PyObject *ptype, *pvalue, *ptraceback;
3353 #if CYTHON_COMPILING_IN_CPYTHON
3354 PyObject **cython_runtime_dict;
3355 #endif
3356 if (unlikely(!__pyx_cython_runtime)) {
3357 return c_line;
3358 }
3359 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
3360 #if CYTHON_COMPILING_IN_CPYTHON
3361 cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
3362 if (likely(cython_runtime_dict)) {
3363 __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
3364 use_cline, *cython_runtime_dict,
3365 __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
3366 } else
3367 #endif
3368 {
3369 PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
3370 if (use_cline_obj) {
3371 use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
3372 Py_DECREF(use_cline_obj);
3373 } else {
3374 PyErr_Clear();
3375 use_cline = NULL;
3376 }
3377 }
3378 if (!use_cline) {
3379 c_line = 0;
3380 PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
3381 }
3382 else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
3383 c_line = 0;
3384 }
3385 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
3386 return c_line;
3387 }
3388 #endif
3389
3390 /* CodeObjectCache */
__pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry * entries,int count,int code_line)3391 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
3392 int start = 0, mid = 0, end = count - 1;
3393 if (end >= 0 && code_line > entries[end].code_line) {
3394 return count;
3395 }
3396 while (start < end) {
3397 mid = start + (end - start) / 2;
3398 if (code_line < entries[mid].code_line) {
3399 end = mid;
3400 } else if (code_line > entries[mid].code_line) {
3401 start = mid + 1;
3402 } else {
3403 return mid;
3404 }
3405 }
3406 if (code_line <= entries[mid].code_line) {
3407 return mid;
3408 } else {
3409 return mid + 1;
3410 }
3411 }
__pyx_find_code_object(int code_line)3412 static PyCodeObject *__pyx_find_code_object(int code_line) {
3413 PyCodeObject* code_object;
3414 int pos;
3415 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
3416 return NULL;
3417 }
3418 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
3419 if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
3420 return NULL;
3421 }
3422 code_object = __pyx_code_cache.entries[pos].code_object;
3423 Py_INCREF(code_object);
3424 return code_object;
3425 }
__pyx_insert_code_object(int code_line,PyCodeObject * code_object)3426 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
3427 int pos, i;
3428 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
3429 if (unlikely(!code_line)) {
3430 return;
3431 }
3432 if (unlikely(!entries)) {
3433 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
3434 if (likely(entries)) {
3435 __pyx_code_cache.entries = entries;
3436 __pyx_code_cache.max_count = 64;
3437 __pyx_code_cache.count = 1;
3438 entries[0].code_line = code_line;
3439 entries[0].code_object = code_object;
3440 Py_INCREF(code_object);
3441 }
3442 return;
3443 }
3444 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
3445 if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
3446 PyCodeObject* tmp = entries[pos].code_object;
3447 entries[pos].code_object = code_object;
3448 Py_DECREF(tmp);
3449 return;
3450 }
3451 if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
3452 int new_max = __pyx_code_cache.max_count + 64;
3453 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
3454 __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
3455 if (unlikely(!entries)) {
3456 return;
3457 }
3458 __pyx_code_cache.entries = entries;
3459 __pyx_code_cache.max_count = new_max;
3460 }
3461 for (i=__pyx_code_cache.count; i>pos; i--) {
3462 entries[i] = entries[i-1];
3463 }
3464 entries[pos].code_line = code_line;
3465 entries[pos].code_object = code_object;
3466 __pyx_code_cache.count++;
3467 Py_INCREF(code_object);
3468 }
3469
3470 /* AddTraceback */
3471 #include "compile.h"
3472 #include "frameobject.h"
3473 #include "traceback.h"
__Pyx_CreateCodeObjectForTraceback(const char * funcname,int c_line,int py_line,const char * filename)3474 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
3475 const char *funcname, int c_line,
3476 int py_line, const char *filename) {
3477 PyCodeObject *py_code = 0;
3478 PyObject *py_srcfile = 0;
3479 PyObject *py_funcname = 0;
3480 #if PY_MAJOR_VERSION < 3
3481 py_srcfile = PyString_FromString(filename);
3482 #else
3483 py_srcfile = PyUnicode_FromString(filename);
3484 #endif
3485 if (!py_srcfile) goto bad;
3486 if (c_line) {
3487 #if PY_MAJOR_VERSION < 3
3488 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
3489 #else
3490 py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
3491 #endif
3492 }
3493 else {
3494 #if PY_MAJOR_VERSION < 3
3495 py_funcname = PyString_FromString(funcname);
3496 #else
3497 py_funcname = PyUnicode_FromString(funcname);
3498 #endif
3499 }
3500 if (!py_funcname) goto bad;
3501 py_code = __Pyx_PyCode_New(
3502 0,
3503 0,
3504 0,
3505 0,
3506 0,
3507 __pyx_empty_bytes, /*PyObject *code,*/
3508 __pyx_empty_tuple, /*PyObject *consts,*/
3509 __pyx_empty_tuple, /*PyObject *names,*/
3510 __pyx_empty_tuple, /*PyObject *varnames,*/
3511 __pyx_empty_tuple, /*PyObject *freevars,*/
3512 __pyx_empty_tuple, /*PyObject *cellvars,*/
3513 py_srcfile, /*PyObject *filename,*/
3514 py_funcname, /*PyObject *name,*/
3515 py_line,
3516 __pyx_empty_bytes /*PyObject *lnotab*/
3517 );
3518 Py_DECREF(py_srcfile);
3519 Py_DECREF(py_funcname);
3520 return py_code;
3521 bad:
3522 Py_XDECREF(py_srcfile);
3523 Py_XDECREF(py_funcname);
3524 return NULL;
3525 }
__Pyx_AddTraceback(const char * funcname,int c_line,int py_line,const char * filename)3526 static void __Pyx_AddTraceback(const char *funcname, int c_line,
3527 int py_line, const char *filename) {
3528 PyCodeObject *py_code = 0;
3529 PyFrameObject *py_frame = 0;
3530 PyThreadState *tstate = __Pyx_PyThreadState_Current;
3531 if (c_line) {
3532 c_line = __Pyx_CLineForTraceback(tstate, c_line);
3533 }
3534 py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
3535 if (!py_code) {
3536 py_code = __Pyx_CreateCodeObjectForTraceback(
3537 funcname, c_line, py_line, filename);
3538 if (!py_code) goto bad;
3539 __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
3540 }
3541 py_frame = PyFrame_New(
3542 tstate, /*PyThreadState *tstate,*/
3543 py_code, /*PyCodeObject *code,*/
3544 __pyx_d, /*PyObject *globals,*/
3545 0 /*PyObject *locals*/
3546 );
3547 if (!py_frame) goto bad;
3548 __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
3549 PyTraceBack_Here(py_frame);
3550 bad:
3551 Py_XDECREF(py_code);
3552 Py_XDECREF(py_frame);
3553 }
3554
3555 /* CIntToPy */
__Pyx_PyInt_From_long(long value)3556 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
3557 const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
3558 const int is_unsigned = neg_one > const_zero;
3559 if (is_unsigned) {
3560 if (sizeof(long) < sizeof(long)) {
3561 return PyInt_FromLong((long) value);
3562 } else if (sizeof(long) <= sizeof(unsigned long)) {
3563 return PyLong_FromUnsignedLong((unsigned long) value);
3564 #ifdef HAVE_LONG_LONG
3565 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
3566 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
3567 #endif
3568 }
3569 } else {
3570 if (sizeof(long) <= sizeof(long)) {
3571 return PyInt_FromLong((long) value);
3572 #ifdef HAVE_LONG_LONG
3573 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
3574 return PyLong_FromLongLong((PY_LONG_LONG) value);
3575 #endif
3576 }
3577 }
3578 {
3579 int one = 1; int little = (int)*(unsigned char *)&one;
3580 unsigned char *bytes = (unsigned char *)&value;
3581 return _PyLong_FromByteArray(bytes, sizeof(long),
3582 little, !is_unsigned);
3583 }
3584 }
3585
3586 /* CIntFromPyVerify */
3587 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
3588 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
3589 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
3590 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
3591 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
3592 {\
3593 func_type value = func_value;\
3594 if (sizeof(target_type) < sizeof(func_type)) {\
3595 if (unlikely(value != (func_type) (target_type) value)) {\
3596 func_type zero = 0;\
3597 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
3598 return (target_type) -1;\
3599 if (is_unsigned && unlikely(value < zero))\
3600 goto raise_neg_overflow;\
3601 else\
3602 goto raise_overflow;\
3603 }\
3604 }\
3605 return (target_type) value;\
3606 }
3607
3608 /* CIntFromPy */
__Pyx_PyInt_As_long(PyObject * x)3609 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
3610 const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
3611 const int is_unsigned = neg_one > const_zero;
3612 #if PY_MAJOR_VERSION < 3
3613 if (likely(PyInt_Check(x))) {
3614 if (sizeof(long) < sizeof(long)) {
3615 __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
3616 } else {
3617 long val = PyInt_AS_LONG(x);
3618 if (is_unsigned && unlikely(val < 0)) {
3619 goto raise_neg_overflow;
3620 }
3621 return (long) val;
3622 }
3623 } else
3624 #endif
3625 if (likely(PyLong_Check(x))) {
3626 if (is_unsigned) {
3627 #if CYTHON_USE_PYLONG_INTERNALS
3628 const digit* digits = ((PyLongObject*)x)->ob_digit;
3629 switch (Py_SIZE(x)) {
3630 case 0: return (long) 0;
3631 case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
3632 case 2:
3633 if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
3634 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
3635 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3636 } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
3637 return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
3638 }
3639 }
3640 break;
3641 case 3:
3642 if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
3643 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
3644 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3645 } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
3646 return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
3647 }
3648 }
3649 break;
3650 case 4:
3651 if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
3652 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
3653 __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])))
3654 } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
3655 return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
3656 }
3657 }
3658 break;
3659 }
3660 #endif
3661 #if CYTHON_COMPILING_IN_CPYTHON
3662 if (unlikely(Py_SIZE(x) < 0)) {
3663 goto raise_neg_overflow;
3664 }
3665 #else
3666 {
3667 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
3668 if (unlikely(result < 0))
3669 return (long) -1;
3670 if (unlikely(result == 1))
3671 goto raise_neg_overflow;
3672 }
3673 #endif
3674 if (sizeof(long) <= sizeof(unsigned long)) {
3675 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
3676 #ifdef HAVE_LONG_LONG
3677 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
3678 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
3679 #endif
3680 }
3681 } else {
3682 #if CYTHON_USE_PYLONG_INTERNALS
3683 const digit* digits = ((PyLongObject*)x)->ob_digit;
3684 switch (Py_SIZE(x)) {
3685 case 0: return (long) 0;
3686 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
3687 case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
3688 case -2:
3689 if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
3690 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
3691 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3692 } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
3693 return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
3694 }
3695 }
3696 break;
3697 case 2:
3698 if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
3699 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
3700 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3701 } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
3702 return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
3703 }
3704 }
3705 break;
3706 case -3:
3707 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
3708 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
3709 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3710 } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
3711 return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
3712 }
3713 }
3714 break;
3715 case 3:
3716 if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
3717 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
3718 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3719 } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
3720 return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
3721 }
3722 }
3723 break;
3724 case -4:
3725 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
3726 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
3727 __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])))
3728 } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
3729 return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
3730 }
3731 }
3732 break;
3733 case 4:
3734 if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
3735 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
3736 __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])))
3737 } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
3738 return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
3739 }
3740 }
3741 break;
3742 }
3743 #endif
3744 if (sizeof(long) <= sizeof(long)) {
3745 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
3746 #ifdef HAVE_LONG_LONG
3747 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
3748 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
3749 #endif
3750 }
3751 }
3752 {
3753 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
3754 PyErr_SetString(PyExc_RuntimeError,
3755 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
3756 #else
3757 long val;
3758 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
3759 #if PY_MAJOR_VERSION < 3
3760 if (likely(v) && !PyLong_Check(v)) {
3761 PyObject *tmp = v;
3762 v = PyNumber_Long(tmp);
3763 Py_DECREF(tmp);
3764 }
3765 #endif
3766 if (likely(v)) {
3767 int one = 1; int is_little = (int)*(unsigned char *)&one;
3768 unsigned char *bytes = (unsigned char *)&val;
3769 int ret = _PyLong_AsByteArray((PyLongObject *)v,
3770 bytes, sizeof(val),
3771 is_little, !is_unsigned);
3772 Py_DECREF(v);
3773 if (likely(!ret))
3774 return val;
3775 }
3776 #endif
3777 return (long) -1;
3778 }
3779 } else {
3780 long val;
3781 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
3782 if (!tmp) return (long) -1;
3783 val = __Pyx_PyInt_As_long(tmp);
3784 Py_DECREF(tmp);
3785 return val;
3786 }
3787 raise_overflow:
3788 PyErr_SetString(PyExc_OverflowError,
3789 "value too large to convert to long");
3790 return (long) -1;
3791 raise_neg_overflow:
3792 PyErr_SetString(PyExc_OverflowError,
3793 "can't convert negative value to long");
3794 return (long) -1;
3795 }
3796
3797 /* CIntFromPy */
__Pyx_PyInt_As_int(PyObject * x)3798 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
3799 const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
3800 const int is_unsigned = neg_one > const_zero;
3801 #if PY_MAJOR_VERSION < 3
3802 if (likely(PyInt_Check(x))) {
3803 if (sizeof(int) < sizeof(long)) {
3804 __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
3805 } else {
3806 long val = PyInt_AS_LONG(x);
3807 if (is_unsigned && unlikely(val < 0)) {
3808 goto raise_neg_overflow;
3809 }
3810 return (int) val;
3811 }
3812 } else
3813 #endif
3814 if (likely(PyLong_Check(x))) {
3815 if (is_unsigned) {
3816 #if CYTHON_USE_PYLONG_INTERNALS
3817 const digit* digits = ((PyLongObject*)x)->ob_digit;
3818 switch (Py_SIZE(x)) {
3819 case 0: return (int) 0;
3820 case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
3821 case 2:
3822 if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
3823 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
3824 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3825 } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
3826 return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
3827 }
3828 }
3829 break;
3830 case 3:
3831 if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
3832 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
3833 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3834 } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
3835 return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
3836 }
3837 }
3838 break;
3839 case 4:
3840 if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
3841 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
3842 __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])))
3843 } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
3844 return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
3845 }
3846 }
3847 break;
3848 }
3849 #endif
3850 #if CYTHON_COMPILING_IN_CPYTHON
3851 if (unlikely(Py_SIZE(x) < 0)) {
3852 goto raise_neg_overflow;
3853 }
3854 #else
3855 {
3856 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
3857 if (unlikely(result < 0))
3858 return (int) -1;
3859 if (unlikely(result == 1))
3860 goto raise_neg_overflow;
3861 }
3862 #endif
3863 if (sizeof(int) <= sizeof(unsigned long)) {
3864 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
3865 #ifdef HAVE_LONG_LONG
3866 } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
3867 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
3868 #endif
3869 }
3870 } else {
3871 #if CYTHON_USE_PYLONG_INTERNALS
3872 const digit* digits = ((PyLongObject*)x)->ob_digit;
3873 switch (Py_SIZE(x)) {
3874 case 0: return (int) 0;
3875 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
3876 case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
3877 case -2:
3878 if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
3879 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
3880 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3881 } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
3882 return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
3883 }
3884 }
3885 break;
3886 case 2:
3887 if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
3888 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
3889 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3890 } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
3891 return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
3892 }
3893 }
3894 break;
3895 case -3:
3896 if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
3897 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
3898 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3899 } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
3900 return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
3901 }
3902 }
3903 break;
3904 case 3:
3905 if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
3906 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
3907 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3908 } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
3909 return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
3910 }
3911 }
3912 break;
3913 case -4:
3914 if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
3915 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
3916 __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])))
3917 } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
3918 return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
3919 }
3920 }
3921 break;
3922 case 4:
3923 if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
3924 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
3925 __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])))
3926 } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
3927 return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
3928 }
3929 }
3930 break;
3931 }
3932 #endif
3933 if (sizeof(int) <= sizeof(long)) {
3934 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
3935 #ifdef HAVE_LONG_LONG
3936 } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
3937 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
3938 #endif
3939 }
3940 }
3941 {
3942 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
3943 PyErr_SetString(PyExc_RuntimeError,
3944 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
3945 #else
3946 int val;
3947 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
3948 #if PY_MAJOR_VERSION < 3
3949 if (likely(v) && !PyLong_Check(v)) {
3950 PyObject *tmp = v;
3951 v = PyNumber_Long(tmp);
3952 Py_DECREF(tmp);
3953 }
3954 #endif
3955 if (likely(v)) {
3956 int one = 1; int is_little = (int)*(unsigned char *)&one;
3957 unsigned char *bytes = (unsigned char *)&val;
3958 int ret = _PyLong_AsByteArray((PyLongObject *)v,
3959 bytes, sizeof(val),
3960 is_little, !is_unsigned);
3961 Py_DECREF(v);
3962 if (likely(!ret))
3963 return val;
3964 }
3965 #endif
3966 return (int) -1;
3967 }
3968 } else {
3969 int val;
3970 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
3971 if (!tmp) return (int) -1;
3972 val = __Pyx_PyInt_As_int(tmp);
3973 Py_DECREF(tmp);
3974 return val;
3975 }
3976 raise_overflow:
3977 PyErr_SetString(PyExc_OverflowError,
3978 "value too large to convert to int");
3979 return (int) -1;
3980 raise_neg_overflow:
3981 PyErr_SetString(PyExc_OverflowError,
3982 "can't convert negative value to int");
3983 return (int) -1;
3984 }
3985
3986 /* FastTypeChecks */
3987 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_InBases(PyTypeObject * a,PyTypeObject * b)3988 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
3989 while (a) {
3990 a = a->tp_base;
3991 if (a == b)
3992 return 1;
3993 }
3994 return b == &PyBaseObject_Type;
3995 }
__Pyx_IsSubtype(PyTypeObject * a,PyTypeObject * b)3996 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
3997 PyObject *mro;
3998 if (a == b) return 1;
3999 mro = a->tp_mro;
4000 if (likely(mro)) {
4001 Py_ssize_t i, n;
4002 n = PyTuple_GET_SIZE(mro);
4003 for (i = 0; i < n; i++) {
4004 if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
4005 return 1;
4006 }
4007 return 0;
4008 }
4009 return __Pyx_InBases(a, b);
4010 }
4011 #if PY_MAJOR_VERSION == 2
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)4012 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
4013 PyObject *exception, *value, *tb;
4014 int res;
4015 __Pyx_PyThreadState_declare
4016 __Pyx_PyThreadState_assign
4017 __Pyx_ErrFetch(&exception, &value, &tb);
4018 res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
4019 if (unlikely(res == -1)) {
4020 PyErr_WriteUnraisable(err);
4021 res = 0;
4022 }
4023 if (!res) {
4024 res = PyObject_IsSubclass(err, exc_type2);
4025 if (unlikely(res == -1)) {
4026 PyErr_WriteUnraisable(err);
4027 res = 0;
4028 }
4029 }
4030 __Pyx_ErrRestore(exception, value, tb);
4031 return res;
4032 }
4033 #else
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)4034 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
4035 int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
4036 if (!res) {
4037 res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
4038 }
4039 return res;
4040 }
4041 #endif
__Pyx_PyErr_GivenExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)4042 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
4043 Py_ssize_t i, n;
4044 assert(PyExceptionClass_Check(exc_type));
4045 n = PyTuple_GET_SIZE(tuple);
4046 #if PY_MAJOR_VERSION >= 3
4047 for (i=0; i<n; i++) {
4048 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
4049 }
4050 #endif
4051 for (i=0; i<n; i++) {
4052 PyObject *t = PyTuple_GET_ITEM(tuple, i);
4053 #if PY_MAJOR_VERSION < 3
4054 if (likely(exc_type == t)) return 1;
4055 #endif
4056 if (likely(PyExceptionClass_Check(t))) {
4057 if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
4058 } else {
4059 }
4060 }
4061 return 0;
4062 }
__Pyx_PyErr_GivenExceptionMatches(PyObject * err,PyObject * exc_type)4063 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
4064 if (likely(err == exc_type)) return 1;
4065 if (likely(PyExceptionClass_Check(err))) {
4066 if (likely(PyExceptionClass_Check(exc_type))) {
4067 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
4068 } else if (likely(PyTuple_Check(exc_type))) {
4069 return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
4070 } else {
4071 }
4072 }
4073 return PyErr_GivenExceptionMatches(err, exc_type);
4074 }
__Pyx_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)4075 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
4076 assert(PyExceptionClass_Check(exc_type1));
4077 assert(PyExceptionClass_Check(exc_type2));
4078 if (likely(err == exc_type1 || err == exc_type2)) return 1;
4079 if (likely(PyExceptionClass_Check(err))) {
4080 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
4081 }
4082 return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
4083 }
4084 #endif
4085
4086 /* CheckBinaryVersion */
__Pyx_check_binary_version(void)4087 static int __Pyx_check_binary_version(void) {
4088 char ctversion[4], rtversion[4];
4089 PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
4090 PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
4091 if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
4092 char message[200];
4093 PyOS_snprintf(message, sizeof(message),
4094 "compiletime version %s of module '%.100s' "
4095 "does not match runtime version %s",
4096 ctversion, __Pyx_MODULE_NAME, rtversion);
4097 return PyErr_WarnEx(NULL, message, 1);
4098 }
4099 return 0;
4100 }
4101
4102 /* InitStrings */
__Pyx_InitStrings(__Pyx_StringTabEntry * t)4103 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
4104 while (t->p) {
4105 #if PY_MAJOR_VERSION < 3
4106 if (t->is_unicode) {
4107 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
4108 } else if (t->intern) {
4109 *t->p = PyString_InternFromString(t->s);
4110 } else {
4111 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
4112 }
4113 #else
4114 if (t->is_unicode | t->is_str) {
4115 if (t->intern) {
4116 *t->p = PyUnicode_InternFromString(t->s);
4117 } else if (t->encoding) {
4118 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
4119 } else {
4120 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
4121 }
4122 } else {
4123 *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
4124 }
4125 #endif
4126 if (!*t->p)
4127 return -1;
4128 if (PyObject_Hash(*t->p) == -1)
4129 return -1;
4130 ++t;
4131 }
4132 return 0;
4133 }
4134
__Pyx_PyUnicode_FromString(const char * c_str)4135 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
4136 return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
4137 }
__Pyx_PyObject_AsString(PyObject * o)4138 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
4139 Py_ssize_t ignore;
4140 return __Pyx_PyObject_AsStringAndSize(o, &ignore);
4141 }
4142 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
4143 #if !CYTHON_PEP393_ENABLED
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)4144 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
4145 char* defenc_c;
4146 PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
4147 if (!defenc) return NULL;
4148 defenc_c = PyBytes_AS_STRING(defenc);
4149 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
4150 {
4151 char* end = defenc_c + PyBytes_GET_SIZE(defenc);
4152 char* c;
4153 for (c = defenc_c; c < end; c++) {
4154 if ((unsigned char) (*c) >= 128) {
4155 PyUnicode_AsASCIIString(o);
4156 return NULL;
4157 }
4158 }
4159 }
4160 #endif
4161 *length = PyBytes_GET_SIZE(defenc);
4162 return defenc_c;
4163 }
4164 #else
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)4165 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
4166 if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
4167 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
4168 if (likely(PyUnicode_IS_ASCII(o))) {
4169 *length = PyUnicode_GET_LENGTH(o);
4170 return PyUnicode_AsUTF8(o);
4171 } else {
4172 PyUnicode_AsASCIIString(o);
4173 return NULL;
4174 }
4175 #else
4176 return PyUnicode_AsUTF8AndSize(o, length);
4177 #endif
4178 }
4179 #endif
4180 #endif
__Pyx_PyObject_AsStringAndSize(PyObject * o,Py_ssize_t * length)4181 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
4182 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
4183 if (
4184 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
4185 __Pyx_sys_getdefaultencoding_not_ascii &&
4186 #endif
4187 PyUnicode_Check(o)) {
4188 return __Pyx_PyUnicode_AsStringAndSize(o, length);
4189 } else
4190 #endif
4191 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
4192 if (PyByteArray_Check(o)) {
4193 *length = PyByteArray_GET_SIZE(o);
4194 return PyByteArray_AS_STRING(o);
4195 } else
4196 #endif
4197 {
4198 char* result;
4199 int r = PyBytes_AsStringAndSize(o, &result, length);
4200 if (unlikely(r < 0)) {
4201 return NULL;
4202 } else {
4203 return result;
4204 }
4205 }
4206 }
__Pyx_PyObject_IsTrue(PyObject * x)4207 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
4208 int is_true = x == Py_True;
4209 if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
4210 else return PyObject_IsTrue(x);
4211 }
__Pyx_PyObject_IsTrueAndDecref(PyObject * x)4212 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
4213 int retval;
4214 if (unlikely(!x)) return -1;
4215 retval = __Pyx_PyObject_IsTrue(x);
4216 Py_DECREF(x);
4217 return retval;
4218 }
__Pyx_PyNumber_IntOrLongWrongResultType(PyObject * result,const char * type_name)4219 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
4220 #if PY_MAJOR_VERSION >= 3
4221 if (PyLong_Check(result)) {
4222 if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
4223 "__int__ returned non-int (type %.200s). "
4224 "The ability to return an instance of a strict subclass of int "
4225 "is deprecated, and may be removed in a future version of Python.",
4226 Py_TYPE(result)->tp_name)) {
4227 Py_DECREF(result);
4228 return NULL;
4229 }
4230 return result;
4231 }
4232 #endif
4233 PyErr_Format(PyExc_TypeError,
4234 "__%.4s__ returned non-%.4s (type %.200s)",
4235 type_name, type_name, Py_TYPE(result)->tp_name);
4236 Py_DECREF(result);
4237 return NULL;
4238 }
__Pyx_PyNumber_IntOrLong(PyObject * x)4239 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
4240 #if CYTHON_USE_TYPE_SLOTS
4241 PyNumberMethods *m;
4242 #endif
4243 const char *name = NULL;
4244 PyObject *res = NULL;
4245 #if PY_MAJOR_VERSION < 3
4246 if (likely(PyInt_Check(x) || PyLong_Check(x)))
4247 #else
4248 if (likely(PyLong_Check(x)))
4249 #endif
4250 return __Pyx_NewRef(x);
4251 #if CYTHON_USE_TYPE_SLOTS
4252 m = Py_TYPE(x)->tp_as_number;
4253 #if PY_MAJOR_VERSION < 3
4254 if (m && m->nb_int) {
4255 name = "int";
4256 res = m->nb_int(x);
4257 }
4258 else if (m && m->nb_long) {
4259 name = "long";
4260 res = m->nb_long(x);
4261 }
4262 #else
4263 if (likely(m && m->nb_int)) {
4264 name = "int";
4265 res = m->nb_int(x);
4266 }
4267 #endif
4268 #else
4269 if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
4270 res = PyNumber_Int(x);
4271 }
4272 #endif
4273 if (likely(res)) {
4274 #if PY_MAJOR_VERSION < 3
4275 if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
4276 #else
4277 if (unlikely(!PyLong_CheckExact(res))) {
4278 #endif
4279 return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
4280 }
4281 }
4282 else if (!PyErr_Occurred()) {
4283 PyErr_SetString(PyExc_TypeError,
4284 "an integer is required");
4285 }
4286 return res;
4287 }
4288 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
4289 Py_ssize_t ival;
4290 PyObject *x;
4291 #if PY_MAJOR_VERSION < 3
4292 if (likely(PyInt_CheckExact(b))) {
4293 if (sizeof(Py_ssize_t) >= sizeof(long))
4294 return PyInt_AS_LONG(b);
4295 else
4296 return PyInt_AsSsize_t(b);
4297 }
4298 #endif
4299 if (likely(PyLong_CheckExact(b))) {
4300 #if CYTHON_USE_PYLONG_INTERNALS
4301 const digit* digits = ((PyLongObject*)b)->ob_digit;
4302 const Py_ssize_t size = Py_SIZE(b);
4303 if (likely(__Pyx_sst_abs(size) <= 1)) {
4304 ival = likely(size) ? digits[0] : 0;
4305 if (size == -1) ival = -ival;
4306 return ival;
4307 } else {
4308 switch (size) {
4309 case 2:
4310 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
4311 return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
4312 }
4313 break;
4314 case -2:
4315 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
4316 return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
4317 }
4318 break;
4319 case 3:
4320 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
4321 return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
4322 }
4323 break;
4324 case -3:
4325 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
4326 return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
4327 }
4328 break;
4329 case 4:
4330 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
4331 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]));
4332 }
4333 break;
4334 case -4:
4335 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
4336 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]));
4337 }
4338 break;
4339 }
4340 }
4341 #endif
4342 return PyLong_AsSsize_t(b);
4343 }
4344 x = PyNumber_Index(b);
4345 if (!x) return -1;
4346 ival = PyInt_AsSsize_t(x);
4347 Py_DECREF(x);
4348 return ival;
4349 }
4350 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
4351 return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
4352 }
4353 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
4354 return PyInt_FromSize_t(ival);
4355 }
4356
4357
4358 #endif /* Py_PYTHON_H */
4359
4360
4361 static struct _inittab pygame_sdl2_error_inittab[] = {
4362 #if PY_MAJOR_VERSION < 3
4363 { "pygame_sdl2.error", initpygame_sdl2_error },
4364 #else
4365 { "pygame_sdl2.error", PyInit_pygame_sdl2_error },
4366 #endif
4367 { NULL, NULL },
4368 };
4369
4370 static void pygame_sdl2_error_constructor(void) __attribute__((constructor));
4371
4372 static void pygame_sdl2_error_constructor(void) {
4373 PyImport_ExtendInittab(pygame_sdl2_error_inittab);
4374 }
4375