PageRenderTime 36ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 1ms

/zmq/core/error.c

https://bitbucket.org/fatbox/pyzmq-static
C | 2382 lines | 1850 code | 225 blank | 307 comment | 378 complexity | 88fa36db50b2ee4bfc97b882eb65a688 MD5 | raw file
Possible License(s): GPL-3.0, LGPL-3.0
  1. /* Generated by Cython 0.15.1 on Mon Dec 19 01:21:30 2011 */
  2. #define PY_SSIZE_T_CLEAN
  3. #include "Python.h"
  4. #ifndef Py_PYTHON_H
  5. #error Python headers needed to compile C extensions, please install development version of Python.
  6. #else
  7. #include <stddef.h> /* For offsetof */
  8. #ifndef offsetof
  9. #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
  10. #endif
  11. #if !defined(WIN32) && !defined(MS_WINDOWS)
  12. #ifndef __stdcall
  13. #define __stdcall
  14. #endif
  15. #ifndef __cdecl
  16. #define __cdecl
  17. #endif
  18. #ifndef __fastcall
  19. #define __fastcall
  20. #endif
  21. #endif
  22. #ifndef DL_IMPORT
  23. #define DL_IMPORT(t) t
  24. #endif
  25. #ifndef DL_EXPORT
  26. #define DL_EXPORT(t) t
  27. #endif
  28. #ifndef PY_LONG_LONG
  29. #define PY_LONG_LONG LONG_LONG
  30. #endif
  31. #if PY_VERSION_HEX < 0x02040000
  32. #define METH_COEXIST 0
  33. #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type)
  34. #define PyDict_Contains(d,o) PySequence_Contains(d,o)
  35. #endif
  36. #if PY_VERSION_HEX < 0x02050000
  37. typedef int Py_ssize_t;
  38. #define PY_SSIZE_T_MAX INT_MAX
  39. #define PY_SSIZE_T_MIN INT_MIN
  40. #define PY_FORMAT_SIZE_T ""
  41. #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
  42. #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o)
  43. #define PyNumber_Index(o) PyNumber_Int(o)
  44. #define PyIndex_Check(o) PyNumber_Check(o)
  45. #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
  46. #endif
  47. #if PY_VERSION_HEX < 0x02060000
  48. #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
  49. #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
  50. #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size)
  51. #define PyVarObject_HEAD_INIT(type, size) \
  52. PyObject_HEAD_INIT(type) size,
  53. #define PyType_Modified(t)
  54. typedef struct {
  55. void *buf;
  56. PyObject *obj;
  57. Py_ssize_t len;
  58. Py_ssize_t itemsize;
  59. int readonly;
  60. int ndim;
  61. char *format;
  62. Py_ssize_t *shape;
  63. Py_ssize_t *strides;
  64. Py_ssize_t *suboffsets;
  65. void *internal;
  66. } Py_buffer;
  67. #define PyBUF_SIMPLE 0
  68. #define PyBUF_WRITABLE 0x0001
  69. #define PyBUF_FORMAT 0x0004
  70. #define PyBUF_ND 0x0008
  71. #define PyBUF_STRIDES (0x0010 | PyBUF_ND)
  72. #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
  73. #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
  74. #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
  75. #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
  76. #endif
  77. #if PY_MAJOR_VERSION < 3
  78. #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  79. #else
  80. #define __Pyx_BUILTIN_MODULE_NAME "builtins"
  81. #endif
  82. #if PY_MAJOR_VERSION >= 3
  83. #define Py_TPFLAGS_CHECKTYPES 0
  84. #define Py_TPFLAGS_HAVE_INDEX 0
  85. #endif
  86. #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
  87. #define Py_TPFLAGS_HAVE_NEWBUFFER 0
  88. #endif
  89. #if PY_MAJOR_VERSION >= 3
  90. #define PyBaseString_Type PyUnicode_Type
  91. #define PyStringObject PyUnicodeObject
  92. #define PyString_Type PyUnicode_Type
  93. #define PyString_Check PyUnicode_Check
  94. #define PyString_CheckExact PyUnicode_CheckExact
  95. #endif
  96. #if PY_VERSION_HEX < 0x02060000
  97. #define PyBytesObject PyStringObject
  98. #define PyBytes_Type PyString_Type
  99. #define PyBytes_Check PyString_Check
  100. #define PyBytes_CheckExact PyString_CheckExact
  101. #define PyBytes_FromString PyString_FromString
  102. #define PyBytes_FromStringAndSize PyString_FromStringAndSize
  103. #define PyBytes_FromFormat PyString_FromFormat
  104. #define PyBytes_DecodeEscape PyString_DecodeEscape
  105. #define PyBytes_AsString PyString_AsString
  106. #define PyBytes_AsStringAndSize PyString_AsStringAndSize
  107. #define PyBytes_Size PyString_Size
  108. #define PyBytes_AS_STRING PyString_AS_STRING
  109. #define PyBytes_GET_SIZE PyString_GET_SIZE
  110. #define PyBytes_Repr PyString_Repr
  111. #define PyBytes_Concat PyString_Concat
  112. #define PyBytes_ConcatAndDel PyString_ConcatAndDel
  113. #endif
  114. #if PY_VERSION_HEX < 0x02060000
  115. #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type)
  116. #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type)
  117. #endif
  118. #ifndef PySet_CheckExact
  119. #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
  120. #endif
  121. #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
  122. #if PY_MAJOR_VERSION >= 3
  123. #define PyIntObject PyLongObject
  124. #define PyInt_Type PyLong_Type
  125. #define PyInt_Check(op) PyLong_Check(op)
  126. #define PyInt_CheckExact(op) PyLong_CheckExact(op)
  127. #define PyInt_FromString PyLong_FromString
  128. #define PyInt_FromUnicode PyLong_FromUnicode
  129. #define PyInt_FromLong PyLong_FromLong
  130. #define PyInt_FromSize_t PyLong_FromSize_t
  131. #define PyInt_FromSsize_t PyLong_FromSsize_t
  132. #define PyInt_AsLong PyLong_AsLong
  133. #define PyInt_AS_LONG PyLong_AS_LONG
  134. #define PyInt_AsSsize_t PyLong_AsSsize_t
  135. #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
  136. #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
  137. #endif
  138. #if PY_MAJOR_VERSION >= 3
  139. #define PyBoolObject PyLongObject
  140. #endif
  141. #if PY_VERSION_HEX < 0x03020000
  142. typedef long Py_hash_t;
  143. #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  144. #define __Pyx_PyInt_AsHash_t PyInt_AsLong
  145. #else
  146. #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  147. #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
  148. #endif
  149. #if PY_MAJOR_VERSION >= 3
  150. #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
  151. #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
  152. #else
  153. #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
  154. #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
  155. #endif
  156. #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
  157. #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
  158. #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
  159. #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
  160. #else
  161. #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
  162. (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
  163. (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
  164. (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
  165. #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
  166. (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
  167. (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
  168. (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
  169. #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
  170. (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
  171. (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
  172. (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
  173. #endif
  174. #if PY_MAJOR_VERSION >= 3
  175. #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
  176. #endif
  177. #if PY_VERSION_HEX < 0x02050000
  178. #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n)))
  179. #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
  180. #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n)))
  181. #else
  182. #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n))
  183. #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
  184. #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n))
  185. #endif
  186. #if PY_VERSION_HEX < 0x02050000
  187. #define __Pyx_NAMESTR(n) ((char *)(n))
  188. #define __Pyx_DOCSTR(n) ((char *)(n))
  189. #else
  190. #define __Pyx_NAMESTR(n) (n)
  191. #define __Pyx_DOCSTR(n) (n)
  192. #endif
  193. #ifndef __PYX_EXTERN_C
  194. #ifdef __cplusplus
  195. #define __PYX_EXTERN_C extern "C"
  196. #else
  197. #define __PYX_EXTERN_C extern
  198. #endif
  199. #endif
  200. #if defined(WIN32) || defined(MS_WINDOWS)
  201. #define _USE_MATH_DEFINES
  202. #endif
  203. #include <math.h>
  204. #define __PYX_HAVE__zmq__core__error
  205. #define __PYX_HAVE_API__zmq__core__error
  206. #include "stdio.h"
  207. #include "pythread.h"
  208. #include "allocate.h"
  209. #include "errno.h"
  210. #include "string.h"
  211. #include "zmq_compat.h"
  212. #include "zmq.h"
  213. #include "zmq_utils.h"
  214. #ifdef _OPENMP
  215. #include <omp.h>
  216. #endif /* _OPENMP */
  217. #ifdef PYREX_WITHOUT_ASSERTIONS
  218. #define CYTHON_WITHOUT_ASSERTIONS
  219. #endif
  220. /* inline attribute */
  221. #ifndef CYTHON_INLINE
  222. #if defined(__GNUC__)
  223. #define CYTHON_INLINE __inline__
  224. #elif defined(_MSC_VER)
  225. #define CYTHON_INLINE __inline
  226. #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  227. #define CYTHON_INLINE inline
  228. #else
  229. #define CYTHON_INLINE
  230. #endif
  231. #endif
  232. /* unused attribute */
  233. #ifndef CYTHON_UNUSED
  234. # if defined(__GNUC__)
  235. # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
  236. # define CYTHON_UNUSED __attribute__ ((__unused__))
  237. # else
  238. # define CYTHON_UNUSED
  239. # endif
  240. # elif defined(__ICC) || defined(__INTEL_COMPILER)
  241. # define CYTHON_UNUSED __attribute__ ((__unused__))
  242. # else
  243. # define CYTHON_UNUSED
  244. # endif
  245. #endif
  246. typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/
  247. /* Type Conversion Predeclarations */
  248. #define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
  249. #define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s))
  250. #define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
  251. #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
  252. static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
  253. static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
  254. static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
  255. static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
  256. static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
  257. #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
  258. #ifdef __GNUC__
  259. /* Test for GCC > 2.95 */
  260. #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
  261. #define likely(x) __builtin_expect(!!(x), 1)
  262. #define unlikely(x) __builtin_expect(!!(x), 0)
  263. #else /* __GNUC__ > 2 ... */
  264. #define likely(x) (x)
  265. #define unlikely(x) (x)
  266. #endif /* __GNUC__ > 2 ... */
  267. #else /* __GNUC__ */
  268. #define likely(x) (x)
  269. #define unlikely(x) (x)
  270. #endif /* __GNUC__ */
  271. static PyObject *__pyx_m;
  272. static PyObject *__pyx_b;
  273. static PyObject *__pyx_empty_tuple;
  274. static PyObject *__pyx_empty_bytes;
  275. static int __pyx_lineno;
  276. static int __pyx_clineno = 0;
  277. static const char * __pyx_cfilenm= __FILE__;
  278. static const char *__pyx_filename;
  279. static const char *__pyx_f[] = {
  280. "error.pyx",
  281. "bool.pxd",
  282. "complex.pxd",
  283. };
  284. /*--- Type declarations ---*/
  285. #ifndef CYTHON_REFNANNY
  286. #define CYTHON_REFNANNY 0
  287. #endif
  288. #if CYTHON_REFNANNY
  289. typedef struct {
  290. void (*INCREF)(void*, PyObject*, int);
  291. void (*DECREF)(void*, PyObject*, int);
  292. void (*GOTREF)(void*, PyObject*, int);
  293. void (*GIVEREF)(void*, PyObject*, int);
  294. void* (*SetupContext)(const char*, int, const char*);
  295. void (*FinishContext)(void**);
  296. } __Pyx_RefNannyAPIStruct;
  297. static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  298. static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/
  299. #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
  300. #define __Pyx_RefNannySetupContext(name) __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
  301. #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  302. #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  303. #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  304. #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  305. #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  306. #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
  307. #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
  308. #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
  309. #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
  310. #else
  311. #define __Pyx_RefNannyDeclarations
  312. #define __Pyx_RefNannySetupContext(name)
  313. #define __Pyx_RefNannyFinishContext()
  314. #define __Pyx_INCREF(r) Py_INCREF(r)
  315. #define __Pyx_DECREF(r) Py_DECREF(r)
  316. #define __Pyx_GOTREF(r)
  317. #define __Pyx_GIVEREF(r)
  318. #define __Pyx_XINCREF(r) Py_XINCREF(r)
  319. #define __Pyx_XDECREF(r) Py_XDECREF(r)
  320. #define __Pyx_XGOTREF(r)
  321. #define __Pyx_XGIVEREF(r)
  322. #endif /* CYTHON_REFNANNY */
  323. static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
  324. #include <string.h>
  325. static void __Pyx_RaiseDoubleKeywordsError(
  326. const char* func_name, PyObject* kw_name); /*proto*/
  327. static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/
  328. static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
  329. Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
  330. static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/
  331. static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases); /*proto*/
  332. static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
  333. PyObject *modname); /*proto*/
  334. #define __pyx_binding_PyCFunctionType_USED 1
  335. typedef struct {
  336. PyCFunctionObject func;
  337. } __pyx_binding_PyCFunctionType_object;
  338. static PyTypeObject __pyx_binding_PyCFunctionType_type;
  339. static PyTypeObject *__pyx_binding_PyCFunctionType = NULL;
  340. static PyObject *__pyx_binding_PyCFunctionType_NewEx(PyMethodDef *ml, PyObject *self, PyObject *module); /* proto */
  341. #define __pyx_binding_PyCFunctionType_New(ml, self) __pyx_binding_PyCFunctionType_NewEx(ml, self, NULL)
  342. static int __pyx_binding_PyCFunctionType_init(void); /* proto */
  343. #ifndef __PYX_FORCE_INIT_THREADS
  344. #if PY_VERSION_HEX < 0x02040200
  345. #define __PYX_FORCE_INIT_THREADS 1
  346. #else
  347. #define __PYX_FORCE_INIT_THREADS 0
  348. #endif
  349. #endif
  350. static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);
  351. static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);
  352. static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);
  353. static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *);
  354. static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *);
  355. static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *);
  356. static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);
  357. static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);
  358. static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);
  359. static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *);
  360. static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);
  361. static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);
  362. static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *);
  363. static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);
  364. static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);
  365. static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);
  366. static int __Pyx_check_binary_version(void);
  367. static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/
  368. static PyObject *__Pyx_ImportModule(const char *name); /*proto*/
  369. static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno,
  370. int __pyx_lineno, const char *__pyx_filename); /*proto*/
  371. static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
  372. /* Module declarations from 'cpython.version' */
  373. /* Module declarations from 'cpython.ref' */
  374. /* Module declarations from 'cpython.exc' */
  375. /* Module declarations from 'cpython.module' */
  376. /* Module declarations from 'cpython.mem' */
  377. /* Module declarations from 'cpython.tuple' */
  378. /* Module declarations from 'cpython.list' */
  379. /* Module declarations from 'libc.stdio' */
  380. /* Module declarations from 'cpython.object' */
  381. /* Module declarations from 'cpython.sequence' */
  382. /* Module declarations from 'cpython.mapping' */
  383. /* Module declarations from 'cpython.iterator' */
  384. /* Module declarations from 'cpython.type' */
  385. /* Module declarations from 'cpython.number' */
  386. /* Module declarations from 'cpython.int' */
  387. /* Module declarations from '__builtin__' */
  388. /* Module declarations from 'cpython.bool' */
  389. static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0;
  390. /* Module declarations from 'cpython.long' */
  391. /* Module declarations from 'cpython.float' */
  392. /* Module declarations from '__builtin__' */
  393. /* Module declarations from 'cpython.complex' */
  394. static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0;
  395. /* Module declarations from 'cpython.string' */
  396. /* Module declarations from 'cpython.unicode' */
  397. /* Module declarations from 'cpython.dict' */
  398. /* Module declarations from 'cpython.instance' */
  399. /* Module declarations from 'cpython.function' */
  400. /* Module declarations from 'cpython.method' */
  401. /* Module declarations from 'cpython.weakref' */
  402. /* Module declarations from 'cpython.getargs' */
  403. /* Module declarations from 'cpython.pythread' */
  404. /* Module declarations from 'cpython.pystate' */
  405. /* Module declarations from 'cpython.cobject' */
  406. /* Module declarations from 'cpython.oldbuffer' */
  407. /* Module declarations from 'cpython.set' */
  408. /* Module declarations from 'cpython.buffer' */
  409. /* Module declarations from 'cpython.bytes' */
  410. /* Module declarations from 'cpython.pycapsule' */
  411. /* Module declarations from 'cpython' */
  412. /* Module declarations from 'zmq.core.libzmq' */
  413. /* Module declarations from 'zmq.core.error' */
  414. #define __Pyx_MODULE_NAME "zmq.core.error"
  415. int __pyx_module_is_main_zmq__core__error = 0;
  416. /* Implementation of 'zmq.core.error' */
  417. static PyObject *__pyx_builtin_Exception;
  418. static char __pyx_k_1[] = "ZMQError('%s')";
  419. static char __pyx_k_2[] = "0MQ Error classes and functions.";
  420. static char __pyx_k_3[] = "zmq.utils.strtypes";
  421. static char __pyx_k_4[] = "zmq.core.error";
  422. static char __pyx_k_5[] = "Base exception class for 0MQ errors in Python.";
  423. static char __pyx_k_6[] = "Wrap an errno style error.\n\n Parameters\n ----------\n error : int\n The ZMQ errno or None. If None, then ``zmq_errno()`` is called and\n used.\n ";
  424. static char __pyx_k_7[] = "An error for ``Socket.bind_to_random_port()``.\n \n See Also\n --------\n .Socket.bind_to_random_port\n ";
  425. static char __pyx_k_8[] = "Raised when timeout is reached while waiting for 0MQ to finish with a Message\n \n See Also\n --------\n .MessageTracker.wait : object for tracking when ZeroMQ is done\n ";
  426. static char __pyx_k__self[] = "self";
  427. static char __pyx_k__bytes[] = "bytes";
  428. static char __pyx_k__errno[] = "errno";
  429. static char __pyx_k__error[] = "error";
  430. static char __pyx_k__NotDone[] = "NotDone";
  431. static char __pyx_k____all__[] = "__all__";
  432. static char __pyx_k____str__[] = "__str__";
  433. static char __pyx_k__ZMQError[] = "ZMQError";
  434. static char __pyx_k____init__[] = "__init__";
  435. static char __pyx_k____main__[] = "__main__";
  436. static char __pyx_k____repr__[] = "__repr__";
  437. static char __pyx_k____test__[] = "__test__";
  438. static char __pyx_k__strerror[] = "strerror";
  439. static char __pyx_k__Exception[] = "Exception";
  440. static char __pyx_k__ZMQBaseError[] = "ZMQBaseError";
  441. static char __pyx_k__ZMQBindError[] = "ZMQBindError";
  442. static PyObject *__pyx_kp_s_1;
  443. static PyObject *__pyx_n_s_3;
  444. static PyObject *__pyx_n_s_4;
  445. static PyObject *__pyx_kp_s_5;
  446. static PyObject *__pyx_kp_s_6;
  447. static PyObject *__pyx_kp_s_7;
  448. static PyObject *__pyx_kp_s_8;
  449. static PyObject *__pyx_n_s__Exception;
  450. static PyObject *__pyx_n_s__NotDone;
  451. static PyObject *__pyx_n_s__ZMQBaseError;
  452. static PyObject *__pyx_n_s__ZMQBindError;
  453. static PyObject *__pyx_n_s__ZMQError;
  454. static PyObject *__pyx_n_s____all__;
  455. static PyObject *__pyx_n_s____init__;
  456. static PyObject *__pyx_n_s____main__;
  457. static PyObject *__pyx_n_s____repr__;
  458. static PyObject *__pyx_n_s____str__;
  459. static PyObject *__pyx_n_s____test__;
  460. static PyObject *__pyx_n_s__bytes;
  461. static PyObject *__pyx_n_s__errno;
  462. static PyObject *__pyx_n_s__error;
  463. static PyObject *__pyx_n_s__self;
  464. static PyObject *__pyx_n_s__strerror;
  465. /* "zmq/core/error.pyx":36
  466. * from zmq.utils.strtypes import bytes
  467. *
  468. * def strerror(int errnum): # <<<<<<<<<<<<<<
  469. * """strerror(errnum)
  470. *
  471. */
  472. static PyObject *__pyx_pf_3zmq_4core_5error_strerror(PyObject *__pyx_self, PyObject *__pyx_arg_errnum); /*proto*/
  473. static char __pyx_doc_3zmq_4core_5error_strerror[] = "strerror(errnum)\n\n Return the error string given the error number.\n ";
  474. static PyMethodDef __pyx_mdef_3zmq_4core_5error_strerror = {__Pyx_NAMESTR("strerror"), (PyCFunction)__pyx_pf_3zmq_4core_5error_strerror, METH_O, __Pyx_DOCSTR(__pyx_doc_3zmq_4core_5error_strerror)};
  475. static PyObject *__pyx_pf_3zmq_4core_5error_strerror(PyObject *__pyx_self, PyObject *__pyx_arg_errnum) {
  476. int __pyx_v_errnum;
  477. const char* __pyx_v_str_e;
  478. PyObject *__pyx_r = NULL;
  479. __Pyx_RefNannyDeclarations
  480. PyObject *__pyx_t_1 = NULL;
  481. int __pyx_t_2;
  482. int __pyx_lineno = 0;
  483. const char *__pyx_filename = NULL;
  484. int __pyx_clineno = 0;
  485. __Pyx_RefNannySetupContext("strerror");
  486. __pyx_self = __pyx_self;
  487. assert(__pyx_arg_errnum); {
  488. __pyx_v_errnum = __Pyx_PyInt_AsInt(__pyx_arg_errnum); if (unlikely((__pyx_v_errnum == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  489. }
  490. goto __pyx_L4_argument_unpacking_done;
  491. __pyx_L3_error:;
  492. __Pyx_AddTraceback("zmq.core.error.strerror", __pyx_clineno, __pyx_lineno, __pyx_filename);
  493. __Pyx_RefNannyFinishContext();
  494. return NULL;
  495. __pyx_L4_argument_unpacking_done:;
  496. /* "zmq/core/error.pyx":43
  497. * cdef const_char_ptr str_e
  498. * # char * will be a bytes object:
  499. * with nogil: # <<<<<<<<<<<<<<
  500. * str_e = zmq_strerror(errnum)
  501. * if str is bytes:
  502. */
  503. {
  504. #ifdef WITH_THREAD
  505. PyThreadState *_save = NULL;
  506. #endif
  507. Py_UNBLOCK_THREADS
  508. /*try:*/ {
  509. /* "zmq/core/error.pyx":44
  510. * # char * will be a bytes object:
  511. * with nogil:
  512. * str_e = zmq_strerror(errnum) # <<<<<<<<<<<<<<
  513. * if str is bytes:
  514. * # Python 2: str is bytes, so we already have the right type
  515. */
  516. __pyx_v_str_e = zmq_strerror(__pyx_v_errnum);
  517. }
  518. /* "zmq/core/error.pyx":43
  519. * cdef const_char_ptr str_e
  520. * # char * will be a bytes object:
  521. * with nogil: # <<<<<<<<<<<<<<
  522. * str_e = zmq_strerror(errnum)
  523. * if str is bytes:
  524. */
  525. /*finally:*/ {
  526. Py_BLOCK_THREADS
  527. }
  528. }
  529. /* "zmq/core/error.pyx":45
  530. * with nogil:
  531. * str_e = zmq_strerror(errnum)
  532. * if str is bytes: # <<<<<<<<<<<<<<
  533. * # Python 2: str is bytes, so we already have the right type
  534. * return str_e
  535. */
  536. __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__bytes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  537. __Pyx_GOTREF(__pyx_t_1);
  538. __pyx_t_2 = (((PyObject*)(&PyString_Type)) == ((PyObject*)__pyx_t_1));
  539. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  540. if (__pyx_t_2) {
  541. /* "zmq/core/error.pyx":47
  542. * if str is bytes:
  543. * # Python 2: str is bytes, so we already have the right type
  544. * return str_e # <<<<<<<<<<<<<<
  545. * else:
  546. * # Python 3: decode bytes to unicode str
  547. */
  548. __Pyx_XDECREF(__pyx_r);
  549. __pyx_t_1 = PyBytes_FromString(__pyx_v_str_e); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  550. __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  551. __pyx_r = ((PyObject *)__pyx_t_1);
  552. __pyx_t_1 = 0;
  553. goto __pyx_L0;
  554. goto __pyx_L8;
  555. }
  556. /*else*/ {
  557. /* "zmq/core/error.pyx":50
  558. * else:
  559. * # Python 3: decode bytes to unicode str
  560. * return str_e.decode() # <<<<<<<<<<<<<<
  561. *
  562. *
  563. */
  564. __Pyx_XDECREF(__pyx_r);
  565. __pyx_t_1 = ((PyObject *)PyUnicode_Decode(__pyx_v_str_e, strlen(__pyx_v_str_e), NULL, NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  566. __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  567. __pyx_r = ((PyObject *)__pyx_t_1);
  568. __pyx_t_1 = 0;
  569. goto __pyx_L0;
  570. }
  571. __pyx_L8:;
  572. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  573. goto __pyx_L0;
  574. __pyx_L1_error:;
  575. __Pyx_XDECREF(__pyx_t_1);
  576. __Pyx_AddTraceback("zmq.core.error.strerror", __pyx_clineno, __pyx_lineno, __pyx_filename);
  577. __pyx_r = NULL;
  578. __pyx_L0:;
  579. __Pyx_XGIVEREF(__pyx_r);
  580. __Pyx_RefNannyFinishContext();
  581. return __pyx_r;
  582. }
  583. /* "zmq/core/error.pyx":68
  584. * """
  585. *
  586. * def __init__(self, error=None): # <<<<<<<<<<<<<<
  587. * """Wrap an errno style error.
  588. *
  589. */
  590. static PyObject *__pyx_pf_3zmq_4core_5error_8ZMQError___init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  591. static char __pyx_doc_3zmq_4core_5error_8ZMQError___init__[] = "Wrap an errno style error.\n\n Parameters\n ----------\n error : int\n The ZMQ errno or None. If None, then ``zmq_errno()`` is called and\n used.\n ";
  592. static PyMethodDef __pyx_mdef_3zmq_4core_5error_8ZMQError___init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pf_3zmq_4core_5error_8ZMQError___init__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4core_5error_8ZMQError___init__)};
  593. static PyObject *__pyx_pf_3zmq_4core_5error_8ZMQError___init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  594. PyObject *__pyx_v_self = 0;
  595. PyObject *__pyx_v_error = 0;
  596. int __pyx_v_errno;
  597. PyObject *__pyx_r = NULL;
  598. __Pyx_RefNannyDeclarations
  599. int __pyx_t_1;
  600. PyObject *__pyx_t_2 = NULL;
  601. PyObject *__pyx_t_3 = NULL;
  602. PyObject *__pyx_t_4 = NULL;
  603. int __pyx_t_5;
  604. int __pyx_lineno = 0;
  605. const char *__pyx_filename = NULL;
  606. int __pyx_clineno = 0;
  607. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__error,0};
  608. __Pyx_RefNannySetupContext("__init__");
  609. __pyx_self = __pyx_self;
  610. {
  611. PyObject* values[2] = {0,0};
  612. values[1] = ((PyObject *)Py_None);
  613. if (unlikely(__pyx_kwds)) {
  614. Py_ssize_t kw_args;
  615. switch (PyTuple_GET_SIZE(__pyx_args)) {
  616. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  617. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  618. case 0: break;
  619. default: goto __pyx_L5_argtuple_error;
  620. }
  621. kw_args = PyDict_Size(__pyx_kwds);
  622. switch (PyTuple_GET_SIZE(__pyx_args)) {
  623. case 0:
  624. values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
  625. if (likely(values[0])) kw_args--;
  626. else goto __pyx_L5_argtuple_error;
  627. case 1:
  628. if (kw_args > 0) {
  629. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__error);
  630. if (value) { values[1] = value; kw_args--; }
  631. }
  632. }
  633. if (unlikely(kw_args > 0)) {
  634. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  635. }
  636. } else {
  637. switch (PyTuple_GET_SIZE(__pyx_args)) {
  638. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  639. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  640. break;
  641. default: goto __pyx_L5_argtuple_error;
  642. }
  643. }
  644. __pyx_v_self = values[0];
  645. __pyx_v_error = values[1];
  646. }
  647. goto __pyx_L4_argument_unpacking_done;
  648. __pyx_L5_argtuple_error:;
  649. __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  650. __pyx_L3_error:;
  651. __Pyx_AddTraceback("zmq.core.error.ZMQError.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  652. __Pyx_RefNannyFinishContext();
  653. return NULL;
  654. __pyx_L4_argument_unpacking_done:;
  655. __Pyx_INCREF(__pyx_v_error);
  656. /* "zmq/core/error.pyx":78
  657. * """
  658. * cdef int errno
  659. * if error is None: # <<<<<<<<<<<<<<
  660. * with nogil:
  661. * errno = zmq_errno()
  662. */
  663. __pyx_t_1 = (__pyx_v_error == Py_None);
  664. if (__pyx_t_1) {
  665. /* "zmq/core/error.pyx":79
  666. * cdef int errno
  667. * if error is None:
  668. * with nogil: # <<<<<<<<<<<<<<
  669. * errno = zmq_errno()
  670. * error = errno
  671. */
  672. {
  673. #ifdef WITH_THREAD
  674. PyThreadState *_save = NULL;
  675. #endif
  676. Py_UNBLOCK_THREADS
  677. /*try:*/ {
  678. /* "zmq/core/error.pyx":80
  679. * if error is None:
  680. * with nogil:
  681. * errno = zmq_errno() # <<<<<<<<<<<<<<
  682. * error = errno
  683. * if type(error) == int:
  684. */
  685. __pyx_v_errno = zmq_errno();
  686. }
  687. /* "zmq/core/error.pyx":79
  688. * cdef int errno
  689. * if error is None:
  690. * with nogil: # <<<<<<<<<<<<<<
  691. * errno = zmq_errno()
  692. * error = errno
  693. */
  694. /*finally:*/ {
  695. Py_BLOCK_THREADS
  696. }
  697. }
  698. /* "zmq/core/error.pyx":81
  699. * with nogil:
  700. * errno = zmq_errno()
  701. * error = errno # <<<<<<<<<<<<<<
  702. * if type(error) == int:
  703. * self.strerror = strerror(error)
  704. */
  705. __pyx_t_2 = PyInt_FromLong(__pyx_v_errno); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  706. __Pyx_GOTREF(__pyx_t_2);
  707. __Pyx_DECREF(__pyx_v_error);
  708. __pyx_v_error = __pyx_t_2;
  709. __pyx_t_2 = 0;
  710. goto __pyx_L6;
  711. }
  712. __pyx_L6:;
  713. /* "zmq/core/error.pyx":82
  714. * errno = zmq_errno()
  715. * error = errno
  716. * if type(error) == int: # <<<<<<<<<<<<<<
  717. * self.strerror = strerror(error)
  718. * self.errno = error
  719. */
  720. __pyx_t_2 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_error)), ((PyObject *)((PyObject*)(&PyInt_Type))), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  721. __Pyx_GOTREF(__pyx_t_2);
  722. __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  723. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  724. if (__pyx_t_1) {
  725. /* "zmq/core/error.pyx":83
  726. * error = errno
  727. * if type(error) == int:
  728. * self.strerror = strerror(error) # <<<<<<<<<<<<<<
  729. * self.errno = error
  730. * else:
  731. */
  732. __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__strerror); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  733. __Pyx_GOTREF(__pyx_t_2);
  734. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  735. __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  736. __Pyx_INCREF(__pyx_v_error);
  737. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_error);
  738. __Pyx_GIVEREF(__pyx_v_error);
  739. __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  740. __Pyx_GOTREF(__pyx_t_4);
  741. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  742. __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  743. if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__strerror, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  744. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  745. /* "zmq/core/error.pyx":84
  746. * if type(error) == int:
  747. * self.strerror = strerror(error)
  748. * self.errno = error # <<<<<<<<<<<<<<
  749. * else:
  750. * self.strerror = str(error)
  751. */
  752. if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__errno, __pyx_v_error) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  753. goto __pyx_L10;
  754. }
  755. /*else*/ {
  756. /* "zmq/core/error.pyx":86
  757. * self.errno = error
  758. * else:
  759. * self.strerror = str(error) # <<<<<<<<<<<<<<
  760. * self.errno = None
  761. * # flush signals, because there could be a SIGINT
  762. */
  763. __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  764. __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  765. __Pyx_INCREF(__pyx_v_error);
  766. PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_error);
  767. __Pyx_GIVEREF(__pyx_v_error);
  768. __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  769. __Pyx_GOTREF(__pyx_t_3);
  770. __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  771. if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__strerror, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  772. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  773. /* "zmq/core/error.pyx":87
  774. * else:
  775. * self.strerror = str(error)
  776. * self.errno = None # <<<<<<<<<<<<<<
  777. * # flush signals, because there could be a SIGINT
  778. * # waiting to pounce, resulting in uncaught exceptions.
  779. */
  780. if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__errno, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  781. }
  782. __pyx_L10:;
  783. /* "zmq/core/error.pyx":92
  784. * # Doing this here means getting SIGINT during a blocking
  785. * # libzmq call will raise a *catchable* KeyboardInterrupt
  786. * PyErr_CheckSignals() # <<<<<<<<<<<<<<
  787. *
  788. * def __str__(self):
  789. */
  790. __pyx_t_5 = PyErr_CheckSignals(); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  791. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  792. goto __pyx_L0;
  793. __pyx_L1_error:;
  794. __Pyx_XDECREF(__pyx_t_2);
  795. __Pyx_XDECREF(__pyx_t_3);
  796. __Pyx_XDECREF(__pyx_t_4);
  797. __Pyx_AddTraceback("zmq.core.error.ZMQError.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  798. __pyx_r = NULL;
  799. __pyx_L0:;
  800. __Pyx_XDECREF(__pyx_v_error);
  801. __Pyx_XGIVEREF(__pyx_r);
  802. __Pyx_RefNannyFinishContext();
  803. return __pyx_r;
  804. }
  805. /* "zmq/core/error.pyx":94
  806. * PyErr_CheckSignals()
  807. *
  808. * def __str__(self): # <<<<<<<<<<<<<<
  809. * return self.strerror
  810. *
  811. */
  812. static PyObject *__pyx_pf_3zmq_4core_5error_8ZMQError_1__str__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
  813. static PyMethodDef __pyx_mdef_3zmq_4core_5error_8ZMQError_1__str__ = {__Pyx_NAMESTR("__str__"), (PyCFunction)__pyx_pf_3zmq_4core_5error_8ZMQError_1__str__, METH_O, __Pyx_DOCSTR(0)};
  814. static PyObject *__pyx_pf_3zmq_4core_5error_8ZMQError_1__str__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  815. PyObject *__pyx_r = NULL;
  816. __Pyx_RefNannyDeclarations
  817. PyObject *__pyx_t_1 = NULL;
  818. int __pyx_lineno = 0;
  819. const char *__pyx_filename = NULL;
  820. int __pyx_clineno = 0;
  821. __Pyx_RefNannySetupContext("__str__");
  822. __pyx_self = __pyx_self;
  823. /* "zmq/core/error.pyx":95
  824. *
  825. * def __str__(self):
  826. * return self.strerror # <<<<<<<<<<<<<<
  827. *
  828. * def __repr__(self):
  829. */
  830. __Pyx_XDECREF(__pyx_r);
  831. __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__strerror); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  832. __Pyx_GOTREF(__pyx_t_1);
  833. __pyx_r = __pyx_t_1;
  834. __pyx_t_1 = 0;
  835. goto __pyx_L0;
  836. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  837. goto __pyx_L0;
  838. __pyx_L1_error:;
  839. __Pyx_XDECREF(__pyx_t_1);
  840. __Pyx_AddTraceback("zmq.core.error.ZMQError.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  841. __pyx_r = NULL;
  842. __pyx_L0:;
  843. __Pyx_XGIVEREF(__pyx_r);
  844. __Pyx_RefNannyFinishContext();
  845. return __pyx_r;
  846. }
  847. /* "zmq/core/error.pyx":97
  848. * return self.strerror
  849. *
  850. * def __repr__(self): # <<<<<<<<<<<<<<
  851. * return "ZMQError('%s')"%self.strerror
  852. *
  853. */
  854. static PyObject *__pyx_pf_3zmq_4core_5error_8ZMQError_2__repr__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
  855. static PyMethodDef __pyx_mdef_3zmq_4core_5error_8ZMQError_2__repr__ = {__Pyx_NAMESTR("__repr__"), (PyCFunction)__pyx_pf_3zmq_4core_5error_8ZMQError_2__repr__, METH_O, __Pyx_DOCSTR(0)};
  856. static PyObject *__pyx_pf_3zmq_4core_5error_8ZMQError_2__repr__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  857. PyObject *__pyx_r = NULL;
  858. __Pyx_RefNannyDeclarations
  859. PyObject *__pyx_t_1 = NULL;
  860. PyObject *__pyx_t_2 = NULL;
  861. int __pyx_lineno = 0;
  862. const char *__pyx_filename = NULL;
  863. int __pyx_clineno = 0;
  864. __Pyx_RefNannySetupContext("__repr__");
  865. __pyx_self = __pyx_self;
  866. /* "zmq/core/error.pyx":98
  867. *
  868. * def __repr__(self):
  869. * return "ZMQError('%s')"%self.strerror # <<<<<<<<<<<<<<
  870. *
  871. *
  872. */
  873. __Pyx_XDECREF(__pyx_r);
  874. __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__strerror); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  875. __Pyx_GOTREF(__pyx_t_1);
  876. __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  877. __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  878. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  879. __pyx_r = ((PyObject *)__pyx_t_2);
  880. __pyx_t_2 = 0;
  881. goto __pyx_L0;
  882. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  883. goto __pyx_L0;
  884. __pyx_L1_error:;
  885. __Pyx_XDECREF(__pyx_t_1);
  886. __Pyx_XDECREF(__pyx_t_2);
  887. __Pyx_AddTraceback("zmq.core.error.ZMQError.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  888. __pyx_r = NULL;
  889. __pyx_L0:;
  890. __Pyx_XGIVEREF(__pyx_r);
  891. __Pyx_RefNannyFinishContext();
  892. return __pyx_r;
  893. }
  894. static PyMethodDef __pyx_methods[] = {
  895. {0, 0, 0, 0}
  896. };
  897. #if PY_MAJOR_VERSION >= 3
  898. static struct PyModuleDef __pyx_moduledef = {
  899. PyModuleDef_HEAD_INIT,
  900. __Pyx_NAMESTR("error"),
  901. __Pyx_DOCSTR(__pyx_k_2), /* m_doc */
  902. -1, /* m_size */
  903. __pyx_methods /* m_methods */,
  904. NULL, /* m_reload */
  905. NULL, /* m_traverse */
  906. NULL, /* m_clear */
  907. NULL /* m_free */
  908. };
  909. #endif
  910. static __Pyx_StringTabEntry __pyx_string_tab[] = {
  911. {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0},
  912. {&__pyx_n_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 1},
  913. {&__pyx_n_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 1},
  914. {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0},
  915. {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0},
  916. {&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0},
  917. {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0},
  918. {&__pyx_n_s__Exception, __pyx_k__Exception, sizeof(__pyx_k__Exception), 0, 0, 1, 1},
  919. {&__pyx_n_s__NotDone, __pyx_k__NotDone, sizeof(__pyx_k__NotDone), 0, 0, 1, 1},
  920. {&__pyx_n_s__ZMQBaseError, __pyx_k__ZMQBaseError, sizeof(__pyx_k__ZMQBaseError), 0, 0, 1, 1},
  921. {&__pyx_n_s__ZMQBindError, __pyx_k__ZMQBindError, sizeof(__pyx_k__ZMQBindError), 0, 0, 1, 1},
  922. {&__pyx_n_s__ZMQError, __pyx_k__ZMQError, sizeof(__pyx_k__ZMQError), 0, 0, 1, 1},
  923. {&__pyx_n_s____all__, __pyx_k____all__, sizeof(__pyx_k____all__), 0, 0, 1, 1},
  924. {&__pyx_n_s____init__, __pyx_k____init__, sizeof(__pyx_k____init__), 0, 0, 1, 1},
  925. {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
  926. {&__pyx_n_s____repr__, __pyx_k____repr__, sizeof(__pyx_k____repr__), 0, 0, 1, 1},
  927. {&__pyx_n_s____str__, __pyx_k____str__, sizeof(__pyx_k____str__), 0, 0, 1, 1},
  928. {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
  929. {&__pyx_n_s__bytes, __pyx_k__bytes, sizeof(__pyx_k__bytes), 0, 0, 1, 1},
  930. {&__pyx_n_s__errno, __pyx_k__errno, sizeof(__pyx_k__errno), 0, 0, 1, 1},
  931. {&__pyx_n_s__error, __pyx_k__error, sizeof(__pyx_k__error), 0, 0, 1, 1},
  932. {&__pyx_n_s__self, __pyx_k__self, sizeof(__pyx_k__self), 0, 0, 1, 1},
  933. {&__pyx_n_s__strerror, __pyx_k__strerror, sizeof(__pyx_k__strerror), 0, 0, 1, 1},
  934. {0, 0, 0, 0, 0, 0, 0}
  935. };
  936. static int __Pyx_InitCachedBuiltins(void) {
  937. __pyx_builtin_Exception = __Pyx_GetName(__pyx_b, __pyx_n_s__Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  938. return 0;
  939. __pyx_L1_error:;
  940. return -1;
  941. }
  942. static int __Pyx_InitCachedConstants(void) {
  943. __Pyx_RefNannyDeclarations
  944. __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants");
  945. __Pyx_RefNannyFinishContext();
  946. return 0;
  947. }
  948. static int __Pyx_InitGlobals(void) {
  949. if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  950. return 0;
  951. __pyx_L1_error:;
  952. return -1;
  953. }
  954. #if PY_MAJOR_VERSION < 3
  955. PyMODINIT_FUNC initerror(void); /*proto*/
  956. PyMODINIT_FUNC initerror(void)
  957. #else
  958. PyMODINIT_FUNC PyInit_error(void); /*proto*/
  959. PyMODINIT_FUNC PyInit_error(void)
  960. #endif
  961. {
  962. PyObject *__pyx_t_1 = NULL;
  963. PyObject *__pyx_t_2 = NULL;
  964. PyObject *__pyx_t_3 = NULL;
  965. __Pyx_RefNannyDeclarations
  966. #if CYTHON_REFNANNY
  967. __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  968. if (!__Pyx_RefNanny) {
  969. PyErr_Clear();
  970. __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
  971. if (!__Pyx_RefNanny)
  972. Py_FatalError("failed to import 'refnanny' module");
  973. }
  974. #endif
  975. __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_error(void)");
  976. if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  977. __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;}
  978. __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;}
  979. #ifdef __pyx_binding_PyCFunctionType_USED
  980. if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  981. #endif
  982. /*--- Library function declarations ---*/
  983. /*--- Threads initialization code ---*/
  984. #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  985. #ifdef WITH_THREAD /* Python build with threading support? */
  986. PyEval_InitThreads();
  987. #endif
  988. #endif
  989. /*--- Module creation code ---*/
  990. #if PY_MAJOR_VERSION < 3
  991. __pyx_m = Py_InitModule4(__Pyx_NAMESTR("error"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_2), 0, PYTHON_API_VERSION);
  992. #else
  993. __pyx_m = PyModule_Create(&__pyx_moduledef);
  994. #endif
  995. if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  996. #if PY_MAJOR_VERSION < 3
  997. Py_INCREF(__pyx_m);
  998. #endif
  999. __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME));
  1000. if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  1001. if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  1002. /*--- Initialize various global constants etc. ---*/
  1003. if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1004. if (__pyx_module_is_main_zmq__core__error) {
  1005. if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  1006. }
  1007. /*--- Builtin init code ---*/
  1008. if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1009. /*--- Constants init code ---*/
  1010. if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1011. /*--- Global init code ---*/
  1012. /*--- Variable export code ---*/
  1013. /*--- Function export code ---*/
  1014. /*--- Type init code ---*/
  1015. /*--- Type import code ---*/
  1016. __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), 0); if (unlikely(!__pyx_ptype_7cpython_4bool_bool)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1017. __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), 0); if (unlikely(!__pyx_ptype_7cpython_7complex_complex)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1018. /*--- Variable import code ---*/
  1019. /*--- Function import code ---*/
  1020. /*--- Execution code ---*/
  1021. /* "zmq/core/error.pyx":34
  1022. * from libzmq cimport zmq_strerror, zmq_errno
  1023. *
  1024. * from zmq.utils.strtypes import bytes # <<<<<<<<<<<<<<
  1025. *
  1026. * def strerror(int errnum):
  1027. */
  1028. __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1029. __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  1030. __Pyx_INCREF(((PyObject *)__pyx_n_s__bytes));
  1031. PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__bytes));
  1032. __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bytes));
  1033. __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s_3), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1034. __Pyx_GOTREF(__pyx_t_2);
  1035. __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  1036. __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__bytes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1037. __Pyx_GOTREF(__pyx_t_1);
  1038. if (PyObject_SetAttr(__pyx_m, __pyx_n_s__bytes, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1039. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1040. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  1041. /* "zmq/core/error.pyx":36
  1042. * from zmq.utils.strtypes import bytes
  1043. *
  1044. * def strerror(int errnum): # <<<<<<<<<<<<<<
  1045. * """strerror(errnum)
  1046. *
  1047. */
  1048. __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3zmq_4core_5error_strerror, NULL, __pyx_n_s_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1049. __Pyx_GOTREF(__pyx_t_2);
  1050. if (PyObject_SetAttr(__pyx_m, __pyx_n_s__strerror, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1051. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  1052. /* "zmq/core/error.pyx":53
  1053. *
  1054. *
  1055. * class ZMQBaseError(Exception): # <<<<<<<<<<<<<<
  1056. * """Base exception class for 0MQ errors in Python."""
  1057. * pass
  1058. */
  1059. __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1060. __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  1061. __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1062. __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  1063. __Pyx_INCREF(__pyx_builtin_Exception);
  1064. PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_builtin_Exception);
  1065. __Pyx_GIVEREF(__pyx_builtin_Exception);
  1066. if (PyDict_SetItemString(((PyObject *)__pyx_t_2), "__doc__", ((PyObject *)__pyx_kp_s_5)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1067. __pyx_t_3 = __Pyx_CreateClass(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_2), __pyx_n_s__ZMQBaseError, __pyx_n_s_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1068. __Pyx_GOTREF(__pyx_t_3);
  1069. __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  1070. if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ZMQBaseError, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1071. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  1072. __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  1073. /* "zmq/core/error.pyx":58
  1074. *
  1075. *
  1076. * class ZMQError(ZMQBaseError): # <<<<<<<<<<<<<<
  1077. * """Wrap an errno style error.
  1078. *
  1079. */
  1080. __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1081. __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  1082. /* "zmq/core/error.pyx":68
  1083. * """
  1084. *
  1085. * def __init__(self, error=None): # <<<<<<<<<<<<<<
  1086. * """Wrap an errno style error.
  1087. *
  1088. */
  1089. __pyx_t_3 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_3zmq_4core_5error_8ZMQError___init__, NULL, __pyx_n_s_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1090. __Pyx_GOTREF(__pyx_t_3);
  1091. if (PyObject_SetItem(__pyx_t_2, __pyx_n_s____init__, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1092. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  1093. /* "zmq/core/error.pyx":94
  1094. * PyErr_CheckSignals()
  1095. *
  1096. * def __str__(self): # <<<<<<<<<<<<<<
  1097. * return self.strerror
  1098. *
  1099. */
  1100. __pyx_t_3 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_3zmq_4core_5error_8ZMQError_1__str__, NULL, __pyx_n_s_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1101. __Pyx_GOTREF(__pyx_t_3);
  1102. if (PyObject_SetItem(__pyx_t_2, __pyx_n_s____str__, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1103. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  1104. /* "zmq/core/error.pyx":97
  1105. * return self.strerror
  1106. *
  1107. * def __repr__(self): # <<<<<<<<<<<<<<
  1108. * return "ZMQError('%s')"%self.strerror
  1109. *
  1110. */
  1111. __pyx_t_3 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_3zmq_4core_5error_8ZMQError_2__repr__, NULL, __pyx_n_s_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1112. __Pyx_GOTREF(__pyx_t_3);
  1113. if (PyObject_SetItem(__pyx_t_2, __pyx_n_s____repr__, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1114. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  1115. /* "zmq/core/error.pyx":58
  1116. *
  1117. *
  1118. * class ZMQError(ZMQBaseError): # <<<<<<<<<<<<<<
  1119. * """Wrap an errno style error.
  1120. *
  1121. */
  1122. __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQBaseError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1123. __Pyx_GOTREF(__pyx_t_3);
  1124. __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1125. __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  1126. PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
  1127. __Pyx_GIVEREF(__pyx_t_3);
  1128. __pyx_t_3 = 0;
  1129. if (PyDict_SetItemString(((PyObject *)__pyx_t_2), "__doc__", ((PyObject *)__pyx_kp_s_6)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1130. __pyx_t_3 = __Pyx_CreateClass(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_2), __pyx_n_s__ZMQError, __pyx_n_s_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1131. __Pyx_GOTREF(__pyx_t_3);
  1132. __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  1133. if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ZMQError, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1134. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  1135. __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  1136. /* "zmq/core/error.pyx":101
  1137. *
  1138. *
  1139. * class ZMQBindError(ZMQBaseError): # <<<<<<<<<<<<<<
  1140. * """An error for ``Socket.bind_to_random_port()``.
  1141. *
  1142. */
  1143. __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1144. __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  1145. __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQBaseError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1146. __Pyx_GOTREF(__pyx_t_3);
  1147. __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1148. __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  1149. PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
  1150. __Pyx_GIVEREF(__pyx_t_3);
  1151. __pyx_t_3 = 0;
  1152. if (PyDict_SetItemString(((PyObject *)__pyx_t_2), "__doc__", ((PyObject *)__pyx_kp_s_7)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1153. __pyx_t_3 = __Pyx_CreateClass(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_2), __pyx_n_s__ZMQBindError, __pyx_n_s_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1154. __Pyx_GOTREF(__pyx_t_3);
  1155. __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  1156. if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ZMQBindError, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1157. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  1158. __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  1159. /* "zmq/core/error.pyx":111
  1160. *
  1161. *
  1162. * class NotDone(ZMQBaseError): # <<<<<<<<<<<<<<
  1163. * """Raised when timeout is reached while waiting for 0MQ to finish with a Message
  1164. *
  1165. */
  1166. __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1167. __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  1168. __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQBaseError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1169. __Pyx_GOTREF(__pyx_t_3);
  1170. __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1171. __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  1172. PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
  1173. __Pyx_GIVEREF(__pyx_t_3);
  1174. __pyx_t_3 = 0;
  1175. if (PyDict_SetItemString(((PyObject *)__pyx_t_2), "__doc__", ((PyObject *)__pyx_kp_s_8)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1176. __pyx_t_3 = __Pyx_CreateClass(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_2), __pyx_n_s__NotDone, __pyx_n_s_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1177. __Pyx_GOTREF(__pyx_t_3);
  1178. __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  1179. if (PyObject_SetAttr(__pyx_m, __pyx_n_s__NotDone, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1180. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  1181. __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  1182. /* "zmq/core/error.pyx":121
  1183. *
  1184. *
  1185. * __all__ = ['strerror', 'ZMQBaseError', 'ZMQBindError', 'ZMQError', 'NotDone'] # <<<<<<<<<<<<<<
  1186. */
  1187. __pyx_t_2 = PyList_New(5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1188. __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  1189. __Pyx_INCREF(((PyObject *)__pyx_n_s__strerror));
  1190. PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__strerror));
  1191. __Pyx_GIVEREF(((PyObject *)__pyx_n_s__strerror));
  1192. __Pyx_INCREF(((PyObject *)__pyx_n_s__ZMQBaseError));
  1193. PyList_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__ZMQBaseError));
  1194. __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ZMQBaseError));
  1195. __Pyx_INCREF(((PyObject *)__pyx_n_s__ZMQBindError));
  1196. PyList_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_n_s__ZMQBindError));
  1197. __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ZMQBindError));
  1198. __Pyx_INCREF(((PyObject *)__pyx_n_s__ZMQError));
  1199. PyList_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_n_s__ZMQError));
  1200. __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ZMQError));
  1201. __Pyx_INCREF(((PyObject *)__pyx_n_s__NotDone));
  1202. PyList_SET_ITEM(__pyx_t_2, 4, ((PyObject *)__pyx_n_s__NotDone));
  1203. __Pyx_GIVEREF(((PyObject *)__pyx_n_s__NotDone));
  1204. if (PyObject_SetAttr(__pyx_m, __pyx_n_s____all__, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1205. __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  1206. /* "zmq/core/error.pyx":1
  1207. * """0MQ Error classes and functions.""" # <<<<<<<<<<<<<<
  1208. *
  1209. * #
  1210. */
  1211. __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;}
  1212. __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  1213. if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1214. __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  1215. goto __pyx_L0;
  1216. __pyx_L1_error:;
  1217. __Pyx_XDECREF(__pyx_t_1);
  1218. __Pyx_XDECREF(__pyx_t_2);
  1219. __Pyx_XDECREF(__pyx_t_3);
  1220. if (__pyx_m) {
  1221. __Pyx_AddTraceback("init zmq.core.error", __pyx_clineno, __pyx_lineno, __pyx_filename);
  1222. Py_DECREF(__pyx_m); __pyx_m = 0;
  1223. } else if (!PyErr_Occurred()) {
  1224. PyErr_SetString(PyExc_ImportError, "init zmq.core.error");
  1225. }
  1226. __pyx_L0:;
  1227. __Pyx_RefNannyFinishContext();
  1228. #if PY_MAJOR_VERSION < 3
  1229. return;
  1230. #else
  1231. return __pyx_m;
  1232. #endif
  1233. }
  1234. /* Runtime support code */
  1235. #if CYTHON_REFNANNY
  1236. static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
  1237. PyObject *m = NULL, *p = NULL;
  1238. void *r = NULL;
  1239. m = PyImport_ImportModule((char *)modname);
  1240. if (!m) goto end;
  1241. p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
  1242. if (!p) goto end;
  1243. r = PyLong_AsVoidPtr(p);
  1244. end:
  1245. Py_XDECREF(p);
  1246. Py_XDECREF(m);
  1247. return (__Pyx_RefNannyAPIStruct *)r;
  1248. }
  1249. #endif /* CYTHON_REFNANNY */
  1250. static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
  1251. PyObject *result;
  1252. result = PyObject_GetAttr(dict, name);
  1253. if (!result) {
  1254. if (dict != __pyx_b) {
  1255. PyErr_Clear();
  1256. result = PyObject_GetAttr(__pyx_b, name);
  1257. }
  1258. if (!result) {
  1259. PyErr_SetObject(PyExc_NameError, name);
  1260. }
  1261. }
  1262. return result;
  1263. }
  1264. static void __Pyx_RaiseDoubleKeywordsError(
  1265. const char* func_name,
  1266. PyObject* kw_name)
  1267. {
  1268. PyErr_Format(PyExc_TypeError,
  1269. #if PY_MAJOR_VERSION >= 3
  1270. "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
  1271. #else
  1272. "%s() got multiple values for keyword argument '%s'", func_name,
  1273. PyString_AS_STRING(kw_name));
  1274. #endif
  1275. }
  1276. static int __Pyx_ParseOptionalKeywords(
  1277. PyObject *kwds,
  1278. PyObject **argnames[],
  1279. PyObject *kwds2,
  1280. PyObject *values[],
  1281. Py_ssize_t num_pos_args,
  1282. const char* function_name)
  1283. {
  1284. PyObject *key = 0, *value = 0;
  1285. Py_ssize_t pos = 0;
  1286. PyObject*** name;
  1287. PyObject*** first_kw_arg = argnames + num_pos_args;
  1288. while (PyDict_Next(kwds, &pos, &key, &value)) {
  1289. name = first_kw_arg;
  1290. while (*name && (**name != key)) name++;
  1291. if (*name) {
  1292. values[name-argnames] = value;
  1293. } else {
  1294. #if PY_MAJOR_VERSION < 3
  1295. if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) {
  1296. #else
  1297. if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) {
  1298. #endif
  1299. goto invalid_keyword_type;
  1300. } else {
  1301. for (name = first_kw_arg; *name; name++) {
  1302. #if PY_MAJOR_VERSION >= 3
  1303. if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
  1304. PyUnicode_Compare(**name, key) == 0) break;
  1305. #else
  1306. if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
  1307. _PyString_Eq(**name, key)) break;
  1308. #endif
  1309. }
  1310. if (*name) {
  1311. values[name-argnames] = value;
  1312. } else {
  1313. /* unexpected keyword found */
  1314. for (name=argnames; name != first_kw_arg; name++) {
  1315. if (**name == key) goto arg_passed_twice;
  1316. #if PY_MAJOR_VERSION >= 3
  1317. if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
  1318. PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice;
  1319. #else
  1320. if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
  1321. _PyString_Eq(**name, key)) goto arg_passed_twice;
  1322. #endif
  1323. }
  1324. if (kwds2) {
  1325. if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
  1326. } else {
  1327. goto invalid_keyword;
  1328. }
  1329. }
  1330. }
  1331. }
  1332. }
  1333. return 0;
  1334. arg_passed_twice:
  1335. __Pyx_RaiseDoubleKeywordsError(function_name, **name);
  1336. goto bad;
  1337. invalid_keyword_type:
  1338. PyErr_Format(PyExc_TypeError,
  1339. "%s() keywords must be strings", function_name);
  1340. goto bad;
  1341. invalid_keyword:
  1342. PyErr_Format(PyExc_TypeError,
  1343. #if PY_MAJOR_VERSION < 3
  1344. "%s() got an unexpected keyword argument '%s'",
  1345. function_name, PyString_AsString(key));
  1346. #else
  1347. "%s() got an unexpected keyword argument '%U'",
  1348. function_name, key);
  1349. #endif
  1350. bad:
  1351. return -1;
  1352. }
  1353. static void __Pyx_RaiseArgtupleInvalid(
  1354. const char* func_name,
  1355. int exact,
  1356. Py_ssize_t num_min,
  1357. Py_ssize_t num_max,
  1358. Py_ssize_t num_found)
  1359. {
  1360. Py_ssize_t num_expected;
  1361. const char *more_or_less;
  1362. if (num_found < num_min) {
  1363. num_expected = num_min;
  1364. more_or_less = "at least";
  1365. } else {
  1366. num_expected = num_max;
  1367. more_or_less = "at most";
  1368. }
  1369. if (exact) {
  1370. more_or_less = "exactly";
  1371. }
  1372. PyErr_Format(PyExc_TypeError,
  1373. "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)",
  1374. func_name, more_or_less, num_expected,
  1375. (num_expected == 1) ? "" : "s", num_found);
  1376. }
  1377. static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) {
  1378. PyObject *py_import = 0;
  1379. PyObject *empty_list = 0;
  1380. PyObject *module = 0;
  1381. PyObject *global_dict = 0;
  1382. PyObject *empty_dict = 0;
  1383. PyObject *list;
  1384. py_import = __Pyx_GetAttrString(__pyx_b, "__import__");
  1385. if (!py_import)
  1386. goto bad;
  1387. if (from_list)
  1388. list = from_list;
  1389. else {
  1390. empty_list = PyList_New(0);
  1391. if (!empty_list)
  1392. goto bad;
  1393. list = empty_list;
  1394. }
  1395. global_dict = PyModule_GetDict(__pyx_m);
  1396. if (!global_dict)
  1397. goto bad;
  1398. empty_dict = PyDict_New();
  1399. if (!empty_dict)
  1400. goto bad;
  1401. #if PY_VERSION_HEX >= 0x02050000
  1402. {
  1403. PyObject *py_level = PyInt_FromLong(level);
  1404. if (!py_level)
  1405. goto bad;
  1406. module = PyObject_CallFunctionObjArgs(py_import,
  1407. name, global_dict, empty_dict, list, py_level, NULL);
  1408. Py_DECREF(py_level);
  1409. }
  1410. #else
  1411. if (level>0) {
  1412. PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4.");
  1413. goto bad;
  1414. }
  1415. module = PyObject_CallFunctionObjArgs(py_import,
  1416. name, global_dict, empty_dict, list, NULL);
  1417. #endif
  1418. bad:
  1419. Py_XDECREF(empty_list);
  1420. Py_XDECREF(py_import);
  1421. Py_XDECREF(empty_dict);
  1422. return module;
  1423. }
  1424. static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases) {
  1425. PyObject *metaclass;
  1426. /* Default metaclass */
  1427. #if PY_MAJOR_VERSION < 3
  1428. if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
  1429. PyObject *base = PyTuple_GET_ITEM(bases, 0);
  1430. metaclass = PyObject_GetAttrString(base, (char *)"__class__");
  1431. if (!metaclass) {
  1432. PyErr_Clear();
  1433. metaclass = (PyObject*) Py_TYPE(base);
  1434. }
  1435. } else {
  1436. metaclass = (PyObject *) &PyClass_Type;
  1437. }
  1438. #else
  1439. if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
  1440. PyObject *base = PyTuple_GET_ITEM(bases, 0);
  1441. metaclass = (PyObject*) Py_TYPE(base);
  1442. } else {
  1443. metaclass = (PyObject *) &PyType_Type;
  1444. }
  1445. #endif
  1446. Py_INCREF(metaclass);
  1447. return metaclass;
  1448. }
  1449. static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
  1450. PyObject *modname) {
  1451. PyObject *result;
  1452. PyObject *metaclass;
  1453. if (PyDict_SetItemString(dict, "__module__", modname) < 0)
  1454. return NULL;
  1455. /* Python2 __metaclass__ */
  1456. metaclass = PyDict_GetItemString(dict, "__metaclass__");
  1457. if (metaclass) {
  1458. Py_INCREF(metaclass);
  1459. } else {
  1460. metaclass = __Pyx_FindPy2Metaclass(bases);
  1461. }
  1462. result = PyObject_CallFunctionObjArgs(metaclass, name, bases, dict, NULL);
  1463. Py_DECREF(metaclass);
  1464. return result;
  1465. }
  1466. static PyObject *__pyx_binding_PyCFunctionType_NewEx(PyMethodDef *ml, PyObject *self, PyObject *module) {
  1467. __pyx_binding_PyCFunctionType_object *op = PyObject_GC_New(__pyx_binding_PyCFunctionType_object, __pyx_binding_PyCFunctionType);
  1468. if (op == NULL)
  1469. return NULL;
  1470. op->func.m_ml = ml;
  1471. Py_XINCREF(self);
  1472. op->func.m_self = self;
  1473. Py_XINCREF(module);
  1474. op->func.m_module = module;
  1475. PyObject_GC_Track(op);
  1476. return (PyObject *)op;
  1477. }
  1478. static void __pyx_binding_PyCFunctionType_dealloc(__pyx_binding_PyCFunctionType_object *m) {
  1479. PyObject_GC_UnTrack(m);
  1480. Py_XDECREF(m->func.m_self);
  1481. Py_XDECREF(m->func.m_module);
  1482. PyObject_GC_Del(m);
  1483. }
  1484. static PyObject *__pyx_binding_PyCFunctionType_descr_get(PyObject *func, PyObject *obj, PyObject *type) {
  1485. if (obj == Py_None)
  1486. obj = NULL;
  1487. return PyMethod_New(func, obj, type);
  1488. }
  1489. static int __pyx_binding_PyCFunctionType_init(void) {
  1490. __pyx_binding_PyCFunctionType_type = PyCFunction_Type;
  1491. __pyx_binding_PyCFunctionType_type.tp_name = __Pyx_NAMESTR("cython_binding_builtin_function_or_method");
  1492. __pyx_binding_PyCFunctionType_type.tp_dealloc = (destructor)__pyx_binding_PyCFunctionType_dealloc;
  1493. __pyx_binding_PyCFunctionType_type.tp_descr_get = __pyx_binding_PyCFunctionType_descr_get;
  1494. if (PyType_Ready(&__pyx_binding_PyCFunctionType_type) < 0) {
  1495. return -1;
  1496. }
  1497. __pyx_binding_PyCFunctionType = &__pyx_binding_PyCFunctionType_type;
  1498. return 0;
  1499. }
  1500. static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
  1501. const unsigned char neg_one = (unsigned char)-1, const_zero = 0;
  1502. const int is_unsigned = neg_one > const_zero;
  1503. if (sizeof(unsigned char) < sizeof(long)) {
  1504. long val = __Pyx_PyInt_AsLong(x);
  1505. if (unlikely(val != (long)(unsigned char)val)) {
  1506. if (!unlikely(val == -1 && PyErr_Occurred())) {
  1507. PyErr_SetString(PyExc_OverflowError,
  1508. (is_unsigned && unlikely(val < 0)) ?
  1509. "can't convert negative value to unsigned char" :
  1510. "value too large to convert to unsigned char");
  1511. }
  1512. return (unsigned char)-1;
  1513. }
  1514. return (unsigned char)val;
  1515. }
  1516. return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x);
  1517. }
  1518. static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) {
  1519. const unsigned short neg_one = (unsigned short)-1, const_zero = 0;
  1520. const int is_unsigned = neg_one > const_zero;
  1521. if (sizeof(unsigned short) < sizeof(long)) {
  1522. long val = __Pyx_PyInt_AsLong(x);
  1523. if (unlikely(val != (long)(unsigned short)val)) {
  1524. if (!unlikely(val == -1 && PyErr_Occurred())) {
  1525. PyErr_SetString(PyExc_OverflowError,
  1526. (is_unsigned && unlikely(val < 0)) ?
  1527. "can't convert negative value to unsigned short" :
  1528. "value too large to convert to unsigned short");
  1529. }
  1530. return (unsigned short)-1;
  1531. }
  1532. return (unsigned short)val;
  1533. }
  1534. return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x);
  1535. }
  1536. static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) {
  1537. const unsigned int neg_one = (unsigned int)-1, const_zero = 0;
  1538. const int is_unsigned = neg_one > const_zero;
  1539. if (sizeof(unsigned int) < sizeof(long)) {
  1540. long val = __Pyx_PyInt_AsLong(x);
  1541. if (unlikely(val != (long)(unsigned int)val)) {
  1542. if (!unlikely(val == -1 && PyErr_Occurred())) {
  1543. PyErr_SetString(PyExc_OverflowError,
  1544. (is_unsigned && unlikely(val < 0)) ?
  1545. "can't convert negative value to unsigned int" :
  1546. "value too large to convert to unsigned int");
  1547. }
  1548. return (unsigned int)-1;
  1549. }
  1550. return (unsigned int)val;
  1551. }
  1552. return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x);
  1553. }
  1554. static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) {
  1555. const char neg_one = (char)-1, const_zero = 0;
  1556. const int is_unsigned = neg_one > const_zero;
  1557. if (sizeof(char) < sizeof(long)) {
  1558. long val = __Pyx_PyInt_AsLong(x);
  1559. if (unlikely(val != (long)(char)val)) {
  1560. if (!unlikely(val == -1 && PyErr_Occurred())) {
  1561. PyErr_SetString(PyExc_OverflowError,
  1562. (is_unsigned && unlikely(val < 0)) ?
  1563. "can't convert negative value to char" :
  1564. "value too large to convert to char");
  1565. }
  1566. return (char)-1;
  1567. }
  1568. return (char)val;
  1569. }
  1570. return (char)__Pyx_PyInt_AsLong(x);
  1571. }
  1572. static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) {
  1573. const short neg_one = (short)-1, const_zero = 0;
  1574. const int is_unsigned = neg_one > const_zero;
  1575. if (sizeof(short) < sizeof(long)) {
  1576. long val = __Pyx_PyInt_AsLong(x);
  1577. if (unlikely(val != (long)(short)val)) {
  1578. if (!unlikely(val == -1 && PyErr_Occurred())) {
  1579. PyErr_SetString(PyExc_OverflowError,
  1580. (is_unsigned && unlikely(val < 0)) ?
  1581. "can't convert negative value to short" :
  1582. "value too large to convert to short");
  1583. }
  1584. return (short)-1;
  1585. }
  1586. return (short)val;
  1587. }
  1588. return (short)__Pyx_PyInt_AsLong(x);
  1589. }
  1590. static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) {
  1591. const int neg_one = (int)-1, const_zero = 0;
  1592. const int is_unsigned = neg_one > const_zero;
  1593. if (sizeof(int) < sizeof(long)) {
  1594. long val = __Pyx_PyInt_AsLong(x);
  1595. if (unlikely(val != (long)(int)val)) {
  1596. if (!unlikely(val == -1 && PyErr_Occurred())) {
  1597. PyErr_SetString(PyExc_OverflowError,
  1598. (is_unsigned && unlikely(val < 0)) ?
  1599. "can't convert negative value to int" :
  1600. "value too large to convert to int");
  1601. }
  1602. return (int)-1;
  1603. }
  1604. return (int)val;
  1605. }
  1606. return (int)__Pyx_PyInt_AsLong(x);
  1607. }
  1608. static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) {
  1609. const signed char neg_one = (signed char)-1, const_zero = 0;
  1610. const int is_unsigned = neg_one > const_zero;
  1611. if (sizeof(signed char) < sizeof(long)) {
  1612. long val = __Pyx_PyInt_AsLong(x);
  1613. if (unlikely(val != (long)(signed char)val)) {
  1614. if (!unlikely(val == -1 && PyErr_Occurred())) {
  1615. PyErr_SetString(PyExc_OverflowError,
  1616. (is_unsigned && unlikely(val < 0)) ?
  1617. "can't convert negative value to signed char" :
  1618. "value too large to convert to signed char");
  1619. }
  1620. return (signed char)-1;
  1621. }
  1622. return (signed char)val;
  1623. }
  1624. return (signed char)__Pyx_PyInt_AsSignedLong(x);
  1625. }
  1626. static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) {
  1627. const signed short neg_one = (signed short)-1, const_zero = 0;
  1628. const int is_unsigned = neg_one > const_zero;
  1629. if (sizeof(signed short) < sizeof(long)) {
  1630. long val = __Pyx_PyInt_AsLong(x);
  1631. if (unlikely(val != (long)(signed short)val)) {
  1632. if (!unlikely(val == -1 && PyErr_Occurred())) {
  1633. PyErr_SetString(PyExc_OverflowError,
  1634. (is_unsigned && unlikely(val < 0)) ?
  1635. "can't convert negative value to signed short" :
  1636. "value too large to convert to signed short");
  1637. }
  1638. return (signed short)-1;
  1639. }
  1640. return (signed short)val;
  1641. }
  1642. return (signed short)__Pyx_PyInt_AsSignedLong(x);
  1643. }
  1644. static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) {
  1645. const signed int neg_one = (signed int)-1, const_zero = 0;
  1646. const int is_unsigned = neg_one > const_zero;
  1647. if (sizeof(signed int) < sizeof(long)) {
  1648. long val = __Pyx_PyInt_AsLong(x);
  1649. if (unlikely(val != (long)(signed int)val)) {
  1650. if (!unlikely(val == -1 && PyErr_Occurred())) {
  1651. PyErr_SetString(PyExc_OverflowError,
  1652. (is_unsigned && unlikely(val < 0)) ?
  1653. "can't convert negative value to signed int" :
  1654. "value too large to convert to signed int");
  1655. }
  1656. return (signed int)-1;
  1657. }
  1658. return (signed int)val;
  1659. }
  1660. return (signed int)__Pyx_PyInt_AsSignedLong(x);
  1661. }
  1662. static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) {
  1663. const int neg_one = (int)-1, const_zero = 0;
  1664. const int is_unsigned = neg_one > const_zero;
  1665. if (sizeof(int) < sizeof(long)) {
  1666. long val = __Pyx_PyInt_AsLong(x);
  1667. if (unlikely(val != (long)(int)val)) {
  1668. if (!unlikely(val == -1 && PyErr_Occurred())) {
  1669. PyErr_SetString(PyExc_OverflowError,
  1670. (is_unsigned && unlikely(val < 0)) ?
  1671. "can't convert negative value to int" :
  1672. "value too large to convert to int");
  1673. }
  1674. return (int)-1;
  1675. }
  1676. return (int)val;
  1677. }
  1678. return (int)__Pyx_PyInt_AsLong(x);
  1679. }
  1680. static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
  1681. const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
  1682. const int is_unsigned = neg_one > const_zero;
  1683. #if PY_VERSION_HEX < 0x03000000
  1684. if (likely(PyInt_Check(x))) {
  1685. long val = PyInt_AS_LONG(x);
  1686. if (is_unsigned && unlikely(val < 0)) {
  1687. PyErr_SetString(PyExc_OverflowError,
  1688. "can't convert negative value to unsigned long");
  1689. return (unsigned long)-1;
  1690. }
  1691. return (unsigned long)val;
  1692. } else
  1693. #endif
  1694. if (likely(PyLong_Check(x))) {
  1695. if (is_unsigned) {
  1696. if (unlikely(Py_SIZE(x) < 0)) {
  1697. PyErr_SetString(PyExc_OverflowError,
  1698. "can't convert negative value to unsigned long");
  1699. return (unsigned long)-1;
  1700. }
  1701. return (unsigned long)PyLong_AsUnsignedLong(x);
  1702. } else {
  1703. return (unsigned long)PyLong_AsLong(x);
  1704. }
  1705. } else {
  1706. unsigned long val;
  1707. PyObject *tmp = __Pyx_PyNumber_Int(x);
  1708. if (!tmp) return (unsigned long)-1;
  1709. val = __Pyx_PyInt_AsUnsignedLong(tmp);
  1710. Py_DECREF(tmp);
  1711. return val;
  1712. }
  1713. }
  1714. static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
  1715. const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
  1716. const int is_unsigned = neg_one > const_zero;
  1717. #if PY_VERSION_HEX < 0x03000000
  1718. if (likely(PyInt_Check(x))) {
  1719. long val = PyInt_AS_LONG(x);
  1720. if (is_unsigned && unlikely(val < 0)) {
  1721. PyErr_SetString(PyExc_OverflowError,
  1722. "can't convert negative value to unsigned PY_LONG_LONG");
  1723. return (unsigned PY_LONG_LONG)-1;
  1724. }
  1725. return (unsigned PY_LONG_LONG)val;
  1726. } else
  1727. #endif
  1728. if (likely(PyLong_Check(x))) {
  1729. if (is_unsigned) {
  1730. if (unlikely(Py_SIZE(x) < 0)) {
  1731. PyErr_SetString(PyExc_OverflowError,
  1732. "can't convert negative value to unsigned PY_LONG_LONG");
  1733. return (unsigned PY_LONG_LONG)-1;
  1734. }
  1735. return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
  1736. } else {
  1737. return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x);
  1738. }
  1739. } else {
  1740. unsigned PY_LONG_LONG val;
  1741. PyObject *tmp = __Pyx_PyNumber_Int(x);
  1742. if (!tmp) return (unsigned PY_LONG_LONG)-1;
  1743. val = __Pyx_PyInt_AsUnsignedLongLong(tmp);
  1744. Py_DECREF(tmp);
  1745. return val;
  1746. }
  1747. }
  1748. static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
  1749. const long neg_one = (long)-1, const_zero = 0;
  1750. const int is_unsigned = neg_one > const_zero;
  1751. #if PY_VERSION_HEX < 0x03000000
  1752. if (likely(PyInt_Check(x))) {
  1753. long val = PyInt_AS_LONG(x);
  1754. if (is_unsigned && unlikely(val < 0)) {
  1755. PyErr_SetString(PyExc_OverflowError,
  1756. "can't convert negative value to long");
  1757. return (long)-1;
  1758. }
  1759. return (long)val;
  1760. } else
  1761. #endif
  1762. if (likely(PyLong_Check(x))) {
  1763. if (is_unsigned) {
  1764. if (unlikely(Py_SIZE(x) < 0)) {
  1765. PyErr_SetString(PyExc_OverflowError,
  1766. "can't convert negative value to long");
  1767. return (long)-1;
  1768. }
  1769. return (long)PyLong_AsUnsignedLong(x);
  1770. } else {
  1771. return (long)PyLong_AsLong(x);
  1772. }
  1773. } else {
  1774. long val;
  1775. PyObject *tmp = __Pyx_PyNumber_Int(x);
  1776. if (!tmp) return (long)-1;
  1777. val = __Pyx_PyInt_AsLong(tmp);
  1778. Py_DECREF(tmp);
  1779. return val;
  1780. }
  1781. }
  1782. static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
  1783. const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
  1784. const int is_unsigned = neg_one > const_zero;
  1785. #if PY_VERSION_HEX < 0x03000000
  1786. if (likely(PyInt_Check(x))) {
  1787. long val = PyInt_AS_LONG(x);
  1788. if (is_unsigned && unlikely(val < 0)) {
  1789. PyErr_SetString(PyExc_OverflowError,
  1790. "can't convert negative value to PY_LONG_LONG");
  1791. return (PY_LONG_LONG)-1;
  1792. }
  1793. return (PY_LONG_LONG)val;
  1794. } else
  1795. #endif
  1796. if (likely(PyLong_Check(x))) {
  1797. if (is_unsigned) {
  1798. if (unlikely(Py_SIZE(x) < 0)) {
  1799. PyErr_SetString(PyExc_OverflowError,
  1800. "can't convert negative value to PY_LONG_LONG");
  1801. return (PY_LONG_LONG)-1;
  1802. }
  1803. return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
  1804. } else {
  1805. return (PY_LONG_LONG)PyLong_AsLongLong(x);
  1806. }
  1807. } else {
  1808. PY_LONG_LONG val;
  1809. PyObject *tmp = __Pyx_PyNumber_Int(x);
  1810. if (!tmp) return (PY_LONG_LONG)-1;
  1811. val = __Pyx_PyInt_AsLongLong(tmp);
  1812. Py_DECREF(tmp);
  1813. return val;
  1814. }
  1815. }
  1816. static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
  1817. const signed long neg_one = (signed long)-1, const_zero = 0;
  1818. const int is_unsigned = neg_one > const_zero;
  1819. #if PY_VERSION_HEX < 0x03000000
  1820. if (likely(PyInt_Check(x))) {
  1821. long val = PyInt_AS_LONG(x);
  1822. if (is_unsigned && unlikely(val < 0)) {
  1823. PyErr_SetString(PyExc_OverflowError,
  1824. "can't convert negative value to signed long");
  1825. return (signed long)-1;
  1826. }
  1827. return (signed long)val;
  1828. } else
  1829. #endif
  1830. if (likely(PyLong_Check(x))) {
  1831. if (is_unsigned) {
  1832. if (unlikely(Py_SIZE(x) < 0)) {
  1833. PyErr_SetString(PyExc_OverflowError,
  1834. "can't convert negative value to signed long");
  1835. return (signed long)-1;
  1836. }
  1837. return (signed long)PyLong_AsUnsignedLong(x);
  1838. } else {
  1839. return (signed long)PyLong_AsLong(x);
  1840. }
  1841. } else {
  1842. signed long val;
  1843. PyObject *tmp = __Pyx_PyNumber_Int(x);
  1844. if (!tmp) return (signed long)-1;
  1845. val = __Pyx_PyInt_AsSignedLong(tmp);
  1846. Py_DECREF(tmp);
  1847. return val;
  1848. }
  1849. }
  1850. static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
  1851. const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
  1852. const int is_unsigned = neg_one > const_zero;
  1853. #if PY_VERSION_HEX < 0x03000000
  1854. if (likely(PyInt_Check(x))) {
  1855. long val = PyInt_AS_LONG(x);
  1856. if (is_unsigned && unlikely(val < 0)) {
  1857. PyErr_SetString(PyExc_OverflowError,
  1858. "can't convert negative value to signed PY_LONG_LONG");
  1859. return (signed PY_LONG_LONG)-1;
  1860. }
  1861. return (signed PY_LONG_LONG)val;
  1862. } else
  1863. #endif
  1864. if (likely(PyLong_Check(x))) {
  1865. if (is_unsigned) {
  1866. if (unlikely(Py_SIZE(x) < 0)) {
  1867. PyErr_SetString(PyExc_OverflowError,
  1868. "can't convert negative value to signed PY_LONG_LONG");
  1869. return (signed PY_LONG_LONG)-1;
  1870. }
  1871. return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
  1872. } else {
  1873. return (signed PY_LONG_LONG)PyLong_AsLongLong(x);
  1874. }
  1875. } else {
  1876. signed PY_LONG_LONG val;
  1877. PyObject *tmp = __Pyx_PyNumber_Int(x);
  1878. if (!tmp) return (signed PY_LONG_LONG)-1;
  1879. val = __Pyx_PyInt_AsSignedLongLong(tmp);
  1880. Py_DECREF(tmp);
  1881. return val;
  1882. }
  1883. }
  1884. static int __Pyx_check_binary_version(void) {
  1885. char ctversion[4], rtversion[4];
  1886. PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
  1887. PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
  1888. if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
  1889. char message[200];
  1890. PyOS_snprintf(message, sizeof(message),
  1891. "compiletime version %s of module '%.100s' "
  1892. "does not match runtime version %s",
  1893. ctversion, __Pyx_MODULE_NAME, rtversion);
  1894. #if PY_VERSION_HEX < 0x02050000
  1895. return PyErr_Warn(NULL, message);
  1896. #else
  1897. return PyErr_WarnEx(NULL, message, 1);
  1898. #endif
  1899. }
  1900. return 0;
  1901. }
  1902. #ifndef __PYX_HAVE_RT_ImportType
  1903. #define __PYX_HAVE_RT_ImportType
  1904. static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
  1905. size_t size, int strict)
  1906. {
  1907. PyObject *py_module = 0;
  1908. PyObject *result = 0;
  1909. PyObject *py_name = 0;
  1910. char warning[200];
  1911. py_module = __Pyx_ImportModule(module_name);
  1912. if (!py_module)
  1913. goto bad;
  1914. #if PY_MAJOR_VERSION < 3
  1915. py_name = PyString_FromString(class_name);
  1916. #else
  1917. py_name = PyUnicode_FromString(class_name);
  1918. #endif
  1919. if (!py_name)
  1920. goto bad;
  1921. result = PyObject_GetAttr(py_module, py_name);
  1922. Py_DECREF(py_name);
  1923. py_name = 0;
  1924. Py_DECREF(py_module);
  1925. py_module = 0;
  1926. if (!result)
  1927. goto bad;
  1928. if (!PyType_Check(result)) {
  1929. PyErr_Format(PyExc_TypeError,
  1930. "%s.%s is not a type object",
  1931. module_name, class_name);
  1932. goto bad;
  1933. }
  1934. if (!strict && ((PyTypeObject *)result)->tp_basicsize > (Py_ssize_t)size) {
  1935. PyOS_snprintf(warning, sizeof(warning),
  1936. "%s.%s size changed, may indicate binary incompatibility",
  1937. module_name, class_name);
  1938. #if PY_VERSION_HEX < 0x02050000
  1939. if (PyErr_Warn(NULL, warning) < 0) goto bad;
  1940. #else
  1941. if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
  1942. #endif
  1943. }
  1944. else if (((PyTypeObject *)result)->tp_basicsize != (Py_ssize_t)size) {
  1945. PyErr_Format(PyExc_ValueError,
  1946. "%s.%s has the wrong size, try recompiling",
  1947. module_name, class_name);
  1948. goto bad;
  1949. }
  1950. return (PyTypeObject *)result;
  1951. bad:
  1952. Py_XDECREF(py_module);
  1953. Py_XDECREF(result);
  1954. return NULL;
  1955. }
  1956. #endif
  1957. #ifndef __PYX_HAVE_RT_ImportModule
  1958. #define __PYX_HAVE_RT_ImportModule
  1959. static PyObject *__Pyx_ImportModule(const char *name) {
  1960. PyObject *py_name = 0;
  1961. PyObject *py_module = 0;
  1962. #if PY_MAJOR_VERSION < 3
  1963. py_name = PyString_FromString(name);
  1964. #else
  1965. py_name = PyUnicode_FromString(name);
  1966. #endif
  1967. if (!py_name)
  1968. goto bad;
  1969. py_module = PyImport_Import(py_name);
  1970. Py_DECREF(py_name);
  1971. return py_module;
  1972. bad:
  1973. Py_XDECREF(py_name);
  1974. return 0;
  1975. }
  1976. #endif
  1977. #include "compile.h"
  1978. #include "frameobject.h"
  1979. #include "traceback.h"
  1980. static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno,
  1981. int __pyx_lineno, const char *__pyx_filename) {
  1982. PyObject *py_srcfile = 0;
  1983. PyObject *py_funcname = 0;
  1984. PyObject *py_globals = 0;
  1985. PyCodeObject *py_code = 0;
  1986. PyFrameObject *py_frame = 0;
  1987. #if PY_MAJOR_VERSION < 3
  1988. py_srcfile = PyString_FromString(__pyx_filename);
  1989. #else
  1990. py_srcfile = PyUnicode_FromString(__pyx_filename);
  1991. #endif
  1992. if (!py_srcfile) goto bad;
  1993. if (__pyx_clineno) {
  1994. #if PY_MAJOR_VERSION < 3
  1995. py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
  1996. #else
  1997. py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
  1998. #endif
  1999. }
  2000. else {
  2001. #if PY_MAJOR_VERSION < 3
  2002. py_funcname = PyString_FromString(funcname);
  2003. #else
  2004. py_funcname = PyUnicode_FromString(funcname);
  2005. #endif
  2006. }
  2007. if (!py_funcname) goto bad;
  2008. py_globals = PyModule_GetDict(__pyx_m);
  2009. if (!py_globals) goto bad;
  2010. py_code = PyCode_New(
  2011. 0, /*int argcount,*/
  2012. #if PY_MAJOR_VERSION >= 3
  2013. 0, /*int kwonlyargcount,*/
  2014. #endif
  2015. 0, /*int nlocals,*/
  2016. 0, /*int stacksize,*/
  2017. 0, /*int flags,*/
  2018. __pyx_empty_bytes, /*PyObject *code,*/
  2019. __pyx_empty_tuple, /*PyObject *consts,*/
  2020. __pyx_empty_tuple, /*PyObject *names,*/
  2021. __pyx_empty_tuple, /*PyObject *varnames,*/
  2022. __pyx_empty_tuple, /*PyObject *freevars,*/
  2023. __pyx_empty_tuple, /*PyObject *cellvars,*/
  2024. py_srcfile, /*PyObject *filename,*/
  2025. py_funcname, /*PyObject *name,*/
  2026. __pyx_lineno, /*int firstlineno,*/
  2027. __pyx_empty_bytes /*PyObject *lnotab*/
  2028. );
  2029. if (!py_code) goto bad;
  2030. py_frame = PyFrame_New(
  2031. PyThreadState_GET(), /*PyThreadState *tstate,*/
  2032. py_code, /*PyCodeObject *code,*/
  2033. py_globals, /*PyObject *globals,*/
  2034. 0 /*PyObject *locals*/
  2035. );
  2036. if (!py_frame) goto bad;
  2037. py_frame->f_lineno = __pyx_lineno;
  2038. PyTraceBack_Here(py_frame);
  2039. bad:
  2040. Py_XDECREF(py_srcfile);
  2041. Py_XDECREF(py_funcname);
  2042. Py_XDECREF(py_code);
  2043. Py_XDECREF(py_frame);
  2044. }
  2045. static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
  2046. while (t->p) {
  2047. #if PY_MAJOR_VERSION < 3
  2048. if (t->is_unicode) {
  2049. *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
  2050. } else if (t->intern) {
  2051. *t->p = PyString_InternFromString(t->s);
  2052. } else {
  2053. *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
  2054. }
  2055. #else /* Python 3+ has unicode identifiers */
  2056. if (t->is_unicode | t->is_str) {
  2057. if (t->intern) {
  2058. *t->p = PyUnicode_InternFromString(t->s);
  2059. } else if (t->encoding) {
  2060. *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
  2061. } else {
  2062. *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
  2063. }
  2064. } else {
  2065. *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
  2066. }
  2067. #endif
  2068. if (!*t->p)
  2069. return -1;
  2070. ++t;
  2071. }
  2072. return 0;
  2073. }
  2074. /* Type Conversion Functions */
  2075. static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
  2076. int is_true = x == Py_True;
  2077. if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
  2078. else return PyObject_IsTrue(x);
  2079. }
  2080. static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
  2081. PyNumberMethods *m;
  2082. const char *name = NULL;
  2083. PyObject *res = NULL;
  2084. #if PY_VERSION_HEX < 0x03000000
  2085. if (PyInt_Check(x) || PyLong_Check(x))
  2086. #else
  2087. if (PyLong_Check(x))
  2088. #endif
  2089. return Py_INCREF(x), x;
  2090. m = Py_TYPE(x)->tp_as_number;
  2091. #if PY_VERSION_HEX < 0x03000000
  2092. if (m && m->nb_int) {
  2093. name = "int";
  2094. res = PyNumber_Int(x);
  2095. }
  2096. else if (m && m->nb_long) {
  2097. name = "long";
  2098. res = PyNumber_Long(x);
  2099. }
  2100. #else
  2101. if (m && m->nb_int) {
  2102. name = "int";
  2103. res = PyNumber_Long(x);
  2104. }
  2105. #endif
  2106. if (res) {
  2107. #if PY_VERSION_HEX < 0x03000000
  2108. if (!PyInt_Check(res) && !PyLong_Check(res)) {
  2109. #else
  2110. if (!PyLong_Check(res)) {
  2111. #endif
  2112. PyErr_Format(PyExc_TypeError,
  2113. "__%s__ returned non-%s (type %.200s)",
  2114. name, name, Py_TYPE(res)->tp_name);
  2115. Py_DECREF(res);
  2116. return NULL;
  2117. }
  2118. }
  2119. else if (!PyErr_Occurred()) {
  2120. PyErr_SetString(PyExc_TypeError,
  2121. "an integer is required");
  2122. }
  2123. return res;
  2124. }
  2125. static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  2126. Py_ssize_t ival;
  2127. PyObject* x = PyNumber_Index(b);
  2128. if (!x) return -1;
  2129. ival = PyInt_AsSsize_t(x);
  2130. Py_DECREF(x);
  2131. return ival;
  2132. }
  2133. static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
  2134. #if PY_VERSION_HEX < 0x02050000
  2135. if (ival <= LONG_MAX)
  2136. return PyInt_FromLong((long)ival);
  2137. else {
  2138. unsigned char *bytes = (unsigned char *) &ival;
  2139. int one = 1; int little = (int)*(unsigned char*)&one;
  2140. return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
  2141. }
  2142. #else
  2143. return PyInt_FromSize_t(ival);
  2144. #endif
  2145. }
  2146. static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
  2147. unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
  2148. if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
  2149. return (size_t)-1;
  2150. } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
  2151. PyErr_SetString(PyExc_OverflowError,
  2152. "value too large to convert to size_t");
  2153. return (size_t)-1;
  2154. }
  2155. return (size_t)val;
  2156. }
  2157. #endif /* Py_PYTHON_H */