1/* Generated by Cython 0.21.2 */
2
3#define PY_SSIZE_T_CLEAN
4#ifndef CYTHON_USE_PYLONG_INTERNALS
5#ifdef PYLONG_BITS_IN_DIGIT
6#define CYTHON_USE_PYLONG_INTERNALS 0
7#else
8#include "pyconfig.h"
9#ifdef PYLONG_BITS_IN_DIGIT
10#define CYTHON_USE_PYLONG_INTERNALS 1
11#else
12#define CYTHON_USE_PYLONG_INTERNALS 0
13#endif
14#endif
15#endif
16#include "Python.h"
17#ifndef Py_PYTHON_H
18    #error Python headers needed to compile C extensions, please install development version of Python.
19#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000)
20    #error Cython requires Python 2.6+ or Python 3.2+.
21#else
22#define CYTHON_ABI "0_21_2"
23#include <stddef.h>
24#ifndef offsetof
25#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
26#endif
27#if !defined(WIN32) && !defined(MS_WINDOWS)
28  #ifndef __stdcall
29    #define __stdcall
30  #endif
31  #ifndef __cdecl
32    #define __cdecl
33  #endif
34  #ifndef __fastcall
35    #define __fastcall
36  #endif
37#endif
38#ifndef DL_IMPORT
39  #define DL_IMPORT(t) t
40#endif
41#ifndef DL_EXPORT
42  #define DL_EXPORT(t) t
43#endif
44#ifndef PY_LONG_LONG
45  #define PY_LONG_LONG LONG_LONG
46#endif
47#ifndef Py_HUGE_VAL
48  #define Py_HUGE_VAL HUGE_VAL
49#endif
50#ifdef PYPY_VERSION
51#define CYTHON_COMPILING_IN_PYPY 1
52#define CYTHON_COMPILING_IN_CPYTHON 0
53#else
54#define CYTHON_COMPILING_IN_PYPY 0
55#define CYTHON_COMPILING_IN_CPYTHON 1
56#endif
57#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600
58#define Py_OptimizeFlag 0
59#endif
60#define __PYX_BUILD_PY_SSIZE_T "n"
61#define CYTHON_FORMAT_SSIZE_T "z"
62#if PY_MAJOR_VERSION < 3
63  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
64  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
65          PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
66  #define __Pyx_DefaultClassType PyClass_Type
67#else
68  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
69  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
70          PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
71  #define __Pyx_DefaultClassType PyType_Type
72#endif
73#if PY_MAJOR_VERSION >= 3
74  #define Py_TPFLAGS_CHECKTYPES 0
75  #define Py_TPFLAGS_HAVE_INDEX 0
76  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
77#endif
78#if PY_VERSION_HEX < 0x030400a1 && !defined(Py_TPFLAGS_HAVE_FINALIZE)
79  #define Py_TPFLAGS_HAVE_FINALIZE 0
80#endif
81#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
82  #define CYTHON_PEP393_ENABLED 1
83  #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ? \
84                                              0 : _PyUnicode_Ready((PyObject *)(op)))
85  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
86  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
87  #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
88  #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
89  #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
90#else
91  #define CYTHON_PEP393_ENABLED 0
92  #define __Pyx_PyUnicode_READY(op)       (0)
93  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
94  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
95  #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
96  #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
97  #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
98#endif
99#if CYTHON_COMPILING_IN_PYPY
100  #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
101  #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
102  #define __Pyx_PyFrozenSet_Size(s)         PyObject_Size(s)
103#else
104  #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
105  #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ? \
106      PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
107  #define __Pyx_PyFrozenSet_Size(s)         PySet_Size(s)
108#endif
109#define __Pyx_PyString_FormatSafe(a, b)   ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
110#define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
111#if PY_MAJOR_VERSION >= 3
112  #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
113#else
114  #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
115#endif
116#if PY_MAJOR_VERSION >= 3
117  #define PyBaseString_Type            PyUnicode_Type
118  #define PyStringObject               PyUnicodeObject
119  #define PyString_Type                PyUnicode_Type
120  #define PyString_Check               PyUnicode_Check
121  #define PyString_CheckExact          PyUnicode_CheckExact
122#endif
123#if PY_MAJOR_VERSION >= 3
124  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
125  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
126#else
127  #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
128  #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
129#endif
130#ifndef PySet_CheckExact
131  #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
132#endif
133#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
134#if PY_MAJOR_VERSION >= 3
135  #define PyIntObject                  PyLongObject
136  #define PyInt_Type                   PyLong_Type
137  #define PyInt_Check(op)              PyLong_Check(op)
138  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
139  #define PyInt_FromString             PyLong_FromString
140  #define PyInt_FromUnicode            PyLong_FromUnicode
141  #define PyInt_FromLong               PyLong_FromLong
142  #define PyInt_FromSize_t             PyLong_FromSize_t
143  #define PyInt_FromSsize_t            PyLong_FromSsize_t
144  #define PyInt_AsLong                 PyLong_AsLong
145  #define PyInt_AS_LONG                PyLong_AS_LONG
146  #define PyInt_AsSsize_t              PyLong_AsSsize_t
147  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
148  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
149  #define PyNumber_Int                 PyNumber_Long
150#endif
151#if PY_MAJOR_VERSION >= 3
152  #define PyBoolObject                 PyLongObject
153#endif
154#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
155  #ifndef PyUnicode_InternFromString
156    #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
157  #endif
158#endif
159#if PY_VERSION_HEX < 0x030200A4
160  typedef long Py_hash_t;
161  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
162  #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
163#else
164  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
165  #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
166#endif
167#if PY_MAJOR_VERSION >= 3
168  #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
169#else
170  #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
171#endif
172#ifndef CYTHON_INLINE
173  #if defined(__GNUC__)
174    #define CYTHON_INLINE __inline__
175  #elif defined(_MSC_VER)
176    #define CYTHON_INLINE __inline
177  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
178    #define CYTHON_INLINE inline
179  #else
180    #define CYTHON_INLINE
181  #endif
182#endif
183#ifndef CYTHON_RESTRICT
184  #if defined(__GNUC__)
185    #define CYTHON_RESTRICT __restrict__
186  #elif defined(_MSC_VER) && _MSC_VER >= 1400
187    #define CYTHON_RESTRICT __restrict
188  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
189    #define CYTHON_RESTRICT restrict
190  #else
191    #define CYTHON_RESTRICT
192  #endif
193#endif
194#ifdef NAN
195#define __PYX_NAN() ((float) NAN)
196#else
197static CYTHON_INLINE float __PYX_NAN() {
198  /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and
199   a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is
200   a quiet NaN. */
201  float value;
202  memset(&value, 0xFF, sizeof(value));
203  return value;
204}
205#endif
206#ifdef __cplusplus
207template<typename T>
208void __Pyx_call_destructor(T* x) {
209    x->~T();
210}
211#endif
212
213
214#if PY_MAJOR_VERSION >= 3
215  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
216  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
217#else
218  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
219  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
220#endif
221
222#ifndef __PYX_EXTERN_C
223  #ifdef __cplusplus
224    #define __PYX_EXTERN_C extern "C"
225  #else
226    #define __PYX_EXTERN_C extern
227  #endif
228#endif
229
230#if defined(WIN32) || defined(MS_WINDOWS)
231#define _USE_MATH_DEFINES
232#endif
233#include <math.h>
234#define __PYX_HAVE__zmq__backend__cython__error
235#define __PYX_HAVE_API__zmq__backend__cython__error
236#include "zmq_compat.h"
237#include "zmq.h"
238#include "zmq_utils.h"
239#ifdef _OPENMP
240#include <omp.h>
241#endif /* _OPENMP */
242
243#ifdef PYREX_WITHOUT_ASSERTIONS
244#define CYTHON_WITHOUT_ASSERTIONS
245#endif
246
247#ifndef CYTHON_UNUSED
248# if defined(__GNUC__)
249#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
250#     define CYTHON_UNUSED __attribute__ ((__unused__))
251#   else
252#     define CYTHON_UNUSED
253#   endif
254# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
255#   define CYTHON_UNUSED __attribute__ ((__unused__))
256# else
257#   define CYTHON_UNUSED
258# endif
259#endif
260typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding;
261                const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
262
263#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
264#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
265#define __PYX_DEFAULT_STRING_ENCODING ""
266#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
267#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
268#define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (    \
269    (sizeof(type) < sizeof(Py_ssize_t))  ||             \
270    (sizeof(type) > sizeof(Py_ssize_t) &&               \
271          likely(v < (type)PY_SSIZE_T_MAX ||            \
272                 v == (type)PY_SSIZE_T_MAX)  &&         \
273          (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||       \
274                                v == (type)PY_SSIZE_T_MIN)))  ||  \
275    (sizeof(type) == sizeof(Py_ssize_t) &&              \
276          (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||        \
277                               v == (type)PY_SSIZE_T_MAX)))  )
278static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
279static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
280#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
281#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
282#define __Pyx_PyBytes_FromString        PyBytes_FromString
283#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
284static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
285#if PY_MAJOR_VERSION < 3
286    #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
287    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
288#else
289    #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
290    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
291#endif
292#define __Pyx_PyObject_AsSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
293#define __Pyx_PyObject_AsUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
294#define __Pyx_PyObject_FromUString(s)  __Pyx_PyObject_FromString((const char*)s)
295#define __Pyx_PyBytes_FromUString(s)   __Pyx_PyBytes_FromString((const char*)s)
296#define __Pyx_PyByteArray_FromUString(s)   __Pyx_PyByteArray_FromString((const char*)s)
297#define __Pyx_PyStr_FromUString(s)     __Pyx_PyStr_FromString((const char*)s)
298#define __Pyx_PyUnicode_FromUString(s) __Pyx_PyUnicode_FromString((const char*)s)
299#if PY_MAJOR_VERSION < 3
300static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
301{
302    const Py_UNICODE *u_end = u;
303    while (*u_end++) ;
304    return (size_t)(u_end - u - 1);
305}
306#else
307#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
308#endif
309#define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
310#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
311#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
312#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
313#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
314static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
315static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
316static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
317static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
318#if CYTHON_COMPILING_IN_CPYTHON
319#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
320#else
321#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
322#endif
323#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
324#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
325static int __Pyx_sys_getdefaultencoding_not_ascii;
326static int __Pyx_init_sys_getdefaultencoding_params(void) {
327    PyObject* sys;
328    PyObject* default_encoding = NULL;
329    PyObject* ascii_chars_u = NULL;
330    PyObject* ascii_chars_b = NULL;
331    const char* default_encoding_c;
332    sys = PyImport_ImportModule("sys");
333    if (!sys) goto bad;
334    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
335    Py_DECREF(sys);
336    if (!default_encoding) goto bad;
337    default_encoding_c = PyBytes_AsString(default_encoding);
338    if (!default_encoding_c) goto bad;
339    if (strcmp(default_encoding_c, "ascii") == 0) {
340        __Pyx_sys_getdefaultencoding_not_ascii = 0;
341    } else {
342        char ascii_chars[128];
343        int c;
344        for (c = 0; c < 128; c++) {
345            ascii_chars[c] = c;
346        }
347        __Pyx_sys_getdefaultencoding_not_ascii = 1;
348        ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
349        if (!ascii_chars_u) goto bad;
350        ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
351        if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
352            PyErr_Format(
353                PyExc_ValueError,
354                "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
355                default_encoding_c);
356            goto bad;
357        }
358        Py_DECREF(ascii_chars_u);
359        Py_DECREF(ascii_chars_b);
360    }
361    Py_DECREF(default_encoding);
362    return 0;
363bad:
364    Py_XDECREF(default_encoding);
365    Py_XDECREF(ascii_chars_u);
366    Py_XDECREF(ascii_chars_b);
367    return -1;
368}
369#endif
370#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
371#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
372#else
373#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
374#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
375static char* __PYX_DEFAULT_STRING_ENCODING;
376static int __Pyx_init_sys_getdefaultencoding_params(void) {
377    PyObject* sys;
378    PyObject* default_encoding = NULL;
379    char* default_encoding_c;
380    sys = PyImport_ImportModule("sys");
381    if (!sys) goto bad;
382    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
383    Py_DECREF(sys);
384    if (!default_encoding) goto bad;
385    default_encoding_c = PyBytes_AsString(default_encoding);
386    if (!default_encoding_c) goto bad;
387    __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
388    if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
389    strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
390    Py_DECREF(default_encoding);
391    return 0;
392bad:
393    Py_XDECREF(default_encoding);
394    return -1;
395}
396#endif
397#endif
398
399
400/* Test for GCC > 2.95 */
401#if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
402  #define likely(x)   __builtin_expect(!!(x), 1)
403  #define unlikely(x) __builtin_expect(!!(x), 0)
404#else /* !__GNUC__ or GCC < 2.95 */
405  #define likely(x)   (x)
406  #define unlikely(x) (x)
407#endif /* __GNUC__ */
408
409static PyObject *__pyx_m;
410static PyObject *__pyx_d;
411static PyObject *__pyx_b;
412static PyObject *__pyx_empty_tuple;
413static PyObject *__pyx_empty_bytes;
414static int __pyx_lineno;
415static int __pyx_clineno = 0;
416static const char * __pyx_cfilenm= __FILE__;
417static const char *__pyx_filename;
418
419
420static const char *__pyx_f[] = {
421  "zmq/backend/cython/error.pyx",
422};
423
424/*--- Type declarations ---*/
425#ifndef CYTHON_REFNANNY
426  #define CYTHON_REFNANNY 0
427#endif
428#if CYTHON_REFNANNY
429  typedef struct {
430    void (*INCREF)(void*, PyObject*, int);
431    void (*DECREF)(void*, PyObject*, int);
432    void (*GOTREF)(void*, PyObject*, int);
433    void (*GIVEREF)(void*, PyObject*, int);
434    void* (*SetupContext)(const char*, int, const char*);
435    void (*FinishContext)(void**);
436  } __Pyx_RefNannyAPIStruct;
437  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
438  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
439  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
440#ifdef WITH_THREAD
441  #define __Pyx_RefNannySetupContext(name, acquire_gil) \
442          if (acquire_gil) { \
443              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \
444              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
445              PyGILState_Release(__pyx_gilstate_save); \
446          } else { \
447              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
448          }
449#else
450  #define __Pyx_RefNannySetupContext(name, acquire_gil) \
451          __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
452#endif
453  #define __Pyx_RefNannyFinishContext() \
454          __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
455  #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
456  #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
457  #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
458  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
459  #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
460  #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
461  #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
462  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
463#else
464  #define __Pyx_RefNannyDeclarations
465  #define __Pyx_RefNannySetupContext(name, acquire_gil)
466  #define __Pyx_RefNannyFinishContext()
467  #define __Pyx_INCREF(r) Py_INCREF(r)
468  #define __Pyx_DECREF(r) Py_DECREF(r)
469  #define __Pyx_GOTREF(r)
470  #define __Pyx_GIVEREF(r)
471  #define __Pyx_XINCREF(r) Py_XINCREF(r)
472  #define __Pyx_XDECREF(r) Py_XDECREF(r)
473  #define __Pyx_XGOTREF(r)
474  #define __Pyx_XGIVEREF(r)
475#endif
476#define __Pyx_XDECREF_SET(r, v) do {                            \
477        PyObject *tmp = (PyObject *) r;                         \
478        r = v; __Pyx_XDECREF(tmp);                              \
479    } while (0)
480#define __Pyx_DECREF_SET(r, v) do {                             \
481        PyObject *tmp = (PyObject *) r;                         \
482        r = v; __Pyx_DECREF(tmp);                               \
483    } while (0)
484#define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
485#define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
486
487#if CYTHON_COMPILING_IN_CPYTHON
488static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
489    PyTypeObject* tp = Py_TYPE(obj);
490    if (likely(tp->tp_getattro))
491        return tp->tp_getattro(obj, attr_name);
492#if PY_MAJOR_VERSION < 3
493    if (likely(tp->tp_getattr))
494        return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
495#endif
496    return PyObject_GetAttr(obj, attr_name);
497}
498#else
499#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
500#endif
501
502static PyObject *__Pyx_GetBuiltinName(PyObject *name);
503
504static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);
505
506#include <string.h>
507
508static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
509         const char* cstring, Py_ssize_t start, Py_ssize_t stop,
510         const char* encoding, const char* errors,
511         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));
512
513static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
514
515typedef struct {
516    int code_line;
517    PyCodeObject* code_object;
518} __Pyx_CodeObjectCacheEntry;
519struct __Pyx_CodeObjectCache {
520    int count;
521    int max_count;
522    __Pyx_CodeObjectCacheEntry* entries;
523};
524static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
525static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
526static PyCodeObject *__pyx_find_code_object(int code_line);
527static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
528
529static void __Pyx_AddTraceback(const char *funcname, int c_line,
530                               int py_line, const char *filename);
531
532static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
533
534static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
535
536static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
537
538static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
539
540static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
541
542static int __Pyx_check_binary_version(void);
543
544static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
545
546
547/* Module declarations from 'zmq.backend.cython.libzmq' */
548
549/* Module declarations from 'zmq.backend.cython.error' */
550#define __Pyx_MODULE_NAME "zmq.backend.cython.error"
551int __pyx_module_is_main_zmq__backend__cython__error = 0;
552
553/* Implementation of 'zmq.backend.cython.error' */
554static PyObject *__pyx_pf_3zmq_7backend_6cython_5error_strerror(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_errno); /* proto */
555static PyObject *__pyx_pf_3zmq_7backend_6cython_5error_2zmq_errno(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
556static char __pyx_k_all[] = "__all__";
557static char __pyx_k_main[] = "__main__";
558static char __pyx_k_test[] = "__test__";
559static char __pyx_k_bytes[] = "bytes";
560static char __pyx_k_errno[] = "errno";
561static char __pyx_k_str_e[] = "str_e";
562static char __pyx_k_import[] = "__import__";
563static char __pyx_k_strerror[] = "strerror";
564static char __pyx_k_zmq_errno[] = "zmq_errno";
565static char __pyx_k_zmq_utils_strtypes[] = "zmq.utils.strtypes";
566static char __pyx_k_zmq_backend_cython_error[] = "zmq.backend.cython.error";
567static char __pyx_k_0MQ_Error_classes_and_functions[] = "0MQ Error classes and functions.";
568static char __pyx_k_private_tmp_pyzmq_release_zmq_b[] = "/private/tmp/pyzmq-release/zmq/backend/cython/error.pyx";
569static PyObject *__pyx_n_s_all;
570static PyObject *__pyx_n_s_bytes;
571static PyObject *__pyx_n_s_errno;
572static PyObject *__pyx_n_s_import;
573static PyObject *__pyx_n_s_main;
574static PyObject *__pyx_kp_s_private_tmp_pyzmq_release_zmq_b;
575static PyObject *__pyx_n_s_str_e;
576static PyObject *__pyx_n_s_strerror;
577static PyObject *__pyx_n_s_test;
578static PyObject *__pyx_n_s_zmq_backend_cython_error;
579static PyObject *__pyx_n_s_zmq_errno;
580static PyObject *__pyx_n_s_zmq_utils_strtypes;
581static PyObject *__pyx_tuple_;
582static PyObject *__pyx_codeobj__2;
583static PyObject *__pyx_codeobj__3;
584
585/* "zmq/backend/cython/error.pyx":34
586 * from zmq.utils.strtypes import bytes
587 *
588 * def strerror(int errno):             # <<<<<<<<<<<<<<
589 *     """strerror(errno)
590 *
591 */
592
593/* Python wrapper */
594static PyObject *__pyx_pw_3zmq_7backend_6cython_5error_1strerror(PyObject *__pyx_self, PyObject *__pyx_arg_errno); /*proto*/
595static char __pyx_doc_3zmq_7backend_6cython_5error_strerror[] = "strerror(errno)\n\n    Return the error string given the error number.\n    ";
596static PyMethodDef __pyx_mdef_3zmq_7backend_6cython_5error_1strerror = {"strerror", (PyCFunction)__pyx_pw_3zmq_7backend_6cython_5error_1strerror, METH_O, __pyx_doc_3zmq_7backend_6cython_5error_strerror};
597static PyObject *__pyx_pw_3zmq_7backend_6cython_5error_1strerror(PyObject *__pyx_self, PyObject *__pyx_arg_errno) {
598  int __pyx_v_errno;
599  int __pyx_lineno = 0;
600  const char *__pyx_filename = NULL;
601  int __pyx_clineno = 0;
602  PyObject *__pyx_r = 0;
603  __Pyx_RefNannyDeclarations
604  __Pyx_RefNannySetupContext("strerror (wrapper)", 0);
605  assert(__pyx_arg_errno); {
606    __pyx_v_errno = __Pyx_PyInt_As_int(__pyx_arg_errno); if (unlikely((__pyx_v_errno == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
607  }
608  goto __pyx_L4_argument_unpacking_done;
609  __pyx_L3_error:;
610  __Pyx_AddTraceback("zmq.backend.cython.error.strerror", __pyx_clineno, __pyx_lineno, __pyx_filename);
611  __Pyx_RefNannyFinishContext();
612  return NULL;
613  __pyx_L4_argument_unpacking_done:;
614  __pyx_r = __pyx_pf_3zmq_7backend_6cython_5error_strerror(__pyx_self, ((int)__pyx_v_errno));
615
616  /* function exit code */
617  __Pyx_RefNannyFinishContext();
618  return __pyx_r;
619}
620
621static PyObject *__pyx_pf_3zmq_7backend_6cython_5error_strerror(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_errno) {
622  const char* __pyx_v_str_e;
623  PyObject *__pyx_r = NULL;
624  __Pyx_RefNannyDeclarations
625  PyObject *__pyx_t_1 = NULL;
626  int __pyx_t_2;
627  int __pyx_t_3;
628  int __pyx_lineno = 0;
629  const char *__pyx_filename = NULL;
630  int __pyx_clineno = 0;
631  __Pyx_RefNannySetupContext("strerror", 0);
632
633  /* "zmq/backend/cython/error.pyx":41
634 *     cdef const_char_ptr str_e
635 *     # char * will be a bytes object:
636 *     str_e = zmq_strerror(errno)             # <<<<<<<<<<<<<<
637 *     if str is bytes:
638 *         # Python 2: str is bytes, so we already have the right type
639 */
640  __pyx_v_str_e = zmq_strerror(__pyx_v_errno);
641
642  /* "zmq/backend/cython/error.pyx":42
643 *     # char * will be a bytes object:
644 *     str_e = zmq_strerror(errno)
645 *     if str is bytes:             # <<<<<<<<<<<<<<
646 *         # Python 2: str is bytes, so we already have the right type
647 *         return str_e
648 */
649  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_bytes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
650  __Pyx_GOTREF(__pyx_t_1);
651  __pyx_t_2 = (((PyObject*)(&PyString_Type)) == ((PyObject*)__pyx_t_1));
652  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
653  __pyx_t_3 = (__pyx_t_2 != 0);
654  if (__pyx_t_3) {
655
656    /* "zmq/backend/cython/error.pyx":44
657 *     if str is bytes:
658 *         # Python 2: str is bytes, so we already have the right type
659 *         return str_e             # <<<<<<<<<<<<<<
660 *     else:
661 *         # Python 3: decode bytes to unicode str
662 */
663    __Pyx_XDECREF(__pyx_r);
664    __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_str_e); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
665    __Pyx_GOTREF(__pyx_t_1);
666    __pyx_r = __pyx_t_1;
667    __pyx_t_1 = 0;
668    goto __pyx_L0;
669  }
670  /*else*/ {
671
672    /* "zmq/backend/cython/error.pyx":47
673 *     else:
674 *         # Python 3: decode bytes to unicode str
675 *         return str_e.decode()             # <<<<<<<<<<<<<<
676 *
677 * def zmq_errno():
678 */
679    __Pyx_XDECREF(__pyx_r);
680    __pyx_t_1 = __Pyx_decode_c_string(__pyx_v_str_e, 0, strlen(__pyx_v_str_e), NULL, NULL, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
681    __Pyx_GOTREF(__pyx_t_1);
682    __pyx_r = __pyx_t_1;
683    __pyx_t_1 = 0;
684    goto __pyx_L0;
685  }
686
687  /* "zmq/backend/cython/error.pyx":34
688 * from zmq.utils.strtypes import bytes
689 *
690 * def strerror(int errno):             # <<<<<<<<<<<<<<
691 *     """strerror(errno)
692 *
693 */
694
695  /* function exit code */
696  __pyx_L1_error:;
697  __Pyx_XDECREF(__pyx_t_1);
698  __Pyx_AddTraceback("zmq.backend.cython.error.strerror", __pyx_clineno, __pyx_lineno, __pyx_filename);
699  __pyx_r = NULL;
700  __pyx_L0:;
701  __Pyx_XGIVEREF(__pyx_r);
702  __Pyx_RefNannyFinishContext();
703  return __pyx_r;
704}
705
706/* "zmq/backend/cython/error.pyx":49
707 *         return str_e.decode()
708 *
709 * def zmq_errno():             # <<<<<<<<<<<<<<
710 *     """zmq_errno()
711 *
712 */
713
714/* Python wrapper */
715static PyObject *__pyx_pw_3zmq_7backend_6cython_5error_3zmq_errno(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
716static char __pyx_doc_3zmq_7backend_6cython_5error_2zmq_errno[] = "zmq_errno()\n    \n    Return the integer errno of the most recent zmq error.\n    ";
717static PyMethodDef __pyx_mdef_3zmq_7backend_6cython_5error_3zmq_errno = {"zmq_errno", (PyCFunction)__pyx_pw_3zmq_7backend_6cython_5error_3zmq_errno, METH_NOARGS, __pyx_doc_3zmq_7backend_6cython_5error_2zmq_errno};
718static PyObject *__pyx_pw_3zmq_7backend_6cython_5error_3zmq_errno(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
719  PyObject *__pyx_r = 0;
720  __Pyx_RefNannyDeclarations
721  __Pyx_RefNannySetupContext("zmq_errno (wrapper)", 0);
722  __pyx_r = __pyx_pf_3zmq_7backend_6cython_5error_2zmq_errno(__pyx_self);
723
724  /* function exit code */
725  __Pyx_RefNannyFinishContext();
726  return __pyx_r;
727}
728
729static PyObject *__pyx_pf_3zmq_7backend_6cython_5error_2zmq_errno(CYTHON_UNUSED PyObject *__pyx_self) {
730  PyObject *__pyx_r = NULL;
731  __Pyx_RefNannyDeclarations
732  PyObject *__pyx_t_1 = NULL;
733  int __pyx_lineno = 0;
734  const char *__pyx_filename = NULL;
735  int __pyx_clineno = 0;
736  __Pyx_RefNannySetupContext("zmq_errno", 0);
737
738  /* "zmq/backend/cython/error.pyx":54
739 *     Return the integer errno of the most recent zmq error.
740 *     """
741 *     return zmq_errno_c()             # <<<<<<<<<<<<<<
742 *
743 * __all__ = ['strerror', 'zmq_errno']
744 */
745  __Pyx_XDECREF(__pyx_r);
746  __pyx_t_1 = __Pyx_PyInt_From_int(zmq_errno()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
747  __Pyx_GOTREF(__pyx_t_1);
748  __pyx_r = __pyx_t_1;
749  __pyx_t_1 = 0;
750  goto __pyx_L0;
751
752  /* "zmq/backend/cython/error.pyx":49
753 *         return str_e.decode()
754 *
755 * def zmq_errno():             # <<<<<<<<<<<<<<
756 *     """zmq_errno()
757 *
758 */
759
760  /* function exit code */
761  __pyx_L1_error:;
762  __Pyx_XDECREF(__pyx_t_1);
763  __Pyx_AddTraceback("zmq.backend.cython.error.zmq_errno", __pyx_clineno, __pyx_lineno, __pyx_filename);
764  __pyx_r = NULL;
765  __pyx_L0:;
766  __Pyx_XGIVEREF(__pyx_r);
767  __Pyx_RefNannyFinishContext();
768  return __pyx_r;
769}
770
771static PyMethodDef __pyx_methods[] = {
772  {0, 0, 0, 0}
773};
774
775#if PY_MAJOR_VERSION >= 3
776static struct PyModuleDef __pyx_moduledef = {
777  #if PY_VERSION_HEX < 0x03020000
778    { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
779  #else
780    PyModuleDef_HEAD_INIT,
781  #endif
782    "error",
783    __pyx_k_0MQ_Error_classes_and_functions, /* m_doc */
784    -1, /* m_size */
785    __pyx_methods /* m_methods */,
786    NULL, /* m_reload */
787    NULL, /* m_traverse */
788    NULL, /* m_clear */
789    NULL /* m_free */
790};
791#endif
792
793static __Pyx_StringTabEntry __pyx_string_tab[] = {
794  {&__pyx_n_s_all, __pyx_k_all, sizeof(__pyx_k_all), 0, 0, 1, 1},
795  {&__pyx_n_s_bytes, __pyx_k_bytes, sizeof(__pyx_k_bytes), 0, 0, 1, 1},
796  {&__pyx_n_s_errno, __pyx_k_errno, sizeof(__pyx_k_errno), 0, 0, 1, 1},
797  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
798  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
799  {&__pyx_kp_s_private_tmp_pyzmq_release_zmq_b, __pyx_k_private_tmp_pyzmq_release_zmq_b, sizeof(__pyx_k_private_tmp_pyzmq_release_zmq_b), 0, 0, 1, 0},
800  {&__pyx_n_s_str_e, __pyx_k_str_e, sizeof(__pyx_k_str_e), 0, 0, 1, 1},
801  {&__pyx_n_s_strerror, __pyx_k_strerror, sizeof(__pyx_k_strerror), 0, 0, 1, 1},
802  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
803  {&__pyx_n_s_zmq_backend_cython_error, __pyx_k_zmq_backend_cython_error, sizeof(__pyx_k_zmq_backend_cython_error), 0, 0, 1, 1},
804  {&__pyx_n_s_zmq_errno, __pyx_k_zmq_errno, sizeof(__pyx_k_zmq_errno), 0, 0, 1, 1},
805  {&__pyx_n_s_zmq_utils_strtypes, __pyx_k_zmq_utils_strtypes, sizeof(__pyx_k_zmq_utils_strtypes), 0, 0, 1, 1},
806  {0, 0, 0, 0, 0, 0, 0}
807};
808static int __Pyx_InitCachedBuiltins(void) {
809  return 0;
810}
811
812static int __Pyx_InitCachedConstants(void) {
813  __Pyx_RefNannyDeclarations
814  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
815
816  /* "zmq/backend/cython/error.pyx":34
817 * from zmq.utils.strtypes import bytes
818 *
819 * def strerror(int errno):             # <<<<<<<<<<<<<<
820 *     """strerror(errno)
821 *
822 */
823  __pyx_tuple_ = PyTuple_Pack(3, __pyx_n_s_errno, __pyx_n_s_errno, __pyx_n_s_str_e); if (unlikely(!__pyx_tuple_)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
824  __Pyx_GOTREF(__pyx_tuple_);
825  __Pyx_GIVEREF(__pyx_tuple_);
826  __pyx_codeobj__2 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple_, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_private_tmp_pyzmq_release_zmq_b, __pyx_n_s_strerror, 34, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
827
828  /* "zmq/backend/cython/error.pyx":49
829 *         return str_e.decode()
830 *
831 * def zmq_errno():             # <<<<<<<<<<<<<<
832 *     """zmq_errno()
833 *
834 */
835  __pyx_codeobj__3 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_private_tmp_pyzmq_release_zmq_b, __pyx_n_s_zmq_errno, 49, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
836  __Pyx_RefNannyFinishContext();
837  return 0;
838  __pyx_L1_error:;
839  __Pyx_RefNannyFinishContext();
840  return -1;
841}
842
843static int __Pyx_InitGlobals(void) {
844  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
845  return 0;
846  __pyx_L1_error:;
847  return -1;
848}
849
850#if PY_MAJOR_VERSION < 3
851PyMODINIT_FUNC initerror(void); /*proto*/
852PyMODINIT_FUNC initerror(void)
853#else
854PyMODINIT_FUNC PyInit_error(void); /*proto*/
855PyMODINIT_FUNC PyInit_error(void)
856#endif
857{
858  PyObject *__pyx_t_1 = NULL;
859  PyObject *__pyx_t_2 = NULL;
860  int __pyx_lineno = 0;
861  const char *__pyx_filename = NULL;
862  int __pyx_clineno = 0;
863  __Pyx_RefNannyDeclarations
864  #if CYTHON_REFNANNY
865  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
866  if (!__Pyx_RefNanny) {
867      PyErr_Clear();
868      __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
869      if (!__Pyx_RefNanny)
870          Py_FatalError("failed to import 'refnanny' module");
871  }
872  #endif
873  __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_error(void)", 0);
874  if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
875  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
876  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
877  #ifdef __Pyx_CyFunction_USED
878  if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
879  #endif
880  #ifdef __Pyx_FusedFunction_USED
881  if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
882  #endif
883  #ifdef __Pyx_Generator_USED
884  if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
885  #endif
886  /*--- Library function declarations ---*/
887  /*--- Threads initialization code ---*/
888  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
889  #ifdef WITH_THREAD /* Python build with threading support? */
890  PyEval_InitThreads();
891  #endif
892  #endif
893  /*--- Module creation code ---*/
894  #if PY_MAJOR_VERSION < 3
895  __pyx_m = Py_InitModule4("error", __pyx_methods, __pyx_k_0MQ_Error_classes_and_functions, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
896  #else
897  __pyx_m = PyModule_Create(&__pyx_moduledef);
898  #endif
899  if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
900  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
901  Py_INCREF(__pyx_d);
902  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
903  #if CYTHON_COMPILING_IN_PYPY
904  Py_INCREF(__pyx_b);
905  #endif
906  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
907  /*--- Initialize various global constants etc. ---*/
908  if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
909  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
910  if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
911  #endif
912  if (__pyx_module_is_main_zmq__backend__cython__error) {
913    if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
914  }
915  #if PY_MAJOR_VERSION >= 3
916  {
917    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
918    if (!PyDict_GetItemString(modules, "zmq.backend.cython.error")) {
919      if (unlikely(PyDict_SetItemString(modules, "zmq.backend.cython.error", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
920    }
921  }
922  #endif
923  /*--- Builtin init code ---*/
924  if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
925  /*--- Constants init code ---*/
926  if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
927  /*--- Global init code ---*/
928  /*--- Variable export code ---*/
929  /*--- Function export code ---*/
930  /*--- Type init code ---*/
931  /*--- Type import code ---*/
932  /*--- Variable import code ---*/
933  /*--- Function import code ---*/
934  /*--- Execution code ---*/
935
936  /* "zmq/backend/cython/error.pyx":32
937 * from libzmq cimport zmq_strerror, zmq_errno as zmq_errno_c
938 *
939 * from zmq.utils.strtypes import bytes             # <<<<<<<<<<<<<<
940 *
941 * def strerror(int errno):
942 */
943  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
944  __Pyx_GOTREF(__pyx_t_1);
945  __Pyx_INCREF(__pyx_n_s_bytes);
946  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_bytes);
947  __Pyx_GIVEREF(__pyx_n_s_bytes);
948  __pyx_t_2 = __Pyx_Import(__pyx_n_s_zmq_utils_strtypes, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
949  __Pyx_GOTREF(__pyx_t_2);
950  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
951  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_bytes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
952  __Pyx_GOTREF(__pyx_t_1);
953  if (PyDict_SetItem(__pyx_d, __pyx_n_s_bytes, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
954  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
955  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
956
957  /* "zmq/backend/cython/error.pyx":34
958 * from zmq.utils.strtypes import bytes
959 *
960 * def strerror(int errno):             # <<<<<<<<<<<<<<
961 *     """strerror(errno)
962 *
963 */
964  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3zmq_7backend_6cython_5error_1strerror, NULL, __pyx_n_s_zmq_backend_cython_error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
965  __Pyx_GOTREF(__pyx_t_2);
966  if (PyDict_SetItem(__pyx_d, __pyx_n_s_strerror, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
967  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
968
969  /* "zmq/backend/cython/error.pyx":49
970 *         return str_e.decode()
971 *
972 * def zmq_errno():             # <<<<<<<<<<<<<<
973 *     """zmq_errno()
974 *
975 */
976  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3zmq_7backend_6cython_5error_3zmq_errno, NULL, __pyx_n_s_zmq_backend_cython_error); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
977  __Pyx_GOTREF(__pyx_t_2);
978  if (PyDict_SetItem(__pyx_d, __pyx_n_s_zmq_errno, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
979  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
980
981  /* "zmq/backend/cython/error.pyx":56
982 *     return zmq_errno_c()
983 *
984 * __all__ = ['strerror', 'zmq_errno']             # <<<<<<<<<<<<<<
985 */
986  __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
987  __Pyx_GOTREF(__pyx_t_2);
988  __Pyx_INCREF(__pyx_n_s_strerror);
989  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_strerror);
990  __Pyx_GIVEREF(__pyx_n_s_strerror);
991  __Pyx_INCREF(__pyx_n_s_zmq_errno);
992  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_zmq_errno);
993  __Pyx_GIVEREF(__pyx_n_s_zmq_errno);
994  if (PyDict_SetItem(__pyx_d, __pyx_n_s_all, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
995  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
996
997  /* "zmq/backend/cython/error.pyx":1
998 * """0MQ Error classes and functions."""             # <<<<<<<<<<<<<<
999 *
1000 * #
1001 */
1002  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1003  __Pyx_GOTREF(__pyx_t_2);
1004  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1005  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1006
1007  /*--- Wrapped vars code ---*/
1008
1009  goto __pyx_L0;
1010  __pyx_L1_error:;
1011  __Pyx_XDECREF(__pyx_t_1);
1012  __Pyx_XDECREF(__pyx_t_2);
1013  if (__pyx_m) {
1014    if (__pyx_d) {
1015      __Pyx_AddTraceback("init zmq.backend.cython.error", __pyx_clineno, __pyx_lineno, __pyx_filename);
1016    }
1017    Py_DECREF(__pyx_m); __pyx_m = 0;
1018  } else if (!PyErr_Occurred()) {
1019    PyErr_SetString(PyExc_ImportError, "init zmq.backend.cython.error");
1020  }
1021  __pyx_L0:;
1022  __Pyx_RefNannyFinishContext();
1023  #if PY_MAJOR_VERSION < 3
1024  return;
1025  #else
1026  return __pyx_m;
1027  #endif
1028}
1029
1030/* Runtime support code */
1031#if CYTHON_REFNANNY
1032static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
1033    PyObject *m = NULL, *p = NULL;
1034    void *r = NULL;
1035    m = PyImport_ImportModule((char *)modname);
1036    if (!m) goto end;
1037    p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
1038    if (!p) goto end;
1039    r = PyLong_AsVoidPtr(p);
1040end:
1041    Py_XDECREF(p);
1042    Py_XDECREF(m);
1043    return (__Pyx_RefNannyAPIStruct *)r;
1044}
1045#endif
1046
1047static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
1048    PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
1049    if (unlikely(!result)) {
1050        PyErr_Format(PyExc_NameError,
1051#if PY_MAJOR_VERSION >= 3
1052            "name '%U' is not defined", name);
1053#else
1054            "name '%.200s' is not defined", PyString_AS_STRING(name));
1055#endif
1056    }
1057    return result;
1058}
1059
1060static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
1061    PyObject *result;
1062#if CYTHON_COMPILING_IN_CPYTHON
1063    result = PyDict_GetItem(__pyx_d, name);
1064    if (likely(result)) {
1065        Py_INCREF(result);
1066    } else {
1067#else
1068    result = PyObject_GetItem(__pyx_d, name);
1069    if (!result) {
1070        PyErr_Clear();
1071#endif
1072        result = __Pyx_GetBuiltinName(name);
1073    }
1074    return result;
1075}
1076
1077static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
1078         const char* cstring, Py_ssize_t start, Py_ssize_t stop,
1079         const char* encoding, const char* errors,
1080         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
1081    Py_ssize_t length;
1082    if (unlikely((start < 0) | (stop < 0))) {
1083        length = strlen(cstring);
1084        if (start < 0) {
1085            start += length;
1086            if (start < 0)
1087                start = 0;
1088        }
1089        if (stop < 0)
1090            stop += length;
1091    }
1092    length = stop - start;
1093    if (unlikely(length <= 0))
1094        return PyUnicode_FromUnicode(NULL, 0);
1095    cstring += start;
1096    if (decode_func) {
1097        return decode_func(cstring, length, errors);
1098    } else {
1099        return PyUnicode_Decode(cstring, length, encoding, errors);
1100    }
1101}
1102
1103static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
1104    PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
1105    if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
1106        PyErr_Format(PyExc_ImportError,
1107        #if PY_MAJOR_VERSION < 3
1108            "cannot import name %.230s", PyString_AS_STRING(name));
1109        #else
1110            "cannot import name %S", name);
1111        #endif
1112    }
1113    return value;
1114}
1115
1116static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
1117    int start = 0, mid = 0, end = count - 1;
1118    if (end >= 0 && code_line > entries[end].code_line) {
1119        return count;
1120    }
1121    while (start < end) {
1122        mid = (start + end) / 2;
1123        if (code_line < entries[mid].code_line) {
1124            end = mid;
1125        } else if (code_line > entries[mid].code_line) {
1126             start = mid + 1;
1127        } else {
1128            return mid;
1129        }
1130    }
1131    if (code_line <= entries[mid].code_line) {
1132        return mid;
1133    } else {
1134        return mid + 1;
1135    }
1136}
1137static PyCodeObject *__pyx_find_code_object(int code_line) {
1138    PyCodeObject* code_object;
1139    int pos;
1140    if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
1141        return NULL;
1142    }
1143    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
1144    if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
1145        return NULL;
1146    }
1147    code_object = __pyx_code_cache.entries[pos].code_object;
1148    Py_INCREF(code_object);
1149    return code_object;
1150}
1151static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
1152    int pos, i;
1153    __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
1154    if (unlikely(!code_line)) {
1155        return;
1156    }
1157    if (unlikely(!entries)) {
1158        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
1159        if (likely(entries)) {
1160            __pyx_code_cache.entries = entries;
1161            __pyx_code_cache.max_count = 64;
1162            __pyx_code_cache.count = 1;
1163            entries[0].code_line = code_line;
1164            entries[0].code_object = code_object;
1165            Py_INCREF(code_object);
1166        }
1167        return;
1168    }
1169    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
1170    if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
1171        PyCodeObject* tmp = entries[pos].code_object;
1172        entries[pos].code_object = code_object;
1173        Py_DECREF(tmp);
1174        return;
1175    }
1176    if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
1177        int new_max = __pyx_code_cache.max_count + 64;
1178        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
1179            __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
1180        if (unlikely(!entries)) {
1181            return;
1182        }
1183        __pyx_code_cache.entries = entries;
1184        __pyx_code_cache.max_count = new_max;
1185    }
1186    for (i=__pyx_code_cache.count; i>pos; i--) {
1187        entries[i] = entries[i-1];
1188    }
1189    entries[pos].code_line = code_line;
1190    entries[pos].code_object = code_object;
1191    __pyx_code_cache.count++;
1192    Py_INCREF(code_object);
1193}
1194
1195#include "compile.h"
1196#include "frameobject.h"
1197#include "traceback.h"
1198static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
1199            const char *funcname, int c_line,
1200            int py_line, const char *filename) {
1201    PyCodeObject *py_code = 0;
1202    PyObject *py_srcfile = 0;
1203    PyObject *py_funcname = 0;
1204    #if PY_MAJOR_VERSION < 3
1205    py_srcfile = PyString_FromString(filename);
1206    #else
1207    py_srcfile = PyUnicode_FromString(filename);
1208    #endif
1209    if (!py_srcfile) goto bad;
1210    if (c_line) {
1211        #if PY_MAJOR_VERSION < 3
1212        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
1213        #else
1214        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
1215        #endif
1216    }
1217    else {
1218        #if PY_MAJOR_VERSION < 3
1219        py_funcname = PyString_FromString(funcname);
1220        #else
1221        py_funcname = PyUnicode_FromString(funcname);
1222        #endif
1223    }
1224    if (!py_funcname) goto bad;
1225    py_code = __Pyx_PyCode_New(
1226        0,
1227        0,
1228        0,
1229        0,
1230        0,
1231        __pyx_empty_bytes, /*PyObject *code,*/
1232        __pyx_empty_tuple, /*PyObject *consts,*/
1233        __pyx_empty_tuple, /*PyObject *names,*/
1234        __pyx_empty_tuple, /*PyObject *varnames,*/
1235        __pyx_empty_tuple, /*PyObject *freevars,*/
1236        __pyx_empty_tuple, /*PyObject *cellvars,*/
1237        py_srcfile,   /*PyObject *filename,*/
1238        py_funcname,  /*PyObject *name,*/
1239        py_line,
1240        __pyx_empty_bytes  /*PyObject *lnotab*/
1241    );
1242    Py_DECREF(py_srcfile);
1243    Py_DECREF(py_funcname);
1244    return py_code;
1245bad:
1246    Py_XDECREF(py_srcfile);
1247    Py_XDECREF(py_funcname);
1248    return NULL;
1249}
1250static void __Pyx_AddTraceback(const char *funcname, int c_line,
1251                               int py_line, const char *filename) {
1252    PyCodeObject *py_code = 0;
1253    PyFrameObject *py_frame = 0;
1254    py_code = __pyx_find_code_object(c_line ? c_line : py_line);
1255    if (!py_code) {
1256        py_code = __Pyx_CreateCodeObjectForTraceback(
1257            funcname, c_line, py_line, filename);
1258        if (!py_code) goto bad;
1259        __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
1260    }
1261    py_frame = PyFrame_New(
1262        PyThreadState_GET(), /*PyThreadState *tstate,*/
1263        py_code,             /*PyCodeObject *code,*/
1264        __pyx_d,      /*PyObject *globals,*/
1265        0                    /*PyObject *locals*/
1266    );
1267    if (!py_frame) goto bad;
1268    py_frame->f_lineno = py_line;
1269    PyTraceBack_Here(py_frame);
1270bad:
1271    Py_XDECREF(py_code);
1272    Py_XDECREF(py_frame);
1273}
1274
1275static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
1276    PyObject *empty_list = 0;
1277    PyObject *module = 0;
1278    PyObject *global_dict = 0;
1279    PyObject *empty_dict = 0;
1280    PyObject *list;
1281    #if PY_VERSION_HEX < 0x03030000
1282    PyObject *py_import;
1283    py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
1284    if (!py_import)
1285        goto bad;
1286    #endif
1287    if (from_list)
1288        list = from_list;
1289    else {
1290        empty_list = PyList_New(0);
1291        if (!empty_list)
1292            goto bad;
1293        list = empty_list;
1294    }
1295    global_dict = PyModule_GetDict(__pyx_m);
1296    if (!global_dict)
1297        goto bad;
1298    empty_dict = PyDict_New();
1299    if (!empty_dict)
1300        goto bad;
1301    {
1302        #if PY_MAJOR_VERSION >= 3
1303        if (level == -1) {
1304            if (strchr(__Pyx_MODULE_NAME, '.')) {
1305                #if PY_VERSION_HEX < 0x03030000
1306                PyObject *py_level = PyInt_FromLong(1);
1307                if (!py_level)
1308                    goto bad;
1309                module = PyObject_CallFunctionObjArgs(py_import,
1310                    name, global_dict, empty_dict, list, py_level, NULL);
1311                Py_DECREF(py_level);
1312                #else
1313                module = PyImport_ImportModuleLevelObject(
1314                    name, global_dict, empty_dict, list, 1);
1315                #endif
1316                if (!module) {
1317                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
1318                        goto bad;
1319                    PyErr_Clear();
1320                }
1321            }
1322            level = 0;
1323        }
1324        #endif
1325        if (!module) {
1326            #if PY_VERSION_HEX < 0x03030000
1327            PyObject *py_level = PyInt_FromLong(level);
1328            if (!py_level)
1329                goto bad;
1330            module = PyObject_CallFunctionObjArgs(py_import,
1331                name, global_dict, empty_dict, list, py_level, NULL);
1332            Py_DECREF(py_level);
1333            #else
1334            module = PyImport_ImportModuleLevelObject(
1335                name, global_dict, empty_dict, list, level);
1336            #endif
1337        }
1338    }
1339bad:
1340    #if PY_VERSION_HEX < 0x03030000
1341    Py_XDECREF(py_import);
1342    #endif
1343    Py_XDECREF(empty_list);
1344    Py_XDECREF(empty_dict);
1345    return module;
1346}
1347
1348#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)       \
1349    {                                                                     \
1350        func_type value = func_value;                                     \
1351        if (sizeof(target_type) < sizeof(func_type)) {                    \
1352            if (unlikely(value != (func_type) (target_type) value)) {     \
1353                func_type zero = 0;                                       \
1354                if (is_unsigned && unlikely(value < zero))                \
1355                    goto raise_neg_overflow;                              \
1356                else                                                      \
1357                    goto raise_overflow;                                  \
1358            }                                                             \
1359        }                                                                 \
1360        return (target_type) value;                                       \
1361    }
1362
1363#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
1364 #if CYTHON_USE_PYLONG_INTERNALS
1365  #include "longintrepr.h"
1366 #endif
1367#endif
1368
1369static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
1370    const int neg_one = (int) -1, const_zero = 0;
1371    const int is_unsigned = neg_one > const_zero;
1372#if PY_MAJOR_VERSION < 3
1373    if (likely(PyInt_Check(x))) {
1374        if (sizeof(int) < sizeof(long)) {
1375            __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
1376        } else {
1377            long val = PyInt_AS_LONG(x);
1378            if (is_unsigned && unlikely(val < 0)) {
1379                goto raise_neg_overflow;
1380            }
1381            return (int) val;
1382        }
1383    } else
1384#endif
1385    if (likely(PyLong_Check(x))) {
1386        if (is_unsigned) {
1387#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
1388 #if CYTHON_USE_PYLONG_INTERNALS
1389            switch (Py_SIZE(x)) {
1390                case  0: return 0;
1391                case  1: __PYX_VERIFY_RETURN_INT(int, digit, ((PyLongObject*)x)->ob_digit[0]);
1392            }
1393 #endif
1394#endif
1395            if (unlikely(Py_SIZE(x) < 0)) {
1396                goto raise_neg_overflow;
1397            }
1398            if (sizeof(int) <= sizeof(unsigned long)) {
1399                __PYX_VERIFY_RETURN_INT(int, unsigned long, PyLong_AsUnsignedLong(x))
1400            } else if (sizeof(int) <= sizeof(unsigned long long)) {
1401                __PYX_VERIFY_RETURN_INT(int, unsigned long long, PyLong_AsUnsignedLongLong(x))
1402            }
1403        } else {
1404#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
1405 #if CYTHON_USE_PYLONG_INTERNALS
1406            switch (Py_SIZE(x)) {
1407                case  0: return 0;
1408                case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +(((PyLongObject*)x)->ob_digit[0]));
1409                case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
1410            }
1411 #endif
1412#endif
1413            if (sizeof(int) <= sizeof(long)) {
1414                __PYX_VERIFY_RETURN_INT(int, long, PyLong_AsLong(x))
1415            } else if (sizeof(int) <= sizeof(long long)) {
1416                __PYX_VERIFY_RETURN_INT(int, long long, PyLong_AsLongLong(x))
1417            }
1418        }
1419        {
1420#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
1421            PyErr_SetString(PyExc_RuntimeError,
1422                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
1423#else
1424            int val;
1425            PyObject *v = __Pyx_PyNumber_Int(x);
1426 #if PY_MAJOR_VERSION < 3
1427            if (likely(v) && !PyLong_Check(v)) {
1428                PyObject *tmp = v;
1429                v = PyNumber_Long(tmp);
1430                Py_DECREF(tmp);
1431            }
1432 #endif
1433            if (likely(v)) {
1434                int one = 1; int is_little = (int)*(unsigned char *)&one;
1435                unsigned char *bytes = (unsigned char *)&val;
1436                int ret = _PyLong_AsByteArray((PyLongObject *)v,
1437                                              bytes, sizeof(val),
1438                                              is_little, !is_unsigned);
1439                Py_DECREF(v);
1440                if (likely(!ret))
1441                    return val;
1442            }
1443#endif
1444            return (int) -1;
1445        }
1446    } else {
1447        int val;
1448        PyObject *tmp = __Pyx_PyNumber_Int(x);
1449        if (!tmp) return (int) -1;
1450        val = __Pyx_PyInt_As_int(tmp);
1451        Py_DECREF(tmp);
1452        return val;
1453    }
1454raise_overflow:
1455    PyErr_SetString(PyExc_OverflowError,
1456        "value too large to convert to int");
1457    return (int) -1;
1458raise_neg_overflow:
1459    PyErr_SetString(PyExc_OverflowError,
1460        "can't convert negative value to int");
1461    return (int) -1;
1462}
1463
1464static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
1465    const int neg_one = (int) -1, const_zero = 0;
1466    const int is_unsigned = neg_one > const_zero;
1467    if (is_unsigned) {
1468        if (sizeof(int) < sizeof(long)) {
1469            return PyInt_FromLong((long) value);
1470        } else if (sizeof(int) <= sizeof(unsigned long)) {
1471            return PyLong_FromUnsignedLong((unsigned long) value);
1472        } else if (sizeof(int) <= sizeof(unsigned long long)) {
1473            return PyLong_FromUnsignedLongLong((unsigned long long) value);
1474        }
1475    } else {
1476        if (sizeof(int) <= sizeof(long)) {
1477            return PyInt_FromLong((long) value);
1478        } else if (sizeof(int) <= sizeof(long long)) {
1479            return PyLong_FromLongLong((long long) value);
1480        }
1481    }
1482    {
1483        int one = 1; int little = (int)*(unsigned char *)&one;
1484        unsigned char *bytes = (unsigned char *)&value;
1485        return _PyLong_FromByteArray(bytes, sizeof(int),
1486                                     little, !is_unsigned);
1487    }
1488}
1489
1490static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
1491    const long neg_one = (long) -1, const_zero = 0;
1492    const int is_unsigned = neg_one > const_zero;
1493    if (is_unsigned) {
1494        if (sizeof(long) < sizeof(long)) {
1495            return PyInt_FromLong((long) value);
1496        } else if (sizeof(long) <= sizeof(unsigned long)) {
1497            return PyLong_FromUnsignedLong((unsigned long) value);
1498        } else if (sizeof(long) <= sizeof(unsigned long long)) {
1499            return PyLong_FromUnsignedLongLong((unsigned long long) value);
1500        }
1501    } else {
1502        if (sizeof(long) <= sizeof(long)) {
1503            return PyInt_FromLong((long) value);
1504        } else if (sizeof(long) <= sizeof(long long)) {
1505            return PyLong_FromLongLong((long long) value);
1506        }
1507    }
1508    {
1509        int one = 1; int little = (int)*(unsigned char *)&one;
1510        unsigned char *bytes = (unsigned char *)&value;
1511        return _PyLong_FromByteArray(bytes, sizeof(long),
1512                                     little, !is_unsigned);
1513    }
1514}
1515
1516static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
1517    const long neg_one = (long) -1, const_zero = 0;
1518    const int is_unsigned = neg_one > const_zero;
1519#if PY_MAJOR_VERSION < 3
1520    if (likely(PyInt_Check(x))) {
1521        if (sizeof(long) < sizeof(long)) {
1522            __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
1523        } else {
1524            long val = PyInt_AS_LONG(x);
1525            if (is_unsigned && unlikely(val < 0)) {
1526                goto raise_neg_overflow;
1527            }
1528            return (long) val;
1529        }
1530    } else
1531#endif
1532    if (likely(PyLong_Check(x))) {
1533        if (is_unsigned) {
1534#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
1535 #if CYTHON_USE_PYLONG_INTERNALS
1536            switch (Py_SIZE(x)) {
1537                case  0: return 0;
1538                case  1: __PYX_VERIFY_RETURN_INT(long, digit, ((PyLongObject*)x)->ob_digit[0]);
1539            }
1540 #endif
1541#endif
1542            if (unlikely(Py_SIZE(x) < 0)) {
1543                goto raise_neg_overflow;
1544            }
1545            if (sizeof(long) <= sizeof(unsigned long)) {
1546                __PYX_VERIFY_RETURN_INT(long, unsigned long, PyLong_AsUnsignedLong(x))
1547            } else if (sizeof(long) <= sizeof(unsigned long long)) {
1548                __PYX_VERIFY_RETURN_INT(long, unsigned long long, PyLong_AsUnsignedLongLong(x))
1549            }
1550        } else {
1551#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
1552 #if CYTHON_USE_PYLONG_INTERNALS
1553            switch (Py_SIZE(x)) {
1554                case  0: return 0;
1555                case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +(((PyLongObject*)x)->ob_digit[0]));
1556                case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
1557            }
1558 #endif
1559#endif
1560            if (sizeof(long) <= sizeof(long)) {
1561                __PYX_VERIFY_RETURN_INT(long, long, PyLong_AsLong(x))
1562            } else if (sizeof(long) <= sizeof(long long)) {
1563                __PYX_VERIFY_RETURN_INT(long, long long, PyLong_AsLongLong(x))
1564            }
1565        }
1566        {
1567#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
1568            PyErr_SetString(PyExc_RuntimeError,
1569                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
1570#else
1571            long val;
1572            PyObject *v = __Pyx_PyNumber_Int(x);
1573 #if PY_MAJOR_VERSION < 3
1574            if (likely(v) && !PyLong_Check(v)) {
1575                PyObject *tmp = v;
1576                v = PyNumber_Long(tmp);
1577                Py_DECREF(tmp);
1578            }
1579 #endif
1580            if (likely(v)) {
1581                int one = 1; int is_little = (int)*(unsigned char *)&one;
1582                unsigned char *bytes = (unsigned char *)&val;
1583                int ret = _PyLong_AsByteArray((PyLongObject *)v,
1584                                              bytes, sizeof(val),
1585                                              is_little, !is_unsigned);
1586                Py_DECREF(v);
1587                if (likely(!ret))
1588                    return val;
1589            }
1590#endif
1591            return (long) -1;
1592        }
1593    } else {
1594        long val;
1595        PyObject *tmp = __Pyx_PyNumber_Int(x);
1596        if (!tmp) return (long) -1;
1597        val = __Pyx_PyInt_As_long(tmp);
1598        Py_DECREF(tmp);
1599        return val;
1600    }
1601raise_overflow:
1602    PyErr_SetString(PyExc_OverflowError,
1603        "value too large to convert to long");
1604    return (long) -1;
1605raise_neg_overflow:
1606    PyErr_SetString(PyExc_OverflowError,
1607        "can't convert negative value to long");
1608    return (long) -1;
1609}
1610
1611static int __Pyx_check_binary_version(void) {
1612    char ctversion[4], rtversion[4];
1613    PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
1614    PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
1615    if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
1616        char message[200];
1617        PyOS_snprintf(message, sizeof(message),
1618                      "compiletime version %s of module '%.100s' "
1619                      "does not match runtime version %s",
1620                      ctversion, __Pyx_MODULE_NAME, rtversion);
1621        return PyErr_WarnEx(NULL, message, 1);
1622    }
1623    return 0;
1624}
1625
1626static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
1627    while (t->p) {
1628        #if PY_MAJOR_VERSION < 3
1629        if (t->is_unicode) {
1630            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
1631        } else if (t->intern) {
1632            *t->p = PyString_InternFromString(t->s);
1633        } else {
1634            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
1635        }
1636        #else
1637        if (t->is_unicode | t->is_str) {
1638            if (t->intern) {
1639                *t->p = PyUnicode_InternFromString(t->s);
1640            } else if (t->encoding) {
1641                *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
1642            } else {
1643                *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
1644            }
1645        } else {
1646            *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
1647        }
1648        #endif
1649        if (!*t->p)
1650            return -1;
1651        ++t;
1652    }
1653    return 0;
1654}
1655
1656static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
1657    return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
1658}
1659static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
1660    Py_ssize_t ignore;
1661    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
1662}
1663static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
1664#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
1665    if (
1666#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
1667            __Pyx_sys_getdefaultencoding_not_ascii &&
1668#endif
1669            PyUnicode_Check(o)) {
1670#if PY_VERSION_HEX < 0x03030000
1671        char* defenc_c;
1672        PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
1673        if (!defenc) return NULL;
1674        defenc_c = PyBytes_AS_STRING(defenc);
1675#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
1676        {
1677            char* end = defenc_c + PyBytes_GET_SIZE(defenc);
1678            char* c;
1679            for (c = defenc_c; c < end; c++) {
1680                if ((unsigned char) (*c) >= 128) {
1681                    PyUnicode_AsASCIIString(o);
1682                    return NULL;
1683                }
1684            }
1685        }
1686#endif
1687        *length = PyBytes_GET_SIZE(defenc);
1688        return defenc_c;
1689#else
1690        if (__Pyx_PyUnicode_READY(o) == -1) return NULL;
1691#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
1692        if (PyUnicode_IS_ASCII(o)) {
1693            *length = PyUnicode_GET_LENGTH(o);
1694            return PyUnicode_AsUTF8(o);
1695        } else {
1696            PyUnicode_AsASCIIString(o);
1697            return NULL;
1698        }
1699#else
1700        return PyUnicode_AsUTF8AndSize(o, length);
1701#endif
1702#endif
1703    } else
1704#endif
1705#if !CYTHON_COMPILING_IN_PYPY
1706    if (PyByteArray_Check(o)) {
1707        *length = PyByteArray_GET_SIZE(o);
1708        return PyByteArray_AS_STRING(o);
1709    } else
1710#endif
1711    {
1712        char* result;
1713        int r = PyBytes_AsStringAndSize(o, &result, length);
1714        if (unlikely(r < 0)) {
1715            return NULL;
1716        } else {
1717            return result;
1718        }
1719    }
1720}
1721static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
1722   int is_true = x == Py_True;
1723   if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
1724   else return PyObject_IsTrue(x);
1725}
1726static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
1727  PyNumberMethods *m;
1728  const char *name = NULL;
1729  PyObject *res = NULL;
1730#if PY_MAJOR_VERSION < 3
1731  if (PyInt_Check(x) || PyLong_Check(x))
1732#else
1733  if (PyLong_Check(x))
1734#endif
1735    return Py_INCREF(x), x;
1736  m = Py_TYPE(x)->tp_as_number;
1737#if PY_MAJOR_VERSION < 3
1738  if (m && m->nb_int) {
1739    name = "int";
1740    res = PyNumber_Int(x);
1741  }
1742  else if (m && m->nb_long) {
1743    name = "long";
1744    res = PyNumber_Long(x);
1745  }
1746#else
1747  if (m && m->nb_int) {
1748    name = "int";
1749    res = PyNumber_Long(x);
1750  }
1751#endif
1752  if (res) {
1753#if PY_MAJOR_VERSION < 3
1754    if (!PyInt_Check(res) && !PyLong_Check(res)) {
1755#else
1756    if (!PyLong_Check(res)) {
1757#endif
1758      PyErr_Format(PyExc_TypeError,
1759                   "__%.4s__ returned non-%.4s (type %.200s)",
1760                   name, name, Py_TYPE(res)->tp_name);
1761      Py_DECREF(res);
1762      return NULL;
1763    }
1764  }
1765  else if (!PyErr_Occurred()) {
1766    PyErr_SetString(PyExc_TypeError,
1767                    "an integer is required");
1768  }
1769  return res;
1770}
1771static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
1772  Py_ssize_t ival;
1773  PyObject *x;
1774#if PY_MAJOR_VERSION < 3
1775  if (likely(PyInt_CheckExact(b)))
1776      return PyInt_AS_LONG(b);
1777#endif
1778  if (likely(PyLong_CheckExact(b))) {
1779    #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
1780     #if CYTHON_USE_PYLONG_INTERNALS
1781       switch (Py_SIZE(b)) {
1782       case -1: return -(sdigit)((PyLongObject*)b)->ob_digit[0];
1783       case  0: return 0;
1784       case  1: return ((PyLongObject*)b)->ob_digit[0];
1785       }
1786     #endif
1787    #endif
1788    return PyLong_AsSsize_t(b);
1789  }
1790  x = PyNumber_Index(b);
1791  if (!x) return -1;
1792  ival = PyInt_AsSsize_t(x);
1793  Py_DECREF(x);
1794  return ival;
1795}
1796static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
1797    return PyInt_FromSize_t(ival);
1798}
1799
1800
1801#endif /* Py_PYTHON_H */
1802