PageRenderTime 68ms CodeModel.GetById 24ms RepoModel.GetById 1ms app.codeStats 1ms

/zmq/core/socket.c

https://bitbucket.org/markotibold/pyzmq-static
C | 10425 lines | 7026 code | 728 blank | 2671 comment | 1314 complexity | 979cc623d9830e0766d3d536ba0449be MD5 | raw file
Possible License(s): GPL-3.0, LGPL-3.0

Large files files are truncated, but you can click here to view the full file

  1. /* Generated by Cython 0.14.1 on Fri May 13 15:49:46 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) PyInt_AsLong(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_MAJOR_VERSION >= 3
  142. #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
  143. #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
  144. #else
  145. #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
  146. #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
  147. #endif
  148. #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
  149. #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
  150. #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
  151. #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
  152. #else
  153. #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
  154. (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
  155. (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
  156. (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
  157. #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
  158. (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
  159. (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
  160. (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
  161. #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
  162. (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
  163. (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
  164. (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
  165. #endif
  166. #if PY_MAJOR_VERSION >= 3
  167. #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
  168. #endif
  169. #if PY_VERSION_HEX < 0x02050000
  170. #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n)))
  171. #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
  172. #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n)))
  173. #else
  174. #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n))
  175. #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
  176. #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n))
  177. #endif
  178. #if PY_VERSION_HEX < 0x02050000
  179. #define __Pyx_NAMESTR(n) ((char *)(n))
  180. #define __Pyx_DOCSTR(n) ((char *)(n))
  181. #else
  182. #define __Pyx_NAMESTR(n) (n)
  183. #define __Pyx_DOCSTR(n) (n)
  184. #endif
  185. #ifdef __cplusplus
  186. #define __PYX_EXTERN_C extern "C"
  187. #else
  188. #define __PYX_EXTERN_C extern
  189. #endif
  190. #if defined(WIN32) || defined(MS_WINDOWS)
  191. #define _USE_MATH_DEFINES
  192. #endif
  193. #include <math.h>
  194. #define __PYX_HAVE_API__zmq__core__socket
  195. #include "allocate.h"
  196. #include "errno.h"
  197. #include "string.h"
  198. #include "zmq_compat.h"
  199. #include "zmq.h"
  200. #include "zmq_utils.h"
  201. #include "pyversion_compat.h"
  202. #include "stdlib.h"
  203. #include "stdio.h"
  204. #include "pythread.h"
  205. #ifdef PYREX_WITHOUT_ASSERTIONS
  206. #define CYTHON_WITHOUT_ASSERTIONS
  207. #endif
  208. /* inline attribute */
  209. #ifndef CYTHON_INLINE
  210. #if defined(__GNUC__)
  211. #define CYTHON_INLINE __inline__
  212. #elif defined(_MSC_VER)
  213. #define CYTHON_INLINE __inline
  214. #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  215. #define CYTHON_INLINE inline
  216. #else
  217. #define CYTHON_INLINE
  218. #endif
  219. #endif
  220. /* unused attribute */
  221. #ifndef CYTHON_UNUSED
  222. # if defined(__GNUC__)
  223. # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
  224. # define CYTHON_UNUSED __attribute__ ((__unused__))
  225. # else
  226. # define CYTHON_UNUSED
  227. # endif
  228. # elif defined(__ICC) || defined(__INTEL_COMPILER)
  229. # define CYTHON_UNUSED __attribute__ ((__unused__))
  230. # else
  231. # define CYTHON_UNUSED
  232. # endif
  233. #endif
  234. 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*/
  235. /* Type Conversion Predeclarations */
  236. #define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
  237. #define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s))
  238. #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
  239. static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
  240. static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
  241. static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
  242. static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
  243. static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
  244. #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
  245. #ifdef __GNUC__
  246. /* Test for GCC > 2.95 */
  247. #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
  248. #define likely(x) __builtin_expect(!!(x), 1)
  249. #define unlikely(x) __builtin_expect(!!(x), 0)
  250. #else /* __GNUC__ > 2 ... */
  251. #define likely(x) (x)
  252. #define unlikely(x) (x)
  253. #endif /* __GNUC__ > 2 ... */
  254. #else /* __GNUC__ */
  255. #define likely(x) (x)
  256. #define unlikely(x) (x)
  257. #endif /* __GNUC__ */
  258. static PyObject *__pyx_m;
  259. static PyObject *__pyx_b;
  260. static PyObject *__pyx_empty_tuple;
  261. static PyObject *__pyx_empty_bytes;
  262. static int __pyx_lineno;
  263. static int __pyx_clineno = 0;
  264. static const char * __pyx_cfilenm= __FILE__;
  265. static const char *__pyx_filename;
  266. static const char *__pyx_f[] = {
  267. "socket.pyx",
  268. "socket.pxd",
  269. "buffers.pxd",
  270. "message.pxd",
  271. "bool.pxd",
  272. "complex.pxd",
  273. };
  274. /* Type declarations */
  275. /* "zmq/core/socket.pxd":44
  276. *
  277. * # cpdef methods for direct-cython access:
  278. * cpdef object send(self, object data, int flags=*, copy=*, track=*) # <<<<<<<<<<<<<<
  279. * cpdef object recv(self, int flags=*, copy=*, track=*)
  280. *
  281. */
  282. struct __pyx_opt_args_3zmq_4core_6socket_6Socket_send {
  283. int __pyx_n;
  284. int flags;
  285. PyObject *copy;
  286. PyObject *track;
  287. };
  288. /* "zmq/core/socket.pxd":45
  289. * # cpdef methods for direct-cython access:
  290. * cpdef object send(self, object data, int flags=*, copy=*, track=*)
  291. * cpdef object recv(self, int flags=*, copy=*, track=*) # <<<<<<<<<<<<<<
  292. *
  293. */
  294. struct __pyx_opt_args_3zmq_4core_6socket_6Socket_recv {
  295. int __pyx_n;
  296. int flags;
  297. PyObject *copy;
  298. PyObject *track;
  299. };
  300. /* "zmq/core/socket.pyx":79
  301. * raise ZMQError(ENOTSUP)
  302. *
  303. * cdef inline Message _recv_message(void *handle, int flags=0, track=False): # <<<<<<<<<<<<<<
  304. * """Receive a message in a non-copying manner and return a Message."""
  305. * cdef int rc
  306. */
  307. struct __pyx_opt_args_3zmq_4core_6socket__recv_message {
  308. int __pyx_n;
  309. int flags;
  310. PyObject *track;
  311. };
  312. /* "zmq/core/socket.pyx":92
  313. * return msg
  314. *
  315. * cdef inline object _recv_copy(void *handle, int flags=0): # <<<<<<<<<<<<<<
  316. * """Recieve a message and return a copy"""
  317. * cdef zmq_msg_t zmq_msg
  318. */
  319. struct __pyx_opt_args_3zmq_4core_6socket__recv_copy {
  320. int __pyx_n;
  321. int flags;
  322. };
  323. /* "zmq/core/socket.pyx":105
  324. * return msg_bytes
  325. *
  326. * cdef inline object _send_message(void *handle, Message msg, int flags=0): # <<<<<<<<<<<<<<
  327. * """Send a Message on this socket in a non-copy manner."""
  328. * cdef int rc
  329. */
  330. struct __pyx_opt_args_3zmq_4core_6socket__send_message {
  331. int __pyx_n;
  332. int flags;
  333. };
  334. /* "zmq/core/socket.pyx":124
  335. *
  336. *
  337. * cdef inline object _send_copy(void *handle, object msg, int flags=0): # <<<<<<<<<<<<<<
  338. * """Send a message on this socket by copying its content."""
  339. * cdef int rc, rc2
  340. */
  341. struct __pyx_opt_args_3zmq_4core_6socket__send_copy {
  342. int __pyx_n;
  343. int flags;
  344. };
  345. /* "zmq/core/socket.pxd":33
  346. *
  347. *
  348. * cdef class Socket: # <<<<<<<<<<<<<<
  349. * """A 0MQ socket."""
  350. *
  351. */
  352. struct __pyx_obj_3zmq_4core_6socket_Socket {
  353. PyObject_HEAD
  354. struct __pyx_vtabstruct_3zmq_4core_6socket_Socket *__pyx_vtab;
  355. void *handle;
  356. int socket_type;
  357. PyObject *context;
  358. PyObject *closed;
  359. };
  360. /* "message.pxd":32
  361. * #-----------------------------------------------------------------------------
  362. *
  363. * cdef class MessageTracker(object): # <<<<<<<<<<<<<<
  364. * """A class for tracking if 0MQ is done using one or more messages."""
  365. *
  366. */
  367. struct __pyx_obj_3zmq_4core_7message_MessageTracker {
  368. PyObject_HEAD
  369. PyObject *events;
  370. PyObject *peers;
  371. };
  372. /* "message.pxd":39
  373. *
  374. *
  375. * cdef class Message: # <<<<<<<<<<<<<<
  376. * """A Message class for non-copy send/recvs."""
  377. *
  378. */
  379. struct __pyx_obj_3zmq_4core_7message_Message {
  380. PyObject_HEAD
  381. struct __pyx_vtabstruct_3zmq_4core_7message_Message *__pyx_vtab;
  382. zmq_msg_t zmq_msg;
  383. PyObject *_data;
  384. PyObject *_buffer;
  385. PyObject *_bytes;
  386. int _failed_init;
  387. PyObject *tracker_event;
  388. PyObject *tracker;
  389. };
  390. /* "zmq/core/socket.pyx":151
  391. *
  392. *
  393. * cdef class Socket: # <<<<<<<<<<<<<<
  394. * """Socket(context, socket_type)
  395. *
  396. */
  397. struct __pyx_vtabstruct_3zmq_4core_6socket_Socket {
  398. PyObject *(*send)(struct __pyx_obj_3zmq_4core_6socket_Socket *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_3zmq_4core_6socket_6Socket_send *__pyx_optional_args);
  399. PyObject *(*recv)(struct __pyx_obj_3zmq_4core_6socket_Socket *, int __pyx_skip_dispatch, struct __pyx_opt_args_3zmq_4core_6socket_6Socket_recv *__pyx_optional_args);
  400. };
  401. static struct __pyx_vtabstruct_3zmq_4core_6socket_Socket *__pyx_vtabptr_3zmq_4core_6socket_Socket;
  402. /* "message.pxd":39
  403. *
  404. *
  405. * cdef class Message: # <<<<<<<<<<<<<<
  406. * """A Message class for non-copy send/recvs."""
  407. *
  408. */
  409. struct __pyx_vtabstruct_3zmq_4core_7message_Message {
  410. struct __pyx_obj_3zmq_4core_7message_Message *(*fast_copy)(struct __pyx_obj_3zmq_4core_7message_Message *);
  411. PyObject *(*_getbuffer)(struct __pyx_obj_3zmq_4core_7message_Message *);
  412. };
  413. static struct __pyx_vtabstruct_3zmq_4core_7message_Message *__pyx_vtabptr_3zmq_4core_7message_Message;
  414. #ifndef CYTHON_REFNANNY
  415. #define CYTHON_REFNANNY 0
  416. #endif
  417. #if CYTHON_REFNANNY
  418. typedef struct {
  419. void (*INCREF)(void*, PyObject*, int);
  420. void (*DECREF)(void*, PyObject*, int);
  421. void (*GOTREF)(void*, PyObject*, int);
  422. void (*GIVEREF)(void*, PyObject*, int);
  423. void* (*SetupContext)(const char*, int, const char*);
  424. void (*FinishContext)(void**);
  425. } __Pyx_RefNannyAPIStruct;
  426. static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  427. static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) {
  428. PyObject *m = NULL, *p = NULL;
  429. void *r = NULL;
  430. m = PyImport_ImportModule((char *)modname);
  431. if (!m) goto end;
  432. p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
  433. if (!p) goto end;
  434. r = PyLong_AsVoidPtr(p);
  435. end:
  436. Py_XDECREF(p);
  437. Py_XDECREF(m);
  438. return (__Pyx_RefNannyAPIStruct *)r;
  439. }
  440. #define __Pyx_RefNannySetupContext(name) void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
  441. #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  442. #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  443. #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  444. #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  445. #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  446. #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0)
  447. #else
  448. #define __Pyx_RefNannySetupContext(name)
  449. #define __Pyx_RefNannyFinishContext()
  450. #define __Pyx_INCREF(r) Py_INCREF(r)
  451. #define __Pyx_DECREF(r) Py_DECREF(r)
  452. #define __Pyx_GOTREF(r)
  453. #define __Pyx_GIVEREF(r)
  454. #define __Pyx_XDECREF(r) Py_XDECREF(r)
  455. #endif /* CYTHON_REFNANNY */
  456. #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0)
  457. #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0)
  458. static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
  459. static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
  460. static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
  461. static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
  462. static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
  463. Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
  464. static void __Pyx_RaiseDoubleKeywordsError(
  465. const char* func_name, PyObject* kw_name); /*proto*/
  466. static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/
  467. static CYTHON_INLINE long __Pyx_NegateNonNeg(long b) { return unlikely(b < 0) ? b : !b; }
  468. static CYTHON_INLINE PyObject* __Pyx_PyBoolOrNull_FromLong(long b) {
  469. return unlikely(b < 0) ? NULL : __Pyx_PyBool_FromLong(b);
  470. }
  471. static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/
  472. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
  473. PyObject *r;
  474. if (!j) return NULL;
  475. r = PyObject_GetItem(o, j);
  476. Py_DECREF(j);
  477. return r;
  478. }
  479. #define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
  480. __Pyx_GetItemInt_List_Fast(o, i) : \
  481. __Pyx_GetItemInt_Generic(o, to_py_func(i)))
  482. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) {
  483. if (likely(o != Py_None)) {
  484. if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
  485. PyObject *r = PyList_GET_ITEM(o, i);
  486. Py_INCREF(r);
  487. return r;
  488. }
  489. else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
  490. PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
  491. Py_INCREF(r);
  492. return r;
  493. }
  494. }
  495. return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
  496. }
  497. #define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
  498. __Pyx_GetItemInt_Tuple_Fast(o, i) : \
  499. __Pyx_GetItemInt_Generic(o, to_py_func(i)))
  500. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) {
  501. if (likely(o != Py_None)) {
  502. if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
  503. PyObject *r = PyTuple_GET_ITEM(o, i);
  504. Py_INCREF(r);
  505. return r;
  506. }
  507. else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
  508. PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
  509. Py_INCREF(r);
  510. return r;
  511. }
  512. }
  513. return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
  514. }
  515. #define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
  516. __Pyx_GetItemInt_Fast(o, i) : \
  517. __Pyx_GetItemInt_Generic(o, to_py_func(i)))
  518. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) {
  519. PyObject *r;
  520. if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) {
  521. r = PyList_GET_ITEM(o, i);
  522. Py_INCREF(r);
  523. }
  524. else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
  525. r = PyTuple_GET_ITEM(o, i);
  526. Py_INCREF(r);
  527. }
  528. else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) {
  529. r = PySequence_GetItem(o, i);
  530. }
  531. else {
  532. r = __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
  533. }
  534. return r;
  535. }
  536. static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
  537. static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
  538. static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
  539. static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/
  540. #ifndef __PYX_FORCE_INIT_THREADS
  541. #if PY_VERSION_HEX < 0x02040200
  542. #define __PYX_FORCE_INIT_THREADS 1
  543. #else
  544. #define __PYX_FORCE_INIT_THREADS 0
  545. #endif
  546. #endif
  547. static CYTHON_INLINE pyzmq_int64_t __Pyx_PyInt_from_py_pyzmq_int64_t(PyObject *);
  548. static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_pyzmq_int64_t(pyzmq_int64_t);
  549. static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);
  550. static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);
  551. static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);
  552. static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *);
  553. static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *);
  554. static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *);
  555. static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);
  556. static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);
  557. static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);
  558. static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *);
  559. static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);
  560. static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);
  561. static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *);
  562. static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);
  563. static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);
  564. static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);
  565. static CYTHON_INLINE int __Pyx_StrEq(const char *, const char *); /*proto*/
  566. static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
  567. static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size, int strict); /*proto*/
  568. static PyObject *__Pyx_ImportModule(const char *name); /*proto*/
  569. static void* __Pyx_GetVtable(PyObject *dict); /*proto*/
  570. static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig); /*proto*/
  571. static void __Pyx_AddTraceback(const char *funcname); /*proto*/
  572. static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
  573. /* Module declarations from zmq.core.czmq */
  574. /* Module declarations from zmq.core.message */
  575. static PyTypeObject *__pyx_ptype_3zmq_4core_7message_MessageTracker = 0;
  576. static PyTypeObject *__pyx_ptype_3zmq_4core_7message_Message = 0;
  577. static PyObject *(*__pyx_f_3zmq_4core_7message_copy_zmq_msg_bytes)(zmq_msg_t *); /*proto*/
  578. /* Module declarations from libc.stdlib */
  579. /* Module declarations from cpython.version */
  580. /* Module declarations from cpython.ref */
  581. /* Module declarations from cpython.exc */
  582. /* Module declarations from cpython.module */
  583. /* Module declarations from cpython.mem */
  584. /* Module declarations from cpython.tuple */
  585. /* Module declarations from cpython.list */
  586. /* Module declarations from libc.stdio */
  587. /* Module declarations from cpython.object */
  588. /* Module declarations from cpython.sequence */
  589. /* Module declarations from cpython.mapping */
  590. /* Module declarations from cpython.iterator */
  591. /* Module declarations from cpython.type */
  592. /* Module declarations from cpython.number */
  593. /* Module declarations from cpython.int */
  594. /* Module declarations from __builtin__ */
  595. /* Module declarations from cpython.bool */
  596. static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0;
  597. /* Module declarations from cpython.long */
  598. /* Module declarations from cpython.float */
  599. /* Module declarations from __builtin__ */
  600. /* Module declarations from cpython.complex */
  601. static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0;
  602. /* Module declarations from cpython.string */
  603. /* Module declarations from cpython.unicode */
  604. /* Module declarations from cpython.dict */
  605. /* Module declarations from cpython.instance */
  606. /* Module declarations from cpython.function */
  607. /* Module declarations from cpython.method */
  608. /* Module declarations from cpython.weakref */
  609. /* Module declarations from cpython.getargs */
  610. /* Module declarations from cpython.pythread */
  611. /* Module declarations from cpython.cobject */
  612. /* Module declarations from cpython.oldbuffer */
  613. /* Module declarations from cpython.set */
  614. /* Module declarations from cpython.buffer */
  615. /* Module declarations from cpython.bytes */
  616. /* Module declarations from cpython.pycapsule */
  617. /* Module declarations from cpython */
  618. /* Module declarations from buffers */
  619. static CYTHON_INLINE int __pyx_f_7buffers_newstyle_available(void); /*proto*/
  620. static CYTHON_INLINE int __pyx_f_7buffers_memoryview_available(void); /*proto*/
  621. static CYTHON_INLINE int __pyx_f_7buffers_oldstyle_available(void); /*proto*/
  622. static CYTHON_INLINE int __pyx_f_7buffers_check_buffer(PyObject *); /*proto*/
  623. static CYTHON_INLINE PyObject *__pyx_f_7buffers_asbuffer(PyObject *, int, int, void **, Py_ssize_t *, Py_ssize_t *); /*proto*/
  624. static CYTHON_INLINE PyObject *__pyx_f_7buffers_asbuffer_r(PyObject *, void **, Py_ssize_t *); /*proto*/
  625. static CYTHON_INLINE PyObject *__pyx_f_7buffers_asbuffer_w(PyObject *, void **, Py_ssize_t *); /*proto*/
  626. static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer_3(void *, Py_ssize_t, int); /*proto*/
  627. static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer_2(void *, Py_ssize_t, int); /*proto*/
  628. static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer(void *, Py_ssize_t, int); /*proto*/
  629. static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer_r(void *, Py_ssize_t); /*proto*/
  630. static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer_w(void *, Py_ssize_t); /*proto*/
  631. static CYTHON_INLINE PyObject *__pyx_f_7buffers_viewfromobject(PyObject *, int); /*proto*/
  632. static CYTHON_INLINE PyObject *__pyx_f_7buffers_viewfromobject_r(PyObject *); /*proto*/
  633. static CYTHON_INLINE PyObject *__pyx_f_7buffers_viewfromobject_w(PyObject *); /*proto*/
  634. /* Module declarations from zmq.core.socket */
  635. static PyTypeObject *__pyx_ptype_3zmq_4core_6socket_Socket = 0;
  636. static CYTHON_INLINE PyObject *__pyx_f_3zmq_4core_6socket__check_closed(struct __pyx_obj_3zmq_4core_6socket_Socket *); /*proto*/
  637. static CYTHON_INLINE struct __pyx_obj_3zmq_4core_7message_Message *__pyx_f_3zmq_4core_6socket__recv_message(void *, struct __pyx_opt_args_3zmq_4core_6socket__recv_message *__pyx_optional_args); /*proto*/
  638. static CYTHON_INLINE PyObject *__pyx_f_3zmq_4core_6socket__recv_copy(void *, struct __pyx_opt_args_3zmq_4core_6socket__recv_copy *__pyx_optional_args); /*proto*/
  639. static CYTHON_INLINE PyObject *__pyx_f_3zmq_4core_6socket__send_message(void *, struct __pyx_obj_3zmq_4core_7message_Message *, struct __pyx_opt_args_3zmq_4core_6socket__send_message *__pyx_optional_args); /*proto*/
  640. static CYTHON_INLINE PyObject *__pyx_f_3zmq_4core_6socket__send_copy(void *, PyObject *, struct __pyx_opt_args_3zmq_4core_6socket__send_copy *__pyx_optional_args); /*proto*/
  641. #define __Pyx_MODULE_NAME "zmq.core.socket"
  642. static int __pyx_module_is_main_zmq__core__socket = 0;
  643. /* Implementation of zmq.core.socket */
  644. static PyObject *__pyx_builtin_TypeError;
  645. static PyObject *__pyx_builtin_xrange;
  646. static PyObject *__pyx_builtin_ValueError;
  647. static PyObject *__pyx_builtin_ImportError;
  648. static PyObject *__pyx_builtin_AttributeError;
  649. static PyObject *__pyx_builtin_NotImplementedError;
  650. static char __pyx_k_2[] = "unicode not allowed, use setsockopt_unicode";
  651. static char __pyx_k_4[] = "expected str, got: %r";
  652. static char __pyx_k_5[] = "expected int, got: %r";
  653. static char __pyx_k_6[] = "utf-8";
  654. static char __pyx_k_7[] = "unicode strings only";
  655. static char __pyx_k_9[] = "option %i will not return a string to be decoded";
  656. static char __pyx_k_11[] = "%s:%s";
  657. static char __pyx_k_12[] = "Could not bind socket to random port.";
  658. static char __pyx_k_17[] = "unicode not allowed, use send_unicode";
  659. static char __pyx_k_19[] = "Not a tracked message";
  660. static char __pyx_k_28[] = "unicode/str objects only";
  661. static char __pyx_k_30[] = "jsonlib{1,2}, json or simplejson library is required.";
  662. static char __pyx_k_33[] = "%r does not provide a buffer interface.";
  663. static char __pyx_k_34[] = "";
  664. static char __pyx_k_35[] = "New style buffers not available.";
  665. static char __pyx_k_37[] = "Old style buffers not available.";
  666. static char __pyx_k_39[] = "0MQ Socket class.";
  667. static char __pyx_k_40[] = "zmq.utils";
  668. static char __pyx_k_41[] = "zmq.core";
  669. static char __pyx_k_42[] = "zmq.core.constants";
  670. static char __pyx_k_43[] = "*";
  671. static char __pyx_k_44[] = "zmq.core.error";
  672. static char __pyx_k_45[] = "zmq.utils.strtypes";
  673. static char __pyx_k__B[] = "B";
  674. static char __pyx_k__u[] = "u";
  675. static char __pyx_k__buf[] = "buf";
  676. static char __pyx_k__len[] = "len";
  677. static char __pyx_k__obj[] = "obj";
  678. static char __pyx_k__sys[] = "sys";
  679. static char __pyx_k__addr[] = "addr";
  680. static char __pyx_k__bind[] = "bind";
  681. static char __pyx_k__char[] = "char";
  682. static char __pyx_k__copy[] = "copy";
  683. static char __pyx_k__data[] = "data";
  684. static char __pyx_k__recv[] = "recv";
  685. static char __pyx_k__send[] = "send";
  686. static char __pyx_k__time[] = "time";
  687. static char __pyx_k__bytes[] = "bytes";
  688. static char __pyx_k__close[] = "close";
  689. static char __pyx_k__dtype[] = "dtype";
  690. static char __pyx_k__dumps[] = "dumps";
  691. static char __pyx_k__flags[] = "flags";
  692. static char __pyx_k__loads[] = "loads";
  693. static char __pyx_k__range[] = "range";
  694. static char __pyx_k__shape[] = "shape";
  695. static char __pyx_k__track[] = "track";
  696. static char __pyx_k__EINVAL[] = "EINVAL";
  697. static char __pyx_k__Socket[] = "Socket";
  698. static char __pyx_k__append[] = "append";
  699. static char __pyx_k__buffer[] = "buffer";
  700. static char __pyx_k__closed[] = "closed";
  701. static char __pyx_k__codecs[] = "codecs";
  702. static char __pyx_k__decode[] = "decode";
  703. static char __pyx_k__encode[] = "encode";
  704. static char __pyx_k__format[] = "format";
  705. static char __pyx_k__handle[] = "handle";
  706. static char __pyx_k__option[] = "option";
  707. static char __pyx_k__optval[] = "optval";
  708. static char __pyx_k__pickle[] = "pickle";
  709. static char __pyx_k__random[] = "random";
  710. static char __pyx_k__struct[] = "struct";
  711. static char __pyx_k__xrange[] = "xrange";
  712. static char __pyx_k__ENOTSUP[] = "ENOTSUP";
  713. static char __pyx_k__RCVMORE[] = "RCVMORE";
  714. static char __pyx_k__SNDMORE[] = "SNDMORE";
  715. static char __pyx_k____all__[] = "__all__";
  716. static char __pyx_k___handle[] = "_handle";
  717. static char __pyx_k__cPickle[] = "cPickle";
  718. static char __pyx_k__context[] = "context";
  719. static char __pyx_k__jsonapi[] = "jsonapi";
  720. static char __pyx_k__jsonmod[] = "jsonmod";
  721. static char __pyx_k__rcvmore[] = "rcvmore";
  722. static char __pyx_k__tracker[] = "tracker";
  723. static char __pyx_k__unicode[] = "unicode";
  724. static char __pyx_k__zmq_msg[] = "zmq_msg";
  725. static char __pyx_k__IDENTITY[] = "IDENTITY";
  726. static char __pyx_k__ZMQError[] = "ZMQError";
  727. static char __pyx_k____main__[] = "__main__";
  728. static char __pyx_k____test__[] = "__test__";
  729. static char __pyx_k__copy_mod[] = "copy_mod";
  730. static char __pyx_k__encoding[] = "encoding";
  731. static char __pyx_k__itemsize[] = "itemsize";
  732. static char __pyx_k__max_port[] = "max_port";
  733. static char __pyx_k__min_port[] = "min_port";
  734. static char __pyx_k__protocol[] = "protocol";
  735. static char __pyx_k__typecode[] = "typecode";
  736. static char __pyx_k__TypeError[] = "TypeError";
  737. static char __pyx_k__constants[] = "constants";
  738. static char __pyx_k__fast_copy[] = "fast_copy";
  739. static char __pyx_k__max_tries[] = "max_tries";
  740. static char __pyx_k__msg_parts[] = "msg_parts";
  741. static char __pyx_k__randrange[] = "randrange";
  742. static char __pyx_k__ValueError[] = "ValueError";
  743. static char __pyx_k__basestring[] = "basestring";
  744. static char __pyx_k__getsockopt[] = "getsockopt";
  745. static char __pyx_k__setsockopt[] = "setsockopt";
  746. static char __pyx_k__ImportError[] = "ImportError";
  747. static char __pyx_k__socket_type[] = "socket_type";
  748. static char __pyx_k__ZMQBindError[] = "ZMQBindError";
  749. static char __pyx_k__int_sockopts[] = "int_sockopts";
  750. static char __pyx_k__AttributeError[] = "AttributeError";
  751. static char __pyx_k__bytes_sockopts[] = "bytes_sockopts";
  752. static char __pyx_k__int64_sockopts[] = "int64_sockopts";
  753. static char __pyx_k__NotImplementedError[] = "NotImplementedError";
  754. static PyObject *__pyx_kp_s_11;
  755. static PyObject *__pyx_kp_s_12;
  756. static PyObject *__pyx_kp_s_17;
  757. static PyObject *__pyx_kp_s_19;
  758. static PyObject *__pyx_kp_s_2;
  759. static PyObject *__pyx_kp_s_28;
  760. static PyObject *__pyx_kp_s_30;
  761. static PyObject *__pyx_kp_s_33;
  762. static PyObject *__pyx_kp_s_34;
  763. static PyObject *__pyx_kp_s_35;
  764. static PyObject *__pyx_kp_s_37;
  765. static PyObject *__pyx_kp_s_4;
  766. static PyObject *__pyx_n_s_40;
  767. static PyObject *__pyx_n_s_41;
  768. static PyObject *__pyx_n_s_42;
  769. static PyObject *__pyx_n_s_43;
  770. static PyObject *__pyx_n_s_44;
  771. static PyObject *__pyx_n_s_45;
  772. static PyObject *__pyx_kp_s_5;
  773. static PyObject *__pyx_kp_s_6;
  774. static PyObject *__pyx_kp_s_7;
  775. static PyObject *__pyx_kp_s_9;
  776. static PyObject *__pyx_n_s__AttributeError;
  777. static PyObject *__pyx_n_s__B;
  778. static PyObject *__pyx_n_s__EINVAL;
  779. static PyObject *__pyx_n_s__ENOTSUP;
  780. static PyObject *__pyx_n_s__IDENTITY;
  781. static PyObject *__pyx_n_s__ImportError;
  782. static PyObject *__pyx_n_s__NotImplementedError;
  783. static PyObject *__pyx_n_s__RCVMORE;
  784. static PyObject *__pyx_n_s__SNDMORE;
  785. static PyObject *__pyx_n_s__Socket;
  786. static PyObject *__pyx_n_s__TypeError;
  787. static PyObject *__pyx_n_s__ValueError;
  788. static PyObject *__pyx_n_s__ZMQBindError;
  789. static PyObject *__pyx_n_s__ZMQError;
  790. static PyObject *__pyx_n_s____all__;
  791. static PyObject *__pyx_n_s____main__;
  792. static PyObject *__pyx_n_s____test__;
  793. static PyObject *__pyx_n_s___handle;
  794. static PyObject *__pyx_n_s__addr;
  795. static PyObject *__pyx_n_s__append;
  796. static PyObject *__pyx_n_s__basestring;
  797. static PyObject *__pyx_n_s__bind;
  798. static PyObject *__pyx_n_s__buf;
  799. static PyObject *__pyx_n_s__buffer;
  800. static PyObject *__pyx_n_s__bytes;
  801. static PyObject *__pyx_n_s__bytes_sockopts;
  802. static PyObject *__pyx_n_s__cPickle;
  803. static PyObject *__pyx_n_s__char;
  804. static PyObject *__pyx_n_s__close;
  805. static PyObject *__pyx_n_s__closed;
  806. static PyObject *__pyx_n_s__codecs;
  807. static PyObject *__pyx_n_s__constants;
  808. static PyObject *__pyx_n_s__context;
  809. static PyObject *__pyx_n_s__copy;
  810. static PyObject *__pyx_n_s__copy_mod;
  811. static PyObject *__pyx_n_s__data;
  812. static PyObject *__pyx_n_s__decode;
  813. static PyObject *__pyx_n_s__dtype;
  814. static PyObject *__pyx_n_s__dumps;
  815. static PyObject *__pyx_n_s__encode;
  816. static PyObject *__pyx_n_s__encoding;
  817. static PyObject *__pyx_n_s__fast_copy;
  818. static PyObject *__pyx_n_s__flags;
  819. static PyObject *__pyx_n_s__format;
  820. static PyObject *__pyx_n_s__getsockopt;
  821. static PyObject *__pyx_n_s__handle;
  822. static PyObject *__pyx_n_s__int64_sockopts;
  823. static PyObject *__pyx_n_s__int_sockopts;
  824. static PyObject *__pyx_n_s__itemsize;
  825. static PyObject *__pyx_n_s__jsonapi;
  826. static PyObject *__pyx_n_s__jsonmod;
  827. static PyObject *__pyx_n_s__len;
  828. static PyObject *__pyx_n_s__loads;
  829. static PyObject *__pyx_n_s__max_port;
  830. static PyObject *__pyx_n_s__max_tries;
  831. static PyObject *__pyx_n_s__min_port;
  832. static PyObject *__pyx_n_s__msg_parts;
  833. static PyObject *__pyx_n_s__obj;
  834. static PyObject *__pyx_n_s__option;
  835. static PyObject *__pyx_n_s__optval;
  836. static PyObject *__pyx_n_s__pickle;
  837. static PyObject *__pyx_n_s__protocol;
  838. static PyObject *__pyx_n_s__random;
  839. static PyObject *__pyx_n_s__randrange;
  840. static PyObject *__pyx_n_s__range;
  841. static PyObject *__pyx_n_s__rcvmore;
  842. static PyObject *__pyx_n_s__recv;
  843. static PyObject *__pyx_n_s__send;
  844. static PyObject *__pyx_n_s__setsockopt;
  845. static PyObject *__pyx_n_s__shape;
  846. static PyObject *__pyx_n_s__socket_type;
  847. static PyObject *__pyx_n_s__struct;
  848. static PyObject *__pyx_n_s__sys;
  849. static PyObject *__pyx_n_s__time;
  850. static PyObject *__pyx_n_s__track;
  851. static PyObject *__pyx_n_s__tracker;
  852. static PyObject *__pyx_n_s__typecode;
  853. static PyObject *__pyx_n_s__u;
  854. static PyObject *__pyx_n_s__unicode;
  855. static PyObject *__pyx_n_s__xrange;
  856. static PyObject *__pyx_n_s__zmq_msg;
  857. static PyObject *__pyx_int_0;
  858. static PyObject *__pyx_int_neg_1;
  859. static PyObject *__pyx_int_100;
  860. static PyObject *__pyx_int_49152;
  861. static PyObject *__pyx_int_65536;
  862. static PyObject *__pyx_k_1;
  863. static PyObject *__pyx_k_15;
  864. static PyObject *__pyx_k_16;
  865. static PyObject *__pyx_k_21;
  866. static PyObject *__pyx_k_22;
  867. static PyObject *__pyx_k_23;
  868. static PyObject *__pyx_k_24;
  869. static PyObject *__pyx_k_25;
  870. static PyObject *__pyx_k_26;
  871. static PyObject *__pyx_k_27;
  872. static PyObject *__pyx_k_tuple_3;
  873. static PyObject *__pyx_k_tuple_8;
  874. static PyObject *__pyx_k_tuple_10;
  875. static PyObject *__pyx_k_tuple_13;
  876. static PyObject *__pyx_k_tuple_14;
  877. static PyObject *__pyx_k_tuple_18;
  878. static PyObject *__pyx_k_tuple_20;
  879. static PyObject *__pyx_k_tuple_29;
  880. static PyObject *__pyx_k_tuple_31;
  881. static PyObject *__pyx_k_tuple_32;
  882. static PyObject *__pyx_k_tuple_36;
  883. static PyObject *__pyx_k_tuple_38;
  884. /* "zmq/core/socket.pyx":75
  885. * # true methods frequently cannot be inlined, acc. Cython docs
  886. *
  887. * cdef inline _check_closed(Socket s): # <<<<<<<<<<<<<<
  888. * if s.closed:
  889. * raise ZMQError(ENOTSUP)
  890. */
  891. static CYTHON_INLINE PyObject *__pyx_f_3zmq_4core_6socket__check_closed(struct __pyx_obj_3zmq_4core_6socket_Socket *__pyx_v_s) {
  892. PyObject *__pyx_r = NULL;
  893. int __pyx_t_1;
  894. PyObject *__pyx_t_2 = NULL;
  895. PyObject *__pyx_t_3 = NULL;
  896. PyObject *__pyx_t_4 = NULL;
  897. __Pyx_RefNannySetupContext("_check_closed");
  898. /* "zmq/core/socket.pyx":76
  899. *
  900. * cdef inline _check_closed(Socket s):
  901. * if s.closed: # <<<<<<<<<<<<<<
  902. * raise ZMQError(ENOTSUP)
  903. *
  904. */
  905. __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_s->closed); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  906. if (__pyx_t_1) {
  907. /* "zmq/core/socket.pyx":77
  908. * cdef inline _check_closed(Socket s):
  909. * if s.closed:
  910. * raise ZMQError(ENOTSUP) # <<<<<<<<<<<<<<
  911. *
  912. * cdef inline Message _recv_message(void *handle, int flags=0, track=False):
  913. */
  914. __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  915. __Pyx_GOTREF(__pyx_t_2);
  916. __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__ENOTSUP); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  917. __Pyx_GOTREF(__pyx_t_3);
  918. __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  919. __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  920. PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
  921. __Pyx_GIVEREF(__pyx_t_3);
  922. __pyx_t_3 = 0;
  923. __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  924. __Pyx_GOTREF(__pyx_t_3);
  925. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  926. __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  927. __Pyx_Raise(__pyx_t_3, 0, 0);
  928. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  929. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  930. goto __pyx_L3;
  931. }
  932. __pyx_L3:;
  933. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  934. goto __pyx_L0;
  935. __pyx_L1_error:;
  936. __Pyx_XDECREF(__pyx_t_2);
  937. __Pyx_XDECREF(__pyx_t_3);
  938. __Pyx_XDECREF(__pyx_t_4);
  939. __Pyx_AddTraceback("zmq.core.socket._check_closed");
  940. __pyx_r = 0;
  941. __pyx_L0:;
  942. __Pyx_XGIVEREF(__pyx_r);
  943. __Pyx_RefNannyFinishContext();
  944. return __pyx_r;
  945. }
  946. /* "zmq/core/socket.pyx":79
  947. * raise ZMQError(ENOTSUP)
  948. *
  949. * cdef inline Message _recv_message(void *handle, int flags=0, track=False): # <<<<<<<<<<<<<<
  950. * """Receive a message in a non-copying manner and return a Message."""
  951. * cdef int rc
  952. */
  953. static CYTHON_INLINE struct __pyx_obj_3zmq_4core_7message_Message *__pyx_f_3zmq_4core_6socket__recv_message(void *__pyx_v_handle, struct __pyx_opt_args_3zmq_4core_6socket__recv_message *__pyx_optional_args) {
  954. int __pyx_v_flags = ((int)0);
  955. PyObject *__pyx_v_track = __pyx_k_1;
  956. int __pyx_v_rc;
  957. struct __pyx_obj_3zmq_4core_7message_Message *__pyx_v_msg;
  958. struct __pyx_obj_3zmq_4core_7message_Message *__pyx_r = NULL;
  959. PyObject *__pyx_t_1 = NULL;
  960. PyObject *__pyx_t_2 = NULL;
  961. int __pyx_t_3;
  962. __Pyx_RefNannySetupContext("_recv_message");
  963. if (__pyx_optional_args) {
  964. if (__pyx_optional_args->__pyx_n > 0) {
  965. __pyx_v_flags = __pyx_optional_args->flags;
  966. if (__pyx_optional_args->__pyx_n > 1) {
  967. __pyx_v_track = __pyx_optional_args->track;
  968. }
  969. }
  970. }
  971. __pyx_v_msg = ((struct __pyx_obj_3zmq_4core_7message_Message *)Py_None); __Pyx_INCREF(Py_None);
  972. /* "zmq/core/socket.pyx":83
  973. * cdef int rc
  974. * cdef Message msg
  975. * msg = Message(track=track) # <<<<<<<<<<<<<<
  976. *
  977. * with nogil:
  978. */
  979. __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  980. __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  981. if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__track), __pyx_v_track) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  982. __pyx_t_2 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_3zmq_4core_7message_Message)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  983. __Pyx_GOTREF(__pyx_t_2);
  984. __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  985. __Pyx_DECREF(((PyObject *)__pyx_v_msg));
  986. __pyx_v_msg = ((struct __pyx_obj_3zmq_4core_7message_Message *)__pyx_t_2);
  987. __pyx_t_2 = 0;
  988. /* "zmq/core/socket.pyx":85
  989. * msg = Message(track=track)
  990. *
  991. * with nogil: # <<<<<<<<<<<<<<
  992. * rc = zmq_recvmsg(handle, &msg.zmq_msg, flags)
  993. *
  994. */
  995. {
  996. #ifdef WITH_THREAD
  997. PyThreadState *_save;
  998. #endif
  999. Py_UNBLOCK_THREADS
  1000. /*try:*/ {
  1001. /* "zmq/core/socket.pyx":86
  1002. *
  1003. * with nogil:
  1004. * rc = zmq_recvmsg(handle, &msg.zmq_msg, flags) # <<<<<<<<<<<<<<
  1005. *
  1006. * if rc < 0:
  1007. */
  1008. __pyx_v_rc = zmq_recvmsg(__pyx_v_handle, (&__pyx_v_msg->zmq_msg), __pyx_v_flags);
  1009. }
  1010. /* "zmq/core/socket.pyx":85
  1011. * msg = Message(track=track)
  1012. *
  1013. * with nogil: # <<<<<<<<<<<<<<
  1014. * rc = zmq_recvmsg(handle, &msg.zmq_msg, flags)
  1015. *
  1016. */
  1017. /*finally:*/ {
  1018. Py_BLOCK_THREADS
  1019. }
  1020. }
  1021. /* "zmq/core/socket.pyx":88
  1022. * rc = zmq_recvmsg(handle, &msg.zmq_msg, flags)
  1023. *
  1024. * if rc < 0: # <<<<<<<<<<<<<<
  1025. * raise ZMQError()
  1026. * return msg
  1027. */
  1028. __pyx_t_3 = (__pyx_v_rc < 0);
  1029. if (__pyx_t_3) {
  1030. /* "zmq/core/socket.pyx":89
  1031. *
  1032. * if rc < 0:
  1033. * raise ZMQError() # <<<<<<<<<<<<<<
  1034. * return msg
  1035. *
  1036. */
  1037. __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1038. __Pyx_GOTREF(__pyx_t_2);
  1039. __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1040. __Pyx_GOTREF(__pyx_t_1);
  1041. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  1042. __Pyx_Raise(__pyx_t_1, 0, 0);
  1043. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1044. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1045. goto __pyx_L6;
  1046. }
  1047. __pyx_L6:;
  1048. /* "zmq/core/socket.pyx":90
  1049. * if rc < 0:
  1050. * raise ZMQError()
  1051. * return msg # <<<<<<<<<<<<<<
  1052. *
  1053. * cdef inline object _recv_copy(void *handle, int flags=0):
  1054. */
  1055. __Pyx_XDECREF(((PyObject *)__pyx_r));
  1056. __Pyx_INCREF(((PyObject *)__pyx_v_msg));
  1057. __pyx_r = __pyx_v_msg;
  1058. goto __pyx_L0;
  1059. __pyx_r = ((struct __pyx_obj_3zmq_4core_7message_Message *)Py_None); __Pyx_INCREF(Py_None);
  1060. goto __pyx_L0;
  1061. __pyx_L1_error:;
  1062. __Pyx_XDECREF(__pyx_t_1);
  1063. __Pyx_XDECREF(__pyx_t_2);
  1064. __Pyx_AddTraceback("zmq.core.socket._recv_message");
  1065. __pyx_r = 0;
  1066. __pyx_L0:;
  1067. __Pyx_DECREF((PyObject *)__pyx_v_msg);
  1068. __Pyx_XGIVEREF((PyObject *)__pyx_r);
  1069. __Pyx_RefNannyFinishContext();
  1070. return __pyx_r;
  1071. }
  1072. /* "zmq/core/socket.pyx":92
  1073. * return msg
  1074. *
  1075. * cdef inline object _recv_copy(void *handle, int flags=0): # <<<<<<<<<<<<<<
  1076. * """Recieve a message and return a copy"""
  1077. * cdef zmq_msg_t zmq_msg
  1078. */
  1079. static CYTHON_INLINE PyObject *__pyx_f_3zmq_4core_6socket__recv_copy(void *__pyx_v_handle, struct __pyx_opt_args_3zmq_4core_6socket__recv_copy *__pyx_optional_args) {
  1080. int __pyx_v_flags = ((int)0);
  1081. zmq_msg_t __pyx_v_zmq_msg;
  1082. int __pyx_v_rc;
  1083. PyObject *__pyx_v_msg_bytes;
  1084. PyObject *__pyx_r = NULL;
  1085. int __pyx_t_1;
  1086. PyObject *__pyx_t_2 = NULL;
  1087. PyObject *__pyx_t_3 = NULL;
  1088. __Pyx_RefNannySetupContext("_recv_copy");
  1089. if (__pyx_optional_args) {
  1090. if (__pyx_optional_args->__pyx_n > 0) {
  1091. __pyx_v_flags = __pyx_optional_args->flags;
  1092. }
  1093. }
  1094. __pyx_v_msg_bytes = Py_None; __Pyx_INCREF(Py_None);
  1095. /* "zmq/core/socket.pyx":95
  1096. * """Recieve a message and return a copy"""
  1097. * cdef zmq_msg_t zmq_msg
  1098. * with nogil: # <<<<<<<<<<<<<<
  1099. * zmq_msg_init (&zmq_msg)
  1100. * rc = zmq_recvmsg(handle, &zmq_msg, flags)
  1101. */
  1102. {
  1103. #ifdef WITH_THREAD
  1104. PyThreadState *_save;
  1105. #endif
  1106. Py_UNBLOCK_THREADS
  1107. /*try:*/ {
  1108. /* "zmq/core/socket.pyx":96
  1109. * cdef zmq_msg_t zmq_msg
  1110. * with nogil:
  1111. * zmq_msg_init (&zmq_msg) # <<<<<<<<<<<<<<
  1112. * rc = zmq_recvmsg(handle, &zmq_msg, flags)
  1113. * if rc < 0:
  1114. */
  1115. zmq_msg_init((&__pyx_v_zmq_msg));
  1116. /* "zmq/core/socket.pyx":97
  1117. * with nogil:
  1118. * zmq_msg_init (&zmq_msg)
  1119. * rc = zmq_recvmsg(handle, &zmq_msg, flags) # <<<<<<<<<<<<<<
  1120. * if rc < 0:
  1121. * raise ZMQError()
  1122. */
  1123. __pyx_v_rc = zmq_recvmsg(__pyx_v_handle, (&__pyx_v_zmq_msg), __pyx_v_flags);
  1124. }
  1125. /* "zmq/core/socket.pyx":95
  1126. * """Recieve a message and return a copy"""
  1127. * cdef zmq_msg_t zmq_msg
  1128. * with nogil: # <<<<<<<<<<<<<<
  1129. * zmq_msg_init (&zmq_msg)
  1130. * rc = zmq_recvmsg(handle, &zmq_msg, flags)
  1131. */
  1132. /*finally:*/ {
  1133. Py_BLOCK_THREADS
  1134. }
  1135. }
  1136. /* "zmq/core/socket.pyx":98
  1137. * zmq_msg_init (&zmq_msg)
  1138. * rc = zmq_recvmsg(handle, &zmq_msg, flags)
  1139. * if rc < 0: # <<<<<<<<<<<<<<
  1140. * raise ZMQError()
  1141. * msg_bytes = copy_zmq_msg_bytes(&zmq_msg)
  1142. */
  1143. __pyx_t_1 = (__pyx_v_rc < 0);
  1144. if (__pyx_t_1) {
  1145. /* "zmq/core/socket.pyx":99
  1146. * rc = zmq_recvmsg(handle, &zmq_msg, flags)
  1147. * if rc < 0:
  1148. * raise ZMQError() # <<<<<<<<<<<<<<
  1149. * msg_bytes = copy_zmq_msg_bytes(&zmq_msg)
  1150. * with nogil:
  1151. */
  1152. __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1153. __Pyx_GOTREF(__pyx_t_2);
  1154. __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1155. __Pyx_GOTREF(__pyx_t_3);
  1156. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  1157. __Pyx_Raise(__pyx_t_3, 0, 0);
  1158. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  1159. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1160. goto __pyx_L6;
  1161. }
  1162. __pyx_L6:;
  1163. /* "zmq/core/socket.pyx":100
  1164. * if rc < 0:
  1165. * raise ZMQError()
  1166. * msg_bytes = copy_zmq_msg_bytes(&zmq_msg) # <<<<<<<<<<<<<<
  1167. * with nogil:
  1168. * zmq_msg_close(&zmq_msg)
  1169. */
  1170. __pyx_t_3 = __pyx_f_3zmq_4core_7message_copy_zmq_msg_bytes((&__pyx_v_zmq_msg)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1171. __Pyx_GOTREF(__pyx_t_3);
  1172. __Pyx_DECREF(__pyx_v_msg_bytes);
  1173. __pyx_v_msg_bytes = __pyx_t_3;
  1174. __pyx_t_3 = 0;
  1175. /* "zmq/core/socket.pyx":101
  1176. * raise ZMQError()
  1177. * msg_bytes = copy_zmq_msg_bytes(&zmq_msg)
  1178. * with nogil: # <<<<<<<<<<<<<<
  1179. * zmq_msg_close(&zmq_msg)
  1180. * return msg_bytes
  1181. */
  1182. {
  1183. #ifdef WITH_THREAD
  1184. PyThreadState *_save;
  1185. #endif
  1186. Py_UNBLOCK_THREADS
  1187. /*try:*/ {
  1188. /* "zmq/core/socket.pyx":102
  1189. * msg_bytes = copy_zmq_msg_bytes(&zmq_msg)
  1190. * with nogil:
  1191. * zmq_msg_close(&zmq_msg) # <<<<<<<<<<<<<<
  1192. * return msg_bytes
  1193. *
  1194. */
  1195. zmq_msg_close((&__pyx_v_zmq_msg));
  1196. }
  1197. /* "zmq/core/socket.pyx":101
  1198. * raise ZMQError()
  1199. * msg_bytes = copy_zmq_msg_bytes(&zmq_msg)
  1200. * with nogil: # <<<<<<<<<<<<<<
  1201. * zmq_msg_close(&zmq_msg)…

Large files files are truncated, but you can click here to view the full file