1 /* Generated by Cython 0.29.21 */
2 
3 /* BEGIN: Cython Metadata
4 {
5     "distutils": {
6         "depends": [],
7         "name": "pygame.pypm",
8         "sources": [
9             "src_c\\cython\\pygame\\pypm.pyx"
10         ]
11     },
12     "module_name": "pygame.pypm"
13 }
14 END: Cython Metadata */
15 
16 #define PY_SSIZE_T_CLEAN
17 #include "Python.h"
18 #ifndef Py_PYTHON_H
19     #error Python headers needed to compile C extensions, please install development version of Python.
20 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
21     #error Cython requires Python 2.6+ or Python 3.3+.
22 #else
23 #define CYTHON_ABI "0_29_21"
24 #define CYTHON_HEX_VERSION 0x001D15F0
25 #define CYTHON_FUTURE_DIVISION 0
26 #include <stddef.h>
27 #ifndef offsetof
28   #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
29 #endif
30 #if !defined(WIN32) && !defined(MS_WINDOWS)
31   #ifndef __stdcall
32     #define __stdcall
33   #endif
34   #ifndef __cdecl
35     #define __cdecl
36   #endif
37   #ifndef __fastcall
38     #define __fastcall
39   #endif
40 #endif
41 #ifndef DL_IMPORT
42   #define DL_IMPORT(t) t
43 #endif
44 #ifndef DL_EXPORT
45   #define DL_EXPORT(t) t
46 #endif
47 #define __PYX_COMMA ,
48 #ifndef HAVE_LONG_LONG
49   #if PY_VERSION_HEX >= 0x02070000
50     #define HAVE_LONG_LONG
51   #endif
52 #endif
53 #ifndef PY_LONG_LONG
54   #define PY_LONG_LONG LONG_LONG
55 #endif
56 #ifndef Py_HUGE_VAL
57   #define Py_HUGE_VAL HUGE_VAL
58 #endif
59 #ifdef PYPY_VERSION
60   #define CYTHON_COMPILING_IN_PYPY 1
61   #define CYTHON_COMPILING_IN_PYSTON 0
62   #define CYTHON_COMPILING_IN_CPYTHON 0
63   #undef CYTHON_USE_TYPE_SLOTS
64   #define CYTHON_USE_TYPE_SLOTS 0
65   #undef CYTHON_USE_PYTYPE_LOOKUP
66   #define CYTHON_USE_PYTYPE_LOOKUP 0
67   #if PY_VERSION_HEX < 0x03050000
68     #undef CYTHON_USE_ASYNC_SLOTS
69     #define CYTHON_USE_ASYNC_SLOTS 0
70   #elif !defined(CYTHON_USE_ASYNC_SLOTS)
71     #define CYTHON_USE_ASYNC_SLOTS 1
72   #endif
73   #undef CYTHON_USE_PYLIST_INTERNALS
74   #define CYTHON_USE_PYLIST_INTERNALS 0
75   #undef CYTHON_USE_UNICODE_INTERNALS
76   #define CYTHON_USE_UNICODE_INTERNALS 0
77   #undef CYTHON_USE_UNICODE_WRITER
78   #define CYTHON_USE_UNICODE_WRITER 0
79   #undef CYTHON_USE_PYLONG_INTERNALS
80   #define CYTHON_USE_PYLONG_INTERNALS 0
81   #undef CYTHON_AVOID_BORROWED_REFS
82   #define CYTHON_AVOID_BORROWED_REFS 1
83   #undef CYTHON_ASSUME_SAFE_MACROS
84   #define CYTHON_ASSUME_SAFE_MACROS 0
85   #undef CYTHON_UNPACK_METHODS
86   #define CYTHON_UNPACK_METHODS 0
87   #undef CYTHON_FAST_THREAD_STATE
88   #define CYTHON_FAST_THREAD_STATE 0
89   #undef CYTHON_FAST_PYCALL
90   #define CYTHON_FAST_PYCALL 0
91   #undef CYTHON_PEP489_MULTI_PHASE_INIT
92   #define CYTHON_PEP489_MULTI_PHASE_INIT 0
93   #undef CYTHON_USE_TP_FINALIZE
94   #define CYTHON_USE_TP_FINALIZE 0
95   #undef CYTHON_USE_DICT_VERSIONS
96   #define CYTHON_USE_DICT_VERSIONS 0
97   #undef CYTHON_USE_EXC_INFO_STACK
98   #define CYTHON_USE_EXC_INFO_STACK 0
99 #elif defined(PYSTON_VERSION)
100   #define CYTHON_COMPILING_IN_PYPY 0
101   #define CYTHON_COMPILING_IN_PYSTON 1
102   #define CYTHON_COMPILING_IN_CPYTHON 0
103   #ifndef CYTHON_USE_TYPE_SLOTS
104     #define CYTHON_USE_TYPE_SLOTS 1
105   #endif
106   #undef CYTHON_USE_PYTYPE_LOOKUP
107   #define CYTHON_USE_PYTYPE_LOOKUP 0
108   #undef CYTHON_USE_ASYNC_SLOTS
109   #define CYTHON_USE_ASYNC_SLOTS 0
110   #undef CYTHON_USE_PYLIST_INTERNALS
111   #define CYTHON_USE_PYLIST_INTERNALS 0
112   #ifndef CYTHON_USE_UNICODE_INTERNALS
113     #define CYTHON_USE_UNICODE_INTERNALS 1
114   #endif
115   #undef CYTHON_USE_UNICODE_WRITER
116   #define CYTHON_USE_UNICODE_WRITER 0
117   #undef CYTHON_USE_PYLONG_INTERNALS
118   #define CYTHON_USE_PYLONG_INTERNALS 0
119   #ifndef CYTHON_AVOID_BORROWED_REFS
120     #define CYTHON_AVOID_BORROWED_REFS 0
121   #endif
122   #ifndef CYTHON_ASSUME_SAFE_MACROS
123     #define CYTHON_ASSUME_SAFE_MACROS 1
124   #endif
125   #ifndef CYTHON_UNPACK_METHODS
126     #define CYTHON_UNPACK_METHODS 1
127   #endif
128   #undef CYTHON_FAST_THREAD_STATE
129   #define CYTHON_FAST_THREAD_STATE 0
130   #undef CYTHON_FAST_PYCALL
131   #define CYTHON_FAST_PYCALL 0
132   #undef CYTHON_PEP489_MULTI_PHASE_INIT
133   #define CYTHON_PEP489_MULTI_PHASE_INIT 0
134   #undef CYTHON_USE_TP_FINALIZE
135   #define CYTHON_USE_TP_FINALIZE 0
136   #undef CYTHON_USE_DICT_VERSIONS
137   #define CYTHON_USE_DICT_VERSIONS 0
138   #undef CYTHON_USE_EXC_INFO_STACK
139   #define CYTHON_USE_EXC_INFO_STACK 0
140 #else
141   #define CYTHON_COMPILING_IN_PYPY 0
142   #define CYTHON_COMPILING_IN_PYSTON 0
143   #define CYTHON_COMPILING_IN_CPYTHON 1
144   #ifndef CYTHON_USE_TYPE_SLOTS
145     #define CYTHON_USE_TYPE_SLOTS 1
146   #endif
147   #if PY_VERSION_HEX < 0x02070000
148     #undef CYTHON_USE_PYTYPE_LOOKUP
149     #define CYTHON_USE_PYTYPE_LOOKUP 0
150   #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
151     #define CYTHON_USE_PYTYPE_LOOKUP 1
152   #endif
153   #if PY_MAJOR_VERSION < 3
154     #undef CYTHON_USE_ASYNC_SLOTS
155     #define CYTHON_USE_ASYNC_SLOTS 0
156   #elif !defined(CYTHON_USE_ASYNC_SLOTS)
157     #define CYTHON_USE_ASYNC_SLOTS 1
158   #endif
159   #if PY_VERSION_HEX < 0x02070000
160     #undef CYTHON_USE_PYLONG_INTERNALS
161     #define CYTHON_USE_PYLONG_INTERNALS 0
162   #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
163     #define CYTHON_USE_PYLONG_INTERNALS 1
164   #endif
165   #ifndef CYTHON_USE_PYLIST_INTERNALS
166     #define CYTHON_USE_PYLIST_INTERNALS 1
167   #endif
168   #ifndef CYTHON_USE_UNICODE_INTERNALS
169     #define CYTHON_USE_UNICODE_INTERNALS 1
170   #endif
171   #if PY_VERSION_HEX < 0x030300F0
172     #undef CYTHON_USE_UNICODE_WRITER
173     #define CYTHON_USE_UNICODE_WRITER 0
174   #elif !defined(CYTHON_USE_UNICODE_WRITER)
175     #define CYTHON_USE_UNICODE_WRITER 1
176   #endif
177   #ifndef CYTHON_AVOID_BORROWED_REFS
178     #define CYTHON_AVOID_BORROWED_REFS 0
179   #endif
180   #ifndef CYTHON_ASSUME_SAFE_MACROS
181     #define CYTHON_ASSUME_SAFE_MACROS 1
182   #endif
183   #ifndef CYTHON_UNPACK_METHODS
184     #define CYTHON_UNPACK_METHODS 1
185   #endif
186   #ifndef CYTHON_FAST_THREAD_STATE
187     #define CYTHON_FAST_THREAD_STATE 1
188   #endif
189   #ifndef CYTHON_FAST_PYCALL
190     #define CYTHON_FAST_PYCALL 1
191   #endif
192   #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
193     #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
194   #endif
195   #ifndef CYTHON_USE_TP_FINALIZE
196     #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
197   #endif
198   #ifndef CYTHON_USE_DICT_VERSIONS
199     #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
200   #endif
201   #ifndef CYTHON_USE_EXC_INFO_STACK
202     #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
203   #endif
204 #endif
205 #if !defined(CYTHON_FAST_PYCCALL)
206 #define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
207 #endif
208 #if CYTHON_USE_PYLONG_INTERNALS
209   #include "longintrepr.h"
210   #undef SHIFT
211   #undef BASE
212   #undef MASK
213   #ifdef SIZEOF_VOID_P
214     enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
215   #endif
216 #endif
217 #ifndef __has_attribute
218   #define __has_attribute(x) 0
219 #endif
220 #ifndef __has_cpp_attribute
221   #define __has_cpp_attribute(x) 0
222 #endif
223 #ifndef CYTHON_RESTRICT
224   #if defined(__GNUC__)
225     #define CYTHON_RESTRICT __restrict__
226   #elif defined(_MSC_VER) && _MSC_VER >= 1400
227     #define CYTHON_RESTRICT __restrict
228   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
229     #define CYTHON_RESTRICT restrict
230   #else
231     #define CYTHON_RESTRICT
232   #endif
233 #endif
234 #ifndef CYTHON_UNUSED
235 # if defined(__GNUC__)
236 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
237 #     define CYTHON_UNUSED __attribute__ ((__unused__))
238 #   else
239 #     define CYTHON_UNUSED
240 #   endif
241 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
242 #   define CYTHON_UNUSED __attribute__ ((__unused__))
243 # else
244 #   define CYTHON_UNUSED
245 # endif
246 #endif
247 #ifndef CYTHON_MAYBE_UNUSED_VAR
248 #  if defined(__cplusplus)
CYTHON_MAYBE_UNUSED_VAR(const T &)249      template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
250 #  else
251 #    define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
252 #  endif
253 #endif
254 #ifndef CYTHON_NCP_UNUSED
255 # if CYTHON_COMPILING_IN_CPYTHON
256 #  define CYTHON_NCP_UNUSED
257 # else
258 #  define CYTHON_NCP_UNUSED CYTHON_UNUSED
259 # endif
260 #endif
261 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
262 #ifdef _MSC_VER
263     #ifndef _MSC_STDINT_H_
264         #if _MSC_VER < 1300
265            typedef unsigned char     uint8_t;
266            typedef unsigned int      uint32_t;
267         #else
268            typedef unsigned __int8   uint8_t;
269            typedef unsigned __int32  uint32_t;
270         #endif
271     #endif
272 #else
273    #include <stdint.h>
274 #endif
275 #ifndef CYTHON_FALLTHROUGH
276   #if defined(__cplusplus) && __cplusplus >= 201103L
277     #if __has_cpp_attribute(fallthrough)
278       #define CYTHON_FALLTHROUGH [[fallthrough]]
279     #elif __has_cpp_attribute(clang::fallthrough)
280       #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
281     #elif __has_cpp_attribute(gnu::fallthrough)
282       #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
283     #endif
284   #endif
285   #ifndef CYTHON_FALLTHROUGH
286     #if __has_attribute(fallthrough)
287       #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
288     #else
289       #define CYTHON_FALLTHROUGH
290     #endif
291   #endif
292   #if defined(__clang__ ) && defined(__apple_build_version__)
293     #if __apple_build_version__ < 7000000
294       #undef  CYTHON_FALLTHROUGH
295       #define CYTHON_FALLTHROUGH
296     #endif
297   #endif
298 #endif
299 
300 #ifndef CYTHON_INLINE
301   #if defined(__clang__)
302     #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
303   #elif defined(__GNUC__)
304     #define CYTHON_INLINE __inline__
305   #elif defined(_MSC_VER)
306     #define CYTHON_INLINE __inline
307   #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
308     #define CYTHON_INLINE inline
309   #else
310     #define CYTHON_INLINE
311   #endif
312 #endif
313 
314 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
315   #define Py_OptimizeFlag 0
316 #endif
317 #define __PYX_BUILD_PY_SSIZE_T "n"
318 #define CYTHON_FORMAT_SSIZE_T "z"
319 #if PY_MAJOR_VERSION < 3
320   #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
321   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
322           PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
323   #define __Pyx_DefaultClassType PyClass_Type
324 #else
325   #define __Pyx_BUILTIN_MODULE_NAME "builtins"
326 #if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
327   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
328           PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
329 #else
330   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
331           PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
332 #endif
333   #define __Pyx_DefaultClassType PyType_Type
334 #endif
335 #ifndef Py_TPFLAGS_CHECKTYPES
336   #define Py_TPFLAGS_CHECKTYPES 0
337 #endif
338 #ifndef Py_TPFLAGS_HAVE_INDEX
339   #define Py_TPFLAGS_HAVE_INDEX 0
340 #endif
341 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
342   #define Py_TPFLAGS_HAVE_NEWBUFFER 0
343 #endif
344 #ifndef Py_TPFLAGS_HAVE_FINALIZE
345   #define Py_TPFLAGS_HAVE_FINALIZE 0
346 #endif
347 #ifndef METH_STACKLESS
348   #define METH_STACKLESS 0
349 #endif
350 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
351   #ifndef METH_FASTCALL
352      #define METH_FASTCALL 0x80
353   #endif
354   typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
355   typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
356                                                           Py_ssize_t nargs, PyObject *kwnames);
357 #else
358   #define __Pyx_PyCFunctionFast _PyCFunctionFast
359   #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
360 #endif
361 #if CYTHON_FAST_PYCCALL
362 #define __Pyx_PyFastCFunction_Check(func)\
363     ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
364 #else
365 #define __Pyx_PyFastCFunction_Check(func) 0
366 #endif
367 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
368   #define PyObject_Malloc(s)   PyMem_Malloc(s)
369   #define PyObject_Free(p)     PyMem_Free(p)
370   #define PyObject_Realloc(p)  PyMem_Realloc(p)
371 #endif
372 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
373   #define PyMem_RawMalloc(n)           PyMem_Malloc(n)
374   #define PyMem_RawRealloc(p, n)       PyMem_Realloc(p, n)
375   #define PyMem_RawFree(p)             PyMem_Free(p)
376 #endif
377 #if CYTHON_COMPILING_IN_PYSTON
378   #define __Pyx_PyCode_HasFreeVars(co)  PyCode_HasFreeVars(co)
379   #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
380 #else
381   #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
382   #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
383 #endif
384 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
385   #define __Pyx_PyThreadState_Current PyThreadState_GET()
386 #elif PY_VERSION_HEX >= 0x03060000
387   #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
388 #elif PY_VERSION_HEX >= 0x03000000
389   #define __Pyx_PyThreadState_Current PyThreadState_GET()
390 #else
391   #define __Pyx_PyThreadState_Current _PyThreadState_Current
392 #endif
393 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
394 #include "pythread.h"
395 #define Py_tss_NEEDS_INIT 0
396 typedef int Py_tss_t;
PyThread_tss_create(Py_tss_t * key)397 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
398   *key = PyThread_create_key();
399   return 0;
400 }
PyThread_tss_alloc(void)401 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
402   Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
403   *key = Py_tss_NEEDS_INIT;
404   return key;
405 }
PyThread_tss_free(Py_tss_t * key)406 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
407   PyObject_Free(key);
408 }
PyThread_tss_is_created(Py_tss_t * key)409 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
410   return *key != Py_tss_NEEDS_INIT;
411 }
PyThread_tss_delete(Py_tss_t * key)412 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
413   PyThread_delete_key(*key);
414   *key = Py_tss_NEEDS_INIT;
415 }
PyThread_tss_set(Py_tss_t * key,void * value)416 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
417   return PyThread_set_key_value(*key, value);
418 }
PyThread_tss_get(Py_tss_t * key)419 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
420   return PyThread_get_key_value(*key);
421 }
422 #endif
423 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
424 #define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
425 #else
426 #define __Pyx_PyDict_NewPresized(n)  PyDict_New()
427 #endif
428 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
429   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
430   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
431 #else
432   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
433   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
434 #endif
435 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
436 #define __Pyx_PyDict_GetItemStr(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
437 #else
438 #define __Pyx_PyDict_GetItemStr(dict, name)  PyDict_GetItem(dict, name)
439 #endif
440 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
441   #define CYTHON_PEP393_ENABLED 1
442   #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
443                                               0 : _PyUnicode_Ready((PyObject *)(op)))
444   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
445   #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
446   #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
447   #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
448   #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
449   #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
450   #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, ch)
451   #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE)
452   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
453   #else
454   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_LENGTH(u))
455   #endif
456 #else
457   #define CYTHON_PEP393_ENABLED 0
458   #define PyUnicode_1BYTE_KIND  1
459   #define PyUnicode_2BYTE_KIND  2
460   #define PyUnicode_4BYTE_KIND  4
461   #define __Pyx_PyUnicode_READY(op)       (0)
462   #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
463   #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
464   #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
465   #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
466   #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
467   #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
468   #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
469   #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_SIZE(u))
470 #endif
471 #if CYTHON_COMPILING_IN_PYPY
472   #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
473   #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
474 #else
475   #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
476   #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
477       PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
478 #endif
479 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
480   #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
481 #endif
482 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
483   #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
484 #endif
485 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
486   #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
487 #endif
488 #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))
489 #define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
490 #if PY_MAJOR_VERSION >= 3
491   #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
492 #else
493   #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
494 #endif
495 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
496   #define PyObject_ASCII(o)            PyObject_Repr(o)
497 #endif
498 #if PY_MAJOR_VERSION >= 3
499   #define PyBaseString_Type            PyUnicode_Type
500   #define PyStringObject               PyUnicodeObject
501   #define PyString_Type                PyUnicode_Type
502   #define PyString_Check               PyUnicode_Check
503   #define PyString_CheckExact          PyUnicode_CheckExact
504 #ifndef PyObject_Unicode
505   #define PyObject_Unicode             PyObject_Str
506 #endif
507 #endif
508 #if PY_MAJOR_VERSION >= 3
509   #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
510   #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
511 #else
512   #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
513   #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
514 #endif
515 #ifndef PySet_CheckExact
516   #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
517 #endif
518 #if PY_VERSION_HEX >= 0x030900A4
519   #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
520   #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
521 #else
522   #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
523   #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
524 #endif
525 #if CYTHON_ASSUME_SAFE_MACROS
526   #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
527 #else
528   #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
529 #endif
530 #if PY_MAJOR_VERSION >= 3
531   #define PyIntObject                  PyLongObject
532   #define PyInt_Type                   PyLong_Type
533   #define PyInt_Check(op)              PyLong_Check(op)
534   #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
535   #define PyInt_FromString             PyLong_FromString
536   #define PyInt_FromUnicode            PyLong_FromUnicode
537   #define PyInt_FromLong               PyLong_FromLong
538   #define PyInt_FromSize_t             PyLong_FromSize_t
539   #define PyInt_FromSsize_t            PyLong_FromSsize_t
540   #define PyInt_AsLong                 PyLong_AsLong
541   #define PyInt_AS_LONG                PyLong_AS_LONG
542   #define PyInt_AsSsize_t              PyLong_AsSsize_t
543   #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
544   #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
545   #define PyNumber_Int                 PyNumber_Long
546 #endif
547 #if PY_MAJOR_VERSION >= 3
548   #define PyBoolObject                 PyLongObject
549 #endif
550 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
551   #ifndef PyUnicode_InternFromString
552     #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
553   #endif
554 #endif
555 #if PY_VERSION_HEX < 0x030200A4
556   typedef long Py_hash_t;
557   #define __Pyx_PyInt_FromHash_t PyInt_FromLong
558   #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
559 #else
560   #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
561   #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
562 #endif
563 #if PY_MAJOR_VERSION >= 3
564   #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
565 #else
566   #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
567 #endif
568 #if CYTHON_USE_ASYNC_SLOTS
569   #if PY_VERSION_HEX >= 0x030500B1
570     #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
571     #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
572   #else
573     #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
574   #endif
575 #else
576   #define __Pyx_PyType_AsAsync(obj) NULL
577 #endif
578 #ifndef __Pyx_PyAsyncMethodsStruct
579     typedef struct {
580         unaryfunc am_await;
581         unaryfunc am_aiter;
582         unaryfunc am_anext;
583     } __Pyx_PyAsyncMethodsStruct;
584 #endif
585 
586 #if defined(WIN32) || defined(MS_WINDOWS)
587   #define _USE_MATH_DEFINES
588 #endif
589 #include <math.h>
590 #ifdef NAN
591 #define __PYX_NAN() ((float) NAN)
592 #else
__PYX_NAN()593 static CYTHON_INLINE float __PYX_NAN() {
594   float value;
595   memset(&value, 0xFF, sizeof(value));
596   return value;
597 }
598 #endif
599 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
600 #define __Pyx_truncl trunc
601 #else
602 #define __Pyx_truncl truncl
603 #endif
604 
605 #define __PYX_MARK_ERR_POS(f_index, lineno) \
606     { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
607 #define __PYX_ERR(f_index, lineno, Ln_error) \
608     { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
609 
610 #ifndef __PYX_EXTERN_C
611   #ifdef __cplusplus
612     #define __PYX_EXTERN_C extern "C"
613   #else
614     #define __PYX_EXTERN_C extern
615   #endif
616 #endif
617 
618 #define __PYX_HAVE__pygame__pypm
619 #define __PYX_HAVE_API__pygame__pypm
620 /* Early includes */
621 #include "portmidi.h"
622 #include "porttime.h"
623 #ifdef _OPENMP
624 #include <omp.h>
625 #endif /* _OPENMP */
626 
627 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
628 #define CYTHON_WITHOUT_ASSERTIONS
629 #endif
630 
631 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
632                 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
633 
634 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
635 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
636 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
637 #define __PYX_DEFAULT_STRING_ENCODING ""
638 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
639 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
640 #define __Pyx_uchar_cast(c) ((unsigned char)c)
641 #define __Pyx_long_cast(x) ((long)x)
642 #define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
643     (sizeof(type) < sizeof(Py_ssize_t))  ||\
644     (sizeof(type) > sizeof(Py_ssize_t) &&\
645           likely(v < (type)PY_SSIZE_T_MAX ||\
646                  v == (type)PY_SSIZE_T_MAX)  &&\
647           (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
648                                 v == (type)PY_SSIZE_T_MIN)))  ||\
649     (sizeof(type) == sizeof(Py_ssize_t) &&\
650           (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
651                                v == (type)PY_SSIZE_T_MAX)))  )
__Pyx_is_valid_index(Py_ssize_t i,Py_ssize_t limit)652 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
653     return (size_t) i < (size_t) limit;
654 }
655 #if defined (__cplusplus) && __cplusplus >= 201103L
656     #include <cstdlib>
657     #define __Pyx_sst_abs(value) std::abs(value)
658 #elif SIZEOF_INT >= SIZEOF_SIZE_T
659     #define __Pyx_sst_abs(value) abs(value)
660 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
661     #define __Pyx_sst_abs(value) labs(value)
662 #elif defined (_MSC_VER)
663     #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
664 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
665     #define __Pyx_sst_abs(value) llabs(value)
666 #elif defined (__GNUC__)
667     #define __Pyx_sst_abs(value) __builtin_llabs(value)
668 #else
669     #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
670 #endif
671 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
672 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
673 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
674 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
675 #define __Pyx_PyBytes_FromString        PyBytes_FromString
676 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
677 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
678 #if PY_MAJOR_VERSION < 3
679     #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
680     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
681 #else
682     #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
683     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
684 #endif
685 #define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
686 #define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
687 #define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
688 #define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
689 #define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
690 #define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
691 #define __Pyx_PyObject_AsWritableString(s)    ((char*) __Pyx_PyObject_AsString(s))
692 #define __Pyx_PyObject_AsWritableSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
693 #define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
694 #define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
695 #define __Pyx_PyObject_AsUString(s)    ((const unsigned char*) __Pyx_PyObject_AsString(s))
696 #define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
697 #define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
698 #define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
699 #define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
700 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
__Pyx_Py_UNICODE_strlen(const Py_UNICODE * u)701 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
702     const Py_UNICODE *u_end = u;
703     while (*u_end++) ;
704     return (size_t)(u_end - u - 1);
705 }
706 #define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
707 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
708 #define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
709 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
710 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
711 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
712 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
713 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
714 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
715 #define __Pyx_PySequence_Tuple(obj)\
716     (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
717 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
718 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
719 #if CYTHON_ASSUME_SAFE_MACROS
720 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
721 #else
722 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
723 #endif
724 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
725 #if PY_MAJOR_VERSION >= 3
726 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
727 #else
728 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
729 #endif
730 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
731 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
732 static int __Pyx_sys_getdefaultencoding_not_ascii;
__Pyx_init_sys_getdefaultencoding_params(void)733 static int __Pyx_init_sys_getdefaultencoding_params(void) {
734     PyObject* sys;
735     PyObject* default_encoding = NULL;
736     PyObject* ascii_chars_u = NULL;
737     PyObject* ascii_chars_b = NULL;
738     const char* default_encoding_c;
739     sys = PyImport_ImportModule("sys");
740     if (!sys) goto bad;
741     default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
742     Py_DECREF(sys);
743     if (!default_encoding) goto bad;
744     default_encoding_c = PyBytes_AsString(default_encoding);
745     if (!default_encoding_c) goto bad;
746     if (strcmp(default_encoding_c, "ascii") == 0) {
747         __Pyx_sys_getdefaultencoding_not_ascii = 0;
748     } else {
749         char ascii_chars[128];
750         int c;
751         for (c = 0; c < 128; c++) {
752             ascii_chars[c] = c;
753         }
754         __Pyx_sys_getdefaultencoding_not_ascii = 1;
755         ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
756         if (!ascii_chars_u) goto bad;
757         ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
758         if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
759             PyErr_Format(
760                 PyExc_ValueError,
761                 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
762                 default_encoding_c);
763             goto bad;
764         }
765         Py_DECREF(ascii_chars_u);
766         Py_DECREF(ascii_chars_b);
767     }
768     Py_DECREF(default_encoding);
769     return 0;
770 bad:
771     Py_XDECREF(default_encoding);
772     Py_XDECREF(ascii_chars_u);
773     Py_XDECREF(ascii_chars_b);
774     return -1;
775 }
776 #endif
777 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
778 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
779 #else
780 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
781 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
782 static char* __PYX_DEFAULT_STRING_ENCODING;
__Pyx_init_sys_getdefaultencoding_params(void)783 static int __Pyx_init_sys_getdefaultencoding_params(void) {
784     PyObject* sys;
785     PyObject* default_encoding = NULL;
786     char* default_encoding_c;
787     sys = PyImport_ImportModule("sys");
788     if (!sys) goto bad;
789     default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
790     Py_DECREF(sys);
791     if (!default_encoding) goto bad;
792     default_encoding_c = PyBytes_AsString(default_encoding);
793     if (!default_encoding_c) goto bad;
794     __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
795     if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
796     strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
797     Py_DECREF(default_encoding);
798     return 0;
799 bad:
800     Py_XDECREF(default_encoding);
801     return -1;
802 }
803 #endif
804 #endif
805 
806 
807 /* Test for GCC > 2.95 */
808 #if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
809   #define likely(x)   __builtin_expect(!!(x), 1)
810   #define unlikely(x) __builtin_expect(!!(x), 0)
811 #else /* !__GNUC__ or GCC < 2.95 */
812   #define likely(x)   (x)
813   #define unlikely(x) (x)
814 #endif /* __GNUC__ */
__Pyx_pretend_to_initialize(void * ptr)815 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
816 
817 static PyObject *__pyx_m = NULL;
818 static PyObject *__pyx_d;
819 static PyObject *__pyx_b;
820 static PyObject *__pyx_cython_runtime = NULL;
821 static PyObject *__pyx_empty_tuple;
822 static PyObject *__pyx_empty_bytes;
823 static PyObject *__pyx_empty_unicode;
824 static int __pyx_lineno;
825 static int __pyx_clineno = 0;
826 static const char * __pyx_cfilenm= __FILE__;
827 static const char *__pyx_filename;
828 
829 
830 static const char *__pyx_f[] = {
831   "src_c\\cython\\pygame\\pypm.pyx",
832   "stringsource",
833 };
834 
835 /*--- Type declarations ---*/
836 struct __pyx_obj_6pygame_4pypm_Output;
837 struct __pyx_obj_6pygame_4pypm_Input;
838 
839 /* "pygame/pypm.pyx":256
840  *
841  *
842  * cdef class Output:             # <<<<<<<<<<<<<<
843  *     """Represents an output MIDI stream device.
844  *
845  */
846 struct __pyx_obj_6pygame_4pypm_Output {
847   PyObject_HEAD
848   int device;
849   PmStream *midi;
850   int debug;
851   int _aborted;
852 };
853 
854 
855 /* "pygame/pypm.pyx":525
856  *
857  *
858  * cdef class Input:             # <<<<<<<<<<<<<<
859  *     """Represents an input MIDI stream device.
860  *
861  */
862 struct __pyx_obj_6pygame_4pypm_Input {
863   PyObject_HEAD
864   int device;
865   PmStream *midi;
866   int debug;
867 };
868 
869 
870 /* --- Runtime support code (head) --- */
871 /* Refnanny.proto */
872 #ifndef CYTHON_REFNANNY
873   #define CYTHON_REFNANNY 0
874 #endif
875 #if CYTHON_REFNANNY
876   typedef struct {
877     void (*INCREF)(void*, PyObject*, int);
878     void (*DECREF)(void*, PyObject*, int);
879     void (*GOTREF)(void*, PyObject*, int);
880     void (*GIVEREF)(void*, PyObject*, int);
881     void* (*SetupContext)(const char*, int, const char*);
882     void (*FinishContext)(void**);
883   } __Pyx_RefNannyAPIStruct;
884   static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
885   static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
886   #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
887 #ifdef WITH_THREAD
888   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
889           if (acquire_gil) {\
890               PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
891               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
892               PyGILState_Release(__pyx_gilstate_save);\
893           } else {\
894               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
895           }
896 #else
897   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
898           __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
899 #endif
900   #define __Pyx_RefNannyFinishContext()\
901           __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
902   #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
903   #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
904   #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
905   #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
906   #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
907   #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
908   #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
909   #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
910 #else
911   #define __Pyx_RefNannyDeclarations
912   #define __Pyx_RefNannySetupContext(name, acquire_gil)
913   #define __Pyx_RefNannyFinishContext()
914   #define __Pyx_INCREF(r) Py_INCREF(r)
915   #define __Pyx_DECREF(r) Py_DECREF(r)
916   #define __Pyx_GOTREF(r)
917   #define __Pyx_GIVEREF(r)
918   #define __Pyx_XINCREF(r) Py_XINCREF(r)
919   #define __Pyx_XDECREF(r) Py_XDECREF(r)
920   #define __Pyx_XGOTREF(r)
921   #define __Pyx_XGIVEREF(r)
922 #endif
923 #define __Pyx_XDECREF_SET(r, v) do {\
924         PyObject *tmp = (PyObject *) r;\
925         r = v; __Pyx_XDECREF(tmp);\
926     } while (0)
927 #define __Pyx_DECREF_SET(r, v) do {\
928         PyObject *tmp = (PyObject *) r;\
929         r = v; __Pyx_DECREF(tmp);\
930     } while (0)
931 #define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
932 #define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
933 
934 /* PyObjectGetAttrStr.proto */
935 #if CYTHON_USE_TYPE_SLOTS
936 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
937 #else
938 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
939 #endif
940 
941 /* GetBuiltinName.proto */
942 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
943 
944 /* PyIntBinop.proto */
945 #if !CYTHON_COMPILING_IN_PYPY
946 static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
947 #else
948 #define __Pyx_PyInt_SubtractObjC(op1, op2, intval, inplace, zerodivision_check)\
949     (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2))
950 #endif
951 
952 /* RaiseDoubleKeywords.proto */
953 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
954 
955 /* ParseKeywords.proto */
956 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
957     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
958     const char* function_name);
959 
960 /* RaiseArgTupleInvalid.proto */
961 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
962     Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
963 
964 /* PyIntCompare.proto */
965 static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, long intval, long inplace);
966 
967 /* PyCFunctionFastCall.proto */
968 #if CYTHON_FAST_PYCCALL
969 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
970 #else
971 #define __Pyx_PyCFunction_FastCall(func, args, nargs)  (assert(0), NULL)
972 #endif
973 
974 /* PyFunctionFastCall.proto */
975 #if CYTHON_FAST_PYCALL
976 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
977     __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
978 #if 1 || PY_VERSION_HEX < 0x030600B1
979 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
980 #else
981 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
982 #endif
983 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
984     (sizeof(char [1 - 2*!(cond)]) - 1)
985 #ifndef Py_MEMBER_SIZE
986 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
987 #endif
988   static size_t __pyx_pyframe_localsplus_offset = 0;
989   #include "frameobject.h"
990   #define __Pxy_PyFrame_Initialize_Offsets()\
991     ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
992      (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
993   #define __Pyx_PyFrame_GetLocalsplus(frame)\
994     (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
995 #endif
996 
997 /* PyObjectCall.proto */
998 #if CYTHON_COMPILING_IN_CPYTHON
999 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1000 #else
1001 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1002 #endif
1003 
1004 /* PyObjectCallMethO.proto */
1005 #if CYTHON_COMPILING_IN_CPYTHON
1006 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1007 #endif
1008 
1009 /* PyObjectCallOneArg.proto */
1010 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1011 
1012 /* PyThreadStateGet.proto */
1013 #if CYTHON_FAST_THREAD_STATE
1014 #define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
1015 #define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
1016 #define __Pyx_PyErr_Occurred()  __pyx_tstate->curexc_type
1017 #else
1018 #define __Pyx_PyThreadState_declare
1019 #define __Pyx_PyThreadState_assign
1020 #define __Pyx_PyErr_Occurred()  PyErr_Occurred()
1021 #endif
1022 
1023 /* PyErrFetchRestore.proto */
1024 #if CYTHON_FAST_THREAD_STATE
1025 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1026 #define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1027 #define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1028 #define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1029 #define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1030 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1031 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1032 #if CYTHON_COMPILING_IN_CPYTHON
1033 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1034 #else
1035 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1036 #endif
1037 #else
1038 #define __Pyx_PyErr_Clear() PyErr_Clear()
1039 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1040 #define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
1041 #define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
1042 #define __Pyx_ErrRestoreInState(tstate, type, value, tb)  PyErr_Restore(type, value, tb)
1043 #define __Pyx_ErrFetchInState(tstate, type, value, tb)  PyErr_Fetch(type, value, tb)
1044 #define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
1045 #define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
1046 #endif
1047 
1048 /* RaiseException.proto */
1049 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1050 
1051 /* WriteUnraisableException.proto */
1052 static void __Pyx_WriteUnraisable(const char *name, int clineno,
1053                                   int lineno, const char *filename,
1054                                   int full_traceback, int nogil);
1055 
1056 /* PyObjectCallNoArg.proto */
1057 #if CYTHON_COMPILING_IN_CPYTHON
1058 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
1059 #else
1060 #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
1061 #endif
1062 
1063 /* GetItemInt.proto */
1064 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1065     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1066     __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
1067     (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
1068                __Pyx_GetItemInt_Generic(o, to_py_func(i))))
1069 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1070     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1071     __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1072     (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
1073 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
1074                                                               int wraparound, int boundscheck);
1075 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1076     (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1077     __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1078     (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
1079 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
1080                                                               int wraparound, int boundscheck);
1081 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
1082 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
1083                                                      int is_list, int wraparound, int boundscheck);
1084 
1085 /* PyIntBinop.proto */
1086 #if !CYTHON_COMPILING_IN_PYPY
1087 static PyObject* __Pyx_PyInt_AndObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
1088 #else
1089 #define __Pyx_PyInt_AndObjC(op1, op2, intval, inplace, zerodivision_check)\
1090     (inplace ? PyNumber_InPlaceAnd(op1, op2) : PyNumber_And(op1, op2))
1091 #endif
1092 
1093 /* PyIntBinop.proto */
1094 #if !CYTHON_COMPILING_IN_PYPY
1095 static PyObject* __Pyx_PyInt_LshiftObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
1096 #else
1097 #define __Pyx_PyInt_LshiftObjC(op1, op2, intval, inplace, zerodivision_check)\
1098     (inplace ? PyNumber_InPlaceLshift(op1, op2) : PyNumber_Lshift(op1, op2))
1099 #endif
1100 
1101 /* PyDictVersioning.proto */
1102 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1103 #define __PYX_DICT_VERSION_INIT  ((PY_UINT64_T) -1)
1104 #define __PYX_GET_DICT_VERSION(dict)  (((PyDictObject*)(dict))->ma_version_tag)
1105 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1106     (version_var) = __PYX_GET_DICT_VERSION(dict);\
1107     (cache_var) = (value);
1108 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1109     static PY_UINT64_T __pyx_dict_version = 0;\
1110     static PyObject *__pyx_dict_cached_value = NULL;\
1111     if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1112         (VAR) = __pyx_dict_cached_value;\
1113     } else {\
1114         (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1115         __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1116     }\
1117 }
1118 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1119 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1120 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1121 #else
1122 #define __PYX_GET_DICT_VERSION(dict)  (0)
1123 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1124 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP)  (VAR) = (LOOKUP);
1125 #endif
1126 
1127 /* GetModuleGlobalName.proto */
1128 #if CYTHON_USE_DICT_VERSIONS
1129 #define __Pyx_GetModuleGlobalName(var, name)  {\
1130     static PY_UINT64_T __pyx_dict_version = 0;\
1131     static PyObject *__pyx_dict_cached_value = NULL;\
1132     (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1133         (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1134         __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1135 }
1136 #define __Pyx_GetModuleGlobalNameUncached(var, name)  {\
1137     PY_UINT64_T __pyx_dict_version;\
1138     PyObject *__pyx_dict_cached_value;\
1139     (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1140 }
1141 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1142 #else
1143 #define __Pyx_GetModuleGlobalName(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
1144 #define __Pyx_GetModuleGlobalNameUncached(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
1145 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1146 #endif
1147 
1148 /* ListAppend.proto */
1149 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
__Pyx_PyList_Append(PyObject * list,PyObject * x)1150 static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
1151     PyListObject* L = (PyListObject*) list;
1152     Py_ssize_t len = Py_SIZE(list);
1153     if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
1154         Py_INCREF(x);
1155         PyList_SET_ITEM(list, len, x);
1156         __Pyx_SET_SIZE(list, len + 1);
1157         return 0;
1158     }
1159     return PyList_Append(list, x);
1160 }
1161 #else
1162 #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
1163 #endif
1164 
1165 /* PyObject_GenericGetAttrNoDict.proto */
1166 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1167 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
1168 #else
1169 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
1170 #endif
1171 
1172 /* PyObject_GenericGetAttr.proto */
1173 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1174 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
1175 #else
1176 #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
1177 #endif
1178 
1179 /* PyErrExceptionMatches.proto */
1180 #if CYTHON_FAST_THREAD_STATE
1181 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1182 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1183 #else
1184 #define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
1185 #endif
1186 
1187 /* PyObjectGetAttrStrNoError.proto */
1188 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
1189 
1190 /* SetupReduce.proto */
1191 static int __Pyx_setup_reduce(PyObject* type_obj);
1192 
1193 /* Import.proto */
1194 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1195 
1196 /* CLineInTraceback.proto */
1197 #ifdef CYTHON_CLINE_IN_TRACEBACK
1198 #define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1199 #else
1200 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1201 #endif
1202 
1203 /* CodeObjectCache.proto */
1204 typedef struct {
1205     PyCodeObject* code_object;
1206     int code_line;
1207 } __Pyx_CodeObjectCacheEntry;
1208 struct __Pyx_CodeObjectCache {
1209     int count;
1210     int max_count;
1211     __Pyx_CodeObjectCacheEntry* entries;
1212 };
1213 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1214 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1215 static PyCodeObject *__pyx_find_code_object(int code_line);
1216 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1217 
1218 /* AddTraceback.proto */
1219 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1220                                int py_line, const char *filename);
1221 
1222 /* CIntToPy.proto */
1223 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PmDeviceID(PmDeviceID value);
1224 
1225 /* CIntToPy.proto */
1226 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
1227 
1228 /* CIntToPy.proto */
1229 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PtTimestamp(PtTimestamp value);
1230 
1231 /* Print.proto */
1232 static int __Pyx_Print(PyObject*, PyObject *, int);
1233 #if CYTHON_COMPILING_IN_PYPY || PY_MAJOR_VERSION >= 3
1234 static PyObject* __pyx_print = 0;
1235 static PyObject* __pyx_print_kwargs = 0;
1236 #endif
1237 
1238 /* CIntToPy.proto */
1239 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PmError(PmError value);
1240 
1241 /* CIntToPy.proto */
1242 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1243 
1244 /* CIntToPy.proto */
1245 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PmMessage(PmMessage value);
1246 
1247 /* CIntToPy.proto */
1248 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PmTimestamp(PmTimestamp value);
1249 
1250 /* CIntFromPy.proto */
1251 static CYTHON_INLINE PmDeviceID __Pyx_PyInt_As_PmDeviceID(PyObject *);
1252 
1253 /* CIntFromPy.proto */
1254 static CYTHON_INLINE PmError __Pyx_PyInt_As_PmError(PyObject *);
1255 
1256 /* CIntFromPy.proto */
1257 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
1258 
1259 /* CIntFromPy.proto */
1260 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
1261 
1262 /* CIntFromPy.proto */
1263 static CYTHON_INLINE PmTimestamp __Pyx_PyInt_As_PmTimestamp(PyObject *);
1264 
1265 /* PrintOne.proto */
1266 static int __Pyx_PrintOne(PyObject* stream, PyObject *o);
1267 
1268 /* CIntFromPy.proto */
1269 static CYTHON_INLINE PmMessage __Pyx_PyInt_As_PmMessage(PyObject *);
1270 
1271 /* FastTypeChecks.proto */
1272 #if CYTHON_COMPILING_IN_CPYTHON
1273 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1274 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1275 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1276 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1277 #else
1278 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1279 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1280 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1281 #endif
1282 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1283 
1284 /* CheckBinaryVersion.proto */
1285 static int __Pyx_check_binary_version(void);
1286 
1287 /* InitStrings.proto */
1288 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1289 
1290 
1291 /* Module declarations from 'pygame.pypm' */
1292 static PyTypeObject *__pyx_ptype_6pygame_4pypm_Output = 0;
1293 static PyTypeObject *__pyx_ptype_6pygame_4pypm_Input = 0;
1294 static long __pyx_v_6pygame_4pypm__pypm_initialized;
1295 #define __Pyx_MODULE_NAME "pygame.pypm"
1296 extern int __pyx_module_is_main_pygame__pypm;
1297 int __pyx_module_is_main_pygame__pypm = 0;
1298 
1299 /* Implementation of 'pygame.pypm' */
1300 static PyObject *__pyx_builtin_IndexError;
1301 static PyObject *__pyx_builtin_enumerate;
1302 static PyObject *__pyx_builtin_ValueError;
1303 static PyObject *__pyx_builtin_range;
1304 static PyObject *__pyx_builtin_TypeError;
1305 static const char __pyx_k_B[] = "B";
1306 static const char __pyx_k_end[] = "end";
1307 static const char __pyx_k_err[] = "err";
1308 static const char __pyx_k_msg[] = "msg";
1309 static const char __pyx_k_sys[] = "sys";
1310 static const char __pyx_k_TRUE[] = "TRUE";
1311 static const char __pyx_k_Time[] = "Time";
1312 static const char __pyx_k_chan[] = "chan";
1313 static const char __pyx_k_file[] = "file";
1314 static const char __pyx_k_info[] = "info";
1315 static const char __pyx_k_main[] = "__main__";
1316 static const char __pyx_k_name[] = "__name__";
1317 static const char __pyx_k_test[] = "__test__";
1318 static const char __pyx_k_when[] = "when";
1319 static const char __pyx_k_0_0_6[] = "0.0.6";
1320 static const char __pyx_k_FALSE[] = "FALSE";
1321 static const char __pyx_k_Input[] = "Input";
1322 static const char __pyx_k_array[] = "array";
1323 static const char __pyx_k_data1[] = "data1";
1324 static const char __pyx_k_data2[] = "data2";
1325 static const char __pyx_k_i_r_s[] = "%i : %r : %s";
1326 static const char __pyx_k_print[] = "print";
1327 static const char __pyx_k_range[] = "range";
1328 static const char __pyx_k_Output[] = "Output";
1329 static const char __pyx_k_import[] = "__import__";
1330 static const char __pyx_k_reduce[] = "__reduce__";
1331 static const char __pyx_k_status[] = "status";
1332 static const char __pyx_k_Channel[] = "Channel";
1333 static const char __pyx_k_FILT_F9[] = "FILT_F9";
1334 static const char __pyx_k_FILT_FD[] = "FILT_FD";
1335 static const char __pyx_k_latency[] = "latency";
1336 static const char __pyx_k_tobytes[] = "tobytes";
1337 static const char __pyx_k_version[] = "__version__";
1338 static const char __pyx_k_FILT_MTC[] = "FILT_MTC";
1339 static const char __pyx_k_getstate[] = "__getstate__";
1340 static const char __pyx_k_setstate[] = "__setstate__";
1341 static const char __pyx_k_tostring[] = "tostring";
1342 static const char __pyx_k_FILT_NOTE[] = "FILT_NOTE";
1343 static const char __pyx_k_FILT_PLAY[] = "FILT_PLAY";
1344 static const char __pyx_k_FILT_TICK[] = "FILT_TICK";
1345 static const char __pyx_k_FILT_TUNE[] = "FILT_TUNE";
1346 static const char __pyx_k_Terminate[] = "Terminate";
1347 static const char __pyx_k_TypeError[] = "TypeError";
1348 static const char __pyx_k_device_no[] = "device_no";
1349 static const char __pyx_k_enumerate[] = "enumerate";
1350 static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
1351 static const char __pyx_k_FILT_CLOCK[] = "FILT_CLOCK";
1352 static const char __pyx_k_FILT_RESET[] = "FILT_RESET";
1353 static const char __pyx_k_FILT_SYSEX[] = "FILT_SYSEX";
1354 static const char __pyx_k_IndexError[] = "IndexError";
1355 static const char __pyx_k_Initialize[] = "Initialize";
1356 static const char __pyx_k_ValueError[] = "ValueError";
1357 static const char __pyx_k_buffersize[] = "buffersize";
1358 static const char __pyx_k_check_open[] = "_check_open";
1359 static const char __pyx_k_FILT_ACTIVE[] = "FILT_ACTIVE";
1360 static const char __pyx_k_buffer_size[] = "buffer_size";
1361 static const char __pyx_k_pygame_pypm[] = "pygame.pypm";
1362 static const char __pyx_k_CountDevices[] = "CountDevices";
1363 static const char __pyx_k_FILT_CONTROL[] = "FILT_CONTROL";
1364 static const char __pyx_k_FILT_PROGRAM[] = "FILT_PROGRAM";
1365 static const char __pyx_k_GetErrorText[] = "GetErrorText";
1366 static const char __pyx_k_input_device[] = "input_device";
1367 static const char __pyx_k_version_info[] = "version_info";
1368 static const char __pyx_k_FILT_REALTIME[] = "FILT_REALTIME";
1369 static const char __pyx_k_GetDeviceInfo[] = "GetDeviceInfo";
1370 static const char __pyx_k_output_device[] = "output_device";
1371 static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
1372 static const char __pyx_k_FILT_PITCHBEND[] = "FILT_PITCHBEND";
1373 static const char __pyx_k_FILT_UNDEFINED[] = "FILT_UNDEFINED";
1374 static const char __pyx_k_FILT_AFTERTOUCH[] = "FILT_AFTERTOUCH";
1375 static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
1376 static const char __pyx_k_FILT_SONG_SELECT[] = "FILT_SONG_SELECT";
1377 static const char __pyx_k_pypm_initialized[] = "_pypm_initialized";
1378 static const char __pyx_k_MIDI_input_opened[] = "MIDI input opened.";
1379 static const char __pyx_k_Pm_OpenOutput_err[] = "Pm_OpenOutput err";
1380 static const char __pyx_k_FILT_SONG_POSITION[] = "FILT_SONG_POSITION";
1381 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
1382 static const char __pyx_k_Opening_Midi_Output[] = "Opening Midi Output";
1383 static const char __pyx_k_midi_Input_not_open[] = "midi Input not open.";
1384 static const char __pyx_k_FILT_POLY_AFTERTOUCH[] = "FILT_POLY_AFTERTOUCH";
1385 static const char __pyx_k_midi_Output_not_open[] = "midi Output not open.";
1386 static const char __pyx_k_No_data_in_event_no_i[] = "No data in event no. %i.";
1387 static const char __pyx_k_Writing_to_MIDI_buffer[] = "Writing to MIDI buffer.";
1388 static const char __pyx_k_Writing_to_midi_buffer[] = "Writing to midi buffer.";
1389 static const char __pyx_k_FILT_CHANNEL_AFTERTOUCH[] = "FILT_CHANNEL_AFTERTOUCH";
1390 static const char __pyx_k_GetDefaultInputDeviceID[] = "GetDefaultInputDeviceID";
1391 static const char __pyx_k_GetDefaultOutputDeviceID[] = "GetDefaultOutputDeviceID";
1392 static const char __pyx_k_Minimum_buffer_length_is_1[] = "Minimum buffer length is 1.";
1393 static const char __pyx_k_src_c_cython_pygame_pypm_pyx[] = "src_c\\cython\\pygame\\pypm.pyx";
1394 static const char __pyx_k_Maximum_buffer_length_is_1024[] = "Maximum buffer length is 1024.";
1395 static const char __pyx_k_Closing_MIDI_input_stream_and_de[] = "Closing MIDI input stream and destroying instance";
1396 static const char __pyx_k_Closing_MIDI_output_stream_and_d[] = "Closing MIDI output stream and destroying instance.";
1397 static const char __pyx_k_Maximum_event_list_length_is_102[] = "Maximum event list length is 1024.";
1398 static const char __pyx_k_Too_many_data_bytes_i_in_event_n[] = "Too many data bytes (%i) in event no. %i.";
1399 static const char __pyx_k_Unable_to_open_Midi_OutputDevice[] = "Unable to open Midi OutputDevice=%i: %s";
1400 static const char __pyx_k_midi_Output_aborted_Need_to_call[] = "midi Output aborted. Need to call Close after Abort.";
1401 static const char __pyx_k_self_midi_cannot_be_converted_to[] = "self.midi cannot be converted to a Python object for pickling";
1402 static PyObject *__pyx_kp_s_0_0_6;
1403 static PyObject *__pyx_n_s_B;
1404 static PyObject *__pyx_n_s_Channel;
1405 static PyObject *__pyx_kp_s_Closing_MIDI_input_stream_and_de;
1406 static PyObject *__pyx_kp_s_Closing_MIDI_output_stream_and_d;
1407 static PyObject *__pyx_n_s_CountDevices;
1408 static PyObject *__pyx_n_s_FALSE;
1409 static PyObject *__pyx_n_s_FILT_ACTIVE;
1410 static PyObject *__pyx_n_s_FILT_AFTERTOUCH;
1411 static PyObject *__pyx_n_s_FILT_CHANNEL_AFTERTOUCH;
1412 static PyObject *__pyx_n_s_FILT_CLOCK;
1413 static PyObject *__pyx_n_s_FILT_CONTROL;
1414 static PyObject *__pyx_n_s_FILT_F9;
1415 static PyObject *__pyx_n_s_FILT_FD;
1416 static PyObject *__pyx_n_s_FILT_MTC;
1417 static PyObject *__pyx_n_s_FILT_NOTE;
1418 static PyObject *__pyx_n_s_FILT_PITCHBEND;
1419 static PyObject *__pyx_n_s_FILT_PLAY;
1420 static PyObject *__pyx_n_s_FILT_POLY_AFTERTOUCH;
1421 static PyObject *__pyx_n_s_FILT_PROGRAM;
1422 static PyObject *__pyx_n_s_FILT_REALTIME;
1423 static PyObject *__pyx_n_s_FILT_RESET;
1424 static PyObject *__pyx_n_s_FILT_SONG_POSITION;
1425 static PyObject *__pyx_n_s_FILT_SONG_SELECT;
1426 static PyObject *__pyx_n_s_FILT_SYSEX;
1427 static PyObject *__pyx_n_s_FILT_TICK;
1428 static PyObject *__pyx_n_s_FILT_TUNE;
1429 static PyObject *__pyx_n_s_FILT_UNDEFINED;
1430 static PyObject *__pyx_n_s_GetDefaultInputDeviceID;
1431 static PyObject *__pyx_n_s_GetDefaultOutputDeviceID;
1432 static PyObject *__pyx_n_s_GetDeviceInfo;
1433 static PyObject *__pyx_n_s_GetErrorText;
1434 static PyObject *__pyx_n_s_IndexError;
1435 static PyObject *__pyx_n_s_Initialize;
1436 static PyObject *__pyx_n_s_Input;
1437 static PyObject *__pyx_kp_s_MIDI_input_opened;
1438 static PyObject *__pyx_kp_s_Maximum_buffer_length_is_1024;
1439 static PyObject *__pyx_kp_s_Maximum_event_list_length_is_102;
1440 static PyObject *__pyx_kp_s_Minimum_buffer_length_is_1;
1441 static PyObject *__pyx_kp_s_No_data_in_event_no_i;
1442 static PyObject *__pyx_kp_s_Opening_Midi_Output;
1443 static PyObject *__pyx_n_s_Output;
1444 static PyObject *__pyx_kp_s_Pm_OpenOutput_err;
1445 static PyObject *__pyx_n_s_TRUE;
1446 static PyObject *__pyx_n_s_Terminate;
1447 static PyObject *__pyx_n_s_Time;
1448 static PyObject *__pyx_kp_s_Too_many_data_bytes_i_in_event_n;
1449 static PyObject *__pyx_n_s_TypeError;
1450 static PyObject *__pyx_kp_s_Unable_to_open_Midi_OutputDevice;
1451 static PyObject *__pyx_n_s_ValueError;
1452 static PyObject *__pyx_kp_s_Writing_to_MIDI_buffer;
1453 static PyObject *__pyx_kp_s_Writing_to_midi_buffer;
1454 static PyObject *__pyx_n_s_array;
1455 static PyObject *__pyx_n_s_buffer_size;
1456 static PyObject *__pyx_n_s_buffersize;
1457 static PyObject *__pyx_n_s_chan;
1458 static PyObject *__pyx_n_s_check_open;
1459 static PyObject *__pyx_n_s_cline_in_traceback;
1460 static PyObject *__pyx_n_s_data1;
1461 static PyObject *__pyx_n_s_data2;
1462 static PyObject *__pyx_n_s_device_no;
1463 static PyObject *__pyx_n_s_end;
1464 static PyObject *__pyx_n_s_enumerate;
1465 static PyObject *__pyx_n_s_err;
1466 static PyObject *__pyx_n_s_file;
1467 static PyObject *__pyx_n_s_getstate;
1468 static PyObject *__pyx_kp_s_i_r_s;
1469 static PyObject *__pyx_n_s_import;
1470 static PyObject *__pyx_n_s_info;
1471 static PyObject *__pyx_n_s_input_device;
1472 static PyObject *__pyx_n_s_latency;
1473 static PyObject *__pyx_n_s_main;
1474 static PyObject *__pyx_kp_s_midi_Input_not_open;
1475 static PyObject *__pyx_kp_s_midi_Output_aborted_Need_to_call;
1476 static PyObject *__pyx_kp_s_midi_Output_not_open;
1477 static PyObject *__pyx_n_s_msg;
1478 static PyObject *__pyx_n_s_name;
1479 static PyObject *__pyx_n_s_output_device;
1480 static PyObject *__pyx_n_s_print;
1481 static PyObject *__pyx_n_s_pygame_pypm;
1482 static PyObject *__pyx_n_s_pypm_initialized;
1483 static PyObject *__pyx_n_s_range;
1484 static PyObject *__pyx_n_s_reduce;
1485 static PyObject *__pyx_n_s_reduce_cython;
1486 static PyObject *__pyx_n_s_reduce_ex;
1487 static PyObject *__pyx_kp_s_self_midi_cannot_be_converted_to;
1488 static PyObject *__pyx_n_s_setstate;
1489 static PyObject *__pyx_n_s_setstate_cython;
1490 static PyObject *__pyx_kp_s_src_c_cython_pygame_pypm_pyx;
1491 static PyObject *__pyx_n_s_status;
1492 static PyObject *__pyx_n_s_sys;
1493 static PyObject *__pyx_n_s_test;
1494 static PyObject *__pyx_n_s_tobytes;
1495 static PyObject *__pyx_n_s_tostring;
1496 static PyObject *__pyx_n_s_version;
1497 static PyObject *__pyx_n_s_version_info;
1498 static PyObject *__pyx_n_s_when;
1499 static PyObject *__pyx_pf_6pygame_4pypm_Initialize(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
1500 static PyObject *__pyx_pf_6pygame_4pypm_2Terminate(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
1501 static PyObject *__pyx_pf_6pygame_4pypm_4GetDefaultInputDeviceID(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
1502 static PyObject *__pyx_pf_6pygame_4pypm_6GetDefaultOutputDeviceID(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
1503 static PyObject *__pyx_pf_6pygame_4pypm_8CountDevices(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
1504 static PyObject *__pyx_pf_6pygame_4pypm_10GetDeviceInfo(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_device_no); /* proto */
1505 static PyObject *__pyx_pf_6pygame_4pypm_12Time(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
1506 static PyObject *__pyx_pf_6pygame_4pypm_14GetErrorText(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_err); /* proto */
1507 static PyObject *__pyx_pf_6pygame_4pypm_16Channel(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_chan); /* proto */
1508 static int __pyx_pf_6pygame_4pypm_6Output___init__(struct __pyx_obj_6pygame_4pypm_Output *__pyx_v_self, PyObject *__pyx_v_output_device, PyObject *__pyx_v_latency, PyObject *__pyx_v_buffer_size); /* proto */
1509 static void __pyx_pf_6pygame_4pypm_6Output_2__dealloc__(struct __pyx_obj_6pygame_4pypm_Output *__pyx_v_self); /* proto */
1510 static PyObject *__pyx_pf_6pygame_4pypm_6Output_4_check_open(struct __pyx_obj_6pygame_4pypm_Output *__pyx_v_self); /* proto */
1511 static PyObject *__pyx_pf_6pygame_4pypm_6Output_6Close(struct __pyx_obj_6pygame_4pypm_Output *__pyx_v_self); /* proto */
1512 static PyObject *__pyx_pf_6pygame_4pypm_6Output_8Abort(struct __pyx_obj_6pygame_4pypm_Output *__pyx_v_self); /* proto */
1513 static PyObject *__pyx_pf_6pygame_4pypm_6Output_10Write(struct __pyx_obj_6pygame_4pypm_Output *__pyx_v_self, PyObject *__pyx_v_data); /* proto */
1514 static PyObject *__pyx_pf_6pygame_4pypm_6Output_12WriteShort(struct __pyx_obj_6pygame_4pypm_Output *__pyx_v_self, PyObject *__pyx_v_status, PyObject *__pyx_v_data1, PyObject *__pyx_v_data2); /* proto */
1515 static PyObject *__pyx_pf_6pygame_4pypm_6Output_14WriteSysEx(struct __pyx_obj_6pygame_4pypm_Output *__pyx_v_self, PyObject *__pyx_v_when, PyObject *__pyx_v_msg); /* proto */
1516 static PyObject *__pyx_pf_6pygame_4pypm_6Output_16__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pygame_4pypm_Output *__pyx_v_self); /* proto */
1517 static PyObject *__pyx_pf_6pygame_4pypm_6Output_18__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pygame_4pypm_Output *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
1518 static int __pyx_pf_6pygame_4pypm_5Input___init__(struct __pyx_obj_6pygame_4pypm_Input *__pyx_v_self, PyObject *__pyx_v_input_device, PyObject *__pyx_v_buffersize); /* proto */
1519 static void __pyx_pf_6pygame_4pypm_5Input_2__dealloc__(struct __pyx_obj_6pygame_4pypm_Input *__pyx_v_self); /* proto */
1520 static PyObject *__pyx_pf_6pygame_4pypm_5Input_4_check_open(struct __pyx_obj_6pygame_4pypm_Input *__pyx_v_self); /* proto */
1521 static PyObject *__pyx_pf_6pygame_4pypm_5Input_6Close(struct __pyx_obj_6pygame_4pypm_Input *__pyx_v_self); /* proto */
1522 static PyObject *__pyx_pf_6pygame_4pypm_5Input_8SetFilter(struct __pyx_obj_6pygame_4pypm_Input *__pyx_v_self, PyObject *__pyx_v_filters); /* proto */
1523 static PyObject *__pyx_pf_6pygame_4pypm_5Input_10SetChannelMask(struct __pyx_obj_6pygame_4pypm_Input *__pyx_v_self, PyObject *__pyx_v_mask); /* proto */
1524 static PyObject *__pyx_pf_6pygame_4pypm_5Input_12Poll(struct __pyx_obj_6pygame_4pypm_Input *__pyx_v_self); /* proto */
1525 static PyObject *__pyx_pf_6pygame_4pypm_5Input_14Read(struct __pyx_obj_6pygame_4pypm_Input *__pyx_v_self, PyObject *__pyx_v_max_events); /* proto */
1526 static PyObject *__pyx_pf_6pygame_4pypm_5Input_16__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pygame_4pypm_Input *__pyx_v_self); /* proto */
1527 static PyObject *__pyx_pf_6pygame_4pypm_5Input_18__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pygame_4pypm_Input *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
1528 static PyObject *__pyx_tp_new_6pygame_4pypm_Output(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
1529 static PyObject *__pyx_tp_new_6pygame_4pypm_Input(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
1530 static PyObject *__pyx_int_0;
1531 static PyObject *__pyx_int_1;
1532 static PyObject *__pyx_int_2;
1533 static PyObject *__pyx_int_3;
1534 static PyObject *__pyx_int_4;
1535 static PyObject *__pyx_int_8;
1536 static PyObject *__pyx_int_16;
1537 static PyObject *__pyx_int_32;
1538 static PyObject *__pyx_int_48;
1539 static PyObject *__pyx_int_64;
1540 static PyObject *__pyx_int_127;
1541 static PyObject *__pyx_int_128;
1542 static PyObject *__pyx_int_255;
1543 static PyObject *__pyx_int_256;
1544 static PyObject *__pyx_int_512;
1545 static PyObject *__pyx_int_768;
1546 static PyObject *__pyx_int_1024;
1547 static PyObject *__pyx_int_2048;
1548 static PyObject *__pyx_int_4096;
1549 static PyObject *__pyx_int_8192;
1550 static PyObject *__pyx_int_16384;
1551 static PyObject *__pyx_int_32768;
1552 static PyObject *__pyx_int_65280;
1553 static PyObject *__pyx_int_65536;
1554 static PyObject *__pyx_int_16711680;
1555 static PyObject *__pyx_tuple_;
1556 static PyObject *__pyx_tuple__2;
1557 static PyObject *__pyx_tuple__3;
1558 static PyObject *__pyx_tuple__4;
1559 static PyObject *__pyx_tuple__5;
1560 static PyObject *__pyx_tuple__6;
1561 static PyObject *__pyx_tuple__7;
1562 static PyObject *__pyx_tuple__8;
1563 static PyObject *__pyx_tuple__9;
1564 static PyObject *__pyx_tuple__10;
1565 static PyObject *__pyx_tuple__11;
1566 static PyObject *__pyx_tuple__13;
1567 static PyObject *__pyx_tuple__18;
1568 static PyObject *__pyx_tuple__21;
1569 static PyObject *__pyx_tuple__23;
1570 static PyObject *__pyx_codeobj__12;
1571 static PyObject *__pyx_codeobj__14;
1572 static PyObject *__pyx_codeobj__15;
1573 static PyObject *__pyx_codeobj__16;
1574 static PyObject *__pyx_codeobj__17;
1575 static PyObject *__pyx_codeobj__19;
1576 static PyObject *__pyx_codeobj__20;
1577 static PyObject *__pyx_codeobj__22;
1578 static PyObject *__pyx_codeobj__24;
1579 /* Late includes */
1580 
1581 /* "pygame/pypm.pyx":154
1582  * cdef long _pypm_initialized
1583  *
1584  * def Initialize():             # <<<<<<<<<<<<<<
1585  *     """Initialize PortMidi library.
1586  *
1587  */
1588 
1589 /* Python wrapper */
1590 static PyObject *__pyx_pw_6pygame_4pypm_1Initialize(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
1591 static char __pyx_doc_6pygame_4pypm_Initialize[] = "Initialize PortMidi library.\n\n    This function must be called once before any other function or class from\n    this module can be used.\n\n    ";
1592 static PyMethodDef __pyx_mdef_6pygame_4pypm_1Initialize = {"Initialize", (PyCFunction)__pyx_pw_6pygame_4pypm_1Initialize, METH_NOARGS, __pyx_doc_6pygame_4pypm_Initialize};
__pyx_pw_6pygame_4pypm_1Initialize(PyObject * __pyx_self,CYTHON_UNUSED PyObject * unused)1593 static PyObject *__pyx_pw_6pygame_4pypm_1Initialize(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
1594   PyObject *__pyx_r = 0;
1595   __Pyx_RefNannyDeclarations
1596   __Pyx_RefNannySetupContext("Initialize (wrapper)", 0);
1597   __pyx_r = __pyx_pf_6pygame_4pypm_Initialize(__pyx_self);
1598 
1599   /* function exit code */
1600   __Pyx_RefNannyFinishContext();
1601   return __pyx_r;
1602 }
1603 
__pyx_pf_6pygame_4pypm_Initialize(CYTHON_UNUSED PyObject * __pyx_self)1604 static PyObject *__pyx_pf_6pygame_4pypm_Initialize(CYTHON_UNUSED PyObject *__pyx_self) {
1605   CYTHON_UNUSED long __pyx_v__pypm_initialized;
1606   PyObject *__pyx_r = NULL;
1607   __Pyx_RefNannyDeclarations
1608   __Pyx_RefNannySetupContext("Initialize", 0);
1609 
1610   /* "pygame/pypm.pyx":161
1611  *
1612  *     """
1613  *     Pm_Initialize()             # <<<<<<<<<<<<<<
1614  *     # equiv to TIME_START: start timer w/ ms accuracy
1615  *     Pt_Start(1, NULL, NULL)
1616  */
1617   (void)(Pm_Initialize());
1618 
1619   /* "pygame/pypm.pyx":163
1620  *     Pm_Initialize()
1621  *     # equiv to TIME_START: start timer w/ ms accuracy
1622  *     Pt_Start(1, NULL, NULL)             # <<<<<<<<<<<<<<
1623  *     _pypm_initialized = 1
1624  *
1625  */
1626   (void)(Pt_Start(1, NULL, NULL));
1627 
1628   /* "pygame/pypm.pyx":164
1629  *     # equiv to TIME_START: start timer w/ ms accuracy
1630  *     Pt_Start(1, NULL, NULL)
1631  *     _pypm_initialized = 1             # <<<<<<<<<<<<<<
1632  *
1633  * def Terminate():
1634  */
1635   __pyx_v__pypm_initialized = 1;
1636 
1637   /* "pygame/pypm.pyx":154
1638  * cdef long _pypm_initialized
1639  *
1640  * def Initialize():             # <<<<<<<<<<<<<<
1641  *     """Initialize PortMidi library.
1642  *
1643  */
1644 
1645   /* function exit code */
1646   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
1647   __Pyx_XGIVEREF(__pyx_r);
1648   __Pyx_RefNannyFinishContext();
1649   return __pyx_r;
1650 }
1651 
1652 /* "pygame/pypm.pyx":166
1653  *     _pypm_initialized = 1
1654  *
1655  * def Terminate():             # <<<<<<<<<<<<<<
1656  *     """Terminate use of PortMidi library.
1657  *
1658  */
1659 
1660 /* Python wrapper */
1661 static PyObject *__pyx_pw_6pygame_4pypm_3Terminate(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
1662 static char __pyx_doc_6pygame_4pypm_2Terminate[] = "Terminate use of PortMidi library.\n\n    Call this to clean up Midi streams when done.\n\n    If you do not call this on Windows machines when you are done with MIDI,\n    your system may crash.\n\n    ";
1663 static PyMethodDef __pyx_mdef_6pygame_4pypm_3Terminate = {"Terminate", (PyCFunction)__pyx_pw_6pygame_4pypm_3Terminate, METH_NOARGS, __pyx_doc_6pygame_4pypm_2Terminate};
__pyx_pw_6pygame_4pypm_3Terminate(PyObject * __pyx_self,CYTHON_UNUSED PyObject * unused)1664 static PyObject *__pyx_pw_6pygame_4pypm_3Terminate(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
1665   PyObject *__pyx_r = 0;
1666   __Pyx_RefNannyDeclarations
1667   __Pyx_RefNannySetupContext("Terminate (wrapper)", 0);
1668   __pyx_r = __pyx_pf_6pygame_4pypm_2Terminate(__pyx_self);
1669 
1670   /* function exit code */
1671   __Pyx_RefNannyFinishContext();
1672   return __pyx_r;
1673 }
1674 
__pyx_pf_6pygame_4pypm_2Terminate(CYTHON_UNUSED PyObject * __pyx_self)1675 static PyObject *__pyx_pf_6pygame_4pypm_2Terminate(CYTHON_UNUSED PyObject *__pyx_self) {
1676   CYTHON_UNUSED long __pyx_v__pypm_initialized;
1677   PyObject *__pyx_r = NULL;
1678   __Pyx_RefNannyDeclarations
1679   __Pyx_RefNannySetupContext("Terminate", 0);
1680 
1681   /* "pygame/pypm.pyx":175
1682  *
1683  *     """
1684  *     Pm_Terminate()             # <<<<<<<<<<<<<<
1685  *     _pypm_initialized = 0
1686  *
1687  */
1688   (void)(Pm_Terminate());
1689 
1690   /* "pygame/pypm.pyx":176
1691  *     """
1692  *     Pm_Terminate()
1693  *     _pypm_initialized = 0             # <<<<<<<<<<<<<<
1694  *
1695  *
1696  */
1697   __pyx_v__pypm_initialized = 0;
1698 
1699   /* "pygame/pypm.pyx":166
1700  *     _pypm_initialized = 1
1701  *
1702  * def Terminate():             # <<<<<<<<<<<<<<
1703  *     """Terminate use of PortMidi library.
1704  *
1705  */
1706 
1707   /* function exit code */
1708   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
1709   __Pyx_XGIVEREF(__pyx_r);
1710   __Pyx_RefNannyFinishContext();
1711   return __pyx_r;
1712 }
1713 
1714 /* "pygame/pypm.pyx":179
1715  *
1716  *
1717  * def GetDefaultInputDeviceID():             # <<<<<<<<<<<<<<
1718  *     """Return the number of the default MIDI input device.
1719  *
1720  */
1721 
1722 /* Python wrapper */
1723 static PyObject *__pyx_pw_6pygame_4pypm_5GetDefaultInputDeviceID(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
1724 static char __pyx_doc_6pygame_4pypm_4GetDefaultInputDeviceID[] = "Return the number of the default MIDI input device.\n\n    See the PortMidi documentation on how the default device is set and\n    determined.\n\n    ";
1725 static PyMethodDef __pyx_mdef_6pygame_4pypm_5GetDefaultInputDeviceID = {"GetDefaultInputDeviceID", (PyCFunction)__pyx_pw_6pygame_4pypm_5GetDefaultInputDeviceID, METH_NOARGS, __pyx_doc_6pygame_4pypm_4GetDefaultInputDeviceID};
__pyx_pw_6pygame_4pypm_5GetDefaultInputDeviceID(PyObject * __pyx_self,CYTHON_UNUSED PyObject * unused)1726 static PyObject *__pyx_pw_6pygame_4pypm_5GetDefaultInputDeviceID(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
1727   PyObject *__pyx_r = 0;
1728   __Pyx_RefNannyDeclarations
1729   __Pyx_RefNannySetupContext("GetDefaultInputDeviceID (wrapper)", 0);
1730   __pyx_r = __pyx_pf_6pygame_4pypm_4GetDefaultInputDeviceID(__pyx_self);
1731 
1732   /* function exit code */
1733   __Pyx_RefNannyFinishContext();
1734   return __pyx_r;
1735 }
1736 
__pyx_pf_6pygame_4pypm_4GetDefaultInputDeviceID(CYTHON_UNUSED PyObject * __pyx_self)1737 static PyObject *__pyx_pf_6pygame_4pypm_4GetDefaultInputDeviceID(CYTHON_UNUSED PyObject *__pyx_self) {
1738   PyObject *__pyx_r = NULL;
1739   __Pyx_RefNannyDeclarations
1740   PyObject *__pyx_t_1 = NULL;
1741   int __pyx_lineno = 0;
1742   const char *__pyx_filename = NULL;
1743   int __pyx_clineno = 0;
1744   __Pyx_RefNannySetupContext("GetDefaultInputDeviceID", 0);
1745 
1746   /* "pygame/pypm.pyx":186
1747  *
1748  *     """
1749  *     return Pm_GetDefaultInputDeviceID()             # <<<<<<<<<<<<<<
1750  *
1751  * def GetDefaultOutputDeviceID():
1752  */
1753   __Pyx_XDECREF(__pyx_r);
1754   __pyx_t_1 = __Pyx_PyInt_From_PmDeviceID(Pm_GetDefaultInputDeviceID()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 186, __pyx_L1_error)
1755   __Pyx_GOTREF(__pyx_t_1);
1756   __pyx_r = __pyx_t_1;
1757   __pyx_t_1 = 0;
1758   goto __pyx_L0;
1759 
1760   /* "pygame/pypm.pyx":179
1761  *
1762  *
1763  * def GetDefaultInputDeviceID():             # <<<<<<<<<<<<<<
1764  *     """Return the number of the default MIDI input device.
1765  *
1766  */
1767 
1768   /* function exit code */
1769   __pyx_L1_error:;
1770   __Pyx_XDECREF(__pyx_t_1);
1771   __Pyx_AddTraceback("pygame.pypm.GetDefaultInputDeviceID", __pyx_clineno, __pyx_lineno, __pyx_filename);
1772   __pyx_r = NULL;
1773   __pyx_L0:;
1774   __Pyx_XGIVEREF(__pyx_r);
1775   __Pyx_RefNannyFinishContext();
1776   return __pyx_r;
1777 }
1778 
1779 /* "pygame/pypm.pyx":188
1780  *     return Pm_GetDefaultInputDeviceID()
1781  *
1782  * def GetDefaultOutputDeviceID():             # <<<<<<<<<<<<<<
1783  *     """Return the number of the default MIDI output device.
1784  *
1785  */
1786 
1787 /* Python wrapper */
1788 static PyObject *__pyx_pw_6pygame_4pypm_7GetDefaultOutputDeviceID(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
1789 static char __pyx_doc_6pygame_4pypm_6GetDefaultOutputDeviceID[] = "Return the number of the default MIDI output device.\n\n    See the PortMidi documentation on how the default device is set and\n    determined.\n\n    ";
1790 static PyMethodDef __pyx_mdef_6pygame_4pypm_7GetDefaultOutputDeviceID = {"GetDefaultOutputDeviceID", (PyCFunction)__pyx_pw_6pygame_4pypm_7GetDefaultOutputDeviceID, METH_NOARGS, __pyx_doc_6pygame_4pypm_6GetDefaultOutputDeviceID};
__pyx_pw_6pygame_4pypm_7GetDefaultOutputDeviceID(PyObject * __pyx_self,CYTHON_UNUSED PyObject * unused)1791 static PyObject *__pyx_pw_6pygame_4pypm_7GetDefaultOutputDeviceID(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
1792   PyObject *__pyx_r = 0;
1793   __Pyx_RefNannyDeclarations
1794   __Pyx_RefNannySetupContext("GetDefaultOutputDeviceID (wrapper)", 0);
1795   __pyx_r = __pyx_pf_6pygame_4pypm_6GetDefaultOutputDeviceID(__pyx_self);
1796 
1797   /* function exit code */
1798   __Pyx_RefNannyFinishContext();
1799   return __pyx_r;
1800 }
1801 
__pyx_pf_6pygame_4pypm_6GetDefaultOutputDeviceID(CYTHON_UNUSED PyObject * __pyx_self)1802 static PyObject *__pyx_pf_6pygame_4pypm_6GetDefaultOutputDeviceID(CYTHON_UNUSED PyObject *__pyx_self) {
1803   PyObject *__pyx_r = NULL;
1804   __Pyx_RefNannyDeclarations
1805   PyObject *__pyx_t_1 = NULL;
1806   int __pyx_lineno = 0;
1807   const char *__pyx_filename = NULL;
1808   int __pyx_clineno = 0;
1809   __Pyx_RefNannySetupContext("GetDefaultOutputDeviceID", 0);
1810 
1811   /* "pygame/pypm.pyx":195
1812  *
1813  *     """
1814  *     return Pm_GetDefaultOutputDeviceID()             # <<<<<<<<<<<<<<
1815  *
1816  * def CountDevices():
1817  */
1818   __Pyx_XDECREF(__pyx_r);
1819   __pyx_t_1 = __Pyx_PyInt_From_PmDeviceID(Pm_GetDefaultOutputDeviceID()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 195, __pyx_L1_error)
1820   __Pyx_GOTREF(__pyx_t_1);
1821   __pyx_r = __pyx_t_1;
1822   __pyx_t_1 = 0;
1823   goto __pyx_L0;
1824 
1825   /* "pygame/pypm.pyx":188
1826  *     return Pm_GetDefaultInputDeviceID()
1827  *
1828  * def GetDefaultOutputDeviceID():             # <<<<<<<<<<<<<<
1829  *     """Return the number of the default MIDI output device.
1830  *
1831  */
1832 
1833   /* function exit code */
1834   __pyx_L1_error:;
1835   __Pyx_XDECREF(__pyx_t_1);
1836   __Pyx_AddTraceback("pygame.pypm.GetDefaultOutputDeviceID", __pyx_clineno, __pyx_lineno, __pyx_filename);
1837   __pyx_r = NULL;
1838   __pyx_L0:;
1839   __Pyx_XGIVEREF(__pyx_r);
1840   __Pyx_RefNannyFinishContext();
1841   return __pyx_r;
1842 }
1843 
1844 /* "pygame/pypm.pyx":197
1845  *     return Pm_GetDefaultOutputDeviceID()
1846  *
1847  * def CountDevices():             # <<<<<<<<<<<<<<
1848  *     """Return number of available MIDI (input and output) devices."""
1849  *
1850  */
1851 
1852 /* Python wrapper */
1853 static PyObject *__pyx_pw_6pygame_4pypm_9CountDevices(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
1854 static char __pyx_doc_6pygame_4pypm_8CountDevices[] = "Return number of available MIDI (input and output) devices.";
1855 static PyMethodDef __pyx_mdef_6pygame_4pypm_9CountDevices = {"CountDevices", (PyCFunction)__pyx_pw_6pygame_4pypm_9CountDevices, METH_NOARGS, __pyx_doc_6pygame_4pypm_8CountDevices};
__pyx_pw_6pygame_4pypm_9CountDevices(PyObject * __pyx_self,CYTHON_UNUSED PyObject * unused)1856 static PyObject *__pyx_pw_6pygame_4pypm_9CountDevices(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
1857   PyObject *__pyx_r = 0;
1858   __Pyx_RefNannyDeclarations
1859   __Pyx_RefNannySetupContext("CountDevices (wrapper)", 0);
1860   __pyx_r = __pyx_pf_6pygame_4pypm_8CountDevices(__pyx_self);
1861 
1862   /* function exit code */
1863   __Pyx_RefNannyFinishContext();
1864   return __pyx_r;
1865 }
1866 
__pyx_pf_6pygame_4pypm_8CountDevices(CYTHON_UNUSED PyObject * __pyx_self)1867 static PyObject *__pyx_pf_6pygame_4pypm_8CountDevices(CYTHON_UNUSED PyObject *__pyx_self) {
1868   PyObject *__pyx_r = NULL;
1869   __Pyx_RefNannyDeclarations
1870   PyObject *__pyx_t_1 = NULL;
1871   int __pyx_lineno = 0;
1872   const char *__pyx_filename = NULL;
1873   int __pyx_clineno = 0;
1874   __Pyx_RefNannySetupContext("CountDevices", 0);
1875 
1876   /* "pygame/pypm.pyx":200
1877  *     """Return number of available MIDI (input and output) devices."""
1878  *
1879  *     return Pm_CountDevices()             # <<<<<<<<<<<<<<
1880  *
1881  * def GetDeviceInfo(device_no):
1882  */
1883   __Pyx_XDECREF(__pyx_r);
1884   __pyx_t_1 = __Pyx_PyInt_From_int(Pm_CountDevices()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 200, __pyx_L1_error)
1885   __Pyx_GOTREF(__pyx_t_1);
1886   __pyx_r = __pyx_t_1;
1887   __pyx_t_1 = 0;
1888   goto __pyx_L0;
1889 
1890   /* "pygame/pypm.pyx":197
1891  *     return Pm_GetDefaultOutputDeviceID()
1892  *
1893  * def CountDevices():             # <<<<<<<<<<<<<<
1894  *     """Return number of available MIDI (input and output) devices."""
1895  *
1896  */
1897 
1898   /* function exit code */
1899   __pyx_L1_error:;
1900   __Pyx_XDECREF(__pyx_t_1);
1901   __Pyx_AddTraceback("pygame.pypm.CountDevices", __pyx_clineno, __pyx_lineno, __pyx_filename);
1902   __pyx_r = NULL;
1903   __pyx_L0:;
1904   __Pyx_XGIVEREF(__pyx_r);
1905   __Pyx_RefNannyFinishContext();
1906   return __pyx_r;
1907 }
1908 
1909 /* "pygame/pypm.pyx":202
1910  *     return Pm_CountDevices()
1911  *
1912  * def GetDeviceInfo(device_no):             # <<<<<<<<<<<<<<
1913  *     """Return device info tuple for MIDI device given by device_no.
1914  *
1915  */
1916 
1917 /* Python wrapper */
1918 static PyObject *__pyx_pw_6pygame_4pypm_11GetDeviceInfo(PyObject *__pyx_self, PyObject *__pyx_v_device_no); /*proto*/
1919 static char __pyx_doc_6pygame_4pypm_10GetDeviceInfo[] = "Return device info tuple for MIDI device given by device_no.\n\n    The returned tuple has the following five items:\n\n    * underlying MIDI API (string)\n    * device name (string)\n    * whether device can be opened as input (1) or not (0)\n    * whether device can be opened as output (1) or not (0)\n    * whether device is currently opened (1) or not (0)\n\n    ";
1920 static PyMethodDef __pyx_mdef_6pygame_4pypm_11GetDeviceInfo = {"GetDeviceInfo", (PyCFunction)__pyx_pw_6pygame_4pypm_11GetDeviceInfo, METH_O, __pyx_doc_6pygame_4pypm_10GetDeviceInfo};
__pyx_pw_6pygame_4pypm_11GetDeviceInfo(PyObject * __pyx_self,PyObject * __pyx_v_device_no)1921 static PyObject *__pyx_pw_6pygame_4pypm_11GetDeviceInfo(PyObject *__pyx_self, PyObject *__pyx_v_device_no) {
1922   PyObject *__pyx_r = 0;
1923   __Pyx_RefNannyDeclarations
1924   __Pyx_RefNannySetupContext("GetDeviceInfo (wrapper)", 0);
1925   __pyx_r = __pyx_pf_6pygame_4pypm_10GetDeviceInfo(__pyx_self, ((PyObject *)__pyx_v_device_no));
1926 
1927   /* function exit code */
1928   __Pyx_RefNannyFinishContext();
1929   return __pyx_r;
1930 }
1931 
__pyx_pf_6pygame_4pypm_10GetDeviceInfo(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_device_no)1932 static PyObject *__pyx_pf_6pygame_4pypm_10GetDeviceInfo(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_device_no) {
1933   PmDeviceInfo *__pyx_v_info;
1934   PyObject *__pyx_r = NULL;
1935   __Pyx_RefNannyDeclarations
1936   PmDeviceID __pyx_t_1;
1937   int __pyx_t_2;
1938   PyObject *__pyx_t_3 = NULL;
1939   PyObject *__pyx_t_4 = NULL;
1940   PyObject *__pyx_t_5 = NULL;
1941   PyObject *__pyx_t_6 = NULL;
1942   PyObject *__pyx_t_7 = NULL;
1943   PyObject *__pyx_t_8 = NULL;
1944   int __pyx_lineno = 0;
1945   const char *__pyx_filename = NULL;
1946   int __pyx_clineno = 0;
1947   __Pyx_RefNannySetupContext("GetDeviceInfo", 0);
1948 
1949   /* "pygame/pypm.pyx":218
1950  *     # disregarding the constness from Pm_GetDeviceInfo,
1951  *     # since pyrex doesn't do const.
1952  *     info = <PmDeviceInfo *>Pm_GetDeviceInfo(device_no)             # <<<<<<<<<<<<<<
1953  *
1954  *     if info != NULL:
1955  */
1956   __pyx_t_1 = __Pyx_PyInt_As_PmDeviceID(__pyx_v_device_no); if (unlikely((__pyx_t_1 == ((PmDeviceID)-1)) && PyErr_Occurred())) __PYX_ERR(0, 218, __pyx_L1_error)
1957   __pyx_v_info = ((PmDeviceInfo *)Pm_GetDeviceInfo(__pyx_t_1));
1958 
1959   /* "pygame/pypm.pyx":220
1960  *     info = <PmDeviceInfo *>Pm_GetDeviceInfo(device_no)
1961  *
1962  *     if info != NULL:             # <<<<<<<<<<<<<<
1963  *         return info.interf, info.name, info.input, info.output, info.opened
1964  *     # return None
1965  */
1966   __pyx_t_2 = ((__pyx_v_info != NULL) != 0);
1967   if (__pyx_t_2) {
1968 
1969     /* "pygame/pypm.pyx":221
1970  *
1971  *     if info != NULL:
1972  *         return info.interf, info.name, info.input, info.output, info.opened             # <<<<<<<<<<<<<<
1973  *     # return None
1974  *
1975  */
1976     __Pyx_XDECREF(__pyx_r);
1977     __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_info->interf); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 221, __pyx_L1_error)
1978     __Pyx_GOTREF(__pyx_t_3);
1979     __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_info->name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 221, __pyx_L1_error)
1980     __Pyx_GOTREF(__pyx_t_4);
1981     __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_info->input); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 221, __pyx_L1_error)
1982     __Pyx_GOTREF(__pyx_t_5);
1983     __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_info->output); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 221, __pyx_L1_error)
1984     __Pyx_GOTREF(__pyx_t_6);
1985     __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_info->opened); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 221, __pyx_L1_error)
1986     __Pyx_GOTREF(__pyx_t_7);
1987     __pyx_t_8 = PyTuple_New(5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 221, __pyx_L1_error)
1988     __Pyx_GOTREF(__pyx_t_8);
1989     __Pyx_GIVEREF(__pyx_t_3);
1990     PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3);
1991     __Pyx_GIVEREF(__pyx_t_4);
1992     PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_4);
1993     __Pyx_GIVEREF(__pyx_t_5);
1994     PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_5);
1995     __Pyx_GIVEREF(__pyx_t_6);
1996     PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_6);
1997     __Pyx_GIVEREF(__pyx_t_7);
1998     PyTuple_SET_ITEM(__pyx_t_8, 4, __pyx_t_7);
1999     __pyx_t_3 = 0;
2000     __pyx_t_4 = 0;
2001     __pyx_t_5 = 0;
2002     __pyx_t_6 = 0;
2003     __pyx_t_7 = 0;
2004     __pyx_r = __pyx_t_8;
2005     __pyx_t_8 = 0;
2006     goto __pyx_L0;
2007 
2008     /* "pygame/pypm.pyx":220
2009  *     info = <PmDeviceInfo *>Pm_GetDeviceInfo(device_no)
2010  *
2011  *     if info != NULL:             # <<<<<<<<<<<<<<
2012  *         return info.interf, info.name, info.input, info.output, info.opened
2013  *     # return None
2014  */
2015   }
2016 
2017   /* "pygame/pypm.pyx":202
2018  *     return Pm_CountDevices()
2019  *
2020  * def GetDeviceInfo(device_no):             # <<<<<<<<<<<<<<
2021  *     """Return device info tuple for MIDI device given by device_no.
2022  *
2023  */
2024 
2025   /* function exit code */
2026   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2027   goto __pyx_L0;
2028   __pyx_L1_error:;
2029   __Pyx_XDECREF(__pyx_t_3);
2030   __Pyx_XDECREF(__pyx_t_4);
2031   __Pyx_XDECREF(__pyx_t_5);
2032   __Pyx_XDECREF(__pyx_t_6);
2033   __Pyx_XDECREF(__pyx_t_7);
2034   __Pyx_XDECREF(__pyx_t_8);
2035   __Pyx_AddTraceback("pygame.pypm.GetDeviceInfo", __pyx_clineno, __pyx_lineno, __pyx_filename);
2036   __pyx_r = NULL;
2037   __pyx_L0:;
2038   __Pyx_XGIVEREF(__pyx_r);
2039   __Pyx_RefNannyFinishContext();
2040   return __pyx_r;
2041 }
2042 
2043 /* "pygame/pypm.pyx":224
2044  *     # return None
2045  *
2046  * def Time():             # <<<<<<<<<<<<<<
2047  *     """Return the current time in ms of the PortMidi timer."""
2048  *
2049  */
2050 
2051 /* Python wrapper */
2052 static PyObject *__pyx_pw_6pygame_4pypm_13Time(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
2053 static char __pyx_doc_6pygame_4pypm_12Time[] = "Return the current time in ms of the PortMidi timer.";
2054 static PyMethodDef __pyx_mdef_6pygame_4pypm_13Time = {"Time", (PyCFunction)__pyx_pw_6pygame_4pypm_13Time, METH_NOARGS, __pyx_doc_6pygame_4pypm_12Time};
__pyx_pw_6pygame_4pypm_13Time(PyObject * __pyx_self,CYTHON_UNUSED PyObject * unused)2055 static PyObject *__pyx_pw_6pygame_4pypm_13Time(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
2056   PyObject *__pyx_r = 0;
2057   __Pyx_RefNannyDeclarations
2058   __Pyx_RefNannySetupContext("Time (wrapper)", 0);
2059   __pyx_r = __pyx_pf_6pygame_4pypm_12Time(__pyx_self);
2060 
2061   /* function exit code */
2062   __Pyx_RefNannyFinishContext();
2063   return __pyx_r;
2064 }
2065 
__pyx_pf_6pygame_4pypm_12Time(CYTHON_UNUSED PyObject * __pyx_self)2066 static PyObject *__pyx_pf_6pygame_4pypm_12Time(CYTHON_UNUSED PyObject *__pyx_self) {
2067   PyObject *__pyx_r = NULL;
2068   __Pyx_RefNannyDeclarations
2069   PyObject *__pyx_t_1 = NULL;
2070   int __pyx_lineno = 0;
2071   const char *__pyx_filename = NULL;
2072   int __pyx_clineno = 0;
2073   __Pyx_RefNannySetupContext("Time", 0);
2074 
2075   /* "pygame/pypm.pyx":227
2076  *     """Return the current time in ms of the PortMidi timer."""
2077  *
2078  *     return Pt_Time()             # <<<<<<<<<<<<<<
2079  *
2080  * def GetErrorText(err):
2081  */
2082   __Pyx_XDECREF(__pyx_r);
2083   __pyx_t_1 = __Pyx_PyInt_From_PtTimestamp(Pt_Time()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 227, __pyx_L1_error)
2084   __Pyx_GOTREF(__pyx_t_1);
2085   __pyx_r = __pyx_t_1;
2086   __pyx_t_1 = 0;
2087   goto __pyx_L0;
2088 
2089   /* "pygame/pypm.pyx":224
2090  *     # return None
2091  *
2092  * def Time():             # <<<<<<<<<<<<<<
2093  *     """Return the current time in ms of the PortMidi timer."""
2094  *
2095  */
2096 
2097   /* function exit code */
2098   __pyx_L1_error:;
2099   __Pyx_XDECREF(__pyx_t_1);
2100   __Pyx_AddTraceback("pygame.pypm.Time", __pyx_clineno, __pyx_lineno, __pyx_filename);
2101   __pyx_r = NULL;
2102   __pyx_L0:;
2103   __Pyx_XGIVEREF(__pyx_r);
2104   __Pyx_RefNannyFinishContext();
2105   return __pyx_r;
2106 }
2107 
2108 /* "pygame/pypm.pyx":229
2109  *     return Pt_Time()
2110  *
2111  * def GetErrorText(err):             # <<<<<<<<<<<<<<
2112  *     """Return human-readable error message translated from error number."""
2113  *
2114  */
2115 
2116 /* Python wrapper */
2117 static PyObject *__pyx_pw_6pygame_4pypm_15GetErrorText(PyObject *__pyx_self, PyObject *__pyx_v_err); /*proto*/
2118 static char __pyx_doc_6pygame_4pypm_14GetErrorText[] = "Return human-readable error message translated from error number.";
2119 static PyMethodDef __pyx_mdef_6pygame_4pypm_15GetErrorText = {"GetErrorText", (PyCFunction)__pyx_pw_6pygame_4pypm_15GetErrorText, METH_O, __pyx_doc_6pygame_4pypm_14GetErrorText};
__pyx_pw_6pygame_4pypm_15GetErrorText(PyObject * __pyx_self,PyObject * __pyx_v_err)2120 static PyObject *__pyx_pw_6pygame_4pypm_15GetErrorText(PyObject *__pyx_self, PyObject *__pyx_v_err) {
2121   PyObject *__pyx_r = 0;
2122   __Pyx_RefNannyDeclarations
2123   __Pyx_RefNannySetupContext("GetErrorText (wrapper)", 0);
2124   __pyx_r = __pyx_pf_6pygame_4pypm_14GetErrorText(__pyx_self, ((PyObject *)__pyx_v_err));
2125 
2126   /* function exit code */
2127   __Pyx_RefNannyFinishContext();
2128   return __pyx_r;
2129 }
2130 
__pyx_pf_6pygame_4pypm_14GetErrorText(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_err)2131 static PyObject *__pyx_pf_6pygame_4pypm_14GetErrorText(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_err) {
2132   PyObject *__pyx_r = NULL;
2133   __Pyx_RefNannyDeclarations
2134   PmError __pyx_t_1;
2135   PyObject *__pyx_t_2 = NULL;
2136   int __pyx_lineno = 0;
2137   const char *__pyx_filename = NULL;
2138   int __pyx_clineno = 0;
2139   __Pyx_RefNannySetupContext("GetErrorText", 0);
2140 
2141   /* "pygame/pypm.pyx":232
2142  *     """Return human-readable error message translated from error number."""
2143  *
2144  *     return Pm_GetErrorText(err)             # <<<<<<<<<<<<<<
2145  *
2146  * def Channel(chan):
2147  */
2148   __Pyx_XDECREF(__pyx_r);
2149   __pyx_t_1 = ((PmError)__Pyx_PyInt_As_PmError(__pyx_v_err)); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 232, __pyx_L1_error)
2150   __pyx_t_2 = __Pyx_PyBytes_FromString(Pm_GetErrorText(__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 232, __pyx_L1_error)
2151   __Pyx_GOTREF(__pyx_t_2);
2152   __pyx_r = __pyx_t_2;
2153   __pyx_t_2 = 0;
2154   goto __pyx_L0;
2155 
2156   /* "pygame/pypm.pyx":229
2157  *     return Pt_Time()
2158  *
2159  * def GetErrorText(err):             # <<<<<<<<<<<<<<
2160  *     """Return human-readable error message translated from error number."""
2161  *
2162  */
2163 
2164   /* function exit code */
2165   __pyx_L1_error:;
2166   __Pyx_XDECREF(__pyx_t_2);
2167   __Pyx_AddTraceback("pygame.pypm.GetErrorText", __pyx_clineno, __pyx_lineno, __pyx_filename);
2168   __pyx_r = NULL;
2169   __pyx_L0:;
2170   __Pyx_XGIVEREF(__pyx_r);
2171   __Pyx_RefNannyFinishContext();
2172   return __pyx_r;
2173 }
2174 
2175 /* "pygame/pypm.pyx":234
2176  *     return Pm_GetErrorText(err)
2177  *
2178  * def Channel(chan):             # <<<<<<<<<<<<<<
2179  *     """Return Channel object for given MIDI channel number 1 - 16.
2180  *
2181  */
2182 
2183 /* Python wrapper */
2184 static PyObject *__pyx_pw_6pygame_4pypm_17Channel(PyObject *__pyx_self, PyObject *__pyx_v_chan); /*proto*/
2185 static char __pyx_doc_6pygame_4pypm_16Channel[] = "Return Channel object for given MIDI channel number 1 - 16.\n\n    Channel(<chan>) is used with ChannelMask on input MIDI streams.\n\n    Example:\n\n    To receive input on channels 1 and 10 on a MIDI stream called\n    MidiIn::\n\n        MidiIn.SetChannelMask(pypm.Channel(1) | pypm.Channel(10))\n\n    .. note::\n        PyPortMidi Channel function has been altered from\n        the original PortMidi c call to correct for what\n        seems to be a bug --- i.e. channel filters were\n        all numbered from 0 to 15 instead of 1 to 16.\n\n    ";
2186 static PyMethodDef __pyx_mdef_6pygame_4pypm_17Channel = {"Channel", (PyCFunction)__pyx_pw_6pygame_4pypm_17Channel, METH_O, __pyx_doc_6pygame_4pypm_16Channel};
__pyx_pw_6pygame_4pypm_17Channel(PyObject * __pyx_self,PyObject * __pyx_v_chan)2187 static PyObject *__pyx_pw_6pygame_4pypm_17Channel(PyObject *__pyx_self, PyObject *__pyx_v_chan) {
2188   PyObject *__pyx_r = 0;
2189   __Pyx_RefNannyDeclarations
2190   __Pyx_RefNannySetupContext("Channel (wrapper)", 0);
2191   __pyx_r = __pyx_pf_6pygame_4pypm_16Channel(__pyx_self, ((PyObject *)__pyx_v_chan));
2192 
2193   /* function exit code */
2194   __Pyx_RefNannyFinishContext();
2195   return __pyx_r;
2196 }
2197 
__pyx_pf_6pygame_4pypm_16Channel(CYTHON_UNUSED PyObject * __pyx_self,PyObject * __pyx_v_chan)2198 static PyObject *__pyx_pf_6pygame_4pypm_16Channel(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_chan) {
2199   PyObject *__pyx_r = NULL;
2200   __Pyx_RefNannyDeclarations
2201   PyObject *__pyx_t_1 = NULL;
2202   int __pyx_t_2;
2203   int __pyx_lineno = 0;
2204   const char *__pyx_filename = NULL;
2205   int __pyx_clineno = 0;
2206   __Pyx_RefNannySetupContext("Channel", 0);
2207 
2208   /* "pygame/pypm.pyx":253
2209  *
2210  *     """
2211  *     return Pm_Channel(chan - 1)             # <<<<<<<<<<<<<<
2212  *
2213  *
2214  */
2215   __Pyx_XDECREF(__pyx_r);
2216   __pyx_t_1 = __Pyx_PyInt_SubtractObjC(__pyx_v_chan, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 253, __pyx_L1_error)
2217   __Pyx_GOTREF(__pyx_t_1);
2218   __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 253, __pyx_L1_error)
2219   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2220   __pyx_t_1 = __Pyx_PyInt_From_int(Pm_Channel(__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 253, __pyx_L1_error)
2221   __Pyx_GOTREF(__pyx_t_1);
2222   __pyx_r = __pyx_t_1;
2223   __pyx_t_1 = 0;
2224   goto __pyx_L0;
2225 
2226   /* "pygame/pypm.pyx":234
2227  *     return Pm_GetErrorText(err)
2228  *
2229  * def Channel(chan):             # <<<<<<<<<<<<<<
2230  *     """Return Channel object for given MIDI channel number 1 - 16.
2231  *
2232  */
2233 
2234   /* function exit code */
2235   __pyx_L1_error:;
2236   __Pyx_XDECREF(__pyx_t_1);
2237   __Pyx_AddTraceback("pygame.pypm.Channel", __pyx_clineno, __pyx_lineno, __pyx_filename);
2238   __pyx_r = NULL;
2239   __pyx_L0:;
2240   __Pyx_XGIVEREF(__pyx_r);
2241   __Pyx_RefNannyFinishContext();
2242   return __pyx_r;
2243 }
2244 
2245 /* "pygame/pypm.pyx":271
2246  *     cdef int _aborted
2247  *
2248  *     def __init__(self, output_device, latency=0, buffer_size=256):             # <<<<<<<<<<<<<<
2249  *         """Instantiate MIDI output stream object."""
2250  *
2251  */
2252 
2253 /* Python wrapper */
2254 static int __pyx_pw_6pygame_4pypm_6Output_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2255 static char __pyx_doc_6pygame_4pypm_6Output___init__[] = "Instantiate MIDI output stream object.";
2256 #if CYTHON_COMPILING_IN_CPYTHON
2257 struct wrapperbase __pyx_wrapperbase_6pygame_4pypm_6Output___init__;
2258 #endif
__pyx_pw_6pygame_4pypm_6Output_1__init__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)2259 static int __pyx_pw_6pygame_4pypm_6Output_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2260   PyObject *__pyx_v_output_device = 0;
2261   PyObject *__pyx_v_latency = 0;
2262   PyObject *__pyx_v_buffer_size = 0;
2263   int __pyx_lineno = 0;
2264   const char *__pyx_filename = NULL;
2265   int __pyx_clineno = 0;
2266   int __pyx_r;
2267   __Pyx_RefNannyDeclarations
2268   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
2269   {
2270     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_output_device,&__pyx_n_s_latency,&__pyx_n_s_buffer_size,0};
2271     PyObject* values[3] = {0,0,0};
2272     values[1] = ((PyObject *)__pyx_int_0);
2273     values[2] = ((PyObject *)__pyx_int_256);
2274     if (unlikely(__pyx_kwds)) {
2275       Py_ssize_t kw_args;
2276       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2277       switch (pos_args) {
2278         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2279         CYTHON_FALLTHROUGH;
2280         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2281         CYTHON_FALLTHROUGH;
2282         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2283         CYTHON_FALLTHROUGH;
2284         case  0: break;
2285         default: goto __pyx_L5_argtuple_error;
2286       }
2287       kw_args = PyDict_Size(__pyx_kwds);
2288       switch (pos_args) {
2289         case  0:
2290         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_output_device)) != 0)) kw_args--;
2291         else goto __pyx_L5_argtuple_error;
2292         CYTHON_FALLTHROUGH;
2293         case  1:
2294         if (kw_args > 0) {
2295           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_latency);
2296           if (value) { values[1] = value; kw_args--; }
2297         }
2298         CYTHON_FALLTHROUGH;
2299         case  2:
2300         if (kw_args > 0) {
2301           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_buffer_size);
2302           if (value) { values[2] = value; kw_args--; }
2303         }
2304       }
2305       if (unlikely(kw_args > 0)) {
2306         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 271, __pyx_L3_error)
2307       }
2308     } else {
2309       switch (PyTuple_GET_SIZE(__pyx_args)) {
2310         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2311         CYTHON_FALLTHROUGH;
2312         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2313         CYTHON_FALLTHROUGH;
2314         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2315         break;
2316         default: goto __pyx_L5_argtuple_error;
2317       }
2318     }
2319     __pyx_v_output_device = values[0];
2320     __pyx_v_latency = values[1];
2321     __pyx_v_buffer_size = values[2];
2322   }
2323   goto __pyx_L4_argument_unpacking_done;
2324   __pyx_L5_argtuple_error:;
2325   __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 271, __pyx_L3_error)
2326   __pyx_L3_error:;
2327   __Pyx_AddTraceback("pygame.pypm.Output.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2328   __Pyx_RefNannyFinishContext();
2329   return -1;
2330   __pyx_L4_argument_unpacking_done:;
2331   __pyx_r = __pyx_pf_6pygame_4pypm_6Output___init__(((struct __pyx_obj_6pygame_4pypm_Output *)__pyx_v_self), __pyx_v_output_device, __pyx_v_latency, __pyx_v_buffer_size);
2332 
2333   /* function exit code */
2334   __Pyx_RefNannyFinishContext();
2335   return __pyx_r;
2336 }
2337 
__pyx_pf_6pygame_4pypm_6Output___init__(struct __pyx_obj_6pygame_4pypm_Output * __pyx_v_self,PyObject * __pyx_v_output_device,PyObject * __pyx_v_latency,PyObject * __pyx_v_buffer_size)2338 static int __pyx_pf_6pygame_4pypm_6Output___init__(struct __pyx_obj_6pygame_4pypm_Output *__pyx_v_self, PyObject *__pyx_v_output_device, PyObject *__pyx_v_latency, PyObject *__pyx_v_buffer_size) {
2339   PmError __pyx_v_err;
2340   PmTimeProcPtr __pyx_v_PmPtr;
2341   char const *__pyx_v_errmsg;
2342   int __pyx_r;
2343   __Pyx_RefNannyDeclarations
2344   int __pyx_t_1;
2345   PyObject *__pyx_t_2 = NULL;
2346   int __pyx_t_3;
2347   PmDeviceID __pyx_t_4;
2348   long __pyx_t_5;
2349   long __pyx_t_6;
2350   PyObject *__pyx_t_7 = NULL;
2351   int __pyx_lineno = 0;
2352   const char *__pyx_filename = NULL;
2353   int __pyx_clineno = 0;
2354   __Pyx_RefNannySetupContext("__init__", 0);
2355 
2356   /* "pygame/pypm.pyx":279
2357  *         cdef const char * errmsg
2358  *
2359  *         self.device = output_device             # <<<<<<<<<<<<<<
2360  *         self.debug = 0
2361  *         self._aborted = 0
2362  */
2363   __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_output_device); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 279, __pyx_L1_error)
2364   __pyx_v_self->device = __pyx_t_1;
2365 
2366   /* "pygame/pypm.pyx":280
2367  *
2368  *         self.device = output_device
2369  *         self.debug = 0             # <<<<<<<<<<<<<<
2370  *         self._aborted = 0
2371  *
2372  */
2373   __pyx_v_self->debug = 0;
2374 
2375   /* "pygame/pypm.pyx":281
2376  *         self.device = output_device
2377  *         self.debug = 0
2378  *         self._aborted = 0             # <<<<<<<<<<<<<<
2379  *
2380  *         if latency == 0:
2381  */
2382   __pyx_v_self->_aborted = 0;
2383 
2384   /* "pygame/pypm.pyx":283
2385  *         self._aborted = 0
2386  *
2387  *         if latency == 0:             # <<<<<<<<<<<<<<
2388  *             PmPtr = NULL
2389  *         else:
2390  */
2391   __pyx_t_2 = __Pyx_PyInt_EqObjC(__pyx_v_latency, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 283, __pyx_L1_error)
2392   __Pyx_GOTREF(__pyx_t_2);
2393   __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 283, __pyx_L1_error)
2394   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2395   if (__pyx_t_3) {
2396 
2397     /* "pygame/pypm.pyx":284
2398  *
2399  *         if latency == 0:
2400  *             PmPtr = NULL             # <<<<<<<<<<<<<<
2401  *         else:
2402  *             PmPtr = <PmTimeProcPtr>&Pt_Time
2403  */
2404     __pyx_v_PmPtr = NULL;
2405 
2406     /* "pygame/pypm.pyx":283
2407  *         self._aborted = 0
2408  *
2409  *         if latency == 0:             # <<<<<<<<<<<<<<
2410  *             PmPtr = NULL
2411  *         else:
2412  */
2413     goto __pyx_L3;
2414   }
2415 
2416   /* "pygame/pypm.pyx":286
2417  *             PmPtr = NULL
2418  *         else:
2419  *             PmPtr = <PmTimeProcPtr>&Pt_Time             # <<<<<<<<<<<<<<
2420  *
2421  *         if self.debug:
2422  */
2423   /*else*/ {
2424     __pyx_v_PmPtr = ((PmTimeProcPtr)(&Pt_Time));
2425   }
2426   __pyx_L3:;
2427 
2428   /* "pygame/pypm.pyx":288
2429  *             PmPtr = <PmTimeProcPtr>&Pt_Time
2430  *
2431  *         if self.debug:             # <<<<<<<<<<<<<<
2432  *             print "Opening Midi Output", output_device
2433  *
2434  */
2435   __pyx_t_3 = (__pyx_v_self->debug != 0);
2436   if (__pyx_t_3) {
2437 
2438     /* "pygame/pypm.pyx":289
2439  *
2440  *         if self.debug:
2441  *             print "Opening Midi Output", output_device             # <<<<<<<<<<<<<<
2442  *
2443  *         err = Pm_OpenOutput(&(self.midi), output_device, NULL, buffer_size,
2444  */
2445     __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 289, __pyx_L1_error)
2446     __Pyx_GOTREF(__pyx_t_2);
2447     __Pyx_INCREF(__pyx_kp_s_Opening_Midi_Output);
2448     __Pyx_GIVEREF(__pyx_kp_s_Opening_Midi_Output);
2449     PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_s_Opening_Midi_Output);
2450     __Pyx_INCREF(__pyx_v_output_device);
2451     __Pyx_GIVEREF(__pyx_v_output_device);
2452     PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_output_device);
2453     if (__Pyx_Print(0, __pyx_t_2, 1) < 0) __PYX_ERR(0, 289, __pyx_L1_error)
2454     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2455 
2456     /* "pygame/pypm.pyx":288
2457  *             PmPtr = <PmTimeProcPtr>&Pt_Time
2458  *
2459  *         if self.debug:             # <<<<<<<<<<<<<<
2460  *             print "Opening Midi Output", output_device
2461  *
2462  */
2463   }
2464 
2465   /* "pygame/pypm.pyx":291
2466  *             print "Opening Midi Output", output_device
2467  *
2468  *         err = Pm_OpenOutput(&(self.midi), output_device, NULL, buffer_size,             # <<<<<<<<<<<<<<
2469  *                             PmPtr, NULL, latency)
2470  *         if self.debug:
2471  */
2472   __pyx_t_4 = __Pyx_PyInt_As_PmDeviceID(__pyx_v_output_device); if (unlikely((__pyx_t_4 == ((PmDeviceID)-1)) && PyErr_Occurred())) __PYX_ERR(0, 291, __pyx_L1_error)
2473   __pyx_t_5 = __Pyx_PyInt_As_long(__pyx_v_buffer_size); if (unlikely((__pyx_t_5 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 291, __pyx_L1_error)
2474 
2475   /* "pygame/pypm.pyx":292
2476  *
2477  *         err = Pm_OpenOutput(&(self.midi), output_device, NULL, buffer_size,
2478  *                             PmPtr, NULL, latency)             # <<<<<<<<<<<<<<
2479  *         if self.debug:
2480  *             print "Pm_OpenOutput err", err
2481  */
2482   __pyx_t_6 = __Pyx_PyInt_As_long(__pyx_v_latency); if (unlikely((__pyx_t_6 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 292, __pyx_L1_error)
2483 
2484   /* "pygame/pypm.pyx":291
2485  *             print "Opening Midi Output", output_device
2486  *
2487  *         err = Pm_OpenOutput(&(self.midi), output_device, NULL, buffer_size,             # <<<<<<<<<<<<<<
2488  *                             PmPtr, NULL, latency)
2489  *         if self.debug:
2490  */
2491   __pyx_v_err = Pm_OpenOutput((&__pyx_v_self->midi), __pyx_t_4, NULL, __pyx_t_5, __pyx_v_PmPtr, NULL, __pyx_t_6);
2492 
2493   /* "pygame/pypm.pyx":293
2494  *         err = Pm_OpenOutput(&(self.midi), output_device, NULL, buffer_size,
2495  *                             PmPtr, NULL, latency)
2496  *         if self.debug:             # <<<<<<<<<<<<<<
2497  *             print "Pm_OpenOutput err", err
2498  *
2499  */
2500   __pyx_t_3 = (__pyx_v_self->debug != 0);
2501   if (__pyx_t_3) {
2502 
2503     /* "pygame/pypm.pyx":294
2504  *                             PmPtr, NULL, latency)
2505  *         if self.debug:
2506  *             print "Pm_OpenOutput err", err             # <<<<<<<<<<<<<<
2507  *
2508  *         if err < 0:
2509  */
2510     __pyx_t_2 = __Pyx_PyInt_From_PmError(__pyx_v_err); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 294, __pyx_L1_error)
2511     __Pyx_GOTREF(__pyx_t_2);
2512     __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 294, __pyx_L1_error)
2513     __Pyx_GOTREF(__pyx_t_7);
2514     __Pyx_INCREF(__pyx_kp_s_Pm_OpenOutput_err);
2515     __Pyx_GIVEREF(__pyx_kp_s_Pm_OpenOutput_err);
2516     PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_kp_s_Pm_OpenOutput_err);
2517     __Pyx_GIVEREF(__pyx_t_2);
2518     PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2);
2519     __pyx_t_2 = 0;
2520     if (__Pyx_Print(0, __pyx_t_7, 1) < 0) __PYX_ERR(0, 294, __pyx_L1_error)
2521     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
2522 
2523     /* "pygame/pypm.pyx":293
2524  *         err = Pm_OpenOutput(&(self.midi), output_device, NULL, buffer_size,
2525  *                             PmPtr, NULL, latency)
2526  *         if self.debug:             # <<<<<<<<<<<<<<
2527  *             print "Pm_OpenOutput err", err
2528  *
2529  */
2530   }
2531 
2532   /* "pygame/pypm.pyx":296
2533  *             print "Pm_OpenOutput err", err
2534  *
2535  *         if err < 0:             # <<<<<<<<<<<<<<
2536  *             errmsg = Pm_GetErrorText(err)
2537  *             # Something's amiss here - if we try to throw an Exception
2538  */
2539   __pyx_t_3 = ((__pyx_v_err < 0) != 0);
2540   if (__pyx_t_3) {
2541 
2542     /* "pygame/pypm.pyx":297
2543  *
2544  *         if err < 0:
2545  *             errmsg = Pm_GetErrorText(err)             # <<<<<<<<<<<<<<
2546  *             # Something's amiss here - if we try to throw an Exception
2547  *             # here, we crash.
2548  */
2549     __pyx_v_errmsg = Pm_GetErrorText(__pyx_v_err);
2550 
2551     /* "pygame/pypm.pyx":300
2552  *             # Something's amiss here - if we try to throw an Exception
2553  *             # here, we crash.
2554  *             if not err == -10000:             # <<<<<<<<<<<<<<
2555  *                 raise Exception(errmsg)
2556  *             else:
2557  */
2558     __pyx_t_3 = ((!((__pyx_v_err == -10000L) != 0)) != 0);
2559     if (unlikely(__pyx_t_3)) {
2560 
2561       /* "pygame/pypm.pyx":301
2562  *             # here, we crash.
2563  *             if not err == -10000:
2564  *                 raise Exception(errmsg)             # <<<<<<<<<<<<<<
2565  *             else:
2566  *                 print "Unable to open Midi OutputDevice=%i: %s" % (
2567  */
2568       __pyx_t_7 = __Pyx_PyBytes_FromString(__pyx_v_errmsg); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 301, __pyx_L1_error)
2569       __Pyx_GOTREF(__pyx_t_7);
2570       __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 301, __pyx_L1_error)
2571       __Pyx_GOTREF(__pyx_t_2);
2572       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
2573       __Pyx_Raise(__pyx_t_2, 0, 0, 0);
2574       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2575       __PYX_ERR(0, 301, __pyx_L1_error)
2576 
2577       /* "pygame/pypm.pyx":300
2578  *             # Something's amiss here - if we try to throw an Exception
2579  *             # here, we crash.
2580  *             if not err == -10000:             # <<<<<<<<<<<<<<
2581  *                 raise Exception(errmsg)
2582  *             else:
2583  */
2584     }
2585 
2586     /* "pygame/pypm.pyx":303
2587  *                 raise Exception(errmsg)
2588  *             else:
2589  *                 print "Unable to open Midi OutputDevice=%i: %s" % (             # <<<<<<<<<<<<<<
2590  *                     output_device, errmsg)
2591  *
2592  */
2593     /*else*/ {
2594 
2595       /* "pygame/pypm.pyx":304
2596  *             else:
2597  *                 print "Unable to open Midi OutputDevice=%i: %s" % (
2598  *                     output_device, errmsg)             # <<<<<<<<<<<<<<
2599  *
2600  *     def __dealloc__(self):
2601  */
2602       __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_errmsg); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 304, __pyx_L1_error)
2603       __Pyx_GOTREF(__pyx_t_2);
2604       __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 304, __pyx_L1_error)
2605       __Pyx_GOTREF(__pyx_t_7);
2606       __Pyx_INCREF(__pyx_v_output_device);
2607       __Pyx_GIVEREF(__pyx_v_output_device);
2608       PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_output_device);
2609       __Pyx_GIVEREF(__pyx_t_2);
2610       PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2);
2611       __pyx_t_2 = 0;
2612 
2613       /* "pygame/pypm.pyx":303
2614  *                 raise Exception(errmsg)
2615  *             else:
2616  *                 print "Unable to open Midi OutputDevice=%i: %s" % (             # <<<<<<<<<<<<<<
2617  *                     output_device, errmsg)
2618  *
2619  */
2620       __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_Unable_to_open_Midi_OutputDevice, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 303, __pyx_L1_error)
2621       __Pyx_GOTREF(__pyx_t_2);
2622       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
2623       if (__Pyx_PrintOne(0, __pyx_t_2) < 0) __PYX_ERR(0, 303, __pyx_L1_error)
2624       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2625     }
2626 
2627     /* "pygame/pypm.pyx":296
2628  *             print "Pm_OpenOutput err", err
2629  *
2630  *         if err < 0:             # <<<<<<<<<<<<<<
2631  *             errmsg = Pm_GetErrorText(err)
2632  *             # Something's amiss here - if we try to throw an Exception
2633  */
2634   }
2635 
2636   /* "pygame/pypm.pyx":271
2637  *     cdef int _aborted
2638  *
2639  *     def __init__(self, output_device, latency=0, buffer_size=256):             # <<<<<<<<<<<<<<
2640  *         """Instantiate MIDI output stream object."""
2641  *
2642  */
2643 
2644   /* function exit code */
2645   __pyx_r = 0;
2646   goto __pyx_L0;
2647   __pyx_L1_error:;
2648   __Pyx_XDECREF(__pyx_t_2);
2649   __Pyx_XDECREF(__pyx_t_7);
2650   __Pyx_AddTraceback("pygame.pypm.Output.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2651   __pyx_r = -1;
2652   __pyx_L0:;
2653   __Pyx_RefNannyFinishContext();
2654   return __pyx_r;
2655 }
2656 
2657 /* "pygame/pypm.pyx":306
2658  *                     output_device, errmsg)
2659  *
2660  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
2661  *         """Close midi device if still open when the instance is destroyed."""
2662  *
2663  */
2664 
2665 /* Python wrapper */
2666 static void __pyx_pw_6pygame_4pypm_6Output_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_6pygame_4pypm_6Output_3__dealloc__(PyObject * __pyx_v_self)2667 static void __pyx_pw_6pygame_4pypm_6Output_3__dealloc__(PyObject *__pyx_v_self) {
2668   __Pyx_RefNannyDeclarations
2669   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
2670   __pyx_pf_6pygame_4pypm_6Output_2__dealloc__(((struct __pyx_obj_6pygame_4pypm_Output *)__pyx_v_self));
2671 
2672   /* function exit code */
2673   __Pyx_RefNannyFinishContext();
2674 }
2675 
__pyx_pf_6pygame_4pypm_6Output_2__dealloc__(struct __pyx_obj_6pygame_4pypm_Output * __pyx_v_self)2676 static void __pyx_pf_6pygame_4pypm_6Output_2__dealloc__(struct __pyx_obj_6pygame_4pypm_Output *__pyx_v_self) {
2677   PmError __pyx_v_err;
2678   __Pyx_RefNannyDeclarations
2679   int __pyx_t_1;
2680   int __pyx_t_2;
2681   PyObject *__pyx_t_3 = NULL;
2682   PyObject *__pyx_t_4 = NULL;
2683   int __pyx_lineno = 0;
2684   const char *__pyx_filename = NULL;
2685   int __pyx_clineno = 0;
2686   __Pyx_RefNannySetupContext("__dealloc__", 0);
2687 
2688   /* "pygame/pypm.pyx":311
2689  *         cdef PmError err
2690  *
2691  *         if self.debug:             # <<<<<<<<<<<<<<
2692  *             print "Closing MIDI output stream and destroying instance."
2693  *
2694  */
2695   __pyx_t_1 = (__pyx_v_self->debug != 0);
2696   if (__pyx_t_1) {
2697 
2698     /* "pygame/pypm.pyx":312
2699  *
2700  *         if self.debug:
2701  *             print "Closing MIDI output stream and destroying instance."             # <<<<<<<<<<<<<<
2702  *
2703  *         if self.midi and _pypm_initialized:
2704  */
2705     if (__Pyx_PrintOne(0, __pyx_kp_s_Closing_MIDI_output_stream_and_d) < 0) __PYX_ERR(0, 312, __pyx_L1_error)
2706 
2707     /* "pygame/pypm.pyx":311
2708  *         cdef PmError err
2709  *
2710  *         if self.debug:             # <<<<<<<<<<<<<<
2711  *             print "Closing MIDI output stream and destroying instance."
2712  *
2713  */
2714   }
2715 
2716   /* "pygame/pypm.pyx":314
2717  *             print "Closing MIDI output stream and destroying instance."
2718  *
2719  *         if self.midi and _pypm_initialized:             # <<<<<<<<<<<<<<
2720  *             err = Pm_Close(self.midi)
2721  *             if err < 0:
2722  */
2723   __pyx_t_2 = (__pyx_v_self->midi != 0);
2724   if (__pyx_t_2) {
2725   } else {
2726     __pyx_t_1 = __pyx_t_2;
2727     goto __pyx_L5_bool_binop_done;
2728   }
2729   __pyx_t_2 = (__pyx_v_6pygame_4pypm__pypm_initialized != 0);
2730   __pyx_t_1 = __pyx_t_2;
2731   __pyx_L5_bool_binop_done:;
2732   if (__pyx_t_1) {
2733 
2734     /* "pygame/pypm.pyx":315
2735  *
2736  *         if self.midi and _pypm_initialized:
2737  *             err = Pm_Close(self.midi)             # <<<<<<<<<<<<<<
2738  *             if err < 0:
2739  *                 raise Exception(Pm_GetErrorText(err))
2740  */
2741     __pyx_v_err = Pm_Close(__pyx_v_self->midi);
2742 
2743     /* "pygame/pypm.pyx":316
2744  *         if self.midi and _pypm_initialized:
2745  *             err = Pm_Close(self.midi)
2746  *             if err < 0:             # <<<<<<<<<<<<<<
2747  *                 raise Exception(Pm_GetErrorText(err))
2748  *
2749  */
2750     __pyx_t_1 = ((__pyx_v_err < 0) != 0);
2751     if (unlikely(__pyx_t_1)) {
2752 
2753       /* "pygame/pypm.pyx":317
2754  *             err = Pm_Close(self.midi)
2755  *             if err < 0:
2756  *                 raise Exception(Pm_GetErrorText(err))             # <<<<<<<<<<<<<<
2757  *
2758  *     def _check_open(self):
2759  */
2760       __pyx_t_3 = __Pyx_PyBytes_FromString(Pm_GetErrorText(__pyx_v_err)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 317, __pyx_L1_error)
2761       __Pyx_GOTREF(__pyx_t_3);
2762       __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 317, __pyx_L1_error)
2763       __Pyx_GOTREF(__pyx_t_4);
2764       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2765       __Pyx_Raise(__pyx_t_4, 0, 0, 0);
2766       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2767       __PYX_ERR(0, 317, __pyx_L1_error)
2768 
2769       /* "pygame/pypm.pyx":316
2770  *         if self.midi and _pypm_initialized:
2771  *             err = Pm_Close(self.midi)
2772  *             if err < 0:             # <<<<<<<<<<<<<<
2773  *                 raise Exception(Pm_GetErrorText(err))
2774  *
2775  */
2776     }
2777 
2778     /* "pygame/pypm.pyx":314
2779  *             print "Closing MIDI output stream and destroying instance."
2780  *
2781  *         if self.midi and _pypm_initialized:             # <<<<<<<<<<<<<<
2782  *             err = Pm_Close(self.midi)
2783  *             if err < 0:
2784  */
2785   }
2786 
2787   /* "pygame/pypm.pyx":306
2788  *                     output_device, errmsg)
2789  *
2790  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
2791  *         """Close midi device if still open when the instance is destroyed."""
2792  *
2793  */
2794 
2795   /* function exit code */
2796   goto __pyx_L0;
2797   __pyx_L1_error:;
2798   __Pyx_XDECREF(__pyx_t_3);
2799   __Pyx_XDECREF(__pyx_t_4);
2800   __Pyx_WriteUnraisable("pygame.pypm.Output.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
2801   __pyx_L0:;
2802   __Pyx_RefNannyFinishContext();
2803 }
2804 
2805 /* "pygame/pypm.pyx":319
2806  *                 raise Exception(Pm_GetErrorText(err))
2807  *
2808  *     def _check_open(self):             # <<<<<<<<<<<<<<
2809  *         """Check whether midi device is open, and if not, raises an error.
2810  *
2811  */
2812 
2813 /* Python wrapper */
2814 static PyObject *__pyx_pw_6pygame_4pypm_6Output_5_check_open(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
2815 static char __pyx_doc_6pygame_4pypm_6Output_4_check_open[] = "Check whether midi device is open, and if not, raises an error.\n\n        Internal method, should be used only by other methods of this class.\n\n        ";
__pyx_pw_6pygame_4pypm_6Output_5_check_open(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)2816 static PyObject *__pyx_pw_6pygame_4pypm_6Output_5_check_open(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
2817   PyObject *__pyx_r = 0;
2818   __Pyx_RefNannyDeclarations
2819   __Pyx_RefNannySetupContext("_check_open (wrapper)", 0);
2820   __pyx_r = __pyx_pf_6pygame_4pypm_6Output_4_check_open(((struct __pyx_obj_6pygame_4pypm_Output *)__pyx_v_self));
2821 
2822   /* function exit code */
2823   __Pyx_RefNannyFinishContext();
2824   return __pyx_r;
2825 }
2826 
__pyx_pf_6pygame_4pypm_6Output_4_check_open(struct __pyx_obj_6pygame_4pypm_Output * __pyx_v_self)2827 static PyObject *__pyx_pf_6pygame_4pypm_6Output_4_check_open(struct __pyx_obj_6pygame_4pypm_Output *__pyx_v_self) {
2828   PyObject *__pyx_r = NULL;
2829   __Pyx_RefNannyDeclarations
2830   int __pyx_t_1;
2831   PyObject *__pyx_t_2 = NULL;
2832   int __pyx_lineno = 0;
2833   const char *__pyx_filename = NULL;
2834   int __pyx_clineno = 0;
2835   __Pyx_RefNannySetupContext("_check_open", 0);
2836 
2837   /* "pygame/pypm.pyx":326
2838  *         """
2839  *
2840  *         if self.midi == NULL:             # <<<<<<<<<<<<<<
2841  *             raise Exception("midi Output not open.")
2842  *
2843  */
2844   __pyx_t_1 = ((__pyx_v_self->midi == NULL) != 0);
2845   if (unlikely(__pyx_t_1)) {
2846 
2847     /* "pygame/pypm.pyx":327
2848  *
2849  *         if self.midi == NULL:
2850  *             raise Exception("midi Output not open.")             # <<<<<<<<<<<<<<
2851  *
2852  *         if self._aborted:
2853  */
2854     __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple_, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 327, __pyx_L1_error)
2855     __Pyx_GOTREF(__pyx_t_2);
2856     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
2857     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2858     __PYX_ERR(0, 327, __pyx_L1_error)
2859 
2860     /* "pygame/pypm.pyx":326
2861  *         """
2862  *
2863  *         if self.midi == NULL:             # <<<<<<<<<<<<<<
2864  *             raise Exception("midi Output not open.")
2865  *
2866  */
2867   }
2868 
2869   /* "pygame/pypm.pyx":329
2870  *             raise Exception("midi Output not open.")
2871  *
2872  *         if self._aborted:             # <<<<<<<<<<<<<<
2873  *             raise Exception(
2874  *                 "midi Output aborted. Need to call Close after Abort.")
2875  */
2876   __pyx_t_1 = (__pyx_v_self->_aborted != 0);
2877   if (unlikely(__pyx_t_1)) {
2878 
2879     /* "pygame/pypm.pyx":330
2880  *
2881  *         if self._aborted:
2882  *             raise Exception(             # <<<<<<<<<<<<<<
2883  *                 "midi Output aborted. Need to call Close after Abort.")
2884  *
2885  */
2886     __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 330, __pyx_L1_error)
2887     __Pyx_GOTREF(__pyx_t_2);
2888     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
2889     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2890     __PYX_ERR(0, 330, __pyx_L1_error)
2891 
2892     /* "pygame/pypm.pyx":329
2893  *             raise Exception("midi Output not open.")
2894  *
2895  *         if self._aborted:             # <<<<<<<<<<<<<<
2896  *             raise Exception(
2897  *                 "midi Output aborted. Need to call Close after Abort.")
2898  */
2899   }
2900 
2901   /* "pygame/pypm.pyx":319
2902  *                 raise Exception(Pm_GetErrorText(err))
2903  *
2904  *     def _check_open(self):             # <<<<<<<<<<<<<<
2905  *         """Check whether midi device is open, and if not, raises an error.
2906  *
2907  */
2908 
2909   /* function exit code */
2910   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2911   goto __pyx_L0;
2912   __pyx_L1_error:;
2913   __Pyx_XDECREF(__pyx_t_2);
2914   __Pyx_AddTraceback("pygame.pypm.Output._check_open", __pyx_clineno, __pyx_lineno, __pyx_filename);
2915   __pyx_r = NULL;
2916   __pyx_L0:;
2917   __Pyx_XGIVEREF(__pyx_r);
2918   __Pyx_RefNannyFinishContext();
2919   return __pyx_r;
2920 }
2921 
2922 /* "pygame/pypm.pyx":333
2923  *                 "midi Output aborted. Need to call Close after Abort.")
2924  *
2925  *     def Close(self):             # <<<<<<<<<<<<<<
2926  *         """Close the midi output device, flushing any pending buffers.
2927  *
2928  */
2929 
2930 /* Python wrapper */
2931 static PyObject *__pyx_pw_6pygame_4pypm_6Output_7Close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
2932 static char __pyx_doc_6pygame_4pypm_6Output_6Close[] = "Close the midi output device, flushing any pending buffers.\n\n        PortMidi attempts to close open streams when the application exits --\n        this is particularly difficult under Windows, so it is best to take\n        care to close all devices explicitly.\n\n        ";
__pyx_pw_6pygame_4pypm_6Output_7Close(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)2933 static PyObject *__pyx_pw_6pygame_4pypm_6Output_7Close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
2934   PyObject *__pyx_r = 0;
2935   __Pyx_RefNannyDeclarations
2936   __Pyx_RefNannySetupContext("Close (wrapper)", 0);
2937   __pyx_r = __pyx_pf_6pygame_4pypm_6Output_6Close(((struct __pyx_obj_6pygame_4pypm_Output *)__pyx_v_self));
2938 
2939   /* function exit code */
2940   __Pyx_RefNannyFinishContext();
2941   return __pyx_r;
2942 }
2943 
__pyx_pf_6pygame_4pypm_6Output_6Close(struct __pyx_obj_6pygame_4pypm_Output * __pyx_v_self)2944 static PyObject *__pyx_pf_6pygame_4pypm_6Output_6Close(struct __pyx_obj_6pygame_4pypm_Output *__pyx_v_self) {
2945   PmError __pyx_v_err;
2946   PyObject *__pyx_r = NULL;
2947   __Pyx_RefNannyDeclarations
2948   int __pyx_t_1;
2949   int __pyx_t_2;
2950   PyObject *__pyx_t_3 = NULL;
2951   PyObject *__pyx_t_4 = NULL;
2952   int __pyx_lineno = 0;
2953   const char *__pyx_filename = NULL;
2954   int __pyx_clineno = 0;
2955   __Pyx_RefNannySetupContext("Close", 0);
2956 
2957   /* "pygame/pypm.pyx":343
2958  *         cdef PmError err
2959  *
2960  *         if not self.midi or not _pypm_initialized:             # <<<<<<<<<<<<<<
2961  *             return
2962  *
2963  */
2964   __pyx_t_2 = ((!(__pyx_v_self->midi != 0)) != 0);
2965   if (!__pyx_t_2) {
2966   } else {
2967     __pyx_t_1 = __pyx_t_2;
2968     goto __pyx_L4_bool_binop_done;
2969   }
2970   __pyx_t_2 = ((!(__pyx_v_6pygame_4pypm__pypm_initialized != 0)) != 0);
2971   __pyx_t_1 = __pyx_t_2;
2972   __pyx_L4_bool_binop_done:;
2973   if (__pyx_t_1) {
2974 
2975     /* "pygame/pypm.pyx":344
2976  *
2977  *         if not self.midi or not _pypm_initialized:
2978  *             return             # <<<<<<<<<<<<<<
2979  *
2980  *         err = Pm_Close(self.midi)
2981  */
2982     __Pyx_XDECREF(__pyx_r);
2983     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2984     goto __pyx_L0;
2985 
2986     /* "pygame/pypm.pyx":343
2987  *         cdef PmError err
2988  *
2989  *         if not self.midi or not _pypm_initialized:             # <<<<<<<<<<<<<<
2990  *             return
2991  *
2992  */
2993   }
2994 
2995   /* "pygame/pypm.pyx":346
2996  *             return
2997  *
2998  *         err = Pm_Close(self.midi)             # <<<<<<<<<<<<<<
2999  *         if err < 0:
3000  *             raise Exception(Pm_GetErrorText(err))
3001  */
3002   __pyx_v_err = Pm_Close(__pyx_v_self->midi);
3003 
3004   /* "pygame/pypm.pyx":347
3005  *
3006  *         err = Pm_Close(self.midi)
3007  *         if err < 0:             # <<<<<<<<<<<<<<
3008  *             raise Exception(Pm_GetErrorText(err))
3009  *
3010  */
3011   __pyx_t_1 = ((__pyx_v_err < 0) != 0);
3012   if (unlikely(__pyx_t_1)) {
3013 
3014     /* "pygame/pypm.pyx":348
3015  *         err = Pm_Close(self.midi)
3016  *         if err < 0:
3017  *             raise Exception(Pm_GetErrorText(err))             # <<<<<<<<<<<<<<
3018  *
3019  *         self.midi = NULL
3020  */
3021     __pyx_t_3 = __Pyx_PyBytes_FromString(Pm_GetErrorText(__pyx_v_err)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 348, __pyx_L1_error)
3022     __Pyx_GOTREF(__pyx_t_3);
3023     __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 348, __pyx_L1_error)
3024     __Pyx_GOTREF(__pyx_t_4);
3025     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3026     __Pyx_Raise(__pyx_t_4, 0, 0, 0);
3027     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3028     __PYX_ERR(0, 348, __pyx_L1_error)
3029 
3030     /* "pygame/pypm.pyx":347
3031  *
3032  *         err = Pm_Close(self.midi)
3033  *         if err < 0:             # <<<<<<<<<<<<<<
3034  *             raise Exception(Pm_GetErrorText(err))
3035  *
3036  */
3037   }
3038 
3039   /* "pygame/pypm.pyx":350
3040  *             raise Exception(Pm_GetErrorText(err))
3041  *
3042  *         self.midi = NULL             # <<<<<<<<<<<<<<
3043  *
3044  *     def Abort(self):
3045  */
3046   __pyx_v_self->midi = NULL;
3047 
3048   /* "pygame/pypm.pyx":333
3049  *                 "midi Output aborted. Need to call Close after Abort.")
3050  *
3051  *     def Close(self):             # <<<<<<<<<<<<<<
3052  *         """Close the midi output device, flushing any pending buffers.
3053  *
3054  */
3055 
3056   /* function exit code */
3057   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3058   goto __pyx_L0;
3059   __pyx_L1_error:;
3060   __Pyx_XDECREF(__pyx_t_3);
3061   __Pyx_XDECREF(__pyx_t_4);
3062   __Pyx_AddTraceback("pygame.pypm.Output.Close", __pyx_clineno, __pyx_lineno, __pyx_filename);
3063   __pyx_r = NULL;
3064   __pyx_L0:;
3065   __Pyx_XGIVEREF(__pyx_r);
3066   __Pyx_RefNannyFinishContext();
3067   return __pyx_r;
3068 }
3069 
3070 /* "pygame/pypm.pyx":352
3071  *         self.midi = NULL
3072  *
3073  *     def Abort(self):             # <<<<<<<<<<<<<<
3074  *         """Terminate outgoing messages immediately.
3075  *
3076  */
3077 
3078 /* Python wrapper */
3079 static PyObject *__pyx_pw_6pygame_4pypm_6Output_9Abort(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
3080 static char __pyx_doc_6pygame_4pypm_6Output_8Abort[] = "Terminate outgoing messages immediately.\n\n        The caller should immediately close the output port after calling this\n        method. This call may result in transmission of a partial midi message.\n        There is no abort for Midi input because the user can simply ignore\n        messages in the buffer and close an input device at any time.\n\n        ";
__pyx_pw_6pygame_4pypm_6Output_9Abort(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)3081 static PyObject *__pyx_pw_6pygame_4pypm_6Output_9Abort(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
3082   PyObject *__pyx_r = 0;
3083   __Pyx_RefNannyDeclarations
3084   __Pyx_RefNannySetupContext("Abort (wrapper)", 0);
3085   __pyx_r = __pyx_pf_6pygame_4pypm_6Output_8Abort(((struct __pyx_obj_6pygame_4pypm_Output *)__pyx_v_self));
3086 
3087   /* function exit code */
3088   __Pyx_RefNannyFinishContext();
3089   return __pyx_r;
3090 }
3091 
__pyx_pf_6pygame_4pypm_6Output_8Abort(struct __pyx_obj_6pygame_4pypm_Output * __pyx_v_self)3092 static PyObject *__pyx_pf_6pygame_4pypm_6Output_8Abort(struct __pyx_obj_6pygame_4pypm_Output *__pyx_v_self) {
3093   PmError __pyx_v_err;
3094   PyObject *__pyx_r = NULL;
3095   __Pyx_RefNannyDeclarations
3096   int __pyx_t_1;
3097   PyObject *__pyx_t_2 = NULL;
3098   PyObject *__pyx_t_3 = NULL;
3099   int __pyx_lineno = 0;
3100   const char *__pyx_filename = NULL;
3101   int __pyx_clineno = 0;
3102   __Pyx_RefNannySetupContext("Abort", 0);
3103 
3104   /* "pygame/pypm.pyx":363
3105  *         cdef PmError err
3106  *
3107  *         if not self.midi:             # <<<<<<<<<<<<<<
3108  *             return
3109  *
3110  */
3111   __pyx_t_1 = ((!(__pyx_v_self->midi != 0)) != 0);
3112   if (__pyx_t_1) {
3113 
3114     /* "pygame/pypm.pyx":364
3115  *
3116  *         if not self.midi:
3117  *             return             # <<<<<<<<<<<<<<
3118  *
3119  *         err = Pm_Abort(self.midi)
3120  */
3121     __Pyx_XDECREF(__pyx_r);
3122     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3123     goto __pyx_L0;
3124 
3125     /* "pygame/pypm.pyx":363
3126  *         cdef PmError err
3127  *
3128  *         if not self.midi:             # <<<<<<<<<<<<<<
3129  *             return
3130  *
3131  */
3132   }
3133 
3134   /* "pygame/pypm.pyx":366
3135  *             return
3136  *
3137  *         err = Pm_Abort(self.midi)             # <<<<<<<<<<<<<<
3138  *         if err < 0:
3139  *             raise Exception(Pm_GetErrorText(err))
3140  */
3141   __pyx_v_err = Pm_Abort(__pyx_v_self->midi);
3142 
3143   /* "pygame/pypm.pyx":367
3144  *
3145  *         err = Pm_Abort(self.midi)
3146  *         if err < 0:             # <<<<<<<<<<<<<<
3147  *             raise Exception(Pm_GetErrorText(err))
3148  *
3149  */
3150   __pyx_t_1 = ((__pyx_v_err < 0) != 0);
3151   if (unlikely(__pyx_t_1)) {
3152 
3153     /* "pygame/pypm.pyx":368
3154  *         err = Pm_Abort(self.midi)
3155  *         if err < 0:
3156  *             raise Exception(Pm_GetErrorText(err))             # <<<<<<<<<<<<<<
3157  *
3158  *         self._aborted = 1
3159  */
3160     __pyx_t_2 = __Pyx_PyBytes_FromString(Pm_GetErrorText(__pyx_v_err)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 368, __pyx_L1_error)
3161     __Pyx_GOTREF(__pyx_t_2);
3162     __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 368, __pyx_L1_error)
3163     __Pyx_GOTREF(__pyx_t_3);
3164     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3165     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
3166     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3167     __PYX_ERR(0, 368, __pyx_L1_error)
3168 
3169     /* "pygame/pypm.pyx":367
3170  *
3171  *         err = Pm_Abort(self.midi)
3172  *         if err < 0:             # <<<<<<<<<<<<<<
3173  *             raise Exception(Pm_GetErrorText(err))
3174  *
3175  */
3176   }
3177 
3178   /* "pygame/pypm.pyx":370
3179  *             raise Exception(Pm_GetErrorText(err))
3180  *
3181  *         self._aborted = 1             # <<<<<<<<<<<<<<
3182  *
3183  *     def Write(self, data):
3184  */
3185   __pyx_v_self->_aborted = 1;
3186 
3187   /* "pygame/pypm.pyx":352
3188  *         self.midi = NULL
3189  *
3190  *     def Abort(self):             # <<<<<<<<<<<<<<
3191  *         """Terminate outgoing messages immediately.
3192  *
3193  */
3194 
3195   /* function exit code */
3196   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3197   goto __pyx_L0;
3198   __pyx_L1_error:;
3199   __Pyx_XDECREF(__pyx_t_2);
3200   __Pyx_XDECREF(__pyx_t_3);
3201   __Pyx_AddTraceback("pygame.pypm.Output.Abort", __pyx_clineno, __pyx_lineno, __pyx_filename);
3202   __pyx_r = NULL;
3203   __pyx_L0:;
3204   __Pyx_XGIVEREF(__pyx_r);
3205   __Pyx_RefNannyFinishContext();
3206   return __pyx_r;
3207 }
3208 
3209 /* "pygame/pypm.pyx":372
3210  *         self._aborted = 1
3211  *
3212  *     def Write(self, data):             # <<<<<<<<<<<<<<
3213  *         """Output a series of MIDI events given by data list n this device.
3214  *
3215  */
3216 
3217 /* Python wrapper */
3218 static PyObject *__pyx_pw_6pygame_4pypm_6Output_11Write(PyObject *__pyx_v_self, PyObject *__pyx_v_data); /*proto*/
3219 static char __pyx_doc_6pygame_4pypm_6Output_10Write[] = "Output a series of MIDI events given by data list n this device.\n\n        Usage::\n\n            Write([\n                [[status, data1, data2, data3], timestamp],\n                [[status, data1, data2, data3], timestamp],\n                ...\n            ])\n\n        The data1/2/3 items in each event are optional::\n\n           Write([[[0xc0, 0, 0], 20000]])\n\n        is equivalent to::\n\n           Write([[[0xc0], 20000]])\n\n        Example:\n\n        Send program change 1 at time 20000 and send note 65 with velocity 100\n        at 500 ms later::\n\n             Write([[[0xc0, 0, 0], 20000], [[0x90, 60, 100], 20500]])\n\n        .. notes::\n            1. Timestamps will be ignored if latency == 0.\n\n            2. To get a note to play immediately, send the note on event with\n               the result from the Time() function as the timestamp.\n\n        ";
__pyx_pw_6pygame_4pypm_6Output_11Write(PyObject * __pyx_v_self,PyObject * __pyx_v_data)3220 static PyObject *__pyx_pw_6pygame_4pypm_6Output_11Write(PyObject *__pyx_v_self, PyObject *__pyx_v_data) {
3221   PyObject *__pyx_r = 0;
3222   __Pyx_RefNannyDeclarations
3223   __Pyx_RefNannySetupContext("Write (wrapper)", 0);
3224   __pyx_r = __pyx_pf_6pygame_4pypm_6Output_10Write(((struct __pyx_obj_6pygame_4pypm_Output *)__pyx_v_self), ((PyObject *)__pyx_v_data));
3225 
3226   /* function exit code */
3227   __Pyx_RefNannyFinishContext();
3228   return __pyx_r;
3229 }
3230 
__pyx_pf_6pygame_4pypm_6Output_10Write(struct __pyx_obj_6pygame_4pypm_Output * __pyx_v_self,PyObject * __pyx_v_data)3231 static PyObject *__pyx_pf_6pygame_4pypm_6Output_10Write(struct __pyx_obj_6pygame_4pypm_Output *__pyx_v_self, PyObject *__pyx_v_data) {
3232   PmEvent __pyx_v_buffer[0x400];
3233   PmError __pyx_v_err;
3234   int __pyx_v_item;
3235   int __pyx_v_ev_no;
3236   PyObject *__pyx_v_event = NULL;
3237   PyObject *__pyx_r = NULL;
3238   __Pyx_RefNannyDeclarations
3239   PyObject *__pyx_t_1 = NULL;
3240   PyObject *__pyx_t_2 = NULL;
3241   PyObject *__pyx_t_3 = NULL;
3242   Py_ssize_t __pyx_t_4;
3243   int __pyx_t_5;
3244   int __pyx_t_6;
3245   PyObject *(*__pyx_t_7)(PyObject *);
3246   int __pyx_t_8;
3247   Py_ssize_t __pyx_t_9;
3248   PyObject *__pyx_t_10 = NULL;
3249   Py_ssize_t __pyx_t_11;
3250   int __pyx_t_12;
3251   int __pyx_t_13;
3252   PyObject *__pyx_t_14 = NULL;
3253   PmMessage __pyx_t_15;
3254   PmTimestamp __pyx_t_16;
3255   int __pyx_lineno = 0;
3256   const char *__pyx_filename = NULL;
3257   int __pyx_clineno = 0;
3258   __Pyx_RefNannySetupContext("Write", 0);
3259 
3260   /* "pygame/pypm.pyx":410
3261  *         cdef int ev_no
3262  *
3263  *         self._check_open()             # <<<<<<<<<<<<<<
3264  *
3265  *         if len(data) > 1024:
3266  */
3267   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_check_open); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 410, __pyx_L1_error)
3268   __Pyx_GOTREF(__pyx_t_2);
3269   __pyx_t_3 = NULL;
3270   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
3271     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
3272     if (likely(__pyx_t_3)) {
3273       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
3274       __Pyx_INCREF(__pyx_t_3);
3275       __Pyx_INCREF(function);
3276       __Pyx_DECREF_SET(__pyx_t_2, function);
3277     }
3278   }
3279   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
3280   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3281   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 410, __pyx_L1_error)
3282   __Pyx_GOTREF(__pyx_t_1);
3283   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3284   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3285 
3286   /* "pygame/pypm.pyx":412
3287  *         self._check_open()
3288  *
3289  *         if len(data) > 1024:             # <<<<<<<<<<<<<<
3290  *             raise IndexError('Maximum event list length is 1024.')
3291  *         else:
3292  */
3293   __pyx_t_4 = PyObject_Length(__pyx_v_data); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 412, __pyx_L1_error)
3294   __pyx_t_5 = ((__pyx_t_4 > 0x400) != 0);
3295   if (unlikely(__pyx_t_5)) {
3296 
3297     /* "pygame/pypm.pyx":413
3298  *
3299  *         if len(data) > 1024:
3300  *             raise IndexError('Maximum event list length is 1024.')             # <<<<<<<<<<<<<<
3301  *         else:
3302  *             for ev_no, event in enumerate(data):
3303  */
3304     __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 413, __pyx_L1_error)
3305     __Pyx_GOTREF(__pyx_t_1);
3306     __Pyx_Raise(__pyx_t_1, 0, 0, 0);
3307     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3308     __PYX_ERR(0, 413, __pyx_L1_error)
3309 
3310     /* "pygame/pypm.pyx":412
3311  *         self._check_open()
3312  *
3313  *         if len(data) > 1024:             # <<<<<<<<<<<<<<
3314  *             raise IndexError('Maximum event list length is 1024.')
3315  *         else:
3316  */
3317   }
3318 
3319   /* "pygame/pypm.pyx":415
3320  *             raise IndexError('Maximum event list length is 1024.')
3321  *         else:
3322  *             for ev_no, event in enumerate(data):             # <<<<<<<<<<<<<<
3323  *                 if not event[0]:
3324  *                     raise ValueError('No data in event no. %i.' % ev_no)
3325  */
3326   /*else*/ {
3327     __pyx_t_6 = 0;
3328     if (likely(PyList_CheckExact(__pyx_v_data)) || PyTuple_CheckExact(__pyx_v_data)) {
3329       __pyx_t_1 = __pyx_v_data; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0;
3330       __pyx_t_7 = NULL;
3331     } else {
3332       __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 415, __pyx_L1_error)
3333       __Pyx_GOTREF(__pyx_t_1);
3334       __pyx_t_7 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 415, __pyx_L1_error)
3335     }
3336     for (;;) {
3337       if (likely(!__pyx_t_7)) {
3338         if (likely(PyList_CheckExact(__pyx_t_1))) {
3339           if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
3340           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3341           __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 415, __pyx_L1_error)
3342           #else
3343           __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 415, __pyx_L1_error)
3344           __Pyx_GOTREF(__pyx_t_2);
3345           #endif
3346         } else {
3347           if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
3348           #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3349           __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 415, __pyx_L1_error)
3350           #else
3351           __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 415, __pyx_L1_error)
3352           __Pyx_GOTREF(__pyx_t_2);
3353           #endif
3354         }
3355       } else {
3356         __pyx_t_2 = __pyx_t_7(__pyx_t_1);
3357         if (unlikely(!__pyx_t_2)) {
3358           PyObject* exc_type = PyErr_Occurred();
3359           if (exc_type) {
3360             if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
3361             else __PYX_ERR(0, 415, __pyx_L1_error)
3362           }
3363           break;
3364         }
3365         __Pyx_GOTREF(__pyx_t_2);
3366       }
3367       __Pyx_XDECREF_SET(__pyx_v_event, __pyx_t_2);
3368       __pyx_t_2 = 0;
3369       __pyx_v_ev_no = __pyx_t_6;
3370       __pyx_t_6 = (__pyx_t_6 + 1);
3371 
3372       /* "pygame/pypm.pyx":416
3373  *         else:
3374  *             for ev_no, event in enumerate(data):
3375  *                 if not event[0]:             # <<<<<<<<<<<<<<
3376  *                     raise ValueError('No data in event no. %i.' % ev_no)
3377  *                 if len(event[0]) > 4:
3378  */
3379       __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_event, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 416, __pyx_L1_error)
3380       __Pyx_GOTREF(__pyx_t_2);
3381       __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 416, __pyx_L1_error)
3382       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3383       __pyx_t_8 = ((!__pyx_t_5) != 0);
3384       if (unlikely(__pyx_t_8)) {
3385 
3386         /* "pygame/pypm.pyx":417
3387  *             for ev_no, event in enumerate(data):
3388  *                 if not event[0]:
3389  *                     raise ValueError('No data in event no. %i.' % ev_no)             # <<<<<<<<<<<<<<
3390  *                 if len(event[0]) > 4:
3391  *                     raise ValueError('Too many data bytes (%i) in event no. %i.'
3392  */
3393         __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_ev_no); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 417, __pyx_L1_error)
3394         __Pyx_GOTREF(__pyx_t_2);
3395         __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_No_data_in_event_no_i, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 417, __pyx_L1_error)
3396         __Pyx_GOTREF(__pyx_t_3);
3397         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3398         __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 417, __pyx_L1_error)
3399         __Pyx_GOTREF(__pyx_t_2);
3400         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3401         __Pyx_Raise(__pyx_t_2, 0, 0, 0);
3402         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3403         __PYX_ERR(0, 417, __pyx_L1_error)
3404 
3405         /* "pygame/pypm.pyx":416
3406  *         else:
3407  *             for ev_no, event in enumerate(data):
3408  *                 if not event[0]:             # <<<<<<<<<<<<<<
3409  *                     raise ValueError('No data in event no. %i.' % ev_no)
3410  *                 if len(event[0]) > 4:
3411  */
3412       }
3413 
3414       /* "pygame/pypm.pyx":418
3415  *                 if not event[0]:
3416  *                     raise ValueError('No data in event no. %i.' % ev_no)
3417  *                 if len(event[0]) > 4:             # <<<<<<<<<<<<<<
3418  *                     raise ValueError('Too many data bytes (%i) in event no. %i.'
3419  *                         % (len(event[0]), ev_no))
3420  */
3421       __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_event, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 418, __pyx_L1_error)
3422       __Pyx_GOTREF(__pyx_t_2);
3423       __pyx_t_9 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 418, __pyx_L1_error)
3424       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3425       __pyx_t_8 = ((__pyx_t_9 > 4) != 0);
3426       if (unlikely(__pyx_t_8)) {
3427 
3428         /* "pygame/pypm.pyx":420
3429  *                 if len(event[0]) > 4:
3430  *                     raise ValueError('Too many data bytes (%i) in event no. %i.'
3431  *                         % (len(event[0]), ev_no))             # <<<<<<<<<<<<<<
3432  *
3433  *                 buffer[ev_no].message = 0
3434  */
3435         __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_event, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 420, __pyx_L1_error)
3436         __Pyx_GOTREF(__pyx_t_2);
3437         __pyx_t_9 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 420, __pyx_L1_error)
3438         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3439         __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 420, __pyx_L1_error)
3440         __Pyx_GOTREF(__pyx_t_2);
3441         __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_ev_no); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 420, __pyx_L1_error)
3442         __Pyx_GOTREF(__pyx_t_3);
3443         __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 420, __pyx_L1_error)
3444         __Pyx_GOTREF(__pyx_t_10);
3445         __Pyx_GIVEREF(__pyx_t_2);
3446         PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2);
3447         __Pyx_GIVEREF(__pyx_t_3);
3448         PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_3);
3449         __pyx_t_2 = 0;
3450         __pyx_t_3 = 0;
3451         __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_Too_many_data_bytes_i_in_event_n, __pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 420, __pyx_L1_error)
3452         __Pyx_GOTREF(__pyx_t_3);
3453         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3454 
3455         /* "pygame/pypm.pyx":419
3456  *                     raise ValueError('No data in event no. %i.' % ev_no)
3457  *                 if len(event[0]) > 4:
3458  *                     raise ValueError('Too many data bytes (%i) in event no. %i.'             # <<<<<<<<<<<<<<
3459  *                         % (len(event[0]), ev_no))
3460  *
3461  */
3462         __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 419, __pyx_L1_error)
3463         __Pyx_GOTREF(__pyx_t_10);
3464         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3465         __Pyx_Raise(__pyx_t_10, 0, 0, 0);
3466         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3467         __PYX_ERR(0, 419, __pyx_L1_error)
3468 
3469         /* "pygame/pypm.pyx":418
3470  *                 if not event[0]:
3471  *                     raise ValueError('No data in event no. %i.' % ev_no)
3472  *                 if len(event[0]) > 4:             # <<<<<<<<<<<<<<
3473  *                     raise ValueError('Too many data bytes (%i) in event no. %i.'
3474  *                         % (len(event[0]), ev_no))
3475  */
3476       }
3477 
3478       /* "pygame/pypm.pyx":422
3479  *                         % (len(event[0]), ev_no))
3480  *
3481  *                 buffer[ev_no].message = 0             # <<<<<<<<<<<<<<
3482  *
3483  *                 for item in range(len(event[0])):
3484  */
3485       (__pyx_v_buffer[__pyx_v_ev_no]).message = 0;
3486 
3487       /* "pygame/pypm.pyx":424
3488  *                 buffer[ev_no].message = 0
3489  *
3490  *                 for item in range(len(event[0])):             # <<<<<<<<<<<<<<
3491  *                     buffer[ev_no].message += (
3492  *                         (event[0][item] & 0xFF) << (8 * item))
3493  */
3494       __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_event, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 424, __pyx_L1_error)
3495       __Pyx_GOTREF(__pyx_t_10);
3496       __pyx_t_9 = PyObject_Length(__pyx_t_10); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 424, __pyx_L1_error)
3497       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3498       __pyx_t_11 = __pyx_t_9;
3499       for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
3500         __pyx_v_item = __pyx_t_12;
3501 
3502         /* "pygame/pypm.pyx":425
3503  *
3504  *                 for item in range(len(event[0])):
3505  *                     buffer[ev_no].message += (             # <<<<<<<<<<<<<<
3506  *                         (event[0][item] & 0xFF) << (8 * item))
3507  *
3508  */
3509         __pyx_t_13 = __pyx_v_ev_no;
3510         __pyx_t_10 = __Pyx_PyInt_From_PmMessage((__pyx_v_buffer[__pyx_t_13]).message); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 425, __pyx_L1_error)
3511         __Pyx_GOTREF(__pyx_t_10);
3512 
3513         /* "pygame/pypm.pyx":426
3514  *                 for item in range(len(event[0])):
3515  *                     buffer[ev_no].message += (
3516  *                         (event[0][item] & 0xFF) << (8 * item))             # <<<<<<<<<<<<<<
3517  *
3518  *                 buffer[ev_no].timestamp = event[1]
3519  */
3520         __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_event, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 426, __pyx_L1_error)
3521         __Pyx_GOTREF(__pyx_t_3);
3522         __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, __pyx_v_item, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 426, __pyx_L1_error)
3523         __Pyx_GOTREF(__pyx_t_2);
3524         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3525         __pyx_t_3 = __Pyx_PyInt_AndObjC(__pyx_t_2, __pyx_int_255, 0xFF, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 426, __pyx_L1_error)
3526         __Pyx_GOTREF(__pyx_t_3);
3527         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3528         __pyx_t_2 = __Pyx_PyInt_From_long((8 * __pyx_v_item)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 426, __pyx_L1_error)
3529         __Pyx_GOTREF(__pyx_t_2);
3530         __pyx_t_14 = PyNumber_Lshift(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 426, __pyx_L1_error)
3531         __Pyx_GOTREF(__pyx_t_14);
3532         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3533         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3534 
3535         /* "pygame/pypm.pyx":425
3536  *
3537  *                 for item in range(len(event[0])):
3538  *                     buffer[ev_no].message += (             # <<<<<<<<<<<<<<
3539  *                         (event[0][item] & 0xFF) << (8 * item))
3540  *
3541  */
3542         __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_t_10, __pyx_t_14); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 425, __pyx_L1_error)
3543         __Pyx_GOTREF(__pyx_t_2);
3544         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3545         __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
3546         __pyx_t_15 = __Pyx_PyInt_As_PmMessage(__pyx_t_2); if (unlikely((__pyx_t_15 == ((PmMessage)-1)) && PyErr_Occurred())) __PYX_ERR(0, 425, __pyx_L1_error)
3547         __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3548         (__pyx_v_buffer[__pyx_t_13]).message = __pyx_t_15;
3549       }
3550 
3551       /* "pygame/pypm.pyx":428
3552  *                         (event[0][item] & 0xFF) << (8 * item))
3553  *
3554  *                 buffer[ev_no].timestamp = event[1]             # <<<<<<<<<<<<<<
3555  *
3556  *                 if self.debug:
3557  */
3558       __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_event, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 428, __pyx_L1_error)
3559       __Pyx_GOTREF(__pyx_t_2);
3560       __pyx_t_16 = __Pyx_PyInt_As_PmTimestamp(__pyx_t_2); if (unlikely((__pyx_t_16 == ((PmTimestamp)-1)) && PyErr_Occurred())) __PYX_ERR(0, 428, __pyx_L1_error)
3561       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3562       (__pyx_v_buffer[__pyx_v_ev_no]).timestamp = __pyx_t_16;
3563 
3564       /* "pygame/pypm.pyx":430
3565  *                 buffer[ev_no].timestamp = event[1]
3566  *
3567  *                 if self.debug:             # <<<<<<<<<<<<<<
3568  *                     print "%i : %r : %s" % (
3569  *                         ev_no, buffer[ev_no].message, buffer[ev_no].timestamp)
3570  */
3571       __pyx_t_8 = (__pyx_v_self->debug != 0);
3572       if (__pyx_t_8) {
3573 
3574         /* "pygame/pypm.pyx":432
3575  *                 if self.debug:
3576  *                     print "%i : %r : %s" % (
3577  *                         ev_no, buffer[ev_no].message, buffer[ev_no].timestamp)             # <<<<<<<<<<<<<<
3578  *
3579  *         if self.debug:
3580  */
3581         __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_ev_no); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 432, __pyx_L1_error)
3582         __Pyx_GOTREF(__pyx_t_2);
3583         __pyx_t_14 = __Pyx_PyInt_From_PmMessage((__pyx_v_buffer[__pyx_v_ev_no]).message); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 432, __pyx_L1_error)
3584         __Pyx_GOTREF(__pyx_t_14);
3585         __pyx_t_10 = __Pyx_PyInt_From_PmTimestamp((__pyx_v_buffer[__pyx_v_ev_no]).timestamp); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 432, __pyx_L1_error)
3586         __Pyx_GOTREF(__pyx_t_10);
3587         __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 432, __pyx_L1_error)
3588         __Pyx_GOTREF(__pyx_t_3);
3589         __Pyx_GIVEREF(__pyx_t_2);
3590         PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
3591         __Pyx_GIVEREF(__pyx_t_14);
3592         PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_14);
3593         __Pyx_GIVEREF(__pyx_t_10);
3594         PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_10);
3595         __pyx_t_2 = 0;
3596         __pyx_t_14 = 0;
3597         __pyx_t_10 = 0;
3598 
3599         /* "pygame/pypm.pyx":431
3600  *
3601  *                 if self.debug:
3602  *                     print "%i : %r : %s" % (             # <<<<<<<<<<<<<<
3603  *                         ev_no, buffer[ev_no].message, buffer[ev_no].timestamp)
3604  *
3605  */
3606         __pyx_t_10 = __Pyx_PyString_Format(__pyx_kp_s_i_r_s, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 431, __pyx_L1_error)
3607         __Pyx_GOTREF(__pyx_t_10);
3608         __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3609         if (__Pyx_PrintOne(0, __pyx_t_10) < 0) __PYX_ERR(0, 431, __pyx_L1_error)
3610         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3611 
3612         /* "pygame/pypm.pyx":430
3613  *                 buffer[ev_no].timestamp = event[1]
3614  *
3615  *                 if self.debug:             # <<<<<<<<<<<<<<
3616  *                     print "%i : %r : %s" % (
3617  *                         ev_no, buffer[ev_no].message, buffer[ev_no].timestamp)
3618  */
3619       }
3620 
3621       /* "pygame/pypm.pyx":415
3622  *             raise IndexError('Maximum event list length is 1024.')
3623  *         else:
3624  *             for ev_no, event in enumerate(data):             # <<<<<<<<<<<<<<
3625  *                 if not event[0]:
3626  *                     raise ValueError('No data in event no. %i.' % ev_no)
3627  */
3628     }
3629     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3630   }
3631 
3632   /* "pygame/pypm.pyx":434
3633  *                         ev_no, buffer[ev_no].message, buffer[ev_no].timestamp)
3634  *
3635  *         if self.debug:             # <<<<<<<<<<<<<<
3636  *             print "Writing to midi buffer."
3637  *         err = Pm_Write(self.midi, buffer, len(data))
3638  */
3639   __pyx_t_8 = (__pyx_v_self->debug != 0);
3640   if (__pyx_t_8) {
3641 
3642     /* "pygame/pypm.pyx":435
3643  *
3644  *         if self.debug:
3645  *             print "Writing to midi buffer."             # <<<<<<<<<<<<<<
3646  *         err = Pm_Write(self.midi, buffer, len(data))
3647  *         if err < 0:
3648  */
3649     if (__Pyx_PrintOne(0, __pyx_kp_s_Writing_to_midi_buffer) < 0) __PYX_ERR(0, 435, __pyx_L1_error)
3650 
3651     /* "pygame/pypm.pyx":434
3652  *                         ev_no, buffer[ev_no].message, buffer[ev_no].timestamp)
3653  *
3654  *         if self.debug:             # <<<<<<<<<<<<<<
3655  *             print "Writing to midi buffer."
3656  *         err = Pm_Write(self.midi, buffer, len(data))
3657  */
3658   }
3659 
3660   /* "pygame/pypm.pyx":436
3661  *         if self.debug:
3662  *             print "Writing to midi buffer."
3663  *         err = Pm_Write(self.midi, buffer, len(data))             # <<<<<<<<<<<<<<
3664  *         if err < 0:
3665  *             raise Exception(Pm_GetErrorText(err))
3666  */
3667   __pyx_t_4 = PyObject_Length(__pyx_v_data); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 436, __pyx_L1_error)
3668   __pyx_v_err = Pm_Write(__pyx_v_self->midi, __pyx_v_buffer, __pyx_t_4);
3669 
3670   /* "pygame/pypm.pyx":437
3671  *             print "Writing to midi buffer."
3672  *         err = Pm_Write(self.midi, buffer, len(data))
3673  *         if err < 0:             # <<<<<<<<<<<<<<
3674  *             raise Exception(Pm_GetErrorText(err))
3675  *
3676  */
3677   __pyx_t_8 = ((__pyx_v_err < 0) != 0);
3678   if (unlikely(__pyx_t_8)) {
3679 
3680     /* "pygame/pypm.pyx":438
3681  *         err = Pm_Write(self.midi, buffer, len(data))
3682  *         if err < 0:
3683  *             raise Exception(Pm_GetErrorText(err))             # <<<<<<<<<<<<<<
3684  *
3685  *     def WriteShort(self, status, data1=0, data2=0):
3686  */
3687     __pyx_t_1 = __Pyx_PyBytes_FromString(Pm_GetErrorText(__pyx_v_err)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 438, __pyx_L1_error)
3688     __Pyx_GOTREF(__pyx_t_1);
3689     __pyx_t_10 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 438, __pyx_L1_error)
3690     __Pyx_GOTREF(__pyx_t_10);
3691     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3692     __Pyx_Raise(__pyx_t_10, 0, 0, 0);
3693     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
3694     __PYX_ERR(0, 438, __pyx_L1_error)
3695 
3696     /* "pygame/pypm.pyx":437
3697  *             print "Writing to midi buffer."
3698  *         err = Pm_Write(self.midi, buffer, len(data))
3699  *         if err < 0:             # <<<<<<<<<<<<<<
3700  *             raise Exception(Pm_GetErrorText(err))
3701  *
3702  */
3703   }
3704 
3705   /* "pygame/pypm.pyx":372
3706  *         self._aborted = 1
3707  *
3708  *     def Write(self, data):             # <<<<<<<<<<<<<<
3709  *         """Output a series of MIDI events given by data list n this device.
3710  *
3711  */
3712 
3713   /* function exit code */
3714   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3715   goto __pyx_L0;
3716   __pyx_L1_error:;
3717   __Pyx_XDECREF(__pyx_t_1);
3718   __Pyx_XDECREF(__pyx_t_2);
3719   __Pyx_XDECREF(__pyx_t_3);
3720   __Pyx_XDECREF(__pyx_t_10);
3721   __Pyx_XDECREF(__pyx_t_14);
3722   __Pyx_AddTraceback("pygame.pypm.Output.Write", __pyx_clineno, __pyx_lineno, __pyx_filename);
3723   __pyx_r = NULL;
3724   __pyx_L0:;
3725   __Pyx_XDECREF(__pyx_v_event);
3726   __Pyx_XGIVEREF(__pyx_r);
3727   __Pyx_RefNannyFinishContext();
3728   return __pyx_r;
3729 }
3730 
3731 /* "pygame/pypm.pyx":440
3732  *             raise Exception(Pm_GetErrorText(err))
3733  *
3734  *     def WriteShort(self, status, data1=0, data2=0):             # <<<<<<<<<<<<<<
3735  *         """Output MIDI event of three bytes or less immediately on this device.
3736  *
3737  */
3738 
3739 /* Python wrapper */
3740 static PyObject *__pyx_pw_6pygame_4pypm_6Output_13WriteShort(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3741 static char __pyx_doc_6pygame_4pypm_6Output_12WriteShort[] = "Output MIDI event of three bytes or less immediately on this device.\n\n        Usage::\n\n            WriteShort(status, data1, data2)\n\n        status must be a valid MIDI status byte, for example:\n\n        0xCx = Program Change\n        0xBx = Controller Change\n        0x9x = Note On\n\n        where x is the MIDI channel number 0 - 0xF.\n\n        The data1 and data2 arguments are optional and assumed to be 0 if\n        omitted.\n\n        Example:\n\n        Send note 65 on with velocity 100::\n\n             WriteShort(0x90, 65, 100)\n\n        ";
__pyx_pw_6pygame_4pypm_6Output_13WriteShort(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)3742 static PyObject *__pyx_pw_6pygame_4pypm_6Output_13WriteShort(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3743   PyObject *__pyx_v_status = 0;
3744   PyObject *__pyx_v_data1 = 0;
3745   PyObject *__pyx_v_data2 = 0;
3746   int __pyx_lineno = 0;
3747   const char *__pyx_filename = NULL;
3748   int __pyx_clineno = 0;
3749   PyObject *__pyx_r = 0;
3750   __Pyx_RefNannyDeclarations
3751   __Pyx_RefNannySetupContext("WriteShort (wrapper)", 0);
3752   {
3753     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_status,&__pyx_n_s_data1,&__pyx_n_s_data2,0};
3754     PyObject* values[3] = {0,0,0};
3755     values[1] = ((PyObject *)__pyx_int_0);
3756     values[2] = ((PyObject *)__pyx_int_0);
3757     if (unlikely(__pyx_kwds)) {
3758       Py_ssize_t kw_args;
3759       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3760       switch (pos_args) {
3761         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3762         CYTHON_FALLTHROUGH;
3763         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3764         CYTHON_FALLTHROUGH;
3765         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3766         CYTHON_FALLTHROUGH;
3767         case  0: break;
3768         default: goto __pyx_L5_argtuple_error;
3769       }
3770       kw_args = PyDict_Size(__pyx_kwds);
3771       switch (pos_args) {
3772         case  0:
3773         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_status)) != 0)) kw_args--;
3774         else goto __pyx_L5_argtuple_error;
3775         CYTHON_FALLTHROUGH;
3776         case  1:
3777         if (kw_args > 0) {
3778           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data1);
3779           if (value) { values[1] = value; kw_args--; }
3780         }
3781         CYTHON_FALLTHROUGH;
3782         case  2:
3783         if (kw_args > 0) {
3784           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data2);
3785           if (value) { values[2] = value; kw_args--; }
3786         }
3787       }
3788       if (unlikely(kw_args > 0)) {
3789         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "WriteShort") < 0)) __PYX_ERR(0, 440, __pyx_L3_error)
3790       }
3791     } else {
3792       switch (PyTuple_GET_SIZE(__pyx_args)) {
3793         case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3794         CYTHON_FALLTHROUGH;
3795         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3796         CYTHON_FALLTHROUGH;
3797         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3798         break;
3799         default: goto __pyx_L5_argtuple_error;
3800       }
3801     }
3802     __pyx_v_status = values[0];
3803     __pyx_v_data1 = values[1];
3804     __pyx_v_data2 = values[2];
3805   }
3806   goto __pyx_L4_argument_unpacking_done;
3807   __pyx_L5_argtuple_error:;
3808   __Pyx_RaiseArgtupleInvalid("WriteShort", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 440, __pyx_L3_error)
3809   __pyx_L3_error:;
3810   __Pyx_AddTraceback("pygame.pypm.Output.WriteShort", __pyx_clineno, __pyx_lineno, __pyx_filename);
3811   __Pyx_RefNannyFinishContext();
3812   return NULL;
3813   __pyx_L4_argument_unpacking_done:;
3814   __pyx_r = __pyx_pf_6pygame_4pypm_6Output_12WriteShort(((struct __pyx_obj_6pygame_4pypm_Output *)__pyx_v_self), __pyx_v_status, __pyx_v_data1, __pyx_v_data2);
3815 
3816   /* function exit code */
3817   __Pyx_RefNannyFinishContext();
3818   return __pyx_r;
3819 }
3820 
__pyx_pf_6pygame_4pypm_6Output_12WriteShort(struct __pyx_obj_6pygame_4pypm_Output * __pyx_v_self,PyObject * __pyx_v_status,PyObject * __pyx_v_data1,PyObject * __pyx_v_data2)3821 static PyObject *__pyx_pf_6pygame_4pypm_6Output_12WriteShort(struct __pyx_obj_6pygame_4pypm_Output *__pyx_v_self, PyObject *__pyx_v_status, PyObject *__pyx_v_data1, PyObject *__pyx_v_data2) {
3822   PmEvent __pyx_v_buffer[1];
3823   PmError __pyx_v_err;
3824   PyObject *__pyx_r = NULL;
3825   __Pyx_RefNannyDeclarations
3826   PyObject *__pyx_t_1 = NULL;
3827   PyObject *__pyx_t_2 = NULL;
3828   PyObject *__pyx_t_3 = NULL;
3829   PmMessage __pyx_t_4;
3830   int __pyx_t_5;
3831   int __pyx_lineno = 0;
3832   const char *__pyx_filename = NULL;
3833   int __pyx_clineno = 0;
3834   __Pyx_RefNannySetupContext("WriteShort", 0);
3835 
3836   /* "pygame/pypm.pyx":468
3837  *         cdef PmError err
3838  *
3839  *         self._check_open()             # <<<<<<<<<<<<<<
3840  *
3841  *         buffer[0].timestamp = Pt_Time()
3842  */
3843   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_check_open); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 468, __pyx_L1_error)
3844   __Pyx_GOTREF(__pyx_t_2);
3845   __pyx_t_3 = NULL;
3846   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
3847     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
3848     if (likely(__pyx_t_3)) {
3849       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
3850       __Pyx_INCREF(__pyx_t_3);
3851       __Pyx_INCREF(function);
3852       __Pyx_DECREF_SET(__pyx_t_2, function);
3853     }
3854   }
3855   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
3856   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3857   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 468, __pyx_L1_error)
3858   __Pyx_GOTREF(__pyx_t_1);
3859   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3860   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3861 
3862   /* "pygame/pypm.pyx":470
3863  *         self._check_open()
3864  *
3865  *         buffer[0].timestamp = Pt_Time()             # <<<<<<<<<<<<<<
3866  *         buffer[0].message = (((data2 << 16) & 0xFF0000) |
3867  *             ((data1 << 8) & 0xFF00) | (status & 0xFF))
3868  */
3869   (__pyx_v_buffer[0]).timestamp = Pt_Time();
3870 
3871   /* "pygame/pypm.pyx":471
3872  *
3873  *         buffer[0].timestamp = Pt_Time()
3874  *         buffer[0].message = (((data2 << 16) & 0xFF0000) |             # <<<<<<<<<<<<<<
3875  *             ((data1 << 8) & 0xFF00) | (status & 0xFF))
3876  *
3877  */
3878   __pyx_t_1 = __Pyx_PyInt_LshiftObjC(__pyx_v_data2, __pyx_int_16, 16, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 471, __pyx_L1_error)
3879   __Pyx_GOTREF(__pyx_t_1);
3880   __pyx_t_2 = __Pyx_PyInt_AndObjC(__pyx_t_1, __pyx_int_16711680, 0xFF0000, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 471, __pyx_L1_error)
3881   __Pyx_GOTREF(__pyx_t_2);
3882   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3883 
3884   /* "pygame/pypm.pyx":472
3885  *         buffer[0].timestamp = Pt_Time()
3886  *         buffer[0].message = (((data2 << 16) & 0xFF0000) |
3887  *             ((data1 << 8) & 0xFF00) | (status & 0xFF))             # <<<<<<<<<<<<<<
3888  *
3889  *         if self.debug:
3890  */
3891   __pyx_t_1 = __Pyx_PyInt_LshiftObjC(__pyx_v_data1, __pyx_int_8, 8, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 472, __pyx_L1_error)
3892   __Pyx_GOTREF(__pyx_t_1);
3893   __pyx_t_3 = __Pyx_PyInt_AndObjC(__pyx_t_1, __pyx_int_65280, 0xFF00, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 472, __pyx_L1_error)
3894   __Pyx_GOTREF(__pyx_t_3);
3895   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3896 
3897   /* "pygame/pypm.pyx":471
3898  *
3899  *         buffer[0].timestamp = Pt_Time()
3900  *         buffer[0].message = (((data2 << 16) & 0xFF0000) |             # <<<<<<<<<<<<<<
3901  *             ((data1 << 8) & 0xFF00) | (status & 0xFF))
3902  *
3903  */
3904   __pyx_t_1 = PyNumber_Or(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 471, __pyx_L1_error)
3905   __Pyx_GOTREF(__pyx_t_1);
3906   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3907   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3908 
3909   /* "pygame/pypm.pyx":472
3910  *         buffer[0].timestamp = Pt_Time()
3911  *         buffer[0].message = (((data2 << 16) & 0xFF0000) |
3912  *             ((data1 << 8) & 0xFF00) | (status & 0xFF))             # <<<<<<<<<<<<<<
3913  *
3914  *         if self.debug:
3915  */
3916   __pyx_t_3 = __Pyx_PyInt_AndObjC(__pyx_v_status, __pyx_int_255, 0xFF, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 472, __pyx_L1_error)
3917   __Pyx_GOTREF(__pyx_t_3);
3918   __pyx_t_2 = PyNumber_Or(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 472, __pyx_L1_error)
3919   __Pyx_GOTREF(__pyx_t_2);
3920   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3921   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3922   __pyx_t_4 = __Pyx_PyInt_As_PmMessage(__pyx_t_2); if (unlikely((__pyx_t_4 == ((PmMessage)-1)) && PyErr_Occurred())) __PYX_ERR(0, 472, __pyx_L1_error)
3923   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3924 
3925   /* "pygame/pypm.pyx":471
3926  *
3927  *         buffer[0].timestamp = Pt_Time()
3928  *         buffer[0].message = (((data2 << 16) & 0xFF0000) |             # <<<<<<<<<<<<<<
3929  *             ((data1 << 8) & 0xFF00) | (status & 0xFF))
3930  *
3931  */
3932   (__pyx_v_buffer[0]).message = __pyx_t_4;
3933 
3934   /* "pygame/pypm.pyx":474
3935  *             ((data1 << 8) & 0xFF00) | (status & 0xFF))
3936  *
3937  *         if self.debug:             # <<<<<<<<<<<<<<
3938  *             print "Writing to MIDI buffer."
3939  *         err = Pm_Write(self.midi, buffer, 1) # stream, buffer, length
3940  */
3941   __pyx_t_5 = (__pyx_v_self->debug != 0);
3942   if (__pyx_t_5) {
3943 
3944     /* "pygame/pypm.pyx":475
3945  *
3946  *         if self.debug:
3947  *             print "Writing to MIDI buffer."             # <<<<<<<<<<<<<<
3948  *         err = Pm_Write(self.midi, buffer, 1) # stream, buffer, length
3949  *         if err < 0:
3950  */
3951     if (__Pyx_PrintOne(0, __pyx_kp_s_Writing_to_MIDI_buffer) < 0) __PYX_ERR(0, 475, __pyx_L1_error)
3952 
3953     /* "pygame/pypm.pyx":474
3954  *             ((data1 << 8) & 0xFF00) | (status & 0xFF))
3955  *
3956  *         if self.debug:             # <<<<<<<<<<<<<<
3957  *             print "Writing to MIDI buffer."
3958  *         err = Pm_Write(self.midi, buffer, 1) # stream, buffer, length
3959  */
3960   }
3961 
3962   /* "pygame/pypm.pyx":476
3963  *         if self.debug:
3964  *             print "Writing to MIDI buffer."
3965  *         err = Pm_Write(self.midi, buffer, 1) # stream, buffer, length             # <<<<<<<<<<<<<<
3966  *         if err < 0:
3967  *             raise Exception(Pm_GetErrorText(err))
3968  */
3969   __pyx_v_err = Pm_Write(__pyx_v_self->midi, __pyx_v_buffer, 1);
3970 
3971   /* "pygame/pypm.pyx":477
3972  *             print "Writing to MIDI buffer."
3973  *         err = Pm_Write(self.midi, buffer, 1) # stream, buffer, length
3974  *         if err < 0:             # <<<<<<<<<<<<<<
3975  *             raise Exception(Pm_GetErrorText(err))
3976  *
3977  */
3978   __pyx_t_5 = ((__pyx_v_err < 0) != 0);
3979   if (unlikely(__pyx_t_5)) {
3980 
3981     /* "pygame/pypm.pyx":478
3982  *         err = Pm_Write(self.midi, buffer, 1) # stream, buffer, length
3983  *         if err < 0:
3984  *             raise Exception(Pm_GetErrorText(err))             # <<<<<<<<<<<<<<
3985  *
3986  *     def WriteSysEx(self, when, msg):
3987  */
3988     __pyx_t_2 = __Pyx_PyBytes_FromString(Pm_GetErrorText(__pyx_v_err)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 478, __pyx_L1_error)
3989     __Pyx_GOTREF(__pyx_t_2);
3990     __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 478, __pyx_L1_error)
3991     __Pyx_GOTREF(__pyx_t_3);
3992     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3993     __Pyx_Raise(__pyx_t_3, 0, 0, 0);
3994     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3995     __PYX_ERR(0, 478, __pyx_L1_error)
3996 
3997     /* "pygame/pypm.pyx":477
3998  *             print "Writing to MIDI buffer."
3999  *         err = Pm_Write(self.midi, buffer, 1) # stream, buffer, length
4000  *         if err < 0:             # <<<<<<<<<<<<<<
4001  *             raise Exception(Pm_GetErrorText(err))
4002  *
4003  */
4004   }
4005 
4006   /* "pygame/pypm.pyx":440
4007  *             raise Exception(Pm_GetErrorText(err))
4008  *
4009  *     def WriteShort(self, status, data1=0, data2=0):             # <<<<<<<<<<<<<<
4010  *         """Output MIDI event of three bytes or less immediately on this device.
4011  *
4012  */
4013 
4014   /* function exit code */
4015   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4016   goto __pyx_L0;
4017   __pyx_L1_error:;
4018   __Pyx_XDECREF(__pyx_t_1);
4019   __Pyx_XDECREF(__pyx_t_2);
4020   __Pyx_XDECREF(__pyx_t_3);
4021   __Pyx_AddTraceback("pygame.pypm.Output.WriteShort", __pyx_clineno, __pyx_lineno, __pyx_filename);
4022   __pyx_r = NULL;
4023   __pyx_L0:;
4024   __Pyx_XGIVEREF(__pyx_r);
4025   __Pyx_RefNannyFinishContext();
4026   return __pyx_r;
4027 }
4028 
4029 /* "pygame/pypm.pyx":480
4030  *             raise Exception(Pm_GetErrorText(err))
4031  *
4032  *     def WriteSysEx(self, when, msg):             # <<<<<<<<<<<<<<
4033  *         """Output a timestamped system-exclusive MIDI message on this device.
4034  *
4035  */
4036 
4037 /* Python wrapper */
4038 static PyObject *__pyx_pw_6pygame_4pypm_6Output_15WriteSysEx(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4039 static char __pyx_doc_6pygame_4pypm_6Output_14WriteSysEx[] = "Output a timestamped system-exclusive MIDI message on this device.\n\n        Usage::\n\n            WriteSysEx(<timestamp>, <msg>)\n\n        <msg> can be a *list* or a *string*\n\n        Example (assuming 'out' is an output MIDI stream):\n\n            out.WriteSysEx(0, '\\xF0\\x7D\\x10\\x11\\x12\\x13\\xF7')\n\n        This is equivalent to::\n\n            out.WriteSysEx(pypm.Time(),\n                [0xF0, 0x7D, 0x10, 0x11, 0x12, 0x13, 0xF7])\n\n        ";
__pyx_pw_6pygame_4pypm_6Output_15WriteSysEx(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)4040 static PyObject *__pyx_pw_6pygame_4pypm_6Output_15WriteSysEx(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4041   PyObject *__pyx_v_when = 0;
4042   PyObject *__pyx_v_msg = 0;
4043   int __pyx_lineno = 0;
4044   const char *__pyx_filename = NULL;
4045   int __pyx_clineno = 0;
4046   PyObject *__pyx_r = 0;
4047   __Pyx_RefNannyDeclarations
4048   __Pyx_RefNannySetupContext("WriteSysEx (wrapper)", 0);
4049   {
4050     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_when,&__pyx_n_s_msg,0};
4051     PyObject* values[2] = {0,0};
4052     if (unlikely(__pyx_kwds)) {
4053       Py_ssize_t kw_args;
4054       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4055       switch (pos_args) {
4056         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4057         CYTHON_FALLTHROUGH;
4058         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4059         CYTHON_FALLTHROUGH;
4060         case  0: break;
4061         default: goto __pyx_L5_argtuple_error;
4062       }
4063       kw_args = PyDict_Size(__pyx_kwds);
4064       switch (pos_args) {
4065         case  0:
4066         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_when)) != 0)) kw_args--;
4067         else goto __pyx_L5_argtuple_error;
4068         CYTHON_FALLTHROUGH;
4069         case  1:
4070         if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_msg)) != 0)) kw_args--;
4071         else {
4072           __Pyx_RaiseArgtupleInvalid("WriteSysEx", 1, 2, 2, 1); __PYX_ERR(0, 480, __pyx_L3_error)
4073         }
4074       }
4075       if (unlikely(kw_args > 0)) {
4076         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "WriteSysEx") < 0)) __PYX_ERR(0, 480, __pyx_L3_error)
4077       }
4078     } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
4079       goto __pyx_L5_argtuple_error;
4080     } else {
4081       values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4082       values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4083     }
4084     __pyx_v_when = values[0];
4085     __pyx_v_msg = values[1];
4086   }
4087   goto __pyx_L4_argument_unpacking_done;
4088   __pyx_L5_argtuple_error:;
4089   __Pyx_RaiseArgtupleInvalid("WriteSysEx", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 480, __pyx_L3_error)
4090   __pyx_L3_error:;
4091   __Pyx_AddTraceback("pygame.pypm.Output.WriteSysEx", __pyx_clineno, __pyx_lineno, __pyx_filename);
4092   __Pyx_RefNannyFinishContext();
4093   return NULL;
4094   __pyx_L4_argument_unpacking_done:;
4095   __pyx_r = __pyx_pf_6pygame_4pypm_6Output_14WriteSysEx(((struct __pyx_obj_6pygame_4pypm_Output *)__pyx_v_self), __pyx_v_when, __pyx_v_msg);
4096 
4097   /* function exit code */
4098   __Pyx_RefNannyFinishContext();
4099   return __pyx_r;
4100 }
4101 
__pyx_pf_6pygame_4pypm_6Output_14WriteSysEx(struct __pyx_obj_6pygame_4pypm_Output * __pyx_v_self,PyObject * __pyx_v_when,PyObject * __pyx_v_msg)4102 static PyObject *__pyx_pf_6pygame_4pypm_6Output_14WriteSysEx(struct __pyx_obj_6pygame_4pypm_Output *__pyx_v_self, PyObject *__pyx_v_when, PyObject *__pyx_v_msg) {
4103   PmError __pyx_v_err;
4104   char *__pyx_v_cmsg;
4105   PtTimestamp __pyx_v_cur_time;
4106   PyObject *__pyx_v_arr = NULL;
4107   PyObject *__pyx_r = NULL;
4108   __Pyx_RefNannyDeclarations
4109   PyObject *__pyx_t_1 = NULL;
4110   PyObject *__pyx_t_2 = NULL;
4111   PyObject *__pyx_t_3 = NULL;
4112   int __pyx_t_4;
4113   int __pyx_t_5;
4114   int __pyx_t_6;
4115   PyObject *__pyx_t_7 = NULL;
4116   char *__pyx_t_8;
4117   PmTimestamp __pyx_t_9;
4118   int __pyx_lineno = 0;
4119   const char *__pyx_filename = NULL;
4120   int __pyx_clineno = 0;
4121   __Pyx_RefNannySetupContext("WriteSysEx", 0);
4122   __Pyx_INCREF(__pyx_v_msg);
4123 
4124   /* "pygame/pypm.pyx":503
4125  *         cdef PtTimestamp cur_time
4126  *
4127  *         self._check_open()             # <<<<<<<<<<<<<<
4128  *
4129  *         if type(msg) is list:
4130  */
4131   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_check_open); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 503, __pyx_L1_error)
4132   __Pyx_GOTREF(__pyx_t_2);
4133   __pyx_t_3 = NULL;
4134   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
4135     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
4136     if (likely(__pyx_t_3)) {
4137       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
4138       __Pyx_INCREF(__pyx_t_3);
4139       __Pyx_INCREF(function);
4140       __Pyx_DECREF_SET(__pyx_t_2, function);
4141     }
4142   }
4143   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
4144   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4145   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 503, __pyx_L1_error)
4146   __Pyx_GOTREF(__pyx_t_1);
4147   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4148   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4149 
4150   /* "pygame/pypm.pyx":505
4151  *         self._check_open()
4152  *
4153  *         if type(msg) is list:             # <<<<<<<<<<<<<<
4154  *             # Markus Pfaff contribution
4155  *             arr = array.array('B', msg)
4156  */
4157   __pyx_t_4 = (((PyObject *)Py_TYPE(__pyx_v_msg)) == ((PyObject *)(&PyList_Type)));
4158   __pyx_t_5 = (__pyx_t_4 != 0);
4159   if (__pyx_t_5) {
4160 
4161     /* "pygame/pypm.pyx":507
4162  *         if type(msg) is list:
4163  *             # Markus Pfaff contribution
4164  *             arr = array.array('B', msg)             # <<<<<<<<<<<<<<
4165  *             if sys.version_info[0] == 3:
4166  *                 msg = arr.tobytes()
4167  */
4168     __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_array); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 507, __pyx_L1_error)
4169     __Pyx_GOTREF(__pyx_t_2);
4170     __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_array); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 507, __pyx_L1_error)
4171     __Pyx_GOTREF(__pyx_t_3);
4172     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4173     __pyx_t_2 = NULL;
4174     __pyx_t_6 = 0;
4175     if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
4176       __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
4177       if (likely(__pyx_t_2)) {
4178         PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
4179         __Pyx_INCREF(__pyx_t_2);
4180         __Pyx_INCREF(function);
4181         __Pyx_DECREF_SET(__pyx_t_3, function);
4182         __pyx_t_6 = 1;
4183       }
4184     }
4185     #if CYTHON_FAST_PYCALL
4186     if (PyFunction_Check(__pyx_t_3)) {
4187       PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_n_s_B, __pyx_v_msg};
4188       __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 507, __pyx_L1_error)
4189       __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
4190       __Pyx_GOTREF(__pyx_t_1);
4191     } else
4192     #endif
4193     #if CYTHON_FAST_PYCCALL
4194     if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
4195       PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_n_s_B, __pyx_v_msg};
4196       __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 507, __pyx_L1_error)
4197       __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
4198       __Pyx_GOTREF(__pyx_t_1);
4199     } else
4200     #endif
4201     {
4202       __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 507, __pyx_L1_error)
4203       __Pyx_GOTREF(__pyx_t_7);
4204       if (__pyx_t_2) {
4205         __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2); __pyx_t_2 = NULL;
4206       }
4207       __Pyx_INCREF(__pyx_n_s_B);
4208       __Pyx_GIVEREF(__pyx_n_s_B);
4209       PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_n_s_B);
4210       __Pyx_INCREF(__pyx_v_msg);
4211       __Pyx_GIVEREF(__pyx_v_msg);
4212       PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_msg);
4213       __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 507, __pyx_L1_error)
4214       __Pyx_GOTREF(__pyx_t_1);
4215       __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
4216     }
4217     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4218     __pyx_v_arr = __pyx_t_1;
4219     __pyx_t_1 = 0;
4220 
4221     /* "pygame/pypm.pyx":508
4222  *             # Markus Pfaff contribution
4223  *             arr = array.array('B', msg)
4224  *             if sys.version_info[0] == 3:             # <<<<<<<<<<<<<<
4225  *                 msg = arr.tobytes()
4226  *             else:
4227  */
4228     __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_sys); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 508, __pyx_L1_error)
4229     __Pyx_GOTREF(__pyx_t_1);
4230     __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_version_info); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 508, __pyx_L1_error)
4231     __Pyx_GOTREF(__pyx_t_3);
4232     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4233     __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 508, __pyx_L1_error)
4234     __Pyx_GOTREF(__pyx_t_1);
4235     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4236     __pyx_t_3 = __Pyx_PyInt_EqObjC(__pyx_t_1, __pyx_int_3, 3, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 508, __pyx_L1_error)
4237     __Pyx_GOTREF(__pyx_t_3);
4238     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4239     __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 508, __pyx_L1_error)
4240     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4241     if (__pyx_t_5) {
4242 
4243       /* "pygame/pypm.pyx":509
4244  *             arr = array.array('B', msg)
4245  *             if sys.version_info[0] == 3:
4246  *                 msg = arr.tobytes()             # <<<<<<<<<<<<<<
4247  *             else:
4248  *                 msg = arr.tostring()
4249  */
4250       __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_arr, __pyx_n_s_tobytes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 509, __pyx_L1_error)
4251       __Pyx_GOTREF(__pyx_t_1);
4252       __pyx_t_7 = NULL;
4253       if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
4254         __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1);
4255         if (likely(__pyx_t_7)) {
4256           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
4257           __Pyx_INCREF(__pyx_t_7);
4258           __Pyx_INCREF(function);
4259           __Pyx_DECREF_SET(__pyx_t_1, function);
4260         }
4261       }
4262       __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
4263       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
4264       if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 509, __pyx_L1_error)
4265       __Pyx_GOTREF(__pyx_t_3);
4266       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4267       __Pyx_DECREF_SET(__pyx_v_msg, __pyx_t_3);
4268       __pyx_t_3 = 0;
4269 
4270       /* "pygame/pypm.pyx":508
4271  *             # Markus Pfaff contribution
4272  *             arr = array.array('B', msg)
4273  *             if sys.version_info[0] == 3:             # <<<<<<<<<<<<<<
4274  *                 msg = arr.tobytes()
4275  *             else:
4276  */
4277       goto __pyx_L4;
4278     }
4279 
4280     /* "pygame/pypm.pyx":511
4281  *                 msg = arr.tobytes()
4282  *             else:
4283  *                 msg = arr.tostring()             # <<<<<<<<<<<<<<
4284  *         cmsg = msg
4285  *
4286  */
4287     /*else*/ {
4288       __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_arr, __pyx_n_s_tostring); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 511, __pyx_L1_error)
4289       __Pyx_GOTREF(__pyx_t_1);
4290       __pyx_t_7 = NULL;
4291       if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
4292         __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1);
4293         if (likely(__pyx_t_7)) {
4294           PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
4295           __Pyx_INCREF(__pyx_t_7);
4296           __Pyx_INCREF(function);
4297           __Pyx_DECREF_SET(__pyx_t_1, function);
4298         }
4299       }
4300       __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
4301       __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
4302       if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 511, __pyx_L1_error)
4303       __Pyx_GOTREF(__pyx_t_3);
4304       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4305       __Pyx_DECREF_SET(__pyx_v_msg, __pyx_t_3);
4306       __pyx_t_3 = 0;
4307     }
4308     __pyx_L4:;
4309 
4310     /* "pygame/pypm.pyx":505
4311  *         self._check_open()
4312  *
4313  *         if type(msg) is list:             # <<<<<<<<<<<<<<
4314  *             # Markus Pfaff contribution
4315  *             arr = array.array('B', msg)
4316  */
4317   }
4318 
4319   /* "pygame/pypm.pyx":512
4320  *             else:
4321  *                 msg = arr.tostring()
4322  *         cmsg = msg             # <<<<<<<<<<<<<<
4323  *
4324  *         cur_time = Pt_Time()
4325  */
4326   __pyx_t_8 = __Pyx_PyObject_AsWritableString(__pyx_v_msg); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 512, __pyx_L1_error)
4327   __pyx_v_cmsg = __pyx_t_8;
4328 
4329   /* "pygame/pypm.pyx":514
4330  *         cmsg = msg
4331  *
4332  *         cur_time = Pt_Time()             # <<<<<<<<<<<<<<
4333  *         err = Pm_WriteSysEx(self.midi, when, <unsigned char *> cmsg)
4334  *         if err < 0:
4335  */
4336   __pyx_v_cur_time = Pt_Time();
4337 
4338   /* "pygame/pypm.pyx":515
4339  *
4340  *         cur_time = Pt_Time()
4341  *         err = Pm_WriteSysEx(self.midi, when, <unsigned char *> cmsg)             # <<<<<<<<<<<<<<
4342  *         if err < 0:
4343  *             raise Exception(Pm_GetErrorText(err))
4344  */
4345   __pyx_t_9 = __Pyx_PyInt_As_PmTimestamp(__pyx_v_when); if (unlikely((__pyx_t_9 == ((PmTimestamp)-1)) && PyErr_Occurred())) __PYX_ERR(0, 515, __pyx_L1_error)
4346   __pyx_v_err = Pm_WriteSysEx(__pyx_v_self->midi, __pyx_t_9, ((unsigned char *)__pyx_v_cmsg));
4347 
4348   /* "pygame/pypm.pyx":516
4349  *         cur_time = Pt_Time()
4350  *         err = Pm_WriteSysEx(self.midi, when, <unsigned char *> cmsg)
4351  *         if err < 0:             # <<<<<<<<<<<<<<
4352  *             raise Exception(Pm_GetErrorText(err))
4353  *
4354  */
4355   __pyx_t_5 = ((__pyx_v_err < 0) != 0);
4356   if (unlikely(__pyx_t_5)) {
4357 
4358     /* "pygame/pypm.pyx":517
4359  *         err = Pm_WriteSysEx(self.midi, when, <unsigned char *> cmsg)
4360  *         if err < 0:
4361  *             raise Exception(Pm_GetErrorText(err))             # <<<<<<<<<<<<<<
4362  *
4363  *         # wait for SysEx to go thru or...
4364  */
4365     __pyx_t_3 = __Pyx_PyBytes_FromString(Pm_GetErrorText(__pyx_v_err)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 517, __pyx_L1_error)
4366     __Pyx_GOTREF(__pyx_t_3);
4367     __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 517, __pyx_L1_error)
4368     __Pyx_GOTREF(__pyx_t_1);
4369     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4370     __Pyx_Raise(__pyx_t_1, 0, 0, 0);
4371     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4372     __PYX_ERR(0, 517, __pyx_L1_error)
4373 
4374     /* "pygame/pypm.pyx":516
4375  *         cur_time = Pt_Time()
4376  *         err = Pm_WriteSysEx(self.midi, when, <unsigned char *> cmsg)
4377  *         if err < 0:             # <<<<<<<<<<<<<<
4378  *             raise Exception(Pm_GetErrorText(err))
4379  *
4380  */
4381   }
4382 
4383   /* "pygame/pypm.pyx":521
4384  *         # wait for SysEx to go thru or...
4385  *         # my win32 machine crashes w/ multiple SysEx
4386  *         while Pt_Time() == cur_time:             # <<<<<<<<<<<<<<
4387  *             pass
4388  *
4389  */
4390   while (1) {
4391     __pyx_t_5 = ((Pt_Time() == __pyx_v_cur_time) != 0);
4392     if (!__pyx_t_5) break;
4393   }
4394 
4395   /* "pygame/pypm.pyx":480
4396  *             raise Exception(Pm_GetErrorText(err))
4397  *
4398  *     def WriteSysEx(self, when, msg):             # <<<<<<<<<<<<<<
4399  *         """Output a timestamped system-exclusive MIDI message on this device.
4400  *
4401  */
4402 
4403   /* function exit code */
4404   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4405   goto __pyx_L0;
4406   __pyx_L1_error:;
4407   __Pyx_XDECREF(__pyx_t_1);
4408   __Pyx_XDECREF(__pyx_t_2);
4409   __Pyx_XDECREF(__pyx_t_3);
4410   __Pyx_XDECREF(__pyx_t_7);
4411   __Pyx_AddTraceback("pygame.pypm.Output.WriteSysEx", __pyx_clineno, __pyx_lineno, __pyx_filename);
4412   __pyx_r = NULL;
4413   __pyx_L0:;
4414   __Pyx_XDECREF(__pyx_v_arr);
4415   __Pyx_XDECREF(__pyx_v_msg);
4416   __Pyx_XGIVEREF(__pyx_r);
4417   __Pyx_RefNannyFinishContext();
4418   return __pyx_r;
4419 }
4420 
4421 /* "(tree fragment)":1
4422  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
4423  *     raise TypeError("self.midi cannot be converted to a Python object for pickling")
4424  * def __setstate_cython__(self, __pyx_state):
4425  */
4426 
4427 /* Python wrapper */
4428 static PyObject *__pyx_pw_6pygame_4pypm_6Output_17__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_6pygame_4pypm_6Output_17__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)4429 static PyObject *__pyx_pw_6pygame_4pypm_6Output_17__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
4430   PyObject *__pyx_r = 0;
4431   __Pyx_RefNannyDeclarations
4432   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
4433   __pyx_r = __pyx_pf_6pygame_4pypm_6Output_16__reduce_cython__(((struct __pyx_obj_6pygame_4pypm_Output *)__pyx_v_self));
4434 
4435   /* function exit code */
4436   __Pyx_RefNannyFinishContext();
4437   return __pyx_r;
4438 }
4439 
__pyx_pf_6pygame_4pypm_6Output_16__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pygame_4pypm_Output * __pyx_v_self)4440 static PyObject *__pyx_pf_6pygame_4pypm_6Output_16__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pygame_4pypm_Output *__pyx_v_self) {
4441   PyObject *__pyx_r = NULL;
4442   __Pyx_RefNannyDeclarations
4443   PyObject *__pyx_t_1 = NULL;
4444   int __pyx_lineno = 0;
4445   const char *__pyx_filename = NULL;
4446   int __pyx_clineno = 0;
4447   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
4448 
4449   /* "(tree fragment)":2
4450  * def __reduce_cython__(self):
4451  *     raise TypeError("self.midi cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
4452  * def __setstate_cython__(self, __pyx_state):
4453  *     raise TypeError("self.midi cannot be converted to a Python object for pickling")
4454  */
4455   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
4456   __Pyx_GOTREF(__pyx_t_1);
4457   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
4458   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4459   __PYX_ERR(1, 2, __pyx_L1_error)
4460 
4461   /* "(tree fragment)":1
4462  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
4463  *     raise TypeError("self.midi cannot be converted to a Python object for pickling")
4464  * def __setstate_cython__(self, __pyx_state):
4465  */
4466 
4467   /* function exit code */
4468   __pyx_L1_error:;
4469   __Pyx_XDECREF(__pyx_t_1);
4470   __Pyx_AddTraceback("pygame.pypm.Output.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4471   __pyx_r = NULL;
4472   __Pyx_XGIVEREF(__pyx_r);
4473   __Pyx_RefNannyFinishContext();
4474   return __pyx_r;
4475 }
4476 
4477 /* "(tree fragment)":3
4478  * def __reduce_cython__(self):
4479  *     raise TypeError("self.midi cannot be converted to a Python object for pickling")
4480  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
4481  *     raise TypeError("self.midi cannot be converted to a Python object for pickling")
4482  */
4483 
4484 /* Python wrapper */
4485 static PyObject *__pyx_pw_6pygame_4pypm_6Output_19__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw_6pygame_4pypm_6Output_19__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)4486 static PyObject *__pyx_pw_6pygame_4pypm_6Output_19__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
4487   PyObject *__pyx_r = 0;
4488   __Pyx_RefNannyDeclarations
4489   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
4490   __pyx_r = __pyx_pf_6pygame_4pypm_6Output_18__setstate_cython__(((struct __pyx_obj_6pygame_4pypm_Output *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
4491 
4492   /* function exit code */
4493   __Pyx_RefNannyFinishContext();
4494   return __pyx_r;
4495 }
4496 
__pyx_pf_6pygame_4pypm_6Output_18__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pygame_4pypm_Output * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)4497 static PyObject *__pyx_pf_6pygame_4pypm_6Output_18__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pygame_4pypm_Output *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
4498   PyObject *__pyx_r = NULL;
4499   __Pyx_RefNannyDeclarations
4500   PyObject *__pyx_t_1 = NULL;
4501   int __pyx_lineno = 0;
4502   const char *__pyx_filename = NULL;
4503   int __pyx_clineno = 0;
4504   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
4505 
4506   /* "(tree fragment)":4
4507  *     raise TypeError("self.midi cannot be converted to a Python object for pickling")
4508  * def __setstate_cython__(self, __pyx_state):
4509  *     raise TypeError("self.midi cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
4510  */
4511   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
4512   __Pyx_GOTREF(__pyx_t_1);
4513   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
4514   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4515   __PYX_ERR(1, 4, __pyx_L1_error)
4516 
4517   /* "(tree fragment)":3
4518  * def __reduce_cython__(self):
4519  *     raise TypeError("self.midi cannot be converted to a Python object for pickling")
4520  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
4521  *     raise TypeError("self.midi cannot be converted to a Python object for pickling")
4522  */
4523 
4524   /* function exit code */
4525   __pyx_L1_error:;
4526   __Pyx_XDECREF(__pyx_t_1);
4527   __Pyx_AddTraceback("pygame.pypm.Output.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4528   __pyx_r = NULL;
4529   __Pyx_XGIVEREF(__pyx_r);
4530   __Pyx_RefNannyFinishContext();
4531   return __pyx_r;
4532 }
4533 
4534 /* "pygame/pypm.pyx":537
4535  *     cdef int debug
4536  *
4537  *     def __init__(self, input_device, buffersize=4096):             # <<<<<<<<<<<<<<
4538  *         """Instantiate MIDI input stream object."""
4539  *
4540  */
4541 
4542 /* Python wrapper */
4543 static int __pyx_pw_6pygame_4pypm_5Input_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4544 static char __pyx_doc_6pygame_4pypm_5Input___init__[] = "Instantiate MIDI input stream object.";
4545 #if CYTHON_COMPILING_IN_CPYTHON
4546 struct wrapperbase __pyx_wrapperbase_6pygame_4pypm_5Input___init__;
4547 #endif
__pyx_pw_6pygame_4pypm_5Input_1__init__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)4548 static int __pyx_pw_6pygame_4pypm_5Input_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4549   PyObject *__pyx_v_input_device = 0;
4550   PyObject *__pyx_v_buffersize = 0;
4551   int __pyx_lineno = 0;
4552   const char *__pyx_filename = NULL;
4553   int __pyx_clineno = 0;
4554   int __pyx_r;
4555   __Pyx_RefNannyDeclarations
4556   __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
4557   {
4558     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_input_device,&__pyx_n_s_buffersize,0};
4559     PyObject* values[2] = {0,0};
4560     values[1] = ((PyObject *)__pyx_int_4096);
4561     if (unlikely(__pyx_kwds)) {
4562       Py_ssize_t kw_args;
4563       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4564       switch (pos_args) {
4565         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4566         CYTHON_FALLTHROUGH;
4567         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4568         CYTHON_FALLTHROUGH;
4569         case  0: break;
4570         default: goto __pyx_L5_argtuple_error;
4571       }
4572       kw_args = PyDict_Size(__pyx_kwds);
4573       switch (pos_args) {
4574         case  0:
4575         if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_input_device)) != 0)) kw_args--;
4576         else goto __pyx_L5_argtuple_error;
4577         CYTHON_FALLTHROUGH;
4578         case  1:
4579         if (kw_args > 0) {
4580           PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_buffersize);
4581           if (value) { values[1] = value; kw_args--; }
4582         }
4583       }
4584       if (unlikely(kw_args > 0)) {
4585         if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 537, __pyx_L3_error)
4586       }
4587     } else {
4588       switch (PyTuple_GET_SIZE(__pyx_args)) {
4589         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4590         CYTHON_FALLTHROUGH;
4591         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4592         break;
4593         default: goto __pyx_L5_argtuple_error;
4594       }
4595     }
4596     __pyx_v_input_device = values[0];
4597     __pyx_v_buffersize = values[1];
4598   }
4599   goto __pyx_L4_argument_unpacking_done;
4600   __pyx_L5_argtuple_error:;
4601   __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 537, __pyx_L3_error)
4602   __pyx_L3_error:;
4603   __Pyx_AddTraceback("pygame.pypm.Input.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4604   __Pyx_RefNannyFinishContext();
4605   return -1;
4606   __pyx_L4_argument_unpacking_done:;
4607   __pyx_r = __pyx_pf_6pygame_4pypm_5Input___init__(((struct __pyx_obj_6pygame_4pypm_Input *)__pyx_v_self), __pyx_v_input_device, __pyx_v_buffersize);
4608 
4609   /* function exit code */
4610   __Pyx_RefNannyFinishContext();
4611   return __pyx_r;
4612 }
4613 
__pyx_pf_6pygame_4pypm_5Input___init__(struct __pyx_obj_6pygame_4pypm_Input * __pyx_v_self,PyObject * __pyx_v_input_device,PyObject * __pyx_v_buffersize)4614 static int __pyx_pf_6pygame_4pypm_5Input___init__(struct __pyx_obj_6pygame_4pypm_Input *__pyx_v_self, PyObject *__pyx_v_input_device, PyObject *__pyx_v_buffersize) {
4615   PmError __pyx_v_err;
4616   int __pyx_r;
4617   __Pyx_RefNannyDeclarations
4618   int __pyx_t_1;
4619   PmDeviceID __pyx_t_2;
4620   long __pyx_t_3;
4621   int __pyx_t_4;
4622   PyObject *__pyx_t_5 = NULL;
4623   PyObject *__pyx_t_6 = NULL;
4624   int __pyx_lineno = 0;
4625   const char *__pyx_filename = NULL;
4626   int __pyx_clineno = 0;
4627   __Pyx_RefNannySetupContext("__init__", 0);
4628 
4629   /* "pygame/pypm.pyx":541
4630  *
4631  *         cdef PmError err
4632  *         self.device = input_device             # <<<<<<<<<<<<<<
4633  *         self.debug = 0
4634  *
4635  */
4636   __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_input_device); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 541, __pyx_L1_error)
4637   __pyx_v_self->device = __pyx_t_1;
4638 
4639   /* "pygame/pypm.pyx":542
4640  *         cdef PmError err
4641  *         self.device = input_device
4642  *         self.debug = 0             # <<<<<<<<<<<<<<
4643  *
4644  *         err = Pm_OpenInput(&(self.midi), input_device, NULL, buffersize,
4645  */
4646   __pyx_v_self->debug = 0;
4647 
4648   /* "pygame/pypm.pyx":544
4649  *         self.debug = 0
4650  *
4651  *         err = Pm_OpenInput(&(self.midi), input_device, NULL, buffersize,             # <<<<<<<<<<<<<<
4652  *                            &Pt_Time, NULL)
4653  *         if err < 0:
4654  */
4655   __pyx_t_2 = __Pyx_PyInt_As_PmDeviceID(__pyx_v_input_device); if (unlikely((__pyx_t_2 == ((PmDeviceID)-1)) && PyErr_Occurred())) __PYX_ERR(0, 544, __pyx_L1_error)
4656   __pyx_t_3 = __Pyx_PyInt_As_long(__pyx_v_buffersize); if (unlikely((__pyx_t_3 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 544, __pyx_L1_error)
4657 
4658   /* "pygame/pypm.pyx":545
4659  *
4660  *         err = Pm_OpenInput(&(self.midi), input_device, NULL, buffersize,
4661  *                            &Pt_Time, NULL)             # <<<<<<<<<<<<<<
4662  *         if err < 0:
4663  *             raise Exception(Pm_GetErrorText(err))
4664  */
4665   __pyx_v_err = Pm_OpenInput((&__pyx_v_self->midi), __pyx_t_2, NULL, __pyx_t_3, (&Pt_Time), NULL);
4666 
4667   /* "pygame/pypm.pyx":546
4668  *         err = Pm_OpenInput(&(self.midi), input_device, NULL, buffersize,
4669  *                            &Pt_Time, NULL)
4670  *         if err < 0:             # <<<<<<<<<<<<<<
4671  *             raise Exception(Pm_GetErrorText(err))
4672  *
4673  */
4674   __pyx_t_4 = ((__pyx_v_err < 0) != 0);
4675   if (unlikely(__pyx_t_4)) {
4676 
4677     /* "pygame/pypm.pyx":547
4678  *                            &Pt_Time, NULL)
4679  *         if err < 0:
4680  *             raise Exception(Pm_GetErrorText(err))             # <<<<<<<<<<<<<<
4681  *
4682  *         if self.debug:
4683  */
4684     __pyx_t_5 = __Pyx_PyBytes_FromString(Pm_GetErrorText(__pyx_v_err)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 547, __pyx_L1_error)
4685     __Pyx_GOTREF(__pyx_t_5);
4686     __pyx_t_6 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 547, __pyx_L1_error)
4687     __Pyx_GOTREF(__pyx_t_6);
4688     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4689     __Pyx_Raise(__pyx_t_6, 0, 0, 0);
4690     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4691     __PYX_ERR(0, 547, __pyx_L1_error)
4692 
4693     /* "pygame/pypm.pyx":546
4694  *         err = Pm_OpenInput(&(self.midi), input_device, NULL, buffersize,
4695  *                            &Pt_Time, NULL)
4696  *         if err < 0:             # <<<<<<<<<<<<<<
4697  *             raise Exception(Pm_GetErrorText(err))
4698  *
4699  */
4700   }
4701 
4702   /* "pygame/pypm.pyx":549
4703  *             raise Exception(Pm_GetErrorText(err))
4704  *
4705  *         if self.debug:             # <<<<<<<<<<<<<<
4706  *             print "MIDI input opened.", input_device
4707  *
4708  */
4709   __pyx_t_4 = (__pyx_v_self->debug != 0);
4710   if (__pyx_t_4) {
4711 
4712     /* "pygame/pypm.pyx":550
4713  *
4714  *         if self.debug:
4715  *             print "MIDI input opened.", input_device             # <<<<<<<<<<<<<<
4716  *
4717  *     def __dealloc__(self):
4718  */
4719     __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 550, __pyx_L1_error)
4720     __Pyx_GOTREF(__pyx_t_6);
4721     __Pyx_INCREF(__pyx_kp_s_MIDI_input_opened);
4722     __Pyx_GIVEREF(__pyx_kp_s_MIDI_input_opened);
4723     PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_kp_s_MIDI_input_opened);
4724     __Pyx_INCREF(__pyx_v_input_device);
4725     __Pyx_GIVEREF(__pyx_v_input_device);
4726     PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_input_device);
4727     if (__Pyx_Print(0, __pyx_t_6, 1) < 0) __PYX_ERR(0, 550, __pyx_L1_error)
4728     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4729 
4730     /* "pygame/pypm.pyx":549
4731  *             raise Exception(Pm_GetErrorText(err))
4732  *
4733  *         if self.debug:             # <<<<<<<<<<<<<<
4734  *             print "MIDI input opened.", input_device
4735  *
4736  */
4737   }
4738 
4739   /* "pygame/pypm.pyx":537
4740  *     cdef int debug
4741  *
4742  *     def __init__(self, input_device, buffersize=4096):             # <<<<<<<<<<<<<<
4743  *         """Instantiate MIDI input stream object."""
4744  *
4745  */
4746 
4747   /* function exit code */
4748   __pyx_r = 0;
4749   goto __pyx_L0;
4750   __pyx_L1_error:;
4751   __Pyx_XDECREF(__pyx_t_5);
4752   __Pyx_XDECREF(__pyx_t_6);
4753   __Pyx_AddTraceback("pygame.pypm.Input.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4754   __pyx_r = -1;
4755   __pyx_L0:;
4756   __Pyx_RefNannyFinishContext();
4757   return __pyx_r;
4758 }
4759 
4760 /* "pygame/pypm.pyx":552
4761  *             print "MIDI input opened.", input_device
4762  *
4763  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
4764  *         """Close midi device if still open when the instance is destroyed."""
4765  *
4766  */
4767 
4768 /* Python wrapper */
4769 static void __pyx_pw_6pygame_4pypm_5Input_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_6pygame_4pypm_5Input_3__dealloc__(PyObject * __pyx_v_self)4770 static void __pyx_pw_6pygame_4pypm_5Input_3__dealloc__(PyObject *__pyx_v_self) {
4771   __Pyx_RefNannyDeclarations
4772   __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
4773   __pyx_pf_6pygame_4pypm_5Input_2__dealloc__(((struct __pyx_obj_6pygame_4pypm_Input *)__pyx_v_self));
4774 
4775   /* function exit code */
4776   __Pyx_RefNannyFinishContext();
4777 }
4778 
__pyx_pf_6pygame_4pypm_5Input_2__dealloc__(struct __pyx_obj_6pygame_4pypm_Input * __pyx_v_self)4779 static void __pyx_pf_6pygame_4pypm_5Input_2__dealloc__(struct __pyx_obj_6pygame_4pypm_Input *__pyx_v_self) {
4780   PmError __pyx_v_err;
4781   __Pyx_RefNannyDeclarations
4782   int __pyx_t_1;
4783   PyObject *__pyx_t_2 = NULL;
4784   PyObject *__pyx_t_3 = NULL;
4785   int __pyx_lineno = 0;
4786   const char *__pyx_filename = NULL;
4787   int __pyx_clineno = 0;
4788   __Pyx_RefNannySetupContext("__dealloc__", 0);
4789 
4790   /* "pygame/pypm.pyx":556
4791  *
4792  *         cdef PmError err
4793  *         if not _pypm_initialized:             # <<<<<<<<<<<<<<
4794  *             return
4795  *
4796  */
4797   __pyx_t_1 = ((!(__pyx_v_6pygame_4pypm__pypm_initialized != 0)) != 0);
4798   if (__pyx_t_1) {
4799 
4800     /* "pygame/pypm.pyx":557
4801  *         cdef PmError err
4802  *         if not _pypm_initialized:
4803  *             return             # <<<<<<<<<<<<<<
4804  *
4805  *         if self.debug:
4806  */
4807     goto __pyx_L0;
4808 
4809     /* "pygame/pypm.pyx":556
4810  *
4811  *         cdef PmError err
4812  *         if not _pypm_initialized:             # <<<<<<<<<<<<<<
4813  *             return
4814  *
4815  */
4816   }
4817 
4818   /* "pygame/pypm.pyx":559
4819  *             return
4820  *
4821  *         if self.debug:             # <<<<<<<<<<<<<<
4822  *             print "Closing MIDI input stream and destroying instance"
4823  *
4824  */
4825   __pyx_t_1 = (__pyx_v_self->debug != 0);
4826   if (__pyx_t_1) {
4827 
4828     /* "pygame/pypm.pyx":560
4829  *
4830  *         if self.debug:
4831  *             print "Closing MIDI input stream and destroying instance"             # <<<<<<<<<<<<<<
4832  *
4833  *         if self.midi:
4834  */
4835     if (__Pyx_PrintOne(0, __pyx_kp_s_Closing_MIDI_input_stream_and_de) < 0) __PYX_ERR(0, 560, __pyx_L1_error)
4836 
4837     /* "pygame/pypm.pyx":559
4838  *             return
4839  *
4840  *         if self.debug:             # <<<<<<<<<<<<<<
4841  *             print "Closing MIDI input stream and destroying instance"
4842  *
4843  */
4844   }
4845 
4846   /* "pygame/pypm.pyx":562
4847  *             print "Closing MIDI input stream and destroying instance"
4848  *
4849  *         if self.midi:             # <<<<<<<<<<<<<<
4850  *             err = Pm_Close(self.midi)
4851  *             if err < 0:
4852  */
4853   __pyx_t_1 = (__pyx_v_self->midi != 0);
4854   if (__pyx_t_1) {
4855 
4856     /* "pygame/pypm.pyx":563
4857  *
4858  *         if self.midi:
4859  *             err = Pm_Close(self.midi)             # <<<<<<<<<<<<<<
4860  *             if err < 0:
4861  *                 raise Exception(Pm_GetErrorText(err))
4862  */
4863     __pyx_v_err = Pm_Close(__pyx_v_self->midi);
4864 
4865     /* "pygame/pypm.pyx":564
4866  *         if self.midi:
4867  *             err = Pm_Close(self.midi)
4868  *             if err < 0:             # <<<<<<<<<<<<<<
4869  *                 raise Exception(Pm_GetErrorText(err))
4870  *
4871  */
4872     __pyx_t_1 = ((__pyx_v_err < 0) != 0);
4873     if (unlikely(__pyx_t_1)) {
4874 
4875       /* "pygame/pypm.pyx":565
4876  *             err = Pm_Close(self.midi)
4877  *             if err < 0:
4878  *                 raise Exception(Pm_GetErrorText(err))             # <<<<<<<<<<<<<<
4879  *
4880  *     def _check_open(self):
4881  */
4882       __pyx_t_2 = __Pyx_PyBytes_FromString(Pm_GetErrorText(__pyx_v_err)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 565, __pyx_L1_error)
4883       __Pyx_GOTREF(__pyx_t_2);
4884       __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 565, __pyx_L1_error)
4885       __Pyx_GOTREF(__pyx_t_3);
4886       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4887       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
4888       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4889       __PYX_ERR(0, 565, __pyx_L1_error)
4890 
4891       /* "pygame/pypm.pyx":564
4892  *         if self.midi:
4893  *             err = Pm_Close(self.midi)
4894  *             if err < 0:             # <<<<<<<<<<<<<<
4895  *                 raise Exception(Pm_GetErrorText(err))
4896  *
4897  */
4898     }
4899 
4900     /* "pygame/pypm.pyx":562
4901  *             print "Closing MIDI input stream and destroying instance"
4902  *
4903  *         if self.midi:             # <<<<<<<<<<<<<<
4904  *             err = Pm_Close(self.midi)
4905  *             if err < 0:
4906  */
4907   }
4908 
4909   /* "pygame/pypm.pyx":552
4910  *             print "MIDI input opened.", input_device
4911  *
4912  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
4913  *         """Close midi device if still open when the instance is destroyed."""
4914  *
4915  */
4916 
4917   /* function exit code */
4918   goto __pyx_L0;
4919   __pyx_L1_error:;
4920   __Pyx_XDECREF(__pyx_t_2);
4921   __Pyx_XDECREF(__pyx_t_3);
4922   __Pyx_WriteUnraisable("pygame.pypm.Input.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
4923   __pyx_L0:;
4924   __Pyx_RefNannyFinishContext();
4925 }
4926 
4927 /* "pygame/pypm.pyx":567
4928  *                 raise Exception(Pm_GetErrorText(err))
4929  *
4930  *     def _check_open(self):             # <<<<<<<<<<<<<<
4931  *         """Check whether midi device is open, and if not, raises an error.
4932  *
4933  */
4934 
4935 /* Python wrapper */
4936 static PyObject *__pyx_pw_6pygame_4pypm_5Input_5_check_open(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
4937 static char __pyx_doc_6pygame_4pypm_5Input_4_check_open[] = "Check whether midi device is open, and if not, raises an error.\n\n        Internal method, should be used only by other methods of this class.\n\n        ";
__pyx_pw_6pygame_4pypm_5Input_5_check_open(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)4938 static PyObject *__pyx_pw_6pygame_4pypm_5Input_5_check_open(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
4939   PyObject *__pyx_r = 0;
4940   __Pyx_RefNannyDeclarations
4941   __Pyx_RefNannySetupContext("_check_open (wrapper)", 0);
4942   __pyx_r = __pyx_pf_6pygame_4pypm_5Input_4_check_open(((struct __pyx_obj_6pygame_4pypm_Input *)__pyx_v_self));
4943 
4944   /* function exit code */
4945   __Pyx_RefNannyFinishContext();
4946   return __pyx_r;
4947 }
4948 
__pyx_pf_6pygame_4pypm_5Input_4_check_open(struct __pyx_obj_6pygame_4pypm_Input * __pyx_v_self)4949 static PyObject *__pyx_pf_6pygame_4pypm_5Input_4_check_open(struct __pyx_obj_6pygame_4pypm_Input *__pyx_v_self) {
4950   PyObject *__pyx_r = NULL;
4951   __Pyx_RefNannyDeclarations
4952   int __pyx_t_1;
4953   PyObject *__pyx_t_2 = NULL;
4954   int __pyx_lineno = 0;
4955   const char *__pyx_filename = NULL;
4956   int __pyx_clineno = 0;
4957   __Pyx_RefNannySetupContext("_check_open", 0);
4958 
4959   /* "pygame/pypm.pyx":573
4960  *
4961  *         """
4962  *         if self.midi == NULL:             # <<<<<<<<<<<<<<
4963  *             raise Exception("midi Input not open.")
4964  *
4965  */
4966   __pyx_t_1 = ((__pyx_v_self->midi == NULL) != 0);
4967   if (unlikely(__pyx_t_1)) {
4968 
4969     /* "pygame/pypm.pyx":574
4970  *         """
4971  *         if self.midi == NULL:
4972  *             raise Exception("midi Input not open.")             # <<<<<<<<<<<<<<
4973  *
4974  *     def Close(self):
4975  */
4976     __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 574, __pyx_L1_error)
4977     __Pyx_GOTREF(__pyx_t_2);
4978     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
4979     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4980     __PYX_ERR(0, 574, __pyx_L1_error)
4981 
4982     /* "pygame/pypm.pyx":573
4983  *
4984  *         """
4985  *         if self.midi == NULL:             # <<<<<<<<<<<<<<
4986  *             raise Exception("midi Input not open.")
4987  *
4988  */
4989   }
4990 
4991   /* "pygame/pypm.pyx":567
4992  *                 raise Exception(Pm_GetErrorText(err))
4993  *
4994  *     def _check_open(self):             # <<<<<<<<<<<<<<
4995  *         """Check whether midi device is open, and if not, raises an error.
4996  *
4997  */
4998 
4999   /* function exit code */
5000   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5001   goto __pyx_L0;
5002   __pyx_L1_error:;
5003   __Pyx_XDECREF(__pyx_t_2);
5004   __Pyx_AddTraceback("pygame.pypm.Input._check_open", __pyx_clineno, __pyx_lineno, __pyx_filename);
5005   __pyx_r = NULL;
5006   __pyx_L0:;
5007   __Pyx_XGIVEREF(__pyx_r);
5008   __Pyx_RefNannyFinishContext();
5009   return __pyx_r;
5010 }
5011 
5012 /* "pygame/pypm.pyx":576
5013  *             raise Exception("midi Input not open.")
5014  *
5015  *     def Close(self):             # <<<<<<<<<<<<<<
5016  *         """Close the midi input device.
5017  *
5018  */
5019 
5020 /* Python wrapper */
5021 static PyObject *__pyx_pw_6pygame_4pypm_5Input_7Close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
5022 static char __pyx_doc_6pygame_4pypm_5Input_6Close[] = "Close the midi input device.\n\n        PortMidi attempts to close open streams when the application exits --\n        this is particularly difficult under Windows, so it is best to take\n        care to close all devices explicitly.\n\n        ";
__pyx_pw_6pygame_4pypm_5Input_7Close(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)5023 static PyObject *__pyx_pw_6pygame_4pypm_5Input_7Close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
5024   PyObject *__pyx_r = 0;
5025   __Pyx_RefNannyDeclarations
5026   __Pyx_RefNannySetupContext("Close (wrapper)", 0);
5027   __pyx_r = __pyx_pf_6pygame_4pypm_5Input_6Close(((struct __pyx_obj_6pygame_4pypm_Input *)__pyx_v_self));
5028 
5029   /* function exit code */
5030   __Pyx_RefNannyFinishContext();
5031   return __pyx_r;
5032 }
5033 
__pyx_pf_6pygame_4pypm_5Input_6Close(struct __pyx_obj_6pygame_4pypm_Input * __pyx_v_self)5034 static PyObject *__pyx_pf_6pygame_4pypm_5Input_6Close(struct __pyx_obj_6pygame_4pypm_Input *__pyx_v_self) {
5035   PmError __pyx_v_err;
5036   PyObject *__pyx_r = NULL;
5037   __Pyx_RefNannyDeclarations
5038   int __pyx_t_1;
5039   PyObject *__pyx_t_2 = NULL;
5040   PyObject *__pyx_t_3 = NULL;
5041   int __pyx_lineno = 0;
5042   const char *__pyx_filename = NULL;
5043   int __pyx_clineno = 0;
5044   __Pyx_RefNannySetupContext("Close", 0);
5045 
5046   /* "pygame/pypm.pyx":585
5047  *         """
5048  *         cdef PmError err
5049  *         if not _pypm_initialized:             # <<<<<<<<<<<<<<
5050  *             return
5051  *
5052  */
5053   __pyx_t_1 = ((!(__pyx_v_6pygame_4pypm__pypm_initialized != 0)) != 0);
5054   if (__pyx_t_1) {
5055 
5056     /* "pygame/pypm.pyx":586
5057  *         cdef PmError err
5058  *         if not _pypm_initialized:
5059  *             return             # <<<<<<<<<<<<<<
5060  *
5061  *         if not self.midi:
5062  */
5063     __Pyx_XDECREF(__pyx_r);
5064     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5065     goto __pyx_L0;
5066 
5067     /* "pygame/pypm.pyx":585
5068  *         """
5069  *         cdef PmError err
5070  *         if not _pypm_initialized:             # <<<<<<<<<<<<<<
5071  *             return
5072  *
5073  */
5074   }
5075 
5076   /* "pygame/pypm.pyx":588
5077  *             return
5078  *
5079  *         if not self.midi:             # <<<<<<<<<<<<<<
5080  *             return
5081  *
5082  */
5083   __pyx_t_1 = ((!(__pyx_v_self->midi != 0)) != 0);
5084   if (__pyx_t_1) {
5085 
5086     /* "pygame/pypm.pyx":589
5087  *
5088  *         if not self.midi:
5089  *             return             # <<<<<<<<<<<<<<
5090  *
5091  *         if self.midi:
5092  */
5093     __Pyx_XDECREF(__pyx_r);
5094     __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5095     goto __pyx_L0;
5096 
5097     /* "pygame/pypm.pyx":588
5098  *             return
5099  *
5100  *         if not self.midi:             # <<<<<<<<<<<<<<
5101  *             return
5102  *
5103  */
5104   }
5105 
5106   /* "pygame/pypm.pyx":591
5107  *             return
5108  *
5109  *         if self.midi:             # <<<<<<<<<<<<<<
5110  *             err = Pm_Close(self.midi)
5111  *             if err < 0:
5112  */
5113   __pyx_t_1 = (__pyx_v_self->midi != 0);
5114   if (__pyx_t_1) {
5115 
5116     /* "pygame/pypm.pyx":592
5117  *
5118  *         if self.midi:
5119  *             err = Pm_Close(self.midi)             # <<<<<<<<<<<<<<
5120  *             if err < 0:
5121  *                 raise Exception(Pm_GetErrorText(err))
5122  */
5123     __pyx_v_err = Pm_Close(__pyx_v_self->midi);
5124 
5125     /* "pygame/pypm.pyx":593
5126  *         if self.midi:
5127  *             err = Pm_Close(self.midi)
5128  *             if err < 0:             # <<<<<<<<<<<<<<
5129  *                 raise Exception(Pm_GetErrorText(err))
5130  *
5131  */
5132     __pyx_t_1 = ((__pyx_v_err < 0) != 0);
5133     if (unlikely(__pyx_t_1)) {
5134 
5135       /* "pygame/pypm.pyx":594
5136  *             err = Pm_Close(self.midi)
5137  *             if err < 0:
5138  *                 raise Exception(Pm_GetErrorText(err))             # <<<<<<<<<<<<<<
5139  *
5140  *         self.midi = NULL
5141  */
5142       __pyx_t_2 = __Pyx_PyBytes_FromString(Pm_GetErrorText(__pyx_v_err)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 594, __pyx_L1_error)
5143       __Pyx_GOTREF(__pyx_t_2);
5144       __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 594, __pyx_L1_error)
5145       __Pyx_GOTREF(__pyx_t_3);
5146       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5147       __Pyx_Raise(__pyx_t_3, 0, 0, 0);
5148       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5149       __PYX_ERR(0, 594, __pyx_L1_error)
5150 
5151       /* "pygame/pypm.pyx":593
5152  *         if self.midi:
5153  *             err = Pm_Close(self.midi)
5154  *             if err < 0:             # <<<<<<<<<<<<<<
5155  *                 raise Exception(Pm_GetErrorText(err))
5156  *
5157  */
5158     }
5159 
5160     /* "pygame/pypm.pyx":591
5161  *             return
5162  *
5163  *         if self.midi:             # <<<<<<<<<<<<<<
5164  *             err = Pm_Close(self.midi)
5165  *             if err < 0:
5166  */
5167   }
5168 
5169   /* "pygame/pypm.pyx":596
5170  *                 raise Exception(Pm_GetErrorText(err))
5171  *
5172  *         self.midi = NULL             # <<<<<<<<<<<<<<
5173  *
5174  *
5175  */
5176   __pyx_v_self->midi = NULL;
5177 
5178   /* "pygame/pypm.pyx":576
5179  *             raise Exception("midi Input not open.")
5180  *
5181  *     def Close(self):             # <<<<<<<<<<<<<<
5182  *         """Close the midi input device.
5183  *
5184  */
5185 
5186   /* function exit code */
5187   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5188   goto __pyx_L0;
5189   __pyx_L1_error:;
5190   __Pyx_XDECREF(__pyx_t_2);
5191   __Pyx_XDECREF(__pyx_t_3);
5192   __Pyx_AddTraceback("pygame.pypm.Input.Close", __pyx_clineno, __pyx_lineno, __pyx_filename);
5193   __pyx_r = NULL;
5194   __pyx_L0:;
5195   __Pyx_XGIVEREF(__pyx_r);
5196   __Pyx_RefNannyFinishContext();
5197   return __pyx_r;
5198 }
5199 
5200 /* "pygame/pypm.pyx":599
5201  *
5202  *
5203  *     def SetFilter(self, filters):             # <<<<<<<<<<<<<<
5204  *         """Set filters on an open input stream.
5205  *
5206  */
5207 
5208 /* Python wrapper */
5209 static PyObject *__pyx_pw_6pygame_4pypm_5Input_9SetFilter(PyObject *__pyx_v_self, PyObject *__pyx_v_filters); /*proto*/
5210 static char __pyx_doc_6pygame_4pypm_5Input_8SetFilter[] = "Set filters on an open input stream.\n\n        Usage::\n\n            input.SetFilter(filters)\n\n        Filters are used to drop selected input event types. By default, only\n        active sensing messages are filtered. To prohibit, say, active sensing\n        and sysex messages, call\n\n        ::\n\n            input.SetFilter(FILT_ACTIVE | FILT_SYSEX);\n\n        Filtering is useful when midi routing or midi thru functionality is\n        being provided by the user application. For example, you may want to\n        exclude timing messages (clock, MTC, start/stop/continue), while\n        allowing note-related messages to pass. Or you may be using a sequencer\n        or drum-machine for MIDI clock information but want to exclude any\n        notes it may play.\n\n        .. note::\n            SetFilter empties the buffer after setting the filter,\n            just in case anything got through.\n\n        ";
__pyx_pw_6pygame_4pypm_5Input_9SetFilter(PyObject * __pyx_v_self,PyObject * __pyx_v_filters)5211 static PyObject *__pyx_pw_6pygame_4pypm_5Input_9SetFilter(PyObject *__pyx_v_self, PyObject *__pyx_v_filters) {
5212   PyObject *__pyx_r = 0;
5213   __Pyx_RefNannyDeclarations
5214   __Pyx_RefNannySetupContext("SetFilter (wrapper)", 0);
5215   __pyx_r = __pyx_pf_6pygame_4pypm_5Input_8SetFilter(((struct __pyx_obj_6pygame_4pypm_Input *)__pyx_v_self), ((PyObject *)__pyx_v_filters));
5216 
5217   /* function exit code */
5218   __Pyx_RefNannyFinishContext();
5219   return __pyx_r;
5220 }
5221 
__pyx_pf_6pygame_4pypm_5Input_8SetFilter(struct __pyx_obj_6pygame_4pypm_Input * __pyx_v_self,PyObject * __pyx_v_filters)5222 static PyObject *__pyx_pf_6pygame_4pypm_5Input_8SetFilter(struct __pyx_obj_6pygame_4pypm_Input *__pyx_v_self, PyObject *__pyx_v_filters) {
5223   PmEvent __pyx_v_buffer[1];
5224   PmError __pyx_v_err;
5225   PyObject *__pyx_r = NULL;
5226   __Pyx_RefNannyDeclarations
5227   PyObject *__pyx_t_1 = NULL;
5228   PyObject *__pyx_t_2 = NULL;
5229   PyObject *__pyx_t_3 = NULL;
5230   long __pyx_t_4;
5231   int __pyx_t_5;
5232   int __pyx_lineno = 0;
5233   const char *__pyx_filename = NULL;
5234   int __pyx_clineno = 0;
5235   __Pyx_RefNannySetupContext("SetFilter", 0);
5236 
5237   /* "pygame/pypm.pyx":629
5238  *         cdef PmError err
5239  *
5240  *         self._check_open()             # <<<<<<<<<<<<<<
5241  *
5242  *         err = Pm_SetFilter(self.midi, filters)
5243  */
5244   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_check_open); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 629, __pyx_L1_error)
5245   __Pyx_GOTREF(__pyx_t_2);
5246   __pyx_t_3 = NULL;
5247   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
5248     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
5249     if (likely(__pyx_t_3)) {
5250       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
5251       __Pyx_INCREF(__pyx_t_3);
5252       __Pyx_INCREF(function);
5253       __Pyx_DECREF_SET(__pyx_t_2, function);
5254     }
5255   }
5256   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
5257   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5258   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 629, __pyx_L1_error)
5259   __Pyx_GOTREF(__pyx_t_1);
5260   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5261   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5262 
5263   /* "pygame/pypm.pyx":631
5264  *         self._check_open()
5265  *
5266  *         err = Pm_SetFilter(self.midi, filters)             # <<<<<<<<<<<<<<
5267  *
5268  *         if err < 0:
5269  */
5270   __pyx_t_4 = __Pyx_PyInt_As_long(__pyx_v_filters); if (unlikely((__pyx_t_4 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 631, __pyx_L1_error)
5271   __pyx_v_err = Pm_SetFilter(__pyx_v_self->midi, __pyx_t_4);
5272 
5273   /* "pygame/pypm.pyx":633
5274  *         err = Pm_SetFilter(self.midi, filters)
5275  *
5276  *         if err < 0:             # <<<<<<<<<<<<<<
5277  *             raise Exception(Pm_GetErrorText(err))
5278  *
5279  */
5280   __pyx_t_5 = ((__pyx_v_err < 0) != 0);
5281   if (unlikely(__pyx_t_5)) {
5282 
5283     /* "pygame/pypm.pyx":634
5284  *
5285  *         if err < 0:
5286  *             raise Exception(Pm_GetErrorText(err))             # <<<<<<<<<<<<<<
5287  *
5288  *         while(Pm_Poll(self.midi) != pmNoError):
5289  */
5290     __pyx_t_1 = __Pyx_PyBytes_FromString(Pm_GetErrorText(__pyx_v_err)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 634, __pyx_L1_error)
5291     __Pyx_GOTREF(__pyx_t_1);
5292     __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 634, __pyx_L1_error)
5293     __Pyx_GOTREF(__pyx_t_2);
5294     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5295     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
5296     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5297     __PYX_ERR(0, 634, __pyx_L1_error)
5298 
5299     /* "pygame/pypm.pyx":633
5300  *         err = Pm_SetFilter(self.midi, filters)
5301  *
5302  *         if err < 0:             # <<<<<<<<<<<<<<
5303  *             raise Exception(Pm_GetErrorText(err))
5304  *
5305  */
5306   }
5307 
5308   /* "pygame/pypm.pyx":636
5309  *             raise Exception(Pm_GetErrorText(err))
5310  *
5311  *         while(Pm_Poll(self.midi) != pmNoError):             # <<<<<<<<<<<<<<
5312  *             err = Pm_Read(self.midi, buffer, 1)
5313  *             if err < 0:
5314  */
5315   while (1) {
5316     __pyx_t_5 = ((Pm_Poll(__pyx_v_self->midi) != pmNoError) != 0);
5317     if (!__pyx_t_5) break;
5318 
5319     /* "pygame/pypm.pyx":637
5320  *
5321  *         while(Pm_Poll(self.midi) != pmNoError):
5322  *             err = Pm_Read(self.midi, buffer, 1)             # <<<<<<<<<<<<<<
5323  *             if err < 0:
5324  *                 raise Exception(Pm_GetErrorText(err))
5325  */
5326     __pyx_v_err = Pm_Read(__pyx_v_self->midi, __pyx_v_buffer, 1);
5327 
5328     /* "pygame/pypm.pyx":638
5329  *         while(Pm_Poll(self.midi) != pmNoError):
5330  *             err = Pm_Read(self.midi, buffer, 1)
5331  *             if err < 0:             # <<<<<<<<<<<<<<
5332  *                 raise Exception(Pm_GetErrorText(err))
5333  *
5334  */
5335     __pyx_t_5 = ((__pyx_v_err < 0) != 0);
5336     if (unlikely(__pyx_t_5)) {
5337 
5338       /* "pygame/pypm.pyx":639
5339  *             err = Pm_Read(self.midi, buffer, 1)
5340  *             if err < 0:
5341  *                 raise Exception(Pm_GetErrorText(err))             # <<<<<<<<<<<<<<
5342  *
5343  *     def SetChannelMask(self, mask):
5344  */
5345       __pyx_t_2 = __Pyx_PyBytes_FromString(Pm_GetErrorText(__pyx_v_err)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 639, __pyx_L1_error)
5346       __Pyx_GOTREF(__pyx_t_2);
5347       __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 639, __pyx_L1_error)
5348       __Pyx_GOTREF(__pyx_t_1);
5349       __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5350       __Pyx_Raise(__pyx_t_1, 0, 0, 0);
5351       __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5352       __PYX_ERR(0, 639, __pyx_L1_error)
5353 
5354       /* "pygame/pypm.pyx":638
5355  *         while(Pm_Poll(self.midi) != pmNoError):
5356  *             err = Pm_Read(self.midi, buffer, 1)
5357  *             if err < 0:             # <<<<<<<<<<<<<<
5358  *                 raise Exception(Pm_GetErrorText(err))
5359  *
5360  */
5361     }
5362   }
5363 
5364   /* "pygame/pypm.pyx":599
5365  *
5366  *
5367  *     def SetFilter(self, filters):             # <<<<<<<<<<<<<<
5368  *         """Set filters on an open input stream.
5369  *
5370  */
5371 
5372   /* function exit code */
5373   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5374   goto __pyx_L0;
5375   __pyx_L1_error:;
5376   __Pyx_XDECREF(__pyx_t_1);
5377   __Pyx_XDECREF(__pyx_t_2);
5378   __Pyx_XDECREF(__pyx_t_3);
5379   __Pyx_AddTraceback("pygame.pypm.Input.SetFilter", __pyx_clineno, __pyx_lineno, __pyx_filename);
5380   __pyx_r = NULL;
5381   __pyx_L0:;
5382   __Pyx_XGIVEREF(__pyx_r);
5383   __Pyx_RefNannyFinishContext();
5384   return __pyx_r;
5385 }
5386 
5387 /* "pygame/pypm.pyx":641
5388  *                 raise Exception(Pm_GetErrorText(err))
5389  *
5390  *     def SetChannelMask(self, mask):             # <<<<<<<<<<<<<<
5391  *         """Set channel mask to filter incoming messages based on channel.
5392  *
5393  */
5394 
5395 /* Python wrapper */
5396 static PyObject *__pyx_pw_6pygame_4pypm_5Input_11SetChannelMask(PyObject *__pyx_v_self, PyObject *__pyx_v_mask); /*proto*/
5397 static char __pyx_doc_6pygame_4pypm_5Input_10SetChannelMask[] = "Set channel mask to filter incoming messages based on channel.\n\n        The mask is a 16-bit bitfield corresponding to appropriate channels\n        Channel(<channel>) can assist in calling this function, i.e. to\n        receive only input on channel 1, call this method like this::\n\n            SetChannelMask(Channel(1))\n\n        Multiple channels should be OR'd together::\n\n            SetChannelMask(Channel(10) | Channel(11))\n\n        .. note::\n            The PyPortMidi Channel function has been altered from the original\n            PortMidi C call to correct for what seems to be a bug --- i.e.\n            channel filters were all numbered from 0 to 15 instead of 1 to 16.\n\n        ";
__pyx_pw_6pygame_4pypm_5Input_11SetChannelMask(PyObject * __pyx_v_self,PyObject * __pyx_v_mask)5398 static PyObject *__pyx_pw_6pygame_4pypm_5Input_11SetChannelMask(PyObject *__pyx_v_self, PyObject *__pyx_v_mask) {
5399   PyObject *__pyx_r = 0;
5400   __Pyx_RefNannyDeclarations
5401   __Pyx_RefNannySetupContext("SetChannelMask (wrapper)", 0);
5402   __pyx_r = __pyx_pf_6pygame_4pypm_5Input_10SetChannelMask(((struct __pyx_obj_6pygame_4pypm_Input *)__pyx_v_self), ((PyObject *)__pyx_v_mask));
5403 
5404   /* function exit code */
5405   __Pyx_RefNannyFinishContext();
5406   return __pyx_r;
5407 }
5408 
__pyx_pf_6pygame_4pypm_5Input_10SetChannelMask(struct __pyx_obj_6pygame_4pypm_Input * __pyx_v_self,PyObject * __pyx_v_mask)5409 static PyObject *__pyx_pf_6pygame_4pypm_5Input_10SetChannelMask(struct __pyx_obj_6pygame_4pypm_Input *__pyx_v_self, PyObject *__pyx_v_mask) {
5410   PmError __pyx_v_err;
5411   PyObject *__pyx_r = NULL;
5412   __Pyx_RefNannyDeclarations
5413   PyObject *__pyx_t_1 = NULL;
5414   PyObject *__pyx_t_2 = NULL;
5415   PyObject *__pyx_t_3 = NULL;
5416   int __pyx_t_4;
5417   int __pyx_t_5;
5418   int __pyx_lineno = 0;
5419   const char *__pyx_filename = NULL;
5420   int __pyx_clineno = 0;
5421   __Pyx_RefNannySetupContext("SetChannelMask", 0);
5422 
5423   /* "pygame/pypm.pyx":662
5424  *         cdef PmError err
5425  *
5426  *         self._check_open()             # <<<<<<<<<<<<<<
5427  *
5428  *         err = Pm_SetChannelMask(self.midi, mask)
5429  */
5430   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_check_open); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 662, __pyx_L1_error)
5431   __Pyx_GOTREF(__pyx_t_2);
5432   __pyx_t_3 = NULL;
5433   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
5434     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
5435     if (likely(__pyx_t_3)) {
5436       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
5437       __Pyx_INCREF(__pyx_t_3);
5438       __Pyx_INCREF(function);
5439       __Pyx_DECREF_SET(__pyx_t_2, function);
5440     }
5441   }
5442   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
5443   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5444   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 662, __pyx_L1_error)
5445   __Pyx_GOTREF(__pyx_t_1);
5446   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5447   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5448 
5449   /* "pygame/pypm.pyx":664
5450  *         self._check_open()
5451  *
5452  *         err = Pm_SetChannelMask(self.midi, mask)             # <<<<<<<<<<<<<<
5453  *         if err < 0:
5454  *             raise Exception(Pm_GetErrorText(err))
5455  */
5456   __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_mask); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 664, __pyx_L1_error)
5457   __pyx_v_err = Pm_SetChannelMask(__pyx_v_self->midi, __pyx_t_4);
5458 
5459   /* "pygame/pypm.pyx":665
5460  *
5461  *         err = Pm_SetChannelMask(self.midi, mask)
5462  *         if err < 0:             # <<<<<<<<<<<<<<
5463  *             raise Exception(Pm_GetErrorText(err))
5464  *
5465  */
5466   __pyx_t_5 = ((__pyx_v_err < 0) != 0);
5467   if (unlikely(__pyx_t_5)) {
5468 
5469     /* "pygame/pypm.pyx":666
5470  *         err = Pm_SetChannelMask(self.midi, mask)
5471  *         if err < 0:
5472  *             raise Exception(Pm_GetErrorText(err))             # <<<<<<<<<<<<<<
5473  *
5474  *     def Poll(self):
5475  */
5476     __pyx_t_1 = __Pyx_PyBytes_FromString(Pm_GetErrorText(__pyx_v_err)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 666, __pyx_L1_error)
5477     __Pyx_GOTREF(__pyx_t_1);
5478     __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 666, __pyx_L1_error)
5479     __Pyx_GOTREF(__pyx_t_2);
5480     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5481     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
5482     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5483     __PYX_ERR(0, 666, __pyx_L1_error)
5484 
5485     /* "pygame/pypm.pyx":665
5486  *
5487  *         err = Pm_SetChannelMask(self.midi, mask)
5488  *         if err < 0:             # <<<<<<<<<<<<<<
5489  *             raise Exception(Pm_GetErrorText(err))
5490  *
5491  */
5492   }
5493 
5494   /* "pygame/pypm.pyx":641
5495  *                 raise Exception(Pm_GetErrorText(err))
5496  *
5497  *     def SetChannelMask(self, mask):             # <<<<<<<<<<<<<<
5498  *         """Set channel mask to filter incoming messages based on channel.
5499  *
5500  */
5501 
5502   /* function exit code */
5503   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5504   goto __pyx_L0;
5505   __pyx_L1_error:;
5506   __Pyx_XDECREF(__pyx_t_1);
5507   __Pyx_XDECREF(__pyx_t_2);
5508   __Pyx_XDECREF(__pyx_t_3);
5509   __Pyx_AddTraceback("pygame.pypm.Input.SetChannelMask", __pyx_clineno, __pyx_lineno, __pyx_filename);
5510   __pyx_r = NULL;
5511   __pyx_L0:;
5512   __Pyx_XGIVEREF(__pyx_r);
5513   __Pyx_RefNannyFinishContext();
5514   return __pyx_r;
5515 }
5516 
5517 /* "pygame/pypm.pyx":668
5518  *             raise Exception(Pm_GetErrorText(err))
5519  *
5520  *     def Poll(self):             # <<<<<<<<<<<<<<
5521  *         """Test whether input is available.
5522  *
5523  */
5524 
5525 /* Python wrapper */
5526 static PyObject *__pyx_pw_6pygame_4pypm_5Input_13Poll(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
5527 static char __pyx_doc_6pygame_4pypm_5Input_12Poll[] = "Test whether input is available.\n\n        Returns TRUE if input can be read, FALSE otherwise, or an error value.\n\n        ";
__pyx_pw_6pygame_4pypm_5Input_13Poll(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)5528 static PyObject *__pyx_pw_6pygame_4pypm_5Input_13Poll(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
5529   PyObject *__pyx_r = 0;
5530   __Pyx_RefNannyDeclarations
5531   __Pyx_RefNannySetupContext("Poll (wrapper)", 0);
5532   __pyx_r = __pyx_pf_6pygame_4pypm_5Input_12Poll(((struct __pyx_obj_6pygame_4pypm_Input *)__pyx_v_self));
5533 
5534   /* function exit code */
5535   __Pyx_RefNannyFinishContext();
5536   return __pyx_r;
5537 }
5538 
__pyx_pf_6pygame_4pypm_5Input_12Poll(struct __pyx_obj_6pygame_4pypm_Input * __pyx_v_self)5539 static PyObject *__pyx_pf_6pygame_4pypm_5Input_12Poll(struct __pyx_obj_6pygame_4pypm_Input *__pyx_v_self) {
5540   PmError __pyx_v_err;
5541   PyObject *__pyx_r = NULL;
5542   __Pyx_RefNannyDeclarations
5543   PyObject *__pyx_t_1 = NULL;
5544   PyObject *__pyx_t_2 = NULL;
5545   PyObject *__pyx_t_3 = NULL;
5546   int __pyx_t_4;
5547   int __pyx_lineno = 0;
5548   const char *__pyx_filename = NULL;
5549   int __pyx_clineno = 0;
5550   __Pyx_RefNannySetupContext("Poll", 0);
5551 
5552   /* "pygame/pypm.pyx":676
5553  *         cdef PmError err
5554  *
5555  *         self._check_open()             # <<<<<<<<<<<<<<
5556  *
5557  *         err = Pm_Poll(self.midi)
5558  */
5559   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_check_open); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 676, __pyx_L1_error)
5560   __Pyx_GOTREF(__pyx_t_2);
5561   __pyx_t_3 = NULL;
5562   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
5563     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
5564     if (likely(__pyx_t_3)) {
5565       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
5566       __Pyx_INCREF(__pyx_t_3);
5567       __Pyx_INCREF(function);
5568       __Pyx_DECREF_SET(__pyx_t_2, function);
5569     }
5570   }
5571   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
5572   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5573   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 676, __pyx_L1_error)
5574   __Pyx_GOTREF(__pyx_t_1);
5575   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5576   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5577 
5578   /* "pygame/pypm.pyx":678
5579  *         self._check_open()
5580  *
5581  *         err = Pm_Poll(self.midi)             # <<<<<<<<<<<<<<
5582  *         if err < 0:
5583  *             raise Exception(Pm_GetErrorText(err))
5584  */
5585   __pyx_v_err = Pm_Poll(__pyx_v_self->midi);
5586 
5587   /* "pygame/pypm.pyx":679
5588  *
5589  *         err = Pm_Poll(self.midi)
5590  *         if err < 0:             # <<<<<<<<<<<<<<
5591  *             raise Exception(Pm_GetErrorText(err))
5592  *
5593  */
5594   __pyx_t_4 = ((__pyx_v_err < 0) != 0);
5595   if (unlikely(__pyx_t_4)) {
5596 
5597     /* "pygame/pypm.pyx":680
5598  *         err = Pm_Poll(self.midi)
5599  *         if err < 0:
5600  *             raise Exception(Pm_GetErrorText(err))             # <<<<<<<<<<<<<<
5601  *
5602  *         return err
5603  */
5604     __pyx_t_1 = __Pyx_PyBytes_FromString(Pm_GetErrorText(__pyx_v_err)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 680, __pyx_L1_error)
5605     __Pyx_GOTREF(__pyx_t_1);
5606     __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 680, __pyx_L1_error)
5607     __Pyx_GOTREF(__pyx_t_2);
5608     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5609     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
5610     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5611     __PYX_ERR(0, 680, __pyx_L1_error)
5612 
5613     /* "pygame/pypm.pyx":679
5614  *
5615  *         err = Pm_Poll(self.midi)
5616  *         if err < 0:             # <<<<<<<<<<<<<<
5617  *             raise Exception(Pm_GetErrorText(err))
5618  *
5619  */
5620   }
5621 
5622   /* "pygame/pypm.pyx":682
5623  *             raise Exception(Pm_GetErrorText(err))
5624  *
5625  *         return err             # <<<<<<<<<<<<<<
5626  *
5627  *     def Read(self, max_events):
5628  */
5629   __Pyx_XDECREF(__pyx_r);
5630   __pyx_t_2 = __Pyx_PyInt_From_PmError(__pyx_v_err); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 682, __pyx_L1_error)
5631   __Pyx_GOTREF(__pyx_t_2);
5632   __pyx_r = __pyx_t_2;
5633   __pyx_t_2 = 0;
5634   goto __pyx_L0;
5635 
5636   /* "pygame/pypm.pyx":668
5637  *             raise Exception(Pm_GetErrorText(err))
5638  *
5639  *     def Poll(self):             # <<<<<<<<<<<<<<
5640  *         """Test whether input is available.
5641  *
5642  */
5643 
5644   /* function exit code */
5645   __pyx_L1_error:;
5646   __Pyx_XDECREF(__pyx_t_1);
5647   __Pyx_XDECREF(__pyx_t_2);
5648   __Pyx_XDECREF(__pyx_t_3);
5649   __Pyx_AddTraceback("pygame.pypm.Input.Poll", __pyx_clineno, __pyx_lineno, __pyx_filename);
5650   __pyx_r = NULL;
5651   __pyx_L0:;
5652   __Pyx_XGIVEREF(__pyx_r);
5653   __Pyx_RefNannyFinishContext();
5654   return __pyx_r;
5655 }
5656 
5657 /* "pygame/pypm.pyx":684
5658  *         return err
5659  *
5660  *     def Read(self, max_events):             # <<<<<<<<<<<<<<
5661  *         """Read and return up to max_events events from input.
5662  *
5663  */
5664 
5665 /* Python wrapper */
5666 static PyObject *__pyx_pw_6pygame_4pypm_5Input_15Read(PyObject *__pyx_v_self, PyObject *__pyx_v_max_events); /*proto*/
5667 static char __pyx_doc_6pygame_4pypm_5Input_14Read[] = "Read and return up to max_events events from input.\n\n        Reads up to max_events midi events stored in the input buffer and\n        returns them as a list in the following form::\n\n            [\n                [[status, data1, data2, data3], timestamp],\n                [[status, data1, data2, data3], timestamp],\n                ...\n            ]\n\n        ";
__pyx_pw_6pygame_4pypm_5Input_15Read(PyObject * __pyx_v_self,PyObject * __pyx_v_max_events)5668 static PyObject *__pyx_pw_6pygame_4pypm_5Input_15Read(PyObject *__pyx_v_self, PyObject *__pyx_v_max_events) {
5669   PyObject *__pyx_r = 0;
5670   __Pyx_RefNannyDeclarations
5671   __Pyx_RefNannySetupContext("Read (wrapper)", 0);
5672   __pyx_r = __pyx_pf_6pygame_4pypm_5Input_14Read(((struct __pyx_obj_6pygame_4pypm_Input *)__pyx_v_self), ((PyObject *)__pyx_v_max_events));
5673 
5674   /* function exit code */
5675   __Pyx_RefNannyFinishContext();
5676   return __pyx_r;
5677 }
5678 
__pyx_pf_6pygame_4pypm_5Input_14Read(struct __pyx_obj_6pygame_4pypm_Input * __pyx_v_self,PyObject * __pyx_v_max_events)5679 static PyObject *__pyx_pf_6pygame_4pypm_5Input_14Read(struct __pyx_obj_6pygame_4pypm_Input *__pyx_v_self, PyObject *__pyx_v_max_events) {
5680   PmEvent __pyx_v_buffer[0x400];
5681   PmError __pyx_v_num_events;
5682   PyObject *__pyx_v_events = NULL;
5683   int __pyx_v_ev_no;
5684   PyObject *__pyx_r = NULL;
5685   __Pyx_RefNannyDeclarations
5686   PyObject *__pyx_t_1 = NULL;
5687   PyObject *__pyx_t_2 = NULL;
5688   PyObject *__pyx_t_3 = NULL;
5689   int __pyx_t_4;
5690   int __pyx_t_5;
5691   long __pyx_t_6;
5692   int __pyx_t_7;
5693   int __pyx_t_8;
5694   int __pyx_t_9;
5695   PyObject *__pyx_t_10 = NULL;
5696   PyObject *__pyx_t_11 = NULL;
5697   int __pyx_t_12;
5698   int __pyx_lineno = 0;
5699   const char *__pyx_filename = NULL;
5700   int __pyx_clineno = 0;
5701   __Pyx_RefNannySetupContext("Read", 0);
5702 
5703   /* "pygame/pypm.pyx":700
5704  *         cdef PmError num_events
5705  *
5706  *         self._check_open()             # <<<<<<<<<<<<<<
5707  *
5708  *         if max_events > 1024:
5709  */
5710   __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_check_open); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 700, __pyx_L1_error)
5711   __Pyx_GOTREF(__pyx_t_2);
5712   __pyx_t_3 = NULL;
5713   if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
5714     __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
5715     if (likely(__pyx_t_3)) {
5716       PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
5717       __Pyx_INCREF(__pyx_t_3);
5718       __Pyx_INCREF(function);
5719       __Pyx_DECREF_SET(__pyx_t_2, function);
5720     }
5721   }
5722   __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
5723   __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5724   if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 700, __pyx_L1_error)
5725   __Pyx_GOTREF(__pyx_t_1);
5726   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5727   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5728 
5729   /* "pygame/pypm.pyx":702
5730  *         self._check_open()
5731  *
5732  *         if max_events > 1024:             # <<<<<<<<<<<<<<
5733  *             raise ValueError('Maximum buffer length is 1024.')
5734  *         if not max_events:
5735  */
5736   __pyx_t_1 = PyObject_RichCompare(__pyx_v_max_events, __pyx_int_1024, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 702, __pyx_L1_error)
5737   __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 702, __pyx_L1_error)
5738   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5739   if (unlikely(__pyx_t_4)) {
5740 
5741     /* "pygame/pypm.pyx":703
5742  *
5743  *         if max_events > 1024:
5744  *             raise ValueError('Maximum buffer length is 1024.')             # <<<<<<<<<<<<<<
5745  *         if not max_events:
5746  *             raise ValueError('Minimum buffer length is 1.')
5747  */
5748     __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 703, __pyx_L1_error)
5749     __Pyx_GOTREF(__pyx_t_1);
5750     __Pyx_Raise(__pyx_t_1, 0, 0, 0);
5751     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5752     __PYX_ERR(0, 703, __pyx_L1_error)
5753 
5754     /* "pygame/pypm.pyx":702
5755  *         self._check_open()
5756  *
5757  *         if max_events > 1024:             # <<<<<<<<<<<<<<
5758  *             raise ValueError('Maximum buffer length is 1024.')
5759  *         if not max_events:
5760  */
5761   }
5762 
5763   /* "pygame/pypm.pyx":704
5764  *         if max_events > 1024:
5765  *             raise ValueError('Maximum buffer length is 1024.')
5766  *         if not max_events:             # <<<<<<<<<<<<<<
5767  *             raise ValueError('Minimum buffer length is 1.')
5768  *
5769  */
5770   __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_max_events); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 704, __pyx_L1_error)
5771   __pyx_t_5 = ((!__pyx_t_4) != 0);
5772   if (unlikely(__pyx_t_5)) {
5773 
5774     /* "pygame/pypm.pyx":705
5775  *             raise ValueError('Maximum buffer length is 1024.')
5776  *         if not max_events:
5777  *             raise ValueError('Minimum buffer length is 1.')             # <<<<<<<<<<<<<<
5778  *
5779  *         num_events = Pm_Read(self.midi, buffer, max_events)
5780  */
5781     __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 705, __pyx_L1_error)
5782     __Pyx_GOTREF(__pyx_t_1);
5783     __Pyx_Raise(__pyx_t_1, 0, 0, 0);
5784     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5785     __PYX_ERR(0, 705, __pyx_L1_error)
5786 
5787     /* "pygame/pypm.pyx":704
5788  *         if max_events > 1024:
5789  *             raise ValueError('Maximum buffer length is 1024.')
5790  *         if not max_events:             # <<<<<<<<<<<<<<
5791  *             raise ValueError('Minimum buffer length is 1.')
5792  *
5793  */
5794   }
5795 
5796   /* "pygame/pypm.pyx":707
5797  *             raise ValueError('Minimum buffer length is 1.')
5798  *
5799  *         num_events = Pm_Read(self.midi, buffer, max_events)             # <<<<<<<<<<<<<<
5800  *         if num_events < 0:
5801  *             raise Exception(Pm_GetErrorText(num_events))
5802  */
5803   __pyx_t_6 = __Pyx_PyInt_As_long(__pyx_v_max_events); if (unlikely((__pyx_t_6 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 707, __pyx_L1_error)
5804   __pyx_v_num_events = Pm_Read(__pyx_v_self->midi, __pyx_v_buffer, __pyx_t_6);
5805 
5806   /* "pygame/pypm.pyx":708
5807  *
5808  *         num_events = Pm_Read(self.midi, buffer, max_events)
5809  *         if num_events < 0:             # <<<<<<<<<<<<<<
5810  *             raise Exception(Pm_GetErrorText(num_events))
5811  *
5812  */
5813   __pyx_t_5 = ((__pyx_v_num_events < 0) != 0);
5814   if (unlikely(__pyx_t_5)) {
5815 
5816     /* "pygame/pypm.pyx":709
5817  *         num_events = Pm_Read(self.midi, buffer, max_events)
5818  *         if num_events < 0:
5819  *             raise Exception(Pm_GetErrorText(num_events))             # <<<<<<<<<<<<<<
5820  *
5821  *         events = []
5822  */
5823     __pyx_t_1 = __Pyx_PyBytes_FromString(Pm_GetErrorText(__pyx_v_num_events)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 709, __pyx_L1_error)
5824     __Pyx_GOTREF(__pyx_t_1);
5825     __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 709, __pyx_L1_error)
5826     __Pyx_GOTREF(__pyx_t_2);
5827     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5828     __Pyx_Raise(__pyx_t_2, 0, 0, 0);
5829     __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5830     __PYX_ERR(0, 709, __pyx_L1_error)
5831 
5832     /* "pygame/pypm.pyx":708
5833  *
5834  *         num_events = Pm_Read(self.midi, buffer, max_events)
5835  *         if num_events < 0:             # <<<<<<<<<<<<<<
5836  *             raise Exception(Pm_GetErrorText(num_events))
5837  *
5838  */
5839   }
5840 
5841   /* "pygame/pypm.pyx":711
5842  *             raise Exception(Pm_GetErrorText(num_events))
5843  *
5844  *         events = []             # <<<<<<<<<<<<<<
5845  *         if num_events >= 1:
5846  *             for ev_no in range(<int>num_events):
5847  */
5848   __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 711, __pyx_L1_error)
5849   __Pyx_GOTREF(__pyx_t_2);
5850   __pyx_v_events = ((PyObject*)__pyx_t_2);
5851   __pyx_t_2 = 0;
5852 
5853   /* "pygame/pypm.pyx":712
5854  *
5855  *         events = []
5856  *         if num_events >= 1:             # <<<<<<<<<<<<<<
5857  *             for ev_no in range(<int>num_events):
5858  *                 events.append(
5859  */
5860   __pyx_t_5 = ((__pyx_v_num_events >= 1) != 0);
5861   if (__pyx_t_5) {
5862 
5863     /* "pygame/pypm.pyx":713
5864  *         events = []
5865  *         if num_events >= 1:
5866  *             for ev_no in range(<int>num_events):             # <<<<<<<<<<<<<<
5867  *                 events.append(
5868  *                     [
5869  */
5870     __pyx_t_7 = ((int)__pyx_v_num_events);
5871     __pyx_t_8 = __pyx_t_7;
5872     for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
5873       __pyx_v_ev_no = __pyx_t_9;
5874 
5875       /* "pygame/pypm.pyx":717
5876  *                     [
5877  *                         [
5878  *                             buffer[ev_no].message & 0xFF,             # <<<<<<<<<<<<<<
5879  *                             (buffer[ev_no].message >> 8) & 0xFF,
5880  *                             (buffer[ev_no].message >> 16) & 0xFF,
5881  */
5882       __pyx_t_2 = __Pyx_PyInt_From_PmMessage(((__pyx_v_buffer[__pyx_v_ev_no]).message & 0xFF)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 717, __pyx_L1_error)
5883       __Pyx_GOTREF(__pyx_t_2);
5884 
5885       /* "pygame/pypm.pyx":718
5886  *                         [
5887  *                             buffer[ev_no].message & 0xFF,
5888  *                             (buffer[ev_no].message >> 8) & 0xFF,             # <<<<<<<<<<<<<<
5889  *                             (buffer[ev_no].message >> 16) & 0xFF,
5890  *                             (buffer[ev_no].message >> 24) & 0xFF
5891  */
5892       __pyx_t_1 = __Pyx_PyInt_From_PmMessage((((__pyx_v_buffer[__pyx_v_ev_no]).message >> 8) & 0xFF)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 718, __pyx_L1_error)
5893       __Pyx_GOTREF(__pyx_t_1);
5894 
5895       /* "pygame/pypm.pyx":719
5896  *                             buffer[ev_no].message & 0xFF,
5897  *                             (buffer[ev_no].message >> 8) & 0xFF,
5898  *                             (buffer[ev_no].message >> 16) & 0xFF,             # <<<<<<<<<<<<<<
5899  *                             (buffer[ev_no].message >> 24) & 0xFF
5900  *                         ],
5901  */
5902       __pyx_t_3 = __Pyx_PyInt_From_PmMessage((((__pyx_v_buffer[__pyx_v_ev_no]).message >> 16) & 0xFF)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 719, __pyx_L1_error)
5903       __Pyx_GOTREF(__pyx_t_3);
5904 
5905       /* "pygame/pypm.pyx":720
5906  *                             (buffer[ev_no].message >> 8) & 0xFF,
5907  *                             (buffer[ev_no].message >> 16) & 0xFF,
5908  *                             (buffer[ev_no].message >> 24) & 0xFF             # <<<<<<<<<<<<<<
5909  *                         ],
5910  *                         buffer[ev_no].timestamp
5911  */
5912       __pyx_t_10 = __Pyx_PyInt_From_PmMessage((((__pyx_v_buffer[__pyx_v_ev_no]).message >> 24) & 0xFF)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 720, __pyx_L1_error)
5913       __Pyx_GOTREF(__pyx_t_10);
5914 
5915       /* "pygame/pypm.pyx":716
5916  *                 events.append(
5917  *                     [
5918  *                         [             # <<<<<<<<<<<<<<
5919  *                             buffer[ev_no].message & 0xFF,
5920  *                             (buffer[ev_no].message >> 8) & 0xFF,
5921  */
5922       __pyx_t_11 = PyList_New(4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 716, __pyx_L1_error)
5923       __Pyx_GOTREF(__pyx_t_11);
5924       __Pyx_GIVEREF(__pyx_t_2);
5925       PyList_SET_ITEM(__pyx_t_11, 0, __pyx_t_2);
5926       __Pyx_GIVEREF(__pyx_t_1);
5927       PyList_SET_ITEM(__pyx_t_11, 1, __pyx_t_1);
5928       __Pyx_GIVEREF(__pyx_t_3);
5929       PyList_SET_ITEM(__pyx_t_11, 2, __pyx_t_3);
5930       __Pyx_GIVEREF(__pyx_t_10);
5931       PyList_SET_ITEM(__pyx_t_11, 3, __pyx_t_10);
5932       __pyx_t_2 = 0;
5933       __pyx_t_1 = 0;
5934       __pyx_t_3 = 0;
5935       __pyx_t_10 = 0;
5936 
5937       /* "pygame/pypm.pyx":722
5938  *                             (buffer[ev_no].message >> 24) & 0xFF
5939  *                         ],
5940  *                         buffer[ev_no].timestamp             # <<<<<<<<<<<<<<
5941  *                     ]
5942  *                 )
5943  */
5944       __pyx_t_10 = __Pyx_PyInt_From_PmTimestamp((__pyx_v_buffer[__pyx_v_ev_no]).timestamp); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 722, __pyx_L1_error)
5945       __Pyx_GOTREF(__pyx_t_10);
5946 
5947       /* "pygame/pypm.pyx":715
5948  *             for ev_no in range(<int>num_events):
5949  *                 events.append(
5950  *                     [             # <<<<<<<<<<<<<<
5951  *                         [
5952  *                             buffer[ev_no].message & 0xFF,
5953  */
5954       __pyx_t_3 = PyList_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 715, __pyx_L1_error)
5955       __Pyx_GOTREF(__pyx_t_3);
5956       __Pyx_GIVEREF(__pyx_t_11);
5957       PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_11);
5958       __Pyx_GIVEREF(__pyx_t_10);
5959       PyList_SET_ITEM(__pyx_t_3, 1, __pyx_t_10);
5960       __pyx_t_11 = 0;
5961       __pyx_t_10 = 0;
5962 
5963       /* "pygame/pypm.pyx":714
5964  *         if num_events >= 1:
5965  *             for ev_no in range(<int>num_events):
5966  *                 events.append(             # <<<<<<<<<<<<<<
5967  *                     [
5968  *                         [
5969  */
5970       __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_events, __pyx_t_3); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 714, __pyx_L1_error)
5971       __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5972     }
5973 
5974     /* "pygame/pypm.pyx":712
5975  *
5976  *         events = []
5977  *         if num_events >= 1:             # <<<<<<<<<<<<<<
5978  *             for ev_no in range(<int>num_events):
5979  *                 events.append(
5980  */
5981   }
5982 
5983   /* "pygame/pypm.pyx":726
5984  *                 )
5985  *
5986  *         return events             # <<<<<<<<<<<<<<
5987  */
5988   __Pyx_XDECREF(__pyx_r);
5989   __Pyx_INCREF(__pyx_v_events);
5990   __pyx_r = __pyx_v_events;
5991   goto __pyx_L0;
5992 
5993   /* "pygame/pypm.pyx":684
5994  *         return err
5995  *
5996  *     def Read(self, max_events):             # <<<<<<<<<<<<<<
5997  *         """Read and return up to max_events events from input.
5998  *
5999  */
6000 
6001   /* function exit code */
6002   __pyx_L1_error:;
6003   __Pyx_XDECREF(__pyx_t_1);
6004   __Pyx_XDECREF(__pyx_t_2);
6005   __Pyx_XDECREF(__pyx_t_3);
6006   __Pyx_XDECREF(__pyx_t_10);
6007   __Pyx_XDECREF(__pyx_t_11);
6008   __Pyx_AddTraceback("pygame.pypm.Input.Read", __pyx_clineno, __pyx_lineno, __pyx_filename);
6009   __pyx_r = NULL;
6010   __pyx_L0:;
6011   __Pyx_XDECREF(__pyx_v_events);
6012   __Pyx_XGIVEREF(__pyx_r);
6013   __Pyx_RefNannyFinishContext();
6014   return __pyx_r;
6015 }
6016 
6017 /* "(tree fragment)":1
6018  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
6019  *     raise TypeError("self.midi cannot be converted to a Python object for pickling")
6020  * def __setstate_cython__(self, __pyx_state):
6021  */
6022 
6023 /* Python wrapper */
6024 static PyObject *__pyx_pw_6pygame_4pypm_5Input_17__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
__pyx_pw_6pygame_4pypm_5Input_17__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)6025 static PyObject *__pyx_pw_6pygame_4pypm_5Input_17__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
6026   PyObject *__pyx_r = 0;
6027   __Pyx_RefNannyDeclarations
6028   __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
6029   __pyx_r = __pyx_pf_6pygame_4pypm_5Input_16__reduce_cython__(((struct __pyx_obj_6pygame_4pypm_Input *)__pyx_v_self));
6030 
6031   /* function exit code */
6032   __Pyx_RefNannyFinishContext();
6033   return __pyx_r;
6034 }
6035 
__pyx_pf_6pygame_4pypm_5Input_16__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pygame_4pypm_Input * __pyx_v_self)6036 static PyObject *__pyx_pf_6pygame_4pypm_5Input_16__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_6pygame_4pypm_Input *__pyx_v_self) {
6037   PyObject *__pyx_r = NULL;
6038   __Pyx_RefNannyDeclarations
6039   PyObject *__pyx_t_1 = NULL;
6040   int __pyx_lineno = 0;
6041   const char *__pyx_filename = NULL;
6042   int __pyx_clineno = 0;
6043   __Pyx_RefNannySetupContext("__reduce_cython__", 0);
6044 
6045   /* "(tree fragment)":2
6046  * def __reduce_cython__(self):
6047  *     raise TypeError("self.midi cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
6048  * def __setstate_cython__(self, __pyx_state):
6049  *     raise TypeError("self.midi cannot be converted to a Python object for pickling")
6050  */
6051   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
6052   __Pyx_GOTREF(__pyx_t_1);
6053   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
6054   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6055   __PYX_ERR(1, 2, __pyx_L1_error)
6056 
6057   /* "(tree fragment)":1
6058  * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
6059  *     raise TypeError("self.midi cannot be converted to a Python object for pickling")
6060  * def __setstate_cython__(self, __pyx_state):
6061  */
6062 
6063   /* function exit code */
6064   __pyx_L1_error:;
6065   __Pyx_XDECREF(__pyx_t_1);
6066   __Pyx_AddTraceback("pygame.pypm.Input.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6067   __pyx_r = NULL;
6068   __Pyx_XGIVEREF(__pyx_r);
6069   __Pyx_RefNannyFinishContext();
6070   return __pyx_r;
6071 }
6072 
6073 /* "(tree fragment)":3
6074  * def __reduce_cython__(self):
6075  *     raise TypeError("self.midi cannot be converted to a Python object for pickling")
6076  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
6077  *     raise TypeError("self.midi cannot be converted to a Python object for pickling")
6078  */
6079 
6080 /* Python wrapper */
6081 static PyObject *__pyx_pw_6pygame_4pypm_5Input_19__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
__pyx_pw_6pygame_4pypm_5Input_19__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)6082 static PyObject *__pyx_pw_6pygame_4pypm_5Input_19__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
6083   PyObject *__pyx_r = 0;
6084   __Pyx_RefNannyDeclarations
6085   __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
6086   __pyx_r = __pyx_pf_6pygame_4pypm_5Input_18__setstate_cython__(((struct __pyx_obj_6pygame_4pypm_Input *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
6087 
6088   /* function exit code */
6089   __Pyx_RefNannyFinishContext();
6090   return __pyx_r;
6091 }
6092 
__pyx_pf_6pygame_4pypm_5Input_18__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pygame_4pypm_Input * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)6093 static PyObject *__pyx_pf_6pygame_4pypm_5Input_18__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_6pygame_4pypm_Input *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
6094   PyObject *__pyx_r = NULL;
6095   __Pyx_RefNannyDeclarations
6096   PyObject *__pyx_t_1 = NULL;
6097   int __pyx_lineno = 0;
6098   const char *__pyx_filename = NULL;
6099   int __pyx_clineno = 0;
6100   __Pyx_RefNannySetupContext("__setstate_cython__", 0);
6101 
6102   /* "(tree fragment)":4
6103  *     raise TypeError("self.midi cannot be converted to a Python object for pickling")
6104  * def __setstate_cython__(self, __pyx_state):
6105  *     raise TypeError("self.midi cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
6106  */
6107   __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
6108   __Pyx_GOTREF(__pyx_t_1);
6109   __Pyx_Raise(__pyx_t_1, 0, 0, 0);
6110   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6111   __PYX_ERR(1, 4, __pyx_L1_error)
6112 
6113   /* "(tree fragment)":3
6114  * def __reduce_cython__(self):
6115  *     raise TypeError("self.midi cannot be converted to a Python object for pickling")
6116  * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
6117  *     raise TypeError("self.midi cannot be converted to a Python object for pickling")
6118  */
6119 
6120   /* function exit code */
6121   __pyx_L1_error:;
6122   __Pyx_XDECREF(__pyx_t_1);
6123   __Pyx_AddTraceback("pygame.pypm.Input.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6124   __pyx_r = NULL;
6125   __Pyx_XGIVEREF(__pyx_r);
6126   __Pyx_RefNannyFinishContext();
6127   return __pyx_r;
6128 }
6129 
__pyx_tp_new_6pygame_4pypm_Output(PyTypeObject * t,CYTHON_UNUSED PyObject * a,CYTHON_UNUSED PyObject * k)6130 static PyObject *__pyx_tp_new_6pygame_4pypm_Output(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
6131   PyObject *o;
6132   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
6133     o = (*t->tp_alloc)(t, 0);
6134   } else {
6135     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
6136   }
6137   if (unlikely(!o)) return 0;
6138   return o;
6139 }
6140 
__pyx_tp_dealloc_6pygame_4pypm_Output(PyObject * o)6141 static void __pyx_tp_dealloc_6pygame_4pypm_Output(PyObject *o) {
6142   #if CYTHON_USE_TP_FINALIZE
6143   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
6144     if (PyObject_CallFinalizerFromDealloc(o)) return;
6145   }
6146   #endif
6147   {
6148     PyObject *etype, *eval, *etb;
6149     PyErr_Fetch(&etype, &eval, &etb);
6150     __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
6151     __pyx_pw_6pygame_4pypm_6Output_3__dealloc__(o);
6152     __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
6153     PyErr_Restore(etype, eval, etb);
6154   }
6155   (*Py_TYPE(o)->tp_free)(o);
6156 }
6157 
6158 static PyMethodDef __pyx_methods_6pygame_4pypm_Output[] = {
6159   {"_check_open", (PyCFunction)__pyx_pw_6pygame_4pypm_6Output_5_check_open, METH_NOARGS, __pyx_doc_6pygame_4pypm_6Output_4_check_open},
6160   {"Close", (PyCFunction)__pyx_pw_6pygame_4pypm_6Output_7Close, METH_NOARGS, __pyx_doc_6pygame_4pypm_6Output_6Close},
6161   {"Abort", (PyCFunction)__pyx_pw_6pygame_4pypm_6Output_9Abort, METH_NOARGS, __pyx_doc_6pygame_4pypm_6Output_8Abort},
6162   {"Write", (PyCFunction)__pyx_pw_6pygame_4pypm_6Output_11Write, METH_O, __pyx_doc_6pygame_4pypm_6Output_10Write},
6163   {"WriteShort", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pygame_4pypm_6Output_13WriteShort, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pygame_4pypm_6Output_12WriteShort},
6164   {"WriteSysEx", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6pygame_4pypm_6Output_15WriteSysEx, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6pygame_4pypm_6Output_14WriteSysEx},
6165   {"__reduce_cython__", (PyCFunction)__pyx_pw_6pygame_4pypm_6Output_17__reduce_cython__, METH_NOARGS, 0},
6166   {"__setstate_cython__", (PyCFunction)__pyx_pw_6pygame_4pypm_6Output_19__setstate_cython__, METH_O, 0},
6167   {0, 0, 0, 0}
6168 };
6169 
6170 static PyTypeObject __pyx_type_6pygame_4pypm_Output = {
6171   PyVarObject_HEAD_INIT(0, 0)
6172   "pygame.pypm.Output", /*tp_name*/
6173   sizeof(struct __pyx_obj_6pygame_4pypm_Output), /*tp_basicsize*/
6174   0, /*tp_itemsize*/
6175   __pyx_tp_dealloc_6pygame_4pypm_Output, /*tp_dealloc*/
6176   #if PY_VERSION_HEX < 0x030800b4
6177   0, /*tp_print*/
6178   #endif
6179   #if PY_VERSION_HEX >= 0x030800b4
6180   0, /*tp_vectorcall_offset*/
6181   #endif
6182   0, /*tp_getattr*/
6183   0, /*tp_setattr*/
6184   #if PY_MAJOR_VERSION < 3
6185   0, /*tp_compare*/
6186   #endif
6187   #if PY_MAJOR_VERSION >= 3
6188   0, /*tp_as_async*/
6189   #endif
6190   0, /*tp_repr*/
6191   0, /*tp_as_number*/
6192   0, /*tp_as_sequence*/
6193   0, /*tp_as_mapping*/
6194   0, /*tp_hash*/
6195   0, /*tp_call*/
6196   0, /*tp_str*/
6197   0, /*tp_getattro*/
6198   0, /*tp_setattro*/
6199   0, /*tp_as_buffer*/
6200   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
6201   "Represents an output MIDI stream device.\n\n    Takes the form::\n\n        output = pypm.Output(output_device, latency)\n\n    latency is in ms. If latency == 0 then timestamps for output are ignored.\n\n    ", /*tp_doc*/
6202   0, /*tp_traverse*/
6203   0, /*tp_clear*/
6204   0, /*tp_richcompare*/
6205   0, /*tp_weaklistoffset*/
6206   0, /*tp_iter*/
6207   0, /*tp_iternext*/
6208   __pyx_methods_6pygame_4pypm_Output, /*tp_methods*/
6209   0, /*tp_members*/
6210   0, /*tp_getset*/
6211   0, /*tp_base*/
6212   0, /*tp_dict*/
6213   0, /*tp_descr_get*/
6214   0, /*tp_descr_set*/
6215   0, /*tp_dictoffset*/
6216   __pyx_pw_6pygame_4pypm_6Output_1__init__, /*tp_init*/
6217   0, /*tp_alloc*/
6218   __pyx_tp_new_6pygame_4pypm_Output, /*tp_new*/
6219   0, /*tp_free*/
6220   0, /*tp_is_gc*/
6221   0, /*tp_bases*/
6222   0, /*tp_mro*/
6223   0, /*tp_cache*/
6224   0, /*tp_subclasses*/
6225   0, /*tp_weaklist*/
6226   0, /*tp_del*/
6227   0, /*tp_version_tag*/
6228   #if PY_VERSION_HEX >= 0x030400a1
6229   0, /*tp_finalize*/
6230   #endif
6231   #if PY_VERSION_HEX >= 0x030800b1
6232   0, /*tp_vectorcall*/
6233   #endif
6234   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
6235   0, /*tp_print*/
6236   #endif
6237 };
6238 
__pyx_tp_new_6pygame_4pypm_Input(PyTypeObject * t,CYTHON_UNUSED PyObject * a,CYTHON_UNUSED PyObject * k)6239 static PyObject *__pyx_tp_new_6pygame_4pypm_Input(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
6240   PyObject *o;
6241   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
6242     o = (*t->tp_alloc)(t, 0);
6243   } else {
6244     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
6245   }
6246   if (unlikely(!o)) return 0;
6247   return o;
6248 }
6249 
__pyx_tp_dealloc_6pygame_4pypm_Input(PyObject * o)6250 static void __pyx_tp_dealloc_6pygame_4pypm_Input(PyObject *o) {
6251   #if CYTHON_USE_TP_FINALIZE
6252   if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
6253     if (PyObject_CallFinalizerFromDealloc(o)) return;
6254   }
6255   #endif
6256   {
6257     PyObject *etype, *eval, *etb;
6258     PyErr_Fetch(&etype, &eval, &etb);
6259     __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
6260     __pyx_pw_6pygame_4pypm_5Input_3__dealloc__(o);
6261     __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
6262     PyErr_Restore(etype, eval, etb);
6263   }
6264   (*Py_TYPE(o)->tp_free)(o);
6265 }
6266 
6267 static PyMethodDef __pyx_methods_6pygame_4pypm_Input[] = {
6268   {"_check_open", (PyCFunction)__pyx_pw_6pygame_4pypm_5Input_5_check_open, METH_NOARGS, __pyx_doc_6pygame_4pypm_5Input_4_check_open},
6269   {"Close", (PyCFunction)__pyx_pw_6pygame_4pypm_5Input_7Close, METH_NOARGS, __pyx_doc_6pygame_4pypm_5Input_6Close},
6270   {"SetFilter", (PyCFunction)__pyx_pw_6pygame_4pypm_5Input_9SetFilter, METH_O, __pyx_doc_6pygame_4pypm_5Input_8SetFilter},
6271   {"SetChannelMask", (PyCFunction)__pyx_pw_6pygame_4pypm_5Input_11SetChannelMask, METH_O, __pyx_doc_6pygame_4pypm_5Input_10SetChannelMask},
6272   {"Poll", (PyCFunction)__pyx_pw_6pygame_4pypm_5Input_13Poll, METH_NOARGS, __pyx_doc_6pygame_4pypm_5Input_12Poll},
6273   {"Read", (PyCFunction)__pyx_pw_6pygame_4pypm_5Input_15Read, METH_O, __pyx_doc_6pygame_4pypm_5Input_14Read},
6274   {"__reduce_cython__", (PyCFunction)__pyx_pw_6pygame_4pypm_5Input_17__reduce_cython__, METH_NOARGS, 0},
6275   {"__setstate_cython__", (PyCFunction)__pyx_pw_6pygame_4pypm_5Input_19__setstate_cython__, METH_O, 0},
6276   {0, 0, 0, 0}
6277 };
6278 
6279 static PyTypeObject __pyx_type_6pygame_4pypm_Input = {
6280   PyVarObject_HEAD_INIT(0, 0)
6281   "pygame.pypm.Input", /*tp_name*/
6282   sizeof(struct __pyx_obj_6pygame_4pypm_Input), /*tp_basicsize*/
6283   0, /*tp_itemsize*/
6284   __pyx_tp_dealloc_6pygame_4pypm_Input, /*tp_dealloc*/
6285   #if PY_VERSION_HEX < 0x030800b4
6286   0, /*tp_print*/
6287   #endif
6288   #if PY_VERSION_HEX >= 0x030800b4
6289   0, /*tp_vectorcall_offset*/
6290   #endif
6291   0, /*tp_getattr*/
6292   0, /*tp_setattr*/
6293   #if PY_MAJOR_VERSION < 3
6294   0, /*tp_compare*/
6295   #endif
6296   #if PY_MAJOR_VERSION >= 3
6297   0, /*tp_as_async*/
6298   #endif
6299   0, /*tp_repr*/
6300   0, /*tp_as_number*/
6301   0, /*tp_as_sequence*/
6302   0, /*tp_as_mapping*/
6303   0, /*tp_hash*/
6304   0, /*tp_call*/
6305   0, /*tp_str*/
6306   0, /*tp_getattro*/
6307   0, /*tp_setattro*/
6308   0, /*tp_as_buffer*/
6309   Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
6310   "Represents an input MIDI stream device.\n\n    Takes the form::\n\n        input = pypm.Input(input_device)\n\n    ", /*tp_doc*/
6311   0, /*tp_traverse*/
6312   0, /*tp_clear*/
6313   0, /*tp_richcompare*/
6314   0, /*tp_weaklistoffset*/
6315   0, /*tp_iter*/
6316   0, /*tp_iternext*/
6317   __pyx_methods_6pygame_4pypm_Input, /*tp_methods*/
6318   0, /*tp_members*/
6319   0, /*tp_getset*/
6320   0, /*tp_base*/
6321   0, /*tp_dict*/
6322   0, /*tp_descr_get*/
6323   0, /*tp_descr_set*/
6324   0, /*tp_dictoffset*/
6325   __pyx_pw_6pygame_4pypm_5Input_1__init__, /*tp_init*/
6326   0, /*tp_alloc*/
6327   __pyx_tp_new_6pygame_4pypm_Input, /*tp_new*/
6328   0, /*tp_free*/
6329   0, /*tp_is_gc*/
6330   0, /*tp_bases*/
6331   0, /*tp_mro*/
6332   0, /*tp_cache*/
6333   0, /*tp_subclasses*/
6334   0, /*tp_weaklist*/
6335   0, /*tp_del*/
6336   0, /*tp_version_tag*/
6337   #if PY_VERSION_HEX >= 0x030400a1
6338   0, /*tp_finalize*/
6339   #endif
6340   #if PY_VERSION_HEX >= 0x030800b1
6341   0, /*tp_vectorcall*/
6342   #endif
6343   #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
6344   0, /*tp_print*/
6345   #endif
6346 };
6347 
6348 static PyMethodDef __pyx_methods[] = {
6349   {0, 0, 0, 0}
6350 };
6351 
6352 #if PY_MAJOR_VERSION >= 3
6353 #if CYTHON_PEP489_MULTI_PHASE_INIT
6354 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
6355 static int __pyx_pymod_exec_pypm(PyObject* module); /*proto*/
6356 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
6357   {Py_mod_create, (void*)__pyx_pymod_create},
6358   {Py_mod_exec, (void*)__pyx_pymod_exec_pypm},
6359   {0, NULL}
6360 };
6361 #endif
6362 
6363 static struct PyModuleDef __pyx_moduledef = {
6364     PyModuleDef_HEAD_INIT,
6365     "pypm",
6366     0, /* m_doc */
6367   #if CYTHON_PEP489_MULTI_PHASE_INIT
6368     0, /* m_size */
6369   #else
6370     -1, /* m_size */
6371   #endif
6372     __pyx_methods /* m_methods */,
6373   #if CYTHON_PEP489_MULTI_PHASE_INIT
6374     __pyx_moduledef_slots, /* m_slots */
6375   #else
6376     NULL, /* m_reload */
6377   #endif
6378     NULL, /* m_traverse */
6379     NULL, /* m_clear */
6380     NULL /* m_free */
6381 };
6382 #endif
6383 #ifndef CYTHON_SMALL_CODE
6384 #if defined(__clang__)
6385     #define CYTHON_SMALL_CODE
6386 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
6387     #define CYTHON_SMALL_CODE __attribute__((cold))
6388 #else
6389     #define CYTHON_SMALL_CODE
6390 #endif
6391 #endif
6392 
6393 static __Pyx_StringTabEntry __pyx_string_tab[] = {
6394   {&__pyx_kp_s_0_0_6, __pyx_k_0_0_6, sizeof(__pyx_k_0_0_6), 0, 0, 1, 0},
6395   {&__pyx_n_s_B, __pyx_k_B, sizeof(__pyx_k_B), 0, 0, 1, 1},
6396   {&__pyx_n_s_Channel, __pyx_k_Channel, sizeof(__pyx_k_Channel), 0, 0, 1, 1},
6397   {&__pyx_kp_s_Closing_MIDI_input_stream_and_de, __pyx_k_Closing_MIDI_input_stream_and_de, sizeof(__pyx_k_Closing_MIDI_input_stream_and_de), 0, 0, 1, 0},
6398   {&__pyx_kp_s_Closing_MIDI_output_stream_and_d, __pyx_k_Closing_MIDI_output_stream_and_d, sizeof(__pyx_k_Closing_MIDI_output_stream_and_d), 0, 0, 1, 0},
6399   {&__pyx_n_s_CountDevices, __pyx_k_CountDevices, sizeof(__pyx_k_CountDevices), 0, 0, 1, 1},
6400   {&__pyx_n_s_FALSE, __pyx_k_FALSE, sizeof(__pyx_k_FALSE), 0, 0, 1, 1},
6401   {&__pyx_n_s_FILT_ACTIVE, __pyx_k_FILT_ACTIVE, sizeof(__pyx_k_FILT_ACTIVE), 0, 0, 1, 1},
6402   {&__pyx_n_s_FILT_AFTERTOUCH, __pyx_k_FILT_AFTERTOUCH, sizeof(__pyx_k_FILT_AFTERTOUCH), 0, 0, 1, 1},
6403   {&__pyx_n_s_FILT_CHANNEL_AFTERTOUCH, __pyx_k_FILT_CHANNEL_AFTERTOUCH, sizeof(__pyx_k_FILT_CHANNEL_AFTERTOUCH), 0, 0, 1, 1},
6404   {&__pyx_n_s_FILT_CLOCK, __pyx_k_FILT_CLOCK, sizeof(__pyx_k_FILT_CLOCK), 0, 0, 1, 1},
6405   {&__pyx_n_s_FILT_CONTROL, __pyx_k_FILT_CONTROL, sizeof(__pyx_k_FILT_CONTROL), 0, 0, 1, 1},
6406   {&__pyx_n_s_FILT_F9, __pyx_k_FILT_F9, sizeof(__pyx_k_FILT_F9), 0, 0, 1, 1},
6407   {&__pyx_n_s_FILT_FD, __pyx_k_FILT_FD, sizeof(__pyx_k_FILT_FD), 0, 0, 1, 1},
6408   {&__pyx_n_s_FILT_MTC, __pyx_k_FILT_MTC, sizeof(__pyx_k_FILT_MTC), 0, 0, 1, 1},
6409   {&__pyx_n_s_FILT_NOTE, __pyx_k_FILT_NOTE, sizeof(__pyx_k_FILT_NOTE), 0, 0, 1, 1},
6410   {&__pyx_n_s_FILT_PITCHBEND, __pyx_k_FILT_PITCHBEND, sizeof(__pyx_k_FILT_PITCHBEND), 0, 0, 1, 1},
6411   {&__pyx_n_s_FILT_PLAY, __pyx_k_FILT_PLAY, sizeof(__pyx_k_FILT_PLAY), 0, 0, 1, 1},
6412   {&__pyx_n_s_FILT_POLY_AFTERTOUCH, __pyx_k_FILT_POLY_AFTERTOUCH, sizeof(__pyx_k_FILT_POLY_AFTERTOUCH), 0, 0, 1, 1},
6413   {&__pyx_n_s_FILT_PROGRAM, __pyx_k_FILT_PROGRAM, sizeof(__pyx_k_FILT_PROGRAM), 0, 0, 1, 1},
6414   {&__pyx_n_s_FILT_REALTIME, __pyx_k_FILT_REALTIME, sizeof(__pyx_k_FILT_REALTIME), 0, 0, 1, 1},
6415   {&__pyx_n_s_FILT_RESET, __pyx_k_FILT_RESET, sizeof(__pyx_k_FILT_RESET), 0, 0, 1, 1},
6416   {&__pyx_n_s_FILT_SONG_POSITION, __pyx_k_FILT_SONG_POSITION, sizeof(__pyx_k_FILT_SONG_POSITION), 0, 0, 1, 1},
6417   {&__pyx_n_s_FILT_SONG_SELECT, __pyx_k_FILT_SONG_SELECT, sizeof(__pyx_k_FILT_SONG_SELECT), 0, 0, 1, 1},
6418   {&__pyx_n_s_FILT_SYSEX, __pyx_k_FILT_SYSEX, sizeof(__pyx_k_FILT_SYSEX), 0, 0, 1, 1},
6419   {&__pyx_n_s_FILT_TICK, __pyx_k_FILT_TICK, sizeof(__pyx_k_FILT_TICK), 0, 0, 1, 1},
6420   {&__pyx_n_s_FILT_TUNE, __pyx_k_FILT_TUNE, sizeof(__pyx_k_FILT_TUNE), 0, 0, 1, 1},
6421   {&__pyx_n_s_FILT_UNDEFINED, __pyx_k_FILT_UNDEFINED, sizeof(__pyx_k_FILT_UNDEFINED), 0, 0, 1, 1},
6422   {&__pyx_n_s_GetDefaultInputDeviceID, __pyx_k_GetDefaultInputDeviceID, sizeof(__pyx_k_GetDefaultInputDeviceID), 0, 0, 1, 1},
6423   {&__pyx_n_s_GetDefaultOutputDeviceID, __pyx_k_GetDefaultOutputDeviceID, sizeof(__pyx_k_GetDefaultOutputDeviceID), 0, 0, 1, 1},
6424   {&__pyx_n_s_GetDeviceInfo, __pyx_k_GetDeviceInfo, sizeof(__pyx_k_GetDeviceInfo), 0, 0, 1, 1},
6425   {&__pyx_n_s_GetErrorText, __pyx_k_GetErrorText, sizeof(__pyx_k_GetErrorText), 0, 0, 1, 1},
6426   {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
6427   {&__pyx_n_s_Initialize, __pyx_k_Initialize, sizeof(__pyx_k_Initialize), 0, 0, 1, 1},
6428   {&__pyx_n_s_Input, __pyx_k_Input, sizeof(__pyx_k_Input), 0, 0, 1, 1},
6429   {&__pyx_kp_s_MIDI_input_opened, __pyx_k_MIDI_input_opened, sizeof(__pyx_k_MIDI_input_opened), 0, 0, 1, 0},
6430   {&__pyx_kp_s_Maximum_buffer_length_is_1024, __pyx_k_Maximum_buffer_length_is_1024, sizeof(__pyx_k_Maximum_buffer_length_is_1024), 0, 0, 1, 0},
6431   {&__pyx_kp_s_Maximum_event_list_length_is_102, __pyx_k_Maximum_event_list_length_is_102, sizeof(__pyx_k_Maximum_event_list_length_is_102), 0, 0, 1, 0},
6432   {&__pyx_kp_s_Minimum_buffer_length_is_1, __pyx_k_Minimum_buffer_length_is_1, sizeof(__pyx_k_Minimum_buffer_length_is_1), 0, 0, 1, 0},
6433   {&__pyx_kp_s_No_data_in_event_no_i, __pyx_k_No_data_in_event_no_i, sizeof(__pyx_k_No_data_in_event_no_i), 0, 0, 1, 0},
6434   {&__pyx_kp_s_Opening_Midi_Output, __pyx_k_Opening_Midi_Output, sizeof(__pyx_k_Opening_Midi_Output), 0, 0, 1, 0},
6435   {&__pyx_n_s_Output, __pyx_k_Output, sizeof(__pyx_k_Output), 0, 0, 1, 1},
6436   {&__pyx_kp_s_Pm_OpenOutput_err, __pyx_k_Pm_OpenOutput_err, sizeof(__pyx_k_Pm_OpenOutput_err), 0, 0, 1, 0},
6437   {&__pyx_n_s_TRUE, __pyx_k_TRUE, sizeof(__pyx_k_TRUE), 0, 0, 1, 1},
6438   {&__pyx_n_s_Terminate, __pyx_k_Terminate, sizeof(__pyx_k_Terminate), 0, 0, 1, 1},
6439   {&__pyx_n_s_Time, __pyx_k_Time, sizeof(__pyx_k_Time), 0, 0, 1, 1},
6440   {&__pyx_kp_s_Too_many_data_bytes_i_in_event_n, __pyx_k_Too_many_data_bytes_i_in_event_n, sizeof(__pyx_k_Too_many_data_bytes_i_in_event_n), 0, 0, 1, 0},
6441   {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
6442   {&__pyx_kp_s_Unable_to_open_Midi_OutputDevice, __pyx_k_Unable_to_open_Midi_OutputDevice, sizeof(__pyx_k_Unable_to_open_Midi_OutputDevice), 0, 0, 1, 0},
6443   {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
6444   {&__pyx_kp_s_Writing_to_MIDI_buffer, __pyx_k_Writing_to_MIDI_buffer, sizeof(__pyx_k_Writing_to_MIDI_buffer), 0, 0, 1, 0},
6445   {&__pyx_kp_s_Writing_to_midi_buffer, __pyx_k_Writing_to_midi_buffer, sizeof(__pyx_k_Writing_to_midi_buffer), 0, 0, 1, 0},
6446   {&__pyx_n_s_array, __pyx_k_array, sizeof(__pyx_k_array), 0, 0, 1, 1},
6447   {&__pyx_n_s_buffer_size, __pyx_k_buffer_size, sizeof(__pyx_k_buffer_size), 0, 0, 1, 1},
6448   {&__pyx_n_s_buffersize, __pyx_k_buffersize, sizeof(__pyx_k_buffersize), 0, 0, 1, 1},
6449   {&__pyx_n_s_chan, __pyx_k_chan, sizeof(__pyx_k_chan), 0, 0, 1, 1},
6450   {&__pyx_n_s_check_open, __pyx_k_check_open, sizeof(__pyx_k_check_open), 0, 0, 1, 1},
6451   {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
6452   {&__pyx_n_s_data1, __pyx_k_data1, sizeof(__pyx_k_data1), 0, 0, 1, 1},
6453   {&__pyx_n_s_data2, __pyx_k_data2, sizeof(__pyx_k_data2), 0, 0, 1, 1},
6454   {&__pyx_n_s_device_no, __pyx_k_device_no, sizeof(__pyx_k_device_no), 0, 0, 1, 1},
6455   {&__pyx_n_s_end, __pyx_k_end, sizeof(__pyx_k_end), 0, 0, 1, 1},
6456   {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
6457   {&__pyx_n_s_err, __pyx_k_err, sizeof(__pyx_k_err), 0, 0, 1, 1},
6458   {&__pyx_n_s_file, __pyx_k_file, sizeof(__pyx_k_file), 0, 0, 1, 1},
6459   {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
6460   {&__pyx_kp_s_i_r_s, __pyx_k_i_r_s, sizeof(__pyx_k_i_r_s), 0, 0, 1, 0},
6461   {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
6462   {&__pyx_n_s_info, __pyx_k_info, sizeof(__pyx_k_info), 0, 0, 1, 1},
6463   {&__pyx_n_s_input_device, __pyx_k_input_device, sizeof(__pyx_k_input_device), 0, 0, 1, 1},
6464   {&__pyx_n_s_latency, __pyx_k_latency, sizeof(__pyx_k_latency), 0, 0, 1, 1},
6465   {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
6466   {&__pyx_kp_s_midi_Input_not_open, __pyx_k_midi_Input_not_open, sizeof(__pyx_k_midi_Input_not_open), 0, 0, 1, 0},
6467   {&__pyx_kp_s_midi_Output_aborted_Need_to_call, __pyx_k_midi_Output_aborted_Need_to_call, sizeof(__pyx_k_midi_Output_aborted_Need_to_call), 0, 0, 1, 0},
6468   {&__pyx_kp_s_midi_Output_not_open, __pyx_k_midi_Output_not_open, sizeof(__pyx_k_midi_Output_not_open), 0, 0, 1, 0},
6469   {&__pyx_n_s_msg, __pyx_k_msg, sizeof(__pyx_k_msg), 0, 0, 1, 1},
6470   {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
6471   {&__pyx_n_s_output_device, __pyx_k_output_device, sizeof(__pyx_k_output_device), 0, 0, 1, 1},
6472   {&__pyx_n_s_print, __pyx_k_print, sizeof(__pyx_k_print), 0, 0, 1, 1},
6473   {&__pyx_n_s_pygame_pypm, __pyx_k_pygame_pypm, sizeof(__pyx_k_pygame_pypm), 0, 0, 1, 1},
6474   {&__pyx_n_s_pypm_initialized, __pyx_k_pypm_initialized, sizeof(__pyx_k_pypm_initialized), 0, 0, 1, 1},
6475   {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
6476   {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
6477   {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
6478   {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
6479   {&__pyx_kp_s_self_midi_cannot_be_converted_to, __pyx_k_self_midi_cannot_be_converted_to, sizeof(__pyx_k_self_midi_cannot_be_converted_to), 0, 0, 1, 0},
6480   {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
6481   {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
6482   {&__pyx_kp_s_src_c_cython_pygame_pypm_pyx, __pyx_k_src_c_cython_pygame_pypm_pyx, sizeof(__pyx_k_src_c_cython_pygame_pypm_pyx), 0, 0, 1, 0},
6483   {&__pyx_n_s_status, __pyx_k_status, sizeof(__pyx_k_status), 0, 0, 1, 1},
6484   {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1},
6485   {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
6486   {&__pyx_n_s_tobytes, __pyx_k_tobytes, sizeof(__pyx_k_tobytes), 0, 0, 1, 1},
6487   {&__pyx_n_s_tostring, __pyx_k_tostring, sizeof(__pyx_k_tostring), 0, 0, 1, 1},
6488   {&__pyx_n_s_version, __pyx_k_version, sizeof(__pyx_k_version), 0, 0, 1, 1},
6489   {&__pyx_n_s_version_info, __pyx_k_version_info, sizeof(__pyx_k_version_info), 0, 0, 1, 1},
6490   {&__pyx_n_s_when, __pyx_k_when, sizeof(__pyx_k_when), 0, 0, 1, 1},
6491   {0, 0, 0, 0, 0, 0, 0}
6492 };
__Pyx_InitCachedBuiltins(void)6493 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
6494   __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(0, 413, __pyx_L1_error)
6495   __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 415, __pyx_L1_error)
6496   __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 417, __pyx_L1_error)
6497   __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 424, __pyx_L1_error)
6498   __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(1, 2, __pyx_L1_error)
6499   return 0;
6500   __pyx_L1_error:;
6501   return -1;
6502 }
6503 
__Pyx_InitCachedConstants(void)6504 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
6505   __Pyx_RefNannyDeclarations
6506   __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
6507 
6508   /* "pygame/pypm.pyx":327
6509  *
6510  *         if self.midi == NULL:
6511  *             raise Exception("midi Output not open.")             # <<<<<<<<<<<<<<
6512  *
6513  *         if self._aborted:
6514  */
6515   __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_midi_Output_not_open); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 327, __pyx_L1_error)
6516   __Pyx_GOTREF(__pyx_tuple_);
6517   __Pyx_GIVEREF(__pyx_tuple_);
6518 
6519   /* "pygame/pypm.pyx":330
6520  *
6521  *         if self._aborted:
6522  *             raise Exception(             # <<<<<<<<<<<<<<
6523  *                 "midi Output aborted. Need to call Close after Abort.")
6524  *
6525  */
6526   __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_midi_Output_aborted_Need_to_call); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 330, __pyx_L1_error)
6527   __Pyx_GOTREF(__pyx_tuple__2);
6528   __Pyx_GIVEREF(__pyx_tuple__2);
6529 
6530   /* "pygame/pypm.pyx":413
6531  *
6532  *         if len(data) > 1024:
6533  *             raise IndexError('Maximum event list length is 1024.')             # <<<<<<<<<<<<<<
6534  *         else:
6535  *             for ev_no, event in enumerate(data):
6536  */
6537   __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_Maximum_event_list_length_is_102); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 413, __pyx_L1_error)
6538   __Pyx_GOTREF(__pyx_tuple__3);
6539   __Pyx_GIVEREF(__pyx_tuple__3);
6540 
6541   /* "(tree fragment)":2
6542  * def __reduce_cython__(self):
6543  *     raise TypeError("self.midi cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
6544  * def __setstate_cython__(self, __pyx_state):
6545  *     raise TypeError("self.midi cannot be converted to a Python object for pickling")
6546  */
6547   __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_self_midi_cannot_be_converted_to); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 2, __pyx_L1_error)
6548   __Pyx_GOTREF(__pyx_tuple__4);
6549   __Pyx_GIVEREF(__pyx_tuple__4);
6550 
6551   /* "(tree fragment)":4
6552  *     raise TypeError("self.midi cannot be converted to a Python object for pickling")
6553  * def __setstate_cython__(self, __pyx_state):
6554  *     raise TypeError("self.midi cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
6555  */
6556   __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_self_midi_cannot_be_converted_to); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 4, __pyx_L1_error)
6557   __Pyx_GOTREF(__pyx_tuple__5);
6558   __Pyx_GIVEREF(__pyx_tuple__5);
6559 
6560   /* "pygame/pypm.pyx":574
6561  *         """
6562  *         if self.midi == NULL:
6563  *             raise Exception("midi Input not open.")             # <<<<<<<<<<<<<<
6564  *
6565  *     def Close(self):
6566  */
6567   __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_midi_Input_not_open); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 574, __pyx_L1_error)
6568   __Pyx_GOTREF(__pyx_tuple__6);
6569   __Pyx_GIVEREF(__pyx_tuple__6);
6570 
6571   /* "pygame/pypm.pyx":703
6572  *
6573  *         if max_events > 1024:
6574  *             raise ValueError('Maximum buffer length is 1024.')             # <<<<<<<<<<<<<<
6575  *         if not max_events:
6576  *             raise ValueError('Minimum buffer length is 1.')
6577  */
6578   __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_Maximum_buffer_length_is_1024); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 703, __pyx_L1_error)
6579   __Pyx_GOTREF(__pyx_tuple__7);
6580   __Pyx_GIVEREF(__pyx_tuple__7);
6581 
6582   /* "pygame/pypm.pyx":705
6583  *             raise ValueError('Maximum buffer length is 1024.')
6584  *         if not max_events:
6585  *             raise ValueError('Minimum buffer length is 1.')             # <<<<<<<<<<<<<<
6586  *
6587  *         num_events = Pm_Read(self.midi, buffer, max_events)
6588  */
6589   __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_Minimum_buffer_length_is_1); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 705, __pyx_L1_error)
6590   __Pyx_GOTREF(__pyx_tuple__8);
6591   __Pyx_GIVEREF(__pyx_tuple__8);
6592 
6593   /* "(tree fragment)":2
6594  * def __reduce_cython__(self):
6595  *     raise TypeError("self.midi cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
6596  * def __setstate_cython__(self, __pyx_state):
6597  *     raise TypeError("self.midi cannot be converted to a Python object for pickling")
6598  */
6599   __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_self_midi_cannot_be_converted_to); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 2, __pyx_L1_error)
6600   __Pyx_GOTREF(__pyx_tuple__9);
6601   __Pyx_GIVEREF(__pyx_tuple__9);
6602 
6603   /* "(tree fragment)":4
6604  *     raise TypeError("self.midi cannot be converted to a Python object for pickling")
6605  * def __setstate_cython__(self, __pyx_state):
6606  *     raise TypeError("self.midi cannot be converted to a Python object for pickling")             # <<<<<<<<<<<<<<
6607  */
6608   __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_self_midi_cannot_be_converted_to); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(1, 4, __pyx_L1_error)
6609   __Pyx_GOTREF(__pyx_tuple__10);
6610   __Pyx_GIVEREF(__pyx_tuple__10);
6611 
6612   /* "pygame/pypm.pyx":154
6613  * cdef long _pypm_initialized
6614  *
6615  * def Initialize():             # <<<<<<<<<<<<<<
6616  *     """Initialize PortMidi library.
6617  *
6618  */
6619   __pyx_tuple__11 = PyTuple_Pack(1, __pyx_n_s_pypm_initialized); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 154, __pyx_L1_error)
6620   __Pyx_GOTREF(__pyx_tuple__11);
6621   __Pyx_GIVEREF(__pyx_tuple__11);
6622   __pyx_codeobj__12 = (PyObject*)__Pyx_PyCode_New(0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__11, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_c_cython_pygame_pypm_pyx, __pyx_n_s_Initialize, 154, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__12)) __PYX_ERR(0, 154, __pyx_L1_error)
6623 
6624   /* "pygame/pypm.pyx":166
6625  *     _pypm_initialized = 1
6626  *
6627  * def Terminate():             # <<<<<<<<<<<<<<
6628  *     """Terminate use of PortMidi library.
6629  *
6630  */
6631   __pyx_tuple__13 = PyTuple_Pack(1, __pyx_n_s_pypm_initialized); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 166, __pyx_L1_error)
6632   __Pyx_GOTREF(__pyx_tuple__13);
6633   __Pyx_GIVEREF(__pyx_tuple__13);
6634   __pyx_codeobj__14 = (PyObject*)__Pyx_PyCode_New(0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__13, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_c_cython_pygame_pypm_pyx, __pyx_n_s_Terminate, 166, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__14)) __PYX_ERR(0, 166, __pyx_L1_error)
6635 
6636   /* "pygame/pypm.pyx":179
6637  *
6638  *
6639  * def GetDefaultInputDeviceID():             # <<<<<<<<<<<<<<
6640  *     """Return the number of the default MIDI input device.
6641  *
6642  */
6643   __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_c_cython_pygame_pypm_pyx, __pyx_n_s_GetDefaultInputDeviceID, 179, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 179, __pyx_L1_error)
6644 
6645   /* "pygame/pypm.pyx":188
6646  *     return Pm_GetDefaultInputDeviceID()
6647  *
6648  * def GetDefaultOutputDeviceID():             # <<<<<<<<<<<<<<
6649  *     """Return the number of the default MIDI output device.
6650  *
6651  */
6652   __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_c_cython_pygame_pypm_pyx, __pyx_n_s_GetDefaultOutputDeviceID, 188, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(0, 188, __pyx_L1_error)
6653 
6654   /* "pygame/pypm.pyx":197
6655  *     return Pm_GetDefaultOutputDeviceID()
6656  *
6657  * def CountDevices():             # <<<<<<<<<<<<<<
6658  *     """Return number of available MIDI (input and output) devices."""
6659  *
6660  */
6661   __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_c_cython_pygame_pypm_pyx, __pyx_n_s_CountDevices, 197, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(0, 197, __pyx_L1_error)
6662 
6663   /* "pygame/pypm.pyx":202
6664  *     return Pm_CountDevices()
6665  *
6666  * def GetDeviceInfo(device_no):             # <<<<<<<<<<<<<<
6667  *     """Return device info tuple for MIDI device given by device_no.
6668  *
6669  */
6670   __pyx_tuple__18 = PyTuple_Pack(2, __pyx_n_s_device_no, __pyx_n_s_info); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 202, __pyx_L1_error)
6671   __Pyx_GOTREF(__pyx_tuple__18);
6672   __Pyx_GIVEREF(__pyx_tuple__18);
6673   __pyx_codeobj__19 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_c_cython_pygame_pypm_pyx, __pyx_n_s_GetDeviceInfo, 202, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(0, 202, __pyx_L1_error)
6674 
6675   /* "pygame/pypm.pyx":224
6676  *     # return None
6677  *
6678  * def Time():             # <<<<<<<<<<<<<<
6679  *     """Return the current time in ms of the PortMidi timer."""
6680  *
6681  */
6682   __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_c_cython_pygame_pypm_pyx, __pyx_n_s_Time, 224, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 224, __pyx_L1_error)
6683 
6684   /* "pygame/pypm.pyx":229
6685  *     return Pt_Time()
6686  *
6687  * def GetErrorText(err):             # <<<<<<<<<<<<<<
6688  *     """Return human-readable error message translated from error number."""
6689  *
6690  */
6691   __pyx_tuple__21 = PyTuple_Pack(1, __pyx_n_s_err); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 229, __pyx_L1_error)
6692   __Pyx_GOTREF(__pyx_tuple__21);
6693   __Pyx_GIVEREF(__pyx_tuple__21);
6694   __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_c_cython_pygame_pypm_pyx, __pyx_n_s_GetErrorText, 229, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 229, __pyx_L1_error)
6695 
6696   /* "pygame/pypm.pyx":234
6697  *     return Pm_GetErrorText(err)
6698  *
6699  * def Channel(chan):             # <<<<<<<<<<<<<<
6700  *     """Return Channel object for given MIDI channel number 1 - 16.
6701  *
6702  */
6703   __pyx_tuple__23 = PyTuple_Pack(1, __pyx_n_s_chan); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 234, __pyx_L1_error)
6704   __Pyx_GOTREF(__pyx_tuple__23);
6705   __Pyx_GIVEREF(__pyx_tuple__23);
6706   __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_c_cython_pygame_pypm_pyx, __pyx_n_s_Channel, 234, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 234, __pyx_L1_error)
6707   __Pyx_RefNannyFinishContext();
6708   return 0;
6709   __pyx_L1_error:;
6710   __Pyx_RefNannyFinishContext();
6711   return -1;
6712 }
6713 
__Pyx_InitGlobals(void)6714 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
6715   if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
6716   __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
6717   __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
6718   __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error)
6719   __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error)
6720   __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __PYX_ERR(0, 1, __pyx_L1_error)
6721   __pyx_int_8 = PyInt_FromLong(8); if (unlikely(!__pyx_int_8)) __PYX_ERR(0, 1, __pyx_L1_error)
6722   __pyx_int_16 = PyInt_FromLong(16); if (unlikely(!__pyx_int_16)) __PYX_ERR(0, 1, __pyx_L1_error)
6723   __pyx_int_32 = PyInt_FromLong(32); if (unlikely(!__pyx_int_32)) __PYX_ERR(0, 1, __pyx_L1_error)
6724   __pyx_int_48 = PyInt_FromLong(48); if (unlikely(!__pyx_int_48)) __PYX_ERR(0, 1, __pyx_L1_error)
6725   __pyx_int_64 = PyInt_FromLong(64); if (unlikely(!__pyx_int_64)) __PYX_ERR(0, 1, __pyx_L1_error)
6726   __pyx_int_127 = PyInt_FromLong(127); if (unlikely(!__pyx_int_127)) __PYX_ERR(0, 1, __pyx_L1_error)
6727   __pyx_int_128 = PyInt_FromLong(128); if (unlikely(!__pyx_int_128)) __PYX_ERR(0, 1, __pyx_L1_error)
6728   __pyx_int_255 = PyInt_FromLong(255); if (unlikely(!__pyx_int_255)) __PYX_ERR(0, 1, __pyx_L1_error)
6729   __pyx_int_256 = PyInt_FromLong(256); if (unlikely(!__pyx_int_256)) __PYX_ERR(0, 1, __pyx_L1_error)
6730   __pyx_int_512 = PyInt_FromLong(512); if (unlikely(!__pyx_int_512)) __PYX_ERR(0, 1, __pyx_L1_error)
6731   __pyx_int_768 = PyInt_FromLong(768); if (unlikely(!__pyx_int_768)) __PYX_ERR(0, 1, __pyx_L1_error)
6732   __pyx_int_1024 = PyInt_FromLong(1024); if (unlikely(!__pyx_int_1024)) __PYX_ERR(0, 1, __pyx_L1_error)
6733   __pyx_int_2048 = PyInt_FromLong(2048); if (unlikely(!__pyx_int_2048)) __PYX_ERR(0, 1, __pyx_L1_error)
6734   __pyx_int_4096 = PyInt_FromLong(4096); if (unlikely(!__pyx_int_4096)) __PYX_ERR(0, 1, __pyx_L1_error)
6735   __pyx_int_8192 = PyInt_FromLong(8192); if (unlikely(!__pyx_int_8192)) __PYX_ERR(0, 1, __pyx_L1_error)
6736   __pyx_int_16384 = PyInt_FromLong(16384L); if (unlikely(!__pyx_int_16384)) __PYX_ERR(0, 1, __pyx_L1_error)
6737   __pyx_int_32768 = PyInt_FromLong(32768L); if (unlikely(!__pyx_int_32768)) __PYX_ERR(0, 1, __pyx_L1_error)
6738   __pyx_int_65280 = PyInt_FromLong(65280L); if (unlikely(!__pyx_int_65280)) __PYX_ERR(0, 1, __pyx_L1_error)
6739   __pyx_int_65536 = PyInt_FromLong(65536L); if (unlikely(!__pyx_int_65536)) __PYX_ERR(0, 1, __pyx_L1_error)
6740   __pyx_int_16711680 = PyInt_FromLong(16711680L); if (unlikely(!__pyx_int_16711680)) __PYX_ERR(0, 1, __pyx_L1_error)
6741   return 0;
6742   __pyx_L1_error:;
6743   return -1;
6744 }
6745 
6746 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
6747 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
6748 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
6749 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
6750 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
6751 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
6752 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
6753 
__Pyx_modinit_global_init_code(void)6754 static int __Pyx_modinit_global_init_code(void) {
6755   __Pyx_RefNannyDeclarations
6756   __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
6757   /*--- Global init code ---*/
6758   __Pyx_RefNannyFinishContext();
6759   return 0;
6760 }
6761 
__Pyx_modinit_variable_export_code(void)6762 static int __Pyx_modinit_variable_export_code(void) {
6763   __Pyx_RefNannyDeclarations
6764   __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
6765   /*--- Variable export code ---*/
6766   __Pyx_RefNannyFinishContext();
6767   return 0;
6768 }
6769 
__Pyx_modinit_function_export_code(void)6770 static int __Pyx_modinit_function_export_code(void) {
6771   __Pyx_RefNannyDeclarations
6772   __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
6773   /*--- Function export code ---*/
6774   __Pyx_RefNannyFinishContext();
6775   return 0;
6776 }
6777 
__Pyx_modinit_type_init_code(void)6778 static int __Pyx_modinit_type_init_code(void) {
6779   __Pyx_RefNannyDeclarations
6780   int __pyx_lineno = 0;
6781   const char *__pyx_filename = NULL;
6782   int __pyx_clineno = 0;
6783   __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
6784   /*--- Type init code ---*/
6785   if (PyType_Ready(&__pyx_type_6pygame_4pypm_Output) < 0) __PYX_ERR(0, 256, __pyx_L1_error)
6786   #if PY_VERSION_HEX < 0x030800B1
6787   __pyx_type_6pygame_4pypm_Output.tp_print = 0;
6788   #endif
6789   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6pygame_4pypm_Output.tp_dictoffset && __pyx_type_6pygame_4pypm_Output.tp_getattro == PyObject_GenericGetAttr)) {
6790     __pyx_type_6pygame_4pypm_Output.tp_getattro = __Pyx_PyObject_GenericGetAttr;
6791   }
6792   #if CYTHON_COMPILING_IN_CPYTHON
6793   {
6794     PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_6pygame_4pypm_Output, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 256, __pyx_L1_error)
6795     if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
6796       __pyx_wrapperbase_6pygame_4pypm_6Output___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
6797       __pyx_wrapperbase_6pygame_4pypm_6Output___init__.doc = __pyx_doc_6pygame_4pypm_6Output___init__;
6798       ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6pygame_4pypm_6Output___init__;
6799     }
6800   }
6801   #endif
6802   if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Output, (PyObject *)&__pyx_type_6pygame_4pypm_Output) < 0) __PYX_ERR(0, 256, __pyx_L1_error)
6803   if (__Pyx_setup_reduce((PyObject*)&__pyx_type_6pygame_4pypm_Output) < 0) __PYX_ERR(0, 256, __pyx_L1_error)
6804   __pyx_ptype_6pygame_4pypm_Output = &__pyx_type_6pygame_4pypm_Output;
6805   if (PyType_Ready(&__pyx_type_6pygame_4pypm_Input) < 0) __PYX_ERR(0, 525, __pyx_L1_error)
6806   #if PY_VERSION_HEX < 0x030800B1
6807   __pyx_type_6pygame_4pypm_Input.tp_print = 0;
6808   #endif
6809   if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6pygame_4pypm_Input.tp_dictoffset && __pyx_type_6pygame_4pypm_Input.tp_getattro == PyObject_GenericGetAttr)) {
6810     __pyx_type_6pygame_4pypm_Input.tp_getattro = __Pyx_PyObject_GenericGetAttr;
6811   }
6812   #if CYTHON_COMPILING_IN_CPYTHON
6813   {
6814     PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_6pygame_4pypm_Input, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 525, __pyx_L1_error)
6815     if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
6816       __pyx_wrapperbase_6pygame_4pypm_5Input___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
6817       __pyx_wrapperbase_6pygame_4pypm_5Input___init__.doc = __pyx_doc_6pygame_4pypm_5Input___init__;
6818       ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_6pygame_4pypm_5Input___init__;
6819     }
6820   }
6821   #endif
6822   if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Input, (PyObject *)&__pyx_type_6pygame_4pypm_Input) < 0) __PYX_ERR(0, 525, __pyx_L1_error)
6823   if (__Pyx_setup_reduce((PyObject*)&__pyx_type_6pygame_4pypm_Input) < 0) __PYX_ERR(0, 525, __pyx_L1_error)
6824   __pyx_ptype_6pygame_4pypm_Input = &__pyx_type_6pygame_4pypm_Input;
6825   __Pyx_RefNannyFinishContext();
6826   return 0;
6827   __pyx_L1_error:;
6828   __Pyx_RefNannyFinishContext();
6829   return -1;
6830 }
6831 
__Pyx_modinit_type_import_code(void)6832 static int __Pyx_modinit_type_import_code(void) {
6833   __Pyx_RefNannyDeclarations
6834   __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
6835   /*--- Type import code ---*/
6836   __Pyx_RefNannyFinishContext();
6837   return 0;
6838 }
6839 
__Pyx_modinit_variable_import_code(void)6840 static int __Pyx_modinit_variable_import_code(void) {
6841   __Pyx_RefNannyDeclarations
6842   __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
6843   /*--- Variable import code ---*/
6844   __Pyx_RefNannyFinishContext();
6845   return 0;
6846 }
6847 
__Pyx_modinit_function_import_code(void)6848 static int __Pyx_modinit_function_import_code(void) {
6849   __Pyx_RefNannyDeclarations
6850   __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
6851   /*--- Function import code ---*/
6852   __Pyx_RefNannyFinishContext();
6853   return 0;
6854 }
6855 
6856 
6857 #ifndef CYTHON_NO_PYINIT_EXPORT
6858 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
6859 #elif PY_MAJOR_VERSION < 3
6860 #ifdef __cplusplus
6861 #define __Pyx_PyMODINIT_FUNC extern "C" void
6862 #else
6863 #define __Pyx_PyMODINIT_FUNC void
6864 #endif
6865 #else
6866 #ifdef __cplusplus
6867 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
6868 #else
6869 #define __Pyx_PyMODINIT_FUNC PyObject *
6870 #endif
6871 #endif
6872 
6873 
6874 #if PY_MAJOR_VERSION < 3
6875 __Pyx_PyMODINIT_FUNC initpypm(void) CYTHON_SMALL_CODE; /*proto*/
initpypm(void)6876 __Pyx_PyMODINIT_FUNC initpypm(void)
6877 #else
6878 __Pyx_PyMODINIT_FUNC PyInit_pypm(void) CYTHON_SMALL_CODE; /*proto*/
6879 __Pyx_PyMODINIT_FUNC PyInit_pypm(void)
6880 #if CYTHON_PEP489_MULTI_PHASE_INIT
6881 {
6882   return PyModuleDef_Init(&__pyx_moduledef);
6883 }
6884 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
6885     #if PY_VERSION_HEX >= 0x030700A1
6886     static PY_INT64_T main_interpreter_id = -1;
6887     PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
6888     if (main_interpreter_id == -1) {
6889         main_interpreter_id = current_id;
6890         return (unlikely(current_id == -1)) ? -1 : 0;
6891     } else if (unlikely(main_interpreter_id != current_id))
6892     #else
6893     static PyInterpreterState *main_interpreter = NULL;
6894     PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
6895     if (!main_interpreter) {
6896         main_interpreter = current_interpreter;
6897     } else if (unlikely(main_interpreter != current_interpreter))
6898     #endif
6899     {
6900         PyErr_SetString(
6901             PyExc_ImportError,
6902             "Interpreter change detected - this module can only be loaded into one interpreter per process.");
6903         return -1;
6904     }
6905     return 0;
6906 }
6907 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) {
6908     PyObject *value = PyObject_GetAttrString(spec, from_name);
6909     int result = 0;
6910     if (likely(value)) {
6911         if (allow_none || value != Py_None) {
6912             result = PyDict_SetItemString(moddict, to_name, value);
6913         }
6914         Py_DECREF(value);
6915     } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
6916         PyErr_Clear();
6917     } else {
6918         result = -1;
6919     }
6920     return result;
6921 }
6922 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
6923     PyObject *module = NULL, *moddict, *modname;
6924     if (__Pyx_check_single_interpreter())
6925         return NULL;
6926     if (__pyx_m)
6927         return __Pyx_NewRef(__pyx_m);
6928     modname = PyObject_GetAttrString(spec, "name");
6929     if (unlikely(!modname)) goto bad;
6930     module = PyModule_NewObject(modname);
6931     Py_DECREF(modname);
6932     if (unlikely(!module)) goto bad;
6933     moddict = PyModule_GetDict(module);
6934     if (unlikely(!moddict)) goto bad;
6935     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
6936     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
6937     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
6938     if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
6939     return module;
6940 bad:
6941     Py_XDECREF(module);
6942     return NULL;
6943 }
6944 
6945 
6946 static CYTHON_SMALL_CODE int __pyx_pymod_exec_pypm(PyObject *__pyx_pyinit_module)
6947 #endif
6948 #endif
6949 {
6950   PyObject *__pyx_t_1 = NULL;
6951   int __pyx_lineno = 0;
6952   const char *__pyx_filename = NULL;
6953   int __pyx_clineno = 0;
6954   __Pyx_RefNannyDeclarations
6955   #if CYTHON_PEP489_MULTI_PHASE_INIT
6956   if (__pyx_m) {
6957     if (__pyx_m == __pyx_pyinit_module) return 0;
6958     PyErr_SetString(PyExc_RuntimeError, "Module 'pypm' has already been imported. Re-initialisation is not supported.");
6959     return -1;
6960   }
6961   #elif PY_MAJOR_VERSION >= 3
6962   if (__pyx_m) return __Pyx_NewRef(__pyx_m);
6963   #endif
6964   #if CYTHON_REFNANNY
6965 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
6966 if (!__Pyx_RefNanny) {
6967   PyErr_Clear();
6968   __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
6969   if (!__Pyx_RefNanny)
6970       Py_FatalError("failed to import 'refnanny' module");
6971 }
6972 #endif
6973   __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_pypm(void)", 0);
6974   if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6975   #ifdef __Pxy_PyFrame_Initialize_Offsets
6976   __Pxy_PyFrame_Initialize_Offsets();
6977   #endif
6978   __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
6979   __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
6980   __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
6981   #ifdef __Pyx_CyFunction_USED
6982   if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6983   #endif
6984   #ifdef __Pyx_FusedFunction_USED
6985   if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6986   #endif
6987   #ifdef __Pyx_Coroutine_USED
6988   if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6989   #endif
6990   #ifdef __Pyx_Generator_USED
6991   if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6992   #endif
6993   #ifdef __Pyx_AsyncGen_USED
6994   if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6995   #endif
6996   #ifdef __Pyx_StopAsyncIteration_USED
6997   if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6998   #endif
6999   /*--- Library function declarations ---*/
7000   /*--- Threads initialization code ---*/
7001   #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
7002   #ifdef WITH_THREAD /* Python build with threading support? */
7003   PyEval_InitThreads();
7004   #endif
7005   #endif
7006   /*--- Module creation code ---*/
7007   #if CYTHON_PEP489_MULTI_PHASE_INIT
7008   __pyx_m = __pyx_pyinit_module;
7009   Py_INCREF(__pyx_m);
7010   #else
7011   #if PY_MAJOR_VERSION < 3
7012   __pyx_m = Py_InitModule4("pypm", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
7013   #else
7014   __pyx_m = PyModule_Create(&__pyx_moduledef);
7015   #endif
7016   if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
7017   #endif
7018   __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
7019   Py_INCREF(__pyx_d);
7020   __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
7021   Py_INCREF(__pyx_b);
7022   __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
7023   Py_INCREF(__pyx_cython_runtime);
7024   if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
7025   /*--- Initialize various global constants etc. ---*/
7026   if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
7027   #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
7028   if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
7029   #endif
7030   if (__pyx_module_is_main_pygame__pypm) {
7031     if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
7032   }
7033   #if PY_MAJOR_VERSION >= 3
7034   {
7035     PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
7036     if (!PyDict_GetItemString(modules, "pygame.pypm")) {
7037       if (unlikely(PyDict_SetItemString(modules, "pygame.pypm", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
7038     }
7039   }
7040   #endif
7041   /*--- Builtin init code ---*/
7042   if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
7043   /*--- Constants init code ---*/
7044   if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
7045   /*--- Global type/function init code ---*/
7046   (void)__Pyx_modinit_global_init_code();
7047   (void)__Pyx_modinit_variable_export_code();
7048   (void)__Pyx_modinit_function_export_code();
7049   if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
7050   (void)__Pyx_modinit_type_import_code();
7051   (void)__Pyx_modinit_variable_import_code();
7052   (void)__Pyx_modinit_function_import_code();
7053   /*--- Execution code ---*/
7054   #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
7055   if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
7056   #endif
7057 
7058   /* "pygame/pypm.pyx":10
7059  * # cython: language_level=2
7060  *
7061  * __version__ = "0.0.6"             # <<<<<<<<<<<<<<
7062  *
7063  * import array
7064  */
7065   if (PyDict_SetItem(__pyx_d, __pyx_n_s_version, __pyx_kp_s_0_0_6) < 0) __PYX_ERR(0, 10, __pyx_L1_error)
7066 
7067   /* "pygame/pypm.pyx":12
7068  * __version__ = "0.0.6"
7069  *
7070  * import array             # <<<<<<<<<<<<<<
7071  * import sys
7072  *
7073  */
7074   __pyx_t_1 = __Pyx_Import(__pyx_n_s_array, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __pyx_L1_error)
7075   __Pyx_GOTREF(__pyx_t_1);
7076   if (PyDict_SetItem(__pyx_d, __pyx_n_s_array, __pyx_t_1) < 0) __PYX_ERR(0, 12, __pyx_L1_error)
7077   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7078 
7079   /* "pygame/pypm.pyx":13
7080  *
7081  * import array
7082  * import sys             # <<<<<<<<<<<<<<
7083  *
7084  * # CHANGES:
7085  */
7086   __pyx_t_1 = __Pyx_Import(__pyx_n_s_sys, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error)
7087   __Pyx_GOTREF(__pyx_t_1);
7088   if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_1) < 0) __PYX_ERR(0, 13, __pyx_L1_error)
7089   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7090 
7091   /* "pygame/pypm.pyx":43
7092  *
7093  *
7094  * FILT_ACTIVE = 0x1             # <<<<<<<<<<<<<<
7095  * FILT_SYSEX = 0x2
7096  * FILT_CLOCK = 0x4
7097  */
7098   if (PyDict_SetItem(__pyx_d, __pyx_n_s_FILT_ACTIVE, __pyx_int_1) < 0) __PYX_ERR(0, 43, __pyx_L1_error)
7099 
7100   /* "pygame/pypm.pyx":44
7101  *
7102  * FILT_ACTIVE = 0x1
7103  * FILT_SYSEX = 0x2             # <<<<<<<<<<<<<<
7104  * FILT_CLOCK = 0x4
7105  * FILT_PLAY = 0x8
7106  */
7107   if (PyDict_SetItem(__pyx_d, __pyx_n_s_FILT_SYSEX, __pyx_int_2) < 0) __PYX_ERR(0, 44, __pyx_L1_error)
7108 
7109   /* "pygame/pypm.pyx":45
7110  * FILT_ACTIVE = 0x1
7111  * FILT_SYSEX = 0x2
7112  * FILT_CLOCK = 0x4             # <<<<<<<<<<<<<<
7113  * FILT_PLAY = 0x8
7114  * FILT_F9 = 0x10
7115  */
7116   if (PyDict_SetItem(__pyx_d, __pyx_n_s_FILT_CLOCK, __pyx_int_4) < 0) __PYX_ERR(0, 45, __pyx_L1_error)
7117 
7118   /* "pygame/pypm.pyx":46
7119  * FILT_SYSEX = 0x2
7120  * FILT_CLOCK = 0x4
7121  * FILT_PLAY = 0x8             # <<<<<<<<<<<<<<
7122  * FILT_F9 = 0x10
7123  * FILT_TICK = 0x10
7124  */
7125   if (PyDict_SetItem(__pyx_d, __pyx_n_s_FILT_PLAY, __pyx_int_8) < 0) __PYX_ERR(0, 46, __pyx_L1_error)
7126 
7127   /* "pygame/pypm.pyx":47
7128  * FILT_CLOCK = 0x4
7129  * FILT_PLAY = 0x8
7130  * FILT_F9 = 0x10             # <<<<<<<<<<<<<<
7131  * FILT_TICK = 0x10
7132  * FILT_FD = 0x20
7133  */
7134   if (PyDict_SetItem(__pyx_d, __pyx_n_s_FILT_F9, __pyx_int_16) < 0) __PYX_ERR(0, 47, __pyx_L1_error)
7135 
7136   /* "pygame/pypm.pyx":48
7137  * FILT_PLAY = 0x8
7138  * FILT_F9 = 0x10
7139  * FILT_TICK = 0x10             # <<<<<<<<<<<<<<
7140  * FILT_FD = 0x20
7141  * FILT_UNDEFINED = 0x30
7142  */
7143   if (PyDict_SetItem(__pyx_d, __pyx_n_s_FILT_TICK, __pyx_int_16) < 0) __PYX_ERR(0, 48, __pyx_L1_error)
7144 
7145   /* "pygame/pypm.pyx":49
7146  * FILT_F9 = 0x10
7147  * FILT_TICK = 0x10
7148  * FILT_FD = 0x20             # <<<<<<<<<<<<<<
7149  * FILT_UNDEFINED = 0x30
7150  * FILT_RESET = 0x40
7151  */
7152   if (PyDict_SetItem(__pyx_d, __pyx_n_s_FILT_FD, __pyx_int_32) < 0) __PYX_ERR(0, 49, __pyx_L1_error)
7153 
7154   /* "pygame/pypm.pyx":50
7155  * FILT_TICK = 0x10
7156  * FILT_FD = 0x20
7157  * FILT_UNDEFINED = 0x30             # <<<<<<<<<<<<<<
7158  * FILT_RESET = 0x40
7159  * FILT_REALTIME = 0x7F
7160  */
7161   if (PyDict_SetItem(__pyx_d, __pyx_n_s_FILT_UNDEFINED, __pyx_int_48) < 0) __PYX_ERR(0, 50, __pyx_L1_error)
7162 
7163   /* "pygame/pypm.pyx":51
7164  * FILT_FD = 0x20
7165  * FILT_UNDEFINED = 0x30
7166  * FILT_RESET = 0x40             # <<<<<<<<<<<<<<
7167  * FILT_REALTIME = 0x7F
7168  * FILT_NOTE = 0x80
7169  */
7170   if (PyDict_SetItem(__pyx_d, __pyx_n_s_FILT_RESET, __pyx_int_64) < 0) __PYX_ERR(0, 51, __pyx_L1_error)
7171 
7172   /* "pygame/pypm.pyx":52
7173  * FILT_UNDEFINED = 0x30
7174  * FILT_RESET = 0x40
7175  * FILT_REALTIME = 0x7F             # <<<<<<<<<<<<<<
7176  * FILT_NOTE = 0x80
7177  * FILT_CHANNEL_AFTERTOUCH = 0x100
7178  */
7179   if (PyDict_SetItem(__pyx_d, __pyx_n_s_FILT_REALTIME, __pyx_int_127) < 0) __PYX_ERR(0, 52, __pyx_L1_error)
7180 
7181   /* "pygame/pypm.pyx":53
7182  * FILT_RESET = 0x40
7183  * FILT_REALTIME = 0x7F
7184  * FILT_NOTE = 0x80             # <<<<<<<<<<<<<<
7185  * FILT_CHANNEL_AFTERTOUCH = 0x100
7186  * FILT_POLY_AFTERTOUCH = 0x200
7187  */
7188   if (PyDict_SetItem(__pyx_d, __pyx_n_s_FILT_NOTE, __pyx_int_128) < 0) __PYX_ERR(0, 53, __pyx_L1_error)
7189 
7190   /* "pygame/pypm.pyx":54
7191  * FILT_REALTIME = 0x7F
7192  * FILT_NOTE = 0x80
7193  * FILT_CHANNEL_AFTERTOUCH = 0x100             # <<<<<<<<<<<<<<
7194  * FILT_POLY_AFTERTOUCH = 0x200
7195  * FILT_AFTERTOUCH = 0x300
7196  */
7197   if (PyDict_SetItem(__pyx_d, __pyx_n_s_FILT_CHANNEL_AFTERTOUCH, __pyx_int_256) < 0) __PYX_ERR(0, 54, __pyx_L1_error)
7198 
7199   /* "pygame/pypm.pyx":55
7200  * FILT_NOTE = 0x80
7201  * FILT_CHANNEL_AFTERTOUCH = 0x100
7202  * FILT_POLY_AFTERTOUCH = 0x200             # <<<<<<<<<<<<<<
7203  * FILT_AFTERTOUCH = 0x300
7204  * FILT_PROGRAM = 0x400
7205  */
7206   if (PyDict_SetItem(__pyx_d, __pyx_n_s_FILT_POLY_AFTERTOUCH, __pyx_int_512) < 0) __PYX_ERR(0, 55, __pyx_L1_error)
7207 
7208   /* "pygame/pypm.pyx":56
7209  * FILT_CHANNEL_AFTERTOUCH = 0x100
7210  * FILT_POLY_AFTERTOUCH = 0x200
7211  * FILT_AFTERTOUCH = 0x300             # <<<<<<<<<<<<<<
7212  * FILT_PROGRAM = 0x400
7213  * FILT_CONTROL = 0x800
7214  */
7215   if (PyDict_SetItem(__pyx_d, __pyx_n_s_FILT_AFTERTOUCH, __pyx_int_768) < 0) __PYX_ERR(0, 56, __pyx_L1_error)
7216 
7217   /* "pygame/pypm.pyx":57
7218  * FILT_POLY_AFTERTOUCH = 0x200
7219  * FILT_AFTERTOUCH = 0x300
7220  * FILT_PROGRAM = 0x400             # <<<<<<<<<<<<<<
7221  * FILT_CONTROL = 0x800
7222  * FILT_PITCHBEND = 0x1000
7223  */
7224   if (PyDict_SetItem(__pyx_d, __pyx_n_s_FILT_PROGRAM, __pyx_int_1024) < 0) __PYX_ERR(0, 57, __pyx_L1_error)
7225 
7226   /* "pygame/pypm.pyx":58
7227  * FILT_AFTERTOUCH = 0x300
7228  * FILT_PROGRAM = 0x400
7229  * FILT_CONTROL = 0x800             # <<<<<<<<<<<<<<
7230  * FILT_PITCHBEND = 0x1000
7231  * FILT_MTC = 0x2000
7232  */
7233   if (PyDict_SetItem(__pyx_d, __pyx_n_s_FILT_CONTROL, __pyx_int_2048) < 0) __PYX_ERR(0, 58, __pyx_L1_error)
7234 
7235   /* "pygame/pypm.pyx":59
7236  * FILT_PROGRAM = 0x400
7237  * FILT_CONTROL = 0x800
7238  * FILT_PITCHBEND = 0x1000             # <<<<<<<<<<<<<<
7239  * FILT_MTC = 0x2000
7240  * FILT_SONG_POSITION = 0x4000
7241  */
7242   if (PyDict_SetItem(__pyx_d, __pyx_n_s_FILT_PITCHBEND, __pyx_int_4096) < 0) __PYX_ERR(0, 59, __pyx_L1_error)
7243 
7244   /* "pygame/pypm.pyx":60
7245  * FILT_CONTROL = 0x800
7246  * FILT_PITCHBEND = 0x1000
7247  * FILT_MTC = 0x2000             # <<<<<<<<<<<<<<
7248  * FILT_SONG_POSITION = 0x4000
7249  * FILT_SONG_SELECT = 0x8000
7250  */
7251   if (PyDict_SetItem(__pyx_d, __pyx_n_s_FILT_MTC, __pyx_int_8192) < 0) __PYX_ERR(0, 60, __pyx_L1_error)
7252 
7253   /* "pygame/pypm.pyx":61
7254  * FILT_PITCHBEND = 0x1000
7255  * FILT_MTC = 0x2000
7256  * FILT_SONG_POSITION = 0x4000             # <<<<<<<<<<<<<<
7257  * FILT_SONG_SELECT = 0x8000
7258  * FILT_TUNE = 0x10000
7259  */
7260   if (PyDict_SetItem(__pyx_d, __pyx_n_s_FILT_SONG_POSITION, __pyx_int_16384) < 0) __PYX_ERR(0, 61, __pyx_L1_error)
7261 
7262   /* "pygame/pypm.pyx":62
7263  * FILT_MTC = 0x2000
7264  * FILT_SONG_POSITION = 0x4000
7265  * FILT_SONG_SELECT = 0x8000             # <<<<<<<<<<<<<<
7266  * FILT_TUNE = 0x10000
7267  * FALSE = 0
7268  */
7269   if (PyDict_SetItem(__pyx_d, __pyx_n_s_FILT_SONG_SELECT, __pyx_int_32768) < 0) __PYX_ERR(0, 62, __pyx_L1_error)
7270 
7271   /* "pygame/pypm.pyx":63
7272  * FILT_SONG_POSITION = 0x4000
7273  * FILT_SONG_SELECT = 0x8000
7274  * FILT_TUNE = 0x10000             # <<<<<<<<<<<<<<
7275  * FALSE = 0
7276  * TRUE = 1
7277  */
7278   if (PyDict_SetItem(__pyx_d, __pyx_n_s_FILT_TUNE, __pyx_int_65536) < 0) __PYX_ERR(0, 63, __pyx_L1_error)
7279 
7280   /* "pygame/pypm.pyx":64
7281  * FILT_SONG_SELECT = 0x8000
7282  * FILT_TUNE = 0x10000
7283  * FALSE = 0             # <<<<<<<<<<<<<<
7284  * TRUE = 1
7285  *
7286  */
7287   if (PyDict_SetItem(__pyx_d, __pyx_n_s_FALSE, __pyx_int_0) < 0) __PYX_ERR(0, 64, __pyx_L1_error)
7288 
7289   /* "pygame/pypm.pyx":65
7290  * FILT_TUNE = 0x10000
7291  * FALSE = 0
7292  * TRUE = 1             # <<<<<<<<<<<<<<
7293  *
7294  * cdef extern from "portmidi.h":
7295  */
7296   if (PyDict_SetItem(__pyx_d, __pyx_n_s_TRUE, __pyx_int_1) < 0) __PYX_ERR(0, 65, __pyx_L1_error)
7297 
7298   /* "pygame/pypm.pyx":154
7299  * cdef long _pypm_initialized
7300  *
7301  * def Initialize():             # <<<<<<<<<<<<<<
7302  *     """Initialize PortMidi library.
7303  *
7304  */
7305   __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pygame_4pypm_1Initialize, NULL, __pyx_n_s_pygame_pypm); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 154, __pyx_L1_error)
7306   __Pyx_GOTREF(__pyx_t_1);
7307   if (PyDict_SetItem(__pyx_d, __pyx_n_s_Initialize, __pyx_t_1) < 0) __PYX_ERR(0, 154, __pyx_L1_error)
7308   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7309 
7310   /* "pygame/pypm.pyx":166
7311  *     _pypm_initialized = 1
7312  *
7313  * def Terminate():             # <<<<<<<<<<<<<<
7314  *     """Terminate use of PortMidi library.
7315  *
7316  */
7317   __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pygame_4pypm_3Terminate, NULL, __pyx_n_s_pygame_pypm); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 166, __pyx_L1_error)
7318   __Pyx_GOTREF(__pyx_t_1);
7319   if (PyDict_SetItem(__pyx_d, __pyx_n_s_Terminate, __pyx_t_1) < 0) __PYX_ERR(0, 166, __pyx_L1_error)
7320   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7321 
7322   /* "pygame/pypm.pyx":179
7323  *
7324  *
7325  * def GetDefaultInputDeviceID():             # <<<<<<<<<<<<<<
7326  *     """Return the number of the default MIDI input device.
7327  *
7328  */
7329   __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pygame_4pypm_5GetDefaultInputDeviceID, NULL, __pyx_n_s_pygame_pypm); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 179, __pyx_L1_error)
7330   __Pyx_GOTREF(__pyx_t_1);
7331   if (PyDict_SetItem(__pyx_d, __pyx_n_s_GetDefaultInputDeviceID, __pyx_t_1) < 0) __PYX_ERR(0, 179, __pyx_L1_error)
7332   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7333 
7334   /* "pygame/pypm.pyx":188
7335  *     return Pm_GetDefaultInputDeviceID()
7336  *
7337  * def GetDefaultOutputDeviceID():             # <<<<<<<<<<<<<<
7338  *     """Return the number of the default MIDI output device.
7339  *
7340  */
7341   __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pygame_4pypm_7GetDefaultOutputDeviceID, NULL, __pyx_n_s_pygame_pypm); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 188, __pyx_L1_error)
7342   __Pyx_GOTREF(__pyx_t_1);
7343   if (PyDict_SetItem(__pyx_d, __pyx_n_s_GetDefaultOutputDeviceID, __pyx_t_1) < 0) __PYX_ERR(0, 188, __pyx_L1_error)
7344   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7345 
7346   /* "pygame/pypm.pyx":197
7347  *     return Pm_GetDefaultOutputDeviceID()
7348  *
7349  * def CountDevices():             # <<<<<<<<<<<<<<
7350  *     """Return number of available MIDI (input and output) devices."""
7351  *
7352  */
7353   __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pygame_4pypm_9CountDevices, NULL, __pyx_n_s_pygame_pypm); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 197, __pyx_L1_error)
7354   __Pyx_GOTREF(__pyx_t_1);
7355   if (PyDict_SetItem(__pyx_d, __pyx_n_s_CountDevices, __pyx_t_1) < 0) __PYX_ERR(0, 197, __pyx_L1_error)
7356   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7357 
7358   /* "pygame/pypm.pyx":202
7359  *     return Pm_CountDevices()
7360  *
7361  * def GetDeviceInfo(device_no):             # <<<<<<<<<<<<<<
7362  *     """Return device info tuple for MIDI device given by device_no.
7363  *
7364  */
7365   __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pygame_4pypm_11GetDeviceInfo, NULL, __pyx_n_s_pygame_pypm); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 202, __pyx_L1_error)
7366   __Pyx_GOTREF(__pyx_t_1);
7367   if (PyDict_SetItem(__pyx_d, __pyx_n_s_GetDeviceInfo, __pyx_t_1) < 0) __PYX_ERR(0, 202, __pyx_L1_error)
7368   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7369 
7370   /* "pygame/pypm.pyx":224
7371  *     # return None
7372  *
7373  * def Time():             # <<<<<<<<<<<<<<
7374  *     """Return the current time in ms of the PortMidi timer."""
7375  *
7376  */
7377   __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pygame_4pypm_13Time, NULL, __pyx_n_s_pygame_pypm); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 224, __pyx_L1_error)
7378   __Pyx_GOTREF(__pyx_t_1);
7379   if (PyDict_SetItem(__pyx_d, __pyx_n_s_Time, __pyx_t_1) < 0) __PYX_ERR(0, 224, __pyx_L1_error)
7380   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7381 
7382   /* "pygame/pypm.pyx":229
7383  *     return Pt_Time()
7384  *
7385  * def GetErrorText(err):             # <<<<<<<<<<<<<<
7386  *     """Return human-readable error message translated from error number."""
7387  *
7388  */
7389   __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pygame_4pypm_15GetErrorText, NULL, __pyx_n_s_pygame_pypm); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 229, __pyx_L1_error)
7390   __Pyx_GOTREF(__pyx_t_1);
7391   if (PyDict_SetItem(__pyx_d, __pyx_n_s_GetErrorText, __pyx_t_1) < 0) __PYX_ERR(0, 229, __pyx_L1_error)
7392   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7393 
7394   /* "pygame/pypm.pyx":234
7395  *     return Pm_GetErrorText(err)
7396  *
7397  * def Channel(chan):             # <<<<<<<<<<<<<<
7398  *     """Return Channel object for given MIDI channel number 1 - 16.
7399  *
7400  */
7401   __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6pygame_4pypm_17Channel, NULL, __pyx_n_s_pygame_pypm); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 234, __pyx_L1_error)
7402   __Pyx_GOTREF(__pyx_t_1);
7403   if (PyDict_SetItem(__pyx_d, __pyx_n_s_Channel, __pyx_t_1) < 0) __PYX_ERR(0, 234, __pyx_L1_error)
7404   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7405 
7406   /* "pygame/pypm.pyx":1
7407  * # pyPortMidi             # <<<<<<<<<<<<<<
7408  * # Python bindings for PortMidi
7409  * # John Harrison
7410  */
7411   __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
7412   __Pyx_GOTREF(__pyx_t_1);
7413   if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
7414   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7415 
7416   /*--- Wrapped vars code ---*/
7417 
7418   goto __pyx_L0;
7419   __pyx_L1_error:;
7420   __Pyx_XDECREF(__pyx_t_1);
7421   if (__pyx_m) {
7422     if (__pyx_d) {
7423       __Pyx_AddTraceback("init pygame.pypm", __pyx_clineno, __pyx_lineno, __pyx_filename);
7424     }
7425     Py_CLEAR(__pyx_m);
7426   } else if (!PyErr_Occurred()) {
7427     PyErr_SetString(PyExc_ImportError, "init pygame.pypm");
7428   }
7429   __pyx_L0:;
7430   __Pyx_RefNannyFinishContext();
7431   #if CYTHON_PEP489_MULTI_PHASE_INIT
7432   return (__pyx_m != NULL) ? 0 : -1;
7433   #elif PY_MAJOR_VERSION >= 3
7434   return __pyx_m;
7435   #else
7436   return;
7437   #endif
7438 }
7439 
7440 /* --- Runtime support code --- */
7441 /* Refnanny */
7442 #if CYTHON_REFNANNY
__Pyx_RefNannyImportAPI(const char * modname)7443 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
7444     PyObject *m = NULL, *p = NULL;
7445     void *r = NULL;
7446     m = PyImport_ImportModule(modname);
7447     if (!m) goto end;
7448     p = PyObject_GetAttrString(m, "RefNannyAPI");
7449     if (!p) goto end;
7450     r = PyLong_AsVoidPtr(p);
7451 end:
7452     Py_XDECREF(p);
7453     Py_XDECREF(m);
7454     return (__Pyx_RefNannyAPIStruct *)r;
7455 }
7456 #endif
7457 
7458 /* PyObjectGetAttrStr */
7459 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetAttrStr(PyObject * obj,PyObject * attr_name)7460 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
7461     PyTypeObject* tp = Py_TYPE(obj);
7462     if (likely(tp->tp_getattro))
7463         return tp->tp_getattro(obj, attr_name);
7464 #if PY_MAJOR_VERSION < 3
7465     if (likely(tp->tp_getattr))
7466         return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
7467 #endif
7468     return PyObject_GetAttr(obj, attr_name);
7469 }
7470 #endif
7471 
7472 /* GetBuiltinName */
__Pyx_GetBuiltinName(PyObject * name)7473 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
7474     PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
7475     if (unlikely(!result)) {
7476         PyErr_Format(PyExc_NameError,
7477 #if PY_MAJOR_VERSION >= 3
7478             "name '%U' is not defined", name);
7479 #else
7480             "name '%.200s' is not defined", PyString_AS_STRING(name));
7481 #endif
7482     }
7483     return result;
7484 }
7485 
7486 /* PyIntBinop */
7487 #if !CYTHON_COMPILING_IN_PYPY
__Pyx_PyInt_SubtractObjC(PyObject * op1,PyObject * op2,CYTHON_UNUSED long intval,int inplace,int zerodivision_check)7488 static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
7489     (void)inplace;
7490     (void)zerodivision_check;
7491     #if PY_MAJOR_VERSION < 3
7492     if (likely(PyInt_CheckExact(op1))) {
7493         const long b = intval;
7494         long x;
7495         long a = PyInt_AS_LONG(op1);
7496             x = (long)((unsigned long)a - b);
7497             if (likely((x^a) >= 0 || (x^~b) >= 0))
7498                 return PyInt_FromLong(x);
7499             return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
7500     }
7501     #endif
7502     #if CYTHON_USE_PYLONG_INTERNALS
7503     if (likely(PyLong_CheckExact(op1))) {
7504         const long b = intval;
7505         long a, x;
7506 #ifdef HAVE_LONG_LONG
7507         const PY_LONG_LONG llb = intval;
7508         PY_LONG_LONG lla, llx;
7509 #endif
7510         const digit* digits = ((PyLongObject*)op1)->ob_digit;
7511         const Py_ssize_t size = Py_SIZE(op1);
7512         if (likely(__Pyx_sst_abs(size) <= 1)) {
7513             a = likely(size) ? digits[0] : 0;
7514             if (size == -1) a = -a;
7515         } else {
7516             switch (size) {
7517                 case -2:
7518                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
7519                         a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
7520                         break;
7521 #ifdef HAVE_LONG_LONG
7522                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
7523                         lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
7524                         goto long_long;
7525 #endif
7526                     }
7527                     CYTHON_FALLTHROUGH;
7528                 case 2:
7529                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
7530                         a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
7531                         break;
7532 #ifdef HAVE_LONG_LONG
7533                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
7534                         lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
7535                         goto long_long;
7536 #endif
7537                     }
7538                     CYTHON_FALLTHROUGH;
7539                 case -3:
7540                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
7541                         a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
7542                         break;
7543 #ifdef HAVE_LONG_LONG
7544                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
7545                         lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
7546                         goto long_long;
7547 #endif
7548                     }
7549                     CYTHON_FALLTHROUGH;
7550                 case 3:
7551                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
7552                         a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
7553                         break;
7554 #ifdef HAVE_LONG_LONG
7555                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
7556                         lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
7557                         goto long_long;
7558 #endif
7559                     }
7560                     CYTHON_FALLTHROUGH;
7561                 case -4:
7562                     if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
7563                         a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
7564                         break;
7565 #ifdef HAVE_LONG_LONG
7566                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
7567                         lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
7568                         goto long_long;
7569 #endif
7570                     }
7571                     CYTHON_FALLTHROUGH;
7572                 case 4:
7573                     if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
7574                         a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
7575                         break;
7576 #ifdef HAVE_LONG_LONG
7577                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
7578                         lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
7579                         goto long_long;
7580 #endif
7581                     }
7582                     CYTHON_FALLTHROUGH;
7583                 default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
7584             }
7585         }
7586                 x = a - b;
7587             return PyLong_FromLong(x);
7588 #ifdef HAVE_LONG_LONG
7589         long_long:
7590                 llx = lla - llb;
7591             return PyLong_FromLongLong(llx);
7592 #endif
7593 
7594 
7595     }
7596     #endif
7597     if (PyFloat_CheckExact(op1)) {
7598         const long b = intval;
7599         double a = PyFloat_AS_DOUBLE(op1);
7600             double result;
7601             PyFPE_START_PROTECT("subtract", return NULL)
7602             result = ((double)a) - (double)b;
7603             PyFPE_END_PROTECT(result)
7604             return PyFloat_FromDouble(result);
7605     }
7606     return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
7607 }
7608 #endif
7609 
7610 /* RaiseDoubleKeywords */
__Pyx_RaiseDoubleKeywordsError(const char * func_name,PyObject * kw_name)7611 static void __Pyx_RaiseDoubleKeywordsError(
7612     const char* func_name,
7613     PyObject* kw_name)
7614 {
7615     PyErr_Format(PyExc_TypeError,
7616         #if PY_MAJOR_VERSION >= 3
7617         "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
7618         #else
7619         "%s() got multiple values for keyword argument '%s'", func_name,
7620         PyString_AsString(kw_name));
7621         #endif
7622 }
7623 
7624 /* ParseKeywords */
__Pyx_ParseOptionalKeywords(PyObject * kwds,PyObject ** argnames[],PyObject * kwds2,PyObject * values[],Py_ssize_t num_pos_args,const char * function_name)7625 static int __Pyx_ParseOptionalKeywords(
7626     PyObject *kwds,
7627     PyObject **argnames[],
7628     PyObject *kwds2,
7629     PyObject *values[],
7630     Py_ssize_t num_pos_args,
7631     const char* function_name)
7632 {
7633     PyObject *key = 0, *value = 0;
7634     Py_ssize_t pos = 0;
7635     PyObject*** name;
7636     PyObject*** first_kw_arg = argnames + num_pos_args;
7637     while (PyDict_Next(kwds, &pos, &key, &value)) {
7638         name = first_kw_arg;
7639         while (*name && (**name != key)) name++;
7640         if (*name) {
7641             values[name-argnames] = value;
7642             continue;
7643         }
7644         name = first_kw_arg;
7645         #if PY_MAJOR_VERSION < 3
7646         if (likely(PyString_Check(key))) {
7647             while (*name) {
7648                 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
7649                         && _PyString_Eq(**name, key)) {
7650                     values[name-argnames] = value;
7651                     break;
7652                 }
7653                 name++;
7654             }
7655             if (*name) continue;
7656             else {
7657                 PyObject*** argname = argnames;
7658                 while (argname != first_kw_arg) {
7659                     if ((**argname == key) || (
7660                             (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
7661                              && _PyString_Eq(**argname, key))) {
7662                         goto arg_passed_twice;
7663                     }
7664                     argname++;
7665                 }
7666             }
7667         } else
7668         #endif
7669         if (likely(PyUnicode_Check(key))) {
7670             while (*name) {
7671                 int cmp = (**name == key) ? 0 :
7672                 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
7673                     (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
7674                 #endif
7675                     PyUnicode_Compare(**name, key);
7676                 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
7677                 if (cmp == 0) {
7678                     values[name-argnames] = value;
7679                     break;
7680                 }
7681                 name++;
7682             }
7683             if (*name) continue;
7684             else {
7685                 PyObject*** argname = argnames;
7686                 while (argname != first_kw_arg) {
7687                     int cmp = (**argname == key) ? 0 :
7688                     #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
7689                         (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
7690                     #endif
7691                         PyUnicode_Compare(**argname, key);
7692                     if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
7693                     if (cmp == 0) goto arg_passed_twice;
7694                     argname++;
7695                 }
7696             }
7697         } else
7698             goto invalid_keyword_type;
7699         if (kwds2) {
7700             if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
7701         } else {
7702             goto invalid_keyword;
7703         }
7704     }
7705     return 0;
7706 arg_passed_twice:
7707     __Pyx_RaiseDoubleKeywordsError(function_name, key);
7708     goto bad;
7709 invalid_keyword_type:
7710     PyErr_Format(PyExc_TypeError,
7711         "%.200s() keywords must be strings", function_name);
7712     goto bad;
7713 invalid_keyword:
7714     PyErr_Format(PyExc_TypeError,
7715     #if PY_MAJOR_VERSION < 3
7716         "%.200s() got an unexpected keyword argument '%.200s'",
7717         function_name, PyString_AsString(key));
7718     #else
7719         "%s() got an unexpected keyword argument '%U'",
7720         function_name, key);
7721     #endif
7722 bad:
7723     return -1;
7724 }
7725 
7726 /* RaiseArgTupleInvalid */
__Pyx_RaiseArgtupleInvalid(const char * func_name,int exact,Py_ssize_t num_min,Py_ssize_t num_max,Py_ssize_t num_found)7727 static void __Pyx_RaiseArgtupleInvalid(
7728     const char* func_name,
7729     int exact,
7730     Py_ssize_t num_min,
7731     Py_ssize_t num_max,
7732     Py_ssize_t num_found)
7733 {
7734     Py_ssize_t num_expected;
7735     const char *more_or_less;
7736     if (num_found < num_min) {
7737         num_expected = num_min;
7738         more_or_less = "at least";
7739     } else {
7740         num_expected = num_max;
7741         more_or_less = "at most";
7742     }
7743     if (exact) {
7744         more_or_less = "exactly";
7745     }
7746     PyErr_Format(PyExc_TypeError,
7747                  "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
7748                  func_name, more_or_less, num_expected,
7749                  (num_expected == 1) ? "" : "s", num_found);
7750 }
7751 
7752 /* PyIntCompare */
__Pyx_PyInt_EqObjC(PyObject * op1,PyObject * op2,CYTHON_UNUSED long intval,CYTHON_UNUSED long inplace)7753 static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED long inplace) {
7754     if (op1 == op2) {
7755         Py_RETURN_TRUE;
7756     }
7757     #if PY_MAJOR_VERSION < 3
7758     if (likely(PyInt_CheckExact(op1))) {
7759         const long b = intval;
7760         long a = PyInt_AS_LONG(op1);
7761         if (a == b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
7762     }
7763     #endif
7764     #if CYTHON_USE_PYLONG_INTERNALS
7765     if (likely(PyLong_CheckExact(op1))) {
7766         int unequal;
7767         unsigned long uintval;
7768         Py_ssize_t size = Py_SIZE(op1);
7769         const digit* digits = ((PyLongObject*)op1)->ob_digit;
7770         if (intval == 0) {
7771             if (size == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
7772         } else if (intval < 0) {
7773             if (size >= 0)
7774                 Py_RETURN_FALSE;
7775             intval = -intval;
7776             size = -size;
7777         } else {
7778             if (size <= 0)
7779                 Py_RETURN_FALSE;
7780         }
7781         uintval = (unsigned long) intval;
7782 #if PyLong_SHIFT * 4 < SIZEOF_LONG*8
7783         if (uintval >> (PyLong_SHIFT * 4)) {
7784             unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
7785                  | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
7786         } else
7787 #endif
7788 #if PyLong_SHIFT * 3 < SIZEOF_LONG*8
7789         if (uintval >> (PyLong_SHIFT * 3)) {
7790             unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
7791                  | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
7792         } else
7793 #endif
7794 #if PyLong_SHIFT * 2 < SIZEOF_LONG*8
7795         if (uintval >> (PyLong_SHIFT * 2)) {
7796             unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
7797                  | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
7798         } else
7799 #endif
7800 #if PyLong_SHIFT * 1 < SIZEOF_LONG*8
7801         if (uintval >> (PyLong_SHIFT * 1)) {
7802             unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
7803                  | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
7804         } else
7805 #endif
7806             unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
7807         if (unequal == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
7808     }
7809     #endif
7810     if (PyFloat_CheckExact(op1)) {
7811         const long b = intval;
7812         double a = PyFloat_AS_DOUBLE(op1);
7813         if ((double)a == (double)b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
7814     }
7815     return (
7816         PyObject_RichCompare(op1, op2, Py_EQ));
7817 }
7818 
7819 /* PyCFunctionFastCall */
7820 #if CYTHON_FAST_PYCCALL
__Pyx_PyCFunction_FastCall(PyObject * func_obj,PyObject ** args,Py_ssize_t nargs)7821 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
7822     PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
7823     PyCFunction meth = PyCFunction_GET_FUNCTION(func);
7824     PyObject *self = PyCFunction_GET_SELF(func);
7825     int flags = PyCFunction_GET_FLAGS(func);
7826     assert(PyCFunction_Check(func));
7827     assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
7828     assert(nargs >= 0);
7829     assert(nargs == 0 || args != NULL);
7830     /* _PyCFunction_FastCallDict() must not be called with an exception set,
7831        because it may clear it (directly or indirectly) and so the
7832        caller loses its exception */
7833     assert(!PyErr_Occurred());
7834     if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
7835         return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
7836     } else {
7837         return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
7838     }
7839 }
7840 #endif
7841 
7842 /* PyFunctionFastCall */
7843 #if CYTHON_FAST_PYCALL
__Pyx_PyFunction_FastCallNoKw(PyCodeObject * co,PyObject ** args,Py_ssize_t na,PyObject * globals)7844 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
7845                                                PyObject *globals) {
7846     PyFrameObject *f;
7847     PyThreadState *tstate = __Pyx_PyThreadState_Current;
7848     PyObject **fastlocals;
7849     Py_ssize_t i;
7850     PyObject *result;
7851     assert(globals != NULL);
7852     /* XXX Perhaps we should create a specialized
7853        PyFrame_New() that doesn't take locals, but does
7854        take builtins without sanity checking them.
7855        */
7856     assert(tstate != NULL);
7857     f = PyFrame_New(tstate, co, globals, NULL);
7858     if (f == NULL) {
7859         return NULL;
7860     }
7861     fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
7862     for (i = 0; i < na; i++) {
7863         Py_INCREF(*args);
7864         fastlocals[i] = *args++;
7865     }
7866     result = PyEval_EvalFrameEx(f,0);
7867     ++tstate->recursion_depth;
7868     Py_DECREF(f);
7869     --tstate->recursion_depth;
7870     return result;
7871 }
7872 #if 1 || PY_VERSION_HEX < 0x030600B1
__Pyx_PyFunction_FastCallDict(PyObject * func,PyObject ** args,Py_ssize_t nargs,PyObject * kwargs)7873 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
7874     PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
7875     PyObject *globals = PyFunction_GET_GLOBALS(func);
7876     PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
7877     PyObject *closure;
7878 #if PY_MAJOR_VERSION >= 3
7879     PyObject *kwdefs;
7880 #endif
7881     PyObject *kwtuple, **k;
7882     PyObject **d;
7883     Py_ssize_t nd;
7884     Py_ssize_t nk;
7885     PyObject *result;
7886     assert(kwargs == NULL || PyDict_Check(kwargs));
7887     nk = kwargs ? PyDict_Size(kwargs) : 0;
7888     if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
7889         return NULL;
7890     }
7891     if (
7892 #if PY_MAJOR_VERSION >= 3
7893             co->co_kwonlyargcount == 0 &&
7894 #endif
7895             likely(kwargs == NULL || nk == 0) &&
7896             co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
7897         if (argdefs == NULL && co->co_argcount == nargs) {
7898             result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
7899             goto done;
7900         }
7901         else if (nargs == 0 && argdefs != NULL
7902                  && co->co_argcount == Py_SIZE(argdefs)) {
7903             /* function called with no arguments, but all parameters have
7904                a default value: use default values as arguments .*/
7905             args = &PyTuple_GET_ITEM(argdefs, 0);
7906             result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
7907             goto done;
7908         }
7909     }
7910     if (kwargs != NULL) {
7911         Py_ssize_t pos, i;
7912         kwtuple = PyTuple_New(2 * nk);
7913         if (kwtuple == NULL) {
7914             result = NULL;
7915             goto done;
7916         }
7917         k = &PyTuple_GET_ITEM(kwtuple, 0);
7918         pos = i = 0;
7919         while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
7920             Py_INCREF(k[i]);
7921             Py_INCREF(k[i+1]);
7922             i += 2;
7923         }
7924         nk = i / 2;
7925     }
7926     else {
7927         kwtuple = NULL;
7928         k = NULL;
7929     }
7930     closure = PyFunction_GET_CLOSURE(func);
7931 #if PY_MAJOR_VERSION >= 3
7932     kwdefs = PyFunction_GET_KW_DEFAULTS(func);
7933 #endif
7934     if (argdefs != NULL) {
7935         d = &PyTuple_GET_ITEM(argdefs, 0);
7936         nd = Py_SIZE(argdefs);
7937     }
7938     else {
7939         d = NULL;
7940         nd = 0;
7941     }
7942 #if PY_MAJOR_VERSION >= 3
7943     result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
7944                                args, (int)nargs,
7945                                k, (int)nk,
7946                                d, (int)nd, kwdefs, closure);
7947 #else
7948     result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
7949                                args, (int)nargs,
7950                                k, (int)nk,
7951                                d, (int)nd, closure);
7952 #endif
7953     Py_XDECREF(kwtuple);
7954 done:
7955     Py_LeaveRecursiveCall();
7956     return result;
7957 }
7958 #endif
7959 #endif
7960 
7961 /* PyObjectCall */
7962 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_Call(PyObject * func,PyObject * arg,PyObject * kw)7963 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
7964     PyObject *result;
7965     ternaryfunc call = func->ob_type->tp_call;
7966     if (unlikely(!call))
7967         return PyObject_Call(func, arg, kw);
7968     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
7969         return NULL;
7970     result = (*call)(func, arg, kw);
7971     Py_LeaveRecursiveCall();
7972     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
7973         PyErr_SetString(
7974             PyExc_SystemError,
7975             "NULL result without error in PyObject_Call");
7976     }
7977     return result;
7978 }
7979 #endif
7980 
7981 /* PyObjectCallMethO */
7982 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallMethO(PyObject * func,PyObject * arg)7983 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
7984     PyObject *self, *result;
7985     PyCFunction cfunc;
7986     cfunc = PyCFunction_GET_FUNCTION(func);
7987     self = PyCFunction_GET_SELF(func);
7988     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
7989         return NULL;
7990     result = cfunc(self, arg);
7991     Py_LeaveRecursiveCall();
7992     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
7993         PyErr_SetString(
7994             PyExc_SystemError,
7995             "NULL result without error in PyObject_Call");
7996     }
7997     return result;
7998 }
7999 #endif
8000 
8001 /* PyObjectCallOneArg */
8002 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx__PyObject_CallOneArg(PyObject * func,PyObject * arg)8003 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
8004     PyObject *result;
8005     PyObject *args = PyTuple_New(1);
8006     if (unlikely(!args)) return NULL;
8007     Py_INCREF(arg);
8008     PyTuple_SET_ITEM(args, 0, arg);
8009     result = __Pyx_PyObject_Call(func, args, NULL);
8010     Py_DECREF(args);
8011     return result;
8012 }
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)8013 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
8014 #if CYTHON_FAST_PYCALL
8015     if (PyFunction_Check(func)) {
8016         return __Pyx_PyFunction_FastCall(func, &arg, 1);
8017     }
8018 #endif
8019     if (likely(PyCFunction_Check(func))) {
8020         if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
8021             return __Pyx_PyObject_CallMethO(func, arg);
8022 #if CYTHON_FAST_PYCCALL
8023         } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
8024             return __Pyx_PyCFunction_FastCall(func, &arg, 1);
8025 #endif
8026         }
8027     }
8028     return __Pyx__PyObject_CallOneArg(func, arg);
8029 }
8030 #else
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)8031 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
8032     PyObject *result;
8033     PyObject *args = PyTuple_Pack(1, arg);
8034     if (unlikely(!args)) return NULL;
8035     result = __Pyx_PyObject_Call(func, args, NULL);
8036     Py_DECREF(args);
8037     return result;
8038 }
8039 #endif
8040 
8041 /* PyErrFetchRestore */
8042 #if CYTHON_FAST_THREAD_STATE
__Pyx_ErrRestoreInState(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)8043 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
8044     PyObject *tmp_type, *tmp_value, *tmp_tb;
8045     tmp_type = tstate->curexc_type;
8046     tmp_value = tstate->curexc_value;
8047     tmp_tb = tstate->curexc_traceback;
8048     tstate->curexc_type = type;
8049     tstate->curexc_value = value;
8050     tstate->curexc_traceback = tb;
8051     Py_XDECREF(tmp_type);
8052     Py_XDECREF(tmp_value);
8053     Py_XDECREF(tmp_tb);
8054 }
__Pyx_ErrFetchInState(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)8055 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
8056     *type = tstate->curexc_type;
8057     *value = tstate->curexc_value;
8058     *tb = tstate->curexc_traceback;
8059     tstate->curexc_type = 0;
8060     tstate->curexc_value = 0;
8061     tstate->curexc_traceback = 0;
8062 }
8063 #endif
8064 
8065 /* RaiseException */
8066 #if PY_MAJOR_VERSION < 3
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,CYTHON_UNUSED PyObject * cause)8067 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
8068                         CYTHON_UNUSED PyObject *cause) {
8069     __Pyx_PyThreadState_declare
8070     Py_XINCREF(type);
8071     if (!value || value == Py_None)
8072         value = NULL;
8073     else
8074         Py_INCREF(value);
8075     if (!tb || tb == Py_None)
8076         tb = NULL;
8077     else {
8078         Py_INCREF(tb);
8079         if (!PyTraceBack_Check(tb)) {
8080             PyErr_SetString(PyExc_TypeError,
8081                 "raise: arg 3 must be a traceback or None");
8082             goto raise_error;
8083         }
8084     }
8085     if (PyType_Check(type)) {
8086 #if CYTHON_COMPILING_IN_PYPY
8087         if (!value) {
8088             Py_INCREF(Py_None);
8089             value = Py_None;
8090         }
8091 #endif
8092         PyErr_NormalizeException(&type, &value, &tb);
8093     } else {
8094         if (value) {
8095             PyErr_SetString(PyExc_TypeError,
8096                 "instance exception may not have a separate value");
8097             goto raise_error;
8098         }
8099         value = type;
8100         type = (PyObject*) Py_TYPE(type);
8101         Py_INCREF(type);
8102         if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
8103             PyErr_SetString(PyExc_TypeError,
8104                 "raise: exception class must be a subclass of BaseException");
8105             goto raise_error;
8106         }
8107     }
8108     __Pyx_PyThreadState_assign
8109     __Pyx_ErrRestore(type, value, tb);
8110     return;
8111 raise_error:
8112     Py_XDECREF(value);
8113     Py_XDECREF(type);
8114     Py_XDECREF(tb);
8115     return;
8116 }
8117 #else
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,PyObject * cause)8118 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
8119     PyObject* owned_instance = NULL;
8120     if (tb == Py_None) {
8121         tb = 0;
8122     } else if (tb && !PyTraceBack_Check(tb)) {
8123         PyErr_SetString(PyExc_TypeError,
8124             "raise: arg 3 must be a traceback or None");
8125         goto bad;
8126     }
8127     if (value == Py_None)
8128         value = 0;
8129     if (PyExceptionInstance_Check(type)) {
8130         if (value) {
8131             PyErr_SetString(PyExc_TypeError,
8132                 "instance exception may not have a separate value");
8133             goto bad;
8134         }
8135         value = type;
8136         type = (PyObject*) Py_TYPE(value);
8137     } else if (PyExceptionClass_Check(type)) {
8138         PyObject *instance_class = NULL;
8139         if (value && PyExceptionInstance_Check(value)) {
8140             instance_class = (PyObject*) Py_TYPE(value);
8141             if (instance_class != type) {
8142                 int is_subclass = PyObject_IsSubclass(instance_class, type);
8143                 if (!is_subclass) {
8144                     instance_class = NULL;
8145                 } else if (unlikely(is_subclass == -1)) {
8146                     goto bad;
8147                 } else {
8148                     type = instance_class;
8149                 }
8150             }
8151         }
8152         if (!instance_class) {
8153             PyObject *args;
8154             if (!value)
8155                 args = PyTuple_New(0);
8156             else if (PyTuple_Check(value)) {
8157                 Py_INCREF(value);
8158                 args = value;
8159             } else
8160                 args = PyTuple_Pack(1, value);
8161             if (!args)
8162                 goto bad;
8163             owned_instance = PyObject_Call(type, args, NULL);
8164             Py_DECREF(args);
8165             if (!owned_instance)
8166                 goto bad;
8167             value = owned_instance;
8168             if (!PyExceptionInstance_Check(value)) {
8169                 PyErr_Format(PyExc_TypeError,
8170                              "calling %R should have returned an instance of "
8171                              "BaseException, not %R",
8172                              type, Py_TYPE(value));
8173                 goto bad;
8174             }
8175         }
8176     } else {
8177         PyErr_SetString(PyExc_TypeError,
8178             "raise: exception class must be a subclass of BaseException");
8179         goto bad;
8180     }
8181     if (cause) {
8182         PyObject *fixed_cause;
8183         if (cause == Py_None) {
8184             fixed_cause = NULL;
8185         } else if (PyExceptionClass_Check(cause)) {
8186             fixed_cause = PyObject_CallObject(cause, NULL);
8187             if (fixed_cause == NULL)
8188                 goto bad;
8189         } else if (PyExceptionInstance_Check(cause)) {
8190             fixed_cause = cause;
8191             Py_INCREF(fixed_cause);
8192         } else {
8193             PyErr_SetString(PyExc_TypeError,
8194                             "exception causes must derive from "
8195                             "BaseException");
8196             goto bad;
8197         }
8198         PyException_SetCause(value, fixed_cause);
8199     }
8200     PyErr_SetObject(type, value);
8201     if (tb) {
8202 #if CYTHON_COMPILING_IN_PYPY
8203         PyObject *tmp_type, *tmp_value, *tmp_tb;
8204         PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
8205         Py_INCREF(tb);
8206         PyErr_Restore(tmp_type, tmp_value, tb);
8207         Py_XDECREF(tmp_tb);
8208 #else
8209         PyThreadState *tstate = __Pyx_PyThreadState_Current;
8210         PyObject* tmp_tb = tstate->curexc_traceback;
8211         if (tb != tmp_tb) {
8212             Py_INCREF(tb);
8213             tstate->curexc_traceback = tb;
8214             Py_XDECREF(tmp_tb);
8215         }
8216 #endif
8217     }
8218 bad:
8219     Py_XDECREF(owned_instance);
8220     return;
8221 }
8222 #endif
8223 
8224 /* WriteUnraisableException */
__Pyx_WriteUnraisable(const char * name,CYTHON_UNUSED int clineno,CYTHON_UNUSED int lineno,CYTHON_UNUSED const char * filename,int full_traceback,CYTHON_UNUSED int nogil)8225 static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
8226                                   CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
8227                                   int full_traceback, CYTHON_UNUSED int nogil) {
8228     PyObject *old_exc, *old_val, *old_tb;
8229     PyObject *ctx;
8230     __Pyx_PyThreadState_declare
8231 #ifdef WITH_THREAD
8232     PyGILState_STATE state;
8233     if (nogil)
8234         state = PyGILState_Ensure();
8235 #ifdef _MSC_VER
8236     else state = (PyGILState_STATE)-1;
8237 #endif
8238 #endif
8239     __Pyx_PyThreadState_assign
8240     __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
8241     if (full_traceback) {
8242         Py_XINCREF(old_exc);
8243         Py_XINCREF(old_val);
8244         Py_XINCREF(old_tb);
8245         __Pyx_ErrRestore(old_exc, old_val, old_tb);
8246         PyErr_PrintEx(1);
8247     }
8248     #if PY_MAJOR_VERSION < 3
8249     ctx = PyString_FromString(name);
8250     #else
8251     ctx = PyUnicode_FromString(name);
8252     #endif
8253     __Pyx_ErrRestore(old_exc, old_val, old_tb);
8254     if (!ctx) {
8255         PyErr_WriteUnraisable(Py_None);
8256     } else {
8257         PyErr_WriteUnraisable(ctx);
8258         Py_DECREF(ctx);
8259     }
8260 #ifdef WITH_THREAD
8261     if (nogil)
8262         PyGILState_Release(state);
8263 #endif
8264 }
8265 
8266 /* PyObjectCallNoArg */
8267 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallNoArg(PyObject * func)8268 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
8269 #if CYTHON_FAST_PYCALL
8270     if (PyFunction_Check(func)) {
8271         return __Pyx_PyFunction_FastCall(func, NULL, 0);
8272     }
8273 #endif
8274 #ifdef __Pyx_CyFunction_USED
8275     if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
8276 #else
8277     if (likely(PyCFunction_Check(func)))
8278 #endif
8279     {
8280         if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
8281             return __Pyx_PyObject_CallMethO(func, NULL);
8282         }
8283     }
8284     return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
8285 }
8286 #endif
8287 
8288 /* GetItemInt */
__Pyx_GetItemInt_Generic(PyObject * o,PyObject * j)8289 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
8290     PyObject *r;
8291     if (!j) return NULL;
8292     r = PyObject_GetItem(o, j);
8293     Py_DECREF(j);
8294     return r;
8295 }
__Pyx_GetItemInt_List_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)8296 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
8297                                                               CYTHON_NCP_UNUSED int wraparound,
8298                                                               CYTHON_NCP_UNUSED int boundscheck) {
8299 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8300     Py_ssize_t wrapped_i = i;
8301     if (wraparound & unlikely(i < 0)) {
8302         wrapped_i += PyList_GET_SIZE(o);
8303     }
8304     if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
8305         PyObject *r = PyList_GET_ITEM(o, wrapped_i);
8306         Py_INCREF(r);
8307         return r;
8308     }
8309     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
8310 #else
8311     return PySequence_GetItem(o, i);
8312 #endif
8313 }
__Pyx_GetItemInt_Tuple_Fast(PyObject * o,Py_ssize_t i,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)8314 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
8315                                                               CYTHON_NCP_UNUSED int wraparound,
8316                                                               CYTHON_NCP_UNUSED int boundscheck) {
8317 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8318     Py_ssize_t wrapped_i = i;
8319     if (wraparound & unlikely(i < 0)) {
8320         wrapped_i += PyTuple_GET_SIZE(o);
8321     }
8322     if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
8323         PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
8324         Py_INCREF(r);
8325         return r;
8326     }
8327     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
8328 #else
8329     return PySequence_GetItem(o, i);
8330 #endif
8331 }
__Pyx_GetItemInt_Fast(PyObject * o,Py_ssize_t i,int is_list,CYTHON_NCP_UNUSED int wraparound,CYTHON_NCP_UNUSED int boundscheck)8332 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
8333                                                      CYTHON_NCP_UNUSED int wraparound,
8334                                                      CYTHON_NCP_UNUSED int boundscheck) {
8335 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
8336     if (is_list || PyList_CheckExact(o)) {
8337         Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
8338         if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
8339             PyObject *r = PyList_GET_ITEM(o, n);
8340             Py_INCREF(r);
8341             return r;
8342         }
8343     }
8344     else if (PyTuple_CheckExact(o)) {
8345         Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
8346         if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
8347             PyObject *r = PyTuple_GET_ITEM(o, n);
8348             Py_INCREF(r);
8349             return r;
8350         }
8351     } else {
8352         PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
8353         if (likely(m && m->sq_item)) {
8354             if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
8355                 Py_ssize_t l = m->sq_length(o);
8356                 if (likely(l >= 0)) {
8357                     i += l;
8358                 } else {
8359                     if (!PyErr_ExceptionMatches(PyExc_OverflowError))
8360                         return NULL;
8361                     PyErr_Clear();
8362                 }
8363             }
8364             return m->sq_item(o, i);
8365         }
8366     }
8367 #else
8368     if (is_list || PySequence_Check(o)) {
8369         return PySequence_GetItem(o, i);
8370     }
8371 #endif
8372     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
8373 }
8374 
8375 /* PyIntBinop */
8376 #if !CYTHON_COMPILING_IN_PYPY
__Pyx_PyInt_AndObjC(PyObject * op1,PyObject * op2,CYTHON_UNUSED long intval,int inplace,int zerodivision_check)8377 static PyObject* __Pyx_PyInt_AndObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
8378     (void)inplace;
8379     (void)zerodivision_check;
8380     #if PY_MAJOR_VERSION < 3
8381     if (likely(PyInt_CheckExact(op1))) {
8382         const long b = intval;
8383         long a = PyInt_AS_LONG(op1);
8384             return PyInt_FromLong(a & b);
8385     }
8386     #endif
8387     #if CYTHON_USE_PYLONG_INTERNALS
8388     if (likely(PyLong_CheckExact(op1))) {
8389         const long b = intval;
8390         long a, x;
8391 #ifdef HAVE_LONG_LONG
8392         const PY_LONG_LONG llb = intval;
8393         PY_LONG_LONG lla, llx;
8394 #endif
8395         const digit* digits = ((PyLongObject*)op1)->ob_digit;
8396         const Py_ssize_t size = Py_SIZE(op1);
8397         if (likely(__Pyx_sst_abs(size) <= 1)) {
8398             a = likely(size) ? digits[0] : 0;
8399             if (size == -1) a = -a;
8400         } else {
8401             switch (size) {
8402                 case -2:
8403                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
8404                         a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
8405                         break;
8406 #ifdef HAVE_LONG_LONG
8407                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
8408                         lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
8409                         goto long_long;
8410 #endif
8411                     }
8412                     CYTHON_FALLTHROUGH;
8413                 case 2:
8414                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
8415                         a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
8416                         break;
8417 #ifdef HAVE_LONG_LONG
8418                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
8419                         lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
8420                         goto long_long;
8421 #endif
8422                     }
8423                     CYTHON_FALLTHROUGH;
8424                 case -3:
8425                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
8426                         a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
8427                         break;
8428 #ifdef HAVE_LONG_LONG
8429                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
8430                         lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
8431                         goto long_long;
8432 #endif
8433                     }
8434                     CYTHON_FALLTHROUGH;
8435                 case 3:
8436                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
8437                         a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
8438                         break;
8439 #ifdef HAVE_LONG_LONG
8440                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
8441                         lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
8442                         goto long_long;
8443 #endif
8444                     }
8445                     CYTHON_FALLTHROUGH;
8446                 case -4:
8447                     if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
8448                         a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
8449                         break;
8450 #ifdef HAVE_LONG_LONG
8451                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
8452                         lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
8453                         goto long_long;
8454 #endif
8455                     }
8456                     CYTHON_FALLTHROUGH;
8457                 case 4:
8458                     if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
8459                         a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
8460                         break;
8461 #ifdef HAVE_LONG_LONG
8462                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
8463                         lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
8464                         goto long_long;
8465 #endif
8466                     }
8467                     CYTHON_FALLTHROUGH;
8468                 default: return PyLong_Type.tp_as_number->nb_and(op1, op2);
8469             }
8470         }
8471                 x = a & b;
8472             return PyLong_FromLong(x);
8473 #ifdef HAVE_LONG_LONG
8474         long_long:
8475                 llx = lla & llb;
8476             return PyLong_FromLongLong(llx);
8477 #endif
8478 
8479 
8480     }
8481     #endif
8482     return (inplace ? PyNumber_InPlaceAnd : PyNumber_And)(op1, op2);
8483 }
8484 #endif
8485 
8486 /* PyIntBinop */
8487 #if !CYTHON_COMPILING_IN_PYPY
__Pyx_PyInt_LshiftObjC(PyObject * op1,PyObject * op2,CYTHON_UNUSED long intval,int inplace,int zerodivision_check)8488 static PyObject* __Pyx_PyInt_LshiftObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
8489     (void)inplace;
8490     (void)zerodivision_check;
8491     #if PY_MAJOR_VERSION < 3
8492     if (likely(PyInt_CheckExact(op1))) {
8493         const long b = intval;
8494         long a = PyInt_AS_LONG(op1);
8495             if (likely(b < (long) (sizeof(long)*8) && a == (a << b) >> b) || !a) {
8496                 return PyInt_FromLong(a << b);
8497             }
8498     }
8499     #endif
8500     #if CYTHON_USE_PYLONG_INTERNALS
8501     if (likely(PyLong_CheckExact(op1))) {
8502         const long b = intval;
8503         long a, x;
8504 #ifdef HAVE_LONG_LONG
8505         const PY_LONG_LONG llb = intval;
8506         PY_LONG_LONG lla, llx;
8507 #endif
8508         const digit* digits = ((PyLongObject*)op1)->ob_digit;
8509         const Py_ssize_t size = Py_SIZE(op1);
8510         if (likely(__Pyx_sst_abs(size) <= 1)) {
8511             a = likely(size) ? digits[0] : 0;
8512             if (size == -1) a = -a;
8513         } else {
8514             switch (size) {
8515                 case -2:
8516                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
8517                         a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
8518                         break;
8519 #ifdef HAVE_LONG_LONG
8520                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
8521                         lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
8522                         goto long_long;
8523 #endif
8524                     }
8525                     CYTHON_FALLTHROUGH;
8526                 case 2:
8527                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
8528                         a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
8529                         break;
8530 #ifdef HAVE_LONG_LONG
8531                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
8532                         lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
8533                         goto long_long;
8534 #endif
8535                     }
8536                     CYTHON_FALLTHROUGH;
8537                 case -3:
8538                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
8539                         a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
8540                         break;
8541 #ifdef HAVE_LONG_LONG
8542                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
8543                         lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
8544                         goto long_long;
8545 #endif
8546                     }
8547                     CYTHON_FALLTHROUGH;
8548                 case 3:
8549                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
8550                         a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
8551                         break;
8552 #ifdef HAVE_LONG_LONG
8553                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
8554                         lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
8555                         goto long_long;
8556 #endif
8557                     }
8558                     CYTHON_FALLTHROUGH;
8559                 case -4:
8560                     if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
8561                         a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
8562                         break;
8563 #ifdef HAVE_LONG_LONG
8564                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
8565                         lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
8566                         goto long_long;
8567 #endif
8568                     }
8569                     CYTHON_FALLTHROUGH;
8570                 case 4:
8571                     if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
8572                         a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
8573                         break;
8574 #ifdef HAVE_LONG_LONG
8575                     } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
8576                         lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
8577                         goto long_long;
8578 #endif
8579                     }
8580                     CYTHON_FALLTHROUGH;
8581                 default: return PyLong_Type.tp_as_number->nb_lshift(op1, op2);
8582             }
8583         }
8584                 x = a << b;
8585 #ifdef HAVE_LONG_LONG
8586                 if (unlikely(!(b < (long) (sizeof(long)*8) && a == x >> b)) && a) {
8587                     lla = a;
8588                     goto long_long;
8589                 }
8590 #else
8591                 if (likely(b < (long) (sizeof(long)*8) && a == x >> b) || !a)
8592 #endif
8593             return PyLong_FromLong(x);
8594 #ifdef HAVE_LONG_LONG
8595         long_long:
8596                 llx = lla << llb;
8597                 if (likely(lla == llx >> llb))
8598             return PyLong_FromLongLong(llx);
8599 #endif
8600 
8601 
8602     }
8603     #endif
8604     return (inplace ? PyNumber_InPlaceLshift : PyNumber_Lshift)(op1, op2);
8605 }
8606 #endif
8607 
8608 /* PyDictVersioning */
8609 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
__Pyx_get_tp_dict_version(PyObject * obj)8610 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
8611     PyObject *dict = Py_TYPE(obj)->tp_dict;
8612     return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
8613 }
__Pyx_get_object_dict_version(PyObject * obj)8614 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
8615     PyObject **dictptr = NULL;
8616     Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
8617     if (offset) {
8618 #if CYTHON_COMPILING_IN_CPYTHON
8619         dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
8620 #else
8621         dictptr = _PyObject_GetDictPtr(obj);
8622 #endif
8623     }
8624     return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
8625 }
__Pyx_object_dict_version_matches(PyObject * obj,PY_UINT64_T tp_dict_version,PY_UINT64_T obj_dict_version)8626 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
8627     PyObject *dict = Py_TYPE(obj)->tp_dict;
8628     if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
8629         return 0;
8630     return obj_dict_version == __Pyx_get_object_dict_version(obj);
8631 }
8632 #endif
8633 
8634 /* GetModuleGlobalName */
8635 #if CYTHON_USE_DICT_VERSIONS
__Pyx__GetModuleGlobalName(PyObject * name,PY_UINT64_T * dict_version,PyObject ** dict_cached_value)8636 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
8637 #else
8638 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
8639 #endif
8640 {
8641     PyObject *result;
8642 #if !CYTHON_AVOID_BORROWED_REFS
8643 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
8644     result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
8645     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
8646     if (likely(result)) {
8647         return __Pyx_NewRef(result);
8648     } else if (unlikely(PyErr_Occurred())) {
8649         return NULL;
8650     }
8651 #else
8652     result = PyDict_GetItem(__pyx_d, name);
8653     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
8654     if (likely(result)) {
8655         return __Pyx_NewRef(result);
8656     }
8657 #endif
8658 #else
8659     result = PyObject_GetItem(__pyx_d, name);
8660     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
8661     if (likely(result)) {
8662         return __Pyx_NewRef(result);
8663     }
8664     PyErr_Clear();
8665 #endif
8666     return __Pyx_GetBuiltinName(name);
8667 }
8668 
8669 /* PyObject_GenericGetAttrNoDict */
8670 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_RaiseGenericGetAttributeError(PyTypeObject * tp,PyObject * attr_name)8671 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
8672     PyErr_Format(PyExc_AttributeError,
8673 #if PY_MAJOR_VERSION >= 3
8674                  "'%.50s' object has no attribute '%U'",
8675                  tp->tp_name, attr_name);
8676 #else
8677                  "'%.50s' object has no attribute '%.400s'",
8678                  tp->tp_name, PyString_AS_STRING(attr_name));
8679 #endif
8680     return NULL;
8681 }
__Pyx_PyObject_GenericGetAttrNoDict(PyObject * obj,PyObject * attr_name)8682 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
8683     PyObject *descr;
8684     PyTypeObject *tp = Py_TYPE(obj);
8685     if (unlikely(!PyString_Check(attr_name))) {
8686         return PyObject_GenericGetAttr(obj, attr_name);
8687     }
8688     assert(!tp->tp_dictoffset);
8689     descr = _PyType_Lookup(tp, attr_name);
8690     if (unlikely(!descr)) {
8691         return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
8692     }
8693     Py_INCREF(descr);
8694     #if PY_MAJOR_VERSION < 3
8695     if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
8696     #endif
8697     {
8698         descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
8699         if (unlikely(f)) {
8700             PyObject *res = f(descr, obj, (PyObject *)tp);
8701             Py_DECREF(descr);
8702             return res;
8703         }
8704     }
8705     return descr;
8706 }
8707 #endif
8708 
8709 /* PyObject_GenericGetAttr */
8710 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_PyObject_GenericGetAttr(PyObject * obj,PyObject * attr_name)8711 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
8712     if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
8713         return PyObject_GenericGetAttr(obj, attr_name);
8714     }
8715     return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
8716 }
8717 #endif
8718 
8719 /* PyErrExceptionMatches */
8720 #if CYTHON_FAST_THREAD_STATE
__Pyx_PyErr_ExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)8721 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
8722     Py_ssize_t i, n;
8723     n = PyTuple_GET_SIZE(tuple);
8724 #if PY_MAJOR_VERSION >= 3
8725     for (i=0; i<n; i++) {
8726         if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
8727     }
8728 #endif
8729     for (i=0; i<n; i++) {
8730         if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
8731     }
8732     return 0;
8733 }
__Pyx_PyErr_ExceptionMatchesInState(PyThreadState * tstate,PyObject * err)8734 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
8735     PyObject *exc_type = tstate->curexc_type;
8736     if (exc_type == err) return 1;
8737     if (unlikely(!exc_type)) return 0;
8738     if (unlikely(PyTuple_Check(err)))
8739         return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
8740     return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
8741 }
8742 #endif
8743 
8744 /* PyObjectGetAttrStrNoError */
__Pyx_PyObject_GetAttrStr_ClearAttributeError(void)8745 static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
8746     __Pyx_PyThreadState_declare
8747     __Pyx_PyThreadState_assign
8748     if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
8749         __Pyx_PyErr_Clear();
8750 }
__Pyx_PyObject_GetAttrStrNoError(PyObject * obj,PyObject * attr_name)8751 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
8752     PyObject *result;
8753 #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
8754     PyTypeObject* tp = Py_TYPE(obj);
8755     if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
8756         return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
8757     }
8758 #endif
8759     result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
8760     if (unlikely(!result)) {
8761         __Pyx_PyObject_GetAttrStr_ClearAttributeError();
8762     }
8763     return result;
8764 }
8765 
8766 /* SetupReduce */
__Pyx_setup_reduce_is_named(PyObject * meth,PyObject * name)8767 static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
8768   int ret;
8769   PyObject *name_attr;
8770   name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name);
8771   if (likely(name_attr)) {
8772       ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
8773   } else {
8774       ret = -1;
8775   }
8776   if (unlikely(ret < 0)) {
8777       PyErr_Clear();
8778       ret = 0;
8779   }
8780   Py_XDECREF(name_attr);
8781   return ret;
8782 }
__Pyx_setup_reduce(PyObject * type_obj)8783 static int __Pyx_setup_reduce(PyObject* type_obj) {
8784     int ret = 0;
8785     PyObject *object_reduce = NULL;
8786     PyObject *object_reduce_ex = NULL;
8787     PyObject *reduce = NULL;
8788     PyObject *reduce_ex = NULL;
8789     PyObject *reduce_cython = NULL;
8790     PyObject *setstate = NULL;
8791     PyObject *setstate_cython = NULL;
8792 #if CYTHON_USE_PYTYPE_LOOKUP
8793     if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
8794 #else
8795     if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
8796 #endif
8797 #if CYTHON_USE_PYTYPE_LOOKUP
8798     object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
8799 #else
8800     object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
8801 #endif
8802     reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD;
8803     if (reduce_ex == object_reduce_ex) {
8804 #if CYTHON_USE_PYTYPE_LOOKUP
8805         object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
8806 #else
8807         object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
8808 #endif
8809         reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
8810         if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
8811             reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython);
8812             if (likely(reduce_cython)) {
8813                 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
8814                 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
8815             } else if (reduce == object_reduce || PyErr_Occurred()) {
8816                 goto __PYX_BAD;
8817             }
8818             setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
8819             if (!setstate) PyErr_Clear();
8820             if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
8821                 setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython);
8822                 if (likely(setstate_cython)) {
8823                     ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
8824                     ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
8825                 } else if (!setstate || PyErr_Occurred()) {
8826                     goto __PYX_BAD;
8827                 }
8828             }
8829             PyType_Modified((PyTypeObject*)type_obj);
8830         }
8831     }
8832     goto __PYX_GOOD;
8833 __PYX_BAD:
8834     if (!PyErr_Occurred())
8835         PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
8836     ret = -1;
8837 __PYX_GOOD:
8838 #if !CYTHON_USE_PYTYPE_LOOKUP
8839     Py_XDECREF(object_reduce);
8840     Py_XDECREF(object_reduce_ex);
8841 #endif
8842     Py_XDECREF(reduce);
8843     Py_XDECREF(reduce_ex);
8844     Py_XDECREF(reduce_cython);
8845     Py_XDECREF(setstate);
8846     Py_XDECREF(setstate_cython);
8847     return ret;
8848 }
8849 
8850 /* Import */
__Pyx_Import(PyObject * name,PyObject * from_list,int level)8851 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
8852     PyObject *empty_list = 0;
8853     PyObject *module = 0;
8854     PyObject *global_dict = 0;
8855     PyObject *empty_dict = 0;
8856     PyObject *list;
8857     #if PY_MAJOR_VERSION < 3
8858     PyObject *py_import;
8859     py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
8860     if (!py_import)
8861         goto bad;
8862     #endif
8863     if (from_list)
8864         list = from_list;
8865     else {
8866         empty_list = PyList_New(0);
8867         if (!empty_list)
8868             goto bad;
8869         list = empty_list;
8870     }
8871     global_dict = PyModule_GetDict(__pyx_m);
8872     if (!global_dict)
8873         goto bad;
8874     empty_dict = PyDict_New();
8875     if (!empty_dict)
8876         goto bad;
8877     {
8878         #if PY_MAJOR_VERSION >= 3
8879         if (level == -1) {
8880             if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
8881                 module = PyImport_ImportModuleLevelObject(
8882                     name, global_dict, empty_dict, list, 1);
8883                 if (!module) {
8884                     if (!PyErr_ExceptionMatches(PyExc_ImportError))
8885                         goto bad;
8886                     PyErr_Clear();
8887                 }
8888             }
8889             level = 0;
8890         }
8891         #endif
8892         if (!module) {
8893             #if PY_MAJOR_VERSION < 3
8894             PyObject *py_level = PyInt_FromLong(level);
8895             if (!py_level)
8896                 goto bad;
8897             module = PyObject_CallFunctionObjArgs(py_import,
8898                 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
8899             Py_DECREF(py_level);
8900             #else
8901             module = PyImport_ImportModuleLevelObject(
8902                 name, global_dict, empty_dict, list, level);
8903             #endif
8904         }
8905     }
8906 bad:
8907     #if PY_MAJOR_VERSION < 3
8908     Py_XDECREF(py_import);
8909     #endif
8910     Py_XDECREF(empty_list);
8911     Py_XDECREF(empty_dict);
8912     return module;
8913 }
8914 
8915 /* CLineInTraceback */
8916 #ifndef CYTHON_CLINE_IN_TRACEBACK
__Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState * tstate,int c_line)8917 static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
8918     PyObject *use_cline;
8919     PyObject *ptype, *pvalue, *ptraceback;
8920 #if CYTHON_COMPILING_IN_CPYTHON
8921     PyObject **cython_runtime_dict;
8922 #endif
8923     if (unlikely(!__pyx_cython_runtime)) {
8924         return c_line;
8925     }
8926     __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
8927 #if CYTHON_COMPILING_IN_CPYTHON
8928     cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
8929     if (likely(cython_runtime_dict)) {
8930         __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
8931             use_cline, *cython_runtime_dict,
8932             __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
8933     } else
8934 #endif
8935     {
8936       PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
8937       if (use_cline_obj) {
8938         use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
8939         Py_DECREF(use_cline_obj);
8940       } else {
8941         PyErr_Clear();
8942         use_cline = NULL;
8943       }
8944     }
8945     if (!use_cline) {
8946         c_line = 0;
8947         PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
8948     }
8949     else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
8950         c_line = 0;
8951     }
8952     __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
8953     return c_line;
8954 }
8955 #endif
8956 
8957 /* CodeObjectCache */
__pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry * entries,int count,int code_line)8958 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
8959     int start = 0, mid = 0, end = count - 1;
8960     if (end >= 0 && code_line > entries[end].code_line) {
8961         return count;
8962     }
8963     while (start < end) {
8964         mid = start + (end - start) / 2;
8965         if (code_line < entries[mid].code_line) {
8966             end = mid;
8967         } else if (code_line > entries[mid].code_line) {
8968              start = mid + 1;
8969         } else {
8970             return mid;
8971         }
8972     }
8973     if (code_line <= entries[mid].code_line) {
8974         return mid;
8975     } else {
8976         return mid + 1;
8977     }
8978 }
__pyx_find_code_object(int code_line)8979 static PyCodeObject *__pyx_find_code_object(int code_line) {
8980     PyCodeObject* code_object;
8981     int pos;
8982     if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
8983         return NULL;
8984     }
8985     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
8986     if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
8987         return NULL;
8988     }
8989     code_object = __pyx_code_cache.entries[pos].code_object;
8990     Py_INCREF(code_object);
8991     return code_object;
8992 }
__pyx_insert_code_object(int code_line,PyCodeObject * code_object)8993 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
8994     int pos, i;
8995     __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
8996     if (unlikely(!code_line)) {
8997         return;
8998     }
8999     if (unlikely(!entries)) {
9000         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
9001         if (likely(entries)) {
9002             __pyx_code_cache.entries = entries;
9003             __pyx_code_cache.max_count = 64;
9004             __pyx_code_cache.count = 1;
9005             entries[0].code_line = code_line;
9006             entries[0].code_object = code_object;
9007             Py_INCREF(code_object);
9008         }
9009         return;
9010     }
9011     pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
9012     if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
9013         PyCodeObject* tmp = entries[pos].code_object;
9014         entries[pos].code_object = code_object;
9015         Py_DECREF(tmp);
9016         return;
9017     }
9018     if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
9019         int new_max = __pyx_code_cache.max_count + 64;
9020         entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
9021             __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
9022         if (unlikely(!entries)) {
9023             return;
9024         }
9025         __pyx_code_cache.entries = entries;
9026         __pyx_code_cache.max_count = new_max;
9027     }
9028     for (i=__pyx_code_cache.count; i>pos; i--) {
9029         entries[i] = entries[i-1];
9030     }
9031     entries[pos].code_line = code_line;
9032     entries[pos].code_object = code_object;
9033     __pyx_code_cache.count++;
9034     Py_INCREF(code_object);
9035 }
9036 
9037 /* AddTraceback */
9038 #include "compile.h"
9039 #include "frameobject.h"
9040 #include "traceback.h"
__Pyx_CreateCodeObjectForTraceback(const char * funcname,int c_line,int py_line,const char * filename)9041 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
9042             const char *funcname, int c_line,
9043             int py_line, const char *filename) {
9044     PyCodeObject *py_code = 0;
9045     PyObject *py_srcfile = 0;
9046     PyObject *py_funcname = 0;
9047     #if PY_MAJOR_VERSION < 3
9048     py_srcfile = PyString_FromString(filename);
9049     #else
9050     py_srcfile = PyUnicode_FromString(filename);
9051     #endif
9052     if (!py_srcfile) goto bad;
9053     if (c_line) {
9054         #if PY_MAJOR_VERSION < 3
9055         py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
9056         #else
9057         py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
9058         #endif
9059     }
9060     else {
9061         #if PY_MAJOR_VERSION < 3
9062         py_funcname = PyString_FromString(funcname);
9063         #else
9064         py_funcname = PyUnicode_FromString(funcname);
9065         #endif
9066     }
9067     if (!py_funcname) goto bad;
9068     py_code = __Pyx_PyCode_New(
9069         0,
9070         0,
9071         0,
9072         0,
9073         0,
9074         __pyx_empty_bytes, /*PyObject *code,*/
9075         __pyx_empty_tuple, /*PyObject *consts,*/
9076         __pyx_empty_tuple, /*PyObject *names,*/
9077         __pyx_empty_tuple, /*PyObject *varnames,*/
9078         __pyx_empty_tuple, /*PyObject *freevars,*/
9079         __pyx_empty_tuple, /*PyObject *cellvars,*/
9080         py_srcfile,   /*PyObject *filename,*/
9081         py_funcname,  /*PyObject *name,*/
9082         py_line,
9083         __pyx_empty_bytes  /*PyObject *lnotab*/
9084     );
9085     Py_DECREF(py_srcfile);
9086     Py_DECREF(py_funcname);
9087     return py_code;
9088 bad:
9089     Py_XDECREF(py_srcfile);
9090     Py_XDECREF(py_funcname);
9091     return NULL;
9092 }
__Pyx_AddTraceback(const char * funcname,int c_line,int py_line,const char * filename)9093 static void __Pyx_AddTraceback(const char *funcname, int c_line,
9094                                int py_line, const char *filename) {
9095     PyCodeObject *py_code = 0;
9096     PyFrameObject *py_frame = 0;
9097     PyThreadState *tstate = __Pyx_PyThreadState_Current;
9098     if (c_line) {
9099         c_line = __Pyx_CLineForTraceback(tstate, c_line);
9100     }
9101     py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
9102     if (!py_code) {
9103         py_code = __Pyx_CreateCodeObjectForTraceback(
9104             funcname, c_line, py_line, filename);
9105         if (!py_code) goto bad;
9106         __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
9107     }
9108     py_frame = PyFrame_New(
9109         tstate,            /*PyThreadState *tstate,*/
9110         py_code,           /*PyCodeObject *code,*/
9111         __pyx_d,    /*PyObject *globals,*/
9112         0                  /*PyObject *locals*/
9113     );
9114     if (!py_frame) goto bad;
9115     __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
9116     PyTraceBack_Here(py_frame);
9117 bad:
9118     Py_XDECREF(py_code);
9119     Py_XDECREF(py_frame);
9120 }
9121 
9122 /* CIntToPy */
__Pyx_PyInt_From_PmDeviceID(PmDeviceID value)9123 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PmDeviceID(PmDeviceID value) {
9124     const PmDeviceID neg_one = (PmDeviceID) ((PmDeviceID) 0 - (PmDeviceID) 1), const_zero = (PmDeviceID) 0;
9125     const int is_unsigned = neg_one > const_zero;
9126     if (is_unsigned) {
9127         if (sizeof(PmDeviceID) < sizeof(long)) {
9128             return PyInt_FromLong((long) value);
9129         } else if (sizeof(PmDeviceID) <= sizeof(unsigned long)) {
9130             return PyLong_FromUnsignedLong((unsigned long) value);
9131 #ifdef HAVE_LONG_LONG
9132         } else if (sizeof(PmDeviceID) <= sizeof(unsigned PY_LONG_LONG)) {
9133             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
9134 #endif
9135         }
9136     } else {
9137         if (sizeof(PmDeviceID) <= sizeof(long)) {
9138             return PyInt_FromLong((long) value);
9139 #ifdef HAVE_LONG_LONG
9140         } else if (sizeof(PmDeviceID) <= sizeof(PY_LONG_LONG)) {
9141             return PyLong_FromLongLong((PY_LONG_LONG) value);
9142 #endif
9143         }
9144     }
9145     {
9146         int one = 1; int little = (int)*(unsigned char *)&one;
9147         unsigned char *bytes = (unsigned char *)&value;
9148         return _PyLong_FromByteArray(bytes, sizeof(PmDeviceID),
9149                                      little, !is_unsigned);
9150     }
9151 }
9152 
9153 /* CIntToPy */
__Pyx_PyInt_From_int(int value)9154 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
9155     const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
9156     const int is_unsigned = neg_one > const_zero;
9157     if (is_unsigned) {
9158         if (sizeof(int) < sizeof(long)) {
9159             return PyInt_FromLong((long) value);
9160         } else if (sizeof(int) <= sizeof(unsigned long)) {
9161             return PyLong_FromUnsignedLong((unsigned long) value);
9162 #ifdef HAVE_LONG_LONG
9163         } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
9164             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
9165 #endif
9166         }
9167     } else {
9168         if (sizeof(int) <= sizeof(long)) {
9169             return PyInt_FromLong((long) value);
9170 #ifdef HAVE_LONG_LONG
9171         } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
9172             return PyLong_FromLongLong((PY_LONG_LONG) value);
9173 #endif
9174         }
9175     }
9176     {
9177         int one = 1; int little = (int)*(unsigned char *)&one;
9178         unsigned char *bytes = (unsigned char *)&value;
9179         return _PyLong_FromByteArray(bytes, sizeof(int),
9180                                      little, !is_unsigned);
9181     }
9182 }
9183 
9184 /* CIntFromPyVerify */
9185 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
9186     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
9187 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
9188     __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
9189 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
9190     {\
9191         func_type value = func_value;\
9192         if (sizeof(target_type) < sizeof(func_type)) {\
9193             if (unlikely(value != (func_type) (target_type) value)) {\
9194                 func_type zero = 0;\
9195                 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
9196                     return (target_type) -1;\
9197                 if (is_unsigned && unlikely(value < zero))\
9198                     goto raise_neg_overflow;\
9199                 else\
9200                     goto raise_overflow;\
9201             }\
9202         }\
9203         return (target_type) value;\
9204     }
9205 
9206 /* CIntToPy */
__Pyx_PyInt_From_PtTimestamp(PtTimestamp value)9207 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PtTimestamp(PtTimestamp value) {
9208     const PtTimestamp neg_one = (PtTimestamp) ((PtTimestamp) 0 - (PtTimestamp) 1), const_zero = (PtTimestamp) 0;
9209     const int is_unsigned = neg_one > const_zero;
9210     if (is_unsigned) {
9211         if (sizeof(PtTimestamp) < sizeof(long)) {
9212             return PyInt_FromLong((long) value);
9213         } else if (sizeof(PtTimestamp) <= sizeof(unsigned long)) {
9214             return PyLong_FromUnsignedLong((unsigned long) value);
9215 #ifdef HAVE_LONG_LONG
9216         } else if (sizeof(PtTimestamp) <= sizeof(unsigned PY_LONG_LONG)) {
9217             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
9218 #endif
9219         }
9220     } else {
9221         if (sizeof(PtTimestamp) <= sizeof(long)) {
9222             return PyInt_FromLong((long) value);
9223 #ifdef HAVE_LONG_LONG
9224         } else if (sizeof(PtTimestamp) <= sizeof(PY_LONG_LONG)) {
9225             return PyLong_FromLongLong((PY_LONG_LONG) value);
9226 #endif
9227         }
9228     }
9229     {
9230         int one = 1; int little = (int)*(unsigned char *)&one;
9231         unsigned char *bytes = (unsigned char *)&value;
9232         return _PyLong_FromByteArray(bytes, sizeof(PtTimestamp),
9233                                      little, !is_unsigned);
9234     }
9235 }
9236 
9237 /* Print */
9238 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3
__Pyx_GetStdout(void)9239 static PyObject *__Pyx_GetStdout(void) {
9240     PyObject *f = PySys_GetObject((char *)"stdout");
9241     if (!f) {
9242         PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout");
9243     }
9244     return f;
9245 }
__Pyx_Print(PyObject * f,PyObject * arg_tuple,int newline)9246 static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) {
9247     int i;
9248     if (!f) {
9249         if (!(f = __Pyx_GetStdout()))
9250             return -1;
9251     }
9252     Py_INCREF(f);
9253     for (i=0; i < PyTuple_GET_SIZE(arg_tuple); i++) {
9254         PyObject* v;
9255         if (PyFile_SoftSpace(f, 1)) {
9256             if (PyFile_WriteString(" ", f) < 0)
9257                 goto error;
9258         }
9259         v = PyTuple_GET_ITEM(arg_tuple, i);
9260         if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0)
9261             goto error;
9262         if (PyString_Check(v)) {
9263             char *s = PyString_AsString(v);
9264             Py_ssize_t len = PyString_Size(v);
9265             if (len > 0) {
9266                 switch (s[len-1]) {
9267                     case ' ': break;
9268                     case '\f': case '\r': case '\n': case '\t': case '\v':
9269                         PyFile_SoftSpace(f, 0);
9270                         break;
9271                     default:  break;
9272                 }
9273             }
9274         }
9275     }
9276     if (newline) {
9277         if (PyFile_WriteString("\n", f) < 0)
9278             goto error;
9279         PyFile_SoftSpace(f, 0);
9280     }
9281     Py_DECREF(f);
9282     return 0;
9283 error:
9284     Py_DECREF(f);
9285     return -1;
9286 }
9287 #else
__Pyx_Print(PyObject * stream,PyObject * arg_tuple,int newline)9288 static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) {
9289     PyObject* kwargs = 0;
9290     PyObject* result = 0;
9291     PyObject* end_string;
9292     if (unlikely(!__pyx_print)) {
9293         __pyx_print = PyObject_GetAttr(__pyx_b, __pyx_n_s_print);
9294         if (!__pyx_print)
9295             return -1;
9296     }
9297     if (stream) {
9298         kwargs = PyDict_New();
9299         if (unlikely(!kwargs))
9300             return -1;
9301         if (unlikely(PyDict_SetItem(kwargs, __pyx_n_s_file, stream) < 0))
9302             goto bad;
9303         if (!newline) {
9304             end_string = PyUnicode_FromStringAndSize(" ", 1);
9305             if (unlikely(!end_string))
9306                 goto bad;
9307             if (PyDict_SetItem(kwargs, __pyx_n_s_end, end_string) < 0) {
9308                 Py_DECREF(end_string);
9309                 goto bad;
9310             }
9311             Py_DECREF(end_string);
9312         }
9313     } else if (!newline) {
9314         if (unlikely(!__pyx_print_kwargs)) {
9315             __pyx_print_kwargs = PyDict_New();
9316             if (unlikely(!__pyx_print_kwargs))
9317                 return -1;
9318             end_string = PyUnicode_FromStringAndSize(" ", 1);
9319             if (unlikely(!end_string))
9320                 return -1;
9321             if (PyDict_SetItem(__pyx_print_kwargs, __pyx_n_s_end, end_string) < 0) {
9322                 Py_DECREF(end_string);
9323                 return -1;
9324             }
9325             Py_DECREF(end_string);
9326         }
9327         kwargs = __pyx_print_kwargs;
9328     }
9329     result = PyObject_Call(__pyx_print, arg_tuple, kwargs);
9330     if (unlikely(kwargs) && (kwargs != __pyx_print_kwargs))
9331         Py_DECREF(kwargs);
9332     if (!result)
9333         return -1;
9334     Py_DECREF(result);
9335     return 0;
9336 bad:
9337     if (kwargs != __pyx_print_kwargs)
9338         Py_XDECREF(kwargs);
9339     return -1;
9340 }
9341 #endif
9342 
9343 /* CIntToPy */
__Pyx_PyInt_From_PmError(PmError value)9344 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PmError(PmError value) {
9345     const PmError neg_one = (PmError) ((PmError) 0 - (PmError) 1), const_zero = (PmError) 0;
9346     const int is_unsigned = neg_one > const_zero;
9347     if (is_unsigned) {
9348         if (sizeof(PmError) < sizeof(long)) {
9349             return PyInt_FromLong((long) value);
9350         } else if (sizeof(PmError) <= sizeof(unsigned long)) {
9351             return PyLong_FromUnsignedLong((unsigned long) value);
9352 #ifdef HAVE_LONG_LONG
9353         } else if (sizeof(PmError) <= sizeof(unsigned PY_LONG_LONG)) {
9354             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
9355 #endif
9356         }
9357     } else {
9358         if (sizeof(PmError) <= sizeof(long)) {
9359             return PyInt_FromLong((long) value);
9360 #ifdef HAVE_LONG_LONG
9361         } else if (sizeof(PmError) <= sizeof(PY_LONG_LONG)) {
9362             return PyLong_FromLongLong((PY_LONG_LONG) value);
9363 #endif
9364         }
9365     }
9366     {
9367         int one = 1; int little = (int)*(unsigned char *)&one;
9368         unsigned char *bytes = (unsigned char *)&value;
9369         return _PyLong_FromByteArray(bytes, sizeof(PmError),
9370                                      little, !is_unsigned);
9371     }
9372 }
9373 
9374 /* CIntToPy */
__Pyx_PyInt_From_long(long value)9375 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
9376     const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
9377     const int is_unsigned = neg_one > const_zero;
9378     if (is_unsigned) {
9379         if (sizeof(long) < sizeof(long)) {
9380             return PyInt_FromLong((long) value);
9381         } else if (sizeof(long) <= sizeof(unsigned long)) {
9382             return PyLong_FromUnsignedLong((unsigned long) value);
9383 #ifdef HAVE_LONG_LONG
9384         } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
9385             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
9386 #endif
9387         }
9388     } else {
9389         if (sizeof(long) <= sizeof(long)) {
9390             return PyInt_FromLong((long) value);
9391 #ifdef HAVE_LONG_LONG
9392         } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
9393             return PyLong_FromLongLong((PY_LONG_LONG) value);
9394 #endif
9395         }
9396     }
9397     {
9398         int one = 1; int little = (int)*(unsigned char *)&one;
9399         unsigned char *bytes = (unsigned char *)&value;
9400         return _PyLong_FromByteArray(bytes, sizeof(long),
9401                                      little, !is_unsigned);
9402     }
9403 }
9404 
9405 /* CIntToPy */
__Pyx_PyInt_From_PmMessage(PmMessage value)9406 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PmMessage(PmMessage value) {
9407     const PmMessage neg_one = (PmMessage) ((PmMessage) 0 - (PmMessage) 1), const_zero = (PmMessage) 0;
9408     const int is_unsigned = neg_one > const_zero;
9409     if (is_unsigned) {
9410         if (sizeof(PmMessage) < sizeof(long)) {
9411             return PyInt_FromLong((long) value);
9412         } else if (sizeof(PmMessage) <= sizeof(unsigned long)) {
9413             return PyLong_FromUnsignedLong((unsigned long) value);
9414 #ifdef HAVE_LONG_LONG
9415         } else if (sizeof(PmMessage) <= sizeof(unsigned PY_LONG_LONG)) {
9416             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
9417 #endif
9418         }
9419     } else {
9420         if (sizeof(PmMessage) <= sizeof(long)) {
9421             return PyInt_FromLong((long) value);
9422 #ifdef HAVE_LONG_LONG
9423         } else if (sizeof(PmMessage) <= sizeof(PY_LONG_LONG)) {
9424             return PyLong_FromLongLong((PY_LONG_LONG) value);
9425 #endif
9426         }
9427     }
9428     {
9429         int one = 1; int little = (int)*(unsigned char *)&one;
9430         unsigned char *bytes = (unsigned char *)&value;
9431         return _PyLong_FromByteArray(bytes, sizeof(PmMessage),
9432                                      little, !is_unsigned);
9433     }
9434 }
9435 
9436 /* CIntToPy */
__Pyx_PyInt_From_PmTimestamp(PmTimestamp value)9437 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_PmTimestamp(PmTimestamp value) {
9438     const PmTimestamp neg_one = (PmTimestamp) ((PmTimestamp) 0 - (PmTimestamp) 1), const_zero = (PmTimestamp) 0;
9439     const int is_unsigned = neg_one > const_zero;
9440     if (is_unsigned) {
9441         if (sizeof(PmTimestamp) < sizeof(long)) {
9442             return PyInt_FromLong((long) value);
9443         } else if (sizeof(PmTimestamp) <= sizeof(unsigned long)) {
9444             return PyLong_FromUnsignedLong((unsigned long) value);
9445 #ifdef HAVE_LONG_LONG
9446         } else if (sizeof(PmTimestamp) <= sizeof(unsigned PY_LONG_LONG)) {
9447             return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
9448 #endif
9449         }
9450     } else {
9451         if (sizeof(PmTimestamp) <= sizeof(long)) {
9452             return PyInt_FromLong((long) value);
9453 #ifdef HAVE_LONG_LONG
9454         } else if (sizeof(PmTimestamp) <= sizeof(PY_LONG_LONG)) {
9455             return PyLong_FromLongLong((PY_LONG_LONG) value);
9456 #endif
9457         }
9458     }
9459     {
9460         int one = 1; int little = (int)*(unsigned char *)&one;
9461         unsigned char *bytes = (unsigned char *)&value;
9462         return _PyLong_FromByteArray(bytes, sizeof(PmTimestamp),
9463                                      little, !is_unsigned);
9464     }
9465 }
9466 
9467 /* CIntFromPy */
__Pyx_PyInt_As_PmDeviceID(PyObject * x)9468 static CYTHON_INLINE PmDeviceID __Pyx_PyInt_As_PmDeviceID(PyObject *x) {
9469     const PmDeviceID neg_one = (PmDeviceID) ((PmDeviceID) 0 - (PmDeviceID) 1), const_zero = (PmDeviceID) 0;
9470     const int is_unsigned = neg_one > const_zero;
9471 #if PY_MAJOR_VERSION < 3
9472     if (likely(PyInt_Check(x))) {
9473         if (sizeof(PmDeviceID) < sizeof(long)) {
9474             __PYX_VERIFY_RETURN_INT(PmDeviceID, long, PyInt_AS_LONG(x))
9475         } else {
9476             long val = PyInt_AS_LONG(x);
9477             if (is_unsigned && unlikely(val < 0)) {
9478                 goto raise_neg_overflow;
9479             }
9480             return (PmDeviceID) val;
9481         }
9482     } else
9483 #endif
9484     if (likely(PyLong_Check(x))) {
9485         if (is_unsigned) {
9486 #if CYTHON_USE_PYLONG_INTERNALS
9487             const digit* digits = ((PyLongObject*)x)->ob_digit;
9488             switch (Py_SIZE(x)) {
9489                 case  0: return (PmDeviceID) 0;
9490                 case  1: __PYX_VERIFY_RETURN_INT(PmDeviceID, digit, digits[0])
9491                 case 2:
9492                     if (8 * sizeof(PmDeviceID) > 1 * PyLong_SHIFT) {
9493                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
9494                             __PYX_VERIFY_RETURN_INT(PmDeviceID, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9495                         } else if (8 * sizeof(PmDeviceID) >= 2 * PyLong_SHIFT) {
9496                             return (PmDeviceID) (((((PmDeviceID)digits[1]) << PyLong_SHIFT) | (PmDeviceID)digits[0]));
9497                         }
9498                     }
9499                     break;
9500                 case 3:
9501                     if (8 * sizeof(PmDeviceID) > 2 * PyLong_SHIFT) {
9502                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
9503                             __PYX_VERIFY_RETURN_INT(PmDeviceID, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9504                         } else if (8 * sizeof(PmDeviceID) >= 3 * PyLong_SHIFT) {
9505                             return (PmDeviceID) (((((((PmDeviceID)digits[2]) << PyLong_SHIFT) | (PmDeviceID)digits[1]) << PyLong_SHIFT) | (PmDeviceID)digits[0]));
9506                         }
9507                     }
9508                     break;
9509                 case 4:
9510                     if (8 * sizeof(PmDeviceID) > 3 * PyLong_SHIFT) {
9511                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
9512                             __PYX_VERIFY_RETURN_INT(PmDeviceID, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9513                         } else if (8 * sizeof(PmDeviceID) >= 4 * PyLong_SHIFT) {
9514                             return (PmDeviceID) (((((((((PmDeviceID)digits[3]) << PyLong_SHIFT) | (PmDeviceID)digits[2]) << PyLong_SHIFT) | (PmDeviceID)digits[1]) << PyLong_SHIFT) | (PmDeviceID)digits[0]));
9515                         }
9516                     }
9517                     break;
9518             }
9519 #endif
9520 #if CYTHON_COMPILING_IN_CPYTHON
9521             if (unlikely(Py_SIZE(x) < 0)) {
9522                 goto raise_neg_overflow;
9523             }
9524 #else
9525             {
9526                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
9527                 if (unlikely(result < 0))
9528                     return (PmDeviceID) -1;
9529                 if (unlikely(result == 1))
9530                     goto raise_neg_overflow;
9531             }
9532 #endif
9533             if (sizeof(PmDeviceID) <= sizeof(unsigned long)) {
9534                 __PYX_VERIFY_RETURN_INT_EXC(PmDeviceID, unsigned long, PyLong_AsUnsignedLong(x))
9535 #ifdef HAVE_LONG_LONG
9536             } else if (sizeof(PmDeviceID) <= sizeof(unsigned PY_LONG_LONG)) {
9537                 __PYX_VERIFY_RETURN_INT_EXC(PmDeviceID, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
9538 #endif
9539             }
9540         } else {
9541 #if CYTHON_USE_PYLONG_INTERNALS
9542             const digit* digits = ((PyLongObject*)x)->ob_digit;
9543             switch (Py_SIZE(x)) {
9544                 case  0: return (PmDeviceID) 0;
9545                 case -1: __PYX_VERIFY_RETURN_INT(PmDeviceID, sdigit, (sdigit) (-(sdigit)digits[0]))
9546                 case  1: __PYX_VERIFY_RETURN_INT(PmDeviceID,  digit, +digits[0])
9547                 case -2:
9548                     if (8 * sizeof(PmDeviceID) - 1 > 1 * PyLong_SHIFT) {
9549                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
9550                             __PYX_VERIFY_RETURN_INT(PmDeviceID, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9551                         } else if (8 * sizeof(PmDeviceID) - 1 > 2 * PyLong_SHIFT) {
9552                             return (PmDeviceID) (((PmDeviceID)-1)*(((((PmDeviceID)digits[1]) << PyLong_SHIFT) | (PmDeviceID)digits[0])));
9553                         }
9554                     }
9555                     break;
9556                 case 2:
9557                     if (8 * sizeof(PmDeviceID) > 1 * PyLong_SHIFT) {
9558                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
9559                             __PYX_VERIFY_RETURN_INT(PmDeviceID, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9560                         } else if (8 * sizeof(PmDeviceID) - 1 > 2 * PyLong_SHIFT) {
9561                             return (PmDeviceID) ((((((PmDeviceID)digits[1]) << PyLong_SHIFT) | (PmDeviceID)digits[0])));
9562                         }
9563                     }
9564                     break;
9565                 case -3:
9566                     if (8 * sizeof(PmDeviceID) - 1 > 2 * PyLong_SHIFT) {
9567                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
9568                             __PYX_VERIFY_RETURN_INT(PmDeviceID, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9569                         } else if (8 * sizeof(PmDeviceID) - 1 > 3 * PyLong_SHIFT) {
9570                             return (PmDeviceID) (((PmDeviceID)-1)*(((((((PmDeviceID)digits[2]) << PyLong_SHIFT) | (PmDeviceID)digits[1]) << PyLong_SHIFT) | (PmDeviceID)digits[0])));
9571                         }
9572                     }
9573                     break;
9574                 case 3:
9575                     if (8 * sizeof(PmDeviceID) > 2 * PyLong_SHIFT) {
9576                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
9577                             __PYX_VERIFY_RETURN_INT(PmDeviceID, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9578                         } else if (8 * sizeof(PmDeviceID) - 1 > 3 * PyLong_SHIFT) {
9579                             return (PmDeviceID) ((((((((PmDeviceID)digits[2]) << PyLong_SHIFT) | (PmDeviceID)digits[1]) << PyLong_SHIFT) | (PmDeviceID)digits[0])));
9580                         }
9581                     }
9582                     break;
9583                 case -4:
9584                     if (8 * sizeof(PmDeviceID) - 1 > 3 * PyLong_SHIFT) {
9585                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
9586                             __PYX_VERIFY_RETURN_INT(PmDeviceID, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9587                         } else if (8 * sizeof(PmDeviceID) - 1 > 4 * PyLong_SHIFT) {
9588                             return (PmDeviceID) (((PmDeviceID)-1)*(((((((((PmDeviceID)digits[3]) << PyLong_SHIFT) | (PmDeviceID)digits[2]) << PyLong_SHIFT) | (PmDeviceID)digits[1]) << PyLong_SHIFT) | (PmDeviceID)digits[0])));
9589                         }
9590                     }
9591                     break;
9592                 case 4:
9593                     if (8 * sizeof(PmDeviceID) > 3 * PyLong_SHIFT) {
9594                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
9595                             __PYX_VERIFY_RETURN_INT(PmDeviceID, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9596                         } else if (8 * sizeof(PmDeviceID) - 1 > 4 * PyLong_SHIFT) {
9597                             return (PmDeviceID) ((((((((((PmDeviceID)digits[3]) << PyLong_SHIFT) | (PmDeviceID)digits[2]) << PyLong_SHIFT) | (PmDeviceID)digits[1]) << PyLong_SHIFT) | (PmDeviceID)digits[0])));
9598                         }
9599                     }
9600                     break;
9601             }
9602 #endif
9603             if (sizeof(PmDeviceID) <= sizeof(long)) {
9604                 __PYX_VERIFY_RETURN_INT_EXC(PmDeviceID, long, PyLong_AsLong(x))
9605 #ifdef HAVE_LONG_LONG
9606             } else if (sizeof(PmDeviceID) <= sizeof(PY_LONG_LONG)) {
9607                 __PYX_VERIFY_RETURN_INT_EXC(PmDeviceID, PY_LONG_LONG, PyLong_AsLongLong(x))
9608 #endif
9609             }
9610         }
9611         {
9612 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
9613             PyErr_SetString(PyExc_RuntimeError,
9614                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
9615 #else
9616             PmDeviceID val;
9617             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
9618  #if PY_MAJOR_VERSION < 3
9619             if (likely(v) && !PyLong_Check(v)) {
9620                 PyObject *tmp = v;
9621                 v = PyNumber_Long(tmp);
9622                 Py_DECREF(tmp);
9623             }
9624  #endif
9625             if (likely(v)) {
9626                 int one = 1; int is_little = (int)*(unsigned char *)&one;
9627                 unsigned char *bytes = (unsigned char *)&val;
9628                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
9629                                               bytes, sizeof(val),
9630                                               is_little, !is_unsigned);
9631                 Py_DECREF(v);
9632                 if (likely(!ret))
9633                     return val;
9634             }
9635 #endif
9636             return (PmDeviceID) -1;
9637         }
9638     } else {
9639         PmDeviceID val;
9640         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
9641         if (!tmp) return (PmDeviceID) -1;
9642         val = __Pyx_PyInt_As_PmDeviceID(tmp);
9643         Py_DECREF(tmp);
9644         return val;
9645     }
9646 raise_overflow:
9647     PyErr_SetString(PyExc_OverflowError,
9648         "value too large to convert to PmDeviceID");
9649     return (PmDeviceID) -1;
9650 raise_neg_overflow:
9651     PyErr_SetString(PyExc_OverflowError,
9652         "can't convert negative value to PmDeviceID");
9653     return (PmDeviceID) -1;
9654 }
9655 
9656 /* CIntFromPy */
__Pyx_PyInt_As_PmError(PyObject * x)9657 static CYTHON_INLINE PmError __Pyx_PyInt_As_PmError(PyObject *x) {
9658     const PmError neg_one = (PmError) ((PmError) 0 - (PmError) 1), const_zero = (PmError) 0;
9659     const int is_unsigned = neg_one > const_zero;
9660 #if PY_MAJOR_VERSION < 3
9661     if (likely(PyInt_Check(x))) {
9662         if (sizeof(PmError) < sizeof(long)) {
9663             __PYX_VERIFY_RETURN_INT(PmError, long, PyInt_AS_LONG(x))
9664         } else {
9665             long val = PyInt_AS_LONG(x);
9666             if (is_unsigned && unlikely(val < 0)) {
9667                 goto raise_neg_overflow;
9668             }
9669             return (PmError) val;
9670         }
9671     } else
9672 #endif
9673     if (likely(PyLong_Check(x))) {
9674         if (is_unsigned) {
9675 #if CYTHON_USE_PYLONG_INTERNALS
9676             const digit* digits = ((PyLongObject*)x)->ob_digit;
9677             switch (Py_SIZE(x)) {
9678                 case  0: return (PmError) 0;
9679                 case  1: __PYX_VERIFY_RETURN_INT(PmError, digit, digits[0])
9680                 case 2:
9681                     if (8 * sizeof(PmError) > 1 * PyLong_SHIFT) {
9682                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
9683                             __PYX_VERIFY_RETURN_INT(PmError, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9684                         } else if (8 * sizeof(PmError) >= 2 * PyLong_SHIFT) {
9685                             return (PmError) (((((PmError)digits[1]) << PyLong_SHIFT) | (PmError)digits[0]));
9686                         }
9687                     }
9688                     break;
9689                 case 3:
9690                     if (8 * sizeof(PmError) > 2 * PyLong_SHIFT) {
9691                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
9692                             __PYX_VERIFY_RETURN_INT(PmError, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9693                         } else if (8 * sizeof(PmError) >= 3 * PyLong_SHIFT) {
9694                             return (PmError) (((((((PmError)digits[2]) << PyLong_SHIFT) | (PmError)digits[1]) << PyLong_SHIFT) | (PmError)digits[0]));
9695                         }
9696                     }
9697                     break;
9698                 case 4:
9699                     if (8 * sizeof(PmError) > 3 * PyLong_SHIFT) {
9700                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
9701                             __PYX_VERIFY_RETURN_INT(PmError, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9702                         } else if (8 * sizeof(PmError) >= 4 * PyLong_SHIFT) {
9703                             return (PmError) (((((((((PmError)digits[3]) << PyLong_SHIFT) | (PmError)digits[2]) << PyLong_SHIFT) | (PmError)digits[1]) << PyLong_SHIFT) | (PmError)digits[0]));
9704                         }
9705                     }
9706                     break;
9707             }
9708 #endif
9709 #if CYTHON_COMPILING_IN_CPYTHON
9710             if (unlikely(Py_SIZE(x) < 0)) {
9711                 goto raise_neg_overflow;
9712             }
9713 #else
9714             {
9715                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
9716                 if (unlikely(result < 0))
9717                     return (PmError) -1;
9718                 if (unlikely(result == 1))
9719                     goto raise_neg_overflow;
9720             }
9721 #endif
9722             if (sizeof(PmError) <= sizeof(unsigned long)) {
9723                 __PYX_VERIFY_RETURN_INT_EXC(PmError, unsigned long, PyLong_AsUnsignedLong(x))
9724 #ifdef HAVE_LONG_LONG
9725             } else if (sizeof(PmError) <= sizeof(unsigned PY_LONG_LONG)) {
9726                 __PYX_VERIFY_RETURN_INT_EXC(PmError, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
9727 #endif
9728             }
9729         } else {
9730 #if CYTHON_USE_PYLONG_INTERNALS
9731             const digit* digits = ((PyLongObject*)x)->ob_digit;
9732             switch (Py_SIZE(x)) {
9733                 case  0: return (PmError) 0;
9734                 case -1: __PYX_VERIFY_RETURN_INT(PmError, sdigit, (sdigit) (-(sdigit)digits[0]))
9735                 case  1: __PYX_VERIFY_RETURN_INT(PmError,  digit, +digits[0])
9736                 case -2:
9737                     if (8 * sizeof(PmError) - 1 > 1 * PyLong_SHIFT) {
9738                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
9739                             __PYX_VERIFY_RETURN_INT(PmError, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9740                         } else if (8 * sizeof(PmError) - 1 > 2 * PyLong_SHIFT) {
9741                             return (PmError) (((PmError)-1)*(((((PmError)digits[1]) << PyLong_SHIFT) | (PmError)digits[0])));
9742                         }
9743                     }
9744                     break;
9745                 case 2:
9746                     if (8 * sizeof(PmError) > 1 * PyLong_SHIFT) {
9747                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
9748                             __PYX_VERIFY_RETURN_INT(PmError, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9749                         } else if (8 * sizeof(PmError) - 1 > 2 * PyLong_SHIFT) {
9750                             return (PmError) ((((((PmError)digits[1]) << PyLong_SHIFT) | (PmError)digits[0])));
9751                         }
9752                     }
9753                     break;
9754                 case -3:
9755                     if (8 * sizeof(PmError) - 1 > 2 * PyLong_SHIFT) {
9756                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
9757                             __PYX_VERIFY_RETURN_INT(PmError, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9758                         } else if (8 * sizeof(PmError) - 1 > 3 * PyLong_SHIFT) {
9759                             return (PmError) (((PmError)-1)*(((((((PmError)digits[2]) << PyLong_SHIFT) | (PmError)digits[1]) << PyLong_SHIFT) | (PmError)digits[0])));
9760                         }
9761                     }
9762                     break;
9763                 case 3:
9764                     if (8 * sizeof(PmError) > 2 * PyLong_SHIFT) {
9765                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
9766                             __PYX_VERIFY_RETURN_INT(PmError, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9767                         } else if (8 * sizeof(PmError) - 1 > 3 * PyLong_SHIFT) {
9768                             return (PmError) ((((((((PmError)digits[2]) << PyLong_SHIFT) | (PmError)digits[1]) << PyLong_SHIFT) | (PmError)digits[0])));
9769                         }
9770                     }
9771                     break;
9772                 case -4:
9773                     if (8 * sizeof(PmError) - 1 > 3 * PyLong_SHIFT) {
9774                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
9775                             __PYX_VERIFY_RETURN_INT(PmError, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9776                         } else if (8 * sizeof(PmError) - 1 > 4 * PyLong_SHIFT) {
9777                             return (PmError) (((PmError)-1)*(((((((((PmError)digits[3]) << PyLong_SHIFT) | (PmError)digits[2]) << PyLong_SHIFT) | (PmError)digits[1]) << PyLong_SHIFT) | (PmError)digits[0])));
9778                         }
9779                     }
9780                     break;
9781                 case 4:
9782                     if (8 * sizeof(PmError) > 3 * PyLong_SHIFT) {
9783                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
9784                             __PYX_VERIFY_RETURN_INT(PmError, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9785                         } else if (8 * sizeof(PmError) - 1 > 4 * PyLong_SHIFT) {
9786                             return (PmError) ((((((((((PmError)digits[3]) << PyLong_SHIFT) | (PmError)digits[2]) << PyLong_SHIFT) | (PmError)digits[1]) << PyLong_SHIFT) | (PmError)digits[0])));
9787                         }
9788                     }
9789                     break;
9790             }
9791 #endif
9792             if (sizeof(PmError) <= sizeof(long)) {
9793                 __PYX_VERIFY_RETURN_INT_EXC(PmError, long, PyLong_AsLong(x))
9794 #ifdef HAVE_LONG_LONG
9795             } else if (sizeof(PmError) <= sizeof(PY_LONG_LONG)) {
9796                 __PYX_VERIFY_RETURN_INT_EXC(PmError, PY_LONG_LONG, PyLong_AsLongLong(x))
9797 #endif
9798             }
9799         }
9800         {
9801 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
9802             PyErr_SetString(PyExc_RuntimeError,
9803                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
9804 #else
9805             PmError val;
9806             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
9807  #if PY_MAJOR_VERSION < 3
9808             if (likely(v) && !PyLong_Check(v)) {
9809                 PyObject *tmp = v;
9810                 v = PyNumber_Long(tmp);
9811                 Py_DECREF(tmp);
9812             }
9813  #endif
9814             if (likely(v)) {
9815                 int one = 1; int is_little = (int)*(unsigned char *)&one;
9816                 unsigned char *bytes = (unsigned char *)&val;
9817                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
9818                                               bytes, sizeof(val),
9819                                               is_little, !is_unsigned);
9820                 Py_DECREF(v);
9821                 if (likely(!ret))
9822                     return val;
9823             }
9824 #endif
9825             return (PmError) -1;
9826         }
9827     } else {
9828         PmError val;
9829         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
9830         if (!tmp) return (PmError) -1;
9831         val = __Pyx_PyInt_As_PmError(tmp);
9832         Py_DECREF(tmp);
9833         return val;
9834     }
9835 raise_overflow:
9836     PyErr_SetString(PyExc_OverflowError,
9837         "value too large to convert to PmError");
9838     return (PmError) -1;
9839 raise_neg_overflow:
9840     PyErr_SetString(PyExc_OverflowError,
9841         "can't convert negative value to PmError");
9842     return (PmError) -1;
9843 }
9844 
9845 /* CIntFromPy */
__Pyx_PyInt_As_int(PyObject * x)9846 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
9847     const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
9848     const int is_unsigned = neg_one > const_zero;
9849 #if PY_MAJOR_VERSION < 3
9850     if (likely(PyInt_Check(x))) {
9851         if (sizeof(int) < sizeof(long)) {
9852             __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
9853         } else {
9854             long val = PyInt_AS_LONG(x);
9855             if (is_unsigned && unlikely(val < 0)) {
9856                 goto raise_neg_overflow;
9857             }
9858             return (int) val;
9859         }
9860     } else
9861 #endif
9862     if (likely(PyLong_Check(x))) {
9863         if (is_unsigned) {
9864 #if CYTHON_USE_PYLONG_INTERNALS
9865             const digit* digits = ((PyLongObject*)x)->ob_digit;
9866             switch (Py_SIZE(x)) {
9867                 case  0: return (int) 0;
9868                 case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
9869                 case 2:
9870                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
9871                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
9872                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9873                         } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
9874                             return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
9875                         }
9876                     }
9877                     break;
9878                 case 3:
9879                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
9880                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
9881                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9882                         } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
9883                             return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
9884                         }
9885                     }
9886                     break;
9887                 case 4:
9888                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
9889                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
9890                             __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])))
9891                         } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
9892                             return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
9893                         }
9894                     }
9895                     break;
9896             }
9897 #endif
9898 #if CYTHON_COMPILING_IN_CPYTHON
9899             if (unlikely(Py_SIZE(x) < 0)) {
9900                 goto raise_neg_overflow;
9901             }
9902 #else
9903             {
9904                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
9905                 if (unlikely(result < 0))
9906                     return (int) -1;
9907                 if (unlikely(result == 1))
9908                     goto raise_neg_overflow;
9909             }
9910 #endif
9911             if (sizeof(int) <= sizeof(unsigned long)) {
9912                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
9913 #ifdef HAVE_LONG_LONG
9914             } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
9915                 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
9916 #endif
9917             }
9918         } else {
9919 #if CYTHON_USE_PYLONG_INTERNALS
9920             const digit* digits = ((PyLongObject*)x)->ob_digit;
9921             switch (Py_SIZE(x)) {
9922                 case  0: return (int) 0;
9923                 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
9924                 case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
9925                 case -2:
9926                     if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
9927                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
9928                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9929                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
9930                             return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
9931                         }
9932                     }
9933                     break;
9934                 case 2:
9935                     if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
9936                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
9937                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9938                         } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
9939                             return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
9940                         }
9941                     }
9942                     break;
9943                 case -3:
9944                     if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
9945                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
9946                             __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9947                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
9948                             return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
9949                         }
9950                     }
9951                     break;
9952                 case 3:
9953                     if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
9954                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
9955                             __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
9956                         } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
9957                             return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
9958                         }
9959                     }
9960                     break;
9961                 case -4:
9962                     if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
9963                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
9964                             __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])))
9965                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
9966                             return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
9967                         }
9968                     }
9969                     break;
9970                 case 4:
9971                     if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
9972                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
9973                             __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])))
9974                         } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
9975                             return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
9976                         }
9977                     }
9978                     break;
9979             }
9980 #endif
9981             if (sizeof(int) <= sizeof(long)) {
9982                 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
9983 #ifdef HAVE_LONG_LONG
9984             } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
9985                 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
9986 #endif
9987             }
9988         }
9989         {
9990 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
9991             PyErr_SetString(PyExc_RuntimeError,
9992                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
9993 #else
9994             int val;
9995             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
9996  #if PY_MAJOR_VERSION < 3
9997             if (likely(v) && !PyLong_Check(v)) {
9998                 PyObject *tmp = v;
9999                 v = PyNumber_Long(tmp);
10000                 Py_DECREF(tmp);
10001             }
10002  #endif
10003             if (likely(v)) {
10004                 int one = 1; int is_little = (int)*(unsigned char *)&one;
10005                 unsigned char *bytes = (unsigned char *)&val;
10006                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
10007                                               bytes, sizeof(val),
10008                                               is_little, !is_unsigned);
10009                 Py_DECREF(v);
10010                 if (likely(!ret))
10011                     return val;
10012             }
10013 #endif
10014             return (int) -1;
10015         }
10016     } else {
10017         int val;
10018         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
10019         if (!tmp) return (int) -1;
10020         val = __Pyx_PyInt_As_int(tmp);
10021         Py_DECREF(tmp);
10022         return val;
10023     }
10024 raise_overflow:
10025     PyErr_SetString(PyExc_OverflowError,
10026         "value too large to convert to int");
10027     return (int) -1;
10028 raise_neg_overflow:
10029     PyErr_SetString(PyExc_OverflowError,
10030         "can't convert negative value to int");
10031     return (int) -1;
10032 }
10033 
10034 /* CIntFromPy */
__Pyx_PyInt_As_long(PyObject * x)10035 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
10036     const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
10037     const int is_unsigned = neg_one > const_zero;
10038 #if PY_MAJOR_VERSION < 3
10039     if (likely(PyInt_Check(x))) {
10040         if (sizeof(long) < sizeof(long)) {
10041             __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
10042         } else {
10043             long val = PyInt_AS_LONG(x);
10044             if (is_unsigned && unlikely(val < 0)) {
10045                 goto raise_neg_overflow;
10046             }
10047             return (long) val;
10048         }
10049     } else
10050 #endif
10051     if (likely(PyLong_Check(x))) {
10052         if (is_unsigned) {
10053 #if CYTHON_USE_PYLONG_INTERNALS
10054             const digit* digits = ((PyLongObject*)x)->ob_digit;
10055             switch (Py_SIZE(x)) {
10056                 case  0: return (long) 0;
10057                 case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
10058                 case 2:
10059                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
10060                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
10061                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10062                         } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
10063                             return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
10064                         }
10065                     }
10066                     break;
10067                 case 3:
10068                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
10069                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
10070                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10071                         } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
10072                             return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
10073                         }
10074                     }
10075                     break;
10076                 case 4:
10077                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
10078                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
10079                             __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])))
10080                         } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
10081                             return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
10082                         }
10083                     }
10084                     break;
10085             }
10086 #endif
10087 #if CYTHON_COMPILING_IN_CPYTHON
10088             if (unlikely(Py_SIZE(x) < 0)) {
10089                 goto raise_neg_overflow;
10090             }
10091 #else
10092             {
10093                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
10094                 if (unlikely(result < 0))
10095                     return (long) -1;
10096                 if (unlikely(result == 1))
10097                     goto raise_neg_overflow;
10098             }
10099 #endif
10100             if (sizeof(long) <= sizeof(unsigned long)) {
10101                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
10102 #ifdef HAVE_LONG_LONG
10103             } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
10104                 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
10105 #endif
10106             }
10107         } else {
10108 #if CYTHON_USE_PYLONG_INTERNALS
10109             const digit* digits = ((PyLongObject*)x)->ob_digit;
10110             switch (Py_SIZE(x)) {
10111                 case  0: return (long) 0;
10112                 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
10113                 case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
10114                 case -2:
10115                     if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
10116                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
10117                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10118                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
10119                             return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
10120                         }
10121                     }
10122                     break;
10123                 case 2:
10124                     if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
10125                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
10126                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10127                         } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
10128                             return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
10129                         }
10130                     }
10131                     break;
10132                 case -3:
10133                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
10134                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
10135                             __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10136                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
10137                             return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
10138                         }
10139                     }
10140                     break;
10141                 case 3:
10142                     if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
10143                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
10144                             __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10145                         } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
10146                             return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
10147                         }
10148                     }
10149                     break;
10150                 case -4:
10151                     if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
10152                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
10153                             __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])))
10154                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
10155                             return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
10156                         }
10157                     }
10158                     break;
10159                 case 4:
10160                     if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
10161                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
10162                             __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])))
10163                         } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
10164                             return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
10165                         }
10166                     }
10167                     break;
10168             }
10169 #endif
10170             if (sizeof(long) <= sizeof(long)) {
10171                 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
10172 #ifdef HAVE_LONG_LONG
10173             } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
10174                 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
10175 #endif
10176             }
10177         }
10178         {
10179 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
10180             PyErr_SetString(PyExc_RuntimeError,
10181                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
10182 #else
10183             long val;
10184             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
10185  #if PY_MAJOR_VERSION < 3
10186             if (likely(v) && !PyLong_Check(v)) {
10187                 PyObject *tmp = v;
10188                 v = PyNumber_Long(tmp);
10189                 Py_DECREF(tmp);
10190             }
10191  #endif
10192             if (likely(v)) {
10193                 int one = 1; int is_little = (int)*(unsigned char *)&one;
10194                 unsigned char *bytes = (unsigned char *)&val;
10195                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
10196                                               bytes, sizeof(val),
10197                                               is_little, !is_unsigned);
10198                 Py_DECREF(v);
10199                 if (likely(!ret))
10200                     return val;
10201             }
10202 #endif
10203             return (long) -1;
10204         }
10205     } else {
10206         long val;
10207         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
10208         if (!tmp) return (long) -1;
10209         val = __Pyx_PyInt_As_long(tmp);
10210         Py_DECREF(tmp);
10211         return val;
10212     }
10213 raise_overflow:
10214     PyErr_SetString(PyExc_OverflowError,
10215         "value too large to convert to long");
10216     return (long) -1;
10217 raise_neg_overflow:
10218     PyErr_SetString(PyExc_OverflowError,
10219         "can't convert negative value to long");
10220     return (long) -1;
10221 }
10222 
10223 /* CIntFromPy */
__Pyx_PyInt_As_PmTimestamp(PyObject * x)10224 static CYTHON_INLINE PmTimestamp __Pyx_PyInt_As_PmTimestamp(PyObject *x) {
10225     const PmTimestamp neg_one = (PmTimestamp) ((PmTimestamp) 0 - (PmTimestamp) 1), const_zero = (PmTimestamp) 0;
10226     const int is_unsigned = neg_one > const_zero;
10227 #if PY_MAJOR_VERSION < 3
10228     if (likely(PyInt_Check(x))) {
10229         if (sizeof(PmTimestamp) < sizeof(long)) {
10230             __PYX_VERIFY_RETURN_INT(PmTimestamp, long, PyInt_AS_LONG(x))
10231         } else {
10232             long val = PyInt_AS_LONG(x);
10233             if (is_unsigned && unlikely(val < 0)) {
10234                 goto raise_neg_overflow;
10235             }
10236             return (PmTimestamp) val;
10237         }
10238     } else
10239 #endif
10240     if (likely(PyLong_Check(x))) {
10241         if (is_unsigned) {
10242 #if CYTHON_USE_PYLONG_INTERNALS
10243             const digit* digits = ((PyLongObject*)x)->ob_digit;
10244             switch (Py_SIZE(x)) {
10245                 case  0: return (PmTimestamp) 0;
10246                 case  1: __PYX_VERIFY_RETURN_INT(PmTimestamp, digit, digits[0])
10247                 case 2:
10248                     if (8 * sizeof(PmTimestamp) > 1 * PyLong_SHIFT) {
10249                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
10250                             __PYX_VERIFY_RETURN_INT(PmTimestamp, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10251                         } else if (8 * sizeof(PmTimestamp) >= 2 * PyLong_SHIFT) {
10252                             return (PmTimestamp) (((((PmTimestamp)digits[1]) << PyLong_SHIFT) | (PmTimestamp)digits[0]));
10253                         }
10254                     }
10255                     break;
10256                 case 3:
10257                     if (8 * sizeof(PmTimestamp) > 2 * PyLong_SHIFT) {
10258                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
10259                             __PYX_VERIFY_RETURN_INT(PmTimestamp, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10260                         } else if (8 * sizeof(PmTimestamp) >= 3 * PyLong_SHIFT) {
10261                             return (PmTimestamp) (((((((PmTimestamp)digits[2]) << PyLong_SHIFT) | (PmTimestamp)digits[1]) << PyLong_SHIFT) | (PmTimestamp)digits[0]));
10262                         }
10263                     }
10264                     break;
10265                 case 4:
10266                     if (8 * sizeof(PmTimestamp) > 3 * PyLong_SHIFT) {
10267                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
10268                             __PYX_VERIFY_RETURN_INT(PmTimestamp, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10269                         } else if (8 * sizeof(PmTimestamp) >= 4 * PyLong_SHIFT) {
10270                             return (PmTimestamp) (((((((((PmTimestamp)digits[3]) << PyLong_SHIFT) | (PmTimestamp)digits[2]) << PyLong_SHIFT) | (PmTimestamp)digits[1]) << PyLong_SHIFT) | (PmTimestamp)digits[0]));
10271                         }
10272                     }
10273                     break;
10274             }
10275 #endif
10276 #if CYTHON_COMPILING_IN_CPYTHON
10277             if (unlikely(Py_SIZE(x) < 0)) {
10278                 goto raise_neg_overflow;
10279             }
10280 #else
10281             {
10282                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
10283                 if (unlikely(result < 0))
10284                     return (PmTimestamp) -1;
10285                 if (unlikely(result == 1))
10286                     goto raise_neg_overflow;
10287             }
10288 #endif
10289             if (sizeof(PmTimestamp) <= sizeof(unsigned long)) {
10290                 __PYX_VERIFY_RETURN_INT_EXC(PmTimestamp, unsigned long, PyLong_AsUnsignedLong(x))
10291 #ifdef HAVE_LONG_LONG
10292             } else if (sizeof(PmTimestamp) <= sizeof(unsigned PY_LONG_LONG)) {
10293                 __PYX_VERIFY_RETURN_INT_EXC(PmTimestamp, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
10294 #endif
10295             }
10296         } else {
10297 #if CYTHON_USE_PYLONG_INTERNALS
10298             const digit* digits = ((PyLongObject*)x)->ob_digit;
10299             switch (Py_SIZE(x)) {
10300                 case  0: return (PmTimestamp) 0;
10301                 case -1: __PYX_VERIFY_RETURN_INT(PmTimestamp, sdigit, (sdigit) (-(sdigit)digits[0]))
10302                 case  1: __PYX_VERIFY_RETURN_INT(PmTimestamp,  digit, +digits[0])
10303                 case -2:
10304                     if (8 * sizeof(PmTimestamp) - 1 > 1 * PyLong_SHIFT) {
10305                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
10306                             __PYX_VERIFY_RETURN_INT(PmTimestamp, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10307                         } else if (8 * sizeof(PmTimestamp) - 1 > 2 * PyLong_SHIFT) {
10308                             return (PmTimestamp) (((PmTimestamp)-1)*(((((PmTimestamp)digits[1]) << PyLong_SHIFT) | (PmTimestamp)digits[0])));
10309                         }
10310                     }
10311                     break;
10312                 case 2:
10313                     if (8 * sizeof(PmTimestamp) > 1 * PyLong_SHIFT) {
10314                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
10315                             __PYX_VERIFY_RETURN_INT(PmTimestamp, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10316                         } else if (8 * sizeof(PmTimestamp) - 1 > 2 * PyLong_SHIFT) {
10317                             return (PmTimestamp) ((((((PmTimestamp)digits[1]) << PyLong_SHIFT) | (PmTimestamp)digits[0])));
10318                         }
10319                     }
10320                     break;
10321                 case -3:
10322                     if (8 * sizeof(PmTimestamp) - 1 > 2 * PyLong_SHIFT) {
10323                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
10324                             __PYX_VERIFY_RETURN_INT(PmTimestamp, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10325                         } else if (8 * sizeof(PmTimestamp) - 1 > 3 * PyLong_SHIFT) {
10326                             return (PmTimestamp) (((PmTimestamp)-1)*(((((((PmTimestamp)digits[2]) << PyLong_SHIFT) | (PmTimestamp)digits[1]) << PyLong_SHIFT) | (PmTimestamp)digits[0])));
10327                         }
10328                     }
10329                     break;
10330                 case 3:
10331                     if (8 * sizeof(PmTimestamp) > 2 * PyLong_SHIFT) {
10332                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
10333                             __PYX_VERIFY_RETURN_INT(PmTimestamp, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10334                         } else if (8 * sizeof(PmTimestamp) - 1 > 3 * PyLong_SHIFT) {
10335                             return (PmTimestamp) ((((((((PmTimestamp)digits[2]) << PyLong_SHIFT) | (PmTimestamp)digits[1]) << PyLong_SHIFT) | (PmTimestamp)digits[0])));
10336                         }
10337                     }
10338                     break;
10339                 case -4:
10340                     if (8 * sizeof(PmTimestamp) - 1 > 3 * PyLong_SHIFT) {
10341                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
10342                             __PYX_VERIFY_RETURN_INT(PmTimestamp, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10343                         } else if (8 * sizeof(PmTimestamp) - 1 > 4 * PyLong_SHIFT) {
10344                             return (PmTimestamp) (((PmTimestamp)-1)*(((((((((PmTimestamp)digits[3]) << PyLong_SHIFT) | (PmTimestamp)digits[2]) << PyLong_SHIFT) | (PmTimestamp)digits[1]) << PyLong_SHIFT) | (PmTimestamp)digits[0])));
10345                         }
10346                     }
10347                     break;
10348                 case 4:
10349                     if (8 * sizeof(PmTimestamp) > 3 * PyLong_SHIFT) {
10350                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
10351                             __PYX_VERIFY_RETURN_INT(PmTimestamp, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10352                         } else if (8 * sizeof(PmTimestamp) - 1 > 4 * PyLong_SHIFT) {
10353                             return (PmTimestamp) ((((((((((PmTimestamp)digits[3]) << PyLong_SHIFT) | (PmTimestamp)digits[2]) << PyLong_SHIFT) | (PmTimestamp)digits[1]) << PyLong_SHIFT) | (PmTimestamp)digits[0])));
10354                         }
10355                     }
10356                     break;
10357             }
10358 #endif
10359             if (sizeof(PmTimestamp) <= sizeof(long)) {
10360                 __PYX_VERIFY_RETURN_INT_EXC(PmTimestamp, long, PyLong_AsLong(x))
10361 #ifdef HAVE_LONG_LONG
10362             } else if (sizeof(PmTimestamp) <= sizeof(PY_LONG_LONG)) {
10363                 __PYX_VERIFY_RETURN_INT_EXC(PmTimestamp, PY_LONG_LONG, PyLong_AsLongLong(x))
10364 #endif
10365             }
10366         }
10367         {
10368 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
10369             PyErr_SetString(PyExc_RuntimeError,
10370                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
10371 #else
10372             PmTimestamp val;
10373             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
10374  #if PY_MAJOR_VERSION < 3
10375             if (likely(v) && !PyLong_Check(v)) {
10376                 PyObject *tmp = v;
10377                 v = PyNumber_Long(tmp);
10378                 Py_DECREF(tmp);
10379             }
10380  #endif
10381             if (likely(v)) {
10382                 int one = 1; int is_little = (int)*(unsigned char *)&one;
10383                 unsigned char *bytes = (unsigned char *)&val;
10384                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
10385                                               bytes, sizeof(val),
10386                                               is_little, !is_unsigned);
10387                 Py_DECREF(v);
10388                 if (likely(!ret))
10389                     return val;
10390             }
10391 #endif
10392             return (PmTimestamp) -1;
10393         }
10394     } else {
10395         PmTimestamp val;
10396         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
10397         if (!tmp) return (PmTimestamp) -1;
10398         val = __Pyx_PyInt_As_PmTimestamp(tmp);
10399         Py_DECREF(tmp);
10400         return val;
10401     }
10402 raise_overflow:
10403     PyErr_SetString(PyExc_OverflowError,
10404         "value too large to convert to PmTimestamp");
10405     return (PmTimestamp) -1;
10406 raise_neg_overflow:
10407     PyErr_SetString(PyExc_OverflowError,
10408         "can't convert negative value to PmTimestamp");
10409     return (PmTimestamp) -1;
10410 }
10411 
10412 /* PrintOne */
10413 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3
__Pyx_PrintOne(PyObject * f,PyObject * o)10414 static int __Pyx_PrintOne(PyObject* f, PyObject *o) {
10415     if (!f) {
10416         if (!(f = __Pyx_GetStdout()))
10417             return -1;
10418     }
10419     Py_INCREF(f);
10420     if (PyFile_SoftSpace(f, 0)) {
10421         if (PyFile_WriteString(" ", f) < 0)
10422             goto error;
10423     }
10424     if (PyFile_WriteObject(o, f, Py_PRINT_RAW) < 0)
10425         goto error;
10426     if (PyFile_WriteString("\n", f) < 0)
10427         goto error;
10428     Py_DECREF(f);
10429     return 0;
10430 error:
10431     Py_DECREF(f);
10432     return -1;
10433     /* the line below is just to avoid C compiler
10434      * warnings about unused functions */
10435     return __Pyx_Print(f, NULL, 0);
10436 }
10437 #else
__Pyx_PrintOne(PyObject * stream,PyObject * o)10438 static int __Pyx_PrintOne(PyObject* stream, PyObject *o) {
10439     int res;
10440     PyObject* arg_tuple = PyTuple_Pack(1, o);
10441     if (unlikely(!arg_tuple))
10442         return -1;
10443     res = __Pyx_Print(stream, arg_tuple, 1);
10444     Py_DECREF(arg_tuple);
10445     return res;
10446 }
10447 #endif
10448 
10449 /* CIntFromPy */
__Pyx_PyInt_As_PmMessage(PyObject * x)10450 static CYTHON_INLINE PmMessage __Pyx_PyInt_As_PmMessage(PyObject *x) {
10451     const PmMessage neg_one = (PmMessage) ((PmMessage) 0 - (PmMessage) 1), const_zero = (PmMessage) 0;
10452     const int is_unsigned = neg_one > const_zero;
10453 #if PY_MAJOR_VERSION < 3
10454     if (likely(PyInt_Check(x))) {
10455         if (sizeof(PmMessage) < sizeof(long)) {
10456             __PYX_VERIFY_RETURN_INT(PmMessage, long, PyInt_AS_LONG(x))
10457         } else {
10458             long val = PyInt_AS_LONG(x);
10459             if (is_unsigned && unlikely(val < 0)) {
10460                 goto raise_neg_overflow;
10461             }
10462             return (PmMessage) val;
10463         }
10464     } else
10465 #endif
10466     if (likely(PyLong_Check(x))) {
10467         if (is_unsigned) {
10468 #if CYTHON_USE_PYLONG_INTERNALS
10469             const digit* digits = ((PyLongObject*)x)->ob_digit;
10470             switch (Py_SIZE(x)) {
10471                 case  0: return (PmMessage) 0;
10472                 case  1: __PYX_VERIFY_RETURN_INT(PmMessage, digit, digits[0])
10473                 case 2:
10474                     if (8 * sizeof(PmMessage) > 1 * PyLong_SHIFT) {
10475                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
10476                             __PYX_VERIFY_RETURN_INT(PmMessage, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10477                         } else if (8 * sizeof(PmMessage) >= 2 * PyLong_SHIFT) {
10478                             return (PmMessage) (((((PmMessage)digits[1]) << PyLong_SHIFT) | (PmMessage)digits[0]));
10479                         }
10480                     }
10481                     break;
10482                 case 3:
10483                     if (8 * sizeof(PmMessage) > 2 * PyLong_SHIFT) {
10484                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
10485                             __PYX_VERIFY_RETURN_INT(PmMessage, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10486                         } else if (8 * sizeof(PmMessage) >= 3 * PyLong_SHIFT) {
10487                             return (PmMessage) (((((((PmMessage)digits[2]) << PyLong_SHIFT) | (PmMessage)digits[1]) << PyLong_SHIFT) | (PmMessage)digits[0]));
10488                         }
10489                     }
10490                     break;
10491                 case 4:
10492                     if (8 * sizeof(PmMessage) > 3 * PyLong_SHIFT) {
10493                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
10494                             __PYX_VERIFY_RETURN_INT(PmMessage, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10495                         } else if (8 * sizeof(PmMessage) >= 4 * PyLong_SHIFT) {
10496                             return (PmMessage) (((((((((PmMessage)digits[3]) << PyLong_SHIFT) | (PmMessage)digits[2]) << PyLong_SHIFT) | (PmMessage)digits[1]) << PyLong_SHIFT) | (PmMessage)digits[0]));
10497                         }
10498                     }
10499                     break;
10500             }
10501 #endif
10502 #if CYTHON_COMPILING_IN_CPYTHON
10503             if (unlikely(Py_SIZE(x) < 0)) {
10504                 goto raise_neg_overflow;
10505             }
10506 #else
10507             {
10508                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
10509                 if (unlikely(result < 0))
10510                     return (PmMessage) -1;
10511                 if (unlikely(result == 1))
10512                     goto raise_neg_overflow;
10513             }
10514 #endif
10515             if (sizeof(PmMessage) <= sizeof(unsigned long)) {
10516                 __PYX_VERIFY_RETURN_INT_EXC(PmMessage, unsigned long, PyLong_AsUnsignedLong(x))
10517 #ifdef HAVE_LONG_LONG
10518             } else if (sizeof(PmMessage) <= sizeof(unsigned PY_LONG_LONG)) {
10519                 __PYX_VERIFY_RETURN_INT_EXC(PmMessage, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
10520 #endif
10521             }
10522         } else {
10523 #if CYTHON_USE_PYLONG_INTERNALS
10524             const digit* digits = ((PyLongObject*)x)->ob_digit;
10525             switch (Py_SIZE(x)) {
10526                 case  0: return (PmMessage) 0;
10527                 case -1: __PYX_VERIFY_RETURN_INT(PmMessage, sdigit, (sdigit) (-(sdigit)digits[0]))
10528                 case  1: __PYX_VERIFY_RETURN_INT(PmMessage,  digit, +digits[0])
10529                 case -2:
10530                     if (8 * sizeof(PmMessage) - 1 > 1 * PyLong_SHIFT) {
10531                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
10532                             __PYX_VERIFY_RETURN_INT(PmMessage, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10533                         } else if (8 * sizeof(PmMessage) - 1 > 2 * PyLong_SHIFT) {
10534                             return (PmMessage) (((PmMessage)-1)*(((((PmMessage)digits[1]) << PyLong_SHIFT) | (PmMessage)digits[0])));
10535                         }
10536                     }
10537                     break;
10538                 case 2:
10539                     if (8 * sizeof(PmMessage) > 1 * PyLong_SHIFT) {
10540                         if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
10541                             __PYX_VERIFY_RETURN_INT(PmMessage, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10542                         } else if (8 * sizeof(PmMessage) - 1 > 2 * PyLong_SHIFT) {
10543                             return (PmMessage) ((((((PmMessage)digits[1]) << PyLong_SHIFT) | (PmMessage)digits[0])));
10544                         }
10545                     }
10546                     break;
10547                 case -3:
10548                     if (8 * sizeof(PmMessage) - 1 > 2 * PyLong_SHIFT) {
10549                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
10550                             __PYX_VERIFY_RETURN_INT(PmMessage, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10551                         } else if (8 * sizeof(PmMessage) - 1 > 3 * PyLong_SHIFT) {
10552                             return (PmMessage) (((PmMessage)-1)*(((((((PmMessage)digits[2]) << PyLong_SHIFT) | (PmMessage)digits[1]) << PyLong_SHIFT) | (PmMessage)digits[0])));
10553                         }
10554                     }
10555                     break;
10556                 case 3:
10557                     if (8 * sizeof(PmMessage) > 2 * PyLong_SHIFT) {
10558                         if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
10559                             __PYX_VERIFY_RETURN_INT(PmMessage, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10560                         } else if (8 * sizeof(PmMessage) - 1 > 3 * PyLong_SHIFT) {
10561                             return (PmMessage) ((((((((PmMessage)digits[2]) << PyLong_SHIFT) | (PmMessage)digits[1]) << PyLong_SHIFT) | (PmMessage)digits[0])));
10562                         }
10563                     }
10564                     break;
10565                 case -4:
10566                     if (8 * sizeof(PmMessage) - 1 > 3 * PyLong_SHIFT) {
10567                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
10568                             __PYX_VERIFY_RETURN_INT(PmMessage, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10569                         } else if (8 * sizeof(PmMessage) - 1 > 4 * PyLong_SHIFT) {
10570                             return (PmMessage) (((PmMessage)-1)*(((((((((PmMessage)digits[3]) << PyLong_SHIFT) | (PmMessage)digits[2]) << PyLong_SHIFT) | (PmMessage)digits[1]) << PyLong_SHIFT) | (PmMessage)digits[0])));
10571                         }
10572                     }
10573                     break;
10574                 case 4:
10575                     if (8 * sizeof(PmMessage) > 3 * PyLong_SHIFT) {
10576                         if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
10577                             __PYX_VERIFY_RETURN_INT(PmMessage, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
10578                         } else if (8 * sizeof(PmMessage) - 1 > 4 * PyLong_SHIFT) {
10579                             return (PmMessage) ((((((((((PmMessage)digits[3]) << PyLong_SHIFT) | (PmMessage)digits[2]) << PyLong_SHIFT) | (PmMessage)digits[1]) << PyLong_SHIFT) | (PmMessage)digits[0])));
10580                         }
10581                     }
10582                     break;
10583             }
10584 #endif
10585             if (sizeof(PmMessage) <= sizeof(long)) {
10586                 __PYX_VERIFY_RETURN_INT_EXC(PmMessage, long, PyLong_AsLong(x))
10587 #ifdef HAVE_LONG_LONG
10588             } else if (sizeof(PmMessage) <= sizeof(PY_LONG_LONG)) {
10589                 __PYX_VERIFY_RETURN_INT_EXC(PmMessage, PY_LONG_LONG, PyLong_AsLongLong(x))
10590 #endif
10591             }
10592         }
10593         {
10594 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
10595             PyErr_SetString(PyExc_RuntimeError,
10596                             "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
10597 #else
10598             PmMessage val;
10599             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
10600  #if PY_MAJOR_VERSION < 3
10601             if (likely(v) && !PyLong_Check(v)) {
10602                 PyObject *tmp = v;
10603                 v = PyNumber_Long(tmp);
10604                 Py_DECREF(tmp);
10605             }
10606  #endif
10607             if (likely(v)) {
10608                 int one = 1; int is_little = (int)*(unsigned char *)&one;
10609                 unsigned char *bytes = (unsigned char *)&val;
10610                 int ret = _PyLong_AsByteArray((PyLongObject *)v,
10611                                               bytes, sizeof(val),
10612                                               is_little, !is_unsigned);
10613                 Py_DECREF(v);
10614                 if (likely(!ret))
10615                     return val;
10616             }
10617 #endif
10618             return (PmMessage) -1;
10619         }
10620     } else {
10621         PmMessage val;
10622         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
10623         if (!tmp) return (PmMessage) -1;
10624         val = __Pyx_PyInt_As_PmMessage(tmp);
10625         Py_DECREF(tmp);
10626         return val;
10627     }
10628 raise_overflow:
10629     PyErr_SetString(PyExc_OverflowError,
10630         "value too large to convert to PmMessage");
10631     return (PmMessage) -1;
10632 raise_neg_overflow:
10633     PyErr_SetString(PyExc_OverflowError,
10634         "can't convert negative value to PmMessage");
10635     return (PmMessage) -1;
10636 }
10637 
10638 /* FastTypeChecks */
10639 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_InBases(PyTypeObject * a,PyTypeObject * b)10640 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
10641     while (a) {
10642         a = a->tp_base;
10643         if (a == b)
10644             return 1;
10645     }
10646     return b == &PyBaseObject_Type;
10647 }
__Pyx_IsSubtype(PyTypeObject * a,PyTypeObject * b)10648 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
10649     PyObject *mro;
10650     if (a == b) return 1;
10651     mro = a->tp_mro;
10652     if (likely(mro)) {
10653         Py_ssize_t i, n;
10654         n = PyTuple_GET_SIZE(mro);
10655         for (i = 0; i < n; i++) {
10656             if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
10657                 return 1;
10658         }
10659         return 0;
10660     }
10661     return __Pyx_InBases(a, b);
10662 }
10663 #if PY_MAJOR_VERSION == 2
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)10664 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
10665     PyObject *exception, *value, *tb;
10666     int res;
10667     __Pyx_PyThreadState_declare
10668     __Pyx_PyThreadState_assign
10669     __Pyx_ErrFetch(&exception, &value, &tb);
10670     res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
10671     if (unlikely(res == -1)) {
10672         PyErr_WriteUnraisable(err);
10673         res = 0;
10674     }
10675     if (!res) {
10676         res = PyObject_IsSubclass(err, exc_type2);
10677         if (unlikely(res == -1)) {
10678             PyErr_WriteUnraisable(err);
10679             res = 0;
10680         }
10681     }
10682     __Pyx_ErrRestore(exception, value, tb);
10683     return res;
10684 }
10685 #else
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)10686 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
10687     int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
10688     if (!res) {
10689         res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
10690     }
10691     return res;
10692 }
10693 #endif
__Pyx_PyErr_GivenExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)10694 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
10695     Py_ssize_t i, n;
10696     assert(PyExceptionClass_Check(exc_type));
10697     n = PyTuple_GET_SIZE(tuple);
10698 #if PY_MAJOR_VERSION >= 3
10699     for (i=0; i<n; i++) {
10700         if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
10701     }
10702 #endif
10703     for (i=0; i<n; i++) {
10704         PyObject *t = PyTuple_GET_ITEM(tuple, i);
10705         #if PY_MAJOR_VERSION < 3
10706         if (likely(exc_type == t)) return 1;
10707         #endif
10708         if (likely(PyExceptionClass_Check(t))) {
10709             if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
10710         } else {
10711         }
10712     }
10713     return 0;
10714 }
__Pyx_PyErr_GivenExceptionMatches(PyObject * err,PyObject * exc_type)10715 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
10716     if (likely(err == exc_type)) return 1;
10717     if (likely(PyExceptionClass_Check(err))) {
10718         if (likely(PyExceptionClass_Check(exc_type))) {
10719             return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
10720         } else if (likely(PyTuple_Check(exc_type))) {
10721             return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
10722         } else {
10723         }
10724     }
10725     return PyErr_GivenExceptionMatches(err, exc_type);
10726 }
__Pyx_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)10727 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
10728     assert(PyExceptionClass_Check(exc_type1));
10729     assert(PyExceptionClass_Check(exc_type2));
10730     if (likely(err == exc_type1 || err == exc_type2)) return 1;
10731     if (likely(PyExceptionClass_Check(err))) {
10732         return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
10733     }
10734     return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
10735 }
10736 #endif
10737 
10738 /* CheckBinaryVersion */
__Pyx_check_binary_version(void)10739 static int __Pyx_check_binary_version(void) {
10740     char ctversion[4], rtversion[4];
10741     PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
10742     PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
10743     if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
10744         char message[200];
10745         PyOS_snprintf(message, sizeof(message),
10746                       "compiletime version %s of module '%.100s' "
10747                       "does not match runtime version %s",
10748                       ctversion, __Pyx_MODULE_NAME, rtversion);
10749         return PyErr_WarnEx(NULL, message, 1);
10750     }
10751     return 0;
10752 }
10753 
10754 /* InitStrings */
__Pyx_InitStrings(__Pyx_StringTabEntry * t)10755 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
10756     while (t->p) {
10757         #if PY_MAJOR_VERSION < 3
10758         if (t->is_unicode) {
10759             *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
10760         } else if (t->intern) {
10761             *t->p = PyString_InternFromString(t->s);
10762         } else {
10763             *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
10764         }
10765         #else
10766         if (t->is_unicode | t->is_str) {
10767             if (t->intern) {
10768                 *t->p = PyUnicode_InternFromString(t->s);
10769             } else if (t->encoding) {
10770                 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
10771             } else {
10772                 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
10773             }
10774         } else {
10775             *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
10776         }
10777         #endif
10778         if (!*t->p)
10779             return -1;
10780         if (PyObject_Hash(*t->p) == -1)
10781             return -1;
10782         ++t;
10783     }
10784     return 0;
10785 }
10786 
__Pyx_PyUnicode_FromString(const char * c_str)10787 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
10788     return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
10789 }
__Pyx_PyObject_AsString(PyObject * o)10790 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
10791     Py_ssize_t ignore;
10792     return __Pyx_PyObject_AsStringAndSize(o, &ignore);
10793 }
10794 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
10795 #if !CYTHON_PEP393_ENABLED
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)10796 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
10797     char* defenc_c;
10798     PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
10799     if (!defenc) return NULL;
10800     defenc_c = PyBytes_AS_STRING(defenc);
10801 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
10802     {
10803         char* end = defenc_c + PyBytes_GET_SIZE(defenc);
10804         char* c;
10805         for (c = defenc_c; c < end; c++) {
10806             if ((unsigned char) (*c) >= 128) {
10807                 PyUnicode_AsASCIIString(o);
10808                 return NULL;
10809             }
10810         }
10811     }
10812 #endif
10813     *length = PyBytes_GET_SIZE(defenc);
10814     return defenc_c;
10815 }
10816 #else
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)10817 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
10818     if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
10819 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
10820     if (likely(PyUnicode_IS_ASCII(o))) {
10821         *length = PyUnicode_GET_LENGTH(o);
10822         return PyUnicode_AsUTF8(o);
10823     } else {
10824         PyUnicode_AsASCIIString(o);
10825         return NULL;
10826     }
10827 #else
10828     return PyUnicode_AsUTF8AndSize(o, length);
10829 #endif
10830 }
10831 #endif
10832 #endif
__Pyx_PyObject_AsStringAndSize(PyObject * o,Py_ssize_t * length)10833 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
10834 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
10835     if (
10836 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
10837             __Pyx_sys_getdefaultencoding_not_ascii &&
10838 #endif
10839             PyUnicode_Check(o)) {
10840         return __Pyx_PyUnicode_AsStringAndSize(o, length);
10841     } else
10842 #endif
10843 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
10844     if (PyByteArray_Check(o)) {
10845         *length = PyByteArray_GET_SIZE(o);
10846         return PyByteArray_AS_STRING(o);
10847     } else
10848 #endif
10849     {
10850         char* result;
10851         int r = PyBytes_AsStringAndSize(o, &result, length);
10852         if (unlikely(r < 0)) {
10853             return NULL;
10854         } else {
10855             return result;
10856         }
10857     }
10858 }
__Pyx_PyObject_IsTrue(PyObject * x)10859 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
10860    int is_true = x == Py_True;
10861    if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
10862    else return PyObject_IsTrue(x);
10863 }
__Pyx_PyObject_IsTrueAndDecref(PyObject * x)10864 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
10865     int retval;
10866     if (unlikely(!x)) return -1;
10867     retval = __Pyx_PyObject_IsTrue(x);
10868     Py_DECREF(x);
10869     return retval;
10870 }
__Pyx_PyNumber_IntOrLongWrongResultType(PyObject * result,const char * type_name)10871 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
10872 #if PY_MAJOR_VERSION >= 3
10873     if (PyLong_Check(result)) {
10874         if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
10875                 "__int__ returned non-int (type %.200s).  "
10876                 "The ability to return an instance of a strict subclass of int "
10877                 "is deprecated, and may be removed in a future version of Python.",
10878                 Py_TYPE(result)->tp_name)) {
10879             Py_DECREF(result);
10880             return NULL;
10881         }
10882         return result;
10883     }
10884 #endif
10885     PyErr_Format(PyExc_TypeError,
10886                  "__%.4s__ returned non-%.4s (type %.200s)",
10887                  type_name, type_name, Py_TYPE(result)->tp_name);
10888     Py_DECREF(result);
10889     return NULL;
10890 }
__Pyx_PyNumber_IntOrLong(PyObject * x)10891 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
10892 #if CYTHON_USE_TYPE_SLOTS
10893   PyNumberMethods *m;
10894 #endif
10895   const char *name = NULL;
10896   PyObject *res = NULL;
10897 #if PY_MAJOR_VERSION < 3
10898   if (likely(PyInt_Check(x) || PyLong_Check(x)))
10899 #else
10900   if (likely(PyLong_Check(x)))
10901 #endif
10902     return __Pyx_NewRef(x);
10903 #if CYTHON_USE_TYPE_SLOTS
10904   m = Py_TYPE(x)->tp_as_number;
10905   #if PY_MAJOR_VERSION < 3
10906   if (m && m->nb_int) {
10907     name = "int";
10908     res = m->nb_int(x);
10909   }
10910   else if (m && m->nb_long) {
10911     name = "long";
10912     res = m->nb_long(x);
10913   }
10914   #else
10915   if (likely(m && m->nb_int)) {
10916     name = "int";
10917     res = m->nb_int(x);
10918   }
10919   #endif
10920 #else
10921   if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
10922     res = PyNumber_Int(x);
10923   }
10924 #endif
10925   if (likely(res)) {
10926 #if PY_MAJOR_VERSION < 3
10927     if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
10928 #else
10929     if (unlikely(!PyLong_CheckExact(res))) {
10930 #endif
10931         return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
10932     }
10933   }
10934   else if (!PyErr_Occurred()) {
10935     PyErr_SetString(PyExc_TypeError,
10936                     "an integer is required");
10937   }
10938   return res;
10939 }
10940 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
10941   Py_ssize_t ival;
10942   PyObject *x;
10943 #if PY_MAJOR_VERSION < 3
10944   if (likely(PyInt_CheckExact(b))) {
10945     if (sizeof(Py_ssize_t) >= sizeof(long))
10946         return PyInt_AS_LONG(b);
10947     else
10948         return PyInt_AsSsize_t(b);
10949   }
10950 #endif
10951   if (likely(PyLong_CheckExact(b))) {
10952     #if CYTHON_USE_PYLONG_INTERNALS
10953     const digit* digits = ((PyLongObject*)b)->ob_digit;
10954     const Py_ssize_t size = Py_SIZE(b);
10955     if (likely(__Pyx_sst_abs(size) <= 1)) {
10956         ival = likely(size) ? digits[0] : 0;
10957         if (size == -1) ival = -ival;
10958         return ival;
10959     } else {
10960       switch (size) {
10961          case 2:
10962            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
10963              return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
10964            }
10965            break;
10966          case -2:
10967            if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
10968              return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
10969            }
10970            break;
10971          case 3:
10972            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
10973              return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
10974            }
10975            break;
10976          case -3:
10977            if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
10978              return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
10979            }
10980            break;
10981          case 4:
10982            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
10983              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]));
10984            }
10985            break;
10986          case -4:
10987            if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
10988              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]));
10989            }
10990            break;
10991       }
10992     }
10993     #endif
10994     return PyLong_AsSsize_t(b);
10995   }
10996   x = PyNumber_Index(b);
10997   if (!x) return -1;
10998   ival = PyInt_AsSsize_t(x);
10999   Py_DECREF(x);
11000   return ival;
11001 }
11002 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
11003   return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
11004 }
11005 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
11006     return PyInt_FromSize_t(ival);
11007 }
11008 
11009 
11010 #endif /* Py_PYTHON_H */
11011