PageRenderTime 60ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 3ms

/zmq/core/socket.c

https://bitbucket.org/fatbox/pyzmq-static
C | 11745 lines | 7798 code | 802 blank | 3145 comment | 1486 complexity | 9ae7b613a714132098158c41a6419f43 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:36 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__socket
  205. #define __PYX_HAVE_API__zmq__core__socket
  206. #include "allocate.h"
  207. #include "errno.h"
  208. #include "string.h"
  209. #include "zmq_compat.h"
  210. #include "zmq.h"
  211. #include "zmq_utils.h"
  212. #include "pyversion_compat.h"
  213. #include "stdio.h"
  214. #include "pythread.h"
  215. #ifdef _OPENMP
  216. #include <omp.h>
  217. #endif /* _OPENMP */
  218. #ifdef PYREX_WITHOUT_ASSERTIONS
  219. #define CYTHON_WITHOUT_ASSERTIONS
  220. #endif
  221. /* inline attribute */
  222. #ifndef CYTHON_INLINE
  223. #if defined(__GNUC__)
  224. #define CYTHON_INLINE __inline__
  225. #elif defined(_MSC_VER)
  226. #define CYTHON_INLINE __inline
  227. #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  228. #define CYTHON_INLINE inline
  229. #else
  230. #define CYTHON_INLINE
  231. #endif
  232. #endif
  233. /* unused attribute */
  234. #ifndef CYTHON_UNUSED
  235. # if defined(__GNUC__)
  236. # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
  237. # define CYTHON_UNUSED __attribute__ ((__unused__))
  238. # else
  239. # define CYTHON_UNUSED
  240. # endif
  241. # elif defined(__ICC) || defined(__INTEL_COMPILER)
  242. # define CYTHON_UNUSED __attribute__ ((__unused__))
  243. # else
  244. # define CYTHON_UNUSED
  245. # endif
  246. #endif
  247. 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*/
  248. /* Type Conversion Predeclarations */
  249. #define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
  250. #define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s))
  251. #define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
  252. #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
  253. static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
  254. static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
  255. static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
  256. static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
  257. static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
  258. #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
  259. #ifdef __GNUC__
  260. /* Test for GCC > 2.95 */
  261. #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
  262. #define likely(x) __builtin_expect(!!(x), 1)
  263. #define unlikely(x) __builtin_expect(!!(x), 0)
  264. #else /* __GNUC__ > 2 ... */
  265. #define likely(x) (x)
  266. #define unlikely(x) (x)
  267. #endif /* __GNUC__ > 2 ... */
  268. #else /* __GNUC__ */
  269. #define likely(x) (x)
  270. #define unlikely(x) (x)
  271. #endif /* __GNUC__ */
  272. static PyObject *__pyx_m;
  273. static PyObject *__pyx_b;
  274. static PyObject *__pyx_empty_tuple;
  275. static PyObject *__pyx_empty_bytes;
  276. static int __pyx_lineno;
  277. static int __pyx_clineno = 0;
  278. static const char * __pyx_cfilenm= __FILE__;
  279. static const char *__pyx_filename;
  280. static const char *__pyx_f[] = {
  281. "socket.pyx",
  282. "socket.pxd",
  283. "buffers.pxd",
  284. "message.pxd",
  285. "context.pxd",
  286. "bool.pxd",
  287. "complex.pxd",
  288. };
  289. /*--- Type declarations ---*/
  290. struct __pyx_obj_3zmq_4core_6socket_Socket;
  291. struct __pyx_obj_3zmq_4core_7context_Context;
  292. struct __pyx_obj_3zmq_4core_7message_MessageTracker;
  293. struct __pyx_obj_3zmq_4core_7message_Message;
  294. struct __pyx_opt_args_3zmq_4core_6socket_6Socket_send;
  295. struct __pyx_opt_args_3zmq_4core_6socket_6Socket_recv;
  296. struct __pyx_opt_args_3zmq_4core_6socket__recv_message;
  297. struct __pyx_opt_args_3zmq_4core_6socket__recv_copy;
  298. struct __pyx_opt_args_3zmq_4core_6socket__send_message;
  299. struct __pyx_opt_args_3zmq_4core_6socket__send_copy;
  300. /* "zmq/core/socket.pxd":47
  301. *
  302. * # cpdef methods for direct-cython access:
  303. * cpdef object send(self, object data, int flags=*, copy=*, track=*) # <<<<<<<<<<<<<<
  304. * cpdef object recv(self, int flags=*, copy=*, track=*)
  305. *
  306. */
  307. struct __pyx_opt_args_3zmq_4core_6socket_6Socket_send {
  308. int __pyx_n;
  309. int flags;
  310. PyObject *copy;
  311. PyObject *track;
  312. };
  313. /* "zmq/core/socket.pxd":48
  314. * # cpdef methods for direct-cython access:
  315. * cpdef object send(self, object data, int flags=*, copy=*, track=*)
  316. * cpdef object recv(self, int flags=*, copy=*, track=*) # <<<<<<<<<<<<<<
  317. *
  318. */
  319. struct __pyx_opt_args_3zmq_4core_6socket_6Socket_recv {
  320. int __pyx_n;
  321. int flags;
  322. PyObject *copy;
  323. PyObject *track;
  324. };
  325. /* "zmq/core/socket.pyx":99
  326. * return False
  327. *
  328. * cdef inline Message _recv_message(void *handle, int flags=0, track=False): # <<<<<<<<<<<<<<
  329. * """Receive a message in a non-copying manner and return a Message."""
  330. * cdef int rc
  331. */
  332. struct __pyx_opt_args_3zmq_4core_6socket__recv_message {
  333. int __pyx_n;
  334. int flags;
  335. PyObject *track;
  336. };
  337. /* "zmq/core/socket.pyx":112
  338. * return msg
  339. *
  340. * cdef inline object _recv_copy(void *handle, int flags=0): # <<<<<<<<<<<<<<
  341. * """Recieve a message and return a copy"""
  342. * cdef zmq_msg_t zmq_msg
  343. */
  344. struct __pyx_opt_args_3zmq_4core_6socket__recv_copy {
  345. int __pyx_n;
  346. int flags;
  347. };
  348. /* "zmq/core/socket.pyx":125
  349. * return msg_bytes
  350. *
  351. * cdef inline object _send_message(void *handle, Message msg, int flags=0): # <<<<<<<<<<<<<<
  352. * """Send a Message on this socket in a non-copy manner."""
  353. * cdef int rc
  354. */
  355. struct __pyx_opt_args_3zmq_4core_6socket__send_message {
  356. int __pyx_n;
  357. int flags;
  358. };
  359. /* "zmq/core/socket.pyx":144
  360. *
  361. *
  362. * cdef inline object _send_copy(void *handle, object msg, int flags=0): # <<<<<<<<<<<<<<
  363. * """Send a message on this socket by copying its content."""
  364. * cdef int rc, rc2
  365. */
  366. struct __pyx_opt_args_3zmq_4core_6socket__send_copy {
  367. int __pyx_n;
  368. int flags;
  369. };
  370. /* "zmq/core/socket.pxd":35
  371. *
  372. *
  373. * cdef class Socket: # <<<<<<<<<<<<<<
  374. * """A 0MQ socket."""
  375. *
  376. */
  377. struct __pyx_obj_3zmq_4core_6socket_Socket {
  378. PyObject_HEAD
  379. struct __pyx_vtabstruct_3zmq_4core_6socket_Socket *__pyx_vtab;
  380. void *handle;
  381. int socket_type;
  382. struct __pyx_obj_3zmq_4core_7context_Context *context;
  383. int _closed;
  384. PyObject *_attrs;
  385. };
  386. /* "context.pxd":26
  387. * #-----------------------------------------------------------------------------
  388. *
  389. * cdef class Context: # <<<<<<<<<<<<<<
  390. * """Manage the lifecycle of a 0MQ context."""
  391. *
  392. */
  393. struct __pyx_obj_3zmq_4core_7context_Context {
  394. PyObject_HEAD
  395. struct __pyx_vtabstruct_3zmq_4core_7context_Context *__pyx_vtab;
  396. void *handle;
  397. void **_sockets;
  398. size_t n_sockets;
  399. size_t max_sockets;
  400. PyObject *closed;
  401. };
  402. /* "message.pxd":32
  403. * #-----------------------------------------------------------------------------
  404. *
  405. * cdef class MessageTracker(object): # <<<<<<<<<<<<<<
  406. * """A class for tracking if 0MQ is done using one or more messages."""
  407. *
  408. */
  409. struct __pyx_obj_3zmq_4core_7message_MessageTracker {
  410. PyObject_HEAD
  411. PyObject *events;
  412. PyObject *peers;
  413. };
  414. /* "message.pxd":39
  415. *
  416. *
  417. * cdef class Message: # <<<<<<<<<<<<<<
  418. * """A Message class for non-copy send/recvs."""
  419. *
  420. */
  421. struct __pyx_obj_3zmq_4core_7message_Message {
  422. PyObject_HEAD
  423. struct __pyx_vtabstruct_3zmq_4core_7message_Message *__pyx_vtab;
  424. zmq_msg_t zmq_msg;
  425. PyObject *_data;
  426. PyObject *_buffer;
  427. PyObject *_bytes;
  428. int _failed_init;
  429. PyObject *tracker_event;
  430. PyObject *tracker;
  431. };
  432. /* "zmq/core/socket.pyx":171
  433. *
  434. *
  435. * cdef class Socket: # <<<<<<<<<<<<<<
  436. * """Socket(context, socket_type)
  437. *
  438. */
  439. struct __pyx_vtabstruct_3zmq_4core_6socket_Socket {
  440. 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);
  441. 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);
  442. };
  443. static struct __pyx_vtabstruct_3zmq_4core_6socket_Socket *__pyx_vtabptr_3zmq_4core_6socket_Socket;
  444. /* "message.pxd":39
  445. *
  446. *
  447. * cdef class Message: # <<<<<<<<<<<<<<
  448. * """A Message class for non-copy send/recvs."""
  449. *
  450. */
  451. struct __pyx_vtabstruct_3zmq_4core_7message_Message {
  452. struct __pyx_obj_3zmq_4core_7message_Message *(*fast_copy)(struct __pyx_obj_3zmq_4core_7message_Message *);
  453. PyObject *(*_getbuffer)(struct __pyx_obj_3zmq_4core_7message_Message *);
  454. };
  455. static struct __pyx_vtabstruct_3zmq_4core_7message_Message *__pyx_vtabptr_3zmq_4core_7message_Message;
  456. /* "context.pxd":26
  457. * #-----------------------------------------------------------------------------
  458. *
  459. * cdef class Context: # <<<<<<<<<<<<<<
  460. * """Manage the lifecycle of a 0MQ context."""
  461. *
  462. */
  463. struct __pyx_vtabstruct_3zmq_4core_7context_Context {
  464. void (*_add_socket)(struct __pyx_obj_3zmq_4core_7context_Context *, void *);
  465. void (*_remove_socket)(struct __pyx_obj_3zmq_4core_7context_Context *, void *);
  466. };
  467. static struct __pyx_vtabstruct_3zmq_4core_7context_Context *__pyx_vtabptr_3zmq_4core_7context_Context;
  468. #ifndef CYTHON_REFNANNY
  469. #define CYTHON_REFNANNY 0
  470. #endif
  471. #if CYTHON_REFNANNY
  472. typedef struct {
  473. void (*INCREF)(void*, PyObject*, int);
  474. void (*DECREF)(void*, PyObject*, int);
  475. void (*GOTREF)(void*, PyObject*, int);
  476. void (*GIVEREF)(void*, PyObject*, int);
  477. void* (*SetupContext)(const char*, int, const char*);
  478. void (*FinishContext)(void**);
  479. } __Pyx_RefNannyAPIStruct;
  480. static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  481. static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/
  482. #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
  483. #define __Pyx_RefNannySetupContext(name) __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
  484. #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  485. #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  486. #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  487. #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  488. #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  489. #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
  490. #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
  491. #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
  492. #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
  493. #else
  494. #define __Pyx_RefNannyDeclarations
  495. #define __Pyx_RefNannySetupContext(name)
  496. #define __Pyx_RefNannyFinishContext()
  497. #define __Pyx_INCREF(r) Py_INCREF(r)
  498. #define __Pyx_DECREF(r) Py_DECREF(r)
  499. #define __Pyx_GOTREF(r)
  500. #define __Pyx_GIVEREF(r)
  501. #define __Pyx_XINCREF(r) Py_XINCREF(r)
  502. #define __Pyx_XDECREF(r) Py_XDECREF(r)
  503. #define __Pyx_XGOTREF(r)
  504. #define __Pyx_XGIVEREF(r)
  505. #endif /* CYTHON_REFNANNY */
  506. static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
  507. static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
  508. static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
  509. static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/
  510. static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
  511. Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
  512. static void __Pyx_RaiseDoubleKeywordsError(
  513. const char* func_name, PyObject* kw_name); /*proto*/
  514. static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/
  515. static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
  516. const char *name, int exact); /*proto*/
  517. static CYTHON_INLINE int __Pyx_NegateNonNeg(int b) {
  518. return unlikely(b < 0) ? b : !b;
  519. }
  520. static CYTHON_INLINE PyObject* __Pyx_PyBoolOrNull_FromLong(long b) {
  521. return unlikely(b < 0) ? NULL : __Pyx_PyBool_FromLong(b);
  522. }
  523. static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
  524. static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void);
  525. #if PY_MAJOR_VERSION >= 3
  526. static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
  527. PyObject *value;
  528. if (unlikely(d == Py_None)) {
  529. __Pyx_RaiseNoneIndexingError();
  530. return NULL;
  531. }
  532. value = PyDict_GetItemWithError(d, key);
  533. if (unlikely(!value)) {
  534. if (!PyErr_Occurred())
  535. PyErr_SetObject(PyExc_KeyError, key);
  536. return NULL;
  537. }
  538. Py_INCREF(value);
  539. return value;
  540. }
  541. #else
  542. #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
  543. #endif
  544. static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/
  545. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
  546. PyObject *r;
  547. if (!j) return NULL;
  548. r = PyObject_GetItem(o, j);
  549. Py_DECREF(j);
  550. return r;
  551. }
  552. #define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
  553. __Pyx_GetItemInt_List_Fast(o, i) : \
  554. __Pyx_GetItemInt_Generic(o, to_py_func(i)))
  555. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) {
  556. if (likely(o != Py_None)) {
  557. if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
  558. PyObject *r = PyList_GET_ITEM(o, i);
  559. Py_INCREF(r);
  560. return r;
  561. }
  562. else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
  563. PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
  564. Py_INCREF(r);
  565. return r;
  566. }
  567. }
  568. return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
  569. }
  570. #define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
  571. __Pyx_GetItemInt_Tuple_Fast(o, i) : \
  572. __Pyx_GetItemInt_Generic(o, to_py_func(i)))
  573. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) {
  574. if (likely(o != Py_None)) {
  575. if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
  576. PyObject *r = PyTuple_GET_ITEM(o, i);
  577. Py_INCREF(r);
  578. return r;
  579. }
  580. else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
  581. PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
  582. Py_INCREF(r);
  583. return r;
  584. }
  585. }
  586. return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
  587. }
  588. #define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
  589. __Pyx_GetItemInt_Fast(o, i) : \
  590. __Pyx_GetItemInt_Generic(o, to_py_func(i)))
  591. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) {
  592. PyObject *r;
  593. if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) {
  594. r = PyList_GET_ITEM(o, i);
  595. Py_INCREF(r);
  596. }
  597. else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
  598. r = PyTuple_GET_ITEM(o, i);
  599. Py_INCREF(r);
  600. }
  601. else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) {
  602. r = PySequence_GetItem(o, i);
  603. }
  604. else {
  605. r = __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
  606. }
  607. return r;
  608. }
  609. static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value) {
  610. PyObject* value;
  611. #if PY_MAJOR_VERSION >= 3
  612. value = PyDict_GetItemWithError(d, key);
  613. if (unlikely(!value)) {
  614. if (unlikely(PyErr_Occurred()))
  615. return NULL;
  616. value = default_value;
  617. }
  618. Py_INCREF(value);
  619. #else
  620. if (PyString_CheckExact(key) || PyUnicode_CheckExact(key) || PyInt_CheckExact(key)) {
  621. /* these presumably have safe hash functions */
  622. value = PyDict_GetItem(d, key);
  623. if (unlikely(!value)) {
  624. value = default_value;
  625. }
  626. Py_INCREF(value);
  627. } else {
  628. PyObject *m;
  629. m = __Pyx_GetAttrString(d, "get");
  630. if (!m) return NULL;
  631. value = PyObject_CallFunctionObjArgs(m, key,
  632. (default_value == Py_None) ? NULL : default_value, NULL);
  633. Py_DECREF(m);
  634. }
  635. #endif
  636. return value;
  637. }
  638. static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
  639. static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
  640. static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/
  641. #ifndef __PYX_FORCE_INIT_THREADS
  642. #if PY_VERSION_HEX < 0x02040200
  643. #define __PYX_FORCE_INIT_THREADS 1
  644. #else
  645. #define __PYX_FORCE_INIT_THREADS 0
  646. #endif
  647. #endif
  648. static CYTHON_INLINE pyzmq_int64_t __Pyx_PyInt_from_py_pyzmq_int64_t(PyObject *);
  649. static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_pyzmq_int64_t(pyzmq_int64_t);
  650. static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_ZMQ_FD_T(ZMQ_FD_T);
  651. static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); /*proto*/
  652. #include <string.h>
  653. static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/
  654. static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/
  655. #if PY_MAJOR_VERSION >= 3
  656. #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
  657. #else
  658. #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
  659. #endif
  660. static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);
  661. static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);
  662. static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);
  663. static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *);
  664. static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *);
  665. static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *);
  666. static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);
  667. static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);
  668. static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);
  669. static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *);
  670. static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);
  671. static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);
  672. static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *);
  673. static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);
  674. static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);
  675. static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);
  676. static CYTHON_INLINE int __Pyx_StrEq(const char *, const char *); /*proto*/
  677. static int __Pyx_check_binary_version(void);
  678. static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
  679. static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/
  680. static PyObject *__Pyx_ImportModule(const char *name); /*proto*/
  681. static void* __Pyx_GetVtable(PyObject *dict); /*proto*/
  682. static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig); /*proto*/
  683. static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno,
  684. int __pyx_lineno, const char *__pyx_filename); /*proto*/
  685. static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
  686. /* Module declarations from 'zmq.core.libzmq' */
  687. /* Module declarations from 'zmq.core.message' */
  688. static PyTypeObject *__pyx_ptype_3zmq_4core_7message_MessageTracker = 0;
  689. static PyTypeObject *__pyx_ptype_3zmq_4core_7message_Message = 0;
  690. static PyObject *(*__pyx_f_3zmq_4core_7message_copy_zmq_msg_bytes)(zmq_msg_t *); /*proto*/
  691. /* Module declarations from 'zmq.core.context' */
  692. static PyTypeObject *__pyx_ptype_3zmq_4core_7context_Context = 0;
  693. /* Module declarations from 'cpython.version' */
  694. /* Module declarations from 'cpython.ref' */
  695. /* Module declarations from 'cpython.exc' */
  696. /* Module declarations from 'cpython.module' */
  697. /* Module declarations from 'cpython.mem' */
  698. /* Module declarations from 'cpython.tuple' */
  699. /* Module declarations from 'cpython.list' */
  700. /* Module declarations from 'libc.stdio' */
  701. /* Module declarations from 'cpython.object' */
  702. /* Module declarations from 'cpython.sequence' */
  703. /* Module declarations from 'cpython.mapping' */
  704. /* Module declarations from 'cpython.iterator' */
  705. /* Module declarations from 'cpython.type' */
  706. /* Module declarations from 'cpython.number' */
  707. /* Module declarations from 'cpython.int' */
  708. /* Module declarations from '__builtin__' */
  709. /* Module declarations from 'cpython.bool' */
  710. static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0;
  711. /* Module declarations from 'cpython.long' */
  712. /* Module declarations from 'cpython.float' */
  713. /* Module declarations from '__builtin__' */
  714. /* Module declarations from 'cpython.complex' */
  715. static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0;
  716. /* Module declarations from 'cpython.string' */
  717. /* Module declarations from 'cpython.unicode' */
  718. /* Module declarations from 'cpython.dict' */
  719. /* Module declarations from 'cpython.instance' */
  720. /* Module declarations from 'cpython.function' */
  721. /* Module declarations from 'cpython.method' */
  722. /* Module declarations from 'cpython.weakref' */
  723. /* Module declarations from 'cpython.getargs' */
  724. /* Module declarations from 'cpython.pythread' */
  725. /* Module declarations from 'cpython.pystate' */
  726. /* Module declarations from 'cpython.cobject' */
  727. /* Module declarations from 'cpython.oldbuffer' */
  728. /* Module declarations from 'cpython.set' */
  729. /* Module declarations from 'cpython.buffer' */
  730. /* Module declarations from 'cpython.bytes' */
  731. /* Module declarations from 'cpython.pycapsule' */
  732. /* Module declarations from 'cpython' */
  733. /* Module declarations from 'buffers' */
  734. static CYTHON_INLINE int __pyx_f_7buffers_newstyle_available(void); /*proto*/
  735. static CYTHON_INLINE int __pyx_f_7buffers_memoryview_available(void); /*proto*/
  736. static CYTHON_INLINE int __pyx_f_7buffers_oldstyle_available(void); /*proto*/
  737. static CYTHON_INLINE int __pyx_f_7buffers_check_buffer(PyObject *); /*proto*/
  738. static CYTHON_INLINE PyObject *__pyx_f_7buffers_asbuffer(PyObject *, int, int, void **, Py_ssize_t *, Py_ssize_t *); /*proto*/
  739. static CYTHON_INLINE PyObject *__pyx_f_7buffers_asbuffer_r(PyObject *, void **, Py_ssize_t *); /*proto*/
  740. static CYTHON_INLINE PyObject *__pyx_f_7buffers_asbuffer_w(PyObject *, void **, Py_ssize_t *); /*proto*/
  741. static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer_3(void *, Py_ssize_t, int); /*proto*/
  742. static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer_2(void *, Py_ssize_t, int); /*proto*/
  743. static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer(void *, Py_ssize_t, int); /*proto*/
  744. static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer_r(void *, Py_ssize_t); /*proto*/
  745. static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer_w(void *, Py_ssize_t); /*proto*/
  746. static CYTHON_INLINE PyObject *__pyx_f_7buffers_viewfromobject(PyObject *, int); /*proto*/
  747. static CYTHON_INLINE PyObject *__pyx_f_7buffers_viewfromobject_r(PyObject *); /*proto*/
  748. static CYTHON_INLINE PyObject *__pyx_f_7buffers_viewfromobject_w(PyObject *); /*proto*/
  749. /* Module declarations from 'zmq.core.socket' */
  750. static PyTypeObject *__pyx_ptype_3zmq_4core_6socket_Socket = 0;
  751. static CYTHON_INLINE PyObject *__pyx_f_3zmq_4core_6socket__check_closed(struct __pyx_obj_3zmq_4core_6socket_Socket *, int); /*proto*/
  752. 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*/
  753. 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*/
  754. 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*/
  755. 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*/
  756. #define __Pyx_MODULE_NAME "zmq.core.socket"
  757. int __pyx_module_is_main_zmq__core__socket = 0;
  758. /* Implementation of 'zmq.core.socket' */
  759. static PyObject *__pyx_builtin_property;
  760. static PyObject *__pyx_builtin_TypeError;
  761. static PyObject *__pyx_builtin_AttributeError;
  762. static PyObject *__pyx_builtin_xrange;
  763. static PyObject *__pyx_builtin_ValueError;
  764. static PyObject *__pyx_builtin_ImportError;
  765. static PyObject *__pyx_builtin_NotImplementedError;
  766. static char __pyx_k_2[] = "unicode not allowed, use setsockopt_unicode";
  767. static char __pyx_k_4[] = "expected bytes, got: %r";
  768. static char __pyx_k_5[] = "expected int, got: %r";
  769. static char __pyx_k_6[] = "utf-8";
  770. static char __pyx_k_7[] = "unicode strings only";
  771. static char __pyx_k_9[] = "option %i will not return a string to be decoded";
  772. static char __pyx_k_10[] = "zmq.core.socket";
  773. static char __pyx_k_11[] = "Socket has no such option: %s";
  774. static char __pyx_k_13[] = "expected str, got: %r";
  775. static char __pyx_k_14[] = "%s:%s";
  776. static char __pyx_k_15[] = "Could not bind socket to random port.";
  777. static char __pyx_k_20[] = "unicode not allowed, use send_unicode";
  778. static char __pyx_k_22[] = "Not a tracked message";
  779. static char __pyx_k_31[] = "unicode/str objects only";
  780. static char __pyx_k_33[] = "jsonlib{1,2}, json or simplejson library is required.";
  781. static char __pyx_k_36[] = "%r does not provide a buffer interface.";
  782. static char __pyx_k_37[] = "";
  783. static char __pyx_k_38[] = "New style buffers not available.";
  784. static char __pyx_k_40[] = "Old style buffers not available.";
  785. static char __pyx_k_42[] = "0MQ Socket class.";
  786. static char __pyx_k_43[] = "zmq.utils";
  787. static char __pyx_k_44[] = "zmq.core";
  788. static char __pyx_k_45[] = "zmq.core.constants";
  789. static char __pyx_k_46[] = "*";
  790. static char __pyx_k_47[] = "zmq.core.error";
  791. static char __pyx_k_48[] = "zmq.utils.strtypes";
  792. static char __pyx_k__B[] = "B";
  793. static char __pyx_k__u[] = "u";
  794. static char __pyx_k__obj[] = "obj";
  795. static char __pyx_k__sys[] = "sys";
  796. static char __pyx_k__zmq[] = "zmq";
  797. static char __pyx_k__addr[] = "addr";
  798. static char __pyx_k__bind[] = "bind";
  799. static char __pyx_k__char[] = "char";
  800. static char __pyx_k__copy[] = "copy";
  801. static char __pyx_k__data[] = "data";
  802. static char __pyx_k__poll[] = "poll";
  803. static char __pyx_k__recv[] = "recv";
  804. static char __pyx_k__send[] = "send";
  805. static char __pyx_k__time[] = "time";
  806. static char __pyx_k__bytes[] = "bytes";
  807. static char __pyx_k__close[] = "close";
  808. static char __pyx_k__dtype[] = "dtype";
  809. static char __pyx_k__dumps[] = "dumps";
  810. static char __pyx_k__flags[] = "flags";
  811. static char __pyx_k__loads[] = "loads";
  812. static char __pyx_k__range[] = "range";
  813. static char __pyx_k__track[] = "track";
  814. static char __pyx_k__upper[] = "upper";
  815. static char __pyx_k__POLLIN[] = "POLLIN";
  816. static char __pyx_k__Poller[] = "Poller";
  817. static char __pyx_k__Socket[] = "Socket";
  818. static char __pyx_k__buffer[] = "buffer";
  819. static char __pyx_k__closed[] = "closed";
  820. static char __pyx_k__codecs[] = "codecs";
  821. static char __pyx_k__decode[] = "decode";
  822. static char __pyx_k__encode[] = "encode";
  823. static char __pyx_k__linger[] = "linger";
  824. static char __pyx_k__option[] = "option";
  825. static char __pyx_k__optval[] = "optval";
  826. static char __pyx_k__pickle[] = "pickle";
  827. static char __pyx_k__prefix[] = "prefix";
  828. static char __pyx_k__random[] = "random";
  829. static char __pyx_k__struct[] = "struct";
  830. static char __pyx_k__xrange[] = "xrange";
  831. static char __pyx_k__ENOTSUP[] = "ENOTSUP";
  832. static char __pyx_k__POLLERR[] = "POLLERR";
  833. static char __pyx_k__SNDMORE[] = "SNDMORE";
  834. static char __pyx_k____all__[] = "__all__";
  835. static char __pyx_k___handle[] = "_handle";
  836. static char __pyx_k__cPickle[] = "cPickle";
  837. static char __pyx_k__context[] = "context";
  838. static char __pyx_k__jsonapi[] = "jsonapi";
  839. static char __pyx_k__jsonmod[] = "jsonmod";
  840. static char __pyx_k__timeout[] = "timeout";
  841. static char __pyx_k__tracker[] = "tracker";
  842. static char __pyx_k__unicode[] = "unicode";
  843. static char __pyx_k__ENOTSOCK[] = "ENOTSOCK";
  844. static char __pyx_k__ZMQError[] = "ZMQError";
  845. static char __pyx_k____main__[] = "__main__";
  846. static char __pyx_k____test__[] = "__test__";
  847. static char __pyx_k__copy_mod[] = "copy_mod";
  848. static char __pyx_k__encoding[] = "encoding";
  849. static char __pyx_k__itemsize[] = "itemsize";
  850. static char __pyx_k__max_port[] = "max_port";
  851. static char __pyx_k__min_port[] = "min_port";
  852. static char __pyx_k__property[] = "property";
  853. static char __pyx_k__protocol[] = "protocol";
  854. static char __pyx_k__register[] = "register";
  855. static char __pyx_k__typecode[] = "typecode";
  856. static char __pyx_k__TypeError[] = "TypeError";
  857. static char __pyx_k____class__[] = "__class__";
  858. static char __pyx_k__constants[] = "constants";
  859. static char __pyx_k__max_tries[] = "max_tries";
  860. static char __pyx_k__msg_parts[] = "msg_parts";
  861. static char __pyx_k__randrange[] = "randrange";
  862. static char __pyx_k__ValueError[] = "ValueError";
  863. static char __pyx_k____module__[] = "__module__";
  864. static char __pyx_k__basestring[] = "basestring";
  865. static char __pyx_k__getsockopt[] = "getsockopt";
  866. static char __pyx_k__setsockopt[] = "setsockopt";
  867. static char __pyx_k__ImportError[] = "ImportError";
  868. static char __pyx_k__socket_type[] = "socket_type";
  869. static char __pyx_k__ZMQBindError[] = "ZMQBindError";
  870. static char __pyx_k__AttributeError[] = "AttributeError";
  871. static char __pyx_k__bytes_sockopts[] = "bytes_sockopts";
  872. static char __pyx_k__int64_sockopts[] = "int64_sockopts";
  873. static char __pyx_k__NotImplementedError[] = "NotImplementedError";
  874. static PyObject *__pyx_kp_s_10;
  875. static PyObject *__pyx_kp_s_11;
  876. static PyObject *__pyx_kp_s_13;
  877. static PyObject *__pyx_kp_s_14;
  878. static PyObject *__pyx_kp_s_15;
  879. static PyObject *__pyx_kp_s_2;
  880. static PyObject *__pyx_kp_s_20;
  881. static PyObject *__pyx_kp_s_22;
  882. static PyObject *__pyx_kp_s_31;
  883. static PyObject *__pyx_kp_s_33;
  884. static PyObject *__pyx_kp_s_36;
  885. static PyObject *__pyx_kp_s_37;
  886. static PyObject *__pyx_kp_s_38;
  887. static PyObject *__pyx_kp_s_4;
  888. static PyObject *__pyx_kp_s_40;
  889. static PyObject *__pyx_n_s_43;
  890. static PyObject *__pyx_n_s_44;
  891. static PyObject *__pyx_n_s_45;
  892. static PyObject *__pyx_n_s_46;
  893. static PyObject *__pyx_n_s_47;
  894. static PyObject *__pyx_n_s_48;
  895. static PyObject *__pyx_kp_s_5;
  896. static PyObject *__pyx_kp_s_6;
  897. static PyObject *__pyx_kp_s_7;
  898. static PyObject *__pyx_kp_s_9;
  899. static PyObject *__pyx_n_s__AttributeError;
  900. static PyObject *__pyx_n_s__B;
  901. static PyObject *__pyx_n_s__ENOTSOCK;
  902. static PyObject *__pyx_n_s__ENOTSUP;
  903. static PyObject *__pyx_n_s__ImportError;
  904. static PyObject *__pyx_n_s__NotImplementedError;
  905. static PyObject *__pyx_n_s__POLLERR;
  906. static PyObject *__pyx_n_s__POLLIN;
  907. static PyObject *__pyx_n_s__Poller;
  908. static PyObject *__pyx_n_s__SNDMORE;
  909. static PyObject *__pyx_n_s__Socket;
  910. static PyObject *__pyx_n_s__TypeError;
  911. static PyObject *__pyx_n_s__ValueError;
  912. static PyObject *__pyx_n_s__ZMQBindError;
  913. static PyObject *__pyx_n_s__ZMQError;
  914. static PyObject *__pyx_n_s____all__;
  915. static PyObject *__pyx_n_s____class__;
  916. static PyObject *__pyx_n_s____main__;
  917. static PyObject *__pyx_n_s____module__;
  918. static PyObject *__pyx_n_s____test__;
  919. static PyObject *__pyx_n_s___handle;
  920. static PyObject *__pyx_n_s__addr;
  921. static PyObject *__pyx_n_s__basestring;
  922. static PyObject *__pyx_n_s__bind;
  923. static PyObject *__pyx_n_s__buffer;
  924. static PyObject *__pyx_n_s__bytes;
  925. static PyObject *__pyx_n_s__bytes_sockopts;
  926. static PyObject *__pyx_n_s__cPickle;
  927. static PyObject *__pyx_n_s__char;
  928. static PyObject *__pyx_n_s__close;
  929. static PyObject *__pyx_n_s__closed;
  930. static PyObject *__pyx_n_s__codecs;
  931. static PyObject *__pyx_n_s__constants;
  932. static PyObject *__pyx_n_s__context;
  933. static PyObject *__pyx_n_s__copy;
  934. static PyObject *__pyx_n_s__copy_mod;
  935. static PyObject *__pyx_n_s__data;
  936. static PyObject *__pyx_n_s__decode;
  937. static PyObject *__pyx_n_s__dtype;
  938. static PyObject *__pyx_n_s__dumps;
  939. static PyObject *__pyx_n_s__encode;
  940. static PyObject *__pyx_n_s__encoding;
  941. static PyObject *__pyx_n_s__flags;
  942. static PyObject *__pyx_n_s__getsockopt;
  943. static PyObject *__pyx_n_s__int64_sockopts;
  944. static PyObject *__pyx_n_s__itemsize;
  945. static PyObject *__pyx_n_s__jsonapi;
  946. static PyObject *__pyx_n_s__jsonmod;
  947. static PyObject *__pyx_n_s__linger;
  948. static PyObject *__pyx_n_s__loads;
  949. static PyObject *__pyx_n_s__max_port;
  950. static PyObject *__pyx_n_s__max_tries;
  951. static PyObject *__pyx_n_s__min_port;
  952. static PyObject *__pyx_n_s__msg_parts;
  953. static PyObject *__pyx_n_s__obj;
  954. static PyObject *__pyx_n_s__option;
  955. static PyObject *__pyx_n_s__optval;
  956. static PyObject *__pyx_n_s__pickle;
  957. static PyObject *__pyx_n_s__poll;
  958. static PyObject *__pyx_n_s__prefix;
  959. static PyObject *__pyx_n_s__property;
  960. static PyObject *__pyx_n_s__protocol;
  961. static PyObject *__pyx_n_s__random;
  962. static PyObject *__pyx_n_s__randrange;
  963. static PyObject *__pyx_n_s__range;
  964. static PyObject *__pyx_n_s__recv;
  965. static PyObject *__pyx_n_s__register;
  966. static PyObject *__pyx_n_s__send;
  967. static PyObject *__pyx_n_s__setsockopt;
  968. static PyObject *__pyx_n_s__socket_type;
  969. static PyObject *__pyx_n_s__struct;
  970. static PyObject *__pyx_n_s__sys;
  971. static PyObject *__pyx_n_s__time;
  972. static PyObject *__pyx_n_s__timeout;
  973. static PyObject *__pyx_n_s__track;
  974. static PyObject *__pyx_n_s__tracker;
  975. static PyObject *__pyx_n_s__typecode;
  976. static PyObject *__pyx_n_s__u;
  977. static PyObject *__pyx_n_s__unicode;
  978. static PyObject *__pyx_n_s__upper;
  979. static PyObject *__pyx_n_s__xrange;
  980. static PyObject *__pyx_n_s__zmq;
  981. static PyObject *__pyx_int_0;
  982. static PyObject *__pyx_int_neg_1;
  983. static PyObject *__pyx_int_100;
  984. static PyObject *__pyx_int_49152;
  985. static PyObject *__pyx_int_65536;
  986. static PyObject *__pyx_k_1;
  987. static PyObject *__pyx_k_18;
  988. static PyObject *__pyx_k_19;
  989. static PyObject *__pyx_k_24;
  990. static PyObject *__pyx_k_25;
  991. static PyObject *__pyx_k_26;
  992. static PyObject *__pyx_k_27;
  993. static PyObject *__pyx_k_28;
  994. static PyObject *__pyx_k_29;
  995. static PyObject *__pyx_k_30;
  996. static PyObject *__pyx_k_tuple_3;
  997. static PyObject *__pyx_k_tuple_8;
  998. static PyObject *__pyx_k_tuple_12;
  999. static PyObject *__pyx_k_tuple_16;
  1000. static PyObject *__pyx_k_tuple_17;
  1001. static PyObject *__pyx_k_tuple_21;
  1002. static PyObject *__pyx_k_tuple_23;
  1003. static PyObject *__pyx_k_tuple_32;
  1004. static PyObject *__pyx_k_tuple_34;
  1005. static PyObject *__pyx_k_tuple_35;
  1006. static PyObject *__pyx_k_tuple_39;
  1007. static PyObject *__pyx_k_tuple_41;
  1008. /* "zmq/core/socket.pyx":77
  1009. * # true methods frequently cannot be inlined, acc. Cython docs
  1010. *
  1011. * cdef inline _check_closed(Socket s, bint raise_notsup): # <<<<<<<<<<<<<<
  1012. * cdef int rc
  1013. * cdef int errno
  1014. */
  1015. static CYTHON_INLINE PyObject *__pyx_f_3zmq_4core_6socket__check_closed(struct __pyx_obj_3zmq_4core_6socket_Socket *__pyx_v_s, int __pyx_v_raise_notsup) {
  1016. int __pyx_v_rc;
  1017. int __pyx_v_stype;
  1018. size_t __pyx_v_sz;
  1019. PyObject *__pyx_r = NULL;
  1020. __Pyx_RefNannyDeclarations
  1021. PyObject *__pyx_t_1 = NULL;
  1022. PyObject *__pyx_t_2 = NULL;
  1023. PyObject *__pyx_t_3 = NULL;
  1024. int __pyx_t_4;
  1025. int __pyx_t_5;
  1026. int __pyx_lineno = 0;
  1027. const char *__pyx_filename = NULL;
  1028. int __pyx_clineno = 0;
  1029. __Pyx_RefNannySetupContext("_check_closed");
  1030. /* "zmq/core/socket.pyx":81
  1031. * cdef int errno
  1032. * cdef int stype
  1033. * cdef size_t sz=sizeof(int) # <<<<<<<<<<<<<<
  1034. * if s._closed:
  1035. * if raise_notsup:
  1036. */
  1037. __pyx_v_sz = (sizeof(int));
  1038. /* "zmq/core/socket.pyx":82
  1039. * cdef int stype
  1040. * cdef size_t sz=sizeof(int)
  1041. * if s._closed: # <<<<<<<<<<<<<<
  1042. * if raise_notsup:
  1043. * raise ZMQError(ENOTSUP)
  1044. */
  1045. if (__pyx_v_s->_closed) {
  1046. /* "zmq/core/socket.pyx":83
  1047. * cdef size_t sz=sizeof(int)
  1048. * if s._closed:
  1049. * if raise_notsup: # <<<<<<<<<<<<<<
  1050. * raise ZMQError(ENOTSUP)
  1051. * else:
  1052. */
  1053. if (__pyx_v_raise_notsup) {
  1054. /* "zmq/core/socket.pyx":84
  1055. * if s._closed:
  1056. * if raise_notsup:
  1057. * raise ZMQError(ENOTSUP) # <<<<<<<<<<<<<<
  1058. * else:
  1059. * return True
  1060. */
  1061. __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1062. __Pyx_GOTREF(__pyx_t_1);
  1063. __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__ENOTSUP); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1064. __Pyx_GOTREF(__pyx_t_2);
  1065. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1066. __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  1067. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  1068. __Pyx_GIVEREF(__pyx_t_2);
  1069. __pyx_t_2 = 0;
  1070. __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1071. __Pyx_GOTREF(__pyx_t_2);
  1072. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1073. __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  1074. __Pyx_Raise(__pyx_t_2, 0, 0, 0);
  1075. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  1076. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1077. goto __pyx_L4;
  1078. }
  1079. /*else*/ {
  1080. /* "zmq/core/socket.pyx":86
  1081. * raise ZMQError(ENOTSUP)
  1082. * else:
  1083. * return True # <<<<<<<<<<<<<<
  1084. * else:
  1085. * rc = zmq_getsockopt(s.handle, ZMQ_TYPE, <void *>&stype, &sz)
  1086. */
  1087. __Pyx_XDECREF(__pyx_r);
  1088. __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1089. __Pyx_GOTREF(__pyx_t_2);
  1090. __pyx_r = __pyx_t_2;
  1091. __pyx_t_2 = 0;
  1092. goto __pyx_L0;
  1093. }
  1094. __pyx_L4:;
  1095. goto __pyx_L3;
  1096. }
  1097. /*else*/ {
  1098. /* "zmq/core/socket.pyx":88
  1099. * return True
  1100. * else:
  1101. * rc = zmq_getsockopt(s.handle, ZMQ_TYPE, <void *>&stype, &sz) # <<<<<<<<<<<<<<
  1102. * if rc and zmq_errno() == ENOTSOCK:
  1103. * s._closed = True
  1104. */
  1105. __pyx_v_rc = zmq_getsockopt(__pyx_v_s->handle, ZMQ_TYPE, ((void *)(&__pyx_v_stype)), (&__pyx_v_sz));
  1106. /* "zmq/core/socket.pyx":89
  1107. * else:
  1108. * rc = zmq_getsockopt(s.handle, ZMQ_TYPE, <void *>&stype, &sz)
  1109. * if rc and zmq_errno() == ENOTSOCK: # <<<<<<<<<<<<<<
  1110. * s._closed = True
  1111. * if raise_notsup:
  1112. */
  1113. if (__pyx_v_rc) {
  1114. __pyx_t_2 = PyInt_FromLong(zmq_errno()); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1115. __Pyx_GOTREF(__pyx_t_2);
  1116. __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__ENOTSOCK); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1117. __Pyx_GOTREF(__pyx_t_3);
  1118. __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1119. __Pyx_GOTREF(__pyx_t_1);
  1120. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  1121. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  1122. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1123. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1124. __pyx_t_5 = __pyx_t_4;
  1125. } else {
  1126. __pyx_t_5 = __pyx_v_rc;
  1127. }
  1128. if (__pyx_t_5) {
  1129. /* "zmq/core/socket.pyx":90
  1130. * rc = zmq_getsockopt(s.handle, ZMQ_TYPE, <void *>&stype, &sz)
  1131. * if rc and zmq_errno() == ENOTSOCK:
  1132. * s._closed = True # <<<<<<<<<<<<<<
  1133. * if raise_notsup:
  1134. * raise ZMQError(ENOTSUP)
  1135. */
  1136. __pyx_v_s->_closed = 1;
  1137. /* "zmq/core/socket.pyx":91
  1138. * if rc and zmq_errno() == ENOTSOCK:
  1139. * s._closed = True
  1140. * if raise_notsup: # <<<<<<<<<<<<<<
  1141. * raise ZMQError(ENOTSUP)
  1142. * else:
  1143. */
  1144. if (__pyx_v_raise_notsup) {
  1145. /* "zmq/core/socket.pyx":92
  1146. * s._closed = True
  1147. * if raise_notsup:
  1148. * raise ZMQError(ENOTSUP) # <<<<<<<<<<<<<<
  1149. * else:
  1150. * return True
  1151. */
  1152. __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1153. __Pyx_GOTREF(__pyx_t_1);
  1154. __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__ENOTSUP); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1155. __Pyx_GOTREF(__pyx_t_3);
  1156. __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1157. __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  1158. PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
  1159. __Pyx_GIVEREF(__pyx_t_3);
  1160. __pyx_t_3 = 0;
  1161. __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1162. __Pyx_GOTREF(__pyx_t_3);
  1163. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1164. __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  1165. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  1166. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  1167. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1168. goto __pyx_L6;
  1169. }
  1170. /*else*/ {
  1171. /* "zmq/core/socket.pyx":94
  1172. * raise ZMQError(ENOTSUP)
  1173. * else:
  1174. * return True # <<<<<<<<<<<<<<
  1175. * elif rc:
  1176. * raise ZMQError()
  1177. */
  1178. __Pyx_XDECREF(__pyx_r);
  1179. __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1180. __Pyx_GOTREF(__pyx_t_3);
  1181. __pyx_r = __pyx_t_3;
  1182. __pyx_t_3 = 0;
  1183. goto __pyx_L0;
  1184. }
  1185. __pyx_L6:;
  1186. goto __pyx_L5;
  1187. }
  1188. /* "zmq/core/socket.pyx":95
  1189. * else:
  1190. * return True
  1191. * elif rc: # <<<<<<<<<<<<<<
  1192. * raise ZMQError()
  1193. * return False
  1194. */
  1195. if (__pyx_v_rc) {
  1196. /* "zmq/core/socket.pyx":96
  1197. * return True
  1198. * elif rc:
  1199. * raise ZMQError() # <<<<<<<<<<<<<<
  1200. * return False
  1201. *
  1202. */
  1203. __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1204. __Pyx_GOTREF(__pyx_t_3);
  1205. __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1206. __Pyx_GOTREF(__pyx_t_2);
  1207. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  1208. __Pyx_Raise(__pyx_t_2, 0, 0, 0);
  1209. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  1210. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1211. goto __pyx_L5;
  1212. }
  1213. __pyx_L5:;
  1214. }
  1215. __pyx_L3:;
  1216. /* "zmq/core/socket.pyx":97
  1217. * elif rc:
  1218. * raise ZMQError()
  1219. * return False # <<<<<<<<<<<<<<
  1220. *
  1221. * cdef inline Message _recv_message(void *handle, int flags=0, track=False):
  1222. */
  1223. __Pyx_XDECREF(__pyx_r);
  1224. __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1225. __Pyx_GOTREF(__pyx_t_2);
  1226. __pyx_r = __pyx_t_2;
  1227. __pyx_t_2 = 0;
  1228. goto __pyx_L0;
  1229. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  1230. goto __pyx_L0;
  1231. __pyx_L1_error:;
  1232. __Pyx_XDECREF(__pyx_t_1);
  1233. __Pyx_XDECREF(__pyx_t_2);
  1234. __Pyx_XDECREF(__pyx_t_3);
  1235. __Pyx_AddTraceback("zmq.core.socket._check_closed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  1236. __pyx_r = 0;
  1237. __pyx_L0:;
  1238. __Pyx_XGIVEREF(__pyx_r);
  1239. __Pyx_RefNannyFinishContext();
  1240. return __pyx_r;
  1241. }
  1242. /* "zmq/core/socket.pyx":99
  1243. * return False
  1244. *
  1245. * cdef inline Message _recv_message(void *handle, int flags=0, track=False): # <<<<<<<<<<<<<<
  1246. * """Receive a message in a non-copying manner and return a Message."""
  1247. * cdef int rc
  1248. */
  1249. 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) {
  1250. int __pyx_v_flags = ((int)0);
  1251. PyObject *__pyx_v_track = __pyx_k_1;
  1252. int __pyx_v_rc;
  1253. struct __pyx_obj_3zmq_4core_7message_Message *__pyx_v_msg = 0;
  1254. struct __pyx_obj_3zmq_4core_7message_Message *__pyx_r = NULL;
  1255. __Pyx_RefNannyDeclarations
  1256. PyObject *__pyx_t_1 = NULL;
  1257. PyObject *__pyx_t_2 = NULL;
  1258. int __pyx_t_3;
  1259. int __pyx_lineno = 0;
  1260. const char *__pyx_filename = NULL;
  1261. int __pyx_clineno = 0;
  1262. __Pyx_RefNannySetupContext("_recv_message");
  1263. if (__pyx_optional_args) {
  1264. if (__pyx_optional_args->__pyx_n > 0) {
  1265. __pyx_v_flags = __pyx_optional_args->flags;
  1266. if (__pyx_optional_args->__pyx_n > 1) {
  1267. __pyx_v_track = __pyx_optional_args->track;
  1268. }
  1269. }
  1270. }
  1271. /* "zmq/core/socket.pyx":103
  1272. * cdef int rc
  1273. * cdef Message msg
  1274. * msg = Message(track=track) # <<<<<<<<<<<<<<
  1275. *
  1276. * with nogil:
  1277. */
  1278. __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1279. __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  1280. if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__track), __pyx_v_track) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1281. __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 = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1282. __Pyx_GOTREF(__pyx_t_2);
  1283. __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  1284. __pyx_v_msg = ((struct __pyx_obj_3zmq_4core_7message_Message *)__pyx_t_2);
  1285. __pyx_t_2 = 0;
  1286. /* "zmq/core/socket.pyx":105
  1287. * msg = Message(track=track)
  1288. *
  1289. * with nogil: # <<<<<<<<<<<<<<
  1290. * rc = zmq_recvmsg(handle, &msg.zmq_msg, flags)
  1291. *
  1292. */
  1293. {
  1294. #ifdef WITH_THREAD
  1295. PyThreadState *_save = NULL;
  1296. #endif
  1297. Py_UNBLOCK_THREADS
  1298. /*try:*/ {
  1299. /* "zmq/core/socket.pyx":106
  1300. *
  1301. * with nogil:
  1302. * rc = zmq_recvmsg(handle, &msg.zmq_msg, flags) # <<<<<<<<<<<<<<
  1303. *
  1304. * if rc < 0:
  1305. */
  1306. __pyx_v_rc = zmq_recvmsg(__pyx_v_handle, (&__pyx_v_msg->zmq_msg), __pyx_v_flags);
  1307. }
  1308. /* "zmq/core/socket.pyx":105
  1309. * msg = Message(track=track)
  1310. *
  1311. * with nogil: # <<<<<<<<<<<<<<
  1312. * rc = zmq_recvmsg(handle, &msg.zmq_msg, flags)
  1313. *
  1314. */
  1315. /*finally:*/ {
  1316. Py_BLOCK_THREADS
  1317. }
  1318. }
  1319. /* "zmq/core/socket.pyx":108
  1320. * rc = zmq_recvmsg(handle, &msg.zmq_msg, flags)
  1321. *
  1322. * if rc < 0: # <<<<<<<<<<<<<<
  1323. * raise ZMQError()
  1324. * return msg
  1325. */
  1326. __pyx_t_3 = (__pyx_v_rc < 0);
  1327. if (__pyx_t_3) {
  1328. /* "zmq/core/socket.pyx":109
  1329. *
  1330. * if rc < 0:
  1331. * raise ZMQError() # <<<<<<<<<<<<<<
  1332. * return msg
  1333. *
  1334. */
  1335. __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1336. __Pyx_GOTREF(__pyx_t_2);
  1337. __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 = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1338. __Pyx_GOTREF(__pyx_t_1);
  1339. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  1340. __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  1341. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1342. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1343. goto __pyx_L6;
  1344. }
  1345. __pyx_L6:;
  1346. /* "zmq/core/socket.pyx":110
  1347. * if rc < 0:
  1348. * raise ZMQError()
  1349. * return msg # <<<<<<<<<<<<<<
  1350. *
  1351. * cdef inline object _recv_copy(void *handle, int flags=0):
  1352. */
  1353. __Pyx_XDECREF(((PyObject *)__pyx_r));
  1354. __Pyx_INCREF(((PyObject *)__pyx_v_msg));
  1355. __pyx_r = __pyx_v_msg;
  1356. goto __pyx_L0;
  1357. __pyx_r = ((struct __pyx_obj_3zmq_4core_7message_Message *)Py_None); __Pyx_INCREF(Py_None);
  1358. goto __pyx_L0;
  1359. __pyx_L1_error:;
  1360. __Pyx_XDECREF(__pyx_t_1);
  1361. __Pyx_XDECREF(__pyx_t_2);
  1362. __Pyx_AddTraceback("zmq.core.socket._recv_message", __pyx_clineno, __pyx_lineno, __pyx_filename);
  1363. __pyx_r = 0;
  1364. __pyx_L0:;
  1365. __Pyx_XDECREF((PyObject *)__pyx_v_msg);
  1366. __Pyx_XGIVEREF((PyObject *)__pyx_r);
  1367. __Pyx_RefNannyFinishContext();
  1368. return __pyx_r;
  1369. }
  1370. /* "zmq/core/socket.pyx":112
  1371. * return msg
  1372. *
  1373. * cdef inline object _recv_copy(void *handle, int flags=0): # <<<<<<<<<<<<<<
  1374. * """Recieve a message and return a copy"""
  1375. * cdef zmq_msg_t zmq_msg
  1376. */
  1377. 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) {
  1378. int __pyx_v_flags = ((int)0);
  1379. zmq_msg_t __pyx_v_zmq_msg;
  1380. int __pyx_v_rc;
  1381. PyObject *__pyx_v_msg_bytes = NULL;
  1382. PyObject *__pyx_r = NULL;
  1383. __Pyx_RefNannyDeclarations
  1384. int __pyx_t_1;
  1385. PyObject *__pyx_t_2 = NULL;
  1386. PyObject *__pyx_t_3 = NULL;
  1387. int __pyx_lineno = 0;
  1388. const char *__pyx_filename = NULL;
  1389. int __pyx_clineno = 0;
  1390. __Pyx_RefNannySetupContext("_recv_copy");
  1391. if (__pyx_optional_args) {
  1392. if (__pyx_optional_args->__pyx_n > 0) {
  1393. __pyx_v_flags = __pyx_optional_args->flags;
  1394. }
  1395. }
  1396. /* "zmq/core/socket.pyx":115
  1397. * """Recieve a message and return a copy"""
  1398. * cdef zmq_msg_t zmq_msg
  1399. * with nogil: # <<<<<<<<<<<<<<
  1400. * zmq_msg_init (&zmq_msg)
  1401. * rc = zmq_recvmsg(handle, &zmq_msg, flags)
  1402. */
  1403. {
  1404. #ifdef WITH_THREAD
  1405. PyThreadState *_save = NULL;
  1406. #endif
  1407. Py_UNBLOCK_THREADS
  1408. /*try:*/ {
  1409. /* "zmq/core/socket.pyx":116
  1410. * cdef zmq_msg_t zmq_msg
  1411. * with nogil:
  1412. * zmq_msg_init (&zmq_msg) # <<<<<<<<<<<<<<
  1413. * rc = zmq_recvmsg(handle, &zmq_msg, flags)
  1414. * if rc < 0:
  1415. */
  1416. zmq_msg_init((&__pyx_v_zmq_msg));
  1417. /* "zmq/core/socket.pyx":117
  1418. * with nogil:
  1419. * zmq_msg_init (&zmq_msg)
  1420. * rc = zmq_recvmsg(handle, &zmq_msg, flags) # <<<<<<<<<<<<<<
  1421. * if rc < 0:
  1422. * raise ZMQError()
  1423. */
  1424. __pyx_v_rc = zmq_recvmsg(__pyx_v_handle, (&__pyx_v_zmq_msg), __pyx_v_flags);
  1425. }
  1426. /* "zmq/core/socket.pyx":115
  1427. * """Recieve a message and return a copy"""
  1428. * cdef zmq_msg_t zmq_msg
  1429. * with nogil: # <<<<<<<<<<<<<<
  1430. * zmq_msg_init (&zmq_msg)
  1431. * rc = zmq_recvmsg(handle, &zmq_msg, flags)
  1432. */
  1433. /*finally:*/ {
  1434. Py_BLOCK_THREADS
  1435. }
  1436. }
  1437. /* "zmq/core/socket.pyx":118
  1438. * zmq_msg_init (&zmq_msg)
  1439. * rc = zmq_recvmsg(handle, &zmq_msg, flags)
  1440. * if rc < 0: # <<<<<<<<<<<<<<
  1441. * raise ZMQError()
  1442. * msg_bytes = copy_zmq_msg_bytes(&zmq_msg)
  1443. */
  1444. __pyx_t_1 = (__pyx_v_rc < 0);
  1445. if (__pyx_t_1) {
  1446. /* "zmq/core/socket.pyx":119
  1447. * rc = zmq_recvmsg(handle, &zmq_msg, flags)
  1448. * if rc < 0:
  1449. * raise ZMQError() # <<<<<<<<<<<<<<
  1450. * msg_bytes = copy_zmq_msg_bytes(&zmq_msg)
  1451. * with nogil:
  1452. */
  1453. __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1454. __Pyx_GOTREF(__pyx_t_2);
  1455. __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 = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1456. __Pyx_GOTREF(__pyx_t_3);
  1457. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  1458. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  1459. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  1460. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1461. goto __pyx_L6;
  1462. }
  1463. __pyx_L6:;
  1464. /* "zmq/core/socket.pyx":120
  1465. * if rc < 0:
  1466. * raise ZMQError()
  1467. * msg_bytes = copy_zmq_msg_bytes(&zmq_msg) # <<<<<<<<<<<<<<
  1468. * with nogil:
  1469. * zmq_msg_close(&zmq_msg)
  1470. */
  1471. __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 = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1472. __Pyx_GOTREF(__pyx_t_3);
  1473. __pyx_v_msg_bytes = __pyx_t_3;
  1474. __pyx_t_3 = 0;
  1475. /* "zmq/core/socket.pyx":121
  1476. * raise ZMQError()
  1477. * msg_bytes = copy_zmq_msg_bytes(&zmq_msg)
  1478. * with nogil: # <<<<<<<<<<<<<<
  1479. * zmq_msg_close(&zmq_msg)
  1480. * return msg_bytes
  1481. */
  1482. {
  1483. #ifdef WITH_THREAD
  1484. PyThreadState *_save = NULL;
  1485. #endif
  1486. Py_UNBLOCK_THREADS
  1487. /*try:*/ {
  1488. /* "zmq/core/socket.pyx":122
  1489. * msg_bytes = copy_zmq_msg_bytes(&zmq_msg)
  1490. * with nogil:
  1491. * zmq_msg_close(&zmq_msg) # <<<<<<<<<<<<<<
  1492. * return msg_bytes
  1493. *
  1494. */
  1495. zmq_msg_close((&__pyx_v_zmq_msg));
  1496. }
  1497. /* "zmq/core/socket.pyx":121
  1498. * raise ZMQError()
  1499. * msg_bytes = copy_zmq_msg_bytes(&zmq_msg)
  1500. * with nogil: # <<<<<<<<<<<<<<
  1501. * zmq_msg_close(&zmq_msg)
  1502. * return msg_bytes
  1503. */
  1504. /*finally:*/ {
  1505. Py_BLOCK_THREADS
  1506. }
  1507. }
  1508. /* "zmq/core/socket.pyx":123
  1509. * with nogil:
  1510. * zmq_msg_close(&zmq_msg)
  1511. * return msg_bytes # <<<<<<<<<<<<<<
  1512. *
  1513. * cdef inline object _send_message(void *handle, Message msg, int flags=0):
  1514. */
  1515. __Pyx_XDECREF(__pyx_r);
  1516. __Pyx_INCREF(__pyx_v_msg_bytes);
  1517. __pyx_r = __pyx_v_msg_bytes;
  1518. goto __pyx_L0;
  1519. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  1520. goto __pyx_L0;
  1521. __pyx_L1_error:;
  1522. __Pyx_XDECREF(__pyx_t_2);
  1523. __Pyx_XDECREF(__pyx_t_3);
  1524. __Pyx_AddTraceback("zmq.core.socket._recv_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  1525. __pyx_r = 0;
  1526. __pyx_L0:;
  1527. __Pyx_XDECREF(__pyx_v_msg_bytes);
  1528. __Pyx_XGIVEREF(__pyx_r);
  1529. __Pyx_RefNannyFinishContext();
  1530. return __pyx_r;
  1531. }
  1532. /* "zmq/core/socket.pyx":125
  1533. * return msg_bytes
  1534. *
  1535. * cdef inline object _send_message(void *handle, Message msg, int flags=0): # <<<<<<<<<<<<<<
  1536. * """Send a Message on this socket in a non-copy manner."""
  1537. * cdef int rc
  1538. */
  1539. static CYTHON_INLINE PyObject *__pyx_f_3zmq_4core_6socket__send_message(void *__pyx_v_handle, struct __pyx_obj_3zmq_4core_7message_Message *__pyx_v_msg, struct __pyx_opt_args_3zmq_4core_6socket__send_message *__pyx_optional_args) {
  1540. int __pyx_v_flags = ((int)0);
  1541. int __pyx_v_rc;
  1542. struct __pyx_obj_3zmq_4core_7message_Message *__pyx_v_msg_copy = 0;
  1543. PyObject *__pyx_r = NULL;
  1544. __Pyx_RefNannyDeclarations
  1545. PyObject *__pyx_t_1 = NULL;
  1546. int __pyx_t_2;
  1547. PyObject *__pyx_t_3 = NULL;
  1548. int __pyx_lineno = 0;
  1549. const char *__pyx_filename = NULL;
  1550. int __pyx_clineno = 0;
  1551. __Pyx_RefNannySetupContext("_send_message");
  1552. if (__pyx_optional_args) {
  1553. if (__pyx_optional_args->__pyx_n > 0) {
  1554. __pyx_v_flags = __pyx_optional_args->flags;
  1555. }
  1556. }
  1557. /* "zmq/core/socket.pyx":132
  1558. * # Always copy so the original message isn't garbage collected.
  1559. * # This doesn't do a real copy, just a reference.
  1560. * msg_copy = msg.fast_copy() # <<<<<<<<<<<<<<
  1561. *
  1562. * with nogil:
  1563. */
  1564. __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_3zmq_4core_7message_Message *)__pyx_v_msg->__pyx_vtab)->fast_copy(__pyx_v_msg)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1565. __Pyx_GOTREF(__pyx_t_1);
  1566. __pyx_v_msg_copy = ((struct __pyx_obj_3zmq_4core_7message_Message *)__pyx_t_1);
  1567. __pyx_t_1 = 0;
  1568. /* "zmq/core/socket.pyx":134
  1569. * msg_copy = msg.fast_copy()
  1570. *
  1571. * with nogil: # <<<<<<<<<<<<<<
  1572. * rc = zmq_sendmsg(handle, &msg_copy.zmq_msg, flags)
  1573. *
  1574. */
  1575. {
  1576. #ifdef WITH_THREAD
  1577. PyThreadState *_save = NULL;
  1578. #endif
  1579. Py_UNBLOCK_THREADS
  1580. /*try:*/ {
  1581. /* "zmq/core/socket.pyx":135
  1582. *
  1583. * with nogil:
  1584. * rc = zmq_sendmsg(handle, &msg_copy.zmq_msg, flags) # <<<<<<<<<<<<<<
  1585. *
  1586. * if rc < 0:
  1587. */
  1588. __pyx_v_rc = zmq_sendmsg(__pyx_v_handle, (&__pyx_v_msg_copy->zmq_msg), __pyx_v_flags);
  1589. }
  1590. /* "zmq/core/socket.pyx":134
  1591. * msg_copy = msg.fast_copy()
  1592. *
  1593. * with nogil: # <<<<<<<<<<<<<<
  1594. * rc = zmq_sendmsg(handle, &msg_copy.zmq_msg, flags)
  1595. *
  1596. */
  1597. /*finally:*/ {
  1598. Py_BLOCK_THREADS
  1599. }
  1600. }
  1601. /* "zmq/core/socket.pyx":137
  1602. * rc = zmq_sendmsg(handle, &msg_copy.zmq_msg, flags)
  1603. *
  1604. * if rc < 0: # <<<<<<<<<<<<<<
  1605. * # don't pop from the Queue here, because the free_fn will
  1606. * # still call Queue.get() even if the send fails
  1607. */
  1608. __pyx_t_2 = (__pyx_v_rc < 0);
  1609. if (__pyx_t_2) {
  1610. /* "zmq/core/socket.pyx":140
  1611. * # don't pop from the Queue here, because the free_fn will
  1612. * # still call Queue.get() even if the send fails
  1613. * raise ZMQError() # <<<<<<<<<<<<<<
  1614. * return msg.tracker
  1615. *
  1616. */
  1617. __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1618. __Pyx_GOTREF(__pyx_t_1);
  1619. __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1620. __Pyx_GOTREF(__pyx_t_3);
  1621. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1622. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  1623. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  1624. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1625. goto __pyx_L6;
  1626. }
  1627. __pyx_L6:;
  1628. /* "zmq/core/socket.pyx":141
  1629. * # still call Queue.get() even if the send fails
  1630. * raise ZMQError()
  1631. * return msg.tracker # <<<<<<<<<<<<<<
  1632. *
  1633. *
  1634. */
  1635. __Pyx_XDECREF(__pyx_r);
  1636. __Pyx_INCREF(__pyx_v_msg->tracker);
  1637. __pyx_r = __pyx_v_msg->tracker;
  1638. goto __pyx_L0;
  1639. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  1640. goto __pyx_L0;
  1641. __pyx_L1_error:;
  1642. __Pyx_XDECREF(__pyx_t_1);
  1643. __Pyx_XDECREF(__pyx_t_3);
  1644. __Pyx_AddTraceback("zmq.core.socket._send_message", __pyx_clineno, __pyx_lineno, __pyx_filename);
  1645. __pyx_r = 0;
  1646. __pyx_L0:;
  1647. __Pyx_XDECREF((PyObject *)__pyx_v_msg_copy);
  1648. __Pyx_XGIVEREF(__pyx_r);
  1649. __Pyx_RefNannyFinishContext();
  1650. return __pyx_r;
  1651. }
  1652. /* "zmq/core/socket.pyx":144
  1653. *
  1654. *
  1655. * cdef inline object _send_copy(void *handle, object msg, int flags=0): # <<<<<<<<<<<<<<
  1656. * """Send a message on this socket by copying its content."""
  1657. * cdef int rc, rc2
  1658. */
  1659. static CYTHON_INLINE PyObject *__pyx_f_3zmq_4core_6socket__send_copy(void *__pyx_v_handle, PyObject *__pyx_v_msg, struct __pyx_opt_args_3zmq_4core_6socket__send_copy *__pyx_optional_args) {
  1660. int __pyx_v_flags = ((int)0);
  1661. int __pyx_v_rc;
  1662. int __pyx_v_rc2;
  1663. zmq_msg_t __pyx_v_data;
  1664. char *__pyx_v_msg_c;
  1665. Py_ssize_t __pyx_v_msg_c_len;
  1666. PyObject *__pyx_r = NULL;
  1667. __Pyx_RefNannyDeclarations
  1668. PyObject *__pyx_t_1 = NULL;
  1669. int __pyx_t_2;
  1670. PyObject *__pyx_t_3 = NULL;
  1671. int __pyx_t_4;
  1672. int __pyx_t_5;
  1673. int __pyx_lineno = 0;
  1674. const char *__pyx_filename = NULL;
  1675. int __pyx_clineno = 0;
  1676. __Pyx_RefNannySetupContext("_send_copy");
  1677. if (__pyx_optional_args) {
  1678. if (__pyx_optional_args->__pyx_n > 0) {
  1679. __pyx_v_flags = __pyx_optional_args->flags;
  1680. }
  1681. }
  1682. /* "zmq/core/socket.pyx":149
  1683. * cdef zmq_msg_t data
  1684. * cdef char *msg_c
  1685. * cdef Py_ssize_t msg_c_len=0 # <<<<<<<<<<<<<<
  1686. *
  1687. * # copy to c array:
  1688. */
  1689. __pyx_v_msg_c_len = 0;
  1690. /* "zmq/core/socket.pyx":152
  1691. *
  1692. * # copy to c array:
  1693. * asbuffer_r(msg, <void **>&msg_c, &msg_c_len) # <<<<<<<<<<<<<<
  1694. *
  1695. * # Copy the msg before sending. This avoids any complications with
  1696. */
  1697. __pyx_t_1 = __pyx_f_7buffers_asbuffer_r(__pyx_v_msg, ((void **)(&__pyx_v_msg_c)), (&__pyx_v_msg_c_len)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1698. __Pyx_GOTREF(__pyx_t_1);
  1699. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1700. /* "zmq/core/socket.pyx":157
  1701. * # the GIL, etc.
  1702. * # If zmq_msg_init_* fails we must not call zmq_msg_close (Bus Error)
  1703. * with nogil: # <<<<<<<<<<<<<<
  1704. * rc = zmq_msg_init_size(&data, msg_c_len)
  1705. * memcpy(zmq_msg_data(&data), msg_c, zmq_msg_size(&data))
  1706. */
  1707. {
  1708. #ifdef WITH_THREAD
  1709. PyThreadState *_save = NULL;
  1710. #endif
  1711. Py_UNBLOCK_THREADS
  1712. /*try:*/ {
  1713. /* "zmq/core/socket.pyx":158
  1714. * # If zmq_msg_init_* fails we must not call zmq_msg_close (Bus Error)
  1715. * with nogil:
  1716. * rc = zmq_msg_init_size(&data, msg_c_len) # <<<<<<<<<<<<<<
  1717. * memcpy(zmq_msg_data(&data), msg_c, zmq_msg_size(&data))
  1718. *
  1719. */
  1720. __pyx_v_rc = zmq_msg_init_size((&__pyx_v_data), __pyx_v_msg_c_len);
  1721. /* "zmq/core/socket.pyx":159
  1722. * with nogil:
  1723. * rc = zmq_msg_init_size(&data, msg_c_len)
  1724. * memcpy(zmq_msg_data(&data), msg_c, zmq_msg_size(&data)) # <<<<<<<<<<<<<<
  1725. *
  1726. * if rc != 0:
  1727. */
  1728. memcpy(zmq_msg_data((&__pyx_v_data)), __pyx_v_msg_c, zmq_msg_size((&__pyx_v_data)));
  1729. }
  1730. /* "zmq/core/socket.pyx":157
  1731. * # the GIL, etc.
  1732. * # If zmq_msg_init_* fails we must not call zmq_msg_close (Bus Error)
  1733. * with nogil: # <<<<<<<<<<<<<<
  1734. * rc = zmq_msg_init_size(&data, msg_c_len)
  1735. * memcpy(zmq_msg_data(&data), msg_c, zmq_msg_size(&data))
  1736. */
  1737. /*finally:*/ {
  1738. Py_BLOCK_THREADS
  1739. }
  1740. }
  1741. /* "zmq/core/socket.pyx":161
  1742. * memcpy(zmq_msg_data(&data), msg_c, zmq_msg_size(&data))
  1743. *
  1744. * if rc != 0: # <<<<<<<<<<<<<<
  1745. * raise ZMQError()
  1746. *
  1747. */
  1748. __pyx_t_2 = (__pyx_v_rc != 0);
  1749. if (__pyx_t_2) {
  1750. /* "zmq/core/socket.pyx":162
  1751. *
  1752. * if rc != 0:
  1753. * raise ZMQError() # <<<<<<<<<<<<<<
  1754. *
  1755. * with nogil:
  1756. */
  1757. __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1758. __Pyx_GOTREF(__pyx_t_1);
  1759. __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1760. __Pyx_GOTREF(__pyx_t_3);
  1761. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1762. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  1763. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  1764. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1765. goto __pyx_L6;
  1766. }
  1767. __pyx_L6:;
  1768. /* "zmq/core/socket.pyx":164
  1769. * raise ZMQError()
  1770. *
  1771. * with nogil: # <<<<<<<<<<<<<<
  1772. * rc = zmq_sendmsg(handle, &data, flags)
  1773. * rc2 = zmq_msg_close(&data)
  1774. */
  1775. {
  1776. #ifdef WITH_THREAD
  1777. PyThreadState *_save = NULL;
  1778. #endif
  1779. Py_UNBLOCK_THREADS
  1780. /*try:*/ {
  1781. /* "zmq/core/socket.pyx":165
  1782. *
  1783. * with nogil:
  1784. * rc = zmq_sendmsg(handle, &data, flags) # <<<<<<<<<<<<<<
  1785. * rc2 = zmq_msg_close(&data)
  1786. * if rc < 0 or rc2 != 0:
  1787. */
  1788. __pyx_v_rc = zmq_sendmsg(__pyx_v_handle, (&__pyx_v_data), __pyx_v_flags);
  1789. /* "zmq/core/socket.pyx":166
  1790. * with nogil:
  1791. * rc = zmq_sendmsg(handle, &data, flags)
  1792. * rc2 = zmq_msg_close(&data) # <<<<<<<<<<<<<<
  1793. * if rc < 0 or rc2 != 0:
  1794. * raise ZMQError()
  1795. */
  1796. __pyx_v_rc2 = zmq_msg_close((&__pyx_v_data));
  1797. }
  1798. /* "zmq/core/socket.pyx":164
  1799. * raise ZMQError()
  1800. *
  1801. * with nogil: # <<<<<<<<<<<<<<
  1802. * rc = zmq_sendmsg(handle, &data, flags)
  1803. * rc2 = zmq_msg_close(&data)
  1804. */
  1805. /*finally:*/ {
  1806. Py_BLOCK_THREADS
  1807. }
  1808. }
  1809. /* "zmq/core/socket.pyx":167
  1810. * rc = zmq_sendmsg(handle, &data, flags)
  1811. * rc2 = zmq_msg_close(&data)
  1812. * if rc < 0 or rc2 != 0: # <<<<<<<<<<<<<<
  1813. * raise ZMQError()
  1814. *
  1815. */
  1816. __pyx_t_2 = (__pyx_v_rc < 0);
  1817. if (!__pyx_t_2) {
  1818. __pyx_t_4 = (__pyx_v_rc2 != 0);
  1819. __pyx_t_5 = __pyx_t_4;
  1820. } else {
  1821. __pyx_t_5 = __pyx_t_2;
  1822. }
  1823. if (__pyx_t_5) {
  1824. /* "zmq/core/socket.pyx":168
  1825. * rc2 = zmq_msg_close(&data)
  1826. * if rc < 0 or rc2 != 0:
  1827. * raise ZMQError() # <<<<<<<<<<<<<<
  1828. *
  1829. *
  1830. */
  1831. __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1832. __Pyx_GOTREF(__pyx_t_3);
  1833. __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1834. __Pyx_GOTREF(__pyx_t_1);
  1835. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  1836. __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  1837. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1838. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1839. goto __pyx_L10;
  1840. }
  1841. __pyx_L10:;
  1842. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  1843. goto __pyx_L0;
  1844. __pyx_L1_error:;
  1845. __Pyx_XDECREF(__pyx_t_1);
  1846. __Pyx_XDECREF(__pyx_t_3);
  1847. __Pyx_AddTraceback("zmq.core.socket._send_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  1848. __pyx_r = 0;
  1849. __pyx_L0:;
  1850. __Pyx_XGIVEREF(__pyx_r);
  1851. __Pyx_RefNannyFinishContext();
  1852. return __pyx_r;
  1853. }
  1854. /* "zmq/core/socket.pyx":193
  1855. * """
  1856. *
  1857. * def __cinit__(self, Context context, int socket_type, *args, **kwrags): # <<<<<<<<<<<<<<
  1858. * cdef Py_ssize_t c_handle
  1859. * c_handle = context._handle
  1860. */
  1861. static int __pyx_pf_3zmq_4core_6socket_6Socket___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  1862. static int __pyx_pf_3zmq_4core_6socket_6Socket___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  1863. struct __pyx_obj_3zmq_4core_7context_Context *__pyx_v_context = 0;
  1864. int __pyx_v_socket_type;
  1865. PyObject *__pyx_v_args = 0;
  1866. PyObject *__pyx_v_kwrags = 0;
  1867. Py_ssize_t __pyx_v_c_handle;
  1868. int __pyx_r;
  1869. __Pyx_RefNannyDeclarations
  1870. PyObject *__pyx_t_1 = NULL;
  1871. Py_ssize_t __pyx_t_2;
  1872. int __pyx_t_3;
  1873. PyObject *__pyx_t_4 = NULL;
  1874. int __pyx_lineno = 0;
  1875. const char *__pyx_filename = NULL;
  1876. int __pyx_clineno = 0;
  1877. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__context,&__pyx_n_s__socket_type,0};
  1878. __Pyx_RefNannySetupContext("__cinit__");
  1879. __pyx_v_kwrags = PyDict_New(); if (unlikely(!__pyx_v_kwrags)) return -1;
  1880. __Pyx_GOTREF(__pyx_v_kwrags);
  1881. if (PyTuple_GET_SIZE(__pyx_args) > 2) {
  1882. __pyx_v_args = PyTuple_GetSlice(__pyx_args, 2, PyTuple_GET_SIZE(__pyx_args));
  1883. if (unlikely(!__pyx_v_args)) {
  1884. __Pyx_DECREF(__pyx_v_kwrags); __pyx_v_kwrags = 0;
  1885. __Pyx_RefNannyFinishContext();
  1886. return -1;
  1887. }
  1888. __Pyx_GOTREF(__pyx_v_args);
  1889. } else {
  1890. __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  1891. }
  1892. {
  1893. PyObject* values[2] = {0,0};
  1894. if (unlikely(__pyx_kwds)) {
  1895. Py_ssize_t kw_args;
  1896. switch (PyTuple_GET_SIZE(__pyx_args)) {
  1897. default:
  1898. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  1899. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  1900. case 0: break;
  1901. }
  1902. kw_args = PyDict_Size(__pyx_kwds);
  1903. switch (PyTuple_GET_SIZE(__pyx_args)) {
  1904. case 0:
  1905. values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__context);
  1906. if (likely(values[0])) kw_args--;
  1907. else goto __pyx_L5_argtuple_error;
  1908. case 1:
  1909. values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__socket_type);
  1910. if (likely(values[1])) kw_args--;
  1911. else {
  1912. __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1913. }
  1914. }
  1915. if (unlikely(kw_args > 0)) {
  1916. const Py_ssize_t used_pos_args = (PyTuple_GET_SIZE(__pyx_args) < 2) ? PyTuple_GET_SIZE(__pyx_args) : 2;
  1917. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwrags, values, used_pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1918. }
  1919. } else if (PyTuple_GET_SIZE(__pyx_args) < 2) {
  1920. goto __pyx_L5_argtuple_error;
  1921. } else {
  1922. values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  1923. values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  1924. }
  1925. __pyx_v_context = ((struct __pyx_obj_3zmq_4core_7context_Context *)values[0]);
  1926. __pyx_v_socket_type = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_socket_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1927. }
  1928. goto __pyx_L4_argument_unpacking_done;
  1929. __pyx_L5_argtuple_error:;
  1930. __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  1931. __pyx_L3_error:;
  1932. __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0;
  1933. __Pyx_DECREF(__pyx_v_kwrags); __pyx_v_kwrags = 0;
  1934. __Pyx_AddTraceback("zmq.core.socket.Socket.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  1935. __Pyx_RefNannyFinishContext();
  1936. return -1;
  1937. __pyx_L4_argument_unpacking_done:;
  1938. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_context), __pyx_ptype_3zmq_4core_7context_Context, 1, "context", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1939. /* "zmq/core/socket.pyx":195
  1940. * def __cinit__(self, Context context, int socket_type, *args, **kwrags):
  1941. * cdef Py_ssize_t c_handle
  1942. * c_handle = context._handle # <<<<<<<<<<<<<<
  1943. *
  1944. * self.handle = NULL
  1945. */
  1946. __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_context), __pyx_n_s___handle); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1947. __Pyx_GOTREF(__pyx_t_1);
  1948. __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  1949. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  1950. __pyx_v_c_handle = __pyx_t_2;
  1951. /* "zmq/core/socket.pyx":197
  1952. * c_handle = context._handle
  1953. *
  1954. * self.handle = NULL # <<<<<<<<<<<<<<
  1955. * self.context = context
  1956. * self.socket_type = socket_type
  1957. */
  1958. ((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->handle = NULL;
  1959. /* "zmq/core/socket.pyx":198
  1960. *
  1961. * self.handle = NULL
  1962. * self.context = context # <<<<<<<<<<<<<<
  1963. * self.socket_type = socket_type
  1964. * with nogil:
  1965. */
  1966. __Pyx_INCREF(((PyObject *)__pyx_v_context));
  1967. __Pyx_GIVEREF(((PyObject *)__pyx_v_context));
  1968. __Pyx_GOTREF(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->context);
  1969. __Pyx_DECREF(((PyObject *)((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->context));
  1970. ((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->context = __pyx_v_context;
  1971. /* "zmq/core/socket.pyx":199
  1972. * self.handle = NULL
  1973. * self.context = context
  1974. * self.socket_type = socket_type # <<<<<<<<<<<<<<
  1975. * with nogil:
  1976. * self.handle = zmq_socket(<void *>c_handle, socket_type)
  1977. */
  1978. ((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->socket_type = __pyx_v_socket_type;
  1979. /* "zmq/core/socket.pyx":200
  1980. * self.context = context
  1981. * self.socket_type = socket_type
  1982. * with nogil: # <<<<<<<<<<<<<<
  1983. * self.handle = zmq_socket(<void *>c_handle, socket_type)
  1984. * if self.handle == NULL:
  1985. */
  1986. {
  1987. #ifdef WITH_THREAD
  1988. PyThreadState *_save = NULL;
  1989. #endif
  1990. Py_UNBLOCK_THREADS
  1991. /*try:*/ {
  1992. /* "zmq/core/socket.pyx":201
  1993. * self.socket_type = socket_type
  1994. * with nogil:
  1995. * self.handle = zmq_socket(<void *>c_handle, socket_type) # <<<<<<<<<<<<<<
  1996. * if self.handle == NULL:
  1997. * raise ZMQError()
  1998. */
  1999. ((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->handle = zmq_socket(((void *)__pyx_v_c_handle), __pyx_v_socket_type);
  2000. }
  2001. /* "zmq/core/socket.pyx":200
  2002. * self.context = context
  2003. * self.socket_type = socket_type
  2004. * with nogil: # <<<<<<<<<<<<<<
  2005. * self.handle = zmq_socket(<void *>c_handle, socket_type)
  2006. * if self.handle == NULL:
  2007. */
  2008. /*finally:*/ {
  2009. Py_BLOCK_THREADS
  2010. }
  2011. }
  2012. /* "zmq/core/socket.pyx":202
  2013. * with nogil:
  2014. * self.handle = zmq_socket(<void *>c_handle, socket_type)
  2015. * if self.handle == NULL: # <<<<<<<<<<<<<<
  2016. * raise ZMQError()
  2017. * self._closed = False
  2018. */
  2019. __pyx_t_3 = (((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->handle == NULL);
  2020. if (__pyx_t_3) {
  2021. /* "zmq/core/socket.pyx":203
  2022. * self.handle = zmq_socket(<void *>c_handle, socket_type)
  2023. * if self.handle == NULL:
  2024. * raise ZMQError() # <<<<<<<<<<<<<<
  2025. * self._closed = False
  2026. * self._attrs = {}
  2027. */
  2028. __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2029. __Pyx_GOTREF(__pyx_t_1);
  2030. __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2031. __Pyx_GOTREF(__pyx_t_4);
  2032. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2033. __Pyx_Raise(__pyx_t_4, 0, 0, 0);
  2034. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2035. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2036. goto __pyx_L9;
  2037. }
  2038. __pyx_L9:;
  2039. /* "zmq/core/socket.pyx":204
  2040. * if self.handle == NULL:
  2041. * raise ZMQError()
  2042. * self._closed = False # <<<<<<<<<<<<<<
  2043. * self._attrs = {}
  2044. * context._add_socket(self.handle)
  2045. */
  2046. ((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->_closed = 0;
  2047. /* "zmq/core/socket.pyx":205
  2048. * raise ZMQError()
  2049. * self._closed = False
  2050. * self._attrs = {} # <<<<<<<<<<<<<<
  2051. * context._add_socket(self.handle)
  2052. *
  2053. */
  2054. __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2055. __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  2056. __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
  2057. __Pyx_GOTREF(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->_attrs);
  2058. __Pyx_DECREF(((PyObject *)((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->_attrs));
  2059. ((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->_attrs = __pyx_t_4;
  2060. __pyx_t_4 = 0;
  2061. /* "zmq/core/socket.pyx":206
  2062. * self._closed = False
  2063. * self._attrs = {}
  2064. * context._add_socket(self.handle) # <<<<<<<<<<<<<<
  2065. *
  2066. * def __del__(self):
  2067. */
  2068. ((struct __pyx_vtabstruct_3zmq_4core_7context_Context *)__pyx_v_context->__pyx_vtab)->_add_socket(__pyx_v_context, ((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->handle);
  2069. __pyx_r = 0;
  2070. goto __pyx_L0;
  2071. __pyx_L1_error:;
  2072. __Pyx_XDECREF(__pyx_t_1);
  2073. __Pyx_XDECREF(__pyx_t_4);
  2074. __Pyx_AddTraceback("zmq.core.socket.Socket.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2075. __pyx_r = -1;
  2076. __pyx_L0:;
  2077. __Pyx_XDECREF(__pyx_v_args);
  2078. __Pyx_XDECREF(__pyx_v_kwrags);
  2079. __Pyx_RefNannyFinishContext();
  2080. return __pyx_r;
  2081. }
  2082. /* "zmq/core/socket.pyx":208
  2083. * context._add_socket(self.handle)
  2084. *
  2085. * def __del__(self): # <<<<<<<<<<<<<<
  2086. * """close *and* remove from context's list"""
  2087. * self.close()
  2088. */
  2089. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_1__del__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  2090. static char __pyx_doc_3zmq_4core_6socket_6Socket_1__del__[] = "close *and* remove from context's list";
  2091. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_1__del__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  2092. PyObject *__pyx_r = NULL;
  2093. __Pyx_RefNannyDeclarations
  2094. PyObject *__pyx_t_1 = NULL;
  2095. PyObject *__pyx_t_2 = NULL;
  2096. int __pyx_lineno = 0;
  2097. const char *__pyx_filename = NULL;
  2098. int __pyx_clineno = 0;
  2099. __Pyx_RefNannySetupContext("__del__");
  2100. /* "zmq/core/socket.pyx":210
  2101. * def __del__(self):
  2102. * """close *and* remove from context's list"""
  2103. * self.close() # <<<<<<<<<<<<<<
  2104. *
  2105. * def __dealloc__(self):
  2106. */
  2107. __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__close); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2108. __Pyx_GOTREF(__pyx_t_1);
  2109. __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2110. __Pyx_GOTREF(__pyx_t_2);
  2111. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2112. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2113. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  2114. goto __pyx_L0;
  2115. __pyx_L1_error:;
  2116. __Pyx_XDECREF(__pyx_t_1);
  2117. __Pyx_XDECREF(__pyx_t_2);
  2118. __Pyx_AddTraceback("zmq.core.socket.Socket.__del__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2119. __pyx_r = NULL;
  2120. __pyx_L0:;
  2121. __Pyx_XGIVEREF(__pyx_r);
  2122. __Pyx_RefNannyFinishContext();
  2123. return __pyx_r;
  2124. }
  2125. /* "zmq/core/socket.pyx":212
  2126. * self.close()
  2127. *
  2128. * def __dealloc__(self): # <<<<<<<<<<<<<<
  2129. * """don't touch the Context during dealloc, since it might have been cleaned up already.
  2130. *
  2131. */
  2132. static void __pyx_pf_3zmq_4core_6socket_6Socket_2__dealloc__(PyObject *__pyx_v_self); /*proto*/
  2133. static void __pyx_pf_3zmq_4core_6socket_6Socket_2__dealloc__(PyObject *__pyx_v_self) {
  2134. int __pyx_v_rc;
  2135. __Pyx_RefNannyDeclarations
  2136. int __pyx_t_1;
  2137. PyObject *__pyx_t_2 = NULL;
  2138. PyObject *__pyx_t_3 = NULL;
  2139. PyObject *__pyx_t_4 = NULL;
  2140. int __pyx_t_5;
  2141. int __pyx_t_6;
  2142. int __pyx_lineno = 0;
  2143. const char *__pyx_filename = NULL;
  2144. int __pyx_clineno = 0;
  2145. __Pyx_RefNannySetupContext("__dealloc__");
  2146. /* "zmq/core/socket.pyx":216
  2147. *
  2148. * This method will likely do nothing unless init has failed."""
  2149. * if self.handle != NULL: # <<<<<<<<<<<<<<
  2150. * with nogil:
  2151. * rc = zmq_close(self.handle)
  2152. */
  2153. __pyx_t_1 = (((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->handle != NULL);
  2154. if (__pyx_t_1) {
  2155. /* "zmq/core/socket.pyx":217
  2156. * This method will likely do nothing unless init has failed."""
  2157. * if self.handle != NULL:
  2158. * with nogil: # <<<<<<<<<<<<<<
  2159. * rc = zmq_close(self.handle)
  2160. * if rc != 0 and zmq_errno() != ENOTSOCK:
  2161. */
  2162. {
  2163. #ifdef WITH_THREAD
  2164. PyThreadState *_save = NULL;
  2165. #endif
  2166. Py_UNBLOCK_THREADS
  2167. /*try:*/ {
  2168. /* "zmq/core/socket.pyx":218
  2169. * if self.handle != NULL:
  2170. * with nogil:
  2171. * rc = zmq_close(self.handle) # <<<<<<<<<<<<<<
  2172. * if rc != 0 and zmq_errno() != ENOTSOCK:
  2173. * # ignore ENOTSOCK (closed by Context)
  2174. */
  2175. __pyx_v_rc = zmq_close(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->handle);
  2176. }
  2177. /* "zmq/core/socket.pyx":217
  2178. * This method will likely do nothing unless init has failed."""
  2179. * if self.handle != NULL:
  2180. * with nogil: # <<<<<<<<<<<<<<
  2181. * rc = zmq_close(self.handle)
  2182. * if rc != 0 and zmq_errno() != ENOTSOCK:
  2183. */
  2184. /*finally:*/ {
  2185. Py_BLOCK_THREADS
  2186. }
  2187. }
  2188. /* "zmq/core/socket.pyx":219
  2189. * with nogil:
  2190. * rc = zmq_close(self.handle)
  2191. * if rc != 0 and zmq_errno() != ENOTSOCK: # <<<<<<<<<<<<<<
  2192. * # ignore ENOTSOCK (closed by Context)
  2193. * raise ZMQError()
  2194. */
  2195. __pyx_t_1 = (__pyx_v_rc != 0);
  2196. if (__pyx_t_1) {
  2197. __pyx_t_2 = PyInt_FromLong(zmq_errno()); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2198. __Pyx_GOTREF(__pyx_t_2);
  2199. __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__ENOTSOCK); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2200. __Pyx_GOTREF(__pyx_t_3);
  2201. __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_NE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2202. __Pyx_GOTREF(__pyx_t_4);
  2203. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2204. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2205. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2206. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2207. __pyx_t_6 = __pyx_t_5;
  2208. } else {
  2209. __pyx_t_6 = __pyx_t_1;
  2210. }
  2211. if (__pyx_t_6) {
  2212. /* "zmq/core/socket.pyx":221
  2213. * if rc != 0 and zmq_errno() != ENOTSOCK:
  2214. * # ignore ENOTSOCK (closed by Context)
  2215. * raise ZMQError() # <<<<<<<<<<<<<<
  2216. *
  2217. * def __init__(self, context, socket_type):
  2218. */
  2219. __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2220. __Pyx_GOTREF(__pyx_t_4);
  2221. __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2222. __Pyx_GOTREF(__pyx_t_3);
  2223. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2224. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  2225. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2226. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2227. goto __pyx_L9;
  2228. }
  2229. __pyx_L9:;
  2230. goto __pyx_L5;
  2231. }
  2232. __pyx_L5:;
  2233. goto __pyx_L0;
  2234. __pyx_L1_error:;
  2235. __Pyx_XDECREF(__pyx_t_2);
  2236. __Pyx_XDECREF(__pyx_t_3);
  2237. __Pyx_XDECREF(__pyx_t_4);
  2238. __Pyx_AddTraceback("zmq.core.socket.Socket.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2239. __pyx_L0:;
  2240. __Pyx_RefNannyFinishContext();
  2241. }
  2242. /* "zmq/core/socket.pyx":223
  2243. * raise ZMQError()
  2244. *
  2245. * def __init__(self, context, socket_type): # <<<<<<<<<<<<<<
  2246. * pass
  2247. *
  2248. */
  2249. static int __pyx_pf_3zmq_4core_6socket_6Socket_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  2250. static int __pyx_pf_3zmq_4core_6socket_6Socket_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  2251. PyObject *__pyx_v_context = 0;
  2252. PyObject *__pyx_v_socket_type = 0;
  2253. int __pyx_r;
  2254. __Pyx_RefNannyDeclarations
  2255. int __pyx_lineno = 0;
  2256. const char *__pyx_filename = NULL;
  2257. int __pyx_clineno = 0;
  2258. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__context,&__pyx_n_s__socket_type,0};
  2259. __Pyx_RefNannySetupContext("__init__");
  2260. {
  2261. PyObject* values[2] = {0,0};
  2262. if (unlikely(__pyx_kwds)) {
  2263. Py_ssize_t kw_args;
  2264. switch (PyTuple_GET_SIZE(__pyx_args)) {
  2265. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  2266. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  2267. case 0: break;
  2268. default: goto __pyx_L5_argtuple_error;
  2269. }
  2270. kw_args = PyDict_Size(__pyx_kwds);
  2271. switch (PyTuple_GET_SIZE(__pyx_args)) {
  2272. case 0:
  2273. values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__context);
  2274. if (likely(values[0])) kw_args--;
  2275. else goto __pyx_L5_argtuple_error;
  2276. case 1:
  2277. values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__socket_type);
  2278. if (likely(values[1])) kw_args--;
  2279. else {
  2280. __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2281. }
  2282. }
  2283. if (unlikely(kw_args > 0)) {
  2284. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2285. }
  2286. } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
  2287. goto __pyx_L5_argtuple_error;
  2288. } else {
  2289. values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  2290. values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  2291. }
  2292. __pyx_v_context = values[0];
  2293. __pyx_v_socket_type = values[1];
  2294. }
  2295. goto __pyx_L4_argument_unpacking_done;
  2296. __pyx_L5_argtuple_error:;
  2297. __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2298. __pyx_L3_error:;
  2299. __Pyx_AddTraceback("zmq.core.socket.Socket.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2300. __Pyx_RefNannyFinishContext();
  2301. return -1;
  2302. __pyx_L4_argument_unpacking_done:;
  2303. __pyx_r = 0;
  2304. __Pyx_RefNannyFinishContext();
  2305. return __pyx_r;
  2306. }
  2307. /* "zmq/core/socket.pyx":227
  2308. *
  2309. * @property
  2310. * def closed(self): # <<<<<<<<<<<<<<
  2311. * return _check_closed(self, False)
  2312. *
  2313. */
  2314. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_4closed(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  2315. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_4closed(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  2316. PyObject *__pyx_r = NULL;
  2317. __Pyx_RefNannyDeclarations
  2318. PyObject *__pyx_t_1 = NULL;
  2319. int __pyx_lineno = 0;
  2320. const char *__pyx_filename = NULL;
  2321. int __pyx_clineno = 0;
  2322. __Pyx_RefNannySetupContext("closed");
  2323. /* "zmq/core/socket.pyx":228
  2324. * @property
  2325. * def closed(self):
  2326. * return _check_closed(self, False) # <<<<<<<<<<<<<<
  2327. *
  2328. * def close(self, linger=None):
  2329. */
  2330. __Pyx_XDECREF(__pyx_r);
  2331. __pyx_t_1 = __pyx_f_3zmq_4core_6socket__check_closed(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2332. __Pyx_GOTREF(__pyx_t_1);
  2333. __pyx_r = __pyx_t_1;
  2334. __pyx_t_1 = 0;
  2335. goto __pyx_L0;
  2336. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  2337. goto __pyx_L0;
  2338. __pyx_L1_error:;
  2339. __Pyx_XDECREF(__pyx_t_1);
  2340. __Pyx_AddTraceback("zmq.core.socket.Socket.closed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2341. __pyx_r = NULL;
  2342. __pyx_L0:;
  2343. __Pyx_XGIVEREF(__pyx_r);
  2344. __Pyx_RefNannyFinishContext();
  2345. return __pyx_r;
  2346. }
  2347. /* "zmq/core/socket.pyx":230
  2348. * return _check_closed(self, False)
  2349. *
  2350. * def close(self, linger=None): # <<<<<<<<<<<<<<
  2351. * """s.close(linger=None)
  2352. *
  2353. */
  2354. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_5close(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  2355. static char __pyx_doc_3zmq_4core_6socket_6Socket_5close[] = "s.close(linger=None)\n\n Close the socket.\n \n If linger is specified, LINGER sockopt will be set prior to closing.\n\n This can be called to close the socket by hand. If this is not\n called, the socket will automatically be closed when it is\n garbage collected.\n ";
  2356. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_5close(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  2357. PyObject *__pyx_v_linger = 0;
  2358. int __pyx_v_rc;
  2359. int __pyx_v_linger_c;
  2360. int __pyx_v_setlinger;
  2361. PyObject *__pyx_r = NULL;
  2362. __Pyx_RefNannyDeclarations
  2363. int __pyx_t_1;
  2364. int __pyx_t_2;
  2365. int __pyx_t_3;
  2366. int __pyx_t_4;
  2367. PyObject *__pyx_t_5 = NULL;
  2368. PyObject *__pyx_t_6 = NULL;
  2369. PyObject *__pyx_t_7 = NULL;
  2370. int __pyx_lineno = 0;
  2371. const char *__pyx_filename = NULL;
  2372. int __pyx_clineno = 0;
  2373. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__linger,0};
  2374. __Pyx_RefNannySetupContext("close");
  2375. {
  2376. PyObject* values[1] = {0};
  2377. values[0] = ((PyObject *)Py_None);
  2378. if (unlikely(__pyx_kwds)) {
  2379. Py_ssize_t kw_args;
  2380. switch (PyTuple_GET_SIZE(__pyx_args)) {
  2381. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  2382. case 0: break;
  2383. default: goto __pyx_L5_argtuple_error;
  2384. }
  2385. kw_args = PyDict_Size(__pyx_kwds);
  2386. switch (PyTuple_GET_SIZE(__pyx_args)) {
  2387. case 0:
  2388. if (kw_args > 0) {
  2389. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__linger);
  2390. if (value) { values[0] = value; kw_args--; }
  2391. }
  2392. }
  2393. if (unlikely(kw_args > 0)) {
  2394. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "close") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2395. }
  2396. } else {
  2397. switch (PyTuple_GET_SIZE(__pyx_args)) {
  2398. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  2399. case 0: break;
  2400. default: goto __pyx_L5_argtuple_error;
  2401. }
  2402. }
  2403. __pyx_v_linger = values[0];
  2404. }
  2405. goto __pyx_L4_argument_unpacking_done;
  2406. __pyx_L5_argtuple_error:;
  2407. __Pyx_RaiseArgtupleInvalid("close", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2408. __pyx_L3_error:;
  2409. __Pyx_AddTraceback("zmq.core.socket.Socket.close", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2410. __Pyx_RefNannyFinishContext();
  2411. return NULL;
  2412. __pyx_L4_argument_unpacking_done:;
  2413. /* "zmq/core/socket.pyx":241
  2414. * garbage collected.
  2415. * """
  2416. * cdef int rc=0 # <<<<<<<<<<<<<<
  2417. * cdef int linger_c
  2418. * cdef bint setlinger=False
  2419. */
  2420. __pyx_v_rc = 0;
  2421. /* "zmq/core/socket.pyx":243
  2422. * cdef int rc=0
  2423. * cdef int linger_c
  2424. * cdef bint setlinger=False # <<<<<<<<<<<<<<
  2425. *
  2426. * if linger is not None:
  2427. */
  2428. __pyx_v_setlinger = 0;
  2429. /* "zmq/core/socket.pyx":245
  2430. * cdef bint setlinger=False
  2431. *
  2432. * if linger is not None: # <<<<<<<<<<<<<<
  2433. * linger_c = linger
  2434. * setlinger=True
  2435. */
  2436. __pyx_t_1 = (__pyx_v_linger != Py_None);
  2437. if (__pyx_t_1) {
  2438. /* "zmq/core/socket.pyx":246
  2439. *
  2440. * if linger is not None:
  2441. * linger_c = linger # <<<<<<<<<<<<<<
  2442. * setlinger=True
  2443. *
  2444. */
  2445. __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_v_linger); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2446. __pyx_v_linger_c = __pyx_t_2;
  2447. /* "zmq/core/socket.pyx":247
  2448. * if linger is not None:
  2449. * linger_c = linger
  2450. * setlinger=True # <<<<<<<<<<<<<<
  2451. *
  2452. * if self.handle != NULL and not self._closed:
  2453. */
  2454. __pyx_v_setlinger = 1;
  2455. goto __pyx_L6;
  2456. }
  2457. __pyx_L6:;
  2458. /* "zmq/core/socket.pyx":249
  2459. * setlinger=True
  2460. *
  2461. * if self.handle != NULL and not self._closed: # <<<<<<<<<<<<<<
  2462. * with nogil:
  2463. * if setlinger:
  2464. */
  2465. __pyx_t_1 = (((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->handle != NULL);
  2466. if (__pyx_t_1) {
  2467. __pyx_t_3 = (!((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->_closed);
  2468. __pyx_t_4 = __pyx_t_3;
  2469. } else {
  2470. __pyx_t_4 = __pyx_t_1;
  2471. }
  2472. if (__pyx_t_4) {
  2473. /* "zmq/core/socket.pyx":250
  2474. *
  2475. * if self.handle != NULL and not self._closed:
  2476. * with nogil: # <<<<<<<<<<<<<<
  2477. * if setlinger:
  2478. * zmq_setsockopt(self.handle, ZMQ_LINGER, &linger_c, sizeof(int))
  2479. */
  2480. {
  2481. #ifdef WITH_THREAD
  2482. PyThreadState *_save = NULL;
  2483. #endif
  2484. Py_UNBLOCK_THREADS
  2485. /*try:*/ {
  2486. /* "zmq/core/socket.pyx":251
  2487. * if self.handle != NULL and not self._closed:
  2488. * with nogil:
  2489. * if setlinger: # <<<<<<<<<<<<<<
  2490. * zmq_setsockopt(self.handle, ZMQ_LINGER, &linger_c, sizeof(int))
  2491. * rc = zmq_close(self.handle)
  2492. */
  2493. if (__pyx_v_setlinger) {
  2494. /* "zmq/core/socket.pyx":252
  2495. * with nogil:
  2496. * if setlinger:
  2497. * zmq_setsockopt(self.handle, ZMQ_LINGER, &linger_c, sizeof(int)) # <<<<<<<<<<<<<<
  2498. * rc = zmq_close(self.handle)
  2499. * if rc != 0 and zmq_errno() != ENOTSOCK:
  2500. */
  2501. zmq_setsockopt(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->handle, ZMQ_LINGER, (&__pyx_v_linger_c), (sizeof(int)));
  2502. goto __pyx_L11;
  2503. }
  2504. __pyx_L11:;
  2505. /* "zmq/core/socket.pyx":253
  2506. * if setlinger:
  2507. * zmq_setsockopt(self.handle, ZMQ_LINGER, &linger_c, sizeof(int))
  2508. * rc = zmq_close(self.handle) # <<<<<<<<<<<<<<
  2509. * if rc != 0 and zmq_errno() != ENOTSOCK:
  2510. * # ignore ENOTSOCK (closed by Context)
  2511. */
  2512. __pyx_v_rc = zmq_close(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->handle);
  2513. }
  2514. /* "zmq/core/socket.pyx":250
  2515. *
  2516. * if self.handle != NULL and not self._closed:
  2517. * with nogil: # <<<<<<<<<<<<<<
  2518. * if setlinger:
  2519. * zmq_setsockopt(self.handle, ZMQ_LINGER, &linger_c, sizeof(int))
  2520. */
  2521. /*finally:*/ {
  2522. Py_BLOCK_THREADS
  2523. }
  2524. }
  2525. /* "zmq/core/socket.pyx":254
  2526. * zmq_setsockopt(self.handle, ZMQ_LINGER, &linger_c, sizeof(int))
  2527. * rc = zmq_close(self.handle)
  2528. * if rc != 0 and zmq_errno() != ENOTSOCK: # <<<<<<<<<<<<<<
  2529. * # ignore ENOTSOCK (closed by Context)
  2530. * raise ZMQError()
  2531. */
  2532. __pyx_t_4 = (__pyx_v_rc != 0);
  2533. if (__pyx_t_4) {
  2534. __pyx_t_5 = PyInt_FromLong(zmq_errno()); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2535. __Pyx_GOTREF(__pyx_t_5);
  2536. __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__ENOTSOCK); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2537. __Pyx_GOTREF(__pyx_t_6);
  2538. __pyx_t_7 = PyObject_RichCompare(__pyx_t_5, __pyx_t_6, Py_NE); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2539. __Pyx_GOTREF(__pyx_t_7);
  2540. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  2541. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  2542. __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2543. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  2544. __pyx_t_3 = __pyx_t_1;
  2545. } else {
  2546. __pyx_t_3 = __pyx_t_4;
  2547. }
  2548. if (__pyx_t_3) {
  2549. /* "zmq/core/socket.pyx":256
  2550. * if rc != 0 and zmq_errno() != ENOTSOCK:
  2551. * # ignore ENOTSOCK (closed by Context)
  2552. * raise ZMQError() # <<<<<<<<<<<<<<
  2553. * self.context._remove_socket(self.handle)
  2554. * self.handle = NULL
  2555. */
  2556. __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2557. __Pyx_GOTREF(__pyx_t_7);
  2558. __pyx_t_6 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2559. __Pyx_GOTREF(__pyx_t_6);
  2560. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  2561. __Pyx_Raise(__pyx_t_6, 0, 0, 0);
  2562. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  2563. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2564. goto __pyx_L12;
  2565. }
  2566. __pyx_L12:;
  2567. /* "zmq/core/socket.pyx":257
  2568. * # ignore ENOTSOCK (closed by Context)
  2569. * raise ZMQError()
  2570. * self.context._remove_socket(self.handle) # <<<<<<<<<<<<<<
  2571. * self.handle = NULL
  2572. * self._closed = True
  2573. */
  2574. ((struct __pyx_vtabstruct_3zmq_4core_7context_Context *)((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->context->__pyx_vtab)->_remove_socket(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->context, ((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->handle);
  2575. /* "zmq/core/socket.pyx":258
  2576. * raise ZMQError()
  2577. * self.context._remove_socket(self.handle)
  2578. * self.handle = NULL # <<<<<<<<<<<<<<
  2579. * self._closed = True
  2580. *
  2581. */
  2582. ((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->handle = NULL;
  2583. /* "zmq/core/socket.pyx":259
  2584. * self.context._remove_socket(self.handle)
  2585. * self.handle = NULL
  2586. * self._closed = True # <<<<<<<<<<<<<<
  2587. *
  2588. * def setsockopt(self, int option, optval):
  2589. */
  2590. ((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->_closed = 1;
  2591. goto __pyx_L7;
  2592. }
  2593. __pyx_L7:;
  2594. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  2595. goto __pyx_L0;
  2596. __pyx_L1_error:;
  2597. __Pyx_XDECREF(__pyx_t_5);
  2598. __Pyx_XDECREF(__pyx_t_6);
  2599. __Pyx_XDECREF(__pyx_t_7);
  2600. __Pyx_AddTraceback("zmq.core.socket.Socket.close", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2601. __pyx_r = NULL;
  2602. __pyx_L0:;
  2603. __Pyx_XGIVEREF(__pyx_r);
  2604. __Pyx_RefNannyFinishContext();
  2605. return __pyx_r;
  2606. }
  2607. /* "zmq/core/socket.pyx":261
  2608. * self._closed = True
  2609. *
  2610. * def setsockopt(self, int option, optval): # <<<<<<<<<<<<<<
  2611. * """s.setsockopt(option, optval)
  2612. *
  2613. */
  2614. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_6setsockopt(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  2615. static char __pyx_doc_3zmq_4core_6socket_6Socket_6setsockopt[] = "s.setsockopt(option, optval)\n\n Set socket options.\n\n See the 0MQ API documentation for details on specific options.\n\n Parameters\n ----------\n option : int\n The option to set. Available values will depend on your\n version of libzmq. Examples include:\n zmq.SUBSCRIBE, UNSUBSCRIBE, IDENTITY, HWM, LINGER, FD\n optval : int or bytes\n The value of the option to set.\n ";
  2616. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_6setsockopt(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  2617. int __pyx_v_option;
  2618. PyObject *__pyx_v_optval = 0;
  2619. pyzmq_int64_t __pyx_v_optval_int64_c;
  2620. int __pyx_v_optval_int_c;
  2621. int __pyx_v_rc;
  2622. char *__pyx_v_optval_c;
  2623. Py_ssize_t __pyx_v_sz;
  2624. PyObject *__pyx_r = NULL;
  2625. __Pyx_RefNannyDeclarations
  2626. PyObject *__pyx_t_1 = NULL;
  2627. int __pyx_t_2;
  2628. PyObject *__pyx_t_3 = NULL;
  2629. PyObject *__pyx_t_4 = NULL;
  2630. int __pyx_t_5;
  2631. char *__pyx_t_6;
  2632. Py_ssize_t __pyx_t_7;
  2633. pyzmq_int64_t __pyx_t_8;
  2634. int __pyx_t_9;
  2635. int __pyx_lineno = 0;
  2636. const char *__pyx_filename = NULL;
  2637. int __pyx_clineno = 0;
  2638. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__option,&__pyx_n_s__optval,0};
  2639. __Pyx_RefNannySetupContext("setsockopt");
  2640. {
  2641. PyObject* values[2] = {0,0};
  2642. if (unlikely(__pyx_kwds)) {
  2643. Py_ssize_t kw_args;
  2644. switch (PyTuple_GET_SIZE(__pyx_args)) {
  2645. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  2646. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  2647. case 0: break;
  2648. default: goto __pyx_L5_argtuple_error;
  2649. }
  2650. kw_args = PyDict_Size(__pyx_kwds);
  2651. switch (PyTuple_GET_SIZE(__pyx_args)) {
  2652. case 0:
  2653. values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__option);
  2654. if (likely(values[0])) kw_args--;
  2655. else goto __pyx_L5_argtuple_error;
  2656. case 1:
  2657. values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__optval);
  2658. if (likely(values[1])) kw_args--;
  2659. else {
  2660. __Pyx_RaiseArgtupleInvalid("setsockopt", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2661. }
  2662. }
  2663. if (unlikely(kw_args > 0)) {
  2664. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "setsockopt") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2665. }
  2666. } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
  2667. goto __pyx_L5_argtuple_error;
  2668. } else {
  2669. values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  2670. values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  2671. }
  2672. __pyx_v_option = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_option == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2673. __pyx_v_optval = values[1];
  2674. }
  2675. goto __pyx_L4_argument_unpacking_done;
  2676. __pyx_L5_argtuple_error:;
  2677. __Pyx_RaiseArgtupleInvalid("setsockopt", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  2678. __pyx_L3_error:;
  2679. __Pyx_AddTraceback("zmq.core.socket.Socket.setsockopt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  2680. __Pyx_RefNannyFinishContext();
  2681. return NULL;
  2682. __pyx_L4_argument_unpacking_done:;
  2683. /* "zmq/core/socket.pyx":283
  2684. * cdef Py_ssize_t sz
  2685. *
  2686. * _check_closed(self, True) # <<<<<<<<<<<<<<
  2687. * if isinstance(optval, unicode):
  2688. * raise TypeError("unicode not allowed, use setsockopt_unicode")
  2689. */
  2690. __pyx_t_1 = __pyx_f_3zmq_4core_6socket__check_closed(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2691. __Pyx_GOTREF(__pyx_t_1);
  2692. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2693. /* "zmq/core/socket.pyx":284
  2694. *
  2695. * _check_closed(self, True)
  2696. * if isinstance(optval, unicode): # <<<<<<<<<<<<<<
  2697. * raise TypeError("unicode not allowed, use setsockopt_unicode")
  2698. *
  2699. */
  2700. __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__unicode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2701. __Pyx_GOTREF(__pyx_t_1);
  2702. __pyx_t_2 = PyObject_IsInstance(__pyx_v_optval, __pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2703. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2704. if (__pyx_t_2) {
  2705. /* "zmq/core/socket.pyx":285
  2706. * _check_closed(self, True)
  2707. * if isinstance(optval, unicode):
  2708. * raise TypeError("unicode not allowed, use setsockopt_unicode") # <<<<<<<<<<<<<<
  2709. *
  2710. * if option in constants.bytes_sockopts:
  2711. */
  2712. __pyx_t_1 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2713. __Pyx_GOTREF(__pyx_t_1);
  2714. __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  2715. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2716. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2717. goto __pyx_L6;
  2718. }
  2719. __pyx_L6:;
  2720. /* "zmq/core/socket.pyx":287
  2721. * raise TypeError("unicode not allowed, use setsockopt_unicode")
  2722. *
  2723. * if option in constants.bytes_sockopts: # <<<<<<<<<<<<<<
  2724. * if not isinstance(optval, bytes):
  2725. * raise TypeError('expected bytes, got: %r' % optval)
  2726. */
  2727. __pyx_t_1 = PyInt_FromLong(__pyx_v_option); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2728. __Pyx_GOTREF(__pyx_t_1);
  2729. __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__constants); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2730. __Pyx_GOTREF(__pyx_t_3);
  2731. __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__bytes_sockopts); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2732. __Pyx_GOTREF(__pyx_t_4);
  2733. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2734. __pyx_t_2 = ((PySequence_Contains(__pyx_t_4, __pyx_t_1))); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2735. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2736. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2737. if (__pyx_t_2) {
  2738. /* "zmq/core/socket.pyx":288
  2739. *
  2740. * if option in constants.bytes_sockopts:
  2741. * if not isinstance(optval, bytes): # <<<<<<<<<<<<<<
  2742. * raise TypeError('expected bytes, got: %r' % optval)
  2743. * optval_c = PyBytes_AsString(optval)
  2744. */
  2745. __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__bytes); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2746. __Pyx_GOTREF(__pyx_t_4);
  2747. __pyx_t_2 = PyObject_IsInstance(__pyx_v_optval, __pyx_t_4); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2748. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2749. __pyx_t_5 = (!__pyx_t_2);
  2750. if (__pyx_t_5) {
  2751. /* "zmq/core/socket.pyx":289
  2752. * if option in constants.bytes_sockopts:
  2753. * if not isinstance(optval, bytes):
  2754. * raise TypeError('expected bytes, got: %r' % optval) # <<<<<<<<<<<<<<
  2755. * optval_c = PyBytes_AsString(optval)
  2756. * sz = PyBytes_Size(optval)
  2757. */
  2758. __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_4), __pyx_v_optval); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2759. __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  2760. __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2761. __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  2762. PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_4));
  2763. __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
  2764. __pyx_t_4 = 0;
  2765. __pyx_t_4 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2766. __Pyx_GOTREF(__pyx_t_4);
  2767. __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  2768. __Pyx_Raise(__pyx_t_4, 0, 0, 0);
  2769. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2770. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2771. goto __pyx_L8;
  2772. }
  2773. __pyx_L8:;
  2774. /* "zmq/core/socket.pyx":290
  2775. * if not isinstance(optval, bytes):
  2776. * raise TypeError('expected bytes, got: %r' % optval)
  2777. * optval_c = PyBytes_AsString(optval) # <<<<<<<<<<<<<<
  2778. * sz = PyBytes_Size(optval)
  2779. * with nogil:
  2780. */
  2781. __pyx_t_6 = PyBytes_AsString(__pyx_v_optval); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2782. __pyx_v_optval_c = __pyx_t_6;
  2783. /* "zmq/core/socket.pyx":291
  2784. * raise TypeError('expected bytes, got: %r' % optval)
  2785. * optval_c = PyBytes_AsString(optval)
  2786. * sz = PyBytes_Size(optval) # <<<<<<<<<<<<<<
  2787. * with nogil:
  2788. * rc = zmq_setsockopt(
  2789. */
  2790. __pyx_t_7 = PyBytes_Size(__pyx_v_optval); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2791. __pyx_v_sz = __pyx_t_7;
  2792. /* "zmq/core/socket.pyx":292
  2793. * optval_c = PyBytes_AsString(optval)
  2794. * sz = PyBytes_Size(optval)
  2795. * with nogil: # <<<<<<<<<<<<<<
  2796. * rc = zmq_setsockopt(
  2797. * self.handle, option,
  2798. */
  2799. {
  2800. #ifdef WITH_THREAD
  2801. PyThreadState *_save = NULL;
  2802. #endif
  2803. Py_UNBLOCK_THREADS
  2804. /*try:*/ {
  2805. /* "zmq/core/socket.pyx":296
  2806. * self.handle, option,
  2807. * optval_c, sz
  2808. * ) # <<<<<<<<<<<<<<
  2809. * elif option in constants.int64_sockopts:
  2810. * if not isinstance(optval, int):
  2811. */
  2812. __pyx_v_rc = zmq_setsockopt(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->handle, __pyx_v_option, __pyx_v_optval_c, __pyx_v_sz);
  2813. }
  2814. /* "zmq/core/socket.pyx":292
  2815. * optval_c = PyBytes_AsString(optval)
  2816. * sz = PyBytes_Size(optval)
  2817. * with nogil: # <<<<<<<<<<<<<<
  2818. * rc = zmq_setsockopt(
  2819. * self.handle, option,
  2820. */
  2821. /*finally:*/ {
  2822. Py_BLOCK_THREADS
  2823. }
  2824. }
  2825. goto __pyx_L7;
  2826. }
  2827. /* "zmq/core/socket.pyx":297
  2828. * optval_c, sz
  2829. * )
  2830. * elif option in constants.int64_sockopts: # <<<<<<<<<<<<<<
  2831. * if not isinstance(optval, int):
  2832. * raise TypeError('expected int, got: %r' % optval)
  2833. */
  2834. __pyx_t_4 = PyInt_FromLong(__pyx_v_option); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2835. __Pyx_GOTREF(__pyx_t_4);
  2836. __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__constants); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2837. __Pyx_GOTREF(__pyx_t_1);
  2838. __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__int64_sockopts); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2839. __Pyx_GOTREF(__pyx_t_3);
  2840. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2841. __pyx_t_5 = ((PySequence_Contains(__pyx_t_3, __pyx_t_4))); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2842. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2843. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2844. if (__pyx_t_5) {
  2845. /* "zmq/core/socket.pyx":298
  2846. * )
  2847. * elif option in constants.int64_sockopts:
  2848. * if not isinstance(optval, int): # <<<<<<<<<<<<<<
  2849. * raise TypeError('expected int, got: %r' % optval)
  2850. * optval_int64_c = optval
  2851. */
  2852. __pyx_t_3 = ((PyObject *)((PyObject*)(&PyInt_Type)));
  2853. __Pyx_INCREF(__pyx_t_3);
  2854. __pyx_t_5 = __Pyx_TypeCheck(__pyx_v_optval, __pyx_t_3);
  2855. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2856. __pyx_t_2 = (!__pyx_t_5);
  2857. if (__pyx_t_2) {
  2858. /* "zmq/core/socket.pyx":299
  2859. * elif option in constants.int64_sockopts:
  2860. * if not isinstance(optval, int):
  2861. * raise TypeError('expected int, got: %r' % optval) # <<<<<<<<<<<<<<
  2862. * optval_int64_c = optval
  2863. * with nogil:
  2864. */
  2865. __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), __pyx_v_optval); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2866. __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  2867. __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2868. __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  2869. PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
  2870. __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
  2871. __pyx_t_3 = 0;
  2872. __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2873. __Pyx_GOTREF(__pyx_t_3);
  2874. __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  2875. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  2876. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2877. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2878. goto __pyx_L12;
  2879. }
  2880. __pyx_L12:;
  2881. /* "zmq/core/socket.pyx":300
  2882. * if not isinstance(optval, int):
  2883. * raise TypeError('expected int, got: %r' % optval)
  2884. * optval_int64_c = optval # <<<<<<<<<<<<<<
  2885. * with nogil:
  2886. * rc = zmq_setsockopt(
  2887. */
  2888. __pyx_t_8 = __Pyx_PyInt_from_py_pyzmq_int64_t(__pyx_v_optval); if (unlikely((__pyx_t_8 == (pyzmq_int64_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2889. __pyx_v_optval_int64_c = __pyx_t_8;
  2890. /* "zmq/core/socket.pyx":301
  2891. * raise TypeError('expected int, got: %r' % optval)
  2892. * optval_int64_c = optval
  2893. * with nogil: # <<<<<<<<<<<<<<
  2894. * rc = zmq_setsockopt(
  2895. * self.handle, option,
  2896. */
  2897. {
  2898. #ifdef WITH_THREAD
  2899. PyThreadState *_save = NULL;
  2900. #endif
  2901. Py_UNBLOCK_THREADS
  2902. /*try:*/ {
  2903. /* "zmq/core/socket.pyx":304
  2904. * rc = zmq_setsockopt(
  2905. * self.handle, option,
  2906. * &optval_int64_c, sizeof(int64_t) # <<<<<<<<<<<<<<
  2907. * )
  2908. * else:
  2909. */
  2910. __pyx_v_rc = zmq_setsockopt(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->handle, __pyx_v_option, (&__pyx_v_optval_int64_c), (sizeof(pyzmq_int64_t)));
  2911. }
  2912. /* "zmq/core/socket.pyx":301
  2913. * raise TypeError('expected int, got: %r' % optval)
  2914. * optval_int64_c = optval
  2915. * with nogil: # <<<<<<<<<<<<<<
  2916. * rc = zmq_setsockopt(
  2917. * self.handle, option,
  2918. */
  2919. /*finally:*/ {
  2920. Py_BLOCK_THREADS
  2921. }
  2922. }
  2923. goto __pyx_L7;
  2924. }
  2925. /*else*/ {
  2926. /* "zmq/core/socket.pyx":312
  2927. * # sockopts will still raise just the same, but it will be libzmq doing
  2928. * # the raising.
  2929. * if not isinstance(optval, int): # <<<<<<<<<<<<<<
  2930. * raise TypeError('expected int, got: %r' % optval)
  2931. * optval_int_c = optval
  2932. */
  2933. __pyx_t_3 = ((PyObject *)((PyObject*)(&PyInt_Type)));
  2934. __Pyx_INCREF(__pyx_t_3);
  2935. __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_optval, __pyx_t_3);
  2936. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2937. __pyx_t_5 = (!__pyx_t_2);
  2938. if (__pyx_t_5) {
  2939. /* "zmq/core/socket.pyx":313
  2940. * # the raising.
  2941. * if not isinstance(optval, int):
  2942. * raise TypeError('expected int, got: %r' % optval) # <<<<<<<<<<<<<<
  2943. * optval_int_c = optval
  2944. * with nogil:
  2945. */
  2946. __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), __pyx_v_optval); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2947. __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  2948. __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2949. __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  2950. PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
  2951. __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
  2952. __pyx_t_3 = 0;
  2953. __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2954. __Pyx_GOTREF(__pyx_t_3);
  2955. __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  2956. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  2957. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2958. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2959. goto __pyx_L16;
  2960. }
  2961. __pyx_L16:;
  2962. /* "zmq/core/socket.pyx":314
  2963. * if not isinstance(optval, int):
  2964. * raise TypeError('expected int, got: %r' % optval)
  2965. * optval_int_c = optval # <<<<<<<<<<<<<<
  2966. * with nogil:
  2967. * rc = zmq_setsockopt(
  2968. */
  2969. __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_v_optval); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  2970. __pyx_v_optval_int_c = __pyx_t_9;
  2971. /* "zmq/core/socket.pyx":315
  2972. * raise TypeError('expected int, got: %r' % optval)
  2973. * optval_int_c = optval
  2974. * with nogil: # <<<<<<<<<<<<<<
  2975. * rc = zmq_setsockopt(
  2976. * self.handle, option,
  2977. */
  2978. {
  2979. #ifdef WITH_THREAD
  2980. PyThreadState *_save = NULL;
  2981. #endif
  2982. Py_UNBLOCK_THREADS
  2983. /*try:*/ {
  2984. /* "zmq/core/socket.pyx":318
  2985. * rc = zmq_setsockopt(
  2986. * self.handle, option,
  2987. * &optval_int_c, sizeof(int) # <<<<<<<<<<<<<<
  2988. * )
  2989. *
  2990. */
  2991. __pyx_v_rc = zmq_setsockopt(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->handle, __pyx_v_option, (&__pyx_v_optval_int_c), (sizeof(int)));
  2992. }
  2993. /* "zmq/core/socket.pyx":315
  2994. * raise TypeError('expected int, got: %r' % optval)
  2995. * optval_int_c = optval
  2996. * with nogil: # <<<<<<<<<<<<<<
  2997. * rc = zmq_setsockopt(
  2998. * self.handle, option,
  2999. */
  3000. /*finally:*/ {
  3001. Py_BLOCK_THREADS
  3002. }
  3003. }
  3004. }
  3005. __pyx_L7:;
  3006. /* "zmq/core/socket.pyx":321
  3007. * )
  3008. *
  3009. * if rc != 0: # <<<<<<<<<<<<<<
  3010. * raise ZMQError()
  3011. *
  3012. */
  3013. __pyx_t_5 = (__pyx_v_rc != 0);
  3014. if (__pyx_t_5) {
  3015. /* "zmq/core/socket.pyx":322
  3016. *
  3017. * if rc != 0:
  3018. * raise ZMQError() # <<<<<<<<<<<<<<
  3019. *
  3020. * def getsockopt(self, int option):
  3021. */
  3022. __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3023. __Pyx_GOTREF(__pyx_t_3);
  3024. __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3025. __Pyx_GOTREF(__pyx_t_4);
  3026. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3027. __Pyx_Raise(__pyx_t_4, 0, 0, 0);
  3028. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3029. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3030. goto __pyx_L20;
  3031. }
  3032. __pyx_L20:;
  3033. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  3034. goto __pyx_L0;
  3035. __pyx_L1_error:;
  3036. __Pyx_XDECREF(__pyx_t_1);
  3037. __Pyx_XDECREF(__pyx_t_3);
  3038. __Pyx_XDECREF(__pyx_t_4);
  3039. __Pyx_AddTraceback("zmq.core.socket.Socket.setsockopt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3040. __pyx_r = NULL;
  3041. __pyx_L0:;
  3042. __Pyx_XGIVEREF(__pyx_r);
  3043. __Pyx_RefNannyFinishContext();
  3044. return __pyx_r;
  3045. }
  3046. /* "zmq/core/socket.pyx":324
  3047. * raise ZMQError()
  3048. *
  3049. * def getsockopt(self, int option): # <<<<<<<<<<<<<<
  3050. * """s.getsockopt(option)
  3051. *
  3052. */
  3053. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_7getsockopt(PyObject *__pyx_v_self, PyObject *__pyx_arg_option); /*proto*/
  3054. static char __pyx_doc_3zmq_4core_6socket_6Socket_7getsockopt[] = "s.getsockopt(option)\n\n Get the value of a socket option.\n\n See the 0MQ API documentation for details on specific options.\n\n Parameters\n ----------\n option : int\n The option to get. Available values will depend on your\n version of libzmq. Examples include:\n zmq.IDENTITY, HWM, LINGER, FD, EVENTS\n\n Returns\n -------\n optval : int or bytes\n The value of the option as a bytestring or int.\n ";
  3055. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_7getsockopt(PyObject *__pyx_v_self, PyObject *__pyx_arg_option) {
  3056. int __pyx_v_option;
  3057. pyzmq_int64_t __pyx_v_optval_int64_c;
  3058. int __pyx_v_optval_int_c;
  3059. ZMQ_FD_T __pyx_v_optval_fd_c;
  3060. char __pyx_v_identity_str_c[255];
  3061. size_t __pyx_v_sz;
  3062. int __pyx_v_rc;
  3063. PyObject *__pyx_v_result = NULL;
  3064. PyObject *__pyx_r = NULL;
  3065. __Pyx_RefNannyDeclarations
  3066. PyObject *__pyx_t_1 = NULL;
  3067. PyObject *__pyx_t_2 = NULL;
  3068. PyObject *__pyx_t_3 = NULL;
  3069. int __pyx_t_4;
  3070. int __pyx_lineno = 0;
  3071. const char *__pyx_filename = NULL;
  3072. int __pyx_clineno = 0;
  3073. __Pyx_RefNannySetupContext("getsockopt");
  3074. assert(__pyx_arg_option); {
  3075. __pyx_v_option = __Pyx_PyInt_AsInt(__pyx_arg_option); if (unlikely((__pyx_v_option == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3076. }
  3077. goto __pyx_L4_argument_unpacking_done;
  3078. __pyx_L3_error:;
  3079. __Pyx_AddTraceback("zmq.core.socket.Socket.getsockopt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3080. __Pyx_RefNannyFinishContext();
  3081. return NULL;
  3082. __pyx_L4_argument_unpacking_done:;
  3083. /* "zmq/core/socket.pyx":350
  3084. * cdef int rc
  3085. *
  3086. * _check_closed(self, True) # <<<<<<<<<<<<<<
  3087. *
  3088. * if option in constants.bytes_sockopts:
  3089. */
  3090. __pyx_t_1 = __pyx_f_3zmq_4core_6socket__check_closed(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3091. __Pyx_GOTREF(__pyx_t_1);
  3092. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3093. /* "zmq/core/socket.pyx":352
  3094. * _check_closed(self, True)
  3095. *
  3096. * if option in constants.bytes_sockopts: # <<<<<<<<<<<<<<
  3097. * sz = 255
  3098. * with nogil:
  3099. */
  3100. __pyx_t_1 = PyInt_FromLong(__pyx_v_option); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3101. __Pyx_GOTREF(__pyx_t_1);
  3102. __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__constants); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3103. __Pyx_GOTREF(__pyx_t_2);
  3104. __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__bytes_sockopts); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3105. __Pyx_GOTREF(__pyx_t_3);
  3106. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3107. __pyx_t_4 = ((PySequence_Contains(__pyx_t_3, __pyx_t_1))); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3108. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3109. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3110. if (__pyx_t_4) {
  3111. /* "zmq/core/socket.pyx":353
  3112. *
  3113. * if option in constants.bytes_sockopts:
  3114. * sz = 255 # <<<<<<<<<<<<<<
  3115. * with nogil:
  3116. * rc = zmq_getsockopt(self.handle, option, <void *>identity_str_c, &sz)
  3117. */
  3118. __pyx_v_sz = 255;
  3119. /* "zmq/core/socket.pyx":354
  3120. * if option in constants.bytes_sockopts:
  3121. * sz = 255
  3122. * with nogil: # <<<<<<<<<<<<<<
  3123. * rc = zmq_getsockopt(self.handle, option, <void *>identity_str_c, &sz)
  3124. * if rc != 0:
  3125. */
  3126. {
  3127. #ifdef WITH_THREAD
  3128. PyThreadState *_save = NULL;
  3129. #endif
  3130. Py_UNBLOCK_THREADS
  3131. /*try:*/ {
  3132. /* "zmq/core/socket.pyx":355
  3133. * sz = 255
  3134. * with nogil:
  3135. * rc = zmq_getsockopt(self.handle, option, <void *>identity_str_c, &sz) # <<<<<<<<<<<<<<
  3136. * if rc != 0:
  3137. * raise ZMQError()
  3138. */
  3139. __pyx_v_rc = zmq_getsockopt(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->handle, __pyx_v_option, ((void *)__pyx_v_identity_str_c), (&__pyx_v_sz));
  3140. }
  3141. /* "zmq/core/socket.pyx":354
  3142. * if option in constants.bytes_sockopts:
  3143. * sz = 255
  3144. * with nogil: # <<<<<<<<<<<<<<
  3145. * rc = zmq_getsockopt(self.handle, option, <void *>identity_str_c, &sz)
  3146. * if rc != 0:
  3147. */
  3148. /*finally:*/ {
  3149. Py_BLOCK_THREADS
  3150. }
  3151. }
  3152. /* "zmq/core/socket.pyx":356
  3153. * with nogil:
  3154. * rc = zmq_getsockopt(self.handle, option, <void *>identity_str_c, &sz)
  3155. * if rc != 0: # <<<<<<<<<<<<<<
  3156. * raise ZMQError()
  3157. * result = PyBytes_FromStringAndSize(<char *>identity_str_c, sz)
  3158. */
  3159. __pyx_t_4 = (__pyx_v_rc != 0);
  3160. if (__pyx_t_4) {
  3161. /* "zmq/core/socket.pyx":357
  3162. * rc = zmq_getsockopt(self.handle, option, <void *>identity_str_c, &sz)
  3163. * if rc != 0:
  3164. * raise ZMQError() # <<<<<<<<<<<<<<
  3165. * result = PyBytes_FromStringAndSize(<char *>identity_str_c, sz)
  3166. * elif option in constants.int64_sockopts:
  3167. */
  3168. __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3169. __Pyx_GOTREF(__pyx_t_3);
  3170. __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3171. __Pyx_GOTREF(__pyx_t_1);
  3172. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3173. __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  3174. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3175. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3176. goto __pyx_L9;
  3177. }
  3178. __pyx_L9:;
  3179. /* "zmq/core/socket.pyx":358
  3180. * if rc != 0:
  3181. * raise ZMQError()
  3182. * result = PyBytes_FromStringAndSize(<char *>identity_str_c, sz) # <<<<<<<<<<<<<<
  3183. * elif option in constants.int64_sockopts:
  3184. * sz = sizeof(int64_t)
  3185. */
  3186. __pyx_t_1 = ((PyObject *)PyBytes_FromStringAndSize(((char *)__pyx_v_identity_str_c), __pyx_v_sz)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3187. __Pyx_GOTREF(__pyx_t_1);
  3188. __pyx_v_result = __pyx_t_1;
  3189. __pyx_t_1 = 0;
  3190. goto __pyx_L5;
  3191. }
  3192. /* "zmq/core/socket.pyx":359
  3193. * raise ZMQError()
  3194. * result = PyBytes_FromStringAndSize(<char *>identity_str_c, sz)
  3195. * elif option in constants.int64_sockopts: # <<<<<<<<<<<<<<
  3196. * sz = sizeof(int64_t)
  3197. * with nogil:
  3198. */
  3199. __pyx_t_1 = PyInt_FromLong(__pyx_v_option); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3200. __Pyx_GOTREF(__pyx_t_1);
  3201. __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__constants); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3202. __Pyx_GOTREF(__pyx_t_3);
  3203. __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__int64_sockopts); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3204. __Pyx_GOTREF(__pyx_t_2);
  3205. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3206. __pyx_t_4 = ((PySequence_Contains(__pyx_t_2, __pyx_t_1))); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3207. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3208. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3209. if (__pyx_t_4) {
  3210. /* "zmq/core/socket.pyx":360
  3211. * result = PyBytes_FromStringAndSize(<char *>identity_str_c, sz)
  3212. * elif option in constants.int64_sockopts:
  3213. * sz = sizeof(int64_t) # <<<<<<<<<<<<<<
  3214. * with nogil:
  3215. * rc = zmq_getsockopt(self.handle, option, <void *>&optval_int64_c, &sz)
  3216. */
  3217. __pyx_v_sz = (sizeof(pyzmq_int64_t));
  3218. /* "zmq/core/socket.pyx":361
  3219. * elif option in constants.int64_sockopts:
  3220. * sz = sizeof(int64_t)
  3221. * with nogil: # <<<<<<<<<<<<<<
  3222. * rc = zmq_getsockopt(self.handle, option, <void *>&optval_int64_c, &sz)
  3223. * if rc != 0:
  3224. */
  3225. {
  3226. #ifdef WITH_THREAD
  3227. PyThreadState *_save = NULL;
  3228. #endif
  3229. Py_UNBLOCK_THREADS
  3230. /*try:*/ {
  3231. /* "zmq/core/socket.pyx":362
  3232. * sz = sizeof(int64_t)
  3233. * with nogil:
  3234. * rc = zmq_getsockopt(self.handle, option, <void *>&optval_int64_c, &sz) # <<<<<<<<<<<<<<
  3235. * if rc != 0:
  3236. * raise ZMQError()
  3237. */
  3238. __pyx_v_rc = zmq_getsockopt(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->handle, __pyx_v_option, ((void *)(&__pyx_v_optval_int64_c)), (&__pyx_v_sz));
  3239. }
  3240. /* "zmq/core/socket.pyx":361
  3241. * elif option in constants.int64_sockopts:
  3242. * sz = sizeof(int64_t)
  3243. * with nogil: # <<<<<<<<<<<<<<
  3244. * rc = zmq_getsockopt(self.handle, option, <void *>&optval_int64_c, &sz)
  3245. * if rc != 0:
  3246. */
  3247. /*finally:*/ {
  3248. Py_BLOCK_THREADS
  3249. }
  3250. }
  3251. /* "zmq/core/socket.pyx":363
  3252. * with nogil:
  3253. * rc = zmq_getsockopt(self.handle, option, <void *>&optval_int64_c, &sz)
  3254. * if rc != 0: # <<<<<<<<<<<<<<
  3255. * raise ZMQError()
  3256. * result = optval_int64_c
  3257. */
  3258. __pyx_t_4 = (__pyx_v_rc != 0);
  3259. if (__pyx_t_4) {
  3260. /* "zmq/core/socket.pyx":364
  3261. * rc = zmq_getsockopt(self.handle, option, <void *>&optval_int64_c, &sz)
  3262. * if rc != 0:
  3263. * raise ZMQError() # <<<<<<<<<<<<<<
  3264. * result = optval_int64_c
  3265. * elif option == ZMQ_FD:
  3266. */
  3267. __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3268. __Pyx_GOTREF(__pyx_t_2);
  3269. __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 = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3270. __Pyx_GOTREF(__pyx_t_1);
  3271. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3272. __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  3273. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3274. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3275. goto __pyx_L13;
  3276. }
  3277. __pyx_L13:;
  3278. /* "zmq/core/socket.pyx":365
  3279. * if rc != 0:
  3280. * raise ZMQError()
  3281. * result = optval_int64_c # <<<<<<<<<<<<<<
  3282. * elif option == ZMQ_FD:
  3283. * sz = sizeof(fd_t)
  3284. */
  3285. __pyx_t_1 = __Pyx_PyInt_to_py_pyzmq_int64_t(__pyx_v_optval_int64_c); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3286. __Pyx_GOTREF(__pyx_t_1);
  3287. __pyx_v_result = __pyx_t_1;
  3288. __pyx_t_1 = 0;
  3289. goto __pyx_L5;
  3290. }
  3291. /* "zmq/core/socket.pyx":366
  3292. * raise ZMQError()
  3293. * result = optval_int64_c
  3294. * elif option == ZMQ_FD: # <<<<<<<<<<<<<<
  3295. * sz = sizeof(fd_t)
  3296. * with nogil:
  3297. */
  3298. __pyx_t_4 = (__pyx_v_option == ZMQ_FD);
  3299. if (__pyx_t_4) {
  3300. /* "zmq/core/socket.pyx":367
  3301. * result = optval_int64_c
  3302. * elif option == ZMQ_FD:
  3303. * sz = sizeof(fd_t) # <<<<<<<<<<<<<<
  3304. * with nogil:
  3305. * rc = zmq_getsockopt(self.handle, option, <void *>&optval_fd_c, &sz)
  3306. */
  3307. __pyx_v_sz = (sizeof(ZMQ_FD_T));
  3308. /* "zmq/core/socket.pyx":368
  3309. * elif option == ZMQ_FD:
  3310. * sz = sizeof(fd_t)
  3311. * with nogil: # <<<<<<<<<<<<<<
  3312. * rc = zmq_getsockopt(self.handle, option, <void *>&optval_fd_c, &sz)
  3313. * if rc != 0:
  3314. */
  3315. {
  3316. #ifdef WITH_THREAD
  3317. PyThreadState *_save = NULL;
  3318. #endif
  3319. Py_UNBLOCK_THREADS
  3320. /*try:*/ {
  3321. /* "zmq/core/socket.pyx":369
  3322. * sz = sizeof(fd_t)
  3323. * with nogil:
  3324. * rc = zmq_getsockopt(self.handle, option, <void *>&optval_fd_c, &sz) # <<<<<<<<<<<<<<
  3325. * if rc != 0:
  3326. * raise ZMQError()
  3327. */
  3328. __pyx_v_rc = zmq_getsockopt(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->handle, __pyx_v_option, ((void *)(&__pyx_v_optval_fd_c)), (&__pyx_v_sz));
  3329. }
  3330. /* "zmq/core/socket.pyx":368
  3331. * elif option == ZMQ_FD:
  3332. * sz = sizeof(fd_t)
  3333. * with nogil: # <<<<<<<<<<<<<<
  3334. * rc = zmq_getsockopt(self.handle, option, <void *>&optval_fd_c, &sz)
  3335. * if rc != 0:
  3336. */
  3337. /*finally:*/ {
  3338. Py_BLOCK_THREADS
  3339. }
  3340. }
  3341. /* "zmq/core/socket.pyx":370
  3342. * with nogil:
  3343. * rc = zmq_getsockopt(self.handle, option, <void *>&optval_fd_c, &sz)
  3344. * if rc != 0: # <<<<<<<<<<<<<<
  3345. * raise ZMQError()
  3346. * result = optval_fd_c
  3347. */
  3348. __pyx_t_4 = (__pyx_v_rc != 0);
  3349. if (__pyx_t_4) {
  3350. /* "zmq/core/socket.pyx":371
  3351. * rc = zmq_getsockopt(self.handle, option, <void *>&optval_fd_c, &sz)
  3352. * if rc != 0:
  3353. * raise ZMQError() # <<<<<<<<<<<<<<
  3354. * result = optval_fd_c
  3355. * else:
  3356. */
  3357. __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3358. __Pyx_GOTREF(__pyx_t_1);
  3359. __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3360. __Pyx_GOTREF(__pyx_t_2);
  3361. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3362. __Pyx_Raise(__pyx_t_2, 0, 0, 0);
  3363. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3364. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3365. goto __pyx_L17;
  3366. }
  3367. __pyx_L17:;
  3368. /* "zmq/core/socket.pyx":372
  3369. * if rc != 0:
  3370. * raise ZMQError()
  3371. * result = optval_fd_c # <<<<<<<<<<<<<<
  3372. * else:
  3373. * # default is to assume int, which is what most new sockopts will be
  3374. */
  3375. __pyx_t_2 = __Pyx_PyInt_to_py_ZMQ_FD_T(__pyx_v_optval_fd_c); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3376. __Pyx_GOTREF(__pyx_t_2);
  3377. __pyx_v_result = __pyx_t_2;
  3378. __pyx_t_2 = 0;
  3379. goto __pyx_L5;
  3380. }
  3381. /*else*/ {
  3382. /* "zmq/core/socket.pyx":379
  3383. * # sockopts will still raise just the same, but it will be libzmq doing
  3384. * # the raising.
  3385. * sz = sizeof(int) # <<<<<<<<<<<<<<
  3386. * with nogil:
  3387. * rc = zmq_getsockopt(self.handle, option, <void *>&optval_int_c, &sz)
  3388. */
  3389. __pyx_v_sz = (sizeof(int));
  3390. /* "zmq/core/socket.pyx":380
  3391. * # the raising.
  3392. * sz = sizeof(int)
  3393. * with nogil: # <<<<<<<<<<<<<<
  3394. * rc = zmq_getsockopt(self.handle, option, <void *>&optval_int_c, &sz)
  3395. * if rc != 0:
  3396. */
  3397. {
  3398. #ifdef WITH_THREAD
  3399. PyThreadState *_save = NULL;
  3400. #endif
  3401. Py_UNBLOCK_THREADS
  3402. /*try:*/ {
  3403. /* "zmq/core/socket.pyx":381
  3404. * sz = sizeof(int)
  3405. * with nogil:
  3406. * rc = zmq_getsockopt(self.handle, option, <void *>&optval_int_c, &sz) # <<<<<<<<<<<<<<
  3407. * if rc != 0:
  3408. * raise ZMQError()
  3409. */
  3410. __pyx_v_rc = zmq_getsockopt(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->handle, __pyx_v_option, ((void *)(&__pyx_v_optval_int_c)), (&__pyx_v_sz));
  3411. }
  3412. /* "zmq/core/socket.pyx":380
  3413. * # the raising.
  3414. * sz = sizeof(int)
  3415. * with nogil: # <<<<<<<<<<<<<<
  3416. * rc = zmq_getsockopt(self.handle, option, <void *>&optval_int_c, &sz)
  3417. * if rc != 0:
  3418. */
  3419. /*finally:*/ {
  3420. Py_BLOCK_THREADS
  3421. }
  3422. }
  3423. /* "zmq/core/socket.pyx":382
  3424. * with nogil:
  3425. * rc = zmq_getsockopt(self.handle, option, <void *>&optval_int_c, &sz)
  3426. * if rc != 0: # <<<<<<<<<<<<<<
  3427. * raise ZMQError()
  3428. * result = optval_int_c
  3429. */
  3430. __pyx_t_4 = (__pyx_v_rc != 0);
  3431. if (__pyx_t_4) {
  3432. /* "zmq/core/socket.pyx":383
  3433. * rc = zmq_getsockopt(self.handle, option, <void *>&optval_int_c, &sz)
  3434. * if rc != 0:
  3435. * raise ZMQError() # <<<<<<<<<<<<<<
  3436. * result = optval_int_c
  3437. *
  3438. */
  3439. __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3440. __Pyx_GOTREF(__pyx_t_2);
  3441. __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 = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3442. __Pyx_GOTREF(__pyx_t_1);
  3443. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3444. __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  3445. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3446. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3447. goto __pyx_L21;
  3448. }
  3449. __pyx_L21:;
  3450. /* "zmq/core/socket.pyx":384
  3451. * if rc != 0:
  3452. * raise ZMQError()
  3453. * result = optval_int_c # <<<<<<<<<<<<<<
  3454. *
  3455. * return result
  3456. */
  3457. __pyx_t_1 = PyInt_FromLong(__pyx_v_optval_int_c); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3458. __Pyx_GOTREF(__pyx_t_1);
  3459. __pyx_v_result = __pyx_t_1;
  3460. __pyx_t_1 = 0;
  3461. }
  3462. __pyx_L5:;
  3463. /* "zmq/core/socket.pyx":386
  3464. * result = optval_int_c
  3465. *
  3466. * return result # <<<<<<<<<<<<<<
  3467. *
  3468. * def setsockopt_unicode(self, int option, optval, encoding='utf-8'):
  3469. */
  3470. __Pyx_XDECREF(__pyx_r);
  3471. __Pyx_INCREF(__pyx_v_result);
  3472. __pyx_r = __pyx_v_result;
  3473. goto __pyx_L0;
  3474. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  3475. goto __pyx_L0;
  3476. __pyx_L1_error:;
  3477. __Pyx_XDECREF(__pyx_t_1);
  3478. __Pyx_XDECREF(__pyx_t_2);
  3479. __Pyx_XDECREF(__pyx_t_3);
  3480. __Pyx_AddTraceback("zmq.core.socket.Socket.getsockopt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3481. __pyx_r = NULL;
  3482. __pyx_L0:;
  3483. __Pyx_XDECREF(__pyx_v_result);
  3484. __Pyx_XGIVEREF(__pyx_r);
  3485. __Pyx_RefNannyFinishContext();
  3486. return __pyx_r;
  3487. }
  3488. /* "zmq/core/socket.pyx":388
  3489. * return result
  3490. *
  3491. * def setsockopt_unicode(self, int option, optval, encoding='utf-8'): # <<<<<<<<<<<<<<
  3492. * """s.setsockopt_unicode(option, optval, encoding='utf-8')
  3493. *
  3494. */
  3495. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_8setsockopt_unicode(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  3496. static char __pyx_doc_3zmq_4core_6socket_6Socket_8setsockopt_unicode[] = "s.setsockopt_unicode(option, optval, encoding='utf-8')\n\n Set socket options with a unicode object it is simply a wrapper\n for setsockopt to protect from encoding ambiguity.\n\n See the 0MQ documentation for details on specific options.\n\n Parameters\n ----------\n option : int\n The name of the option to set. Can be any of: SUBSCRIBE, \n UNSUBSCRIBE, IDENTITY\n optval : unicode\n The value of the option to set.\n encoding : str\n The encoding to be used, default is utf8\n ";
  3497. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_8setsockopt_unicode(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  3498. int __pyx_v_option;
  3499. PyObject *__pyx_v_optval = 0;
  3500. PyObject *__pyx_v_encoding = 0;
  3501. PyObject *__pyx_r = NULL;
  3502. __Pyx_RefNannyDeclarations
  3503. PyObject *__pyx_t_1 = NULL;
  3504. int __pyx_t_2;
  3505. int __pyx_t_3;
  3506. PyObject *__pyx_t_4 = NULL;
  3507. PyObject *__pyx_t_5 = NULL;
  3508. PyObject *__pyx_t_6 = NULL;
  3509. PyObject *__pyx_t_7 = NULL;
  3510. int __pyx_lineno = 0;
  3511. const char *__pyx_filename = NULL;
  3512. int __pyx_clineno = 0;
  3513. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__option,&__pyx_n_s__optval,&__pyx_n_s__encoding,0};
  3514. __Pyx_RefNannySetupContext("setsockopt_unicode");
  3515. {
  3516. PyObject* values[3] = {0,0,0};
  3517. values[2] = ((PyObject *)__pyx_kp_s_6);
  3518. if (unlikely(__pyx_kwds)) {
  3519. Py_ssize_t kw_args;
  3520. switch (PyTuple_GET_SIZE(__pyx_args)) {
  3521. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  3522. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  3523. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  3524. case 0: break;
  3525. default: goto __pyx_L5_argtuple_error;
  3526. }
  3527. kw_args = PyDict_Size(__pyx_kwds);
  3528. switch (PyTuple_GET_SIZE(__pyx_args)) {
  3529. case 0:
  3530. values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__option);
  3531. if (likely(values[0])) kw_args--;
  3532. else goto __pyx_L5_argtuple_error;
  3533. case 1:
  3534. values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__optval);
  3535. if (likely(values[1])) kw_args--;
  3536. else {
  3537. __Pyx_RaiseArgtupleInvalid("setsockopt_unicode", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3538. }
  3539. case 2:
  3540. if (kw_args > 0) {
  3541. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__encoding);
  3542. if (value) { values[2] = value; kw_args--; }
  3543. }
  3544. }
  3545. if (unlikely(kw_args > 0)) {
  3546. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "setsockopt_unicode") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3547. }
  3548. } else {
  3549. switch (PyTuple_GET_SIZE(__pyx_args)) {
  3550. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  3551. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  3552. values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  3553. break;
  3554. default: goto __pyx_L5_argtuple_error;
  3555. }
  3556. }
  3557. __pyx_v_option = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_option == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3558. __pyx_v_optval = values[1];
  3559. __pyx_v_encoding = values[2];
  3560. }
  3561. goto __pyx_L4_argument_unpacking_done;
  3562. __pyx_L5_argtuple_error:;
  3563. __Pyx_RaiseArgtupleInvalid("setsockopt_unicode", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3564. __pyx_L3_error:;
  3565. __Pyx_AddTraceback("zmq.core.socket.Socket.setsockopt_unicode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3566. __Pyx_RefNannyFinishContext();
  3567. return NULL;
  3568. __pyx_L4_argument_unpacking_done:;
  3569. /* "zmq/core/socket.pyx":406
  3570. * The encoding to be used, default is utf8
  3571. * """
  3572. * if not isinstance(optval, unicode): # <<<<<<<<<<<<<<
  3573. * raise TypeError("unicode strings only")
  3574. * return self.setsockopt(option, optval.encode(encoding))
  3575. */
  3576. __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__unicode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3577. __Pyx_GOTREF(__pyx_t_1);
  3578. __pyx_t_2 = PyObject_IsInstance(__pyx_v_optval, __pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3579. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3580. __pyx_t_3 = (!__pyx_t_2);
  3581. if (__pyx_t_3) {
  3582. /* "zmq/core/socket.pyx":407
  3583. * """
  3584. * if not isinstance(optval, unicode):
  3585. * raise TypeError("unicode strings only") # <<<<<<<<<<<<<<
  3586. * return self.setsockopt(option, optval.encode(encoding))
  3587. *
  3588. */
  3589. __pyx_t_1 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3590. __Pyx_GOTREF(__pyx_t_1);
  3591. __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  3592. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3593. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3594. goto __pyx_L6;
  3595. }
  3596. __pyx_L6:;
  3597. /* "zmq/core/socket.pyx":408
  3598. * if not isinstance(optval, unicode):
  3599. * raise TypeError("unicode strings only")
  3600. * return self.setsockopt(option, optval.encode(encoding)) # <<<<<<<<<<<<<<
  3601. *
  3602. * def getsockopt_unicode(self, int option, encoding='utf-8'):
  3603. */
  3604. __Pyx_XDECREF(__pyx_r);
  3605. __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__setsockopt); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3606. __Pyx_GOTREF(__pyx_t_1);
  3607. __pyx_t_4 = PyInt_FromLong(__pyx_v_option); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3608. __Pyx_GOTREF(__pyx_t_4);
  3609. __pyx_t_5 = PyObject_GetAttr(__pyx_v_optval, __pyx_n_s__encode); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3610. __Pyx_GOTREF(__pyx_t_5);
  3611. __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3612. __Pyx_GOTREF(((PyObject *)__pyx_t_6));
  3613. __Pyx_INCREF(__pyx_v_encoding);
  3614. PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_encoding);
  3615. __Pyx_GIVEREF(__pyx_v_encoding);
  3616. __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3617. __Pyx_GOTREF(__pyx_t_7);
  3618. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  3619. __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
  3620. __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3621. __Pyx_GOTREF(((PyObject *)__pyx_t_6));
  3622. PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
  3623. __Pyx_GIVEREF(__pyx_t_4);
  3624. PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_7);
  3625. __Pyx_GIVEREF(__pyx_t_7);
  3626. __pyx_t_4 = 0;
  3627. __pyx_t_7 = 0;
  3628. __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3629. __Pyx_GOTREF(__pyx_t_7);
  3630. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3631. __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
  3632. __pyx_r = __pyx_t_7;
  3633. __pyx_t_7 = 0;
  3634. goto __pyx_L0;
  3635. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  3636. goto __pyx_L0;
  3637. __pyx_L1_error:;
  3638. __Pyx_XDECREF(__pyx_t_1);
  3639. __Pyx_XDECREF(__pyx_t_4);
  3640. __Pyx_XDECREF(__pyx_t_5);
  3641. __Pyx_XDECREF(__pyx_t_6);
  3642. __Pyx_XDECREF(__pyx_t_7);
  3643. __Pyx_AddTraceback("zmq.core.socket.Socket.setsockopt_unicode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3644. __pyx_r = NULL;
  3645. __pyx_L0:;
  3646. __Pyx_XGIVEREF(__pyx_r);
  3647. __Pyx_RefNannyFinishContext();
  3648. return __pyx_r;
  3649. }
  3650. /* "zmq/core/socket.pyx":410
  3651. * return self.setsockopt(option, optval.encode(encoding))
  3652. *
  3653. * def getsockopt_unicode(self, int option, encoding='utf-8'): # <<<<<<<<<<<<<<
  3654. * """s.getsockopt_unicode(option, encoding='utf-8')
  3655. *
  3656. */
  3657. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_9getsockopt_unicode(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  3658. static char __pyx_doc_3zmq_4core_6socket_6Socket_9getsockopt_unicode[] = "s.getsockopt_unicode(option, encoding='utf-8')\n\n Get the value of a socket option.\n\n See the 0MQ documentation for details on specific options.\n\n Parameters\n ----------\n option : int\n The option to retrieve. Currently, IDENTITY is the only\n gettable option that can return a string.\n\n Returns\n -------\n optval : unicode\n The value of the option as a unicode string.\n ";
  3659. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_9getsockopt_unicode(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  3660. int __pyx_v_option;
  3661. PyObject *__pyx_v_encoding = 0;
  3662. PyObject *__pyx_r = NULL;
  3663. __Pyx_RefNannyDeclarations
  3664. PyObject *__pyx_t_1 = NULL;
  3665. PyObject *__pyx_t_2 = NULL;
  3666. PyObject *__pyx_t_3 = NULL;
  3667. int __pyx_t_4;
  3668. int __pyx_lineno = 0;
  3669. const char *__pyx_filename = NULL;
  3670. int __pyx_clineno = 0;
  3671. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__option,&__pyx_n_s__encoding,0};
  3672. __Pyx_RefNannySetupContext("getsockopt_unicode");
  3673. {
  3674. PyObject* values[2] = {0,0};
  3675. values[1] = ((PyObject *)__pyx_kp_s_6);
  3676. if (unlikely(__pyx_kwds)) {
  3677. Py_ssize_t kw_args;
  3678. switch (PyTuple_GET_SIZE(__pyx_args)) {
  3679. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  3680. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  3681. case 0: break;
  3682. default: goto __pyx_L5_argtuple_error;
  3683. }
  3684. kw_args = PyDict_Size(__pyx_kwds);
  3685. switch (PyTuple_GET_SIZE(__pyx_args)) {
  3686. case 0:
  3687. values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__option);
  3688. if (likely(values[0])) kw_args--;
  3689. else goto __pyx_L5_argtuple_error;
  3690. case 1:
  3691. if (kw_args > 0) {
  3692. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__encoding);
  3693. if (value) { values[1] = value; kw_args--; }
  3694. }
  3695. }
  3696. if (unlikely(kw_args > 0)) {
  3697. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "getsockopt_unicode") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3698. }
  3699. } else {
  3700. switch (PyTuple_GET_SIZE(__pyx_args)) {
  3701. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  3702. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  3703. break;
  3704. default: goto __pyx_L5_argtuple_error;
  3705. }
  3706. }
  3707. __pyx_v_option = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_option == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3708. __pyx_v_encoding = values[1];
  3709. }
  3710. goto __pyx_L4_argument_unpacking_done;
  3711. __pyx_L5_argtuple_error:;
  3712. __Pyx_RaiseArgtupleInvalid("getsockopt_unicode", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  3713. __pyx_L3_error:;
  3714. __Pyx_AddTraceback("zmq.core.socket.Socket.getsockopt_unicode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3715. __Pyx_RefNannyFinishContext();
  3716. return NULL;
  3717. __pyx_L4_argument_unpacking_done:;
  3718. /* "zmq/core/socket.pyx":429
  3719. * """
  3720. *
  3721. * if option not in constants.bytes_sockopts: # <<<<<<<<<<<<<<
  3722. * raise TypeError("option %i will not return a string to be decoded"%option)
  3723. * return self.getsockopt(option).decode(encoding)
  3724. */
  3725. __pyx_t_1 = PyInt_FromLong(__pyx_v_option); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3726. __Pyx_GOTREF(__pyx_t_1);
  3727. __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__constants); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3728. __Pyx_GOTREF(__pyx_t_2);
  3729. __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__bytes_sockopts); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3730. __Pyx_GOTREF(__pyx_t_3);
  3731. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3732. __pyx_t_4 = (__Pyx_NegateNonNeg(PySequence_Contains(__pyx_t_3, __pyx_t_1))); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3733. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3734. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3735. if (__pyx_t_4) {
  3736. /* "zmq/core/socket.pyx":430
  3737. *
  3738. * if option not in constants.bytes_sockopts:
  3739. * raise TypeError("option %i will not return a string to be decoded"%option) # <<<<<<<<<<<<<<
  3740. * return self.getsockopt(option).decode(encoding)
  3741. *
  3742. */
  3743. __pyx_t_3 = PyInt_FromLong(__pyx_v_option); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3744. __Pyx_GOTREF(__pyx_t_3);
  3745. __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_9), __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3746. __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  3747. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3748. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3749. __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  3750. PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1));
  3751. __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  3752. __pyx_t_1 = 0;
  3753. __pyx_t_1 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3754. __Pyx_GOTREF(__pyx_t_1);
  3755. __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  3756. __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  3757. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3758. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3759. goto __pyx_L6;
  3760. }
  3761. __pyx_L6:;
  3762. /* "zmq/core/socket.pyx":431
  3763. * if option not in constants.bytes_sockopts:
  3764. * raise TypeError("option %i will not return a string to be decoded"%option)
  3765. * return self.getsockopt(option).decode(encoding) # <<<<<<<<<<<<<<
  3766. *
  3767. * def __setattr__(self, key, value):
  3768. */
  3769. __Pyx_XDECREF(__pyx_r);
  3770. __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__getsockopt); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3771. __Pyx_GOTREF(__pyx_t_1);
  3772. __pyx_t_3 = PyInt_FromLong(__pyx_v_option); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3773. __Pyx_GOTREF(__pyx_t_3);
  3774. __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3775. __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  3776. PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
  3777. __Pyx_GIVEREF(__pyx_t_3);
  3778. __pyx_t_3 = 0;
  3779. __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3780. __Pyx_GOTREF(__pyx_t_3);
  3781. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3782. __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  3783. __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__decode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3784. __Pyx_GOTREF(__pyx_t_2);
  3785. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3786. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3787. __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  3788. __Pyx_INCREF(__pyx_v_encoding);
  3789. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_encoding);
  3790. __Pyx_GIVEREF(__pyx_v_encoding);
  3791. __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  3792. __Pyx_GOTREF(__pyx_t_1);
  3793. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3794. __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  3795. __pyx_r = __pyx_t_1;
  3796. __pyx_t_1 = 0;
  3797. goto __pyx_L0;
  3798. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  3799. goto __pyx_L0;
  3800. __pyx_L1_error:;
  3801. __Pyx_XDECREF(__pyx_t_1);
  3802. __Pyx_XDECREF(__pyx_t_2);
  3803. __Pyx_XDECREF(__pyx_t_3);
  3804. __Pyx_AddTraceback("zmq.core.socket.Socket.getsockopt_unicode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3805. __pyx_r = NULL;
  3806. __pyx_L0:;
  3807. __Pyx_XGIVEREF(__pyx_r);
  3808. __Pyx_RefNannyFinishContext();
  3809. return __pyx_r;
  3810. }
  3811. /* "zmq/core/socket.pyx":433
  3812. * return self.getsockopt(option).decode(encoding)
  3813. *
  3814. * def __setattr__(self, key, value): # <<<<<<<<<<<<<<
  3815. * """set sockopts by attr"""
  3816. * key = key
  3817. */
  3818. static int __pyx_pf_3zmq_4core_6socket_6Socket_10__setattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /*proto*/
  3819. static char __pyx_doc_3zmq_4core_6socket_6Socket_10__setattr__[] = "set sockopts by attr";
  3820. struct wrapperbase __pyx_wrapperbase_3zmq_4core_6socket_6Socket_10__setattr__;
  3821. static int __pyx_pf_3zmq_4core_6socket_6Socket_10__setattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
  3822. PyObject *__pyx_v_opt = NULL;
  3823. int __pyx_r;
  3824. __Pyx_RefNannyDeclarations
  3825. PyObject *__pyx_t_1 = NULL;
  3826. PyObject *__pyx_t_2 = NULL;
  3827. PyObject *__pyx_t_3 = NULL;
  3828. PyObject *__pyx_t_4 = NULL;
  3829. PyObject *__pyx_t_5 = NULL;
  3830. PyObject *__pyx_t_6 = NULL;
  3831. int __pyx_t_7;
  3832. PyObject *__pyx_t_8 = NULL;
  3833. PyObject *__pyx_t_9 = NULL;
  3834. int __pyx_t_10;
  3835. int __pyx_lineno = 0;
  3836. const char *__pyx_filename = NULL;
  3837. int __pyx_clineno = 0;
  3838. __Pyx_RefNannySetupContext("__setattr__");
  3839. __Pyx_INCREF(__pyx_v_key);
  3840. /* "zmq/core/socket.pyx":435
  3841. * def __setattr__(self, key, value):
  3842. * """set sockopts by attr"""
  3843. * key = key # <<<<<<<<<<<<<<
  3844. * try:
  3845. * opt = getattr(constants, key.upper())
  3846. */
  3847. __Pyx_INCREF(__pyx_v_key);
  3848. __Pyx_DECREF(__pyx_v_key);
  3849. __pyx_v_key = __pyx_v_key;
  3850. /* "zmq/core/socket.pyx":436
  3851. * """set sockopts by attr"""
  3852. * key = key
  3853. * try: # <<<<<<<<<<<<<<
  3854. * opt = getattr(constants, key.upper())
  3855. * except AttributeError:
  3856. */
  3857. {
  3858. __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
  3859. __Pyx_XGOTREF(__pyx_t_1);
  3860. __Pyx_XGOTREF(__pyx_t_2);
  3861. __Pyx_XGOTREF(__pyx_t_3);
  3862. /*try:*/ {
  3863. /* "zmq/core/socket.pyx":437
  3864. * key = key
  3865. * try:
  3866. * opt = getattr(constants, key.upper()) # <<<<<<<<<<<<<<
  3867. * except AttributeError:
  3868. * # allow subclasses to have extended attributes
  3869. */
  3870. __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__constants); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
  3871. __Pyx_GOTREF(__pyx_t_4);
  3872. __pyx_t_5 = PyObject_GetAttr(__pyx_v_key, __pyx_n_s__upper); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
  3873. __Pyx_GOTREF(__pyx_t_5);
  3874. __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
  3875. __Pyx_GOTREF(__pyx_t_6);
  3876. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  3877. __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
  3878. __Pyx_GOTREF(__pyx_t_5);
  3879. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3880. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  3881. __pyx_v_opt = __pyx_t_5;
  3882. __pyx_t_5 = 0;
  3883. }
  3884. /*else:*/ {
  3885. /* "zmq/core/socket.pyx":445
  3886. * raise AttributeError("Socket has no such option: %s"%key.upper())
  3887. * else:
  3888. * self.setsockopt(opt, value) # <<<<<<<<<<<<<<
  3889. *
  3890. * def __getattr__(self, key):
  3891. */
  3892. __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__setsockopt); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
  3893. __Pyx_GOTREF(__pyx_t_5);
  3894. __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
  3895. __Pyx_GOTREF(((PyObject *)__pyx_t_6));
  3896. __Pyx_INCREF(__pyx_v_opt);
  3897. PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_opt);
  3898. __Pyx_GIVEREF(__pyx_v_opt);
  3899. __Pyx_INCREF(__pyx_v_value);
  3900. PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_value);
  3901. __Pyx_GIVEREF(__pyx_v_value);
  3902. __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
  3903. __Pyx_GOTREF(__pyx_t_4);
  3904. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  3905. __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
  3906. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3907. }
  3908. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  3909. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  3910. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  3911. goto __pyx_L12_try_end;
  3912. __pyx_L5_error:;
  3913. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  3914. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  3915. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  3916. /* "zmq/core/socket.pyx":438
  3917. * try:
  3918. * opt = getattr(constants, key.upper())
  3919. * except AttributeError: # <<<<<<<<<<<<<<
  3920. * # allow subclasses to have extended attributes
  3921. * if self.__class__.__module__ != 'zmq.core.socket':
  3922. */
  3923. __pyx_t_7 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
  3924. if (__pyx_t_7) {
  3925. __Pyx_AddTraceback("zmq.core.socket.Socket.__setattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3926. if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
  3927. __Pyx_GOTREF(__pyx_t_4);
  3928. __Pyx_GOTREF(__pyx_t_6);
  3929. __Pyx_GOTREF(__pyx_t_5);
  3930. /* "zmq/core/socket.pyx":440
  3931. * except AttributeError:
  3932. * # allow subclasses to have extended attributes
  3933. * if self.__class__.__module__ != 'zmq.core.socket': # <<<<<<<<<<<<<<
  3934. * self._attrs[key] = value
  3935. * else:
  3936. */
  3937. __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s____class__); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
  3938. __Pyx_GOTREF(__pyx_t_8);
  3939. __pyx_t_9 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s____module__); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
  3940. __Pyx_GOTREF(__pyx_t_9);
  3941. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  3942. __pyx_t_10 = __Pyx_PyString_Equals(__pyx_t_9, ((PyObject *)__pyx_kp_s_10), Py_NE); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
  3943. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  3944. if (__pyx_t_10) {
  3945. /* "zmq/core/socket.pyx":441
  3946. * # allow subclasses to have extended attributes
  3947. * if self.__class__.__module__ != 'zmq.core.socket':
  3948. * self._attrs[key] = value # <<<<<<<<<<<<<<
  3949. * else:
  3950. * raise AttributeError("Socket has no such option: %s"%key.upper())
  3951. */
  3952. if (PyDict_SetItem(((PyObject *)((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->_attrs), __pyx_v_key, __pyx_v_value) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
  3953. goto __pyx_L15;
  3954. }
  3955. /*else*/ {
  3956. /* "zmq/core/socket.pyx":443
  3957. * self._attrs[key] = value
  3958. * else:
  3959. * raise AttributeError("Socket has no such option: %s"%key.upper()) # <<<<<<<<<<<<<<
  3960. * else:
  3961. * self.setsockopt(opt, value)
  3962. */
  3963. __pyx_t_9 = PyObject_GetAttr(__pyx_v_key, __pyx_n_s__upper); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
  3964. __Pyx_GOTREF(__pyx_t_9);
  3965. __pyx_t_8 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
  3966. __Pyx_GOTREF(__pyx_t_8);
  3967. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  3968. __pyx_t_9 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_11), __pyx_t_8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
  3969. __Pyx_GOTREF(((PyObject *)__pyx_t_9));
  3970. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  3971. __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
  3972. __Pyx_GOTREF(((PyObject *)__pyx_t_8));
  3973. PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_9));
  3974. __Pyx_GIVEREF(((PyObject *)__pyx_t_9));
  3975. __pyx_t_9 = 0;
  3976. __pyx_t_9 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
  3977. __Pyx_GOTREF(__pyx_t_9);
  3978. __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
  3979. __Pyx_Raise(__pyx_t_9, 0, 0, 0);
  3980. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  3981. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
  3982. }
  3983. __pyx_L15:;
  3984. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3985. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  3986. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  3987. goto __pyx_L6_exception_handled;
  3988. }
  3989. __pyx_L7_except_error:;
  3990. __Pyx_XGIVEREF(__pyx_t_1);
  3991. __Pyx_XGIVEREF(__pyx_t_2);
  3992. __Pyx_XGIVEREF(__pyx_t_3);
  3993. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  3994. goto __pyx_L1_error;
  3995. __pyx_L6_exception_handled:;
  3996. __Pyx_XGIVEREF(__pyx_t_1);
  3997. __Pyx_XGIVEREF(__pyx_t_2);
  3998. __Pyx_XGIVEREF(__pyx_t_3);
  3999. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  4000. __pyx_L12_try_end:;
  4001. }
  4002. __pyx_r = 0;
  4003. goto __pyx_L0;
  4004. __pyx_L1_error:;
  4005. __Pyx_XDECREF(__pyx_t_4);
  4006. __Pyx_XDECREF(__pyx_t_5);
  4007. __Pyx_XDECREF(__pyx_t_6);
  4008. __Pyx_XDECREF(__pyx_t_8);
  4009. __Pyx_XDECREF(__pyx_t_9);
  4010. __Pyx_AddTraceback("zmq.core.socket.Socket.__setattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4011. __pyx_r = -1;
  4012. __pyx_L0:;
  4013. __Pyx_XDECREF(__pyx_v_opt);
  4014. __Pyx_XDECREF(__pyx_v_key);
  4015. __Pyx_RefNannyFinishContext();
  4016. return __pyx_r;
  4017. }
  4018. /* "zmq/core/socket.pyx":447
  4019. * self.setsockopt(opt, value)
  4020. *
  4021. * def __getattr__(self, key): # <<<<<<<<<<<<<<
  4022. * """set sockopts by attr"""
  4023. * if key in self._attrs:
  4024. */
  4025. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_11__getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
  4026. static char __pyx_doc_3zmq_4core_6socket_6Socket_11__getattr__[] = "set sockopts by attr";
  4027. struct wrapperbase __pyx_wrapperbase_3zmq_4core_6socket_6Socket_11__getattr__;
  4028. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_11__getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  4029. PyObject *__pyx_v_opt = NULL;
  4030. PyObject *__pyx_r = NULL;
  4031. __Pyx_RefNannyDeclarations
  4032. int __pyx_t_1;
  4033. PyObject *__pyx_t_2 = NULL;
  4034. PyObject *__pyx_t_3 = NULL;
  4035. PyObject *__pyx_t_4 = NULL;
  4036. PyObject *__pyx_t_5 = NULL;
  4037. PyObject *__pyx_t_6 = NULL;
  4038. PyObject *__pyx_t_7 = NULL;
  4039. int __pyx_t_8;
  4040. PyObject *__pyx_t_9 = NULL;
  4041. PyObject *__pyx_t_10 = NULL;
  4042. int __pyx_lineno = 0;
  4043. const char *__pyx_filename = NULL;
  4044. int __pyx_clineno = 0;
  4045. __Pyx_RefNannySetupContext("__getattr__");
  4046. __Pyx_INCREF(__pyx_v_key);
  4047. /* "zmq/core/socket.pyx":449
  4048. * def __getattr__(self, key):
  4049. * """set sockopts by attr"""
  4050. * if key in self._attrs: # <<<<<<<<<<<<<<
  4051. * # `key` is subclass extended attribute
  4052. * return self._attrs[key]
  4053. */
  4054. if (unlikely(((PyObject *)((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->_attrs) == Py_None)) {
  4055. PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4056. }
  4057. __pyx_t_1 = ((PyDict_Contains(((PyObject *)((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->_attrs), __pyx_v_key))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4058. if (__pyx_t_1) {
  4059. /* "zmq/core/socket.pyx":451
  4060. * if key in self._attrs:
  4061. * # `key` is subclass extended attribute
  4062. * return self._attrs[key] # <<<<<<<<<<<<<<
  4063. * key = key.upper()
  4064. * try:
  4065. */
  4066. __Pyx_XDECREF(__pyx_r);
  4067. __pyx_t_2 = __Pyx_PyDict_GetItem(((PyObject *)((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->_attrs), __pyx_v_key); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4068. __Pyx_GOTREF(__pyx_t_2);
  4069. __pyx_r = __pyx_t_2;
  4070. __pyx_t_2 = 0;
  4071. goto __pyx_L0;
  4072. goto __pyx_L5;
  4073. }
  4074. __pyx_L5:;
  4075. /* "zmq/core/socket.pyx":452
  4076. * # `key` is subclass extended attribute
  4077. * return self._attrs[key]
  4078. * key = key.upper() # <<<<<<<<<<<<<<
  4079. * try:
  4080. * opt = getattr(constants, key)
  4081. */
  4082. __pyx_t_2 = PyObject_GetAttr(__pyx_v_key, __pyx_n_s__upper); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4083. __Pyx_GOTREF(__pyx_t_2);
  4084. __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 = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4085. __Pyx_GOTREF(__pyx_t_3);
  4086. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4087. __Pyx_DECREF(__pyx_v_key);
  4088. __pyx_v_key = __pyx_t_3;
  4089. __pyx_t_3 = 0;
  4090. /* "zmq/core/socket.pyx":453
  4091. * return self._attrs[key]
  4092. * key = key.upper()
  4093. * try: # <<<<<<<<<<<<<<
  4094. * opt = getattr(constants, key)
  4095. * except AttributeError:
  4096. */
  4097. {
  4098. __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
  4099. __Pyx_XGOTREF(__pyx_t_4);
  4100. __Pyx_XGOTREF(__pyx_t_5);
  4101. __Pyx_XGOTREF(__pyx_t_6);
  4102. /*try:*/ {
  4103. /* "zmq/core/socket.pyx":454
  4104. * key = key.upper()
  4105. * try:
  4106. * opt = getattr(constants, key) # <<<<<<<<<<<<<<
  4107. * except AttributeError:
  4108. * raise AttributeError("Socket has no such option: %s"%key)
  4109. */
  4110. __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__constants); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
  4111. __Pyx_GOTREF(__pyx_t_3);
  4112. __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_v_key); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
  4113. __Pyx_GOTREF(__pyx_t_2);
  4114. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4115. __pyx_v_opt = __pyx_t_2;
  4116. __pyx_t_2 = 0;
  4117. }
  4118. /*else:*/ {
  4119. /* "zmq/core/socket.pyx":458
  4120. * raise AttributeError("Socket has no such option: %s"%key)
  4121. * else:
  4122. * return self.getsockopt(opt) # <<<<<<<<<<<<<<
  4123. *
  4124. * def bind(self, addr):
  4125. */
  4126. __Pyx_XDECREF(__pyx_r);
  4127. __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__getsockopt); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
  4128. __Pyx_GOTREF(__pyx_t_2);
  4129. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
  4130. __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  4131. __Pyx_INCREF(__pyx_v_opt);
  4132. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_opt);
  4133. __Pyx_GIVEREF(__pyx_v_opt);
  4134. __pyx_t_7 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
  4135. __Pyx_GOTREF(__pyx_t_7);
  4136. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4137. __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  4138. __pyx_r = __pyx_t_7;
  4139. __pyx_t_7 = 0;
  4140. goto __pyx_L9_except_return;
  4141. }
  4142. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  4143. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  4144. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  4145. goto __pyx_L13_try_end;
  4146. __pyx_L6_error:;
  4147. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  4148. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  4149. /* "zmq/core/socket.pyx":455
  4150. * try:
  4151. * opt = getattr(constants, key)
  4152. * except AttributeError: # <<<<<<<<<<<<<<
  4153. * raise AttributeError("Socket has no such option: %s"%key)
  4154. * else:
  4155. */
  4156. __pyx_t_8 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
  4157. if (__pyx_t_8) {
  4158. __Pyx_AddTraceback("zmq.core.socket.Socket.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4159. if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_3, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
  4160. __Pyx_GOTREF(__pyx_t_7);
  4161. __Pyx_GOTREF(__pyx_t_3);
  4162. __Pyx_GOTREF(__pyx_t_2);
  4163. /* "zmq/core/socket.pyx":456
  4164. * opt = getattr(constants, key)
  4165. * except AttributeError:
  4166. * raise AttributeError("Socket has no such option: %s"%key) # <<<<<<<<<<<<<<
  4167. * else:
  4168. * return self.getsockopt(opt)
  4169. */
  4170. __pyx_t_9 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_11), __pyx_v_key); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
  4171. __Pyx_GOTREF(((PyObject *)__pyx_t_9));
  4172. __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
  4173. __Pyx_GOTREF(((PyObject *)__pyx_t_10));
  4174. PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_t_9));
  4175. __Pyx_GIVEREF(((PyObject *)__pyx_t_9));
  4176. __pyx_t_9 = 0;
  4177. __pyx_t_9 = PyObject_Call(__pyx_builtin_AttributeError, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
  4178. __Pyx_GOTREF(__pyx_t_9);
  4179. __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
  4180. __Pyx_Raise(__pyx_t_9, 0, 0, 0);
  4181. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  4182. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
  4183. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4184. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4185. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4186. goto __pyx_L7_exception_handled;
  4187. }
  4188. __pyx_L8_except_error:;
  4189. __Pyx_XGIVEREF(__pyx_t_4);
  4190. __Pyx_XGIVEREF(__pyx_t_5);
  4191. __Pyx_XGIVEREF(__pyx_t_6);
  4192. __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
  4193. goto __pyx_L1_error;
  4194. __pyx_L9_except_return:;
  4195. __Pyx_XGIVEREF(__pyx_t_4);
  4196. __Pyx_XGIVEREF(__pyx_t_5);
  4197. __Pyx_XGIVEREF(__pyx_t_6);
  4198. __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
  4199. goto __pyx_L0;
  4200. __pyx_L7_exception_handled:;
  4201. __Pyx_XGIVEREF(__pyx_t_4);
  4202. __Pyx_XGIVEREF(__pyx_t_5);
  4203. __Pyx_XGIVEREF(__pyx_t_6);
  4204. __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
  4205. __pyx_L13_try_end:;
  4206. }
  4207. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  4208. goto __pyx_L0;
  4209. __pyx_L1_error:;
  4210. __Pyx_XDECREF(__pyx_t_2);
  4211. __Pyx_XDECREF(__pyx_t_3);
  4212. __Pyx_XDECREF(__pyx_t_7);
  4213. __Pyx_XDECREF(__pyx_t_9);
  4214. __Pyx_XDECREF(__pyx_t_10);
  4215. __Pyx_AddTraceback("zmq.core.socket.Socket.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4216. __pyx_r = NULL;
  4217. __pyx_L0:;
  4218. __Pyx_XDECREF(__pyx_v_opt);
  4219. __Pyx_XDECREF(__pyx_v_key);
  4220. __Pyx_XGIVEREF(__pyx_r);
  4221. __Pyx_RefNannyFinishContext();
  4222. return __pyx_r;
  4223. }
  4224. /* "zmq/core/socket.pyx":460
  4225. * return self.getsockopt(opt)
  4226. *
  4227. * def bind(self, addr): # <<<<<<<<<<<<<<
  4228. * """s.bind(addr)
  4229. *
  4230. */
  4231. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_12bind(PyObject *__pyx_v_self, PyObject *__pyx_v_addr); /*proto*/
  4232. static char __pyx_doc_3zmq_4core_6socket_6Socket_12bind[] = "s.bind(addr)\n\n Bind the socket to an address.\n\n This causes the socket to listen on a network port. Sockets on the\n other side of this connection will use ``Socket.connect(addr)`` to\n connect to this socket.\n\n Parameters\n ----------\n addr : str\n The address string. This has the form 'protocol://interface:port',\n for example 'tcp://127.0.0.1:5555'. Protocols supported are\n tcp, upd, pgm, inproc and ipc. If the address is unicode, it is\n encoded to utf-8 first.\n ";
  4233. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_12bind(PyObject *__pyx_v_self, PyObject *__pyx_v_addr) {
  4234. int __pyx_v_rc;
  4235. char *__pyx_v_c_addr;
  4236. PyObject *__pyx_r = NULL;
  4237. __Pyx_RefNannyDeclarations
  4238. PyObject *__pyx_t_1 = NULL;
  4239. int __pyx_t_2;
  4240. PyObject *__pyx_t_3 = NULL;
  4241. int __pyx_t_4;
  4242. char *__pyx_t_5;
  4243. int __pyx_lineno = 0;
  4244. const char *__pyx_filename = NULL;
  4245. int __pyx_clineno = 0;
  4246. __Pyx_RefNannySetupContext("bind");
  4247. __Pyx_INCREF(__pyx_v_addr);
  4248. /* "zmq/core/socket.pyx":480
  4249. * cdef char* c_addr
  4250. *
  4251. * _check_closed(self, True) # <<<<<<<<<<<<<<
  4252. * if isinstance(addr, unicode):
  4253. * addr = addr.encode('utf-8')
  4254. */
  4255. __pyx_t_1 = __pyx_f_3zmq_4core_6socket__check_closed(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4256. __Pyx_GOTREF(__pyx_t_1);
  4257. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4258. /* "zmq/core/socket.pyx":481
  4259. *
  4260. * _check_closed(self, True)
  4261. * if isinstance(addr, unicode): # <<<<<<<<<<<<<<
  4262. * addr = addr.encode('utf-8')
  4263. * if not isinstance(addr, bytes):
  4264. */
  4265. __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__unicode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4266. __Pyx_GOTREF(__pyx_t_1);
  4267. __pyx_t_2 = PyObject_IsInstance(__pyx_v_addr, __pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4268. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4269. if (__pyx_t_2) {
  4270. /* "zmq/core/socket.pyx":482
  4271. * _check_closed(self, True)
  4272. * if isinstance(addr, unicode):
  4273. * addr = addr.encode('utf-8') # <<<<<<<<<<<<<<
  4274. * if not isinstance(addr, bytes):
  4275. * raise TypeError('expected str, got: %r' % addr)
  4276. */
  4277. __pyx_t_1 = PyObject_GetAttr(__pyx_v_addr, __pyx_n_s__encode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4278. __Pyx_GOTREF(__pyx_t_1);
  4279. __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4280. __Pyx_GOTREF(__pyx_t_3);
  4281. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4282. __Pyx_DECREF(__pyx_v_addr);
  4283. __pyx_v_addr = __pyx_t_3;
  4284. __pyx_t_3 = 0;
  4285. goto __pyx_L5;
  4286. }
  4287. __pyx_L5:;
  4288. /* "zmq/core/socket.pyx":483
  4289. * if isinstance(addr, unicode):
  4290. * addr = addr.encode('utf-8')
  4291. * if not isinstance(addr, bytes): # <<<<<<<<<<<<<<
  4292. * raise TypeError('expected str, got: %r' % addr)
  4293. * c_addr = addr
  4294. */
  4295. __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__bytes); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4296. __Pyx_GOTREF(__pyx_t_3);
  4297. __pyx_t_2 = PyObject_IsInstance(__pyx_v_addr, __pyx_t_3); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4298. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4299. __pyx_t_4 = (!__pyx_t_2);
  4300. if (__pyx_t_4) {
  4301. /* "zmq/core/socket.pyx":484
  4302. * addr = addr.encode('utf-8')
  4303. * if not isinstance(addr, bytes):
  4304. * raise TypeError('expected str, got: %r' % addr) # <<<<<<<<<<<<<<
  4305. * c_addr = addr
  4306. * with nogil:
  4307. */
  4308. __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_13), __pyx_v_addr); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4309. __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  4310. __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4311. __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  4312. PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_3));
  4313. __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
  4314. __pyx_t_3 = 0;
  4315. __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4316. __Pyx_GOTREF(__pyx_t_3);
  4317. __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  4318. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  4319. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4320. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4321. goto __pyx_L6;
  4322. }
  4323. __pyx_L6:;
  4324. /* "zmq/core/socket.pyx":485
  4325. * if not isinstance(addr, bytes):
  4326. * raise TypeError('expected str, got: %r' % addr)
  4327. * c_addr = addr # <<<<<<<<<<<<<<
  4328. * with nogil:
  4329. * rc = zmq_bind(self.handle, c_addr)
  4330. */
  4331. __pyx_t_5 = PyBytes_AsString(__pyx_v_addr); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4332. __pyx_v_c_addr = __pyx_t_5;
  4333. /* "zmq/core/socket.pyx":486
  4334. * raise TypeError('expected str, got: %r' % addr)
  4335. * c_addr = addr
  4336. * with nogil: # <<<<<<<<<<<<<<
  4337. * rc = zmq_bind(self.handle, c_addr)
  4338. * if rc != 0:
  4339. */
  4340. {
  4341. #ifdef WITH_THREAD
  4342. PyThreadState *_save = NULL;
  4343. #endif
  4344. Py_UNBLOCK_THREADS
  4345. /*try:*/ {
  4346. /* "zmq/core/socket.pyx":487
  4347. * c_addr = addr
  4348. * with nogil:
  4349. * rc = zmq_bind(self.handle, c_addr) # <<<<<<<<<<<<<<
  4350. * if rc != 0:
  4351. * raise ZMQError()
  4352. */
  4353. __pyx_v_rc = zmq_bind(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->handle, __pyx_v_c_addr);
  4354. }
  4355. /* "zmq/core/socket.pyx":486
  4356. * raise TypeError('expected str, got: %r' % addr)
  4357. * c_addr = addr
  4358. * with nogil: # <<<<<<<<<<<<<<
  4359. * rc = zmq_bind(self.handle, c_addr)
  4360. * if rc != 0:
  4361. */
  4362. /*finally:*/ {
  4363. Py_BLOCK_THREADS
  4364. }
  4365. }
  4366. /* "zmq/core/socket.pyx":488
  4367. * with nogil:
  4368. * rc = zmq_bind(self.handle, c_addr)
  4369. * if rc != 0: # <<<<<<<<<<<<<<
  4370. * raise ZMQError()
  4371. *
  4372. */
  4373. __pyx_t_4 = (__pyx_v_rc != 0);
  4374. if (__pyx_t_4) {
  4375. /* "zmq/core/socket.pyx":489
  4376. * rc = zmq_bind(self.handle, c_addr)
  4377. * if rc != 0:
  4378. * raise ZMQError() # <<<<<<<<<<<<<<
  4379. *
  4380. * def bind_to_random_port(self, addr, min_port=49152, max_port=65536, max_tries=100):
  4381. */
  4382. __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4383. __Pyx_GOTREF(__pyx_t_3);
  4384. __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4385. __Pyx_GOTREF(__pyx_t_1);
  4386. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4387. __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  4388. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4389. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4390. goto __pyx_L10;
  4391. }
  4392. __pyx_L10:;
  4393. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  4394. goto __pyx_L0;
  4395. __pyx_L1_error:;
  4396. __Pyx_XDECREF(__pyx_t_1);
  4397. __Pyx_XDECREF(__pyx_t_3);
  4398. __Pyx_AddTraceback("zmq.core.socket.Socket.bind", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4399. __pyx_r = NULL;
  4400. __pyx_L0:;
  4401. __Pyx_XDECREF(__pyx_v_addr);
  4402. __Pyx_XGIVEREF(__pyx_r);
  4403. __Pyx_RefNannyFinishContext();
  4404. return __pyx_r;
  4405. }
  4406. /* "zmq/core/socket.pyx":491
  4407. * raise ZMQError()
  4408. *
  4409. * def bind_to_random_port(self, addr, min_port=49152, max_port=65536, max_tries=100): # <<<<<<<<<<<<<<
  4410. * """s.bind_to_random_port(addr, min_port=49152, max_port=65536, max_tries=100)
  4411. *
  4412. */
  4413. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_13bind_to_random_port(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  4414. static char __pyx_doc_3zmq_4core_6socket_6Socket_13bind_to_random_port[] = "s.bind_to_random_port(addr, min_port=49152, max_port=65536, max_tries=100)\n\n Bind this socket to a random port in a range.\n\n Parameters\n ----------\n addr : str\n The address string without the port to pass to ``Socket.bind()``.\n min_port : int, optional\n The minimum port in the range of ports to try (inclusive).\n max_port : int, optional\n The maximum port in the range of ports to try (exclusive).\n max_tries : int, optional\n The maximum number of bind attempts to make.\n\n Returns\n -------\n port : int\n The port the socket was bound to.\n \n Raises\n ------\n ZMQBindError\n if `max_tries` reached before successful bind\n ";
  4415. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_13bind_to_random_port(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  4416. PyObject *__pyx_v_addr = 0;
  4417. PyObject *__pyx_v_min_port = 0;
  4418. PyObject *__pyx_v_max_port = 0;
  4419. PyObject *__pyx_v_max_tries = 0;
  4420. PyObject *__pyx_v_i = NULL;
  4421. PyObject *__pyx_v_port = NULL;
  4422. PyObject *__pyx_r = NULL;
  4423. __Pyx_RefNannyDeclarations
  4424. PyObject *__pyx_t_1 = NULL;
  4425. PyObject *__pyx_t_2 = NULL;
  4426. Py_ssize_t __pyx_t_3;
  4427. PyObject *(*__pyx_t_4)(PyObject *);
  4428. PyObject *__pyx_t_5 = NULL;
  4429. PyObject *__pyx_t_6 = NULL;
  4430. PyObject *__pyx_t_7 = NULL;
  4431. PyObject *__pyx_t_8 = NULL;
  4432. PyObject *__pyx_t_9 = NULL;
  4433. int __pyx_t_10;
  4434. int __pyx_lineno = 0;
  4435. const char *__pyx_filename = NULL;
  4436. int __pyx_clineno = 0;
  4437. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__addr,&__pyx_n_s__min_port,&__pyx_n_s__max_port,&__pyx_n_s__max_tries,0};
  4438. __Pyx_RefNannySetupContext("bind_to_random_port");
  4439. {
  4440. PyObject* values[4] = {0,0,0,0};
  4441. values[1] = ((PyObject *)__pyx_int_49152);
  4442. values[2] = ((PyObject *)__pyx_int_65536);
  4443. values[3] = ((PyObject *)__pyx_int_100);
  4444. if (unlikely(__pyx_kwds)) {
  4445. Py_ssize_t kw_args;
  4446. switch (PyTuple_GET_SIZE(__pyx_args)) {
  4447. case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
  4448. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  4449. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  4450. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  4451. case 0: break;
  4452. default: goto __pyx_L5_argtuple_error;
  4453. }
  4454. kw_args = PyDict_Size(__pyx_kwds);
  4455. switch (PyTuple_GET_SIZE(__pyx_args)) {
  4456. case 0:
  4457. values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__addr);
  4458. if (likely(values[0])) kw_args--;
  4459. else goto __pyx_L5_argtuple_error;
  4460. case 1:
  4461. if (kw_args > 0) {
  4462. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__min_port);
  4463. if (value) { values[1] = value; kw_args--; }
  4464. }
  4465. case 2:
  4466. if (kw_args > 0) {
  4467. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_port);
  4468. if (value) { values[2] = value; kw_args--; }
  4469. }
  4470. case 3:
  4471. if (kw_args > 0) {
  4472. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_tries);
  4473. if (value) { values[3] = value; kw_args--; }
  4474. }
  4475. }
  4476. if (unlikely(kw_args > 0)) {
  4477. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "bind_to_random_port") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4478. }
  4479. } else {
  4480. switch (PyTuple_GET_SIZE(__pyx_args)) {
  4481. case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
  4482. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  4483. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  4484. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  4485. break;
  4486. default: goto __pyx_L5_argtuple_error;
  4487. }
  4488. }
  4489. __pyx_v_addr = values[0];
  4490. __pyx_v_min_port = values[1];
  4491. __pyx_v_max_port = values[2];
  4492. __pyx_v_max_tries = values[3];
  4493. }
  4494. goto __pyx_L4_argument_unpacking_done;
  4495. __pyx_L5_argtuple_error:;
  4496. __Pyx_RaiseArgtupleInvalid("bind_to_random_port", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  4497. __pyx_L3_error:;
  4498. __Pyx_AddTraceback("zmq.core.socket.Socket.bind_to_random_port", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4499. __Pyx_RefNannyFinishContext();
  4500. return NULL;
  4501. __pyx_L4_argument_unpacking_done:;
  4502. /* "zmq/core/socket.pyx":517
  4503. * if `max_tries` reached before successful bind
  4504. * """
  4505. * for i in xrange(max_tries): # <<<<<<<<<<<<<<
  4506. * try:
  4507. * port = random.randrange(min_port, max_port)
  4508. */
  4509. __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4510. __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  4511. __Pyx_INCREF(__pyx_v_max_tries);
  4512. PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_max_tries);
  4513. __Pyx_GIVEREF(__pyx_v_max_tries);
  4514. __pyx_t_2 = PyObject_Call(__pyx_builtin_xrange, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4515. __Pyx_GOTREF(__pyx_t_2);
  4516. __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  4517. if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
  4518. __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
  4519. __pyx_t_4 = NULL;
  4520. } else {
  4521. __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4522. __Pyx_GOTREF(__pyx_t_1);
  4523. __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext;
  4524. }
  4525. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4526. for (;;) {
  4527. if (PyList_CheckExact(__pyx_t_1)) {
  4528. if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
  4529. __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++;
  4530. } else if (PyTuple_CheckExact(__pyx_t_1)) {
  4531. if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
  4532. __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++;
  4533. } else {
  4534. __pyx_t_2 = __pyx_t_4(__pyx_t_1);
  4535. if (unlikely(!__pyx_t_2)) {
  4536. if (PyErr_Occurred()) {
  4537. if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
  4538. else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4539. }
  4540. break;
  4541. }
  4542. __Pyx_GOTREF(__pyx_t_2);
  4543. }
  4544. __Pyx_XDECREF(__pyx_v_i);
  4545. __pyx_v_i = __pyx_t_2;
  4546. __pyx_t_2 = 0;
  4547. /* "zmq/core/socket.pyx":518
  4548. * """
  4549. * for i in xrange(max_tries):
  4550. * try: # <<<<<<<<<<<<<<
  4551. * port = random.randrange(min_port, max_port)
  4552. * self.bind('%s:%s' % (addr, port))
  4553. */
  4554. {
  4555. __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
  4556. __Pyx_XGOTREF(__pyx_t_5);
  4557. __Pyx_XGOTREF(__pyx_t_6);
  4558. __Pyx_XGOTREF(__pyx_t_7);
  4559. /*try:*/ {
  4560. /* "zmq/core/socket.pyx":519
  4561. * for i in xrange(max_tries):
  4562. * try:
  4563. * port = random.randrange(min_port, max_port) # <<<<<<<<<<<<<<
  4564. * self.bind('%s:%s' % (addr, port))
  4565. * except ZMQError:
  4566. */
  4567. __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__random); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
  4568. __Pyx_GOTREF(__pyx_t_2);
  4569. __pyx_t_8 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__randrange); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
  4570. __Pyx_GOTREF(__pyx_t_8);
  4571. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4572. __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
  4573. __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  4574. __Pyx_INCREF(__pyx_v_min_port);
  4575. PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_min_port);
  4576. __Pyx_GIVEREF(__pyx_v_min_port);
  4577. __Pyx_INCREF(__pyx_v_max_port);
  4578. PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_max_port);
  4579. __Pyx_GIVEREF(__pyx_v_max_port);
  4580. __pyx_t_9 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
  4581. __Pyx_GOTREF(__pyx_t_9);
  4582. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  4583. __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  4584. __Pyx_XDECREF(__pyx_v_port);
  4585. __pyx_v_port = __pyx_t_9;
  4586. __pyx_t_9 = 0;
  4587. /* "zmq/core/socket.pyx":520
  4588. * try:
  4589. * port = random.randrange(min_port, max_port)
  4590. * self.bind('%s:%s' % (addr, port)) # <<<<<<<<<<<<<<
  4591. * except ZMQError:
  4592. * pass
  4593. */
  4594. __pyx_t_9 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__bind); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
  4595. __Pyx_GOTREF(__pyx_t_9);
  4596. __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
  4597. __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  4598. __Pyx_INCREF(__pyx_v_addr);
  4599. PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_addr);
  4600. __Pyx_GIVEREF(__pyx_v_addr);
  4601. __Pyx_INCREF(__pyx_v_port);
  4602. PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_port);
  4603. __Pyx_GIVEREF(__pyx_v_port);
  4604. __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_14), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
  4605. __Pyx_GOTREF(((PyObject *)__pyx_t_8));
  4606. __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  4607. __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
  4608. __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  4609. PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_8));
  4610. __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
  4611. __pyx_t_8 = 0;
  4612. __pyx_t_8 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
  4613. __Pyx_GOTREF(__pyx_t_8);
  4614. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  4615. __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  4616. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  4617. }
  4618. /*else:*/ {
  4619. /* "zmq/core/socket.pyx":524
  4620. * pass
  4621. * else:
  4622. * return port # <<<<<<<<<<<<<<
  4623. * raise ZMQBindError("Could not bind socket to random port.")
  4624. *
  4625. */
  4626. __Pyx_XDECREF(__pyx_r);
  4627. __Pyx_INCREF(__pyx_v_port);
  4628. __pyx_r = __pyx_v_port;
  4629. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4630. goto __pyx_L11_except_return;
  4631. }
  4632. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  4633. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  4634. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  4635. goto __pyx_L15_try_end;
  4636. __pyx_L8_error:;
  4637. __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  4638. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  4639. __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  4640. /* "zmq/core/socket.pyx":521
  4641. * port = random.randrange(min_port, max_port)
  4642. * self.bind('%s:%s' % (addr, port))
  4643. * except ZMQError: # <<<<<<<<<<<<<<
  4644. * pass
  4645. * else:
  4646. */
  4647. __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
  4648. __Pyx_GOTREF(__pyx_t_8);
  4649. __pyx_t_10 = PyErr_ExceptionMatches(__pyx_t_8);
  4650. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  4651. if (__pyx_t_10) {
  4652. PyErr_Restore(0,0,0);
  4653. goto __pyx_L9_exception_handled;
  4654. }
  4655. __pyx_L10_except_error:;
  4656. __Pyx_XGIVEREF(__pyx_t_5);
  4657. __Pyx_XGIVEREF(__pyx_t_6);
  4658. __Pyx_XGIVEREF(__pyx_t_7);
  4659. __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
  4660. goto __pyx_L1_error;
  4661. __pyx_L11_except_return:;
  4662. __Pyx_XGIVEREF(__pyx_t_5);
  4663. __Pyx_XGIVEREF(__pyx_t_6);
  4664. __Pyx_XGIVEREF(__pyx_t_7);
  4665. __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
  4666. goto __pyx_L0;
  4667. __pyx_L9_exception_handled:;
  4668. __Pyx_XGIVEREF(__pyx_t_5);
  4669. __Pyx_XGIVEREF(__pyx_t_6);
  4670. __Pyx_XGIVEREF(__pyx_t_7);
  4671. __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
  4672. __pyx_L15_try_end:;
  4673. }
  4674. }
  4675. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4676. /* "zmq/core/socket.pyx":525
  4677. * else:
  4678. * return port
  4679. * raise ZMQBindError("Could not bind socket to random port.") # <<<<<<<<<<<<<<
  4680. *
  4681. * def connect(self, addr):
  4682. */
  4683. __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQBindError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4684. __Pyx_GOTREF(__pyx_t_1);
  4685. __pyx_t_8 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_16), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4686. __Pyx_GOTREF(__pyx_t_8);
  4687. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4688. __Pyx_Raise(__pyx_t_8, 0, 0, 0);
  4689. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  4690. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4691. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  4692. goto __pyx_L0;
  4693. __pyx_L1_error:;
  4694. __Pyx_XDECREF(__pyx_t_1);
  4695. __Pyx_XDECREF(__pyx_t_2);
  4696. __Pyx_XDECREF(__pyx_t_8);
  4697. __Pyx_XDECREF(__pyx_t_9);
  4698. __Pyx_AddTraceback("zmq.core.socket.Socket.bind_to_random_port", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4699. __pyx_r = NULL;
  4700. __pyx_L0:;
  4701. __Pyx_XDECREF(__pyx_v_i);
  4702. __Pyx_XDECREF(__pyx_v_port);
  4703. __Pyx_XGIVEREF(__pyx_r);
  4704. __Pyx_RefNannyFinishContext();
  4705. return __pyx_r;
  4706. }
  4707. /* "zmq/core/socket.pyx":527
  4708. * raise ZMQBindError("Could not bind socket to random port.")
  4709. *
  4710. * def connect(self, addr): # <<<<<<<<<<<<<<
  4711. * """s.connect(addr)
  4712. *
  4713. */
  4714. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_14connect(PyObject *__pyx_v_self, PyObject *__pyx_v_addr); /*proto*/
  4715. static char __pyx_doc_3zmq_4core_6socket_6Socket_14connect[] = "s.connect(addr)\n\n Connect to a remote 0MQ socket.\n\n Parameters\n ----------\n addr : str\n The address string. This has the form 'protocol://interface:port',\n for example 'tcp://127.0.0.1:5555'. Protocols supported are\n tcp, upd, pgm, inproc and ipc. If the address is unicode, it is\n encoded to utf-8 first.\n ";
  4716. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_14connect(PyObject *__pyx_v_self, PyObject *__pyx_v_addr) {
  4717. int __pyx_v_rc;
  4718. char *__pyx_v_c_addr;
  4719. PyObject *__pyx_r = NULL;
  4720. __Pyx_RefNannyDeclarations
  4721. PyObject *__pyx_t_1 = NULL;
  4722. int __pyx_t_2;
  4723. PyObject *__pyx_t_3 = NULL;
  4724. int __pyx_t_4;
  4725. char *__pyx_t_5;
  4726. int __pyx_lineno = 0;
  4727. const char *__pyx_filename = NULL;
  4728. int __pyx_clineno = 0;
  4729. __Pyx_RefNannySetupContext("connect");
  4730. __Pyx_INCREF(__pyx_v_addr);
  4731. /* "zmq/core/socket.pyx":543
  4732. * cdef char* c_addr
  4733. *
  4734. * _check_closed(self, True) # <<<<<<<<<<<<<<
  4735. * if isinstance(addr, unicode):
  4736. * addr = addr.encode('utf-8')
  4737. */
  4738. __pyx_t_1 = __pyx_f_3zmq_4core_6socket__check_closed(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4739. __Pyx_GOTREF(__pyx_t_1);
  4740. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4741. /* "zmq/core/socket.pyx":544
  4742. *
  4743. * _check_closed(self, True)
  4744. * if isinstance(addr, unicode): # <<<<<<<<<<<<<<
  4745. * addr = addr.encode('utf-8')
  4746. * if not isinstance(addr, bytes):
  4747. */
  4748. __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__unicode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4749. __Pyx_GOTREF(__pyx_t_1);
  4750. __pyx_t_2 = PyObject_IsInstance(__pyx_v_addr, __pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4751. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4752. if (__pyx_t_2) {
  4753. /* "zmq/core/socket.pyx":545
  4754. * _check_closed(self, True)
  4755. * if isinstance(addr, unicode):
  4756. * addr = addr.encode('utf-8') # <<<<<<<<<<<<<<
  4757. * if not isinstance(addr, bytes):
  4758. * raise TypeError('expected str, got: %r' % addr)
  4759. */
  4760. __pyx_t_1 = PyObject_GetAttr(__pyx_v_addr, __pyx_n_s__encode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4761. __Pyx_GOTREF(__pyx_t_1);
  4762. __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_17), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4763. __Pyx_GOTREF(__pyx_t_3);
  4764. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4765. __Pyx_DECREF(__pyx_v_addr);
  4766. __pyx_v_addr = __pyx_t_3;
  4767. __pyx_t_3 = 0;
  4768. goto __pyx_L5;
  4769. }
  4770. __pyx_L5:;
  4771. /* "zmq/core/socket.pyx":546
  4772. * if isinstance(addr, unicode):
  4773. * addr = addr.encode('utf-8')
  4774. * if not isinstance(addr, bytes): # <<<<<<<<<<<<<<
  4775. * raise TypeError('expected str, got: %r' % addr)
  4776. * c_addr = addr
  4777. */
  4778. __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__bytes); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4779. __Pyx_GOTREF(__pyx_t_3);
  4780. __pyx_t_2 = PyObject_IsInstance(__pyx_v_addr, __pyx_t_3); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4781. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4782. __pyx_t_4 = (!__pyx_t_2);
  4783. if (__pyx_t_4) {
  4784. /* "zmq/core/socket.pyx":547
  4785. * addr = addr.encode('utf-8')
  4786. * if not isinstance(addr, bytes):
  4787. * raise TypeError('expected str, got: %r' % addr) # <<<<<<<<<<<<<<
  4788. * c_addr = addr
  4789. *
  4790. */
  4791. __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_13), __pyx_v_addr); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4792. __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  4793. __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4794. __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  4795. PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_3));
  4796. __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
  4797. __pyx_t_3 = 0;
  4798. __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4799. __Pyx_GOTREF(__pyx_t_3);
  4800. __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  4801. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  4802. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4803. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4804. goto __pyx_L6;
  4805. }
  4806. __pyx_L6:;
  4807. /* "zmq/core/socket.pyx":548
  4808. * if not isinstance(addr, bytes):
  4809. * raise TypeError('expected str, got: %r' % addr)
  4810. * c_addr = addr # <<<<<<<<<<<<<<
  4811. *
  4812. * with nogil:
  4813. */
  4814. __pyx_t_5 = PyBytes_AsString(__pyx_v_addr); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4815. __pyx_v_c_addr = __pyx_t_5;
  4816. /* "zmq/core/socket.pyx":550
  4817. * c_addr = addr
  4818. *
  4819. * with nogil: # <<<<<<<<<<<<<<
  4820. * rc = zmq_connect(self.handle, c_addr)
  4821. * if rc != 0:
  4822. */
  4823. {
  4824. #ifdef WITH_THREAD
  4825. PyThreadState *_save = NULL;
  4826. #endif
  4827. Py_UNBLOCK_THREADS
  4828. /*try:*/ {
  4829. /* "zmq/core/socket.pyx":551
  4830. *
  4831. * with nogil:
  4832. * rc = zmq_connect(self.handle, c_addr) # <<<<<<<<<<<<<<
  4833. * if rc != 0:
  4834. * raise ZMQError()
  4835. */
  4836. __pyx_v_rc = zmq_connect(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->handle, __pyx_v_c_addr);
  4837. }
  4838. /* "zmq/core/socket.pyx":550
  4839. * c_addr = addr
  4840. *
  4841. * with nogil: # <<<<<<<<<<<<<<
  4842. * rc = zmq_connect(self.handle, c_addr)
  4843. * if rc != 0:
  4844. */
  4845. /*finally:*/ {
  4846. Py_BLOCK_THREADS
  4847. }
  4848. }
  4849. /* "zmq/core/socket.pyx":552
  4850. * with nogil:
  4851. * rc = zmq_connect(self.handle, c_addr)
  4852. * if rc != 0: # <<<<<<<<<<<<<<
  4853. * raise ZMQError()
  4854. *
  4855. */
  4856. __pyx_t_4 = (__pyx_v_rc != 0);
  4857. if (__pyx_t_4) {
  4858. /* "zmq/core/socket.pyx":553
  4859. * rc = zmq_connect(self.handle, c_addr)
  4860. * if rc != 0:
  4861. * raise ZMQError() # <<<<<<<<<<<<<<
  4862. *
  4863. * #-------------------------------------------------------------------------
  4864. */
  4865. __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4866. __Pyx_GOTREF(__pyx_t_3);
  4867. __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4868. __Pyx_GOTREF(__pyx_t_1);
  4869. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4870. __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  4871. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4872. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4873. goto __pyx_L10;
  4874. }
  4875. __pyx_L10:;
  4876. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  4877. goto __pyx_L0;
  4878. __pyx_L1_error:;
  4879. __Pyx_XDECREF(__pyx_t_1);
  4880. __Pyx_XDECREF(__pyx_t_3);
  4881. __Pyx_AddTraceback("zmq.core.socket.Socket.connect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4882. __pyx_r = NULL;
  4883. __pyx_L0:;
  4884. __Pyx_XDECREF(__pyx_v_addr);
  4885. __Pyx_XGIVEREF(__pyx_r);
  4886. __Pyx_RefNannyFinishContext();
  4887. return __pyx_r;
  4888. }
  4889. /* "zmq/core/socket.pyx":559
  4890. * #-------------------------------------------------------------------------
  4891. *
  4892. * cpdef object send(self, object data, int flags=0, copy=True, track=False): # <<<<<<<<<<<<<<
  4893. * """s.send(data, flags=0, copy=True, track=False)
  4894. *
  4895. */
  4896. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_15send(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  4897. static PyObject *__pyx_f_3zmq_4core_6socket_6Socket_send(struct __pyx_obj_3zmq_4core_6socket_Socket *__pyx_v_self, PyObject *__pyx_v_data, int __pyx_skip_dispatch, struct __pyx_opt_args_3zmq_4core_6socket_6Socket_send *__pyx_optional_args) {
  4898. int __pyx_v_flags = ((int)0);
  4899. PyObject *__pyx_v_copy = __pyx_k_18;
  4900. PyObject *__pyx_v_track = __pyx_k_19;
  4901. PyObject *__pyx_v_msg = NULL;
  4902. PyObject *__pyx_r = NULL;
  4903. __Pyx_RefNannyDeclarations
  4904. PyObject *__pyx_t_1 = NULL;
  4905. PyObject *__pyx_t_2 = NULL;
  4906. PyObject *__pyx_t_3 = NULL;
  4907. int __pyx_t_4;
  4908. struct __pyx_opt_args_3zmq_4core_6socket__send_copy __pyx_t_5;
  4909. int __pyx_t_6;
  4910. int __pyx_t_7;
  4911. struct __pyx_opt_args_3zmq_4core_6socket__send_message __pyx_t_8;
  4912. int __pyx_lineno = 0;
  4913. const char *__pyx_filename = NULL;
  4914. int __pyx_clineno = 0;
  4915. __Pyx_RefNannySetupContext("send");
  4916. if (__pyx_optional_args) {
  4917. if (__pyx_optional_args->__pyx_n > 0) {
  4918. __pyx_v_flags = __pyx_optional_args->flags;
  4919. if (__pyx_optional_args->__pyx_n > 1) {
  4920. __pyx_v_copy = __pyx_optional_args->copy;
  4921. if (__pyx_optional_args->__pyx_n > 2) {
  4922. __pyx_v_track = __pyx_optional_args->track;
  4923. }
  4924. }
  4925. }
  4926. }
  4927. __Pyx_INCREF(__pyx_v_data);
  4928. /* Check if called by wrapper */
  4929. if (unlikely(__pyx_skip_dispatch)) ;
  4930. /* Check if overriden in Python */
  4931. else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
  4932. __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__send); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4933. __Pyx_GOTREF(__pyx_t_1);
  4934. if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_3zmq_4core_6socket_6Socket_15send)) {
  4935. __Pyx_XDECREF(__pyx_r);
  4936. __pyx_t_2 = PyInt_FromLong(__pyx_v_flags); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4937. __Pyx_GOTREF(__pyx_t_2);
  4938. __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4939. __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  4940. __Pyx_INCREF(__pyx_v_data);
  4941. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_data);
  4942. __Pyx_GIVEREF(__pyx_v_data);
  4943. PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  4944. __Pyx_GIVEREF(__pyx_t_2);
  4945. __Pyx_INCREF(__pyx_v_copy);
  4946. PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_copy);
  4947. __Pyx_GIVEREF(__pyx_v_copy);
  4948. __Pyx_INCREF(__pyx_v_track);
  4949. PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_v_track);
  4950. __Pyx_GIVEREF(__pyx_v_track);
  4951. __pyx_t_2 = 0;
  4952. __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4953. __Pyx_GOTREF(__pyx_t_2);
  4954. __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  4955. __pyx_r = __pyx_t_2;
  4956. __pyx_t_2 = 0;
  4957. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4958. goto __pyx_L0;
  4959. }
  4960. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4961. }
  4962. /* "zmq/core/socket.pyx":596
  4963. *
  4964. * """
  4965. * _check_closed(self, True) # <<<<<<<<<<<<<<
  4966. *
  4967. * if isinstance(data, unicode):
  4968. */
  4969. __pyx_t_1 = __pyx_f_3zmq_4core_6socket__check_closed(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4970. __Pyx_GOTREF(__pyx_t_1);
  4971. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4972. /* "zmq/core/socket.pyx":598
  4973. * _check_closed(self, True)
  4974. *
  4975. * if isinstance(data, unicode): # <<<<<<<<<<<<<<
  4976. * raise TypeError("unicode not allowed, use send_unicode")
  4977. *
  4978. */
  4979. __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__unicode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4980. __Pyx_GOTREF(__pyx_t_1);
  4981. __pyx_t_4 = PyObject_IsInstance(__pyx_v_data, __pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4982. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4983. if (__pyx_t_4) {
  4984. /* "zmq/core/socket.pyx":599
  4985. *
  4986. * if isinstance(data, unicode):
  4987. * raise TypeError("unicode not allowed, use send_unicode") # <<<<<<<<<<<<<<
  4988. *
  4989. * if copy:
  4990. */
  4991. __pyx_t_1 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_21), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4992. __Pyx_GOTREF(__pyx_t_1);
  4993. __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  4994. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4995. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  4996. goto __pyx_L3;
  4997. }
  4998. __pyx_L3:;
  4999. /* "zmq/core/socket.pyx":601
  5000. * raise TypeError("unicode not allowed, use send_unicode")
  5001. *
  5002. * if copy: # <<<<<<<<<<<<<<
  5003. * # msg.bytes never returns the input data object
  5004. * # it is always a copy, but always the same copy
  5005. */
  5006. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_copy); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5007. if (__pyx_t_4) {
  5008. /* "zmq/core/socket.pyx":604
  5009. * # msg.bytes never returns the input data object
  5010. * # it is always a copy, but always the same copy
  5011. * if isinstance(data, Message): # <<<<<<<<<<<<<<
  5012. * data = data.buffer
  5013. * return _send_copy(self.handle, data, flags)
  5014. */
  5015. __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_3zmq_4core_7message_Message));
  5016. __Pyx_INCREF(__pyx_t_1);
  5017. __pyx_t_4 = __Pyx_TypeCheck(__pyx_v_data, __pyx_t_1);
  5018. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  5019. if (__pyx_t_4) {
  5020. /* "zmq/core/socket.pyx":605
  5021. * # it is always a copy, but always the same copy
  5022. * if isinstance(data, Message):
  5023. * data = data.buffer # <<<<<<<<<<<<<<
  5024. * return _send_copy(self.handle, data, flags)
  5025. * else:
  5026. */
  5027. __pyx_t_1 = PyObject_GetAttr(__pyx_v_data, __pyx_n_s__buffer); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5028. __Pyx_GOTREF(__pyx_t_1);
  5029. __Pyx_DECREF(__pyx_v_data);
  5030. __pyx_v_data = __pyx_t_1;
  5031. __pyx_t_1 = 0;
  5032. goto __pyx_L5;
  5033. }
  5034. __pyx_L5:;
  5035. /* "zmq/core/socket.pyx":606
  5036. * if isinstance(data, Message):
  5037. * data = data.buffer
  5038. * return _send_copy(self.handle, data, flags) # <<<<<<<<<<<<<<
  5039. * else:
  5040. * if isinstance(data, Message):
  5041. */
  5042. __Pyx_XDECREF(__pyx_r);
  5043. __pyx_t_5.__pyx_n = 1;
  5044. __pyx_t_5.flags = __pyx_v_flags;
  5045. __pyx_t_1 = __pyx_f_3zmq_4core_6socket__send_copy(__pyx_v_self->handle, __pyx_v_data, &__pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5046. __Pyx_GOTREF(__pyx_t_1);
  5047. __pyx_r = __pyx_t_1;
  5048. __pyx_t_1 = 0;
  5049. goto __pyx_L0;
  5050. goto __pyx_L4;
  5051. }
  5052. /*else*/ {
  5053. /* "zmq/core/socket.pyx":608
  5054. * return _send_copy(self.handle, data, flags)
  5055. * else:
  5056. * if isinstance(data, Message): # <<<<<<<<<<<<<<
  5057. * if track and not data.tracker:
  5058. * raise ValueError('Not a tracked message')
  5059. */
  5060. __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_3zmq_4core_7message_Message));
  5061. __Pyx_INCREF(__pyx_t_1);
  5062. __pyx_t_4 = __Pyx_TypeCheck(__pyx_v_data, __pyx_t_1);
  5063. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  5064. if (__pyx_t_4) {
  5065. /* "zmq/core/socket.pyx":609
  5066. * else:
  5067. * if isinstance(data, Message):
  5068. * if track and not data.tracker: # <<<<<<<<<<<<<<
  5069. * raise ValueError('Not a tracked message')
  5070. * msg = data
  5071. */
  5072. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_track); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5073. if (__pyx_t_4) {
  5074. __pyx_t_1 = PyObject_GetAttr(__pyx_v_data, __pyx_n_s__tracker); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5075. __Pyx_GOTREF(__pyx_t_1);
  5076. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5077. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  5078. __pyx_t_7 = (!__pyx_t_6);
  5079. __pyx_t_6 = __pyx_t_7;
  5080. } else {
  5081. __pyx_t_6 = __pyx_t_4;
  5082. }
  5083. if (__pyx_t_6) {
  5084. /* "zmq/core/socket.pyx":610
  5085. * if isinstance(data, Message):
  5086. * if track and not data.tracker:
  5087. * raise ValueError('Not a tracked message') # <<<<<<<<<<<<<<
  5088. * msg = data
  5089. * else:
  5090. */
  5091. __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_23), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5092. __Pyx_GOTREF(__pyx_t_1);
  5093. __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  5094. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  5095. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5096. goto __pyx_L7;
  5097. }
  5098. __pyx_L7:;
  5099. /* "zmq/core/socket.pyx":611
  5100. * if track and not data.tracker:
  5101. * raise ValueError('Not a tracked message')
  5102. * msg = data # <<<<<<<<<<<<<<
  5103. * else:
  5104. * msg = Message(data, track=track)
  5105. */
  5106. __Pyx_INCREF(__pyx_v_data);
  5107. __pyx_v_msg = __pyx_v_data;
  5108. goto __pyx_L6;
  5109. }
  5110. /*else*/ {
  5111. /* "zmq/core/socket.pyx":613
  5112. * msg = data
  5113. * else:
  5114. * msg = Message(data, track=track) # <<<<<<<<<<<<<<
  5115. * return _send_message(self.handle, msg, flags)
  5116. *
  5117. */
  5118. __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5119. __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  5120. __Pyx_INCREF(__pyx_v_data);
  5121. PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_data);
  5122. __Pyx_GIVEREF(__pyx_v_data);
  5123. __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5124. __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  5125. if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__track), __pyx_v_track) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5126. __pyx_t_3 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_3zmq_4core_7message_Message)), ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5127. __Pyx_GOTREF(__pyx_t_3);
  5128. __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  5129. __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  5130. __pyx_v_msg = __pyx_t_3;
  5131. __pyx_t_3 = 0;
  5132. }
  5133. __pyx_L6:;
  5134. /* "zmq/core/socket.pyx":614
  5135. * else:
  5136. * msg = Message(data, track=track)
  5137. * return _send_message(self.handle, msg, flags) # <<<<<<<<<<<<<<
  5138. *
  5139. * cpdef object recv(self, int flags=0, copy=True, track=False):
  5140. */
  5141. __Pyx_XDECREF(__pyx_r);
  5142. if (!(likely(((__pyx_v_msg) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_msg, __pyx_ptype_3zmq_4core_7message_Message))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5143. __pyx_t_3 = __pyx_v_msg;
  5144. __Pyx_INCREF(__pyx_t_3);
  5145. __pyx_t_8.__pyx_n = 1;
  5146. __pyx_t_8.flags = __pyx_v_flags;
  5147. __pyx_t_2 = __pyx_f_3zmq_4core_6socket__send_message(__pyx_v_self->handle, ((struct __pyx_obj_3zmq_4core_7message_Message *)__pyx_t_3), &__pyx_t_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5148. __Pyx_GOTREF(__pyx_t_2);
  5149. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  5150. __pyx_r = __pyx_t_2;
  5151. __pyx_t_2 = 0;
  5152. goto __pyx_L0;
  5153. }
  5154. __pyx_L4:;
  5155. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  5156. goto __pyx_L0;
  5157. __pyx_L1_error:;
  5158. __Pyx_XDECREF(__pyx_t_1);
  5159. __Pyx_XDECREF(__pyx_t_2);
  5160. __Pyx_XDECREF(__pyx_t_3);
  5161. __Pyx_AddTraceback("zmq.core.socket.Socket.send", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5162. __pyx_r = 0;
  5163. __pyx_L0:;
  5164. __Pyx_XDECREF(__pyx_v_msg);
  5165. __Pyx_XDECREF(__pyx_v_data);
  5166. __Pyx_XGIVEREF(__pyx_r);
  5167. __Pyx_RefNannyFinishContext();
  5168. return __pyx_r;
  5169. }
  5170. /* "zmq/core/socket.pyx":559
  5171. * #-------------------------------------------------------------------------
  5172. *
  5173. * cpdef object send(self, object data, int flags=0, copy=True, track=False): # <<<<<<<<<<<<<<
  5174. * """s.send(data, flags=0, copy=True, track=False)
  5175. *
  5176. */
  5177. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_15send(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  5178. static char __pyx_doc_3zmq_4core_6socket_6Socket_15send[] = "s.send(data, flags=0, copy=True, track=False)\n\n Send a message on this socket.\n\n This queues the message to be sent by the IO thread at a later time.\n\n Parameters\n ----------\n data : object, str, Message\n The content of the message.\n flags : int\n Any supported flag: NOBLOCK, SNDMORE.\n copy : bool\n Should the message be sent in a copying or non-copying manner.\n track : bool\n Should the message be tracked for notification that ZMQ has\n finished with it? (ignored if copy=True)\n\n Returns\n -------\n None : if `copy` or not track\n None if message was sent, raises an exception otherwise.\n MessageTracker : if track and not copy\n a MessageTracker object, whose `pending` property will\n be True until the send is completed.\n \n Raises\n ------\n TypeError\n If a unicode object is passed\n ValueError\n If `track=True`, but an untracked Message is passed.\n ZMQError\n If the send does not succeed for any reason.\n \n ";
  5179. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_15send(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  5180. PyObject *__pyx_v_data = 0;
  5181. int __pyx_v_flags;
  5182. PyObject *__pyx_v_copy = 0;
  5183. PyObject *__pyx_v_track = 0;
  5184. PyObject *__pyx_r = NULL;
  5185. __Pyx_RefNannyDeclarations
  5186. PyObject *__pyx_t_1 = NULL;
  5187. struct __pyx_opt_args_3zmq_4core_6socket_6Socket_send __pyx_t_2;
  5188. int __pyx_lineno = 0;
  5189. const char *__pyx_filename = NULL;
  5190. int __pyx_clineno = 0;
  5191. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__data,&__pyx_n_s__flags,&__pyx_n_s__copy,&__pyx_n_s__track,0};
  5192. __Pyx_RefNannySetupContext("send");
  5193. {
  5194. PyObject* values[4] = {0,0,0,0};
  5195. values[2] = __pyx_k_18;
  5196. values[3] = __pyx_k_19;
  5197. if (unlikely(__pyx_kwds)) {
  5198. Py_ssize_t kw_args;
  5199. switch (PyTuple_GET_SIZE(__pyx_args)) {
  5200. case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
  5201. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  5202. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  5203. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  5204. case 0: break;
  5205. default: goto __pyx_L5_argtuple_error;
  5206. }
  5207. kw_args = PyDict_Size(__pyx_kwds);
  5208. switch (PyTuple_GET_SIZE(__pyx_args)) {
  5209. case 0:
  5210. values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data);
  5211. if (likely(values[0])) kw_args--;
  5212. else goto __pyx_L5_argtuple_error;
  5213. case 1:
  5214. if (kw_args > 0) {
  5215. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags);
  5216. if (value) { values[1] = value; kw_args--; }
  5217. }
  5218. case 2:
  5219. if (kw_args > 0) {
  5220. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__copy);
  5221. if (value) { values[2] = value; kw_args--; }
  5222. }
  5223. case 3:
  5224. if (kw_args > 0) {
  5225. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__track);
  5226. if (value) { values[3] = value; kw_args--; }
  5227. }
  5228. }
  5229. if (unlikely(kw_args > 0)) {
  5230. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "send") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5231. }
  5232. } else {
  5233. switch (PyTuple_GET_SIZE(__pyx_args)) {
  5234. case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
  5235. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  5236. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  5237. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  5238. break;
  5239. default: goto __pyx_L5_argtuple_error;
  5240. }
  5241. }
  5242. __pyx_v_data = values[0];
  5243. if (values[1]) {
  5244. __pyx_v_flags = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5245. } else {
  5246. __pyx_v_flags = ((int)0);
  5247. }
  5248. __pyx_v_copy = values[2];
  5249. __pyx_v_track = values[3];
  5250. }
  5251. goto __pyx_L4_argument_unpacking_done;
  5252. __pyx_L5_argtuple_error:;
  5253. __Pyx_RaiseArgtupleInvalid("send", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5254. __pyx_L3_error:;
  5255. __Pyx_AddTraceback("zmq.core.socket.Socket.send", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5256. __Pyx_RefNannyFinishContext();
  5257. return NULL;
  5258. __pyx_L4_argument_unpacking_done:;
  5259. __Pyx_XDECREF(__pyx_r);
  5260. __pyx_t_2.__pyx_n = 3;
  5261. __pyx_t_2.flags = __pyx_v_flags;
  5262. __pyx_t_2.copy = __pyx_v_copy;
  5263. __pyx_t_2.track = __pyx_v_track;
  5264. __pyx_t_1 = ((struct __pyx_vtabstruct_3zmq_4core_6socket_Socket *)((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->__pyx_vtab)->send(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self), __pyx_v_data, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5265. __Pyx_GOTREF(__pyx_t_1);
  5266. __pyx_r = __pyx_t_1;
  5267. __pyx_t_1 = 0;
  5268. goto __pyx_L0;
  5269. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  5270. goto __pyx_L0;
  5271. __pyx_L1_error:;
  5272. __Pyx_XDECREF(__pyx_t_1);
  5273. __Pyx_AddTraceback("zmq.core.socket.Socket.send", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5274. __pyx_r = NULL;
  5275. __pyx_L0:;
  5276. __Pyx_XGIVEREF(__pyx_r);
  5277. __Pyx_RefNannyFinishContext();
  5278. return __pyx_r;
  5279. }
  5280. /* "zmq/core/socket.pyx":616
  5281. * return _send_message(self.handle, msg, flags)
  5282. *
  5283. * cpdef object recv(self, int flags=0, copy=True, track=False): # <<<<<<<<<<<<<<
  5284. * """s.recv(flags=0, copy=True, track=False)
  5285. *
  5286. */
  5287. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_16recv(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  5288. static PyObject *__pyx_f_3zmq_4core_6socket_6Socket_recv(struct __pyx_obj_3zmq_4core_6socket_Socket *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_3zmq_4core_6socket_6Socket_recv *__pyx_optional_args) {
  5289. int __pyx_v_flags = ((int)0);
  5290. PyObject *__pyx_v_copy = __pyx_k_24;
  5291. PyObject *__pyx_v_track = __pyx_k_25;
  5292. PyObject *__pyx_r = NULL;
  5293. __Pyx_RefNannyDeclarations
  5294. PyObject *__pyx_t_1 = NULL;
  5295. PyObject *__pyx_t_2 = NULL;
  5296. PyObject *__pyx_t_3 = NULL;
  5297. int __pyx_t_4;
  5298. struct __pyx_opt_args_3zmq_4core_6socket__recv_copy __pyx_t_5;
  5299. struct __pyx_opt_args_3zmq_4core_6socket__recv_message __pyx_t_6;
  5300. int __pyx_lineno = 0;
  5301. const char *__pyx_filename = NULL;
  5302. int __pyx_clineno = 0;
  5303. __Pyx_RefNannySetupContext("recv");
  5304. if (__pyx_optional_args) {
  5305. if (__pyx_optional_args->__pyx_n > 0) {
  5306. __pyx_v_flags = __pyx_optional_args->flags;
  5307. if (__pyx_optional_args->__pyx_n > 1) {
  5308. __pyx_v_copy = __pyx_optional_args->copy;
  5309. if (__pyx_optional_args->__pyx_n > 2) {
  5310. __pyx_v_track = __pyx_optional_args->track;
  5311. }
  5312. }
  5313. }
  5314. }
  5315. /* Check if called by wrapper */
  5316. if (unlikely(__pyx_skip_dispatch)) ;
  5317. /* Check if overriden in Python */
  5318. else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
  5319. __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__recv); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5320. __Pyx_GOTREF(__pyx_t_1);
  5321. if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_3zmq_4core_6socket_6Socket_16recv)) {
  5322. __Pyx_XDECREF(__pyx_r);
  5323. __pyx_t_2 = PyInt_FromLong(__pyx_v_flags); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5324. __Pyx_GOTREF(__pyx_t_2);
  5325. __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5326. __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  5327. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  5328. __Pyx_GIVEREF(__pyx_t_2);
  5329. __Pyx_INCREF(__pyx_v_copy);
  5330. PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_copy);
  5331. __Pyx_GIVEREF(__pyx_v_copy);
  5332. __Pyx_INCREF(__pyx_v_track);
  5333. PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_track);
  5334. __Pyx_GIVEREF(__pyx_v_track);
  5335. __pyx_t_2 = 0;
  5336. __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5337. __Pyx_GOTREF(__pyx_t_2);
  5338. __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  5339. __pyx_r = __pyx_t_2;
  5340. __pyx_t_2 = 0;
  5341. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  5342. goto __pyx_L0;
  5343. }
  5344. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  5345. }
  5346. /* "zmq/core/socket.pyx":647
  5347. * for any of the reasons zmq_recvmsg might fail.
  5348. * """
  5349. * _check_closed(self, True) # <<<<<<<<<<<<<<
  5350. *
  5351. * if copy:
  5352. */
  5353. __pyx_t_1 = __pyx_f_3zmq_4core_6socket__check_closed(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5354. __Pyx_GOTREF(__pyx_t_1);
  5355. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  5356. /* "zmq/core/socket.pyx":649
  5357. * _check_closed(self, True)
  5358. *
  5359. * if copy: # <<<<<<<<<<<<<<
  5360. * return _recv_copy(self.handle, flags)
  5361. * else:
  5362. */
  5363. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_copy); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5364. if (__pyx_t_4) {
  5365. /* "zmq/core/socket.pyx":650
  5366. *
  5367. * if copy:
  5368. * return _recv_copy(self.handle, flags) # <<<<<<<<<<<<<<
  5369. * else:
  5370. * return _recv_message(self.handle, flags, track)
  5371. */
  5372. __Pyx_XDECREF(__pyx_r);
  5373. __pyx_t_5.__pyx_n = 1;
  5374. __pyx_t_5.flags = __pyx_v_flags;
  5375. __pyx_t_1 = __pyx_f_3zmq_4core_6socket__recv_copy(__pyx_v_self->handle, &__pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5376. __Pyx_GOTREF(__pyx_t_1);
  5377. __pyx_r = __pyx_t_1;
  5378. __pyx_t_1 = 0;
  5379. goto __pyx_L0;
  5380. goto __pyx_L3;
  5381. }
  5382. /*else*/ {
  5383. /* "zmq/core/socket.pyx":652
  5384. * return _recv_copy(self.handle, flags)
  5385. * else:
  5386. * return _recv_message(self.handle, flags, track) # <<<<<<<<<<<<<<
  5387. *
  5388. * def send_multipart(self, msg_parts, int flags=0, copy=True, track=False, prefix=None):
  5389. */
  5390. __Pyx_XDECREF(__pyx_r);
  5391. __pyx_t_6.__pyx_n = 2;
  5392. __pyx_t_6.flags = __pyx_v_flags;
  5393. __pyx_t_6.track = __pyx_v_track;
  5394. __pyx_t_1 = ((PyObject *)__pyx_f_3zmq_4core_6socket__recv_message(__pyx_v_self->handle, &__pyx_t_6)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5395. __Pyx_GOTREF(__pyx_t_1);
  5396. __pyx_r = __pyx_t_1;
  5397. __pyx_t_1 = 0;
  5398. goto __pyx_L0;
  5399. }
  5400. __pyx_L3:;
  5401. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  5402. goto __pyx_L0;
  5403. __pyx_L1_error:;
  5404. __Pyx_XDECREF(__pyx_t_1);
  5405. __Pyx_XDECREF(__pyx_t_2);
  5406. __Pyx_XDECREF(__pyx_t_3);
  5407. __Pyx_AddTraceback("zmq.core.socket.Socket.recv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5408. __pyx_r = 0;
  5409. __pyx_L0:;
  5410. __Pyx_XGIVEREF(__pyx_r);
  5411. __Pyx_RefNannyFinishContext();
  5412. return __pyx_r;
  5413. }
  5414. /* "zmq/core/socket.pyx":616
  5415. * return _send_message(self.handle, msg, flags)
  5416. *
  5417. * cpdef object recv(self, int flags=0, copy=True, track=False): # <<<<<<<<<<<<<<
  5418. * """s.recv(flags=0, copy=True, track=False)
  5419. *
  5420. */
  5421. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_16recv(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  5422. static char __pyx_doc_3zmq_4core_6socket_6Socket_16recv[] = "s.recv(flags=0, copy=True, track=False)\n\n Receive a message.\n\n Parameters\n ----------\n flags : int\n Any supported flag: NOBLOCK. If NOBLOCK is set, this method\n will raise a ZMQError with EAGAIN if a message is not ready.\n If NOBLOCK is not set, then this method will block until a\n message arrives.\n copy : bool\n Should the message be received in a copying or non-copying manner?\n If False a Message object is returned, if True a string copy of\n message is returned.\n track : bool\n Should the message be tracked for notification that ZMQ has\n finished with it? (ignored if copy=True)\n\n Returns\n -------\n msg : str, Message\n The returned message. If `copy` is False, then it will be a Message,\n otherwise a str.\n \n Raises\n ------\n ZMQError\n for any of the reasons zmq_recvmsg might fail.\n ";
  5423. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_16recv(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  5424. int __pyx_v_flags;
  5425. PyObject *__pyx_v_copy = 0;
  5426. PyObject *__pyx_v_track = 0;
  5427. PyObject *__pyx_r = NULL;
  5428. __Pyx_RefNannyDeclarations
  5429. PyObject *__pyx_t_1 = NULL;
  5430. struct __pyx_opt_args_3zmq_4core_6socket_6Socket_recv __pyx_t_2;
  5431. int __pyx_lineno = 0;
  5432. const char *__pyx_filename = NULL;
  5433. int __pyx_clineno = 0;
  5434. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__flags,&__pyx_n_s__copy,&__pyx_n_s__track,0};
  5435. __Pyx_RefNannySetupContext("recv");
  5436. {
  5437. PyObject* values[3] = {0,0,0};
  5438. values[1] = __pyx_k_24;
  5439. values[2] = __pyx_k_25;
  5440. if (unlikely(__pyx_kwds)) {
  5441. Py_ssize_t kw_args;
  5442. switch (PyTuple_GET_SIZE(__pyx_args)) {
  5443. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  5444. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  5445. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  5446. case 0: break;
  5447. default: goto __pyx_L5_argtuple_error;
  5448. }
  5449. kw_args = PyDict_Size(__pyx_kwds);
  5450. switch (PyTuple_GET_SIZE(__pyx_args)) {
  5451. case 0:
  5452. if (kw_args > 0) {
  5453. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags);
  5454. if (value) { values[0] = value; kw_args--; }
  5455. }
  5456. case 1:
  5457. if (kw_args > 0) {
  5458. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__copy);
  5459. if (value) { values[1] = value; kw_args--; }
  5460. }
  5461. case 2:
  5462. if (kw_args > 0) {
  5463. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__track);
  5464. if (value) { values[2] = value; kw_args--; }
  5465. }
  5466. }
  5467. if (unlikely(kw_args > 0)) {
  5468. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "recv") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5469. }
  5470. } else {
  5471. switch (PyTuple_GET_SIZE(__pyx_args)) {
  5472. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  5473. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  5474. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  5475. case 0: break;
  5476. default: goto __pyx_L5_argtuple_error;
  5477. }
  5478. }
  5479. if (values[0]) {
  5480. __pyx_v_flags = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5481. } else {
  5482. __pyx_v_flags = ((int)0);
  5483. }
  5484. __pyx_v_copy = values[1];
  5485. __pyx_v_track = values[2];
  5486. }
  5487. goto __pyx_L4_argument_unpacking_done;
  5488. __pyx_L5_argtuple_error:;
  5489. __Pyx_RaiseArgtupleInvalid("recv", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5490. __pyx_L3_error:;
  5491. __Pyx_AddTraceback("zmq.core.socket.Socket.recv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5492. __Pyx_RefNannyFinishContext();
  5493. return NULL;
  5494. __pyx_L4_argument_unpacking_done:;
  5495. __Pyx_XDECREF(__pyx_r);
  5496. __pyx_t_2.__pyx_n = 3;
  5497. __pyx_t_2.flags = __pyx_v_flags;
  5498. __pyx_t_2.copy = __pyx_v_copy;
  5499. __pyx_t_2.track = __pyx_v_track;
  5500. __pyx_t_1 = ((struct __pyx_vtabstruct_3zmq_4core_6socket_Socket *)((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->__pyx_vtab)->recv(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self), 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5501. __Pyx_GOTREF(__pyx_t_1);
  5502. __pyx_r = __pyx_t_1;
  5503. __pyx_t_1 = 0;
  5504. goto __pyx_L0;
  5505. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  5506. goto __pyx_L0;
  5507. __pyx_L1_error:;
  5508. __Pyx_XDECREF(__pyx_t_1);
  5509. __Pyx_AddTraceback("zmq.core.socket.Socket.recv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5510. __pyx_r = NULL;
  5511. __pyx_L0:;
  5512. __Pyx_XGIVEREF(__pyx_r);
  5513. __Pyx_RefNannyFinishContext();
  5514. return __pyx_r;
  5515. }
  5516. /* "zmq/core/socket.pyx":654
  5517. * return _recv_message(self.handle, flags, track)
  5518. *
  5519. * def send_multipart(self, msg_parts, int flags=0, copy=True, track=False, prefix=None): # <<<<<<<<<<<<<<
  5520. * """s.send_multipart(msg_parts, flags=0, copy=True, track=False, prefix=None)
  5521. *
  5522. */
  5523. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_17send_multipart(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  5524. static char __pyx_doc_3zmq_4core_6socket_6Socket_17send_multipart[] = "s.send_multipart(msg_parts, flags=0, copy=True, track=False, prefix=None)\n\n Send a sequence of messages as a multipart message.\n\n Parameters\n ----------\n msg_parts : iterable\n A sequence of messages to send as a multipart message. Each element\n can be any sendable object (Message, bytes, buffer-providers)\n flags : int, optional\n Only the NOBLOCK flagis supported, SNDMORE is handled\n automatically.\n copy : bool, optional\n Should the message(s) be sent in a copying or non-copying manner.\n track : bool, optional\n Should the message(s) be tracked for notification that ZMQ has\n finished with it (ignored if copy=True).\n prefix : iterable\n A sequence of messages to send as a 0MQ routing prefix. With the removal\n of LABELs from libzmq3, `prefix` has no effect beyond being prepended\n to msg_parts.\n \n Returns\n -------\n None : if copy or not track\n MessageTracker : if track and not copy\n a MessageTracker object, whose `pending` property will\n be True until the last send is completed.\n ";
  5525. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_17send_multipart(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  5526. PyObject *__pyx_v_msg_parts = 0;
  5527. int __pyx_v_flags;
  5528. PyObject *__pyx_v_copy = 0;
  5529. PyObject *__pyx_v_track = 0;
  5530. PyObject *__pyx_v_prefix = 0;
  5531. PyObject *__pyx_v_msg = NULL;
  5532. PyObject *__pyx_r = NULL;
  5533. __Pyx_RefNannyDeclarations
  5534. int __pyx_t_1;
  5535. PyObject *__pyx_t_2 = NULL;
  5536. Py_ssize_t __pyx_t_3;
  5537. PyObject *(*__pyx_t_4)(PyObject *);
  5538. PyObject *__pyx_t_5 = NULL;
  5539. PyObject *__pyx_t_6 = NULL;
  5540. PyObject *__pyx_t_7 = NULL;
  5541. int __pyx_t_8;
  5542. struct __pyx_opt_args_3zmq_4core_6socket_6Socket_send __pyx_t_9;
  5543. PyObject *__pyx_t_10 = NULL;
  5544. int __pyx_lineno = 0;
  5545. const char *__pyx_filename = NULL;
  5546. int __pyx_clineno = 0;
  5547. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__msg_parts,&__pyx_n_s__flags,&__pyx_n_s__copy,&__pyx_n_s__track,&__pyx_n_s__prefix,0};
  5548. __Pyx_RefNannySetupContext("send_multipart");
  5549. {
  5550. PyObject* values[5] = {0,0,0,0,0};
  5551. values[2] = __pyx_k_26;
  5552. values[3] = __pyx_k_27;
  5553. values[4] = ((PyObject *)Py_None);
  5554. if (unlikely(__pyx_kwds)) {
  5555. Py_ssize_t kw_args;
  5556. switch (PyTuple_GET_SIZE(__pyx_args)) {
  5557. case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
  5558. case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
  5559. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  5560. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  5561. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  5562. case 0: break;
  5563. default: goto __pyx_L5_argtuple_error;
  5564. }
  5565. kw_args = PyDict_Size(__pyx_kwds);
  5566. switch (PyTuple_GET_SIZE(__pyx_args)) {
  5567. case 0:
  5568. values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__msg_parts);
  5569. if (likely(values[0])) kw_args--;
  5570. else goto __pyx_L5_argtuple_error;
  5571. case 1:
  5572. if (kw_args > 0) {
  5573. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags);
  5574. if (value) { values[1] = value; kw_args--; }
  5575. }
  5576. case 2:
  5577. if (kw_args > 0) {
  5578. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__copy);
  5579. if (value) { values[2] = value; kw_args--; }
  5580. }
  5581. case 3:
  5582. if (kw_args > 0) {
  5583. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__track);
  5584. if (value) { values[3] = value; kw_args--; }
  5585. }
  5586. case 4:
  5587. if (kw_args > 0) {
  5588. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__prefix);
  5589. if (value) { values[4] = value; kw_args--; }
  5590. }
  5591. }
  5592. if (unlikely(kw_args > 0)) {
  5593. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "send_multipart") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5594. }
  5595. } else {
  5596. switch (PyTuple_GET_SIZE(__pyx_args)) {
  5597. case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
  5598. case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
  5599. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  5600. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  5601. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  5602. break;
  5603. default: goto __pyx_L5_argtuple_error;
  5604. }
  5605. }
  5606. __pyx_v_msg_parts = values[0];
  5607. if (values[1]) {
  5608. __pyx_v_flags = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5609. } else {
  5610. __pyx_v_flags = ((int)0);
  5611. }
  5612. __pyx_v_copy = values[2];
  5613. __pyx_v_track = values[3];
  5614. __pyx_v_prefix = values[4];
  5615. }
  5616. goto __pyx_L4_argument_unpacking_done;
  5617. __pyx_L5_argtuple_error:;
  5618. __Pyx_RaiseArgtupleInvalid("send_multipart", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5619. __pyx_L3_error:;
  5620. __Pyx_AddTraceback("zmq.core.socket.Socket.send_multipart", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5621. __Pyx_RefNannyFinishContext();
  5622. return NULL;
  5623. __pyx_L4_argument_unpacking_done:;
  5624. __Pyx_INCREF(__pyx_v_prefix);
  5625. /* "zmq/core/socket.pyx":684
  5626. * be True until the last send is completed.
  5627. * """
  5628. * if prefix: # <<<<<<<<<<<<<<
  5629. * if isinstance(prefix, bytes):
  5630. * prefix = [prefix]
  5631. */
  5632. __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_prefix); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5633. if (__pyx_t_1) {
  5634. /* "zmq/core/socket.pyx":685
  5635. * """
  5636. * if prefix:
  5637. * if isinstance(prefix, bytes): # <<<<<<<<<<<<<<
  5638. * prefix = [prefix]
  5639. * for msg in prefix:
  5640. */
  5641. __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__bytes); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5642. __Pyx_GOTREF(__pyx_t_2);
  5643. __pyx_t_1 = PyObject_IsInstance(__pyx_v_prefix, __pyx_t_2); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5644. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  5645. if (__pyx_t_1) {
  5646. /* "zmq/core/socket.pyx":686
  5647. * if prefix:
  5648. * if isinstance(prefix, bytes):
  5649. * prefix = [prefix] # <<<<<<<<<<<<<<
  5650. * for msg in prefix:
  5651. * self.send(msg, SNDMORE|flags)
  5652. */
  5653. __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5654. __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  5655. __Pyx_INCREF(__pyx_v_prefix);
  5656. PyList_SET_ITEM(__pyx_t_2, 0, __pyx_v_prefix);
  5657. __Pyx_GIVEREF(__pyx_v_prefix);
  5658. __Pyx_DECREF(__pyx_v_prefix);
  5659. __pyx_v_prefix = ((PyObject *)__pyx_t_2);
  5660. __pyx_t_2 = 0;
  5661. goto __pyx_L7;
  5662. }
  5663. __pyx_L7:;
  5664. /* "zmq/core/socket.pyx":687
  5665. * if isinstance(prefix, bytes):
  5666. * prefix = [prefix]
  5667. * for msg in prefix: # <<<<<<<<<<<<<<
  5668. * self.send(msg, SNDMORE|flags)
  5669. * for msg in msg_parts[:-1]:
  5670. */
  5671. if (PyList_CheckExact(__pyx_v_prefix) || PyTuple_CheckExact(__pyx_v_prefix)) {
  5672. __pyx_t_2 = __pyx_v_prefix; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
  5673. __pyx_t_4 = NULL;
  5674. } else {
  5675. __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_prefix); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5676. __Pyx_GOTREF(__pyx_t_2);
  5677. __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext;
  5678. }
  5679. for (;;) {
  5680. if (PyList_CheckExact(__pyx_t_2)) {
  5681. if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
  5682. __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++;
  5683. } else if (PyTuple_CheckExact(__pyx_t_2)) {
  5684. if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
  5685. __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++;
  5686. } else {
  5687. __pyx_t_5 = __pyx_t_4(__pyx_t_2);
  5688. if (unlikely(!__pyx_t_5)) {
  5689. if (PyErr_Occurred()) {
  5690. if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
  5691. else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5692. }
  5693. break;
  5694. }
  5695. __Pyx_GOTREF(__pyx_t_5);
  5696. }
  5697. __Pyx_XDECREF(__pyx_v_msg);
  5698. __pyx_v_msg = __pyx_t_5;
  5699. __pyx_t_5 = 0;
  5700. /* "zmq/core/socket.pyx":688
  5701. * prefix = [prefix]
  5702. * for msg in prefix:
  5703. * self.send(msg, SNDMORE|flags) # <<<<<<<<<<<<<<
  5704. * for msg in msg_parts[:-1]:
  5705. * self.send(msg, SNDMORE|flags, copy=copy, track=track)
  5706. */
  5707. __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__SNDMORE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5708. __Pyx_GOTREF(__pyx_t_5);
  5709. __pyx_t_6 = PyInt_FromLong(__pyx_v_flags); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5710. __Pyx_GOTREF(__pyx_t_6);
  5711. __pyx_t_7 = PyNumber_Or(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5712. __Pyx_GOTREF(__pyx_t_7);
  5713. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5714. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  5715. __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_7); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5716. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  5717. __pyx_t_9.__pyx_n = 1;
  5718. __pyx_t_9.flags = __pyx_t_8;
  5719. __pyx_t_7 = ((struct __pyx_vtabstruct_3zmq_4core_6socket_Socket *)((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->__pyx_vtab)->send(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self), __pyx_v_msg, 0, &__pyx_t_9); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5720. __Pyx_GOTREF(__pyx_t_7);
  5721. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  5722. }
  5723. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  5724. goto __pyx_L6;
  5725. }
  5726. __pyx_L6:;
  5727. /* "zmq/core/socket.pyx":689
  5728. * for msg in prefix:
  5729. * self.send(msg, SNDMORE|flags)
  5730. * for msg in msg_parts[:-1]: # <<<<<<<<<<<<<<
  5731. * self.send(msg, SNDMORE|flags, copy=copy, track=track)
  5732. * # Send the last part without the extra SNDMORE flag.
  5733. */
  5734. __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_v_msg_parts, 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5735. __Pyx_GOTREF(__pyx_t_2);
  5736. if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
  5737. __pyx_t_7 = __pyx_t_2; __Pyx_INCREF(__pyx_t_7); __pyx_t_3 = 0;
  5738. __pyx_t_4 = NULL;
  5739. } else {
  5740. __pyx_t_3 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5741. __Pyx_GOTREF(__pyx_t_7);
  5742. __pyx_t_4 = Py_TYPE(__pyx_t_7)->tp_iternext;
  5743. }
  5744. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  5745. for (;;) {
  5746. if (PyList_CheckExact(__pyx_t_7)) {
  5747. if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_7)) break;
  5748. __pyx_t_2 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++;
  5749. } else if (PyTuple_CheckExact(__pyx_t_7)) {
  5750. if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_7)) break;
  5751. __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++;
  5752. } else {
  5753. __pyx_t_2 = __pyx_t_4(__pyx_t_7);
  5754. if (unlikely(!__pyx_t_2)) {
  5755. if (PyErr_Occurred()) {
  5756. if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
  5757. else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5758. }
  5759. break;
  5760. }
  5761. __Pyx_GOTREF(__pyx_t_2);
  5762. }
  5763. __Pyx_XDECREF(__pyx_v_msg);
  5764. __pyx_v_msg = __pyx_t_2;
  5765. __pyx_t_2 = 0;
  5766. /* "zmq/core/socket.pyx":690
  5767. * self.send(msg, SNDMORE|flags)
  5768. * for msg in msg_parts[:-1]:
  5769. * self.send(msg, SNDMORE|flags, copy=copy, track=track) # <<<<<<<<<<<<<<
  5770. * # Send the last part without the extra SNDMORE flag.
  5771. * return self.send(msg_parts[-1], flags, copy=copy, track=track)
  5772. */
  5773. __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__send); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5774. __Pyx_GOTREF(__pyx_t_2);
  5775. __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__SNDMORE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5776. __Pyx_GOTREF(__pyx_t_6);
  5777. __pyx_t_5 = PyInt_FromLong(__pyx_v_flags); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5778. __Pyx_GOTREF(__pyx_t_5);
  5779. __pyx_t_10 = PyNumber_Or(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5780. __Pyx_GOTREF(__pyx_t_10);
  5781. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  5782. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5783. __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5784. __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  5785. __Pyx_INCREF(__pyx_v_msg);
  5786. PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_msg);
  5787. __Pyx_GIVEREF(__pyx_v_msg);
  5788. PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_10);
  5789. __Pyx_GIVEREF(__pyx_t_10);
  5790. __pyx_t_10 = 0;
  5791. __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5792. __Pyx_GOTREF(((PyObject *)__pyx_t_10));
  5793. if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__copy), __pyx_v_copy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5794. if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__track), __pyx_v_track) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5795. __pyx_t_6 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5796. __Pyx_GOTREF(__pyx_t_6);
  5797. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  5798. __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  5799. __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
  5800. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  5801. }
  5802. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  5803. /* "zmq/core/socket.pyx":692
  5804. * self.send(msg, SNDMORE|flags, copy=copy, track=track)
  5805. * # Send the last part without the extra SNDMORE flag.
  5806. * return self.send(msg_parts[-1], flags, copy=copy, track=track) # <<<<<<<<<<<<<<
  5807. *
  5808. * def recv_multipart(self, int flags=0, copy=True, track=False):
  5809. */
  5810. __Pyx_XDECREF(__pyx_r);
  5811. __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__send); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5812. __Pyx_GOTREF(__pyx_t_7);
  5813. __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_msg_parts, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5814. __Pyx_GOTREF(__pyx_t_6);
  5815. __pyx_t_10 = PyInt_FromLong(__pyx_v_flags); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5816. __Pyx_GOTREF(__pyx_t_10);
  5817. __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5818. __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  5819. PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6);
  5820. __Pyx_GIVEREF(__pyx_t_6);
  5821. PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_10);
  5822. __Pyx_GIVEREF(__pyx_t_10);
  5823. __pyx_t_6 = 0;
  5824. __pyx_t_10 = 0;
  5825. __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5826. __Pyx_GOTREF(((PyObject *)__pyx_t_10));
  5827. if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__copy), __pyx_v_copy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5828. if (PyDict_SetItem(__pyx_t_10, ((PyObject *)__pyx_n_s__track), __pyx_v_track) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5829. __pyx_t_6 = PyEval_CallObjectWithKeywords(__pyx_t_7, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_10)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5830. __Pyx_GOTREF(__pyx_t_6);
  5831. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  5832. __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  5833. __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0;
  5834. __pyx_r = __pyx_t_6;
  5835. __pyx_t_6 = 0;
  5836. goto __pyx_L0;
  5837. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  5838. goto __pyx_L0;
  5839. __pyx_L1_error:;
  5840. __Pyx_XDECREF(__pyx_t_2);
  5841. __Pyx_XDECREF(__pyx_t_5);
  5842. __Pyx_XDECREF(__pyx_t_6);
  5843. __Pyx_XDECREF(__pyx_t_7);
  5844. __Pyx_XDECREF(__pyx_t_10);
  5845. __Pyx_AddTraceback("zmq.core.socket.Socket.send_multipart", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5846. __pyx_r = NULL;
  5847. __pyx_L0:;
  5848. __Pyx_XDECREF(__pyx_v_msg);
  5849. __Pyx_XDECREF(__pyx_v_prefix);
  5850. __Pyx_XGIVEREF(__pyx_r);
  5851. __Pyx_RefNannyFinishContext();
  5852. return __pyx_r;
  5853. }
  5854. /* "zmq/core/socket.pyx":694
  5855. * return self.send(msg_parts[-1], flags, copy=copy, track=track)
  5856. *
  5857. * def recv_multipart(self, int flags=0, copy=True, track=False): # <<<<<<<<<<<<<<
  5858. * """s.recv_multipart(flags=0, copy=True, track=False)
  5859. *
  5860. */
  5861. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_18recv_multipart(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  5862. static char __pyx_doc_3zmq_4core_6socket_6Socket_18recv_multipart[] = "s.recv_multipart(flags=0, copy=True, track=False)\n\n Receive a multipart message as a list of messages.\n\n Parameters\n ----------\n flags : int, optional\n Any supported flag: NOBLOCK. If NOBLOCK is set, this method\n will raise a ZMQError with EAGAIN if a message is not ready.\n If NOBLOCK is not set, then this method will block until a\n message arrives.\n copy : bool, optional\n Should the message(s) be received in a copying or non-copying manner?\n If False a Message object is returned for part, if True a string copy of\n message is returned for each message part.\n track : bool, optional\n Should the message(s) be tracked for notification that ZMQ has\n finished with it? (ignored if copy=True)\n Returns\n -------\n msg_parts : list\n A list of messages in the multipart message; either Messages or bytes,\n depending on `copy`.\n \n ";
  5863. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_18recv_multipart(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  5864. int __pyx_v_flags;
  5865. PyObject *__pyx_v_copy = 0;
  5866. PyObject *__pyx_v_track = 0;
  5867. PyObject *__pyx_v_parts = NULL;
  5868. PyObject *__pyx_v_part = NULL;
  5869. PyObject *__pyx_r = NULL;
  5870. __Pyx_RefNannyDeclarations
  5871. PyObject *__pyx_t_1 = NULL;
  5872. PyObject *__pyx_t_2 = NULL;
  5873. PyObject *__pyx_t_3 = NULL;
  5874. PyObject *__pyx_t_4 = NULL;
  5875. int __pyx_t_5;
  5876. int __pyx_t_6;
  5877. int __pyx_lineno = 0;
  5878. const char *__pyx_filename = NULL;
  5879. int __pyx_clineno = 0;
  5880. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__flags,&__pyx_n_s__copy,&__pyx_n_s__track,0};
  5881. __Pyx_RefNannySetupContext("recv_multipart");
  5882. {
  5883. PyObject* values[3] = {0,0,0};
  5884. values[1] = __pyx_k_28;
  5885. values[2] = __pyx_k_29;
  5886. if (unlikely(__pyx_kwds)) {
  5887. Py_ssize_t kw_args;
  5888. switch (PyTuple_GET_SIZE(__pyx_args)) {
  5889. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  5890. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  5891. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  5892. case 0: break;
  5893. default: goto __pyx_L5_argtuple_error;
  5894. }
  5895. kw_args = PyDict_Size(__pyx_kwds);
  5896. switch (PyTuple_GET_SIZE(__pyx_args)) {
  5897. case 0:
  5898. if (kw_args > 0) {
  5899. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags);
  5900. if (value) { values[0] = value; kw_args--; }
  5901. }
  5902. case 1:
  5903. if (kw_args > 0) {
  5904. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__copy);
  5905. if (value) { values[1] = value; kw_args--; }
  5906. }
  5907. case 2:
  5908. if (kw_args > 0) {
  5909. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__track);
  5910. if (value) { values[2] = value; kw_args--; }
  5911. }
  5912. }
  5913. if (unlikely(kw_args > 0)) {
  5914. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "recv_multipart") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5915. }
  5916. } else {
  5917. switch (PyTuple_GET_SIZE(__pyx_args)) {
  5918. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  5919. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  5920. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  5921. case 0: break;
  5922. default: goto __pyx_L5_argtuple_error;
  5923. }
  5924. }
  5925. if (values[0]) {
  5926. __pyx_v_flags = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5927. } else {
  5928. __pyx_v_flags = ((int)0);
  5929. }
  5930. __pyx_v_copy = values[1];
  5931. __pyx_v_track = values[2];
  5932. }
  5933. goto __pyx_L4_argument_unpacking_done;
  5934. __pyx_L5_argtuple_error:;
  5935. __Pyx_RaiseArgtupleInvalid("recv_multipart", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  5936. __pyx_L3_error:;
  5937. __Pyx_AddTraceback("zmq.core.socket.Socket.recv_multipart", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5938. __Pyx_RefNannyFinishContext();
  5939. return NULL;
  5940. __pyx_L4_argument_unpacking_done:;
  5941. /* "zmq/core/socket.pyx":720
  5942. *
  5943. * """
  5944. * parts = [self.recv(flags, copy=copy, track=track)] # <<<<<<<<<<<<<<
  5945. * # have first part already, only loop while more to receive
  5946. * while self.getsockopt(ZMQ_RCVMORE):
  5947. */
  5948. __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__recv); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5949. __Pyx_GOTREF(__pyx_t_1);
  5950. __pyx_t_2 = PyInt_FromLong(__pyx_v_flags); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5951. __Pyx_GOTREF(__pyx_t_2);
  5952. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5953. __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  5954. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  5955. __Pyx_GIVEREF(__pyx_t_2);
  5956. __pyx_t_2 = 0;
  5957. __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5958. __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  5959. if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__copy), __pyx_v_copy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5960. if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__track), __pyx_v_track) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5961. __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5962. __Pyx_GOTREF(__pyx_t_4);
  5963. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  5964. __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  5965. __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  5966. __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5967. __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  5968. PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
  5969. __Pyx_GIVEREF(__pyx_t_4);
  5970. __pyx_t_4 = 0;
  5971. __pyx_v_parts = __pyx_t_2;
  5972. __pyx_t_2 = 0;
  5973. /* "zmq/core/socket.pyx":722
  5974. * parts = [self.recv(flags, copy=copy, track=track)]
  5975. * # have first part already, only loop while more to receive
  5976. * while self.getsockopt(ZMQ_RCVMORE): # <<<<<<<<<<<<<<
  5977. * part = self.recv(flags, copy=copy, track=track)
  5978. * parts.append(part)
  5979. */
  5980. while (1) {
  5981. __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__getsockopt); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5982. __Pyx_GOTREF(__pyx_t_2);
  5983. __pyx_t_4 = PyInt_FromLong(ZMQ_RCVMORE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5984. __Pyx_GOTREF(__pyx_t_4);
  5985. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5986. __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  5987. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
  5988. __Pyx_GIVEREF(__pyx_t_4);
  5989. __pyx_t_4 = 0;
  5990. __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 = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5991. __Pyx_GOTREF(__pyx_t_4);
  5992. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  5993. __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  5994. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  5995. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5996. if (!__pyx_t_5) break;
  5997. /* "zmq/core/socket.pyx":723
  5998. * # have first part already, only loop while more to receive
  5999. * while self.getsockopt(ZMQ_RCVMORE):
  6000. * part = self.recv(flags, copy=copy, track=track) # <<<<<<<<<<<<<<
  6001. * parts.append(part)
  6002. *
  6003. */
  6004. __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__recv); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6005. __Pyx_GOTREF(__pyx_t_4);
  6006. __pyx_t_3 = PyInt_FromLong(__pyx_v_flags); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6007. __Pyx_GOTREF(__pyx_t_3);
  6008. __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6009. __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  6010. PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
  6011. __Pyx_GIVEREF(__pyx_t_3);
  6012. __pyx_t_3 = 0;
  6013. __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6014. __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  6015. if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__copy), __pyx_v_copy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6016. if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__track), __pyx_v_track) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6017. __pyx_t_1 = PyEval_CallObjectWithKeywords(__pyx_t_4, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6018. __Pyx_GOTREF(__pyx_t_1);
  6019. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6020. __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  6021. __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  6022. __Pyx_XDECREF(__pyx_v_part);
  6023. __pyx_v_part = __pyx_t_1;
  6024. __pyx_t_1 = 0;
  6025. /* "zmq/core/socket.pyx":724
  6026. * while self.getsockopt(ZMQ_RCVMORE):
  6027. * part = self.recv(flags, copy=copy, track=track)
  6028. * parts.append(part) # <<<<<<<<<<<<<<
  6029. *
  6030. * return parts
  6031. */
  6032. if (unlikely(((PyObject *)__pyx_v_parts) == Py_None)) {
  6033. PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6034. }
  6035. __pyx_t_6 = PyList_Append(__pyx_v_parts, __pyx_v_part); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6036. }
  6037. /* "zmq/core/socket.pyx":726
  6038. * parts.append(part)
  6039. *
  6040. * return parts # <<<<<<<<<<<<<<
  6041. *
  6042. * def send_unicode(self, u, int flags=0, copy=False, encoding='utf-8'):
  6043. */
  6044. __Pyx_XDECREF(__pyx_r);
  6045. __Pyx_INCREF(((PyObject *)__pyx_v_parts));
  6046. __pyx_r = ((PyObject *)__pyx_v_parts);
  6047. goto __pyx_L0;
  6048. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  6049. goto __pyx_L0;
  6050. __pyx_L1_error:;
  6051. __Pyx_XDECREF(__pyx_t_1);
  6052. __Pyx_XDECREF(__pyx_t_2);
  6053. __Pyx_XDECREF(__pyx_t_3);
  6054. __Pyx_XDECREF(__pyx_t_4);
  6055. __Pyx_AddTraceback("zmq.core.socket.Socket.recv_multipart", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6056. __pyx_r = NULL;
  6057. __pyx_L0:;
  6058. __Pyx_XDECREF(__pyx_v_parts);
  6059. __Pyx_XDECREF(__pyx_v_part);
  6060. __Pyx_XGIVEREF(__pyx_r);
  6061. __Pyx_RefNannyFinishContext();
  6062. return __pyx_r;
  6063. }
  6064. /* "zmq/core/socket.pyx":728
  6065. * return parts
  6066. *
  6067. * def send_unicode(self, u, int flags=0, copy=False, encoding='utf-8'): # <<<<<<<<<<<<<<
  6068. * """s.send_unicode(u, flags=0, copy=False, encoding='utf-8')
  6069. *
  6070. */
  6071. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_19send_unicode(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  6072. static char __pyx_doc_3zmq_4core_6socket_6Socket_19send_unicode[] = "s.send_unicode(u, flags=0, copy=False, encoding='utf-8')\n\n Send a Python unicode object as a message with an encoding.\n\n Parameters\n ----------\n u : Python unicode object\n The unicode string to send.\n flags : int, optional\n Any valid send flag.\n encoding : str [default: 'utf-8']\n The encoding to be used\n ";
  6073. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_19send_unicode(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  6074. PyObject *__pyx_v_u = 0;
  6075. int __pyx_v_flags;
  6076. PyObject *__pyx_v_copy = 0;
  6077. PyObject *__pyx_v_encoding = 0;
  6078. PyObject *__pyx_r = NULL;
  6079. __Pyx_RefNannyDeclarations
  6080. PyObject *__pyx_t_1 = NULL;
  6081. int __pyx_t_2;
  6082. int __pyx_t_3;
  6083. PyObject *__pyx_t_4 = NULL;
  6084. PyObject *__pyx_t_5 = NULL;
  6085. PyObject *__pyx_t_6 = NULL;
  6086. int __pyx_lineno = 0;
  6087. const char *__pyx_filename = NULL;
  6088. int __pyx_clineno = 0;
  6089. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__u,&__pyx_n_s__flags,&__pyx_n_s__copy,&__pyx_n_s__encoding,0};
  6090. __Pyx_RefNannySetupContext("send_unicode");
  6091. {
  6092. PyObject* values[4] = {0,0,0,0};
  6093. values[2] = __pyx_k_30;
  6094. values[3] = ((PyObject *)__pyx_kp_s_6);
  6095. if (unlikely(__pyx_kwds)) {
  6096. Py_ssize_t kw_args;
  6097. switch (PyTuple_GET_SIZE(__pyx_args)) {
  6098. case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
  6099. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  6100. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  6101. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  6102. case 0: break;
  6103. default: goto __pyx_L5_argtuple_error;
  6104. }
  6105. kw_args = PyDict_Size(__pyx_kwds);
  6106. switch (PyTuple_GET_SIZE(__pyx_args)) {
  6107. case 0:
  6108. values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__u);
  6109. if (likely(values[0])) kw_args--;
  6110. else goto __pyx_L5_argtuple_error;
  6111. case 1:
  6112. if (kw_args > 0) {
  6113. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags);
  6114. if (value) { values[1] = value; kw_args--; }
  6115. }
  6116. case 2:
  6117. if (kw_args > 0) {
  6118. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__copy);
  6119. if (value) { values[2] = value; kw_args--; }
  6120. }
  6121. case 3:
  6122. if (kw_args > 0) {
  6123. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__encoding);
  6124. if (value) { values[3] = value; kw_args--; }
  6125. }
  6126. }
  6127. if (unlikely(kw_args > 0)) {
  6128. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "send_unicode") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  6129. }
  6130. } else {
  6131. switch (PyTuple_GET_SIZE(__pyx_args)) {
  6132. case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
  6133. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  6134. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  6135. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  6136. break;
  6137. default: goto __pyx_L5_argtuple_error;
  6138. }
  6139. }
  6140. __pyx_v_u = values[0];
  6141. if (values[1]) {
  6142. __pyx_v_flags = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  6143. } else {
  6144. __pyx_v_flags = ((int)0);
  6145. }
  6146. __pyx_v_copy = values[2];
  6147. __pyx_v_encoding = values[3];
  6148. }
  6149. goto __pyx_L4_argument_unpacking_done;
  6150. __pyx_L5_argtuple_error:;
  6151. __Pyx_RaiseArgtupleInvalid("send_unicode", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  6152. __pyx_L3_error:;
  6153. __Pyx_AddTraceback("zmq.core.socket.Socket.send_unicode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6154. __Pyx_RefNannyFinishContext();
  6155. return NULL;
  6156. __pyx_L4_argument_unpacking_done:;
  6157. /* "zmq/core/socket.pyx":742
  6158. * The encoding to be used
  6159. * """
  6160. * if not isinstance(u, basestring): # <<<<<<<<<<<<<<
  6161. * raise TypeError("unicode/str objects only")
  6162. * return self.send(u.encode(encoding), flags=flags, copy=copy)
  6163. */
  6164. __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__basestring); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6165. __Pyx_GOTREF(__pyx_t_1);
  6166. __pyx_t_2 = PyObject_IsInstance(__pyx_v_u, __pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6167. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  6168. __pyx_t_3 = (!__pyx_t_2);
  6169. if (__pyx_t_3) {
  6170. /* "zmq/core/socket.pyx":743
  6171. * """
  6172. * if not isinstance(u, basestring):
  6173. * raise TypeError("unicode/str objects only") # <<<<<<<<<<<<<<
  6174. * return self.send(u.encode(encoding), flags=flags, copy=copy)
  6175. *
  6176. */
  6177. __pyx_t_1 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_32), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6178. __Pyx_GOTREF(__pyx_t_1);
  6179. __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  6180. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  6181. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6182. goto __pyx_L6;
  6183. }
  6184. __pyx_L6:;
  6185. /* "zmq/core/socket.pyx":744
  6186. * if not isinstance(u, basestring):
  6187. * raise TypeError("unicode/str objects only")
  6188. * return self.send(u.encode(encoding), flags=flags, copy=copy) # <<<<<<<<<<<<<<
  6189. *
  6190. * def recv_unicode(self, int flags=0, encoding='utf-8'):
  6191. */
  6192. __Pyx_XDECREF(__pyx_r);
  6193. __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__send); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6194. __Pyx_GOTREF(__pyx_t_1);
  6195. __pyx_t_4 = PyObject_GetAttr(__pyx_v_u, __pyx_n_s__encode); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6196. __Pyx_GOTREF(__pyx_t_4);
  6197. __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6198. __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  6199. __Pyx_INCREF(__pyx_v_encoding);
  6200. PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_encoding);
  6201. __Pyx_GIVEREF(__pyx_v_encoding);
  6202. __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6203. __Pyx_GOTREF(__pyx_t_6);
  6204. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6205. __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  6206. __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6207. __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  6208. PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6);
  6209. __Pyx_GIVEREF(__pyx_t_6);
  6210. __pyx_t_6 = 0;
  6211. __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6212. __Pyx_GOTREF(((PyObject *)__pyx_t_6));
  6213. __pyx_t_4 = PyInt_FromLong(__pyx_v_flags); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6214. __Pyx_GOTREF(__pyx_t_4);
  6215. if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__flags), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6216. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6217. if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__copy), __pyx_v_copy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6218. __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6219. __Pyx_GOTREF(__pyx_t_4);
  6220. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  6221. __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  6222. __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
  6223. __pyx_r = __pyx_t_4;
  6224. __pyx_t_4 = 0;
  6225. goto __pyx_L0;
  6226. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  6227. goto __pyx_L0;
  6228. __pyx_L1_error:;
  6229. __Pyx_XDECREF(__pyx_t_1);
  6230. __Pyx_XDECREF(__pyx_t_4);
  6231. __Pyx_XDECREF(__pyx_t_5);
  6232. __Pyx_XDECREF(__pyx_t_6);
  6233. __Pyx_AddTraceback("zmq.core.socket.Socket.send_unicode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6234. __pyx_r = NULL;
  6235. __pyx_L0:;
  6236. __Pyx_XGIVEREF(__pyx_r);
  6237. __Pyx_RefNannyFinishContext();
  6238. return __pyx_r;
  6239. }
  6240. /* "zmq/core/socket.pyx":746
  6241. * return self.send(u.encode(encoding), flags=flags, copy=copy)
  6242. *
  6243. * def recv_unicode(self, int flags=0, encoding='utf-8'): # <<<<<<<<<<<<<<
  6244. * """s.recv_unicode(flags=0, encoding='utf-8')
  6245. *
  6246. */
  6247. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_20recv_unicode(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  6248. static char __pyx_doc_3zmq_4core_6socket_6Socket_20recv_unicode[] = "s.recv_unicode(flags=0, encoding='utf-8')\n\n Receive a unicode string, as sent by send_unicode.\n \n Parameters\n ----------\n flags : int\n Any valid recv flag.\n encoding : str [default: 'utf-8']\n The encoding to be used\n\n Returns\n -------\n s : unicode string\n The Python unicode string that arrives as message bytes.\n ";
  6249. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_20recv_unicode(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  6250. int __pyx_v_flags;
  6251. PyObject *__pyx_v_encoding = 0;
  6252. PyObject *__pyx_v_msg = NULL;
  6253. PyObject *__pyx_r = NULL;
  6254. __Pyx_RefNannyDeclarations
  6255. PyObject *__pyx_t_1 = NULL;
  6256. PyObject *__pyx_t_2 = NULL;
  6257. PyObject *__pyx_t_3 = NULL;
  6258. int __pyx_lineno = 0;
  6259. const char *__pyx_filename = NULL;
  6260. int __pyx_clineno = 0;
  6261. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__flags,&__pyx_n_s__encoding,0};
  6262. __Pyx_RefNannySetupContext("recv_unicode");
  6263. {
  6264. PyObject* values[2] = {0,0};
  6265. values[1] = ((PyObject *)__pyx_kp_s_6);
  6266. if (unlikely(__pyx_kwds)) {
  6267. Py_ssize_t kw_args;
  6268. switch (PyTuple_GET_SIZE(__pyx_args)) {
  6269. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  6270. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  6271. case 0: break;
  6272. default: goto __pyx_L5_argtuple_error;
  6273. }
  6274. kw_args = PyDict_Size(__pyx_kwds);
  6275. switch (PyTuple_GET_SIZE(__pyx_args)) {
  6276. case 0:
  6277. if (kw_args > 0) {
  6278. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags);
  6279. if (value) { values[0] = value; kw_args--; }
  6280. }
  6281. case 1:
  6282. if (kw_args > 0) {
  6283. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__encoding);
  6284. if (value) { values[1] = value; kw_args--; }
  6285. }
  6286. }
  6287. if (unlikely(kw_args > 0)) {
  6288. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "recv_unicode") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  6289. }
  6290. } else {
  6291. switch (PyTuple_GET_SIZE(__pyx_args)) {
  6292. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  6293. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  6294. case 0: break;
  6295. default: goto __pyx_L5_argtuple_error;
  6296. }
  6297. }
  6298. if (values[0]) {
  6299. __pyx_v_flags = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  6300. } else {
  6301. __pyx_v_flags = ((int)0);
  6302. }
  6303. __pyx_v_encoding = values[1];
  6304. }
  6305. goto __pyx_L4_argument_unpacking_done;
  6306. __pyx_L5_argtuple_error:;
  6307. __Pyx_RaiseArgtupleInvalid("recv_unicode", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  6308. __pyx_L3_error:;
  6309. __Pyx_AddTraceback("zmq.core.socket.Socket.recv_unicode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6310. __Pyx_RefNannyFinishContext();
  6311. return NULL;
  6312. __pyx_L4_argument_unpacking_done:;
  6313. /* "zmq/core/socket.pyx":763
  6314. * The Python unicode string that arrives as message bytes.
  6315. * """
  6316. * msg = self.recv(flags=flags, copy=False) # <<<<<<<<<<<<<<
  6317. * return codecs.decode(msg.bytes, encoding)
  6318. *
  6319. */
  6320. __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__recv); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6321. __Pyx_GOTREF(__pyx_t_1);
  6322. __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6323. __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  6324. __pyx_t_3 = PyInt_FromLong(__pyx_v_flags); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6325. __Pyx_GOTREF(__pyx_t_3);
  6326. if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__flags), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6327. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6328. __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6329. __Pyx_GOTREF(__pyx_t_3);
  6330. if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__copy), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6331. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6332. __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6333. __Pyx_GOTREF(__pyx_t_3);
  6334. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  6335. __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  6336. __pyx_v_msg = __pyx_t_3;
  6337. __pyx_t_3 = 0;
  6338. /* "zmq/core/socket.pyx":764
  6339. * """
  6340. * msg = self.recv(flags=flags, copy=False)
  6341. * return codecs.decode(msg.bytes, encoding) # <<<<<<<<<<<<<<
  6342. *
  6343. * def send_pyobj(self, obj, flags=0, protocol=-1):
  6344. */
  6345. __Pyx_XDECREF(__pyx_r);
  6346. __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__codecs); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6347. __Pyx_GOTREF(__pyx_t_3);
  6348. __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__decode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6349. __Pyx_GOTREF(__pyx_t_2);
  6350. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6351. __pyx_t_3 = PyObject_GetAttr(__pyx_v_msg, __pyx_n_s__bytes); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6352. __Pyx_GOTREF(__pyx_t_3);
  6353. __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6354. __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  6355. PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
  6356. __Pyx_GIVEREF(__pyx_t_3);
  6357. __Pyx_INCREF(__pyx_v_encoding);
  6358. PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_encoding);
  6359. __Pyx_GIVEREF(__pyx_v_encoding);
  6360. __pyx_t_3 = 0;
  6361. __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6362. __Pyx_GOTREF(__pyx_t_3);
  6363. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  6364. __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  6365. __pyx_r = __pyx_t_3;
  6366. __pyx_t_3 = 0;
  6367. goto __pyx_L0;
  6368. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  6369. goto __pyx_L0;
  6370. __pyx_L1_error:;
  6371. __Pyx_XDECREF(__pyx_t_1);
  6372. __Pyx_XDECREF(__pyx_t_2);
  6373. __Pyx_XDECREF(__pyx_t_3);
  6374. __Pyx_AddTraceback("zmq.core.socket.Socket.recv_unicode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6375. __pyx_r = NULL;
  6376. __pyx_L0:;
  6377. __Pyx_XDECREF(__pyx_v_msg);
  6378. __Pyx_XGIVEREF(__pyx_r);
  6379. __Pyx_RefNannyFinishContext();
  6380. return __pyx_r;
  6381. }
  6382. /* "zmq/core/socket.pyx":766
  6383. * return codecs.decode(msg.bytes, encoding)
  6384. *
  6385. * def send_pyobj(self, obj, flags=0, protocol=-1): # <<<<<<<<<<<<<<
  6386. * """s.send_pyobj(obj, flags=0, protocol=-1)
  6387. *
  6388. */
  6389. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_21send_pyobj(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  6390. static char __pyx_doc_3zmq_4core_6socket_6Socket_21send_pyobj[] = "s.send_pyobj(obj, flags=0, protocol=-1)\n\n Send a Python object as a message using pickle to serialize.\n\n Parameters\n ----------\n obj : Python object\n The Python object to send.\n flags : int\n Any valid send flag.\n protocol : int\n The pickle protocol number to use. Default of -1 will select\n the highest supported number. Use 0 for multiple platform\n support.\n ";
  6391. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_21send_pyobj(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  6392. PyObject *__pyx_v_obj = 0;
  6393. PyObject *__pyx_v_flags = 0;
  6394. PyObject *__pyx_v_protocol = 0;
  6395. PyObject *__pyx_v_msg = NULL;
  6396. PyObject *__pyx_r = NULL;
  6397. __Pyx_RefNannyDeclarations
  6398. PyObject *__pyx_t_1 = NULL;
  6399. PyObject *__pyx_t_2 = NULL;
  6400. PyObject *__pyx_t_3 = NULL;
  6401. int __pyx_t_4;
  6402. struct __pyx_opt_args_3zmq_4core_6socket_6Socket_send __pyx_t_5;
  6403. int __pyx_lineno = 0;
  6404. const char *__pyx_filename = NULL;
  6405. int __pyx_clineno = 0;
  6406. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__obj,&__pyx_n_s__flags,&__pyx_n_s__protocol,0};
  6407. __Pyx_RefNannySetupContext("send_pyobj");
  6408. {
  6409. PyObject* values[3] = {0,0,0};
  6410. values[1] = ((PyObject *)__pyx_int_0);
  6411. values[2] = ((PyObject *)__pyx_int_neg_1);
  6412. if (unlikely(__pyx_kwds)) {
  6413. Py_ssize_t kw_args;
  6414. switch (PyTuple_GET_SIZE(__pyx_args)) {
  6415. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  6416. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  6417. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  6418. case 0: break;
  6419. default: goto __pyx_L5_argtuple_error;
  6420. }
  6421. kw_args = PyDict_Size(__pyx_kwds);
  6422. switch (PyTuple_GET_SIZE(__pyx_args)) {
  6423. case 0:
  6424. values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__obj);
  6425. if (likely(values[0])) kw_args--;
  6426. else goto __pyx_L5_argtuple_error;
  6427. case 1:
  6428. if (kw_args > 0) {
  6429. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags);
  6430. if (value) { values[1] = value; kw_args--; }
  6431. }
  6432. case 2:
  6433. if (kw_args > 0) {
  6434. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__protocol);
  6435. if (value) { values[2] = value; kw_args--; }
  6436. }
  6437. }
  6438. if (unlikely(kw_args > 0)) {
  6439. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "send_pyobj") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  6440. }
  6441. } else {
  6442. switch (PyTuple_GET_SIZE(__pyx_args)) {
  6443. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  6444. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  6445. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  6446. break;
  6447. default: goto __pyx_L5_argtuple_error;
  6448. }
  6449. }
  6450. __pyx_v_obj = values[0];
  6451. __pyx_v_flags = values[1];
  6452. __pyx_v_protocol = values[2];
  6453. }
  6454. goto __pyx_L4_argument_unpacking_done;
  6455. __pyx_L5_argtuple_error:;
  6456. __Pyx_RaiseArgtupleInvalid("send_pyobj", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  6457. __pyx_L3_error:;
  6458. __Pyx_AddTraceback("zmq.core.socket.Socket.send_pyobj", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6459. __Pyx_RefNannyFinishContext();
  6460. return NULL;
  6461. __pyx_L4_argument_unpacking_done:;
  6462. /* "zmq/core/socket.pyx":782
  6463. * support.
  6464. * """
  6465. * msg = pickle.dumps(obj, protocol) # <<<<<<<<<<<<<<
  6466. * return self.send(msg, flags)
  6467. *
  6468. */
  6469. __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__pickle); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6470. __Pyx_GOTREF(__pyx_t_1);
  6471. __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__dumps); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6472. __Pyx_GOTREF(__pyx_t_2);
  6473. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  6474. __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6475. __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  6476. __Pyx_INCREF(__pyx_v_obj);
  6477. PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_obj);
  6478. __Pyx_GIVEREF(__pyx_v_obj);
  6479. __Pyx_INCREF(__pyx_v_protocol);
  6480. PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_protocol);
  6481. __Pyx_GIVEREF(__pyx_v_protocol);
  6482. __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6483. __Pyx_GOTREF(__pyx_t_3);
  6484. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  6485. __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  6486. __pyx_v_msg = __pyx_t_3;
  6487. __pyx_t_3 = 0;
  6488. /* "zmq/core/socket.pyx":783
  6489. * """
  6490. * msg = pickle.dumps(obj, protocol)
  6491. * return self.send(msg, flags) # <<<<<<<<<<<<<<
  6492. *
  6493. * def recv_pyobj(self, flags=0):
  6494. */
  6495. __Pyx_XDECREF(__pyx_r);
  6496. __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_v_flags); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6497. __pyx_t_5.__pyx_n = 1;
  6498. __pyx_t_5.flags = __pyx_t_4;
  6499. __pyx_t_3 = ((struct __pyx_vtabstruct_3zmq_4core_6socket_Socket *)((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->__pyx_vtab)->send(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self), __pyx_v_msg, 0, &__pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6500. __Pyx_GOTREF(__pyx_t_3);
  6501. __pyx_r = __pyx_t_3;
  6502. __pyx_t_3 = 0;
  6503. goto __pyx_L0;
  6504. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  6505. goto __pyx_L0;
  6506. __pyx_L1_error:;
  6507. __Pyx_XDECREF(__pyx_t_1);
  6508. __Pyx_XDECREF(__pyx_t_2);
  6509. __Pyx_XDECREF(__pyx_t_3);
  6510. __Pyx_AddTraceback("zmq.core.socket.Socket.send_pyobj", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6511. __pyx_r = NULL;
  6512. __pyx_L0:;
  6513. __Pyx_XDECREF(__pyx_v_msg);
  6514. __Pyx_XGIVEREF(__pyx_r);
  6515. __Pyx_RefNannyFinishContext();
  6516. return __pyx_r;
  6517. }
  6518. /* "zmq/core/socket.pyx":785
  6519. * return self.send(msg, flags)
  6520. *
  6521. * def recv_pyobj(self, flags=0): # <<<<<<<<<<<<<<
  6522. * """s.recv_pyobj(flags=0)
  6523. *
  6524. */
  6525. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_22recv_pyobj(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  6526. static char __pyx_doc_3zmq_4core_6socket_6Socket_22recv_pyobj[] = "s.recv_pyobj(flags=0)\n\n Receive a Python object as a message using pickle to serialize.\n\n Parameters\n ----------\n flags : int\n Any valid recv flag.\n\n Returns\n -------\n obj : Python object\n The Python object that arrives as a message.\n ";
  6527. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_22recv_pyobj(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  6528. PyObject *__pyx_v_flags = 0;
  6529. PyObject *__pyx_v_s = NULL;
  6530. PyObject *__pyx_r = NULL;
  6531. __Pyx_RefNannyDeclarations
  6532. int __pyx_t_1;
  6533. PyObject *__pyx_t_2 = NULL;
  6534. struct __pyx_opt_args_3zmq_4core_6socket_6Socket_recv __pyx_t_3;
  6535. PyObject *__pyx_t_4 = NULL;
  6536. PyObject *__pyx_t_5 = NULL;
  6537. int __pyx_lineno = 0;
  6538. const char *__pyx_filename = NULL;
  6539. int __pyx_clineno = 0;
  6540. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__flags,0};
  6541. __Pyx_RefNannySetupContext("recv_pyobj");
  6542. {
  6543. PyObject* values[1] = {0};
  6544. values[0] = ((PyObject *)__pyx_int_0);
  6545. if (unlikely(__pyx_kwds)) {
  6546. Py_ssize_t kw_args;
  6547. switch (PyTuple_GET_SIZE(__pyx_args)) {
  6548. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  6549. case 0: break;
  6550. default: goto __pyx_L5_argtuple_error;
  6551. }
  6552. kw_args = PyDict_Size(__pyx_kwds);
  6553. switch (PyTuple_GET_SIZE(__pyx_args)) {
  6554. case 0:
  6555. if (kw_args > 0) {
  6556. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags);
  6557. if (value) { values[0] = value; kw_args--; }
  6558. }
  6559. }
  6560. if (unlikely(kw_args > 0)) {
  6561. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "recv_pyobj") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  6562. }
  6563. } else {
  6564. switch (PyTuple_GET_SIZE(__pyx_args)) {
  6565. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  6566. case 0: break;
  6567. default: goto __pyx_L5_argtuple_error;
  6568. }
  6569. }
  6570. __pyx_v_flags = values[0];
  6571. }
  6572. goto __pyx_L4_argument_unpacking_done;
  6573. __pyx_L5_argtuple_error:;
  6574. __Pyx_RaiseArgtupleInvalid("recv_pyobj", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  6575. __pyx_L3_error:;
  6576. __Pyx_AddTraceback("zmq.core.socket.Socket.recv_pyobj", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6577. __Pyx_RefNannyFinishContext();
  6578. return NULL;
  6579. __pyx_L4_argument_unpacking_done:;
  6580. /* "zmq/core/socket.pyx":800
  6581. * The Python object that arrives as a message.
  6582. * """
  6583. * s = self.recv(flags) # <<<<<<<<<<<<<<
  6584. * return pickle.loads(s)
  6585. *
  6586. */
  6587. __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_flags); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6588. __pyx_t_3.__pyx_n = 1;
  6589. __pyx_t_3.flags = __pyx_t_1;
  6590. __pyx_t_2 = ((struct __pyx_vtabstruct_3zmq_4core_6socket_Socket *)((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->__pyx_vtab)->recv(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self), 0, &__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6591. __Pyx_GOTREF(__pyx_t_2);
  6592. __pyx_v_s = __pyx_t_2;
  6593. __pyx_t_2 = 0;
  6594. /* "zmq/core/socket.pyx":801
  6595. * """
  6596. * s = self.recv(flags)
  6597. * return pickle.loads(s) # <<<<<<<<<<<<<<
  6598. *
  6599. * def send_json(self, obj, flags=0):
  6600. */
  6601. __Pyx_XDECREF(__pyx_r);
  6602. __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__pickle); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6603. __Pyx_GOTREF(__pyx_t_2);
  6604. __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__loads); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6605. __Pyx_GOTREF(__pyx_t_4);
  6606. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  6607. __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6608. __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  6609. __Pyx_INCREF(__pyx_v_s);
  6610. PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_s);
  6611. __Pyx_GIVEREF(__pyx_v_s);
  6612. __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6613. __Pyx_GOTREF(__pyx_t_5);
  6614. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6615. __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  6616. __pyx_r = __pyx_t_5;
  6617. __pyx_t_5 = 0;
  6618. goto __pyx_L0;
  6619. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  6620. goto __pyx_L0;
  6621. __pyx_L1_error:;
  6622. __Pyx_XDECREF(__pyx_t_2);
  6623. __Pyx_XDECREF(__pyx_t_4);
  6624. __Pyx_XDECREF(__pyx_t_5);
  6625. __Pyx_AddTraceback("zmq.core.socket.Socket.recv_pyobj", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6626. __pyx_r = NULL;
  6627. __pyx_L0:;
  6628. __Pyx_XDECREF(__pyx_v_s);
  6629. __Pyx_XGIVEREF(__pyx_r);
  6630. __Pyx_RefNannyFinishContext();
  6631. return __pyx_r;
  6632. }
  6633. /* "zmq/core/socket.pyx":803
  6634. * return pickle.loads(s)
  6635. *
  6636. * def send_json(self, obj, flags=0): # <<<<<<<<<<<<<<
  6637. * """s.send_json(obj, flags=0)
  6638. *
  6639. */
  6640. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_23send_json(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  6641. static char __pyx_doc_3zmq_4core_6socket_6Socket_23send_json[] = "s.send_json(obj, flags=0)\n\n Send a Python object as a message using json to serialize.\n\n Parameters\n ----------\n obj : Python object\n The Python object to send.\n flags : int\n Any valid send flag.\n ";
  6642. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_23send_json(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  6643. PyObject *__pyx_v_obj = 0;
  6644. PyObject *__pyx_v_flags = 0;
  6645. PyObject *__pyx_v_msg = NULL;
  6646. PyObject *__pyx_r = NULL;
  6647. __Pyx_RefNannyDeclarations
  6648. PyObject *__pyx_t_1 = NULL;
  6649. PyObject *__pyx_t_2 = NULL;
  6650. int __pyx_t_3;
  6651. PyObject *__pyx_t_4 = NULL;
  6652. int __pyx_t_5;
  6653. struct __pyx_opt_args_3zmq_4core_6socket_6Socket_send __pyx_t_6;
  6654. int __pyx_lineno = 0;
  6655. const char *__pyx_filename = NULL;
  6656. int __pyx_clineno = 0;
  6657. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__obj,&__pyx_n_s__flags,0};
  6658. __Pyx_RefNannySetupContext("send_json");
  6659. {
  6660. PyObject* values[2] = {0,0};
  6661. values[1] = ((PyObject *)__pyx_int_0);
  6662. if (unlikely(__pyx_kwds)) {
  6663. Py_ssize_t kw_args;
  6664. switch (PyTuple_GET_SIZE(__pyx_args)) {
  6665. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  6666. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  6667. case 0: break;
  6668. default: goto __pyx_L5_argtuple_error;
  6669. }
  6670. kw_args = PyDict_Size(__pyx_kwds);
  6671. switch (PyTuple_GET_SIZE(__pyx_args)) {
  6672. case 0:
  6673. values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__obj);
  6674. if (likely(values[0])) kw_args--;
  6675. else goto __pyx_L5_argtuple_error;
  6676. case 1:
  6677. if (kw_args > 0) {
  6678. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags);
  6679. if (value) { values[1] = value; kw_args--; }
  6680. }
  6681. }
  6682. if (unlikely(kw_args > 0)) {
  6683. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "send_json") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  6684. }
  6685. } else {
  6686. switch (PyTuple_GET_SIZE(__pyx_args)) {
  6687. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  6688. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  6689. break;
  6690. default: goto __pyx_L5_argtuple_error;
  6691. }
  6692. }
  6693. __pyx_v_obj = values[0];
  6694. __pyx_v_flags = values[1];
  6695. }
  6696. goto __pyx_L4_argument_unpacking_done;
  6697. __pyx_L5_argtuple_error:;
  6698. __Pyx_RaiseArgtupleInvalid("send_json", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  6699. __pyx_L3_error:;
  6700. __Pyx_AddTraceback("zmq.core.socket.Socket.send_json", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6701. __Pyx_RefNannyFinishContext();
  6702. return NULL;
  6703. __pyx_L4_argument_unpacking_done:;
  6704. /* "zmq/core/socket.pyx":815
  6705. * Any valid send flag.
  6706. * """
  6707. * if jsonapi.jsonmod is None: # <<<<<<<<<<<<<<
  6708. * raise ImportError('jsonlib{1,2}, json or simplejson library is required.')
  6709. * else:
  6710. */
  6711. __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__jsonapi); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6712. __Pyx_GOTREF(__pyx_t_1);
  6713. __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__jsonmod); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6714. __Pyx_GOTREF(__pyx_t_2);
  6715. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  6716. __pyx_t_3 = (__pyx_t_2 == Py_None);
  6717. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  6718. if (__pyx_t_3) {
  6719. /* "zmq/core/socket.pyx":816
  6720. * """
  6721. * if jsonapi.jsonmod is None:
  6722. * raise ImportError('jsonlib{1,2}, json or simplejson library is required.') # <<<<<<<<<<<<<<
  6723. * else:
  6724. * msg = jsonapi.dumps(obj)
  6725. */
  6726. __pyx_t_2 = PyObject_Call(__pyx_builtin_ImportError, ((PyObject *)__pyx_k_tuple_34), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6727. __Pyx_GOTREF(__pyx_t_2);
  6728. __Pyx_Raise(__pyx_t_2, 0, 0, 0);
  6729. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  6730. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6731. goto __pyx_L6;
  6732. }
  6733. /*else*/ {
  6734. /* "zmq/core/socket.pyx":818
  6735. * raise ImportError('jsonlib{1,2}, json or simplejson library is required.')
  6736. * else:
  6737. * msg = jsonapi.dumps(obj) # <<<<<<<<<<<<<<
  6738. * return self.send(msg, flags)
  6739. *
  6740. */
  6741. __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__jsonapi); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6742. __Pyx_GOTREF(__pyx_t_2);
  6743. __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__dumps); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6744. __Pyx_GOTREF(__pyx_t_1);
  6745. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  6746. __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6747. __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  6748. __Pyx_INCREF(__pyx_v_obj);
  6749. PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_obj);
  6750. __Pyx_GIVEREF(__pyx_v_obj);
  6751. __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6752. __Pyx_GOTREF(__pyx_t_4);
  6753. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  6754. __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  6755. __pyx_v_msg = __pyx_t_4;
  6756. __pyx_t_4 = 0;
  6757. /* "zmq/core/socket.pyx":819
  6758. * else:
  6759. * msg = jsonapi.dumps(obj)
  6760. * return self.send(msg, flags) # <<<<<<<<<<<<<<
  6761. *
  6762. * def recv_json(self, flags=0):
  6763. */
  6764. __Pyx_XDECREF(__pyx_r);
  6765. __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_v_flags); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6766. __pyx_t_6.__pyx_n = 1;
  6767. __pyx_t_6.flags = __pyx_t_5;
  6768. __pyx_t_4 = ((struct __pyx_vtabstruct_3zmq_4core_6socket_Socket *)((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->__pyx_vtab)->send(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self), __pyx_v_msg, 0, &__pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6769. __Pyx_GOTREF(__pyx_t_4);
  6770. __pyx_r = __pyx_t_4;
  6771. __pyx_t_4 = 0;
  6772. goto __pyx_L0;
  6773. }
  6774. __pyx_L6:;
  6775. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  6776. goto __pyx_L0;
  6777. __pyx_L1_error:;
  6778. __Pyx_XDECREF(__pyx_t_1);
  6779. __Pyx_XDECREF(__pyx_t_2);
  6780. __Pyx_XDECREF(__pyx_t_4);
  6781. __Pyx_AddTraceback("zmq.core.socket.Socket.send_json", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6782. __pyx_r = NULL;
  6783. __pyx_L0:;
  6784. __Pyx_XDECREF(__pyx_v_msg);
  6785. __Pyx_XGIVEREF(__pyx_r);
  6786. __Pyx_RefNannyFinishContext();
  6787. return __pyx_r;
  6788. }
  6789. /* "zmq/core/socket.pyx":821
  6790. * return self.send(msg, flags)
  6791. *
  6792. * def recv_json(self, flags=0): # <<<<<<<<<<<<<<
  6793. * """s.recv_json(flags=0)
  6794. *
  6795. */
  6796. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_24recv_json(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  6797. static char __pyx_doc_3zmq_4core_6socket_6Socket_24recv_json[] = "s.recv_json(flags=0)\n\n Receive a Python object as a message using json to serialize.\n\n Parameters\n ----------\n flags : int\n Any valid recv flag.\n\n Returns\n -------\n obj : Python object\n The Python object that arrives as a message.\n ";
  6798. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_24recv_json(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  6799. PyObject *__pyx_v_flags = 0;
  6800. PyObject *__pyx_v_msg = NULL;
  6801. PyObject *__pyx_r = NULL;
  6802. __Pyx_RefNannyDeclarations
  6803. PyObject *__pyx_t_1 = NULL;
  6804. PyObject *__pyx_t_2 = NULL;
  6805. int __pyx_t_3;
  6806. int __pyx_t_4;
  6807. struct __pyx_opt_args_3zmq_4core_6socket_6Socket_recv __pyx_t_5;
  6808. PyObject *__pyx_t_6 = NULL;
  6809. int __pyx_lineno = 0;
  6810. const char *__pyx_filename = NULL;
  6811. int __pyx_clineno = 0;
  6812. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__flags,0};
  6813. __Pyx_RefNannySetupContext("recv_json");
  6814. {
  6815. PyObject* values[1] = {0};
  6816. values[0] = ((PyObject *)__pyx_int_0);
  6817. if (unlikely(__pyx_kwds)) {
  6818. Py_ssize_t kw_args;
  6819. switch (PyTuple_GET_SIZE(__pyx_args)) {
  6820. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  6821. case 0: break;
  6822. default: goto __pyx_L5_argtuple_error;
  6823. }
  6824. kw_args = PyDict_Size(__pyx_kwds);
  6825. switch (PyTuple_GET_SIZE(__pyx_args)) {
  6826. case 0:
  6827. if (kw_args > 0) {
  6828. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags);
  6829. if (value) { values[0] = value; kw_args--; }
  6830. }
  6831. }
  6832. if (unlikely(kw_args > 0)) {
  6833. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "recv_json") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  6834. }
  6835. } else {
  6836. switch (PyTuple_GET_SIZE(__pyx_args)) {
  6837. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  6838. case 0: break;
  6839. default: goto __pyx_L5_argtuple_error;
  6840. }
  6841. }
  6842. __pyx_v_flags = values[0];
  6843. }
  6844. goto __pyx_L4_argument_unpacking_done;
  6845. __pyx_L5_argtuple_error:;
  6846. __Pyx_RaiseArgtupleInvalid("recv_json", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  6847. __pyx_L3_error:;
  6848. __Pyx_AddTraceback("zmq.core.socket.Socket.recv_json", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6849. __Pyx_RefNannyFinishContext();
  6850. return NULL;
  6851. __pyx_L4_argument_unpacking_done:;
  6852. /* "zmq/core/socket.pyx":836
  6853. * The Python object that arrives as a message.
  6854. * """
  6855. * if jsonapi.jsonmod is None: # <<<<<<<<<<<<<<
  6856. * raise ImportError('jsonlib{1,2}, json or simplejson library is required.')
  6857. * else:
  6858. */
  6859. __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__jsonapi); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6860. __Pyx_GOTREF(__pyx_t_1);
  6861. __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__jsonmod); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6862. __Pyx_GOTREF(__pyx_t_2);
  6863. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  6864. __pyx_t_3 = (__pyx_t_2 == Py_None);
  6865. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  6866. if (__pyx_t_3) {
  6867. /* "zmq/core/socket.pyx":837
  6868. * """
  6869. * if jsonapi.jsonmod is None:
  6870. * raise ImportError('jsonlib{1,2}, json or simplejson library is required.') # <<<<<<<<<<<<<<
  6871. * else:
  6872. * msg = self.recv(flags)
  6873. */
  6874. __pyx_t_2 = PyObject_Call(__pyx_builtin_ImportError, ((PyObject *)__pyx_k_tuple_35), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6875. __Pyx_GOTREF(__pyx_t_2);
  6876. __Pyx_Raise(__pyx_t_2, 0, 0, 0);
  6877. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  6878. {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6879. goto __pyx_L6;
  6880. }
  6881. /*else*/ {
  6882. /* "zmq/core/socket.pyx":839
  6883. * raise ImportError('jsonlib{1,2}, json or simplejson library is required.')
  6884. * else:
  6885. * msg = self.recv(flags) # <<<<<<<<<<<<<<
  6886. * return jsonapi.loads(msg)
  6887. *
  6888. */
  6889. __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_v_flags); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6890. __pyx_t_5.__pyx_n = 1;
  6891. __pyx_t_5.flags = __pyx_t_4;
  6892. __pyx_t_2 = ((struct __pyx_vtabstruct_3zmq_4core_6socket_Socket *)((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->__pyx_vtab)->recv(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self), 0, &__pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6893. __Pyx_GOTREF(__pyx_t_2);
  6894. __pyx_v_msg = __pyx_t_2;
  6895. __pyx_t_2 = 0;
  6896. /* "zmq/core/socket.pyx":840
  6897. * else:
  6898. * msg = self.recv(flags)
  6899. * return jsonapi.loads(msg) # <<<<<<<<<<<<<<
  6900. *
  6901. * def poll(self, timeout=None, flags=None):
  6902. */
  6903. __Pyx_XDECREF(__pyx_r);
  6904. __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__jsonapi); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6905. __Pyx_GOTREF(__pyx_t_2);
  6906. __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__loads); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6907. __Pyx_GOTREF(__pyx_t_1);
  6908. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  6909. __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6910. __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  6911. __Pyx_INCREF(__pyx_v_msg);
  6912. PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_msg);
  6913. __Pyx_GIVEREF(__pyx_v_msg);
  6914. __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  6915. __Pyx_GOTREF(__pyx_t_6);
  6916. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  6917. __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  6918. __pyx_r = __pyx_t_6;
  6919. __pyx_t_6 = 0;
  6920. goto __pyx_L0;
  6921. }
  6922. __pyx_L6:;
  6923. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  6924. goto __pyx_L0;
  6925. __pyx_L1_error:;
  6926. __Pyx_XDECREF(__pyx_t_1);
  6927. __Pyx_XDECREF(__pyx_t_2);
  6928. __Pyx_XDECREF(__pyx_t_6);
  6929. __Pyx_AddTraceback("zmq.core.socket.Socket.recv_json", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6930. __pyx_r = NULL;
  6931. __pyx_L0:;
  6932. __Pyx_XDECREF(__pyx_v_msg);
  6933. __Pyx_XGIVEREF(__pyx_r);
  6934. __Pyx_RefNannyFinishContext();
  6935. return __pyx_r;
  6936. }
  6937. /* "zmq/core/socket.pyx":842
  6938. * return jsonapi.loads(msg)
  6939. *
  6940. * def poll(self, timeout=None, flags=None): # <<<<<<<<<<<<<<
  6941. * """s.poll(timeout=None, flags=POLLIN|POLLERR)
  6942. *
  6943. */
  6944. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_25poll(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  6945. static char __pyx_doc_3zmq_4core_6socket_6Socket_25poll[] = "s.poll(timeout=None, flags=POLLIN|POLLERR)\n \n Poll the socket for events. The default is to poll forever for incoming\n events. Timeout is in milliseconds, if specified.\n \n Parameters\n ----------\n timeout : int [default: None]\n The timeout (in milliseconds) to wait for an event. If unspecified\n (or secified None), will wait forever for an event.\n flags : bitfield (int) [default: any event]\n The event flags to poll for (any combination of POLLIN|POLLOUT|POLLERR).\n The default is to check for incoming events (POLLIN|POLLERR).\n \n Returns\n -------\n events : bitfield (int)\n The events that are ready and waiting. Will be 0 if no events were ready\n by the time timeout was reached.\n ";
  6946. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_25poll(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  6947. PyObject *__pyx_v_timeout = 0;
  6948. PyObject *__pyx_v_flags = 0;
  6949. PyObject *__pyx_v_p = NULL;
  6950. PyObject *__pyx_v_evts = NULL;
  6951. PyObject *__pyx_r = NULL;
  6952. __Pyx_RefNannyDeclarations
  6953. PyObject *__pyx_t_1 = NULL;
  6954. int __pyx_t_2;
  6955. PyObject *__pyx_t_3 = NULL;
  6956. PyObject *__pyx_t_4 = NULL;
  6957. int __pyx_lineno = 0;
  6958. const char *__pyx_filename = NULL;
  6959. int __pyx_clineno = 0;
  6960. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__timeout,&__pyx_n_s__flags,0};
  6961. __Pyx_RefNannySetupContext("poll");
  6962. {
  6963. PyObject* values[2] = {0,0};
  6964. values[0] = ((PyObject *)Py_None);
  6965. values[1] = ((PyObject *)Py_None);
  6966. if (unlikely(__pyx_kwds)) {
  6967. Py_ssize_t kw_args;
  6968. switch (PyTuple_GET_SIZE(__pyx_args)) {
  6969. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  6970. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  6971. case 0: break;
  6972. default: goto __pyx_L5_argtuple_error;
  6973. }
  6974. kw_args = PyDict_Size(__pyx_kwds);
  6975. switch (PyTuple_GET_SIZE(__pyx_args)) {
  6976. case 0:
  6977. if (kw_args > 0) {
  6978. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__timeout);
  6979. if (value) { values[0] = value; kw_args--; }
  6980. }
  6981. case 1:
  6982. if (kw_args > 0) {
  6983. PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags);
  6984. if (value) { values[1] = value; kw_args--; }
  6985. }
  6986. }
  6987. if (unlikely(kw_args > 0)) {
  6988. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "poll") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  6989. }
  6990. } else {
  6991. switch (PyTuple_GET_SIZE(__pyx_args)) {
  6992. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  6993. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  6994. case 0: break;
  6995. default: goto __pyx_L5_argtuple_error;
  6996. }
  6997. }
  6998. __pyx_v_timeout = values[0];
  6999. __pyx_v_flags = values[1];
  7000. }
  7001. goto __pyx_L4_argument_unpacking_done;
  7002. __pyx_L5_argtuple_error:;
  7003. __Pyx_RaiseArgtupleInvalid("poll", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  7004. __pyx_L3_error:;
  7005. __Pyx_AddTraceback("zmq.core.socket.Socket.poll", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7006. __Pyx_RefNannyFinishContext();
  7007. return NULL;
  7008. __pyx_L4_argument_unpacking_done:;
  7009. __Pyx_INCREF(__pyx_v_flags);
  7010. /* "zmq/core/socket.pyx":864
  7011. * """
  7012. *
  7013. * _check_closed(self, True) # <<<<<<<<<<<<<<
  7014. *
  7015. * if flags is None:
  7016. */
  7017. __pyx_t_1 = __pyx_f_3zmq_4core_6socket__check_closed(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7018. __Pyx_GOTREF(__pyx_t_1);
  7019. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7020. /* "zmq/core/socket.pyx":866
  7021. * _check_closed(self, True)
  7022. *
  7023. * if flags is None: # <<<<<<<<<<<<<<
  7024. * flags = POLLIN|POLLERR
  7025. * p = zmq.Poller()
  7026. */
  7027. __pyx_t_2 = (__pyx_v_flags == Py_None);
  7028. if (__pyx_t_2) {
  7029. /* "zmq/core/socket.pyx":867
  7030. *
  7031. * if flags is None:
  7032. * flags = POLLIN|POLLERR # <<<<<<<<<<<<<<
  7033. * p = zmq.Poller()
  7034. * p.register(self, flags)
  7035. */
  7036. __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__POLLIN); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7037. __Pyx_GOTREF(__pyx_t_1);
  7038. __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__POLLERR); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7039. __Pyx_GOTREF(__pyx_t_3);
  7040. __pyx_t_4 = PyNumber_Or(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7041. __Pyx_GOTREF(__pyx_t_4);
  7042. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7043. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  7044. __Pyx_DECREF(__pyx_v_flags);
  7045. __pyx_v_flags = __pyx_t_4;
  7046. __pyx_t_4 = 0;
  7047. goto __pyx_L6;
  7048. }
  7049. __pyx_L6:;
  7050. /* "zmq/core/socket.pyx":868
  7051. * if flags is None:
  7052. * flags = POLLIN|POLLERR
  7053. * p = zmq.Poller() # <<<<<<<<<<<<<<
  7054. * p.register(self, flags)
  7055. * evts = dict(p.poll(timeout))
  7056. */
  7057. __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__zmq); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7058. __Pyx_GOTREF(__pyx_t_4);
  7059. __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__Poller); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7060. __Pyx_GOTREF(__pyx_t_3);
  7061. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  7062. __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7063. __Pyx_GOTREF(__pyx_t_4);
  7064. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  7065. __pyx_v_p = __pyx_t_4;
  7066. __pyx_t_4 = 0;
  7067. /* "zmq/core/socket.pyx":869
  7068. * flags = POLLIN|POLLERR
  7069. * p = zmq.Poller()
  7070. * p.register(self, flags) # <<<<<<<<<<<<<<
  7071. * evts = dict(p.poll(timeout))
  7072. * # return 0 if no events, otherwise return event bitfield
  7073. */
  7074. __pyx_t_4 = PyObject_GetAttr(__pyx_v_p, __pyx_n_s__register); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7075. __Pyx_GOTREF(__pyx_t_4);
  7076. __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7077. __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  7078. __Pyx_INCREF(__pyx_v_self);
  7079. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_self);
  7080. __Pyx_GIVEREF(__pyx_v_self);
  7081. __Pyx_INCREF(__pyx_v_flags);
  7082. PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_flags);
  7083. __Pyx_GIVEREF(__pyx_v_flags);
  7084. __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7085. __Pyx_GOTREF(__pyx_t_1);
  7086. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  7087. __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  7088. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7089. /* "zmq/core/socket.pyx":870
  7090. * p = zmq.Poller()
  7091. * p.register(self, flags)
  7092. * evts = dict(p.poll(timeout)) # <<<<<<<<<<<<<<
  7093. * # return 0 if no events, otherwise return event bitfield
  7094. * return evts.get(self, 0)
  7095. */
  7096. __pyx_t_1 = PyObject_GetAttr(__pyx_v_p, __pyx_n_s__poll); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7097. __Pyx_GOTREF(__pyx_t_1);
  7098. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7099. __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  7100. __Pyx_INCREF(__pyx_v_timeout);
  7101. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_timeout);
  7102. __Pyx_GIVEREF(__pyx_v_timeout);
  7103. __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7104. __Pyx_GOTREF(__pyx_t_4);
  7105. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7106. __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  7107. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7108. __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  7109. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
  7110. __Pyx_GIVEREF(__pyx_t_4);
  7111. __pyx_t_4 = 0;
  7112. __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyDict_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7113. __Pyx_GOTREF(__pyx_t_4);
  7114. __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  7115. __pyx_v_evts = ((PyObject*)__pyx_t_4);
  7116. __pyx_t_4 = 0;
  7117. /* "zmq/core/socket.pyx":872
  7118. * evts = dict(p.poll(timeout))
  7119. * # return 0 if no events, otherwise return event bitfield
  7120. * return evts.get(self, 0) # <<<<<<<<<<<<<<
  7121. *
  7122. *
  7123. */
  7124. __Pyx_XDECREF(__pyx_r);
  7125. if (unlikely(((PyObject *)__pyx_v_evts) == Py_None)) {
  7126. PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "get"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7127. }
  7128. __pyx_t_4 = __Pyx_PyDict_GetItemDefault(((PyObject *)__pyx_v_evts), __pyx_v_self, __pyx_int_0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7129. __Pyx_GOTREF(__pyx_t_4);
  7130. __pyx_r = __pyx_t_4;
  7131. __pyx_t_4 = 0;
  7132. goto __pyx_L0;
  7133. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  7134. goto __pyx_L0;
  7135. __pyx_L1_error:;
  7136. __Pyx_XDECREF(__pyx_t_1);
  7137. __Pyx_XDECREF(__pyx_t_3);
  7138. __Pyx_XDECREF(__pyx_t_4);
  7139. __Pyx_AddTraceback("zmq.core.socket.Socket.poll", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7140. __pyx_r = NULL;
  7141. __pyx_L0:;
  7142. __Pyx_XDECREF(__pyx_v_p);
  7143. __Pyx_XDECREF(__pyx_v_evts);
  7144. __Pyx_XDECREF(__pyx_v_flags);
  7145. __Pyx_XGIVEREF(__pyx_r);
  7146. __Pyx_RefNannyFinishContext();
  7147. return __pyx_r;
  7148. }
  7149. /* "zmq/core/socket.pxd":39
  7150. *
  7151. * cdef void *handle # The C handle for the underlying zmq object.
  7152. * cdef public int socket_type # The 0MQ socket type - REQ,REP, etc. # <<<<<<<<<<<<<<
  7153. * # Hold on to a reference to the context to make sure it is not garbage
  7154. * # collected until the socket it done with it.
  7155. */
  7156. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_11socket_type___get__(PyObject *__pyx_v_self); /*proto*/
  7157. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_11socket_type___get__(PyObject *__pyx_v_self) {
  7158. PyObject *__pyx_r = NULL;
  7159. __Pyx_RefNannyDeclarations
  7160. PyObject *__pyx_t_1 = NULL;
  7161. int __pyx_lineno = 0;
  7162. const char *__pyx_filename = NULL;
  7163. int __pyx_clineno = 0;
  7164. __Pyx_RefNannySetupContext("__get__");
  7165. __Pyx_XDECREF(__pyx_r);
  7166. __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->socket_type); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7167. __Pyx_GOTREF(__pyx_t_1);
  7168. __pyx_r = __pyx_t_1;
  7169. __pyx_t_1 = 0;
  7170. goto __pyx_L0;
  7171. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  7172. goto __pyx_L0;
  7173. __pyx_L1_error:;
  7174. __Pyx_XDECREF(__pyx_t_1);
  7175. __Pyx_AddTraceback("zmq.core.socket.Socket.socket_type.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7176. __pyx_r = NULL;
  7177. __pyx_L0:;
  7178. __Pyx_XGIVEREF(__pyx_r);
  7179. __Pyx_RefNannyFinishContext();
  7180. return __pyx_r;
  7181. }
  7182. static int __pyx_pf_3zmq_4core_6socket_6Socket_11socket_type_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
  7183. static int __pyx_pf_3zmq_4core_6socket_6Socket_11socket_type_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  7184. int __pyx_r;
  7185. __Pyx_RefNannyDeclarations
  7186. int __pyx_t_1;
  7187. int __pyx_lineno = 0;
  7188. const char *__pyx_filename = NULL;
  7189. int __pyx_clineno = 0;
  7190. __Pyx_RefNannySetupContext("__set__");
  7191. __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7192. ((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->socket_type = __pyx_t_1;
  7193. __pyx_r = 0;
  7194. goto __pyx_L0;
  7195. __pyx_L1_error:;
  7196. __Pyx_AddTraceback("zmq.core.socket.Socket.socket_type.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7197. __pyx_r = -1;
  7198. __pyx_L0:;
  7199. __Pyx_RefNannyFinishContext();
  7200. return __pyx_r;
  7201. }
  7202. /* "zmq/core/socket.pxd":42
  7203. * # Hold on to a reference to the context to make sure it is not garbage
  7204. * # collected until the socket it done with it.
  7205. * cdef public Context context # The zmq Context object that owns this. # <<<<<<<<<<<<<<
  7206. * cdef public bint _closed # bool property for a closed socket.
  7207. * cdef dict _attrs # dict needed for *non-sockopt* get/setattr in subclasses
  7208. */
  7209. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_7context___get__(PyObject *__pyx_v_self); /*proto*/
  7210. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_7context___get__(PyObject *__pyx_v_self) {
  7211. PyObject *__pyx_r = NULL;
  7212. __Pyx_RefNannyDeclarations
  7213. __Pyx_RefNannySetupContext("__get__");
  7214. __Pyx_XDECREF(__pyx_r);
  7215. __Pyx_INCREF(((PyObject *)((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->context));
  7216. __pyx_r = ((PyObject *)((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->context);
  7217. goto __pyx_L0;
  7218. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  7219. __pyx_L0:;
  7220. __Pyx_XGIVEREF(__pyx_r);
  7221. __Pyx_RefNannyFinishContext();
  7222. return __pyx_r;
  7223. }
  7224. static int __pyx_pf_3zmq_4core_6socket_6Socket_7context_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
  7225. static int __pyx_pf_3zmq_4core_6socket_6Socket_7context_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  7226. int __pyx_r;
  7227. __Pyx_RefNannyDeclarations
  7228. int __pyx_lineno = 0;
  7229. const char *__pyx_filename = NULL;
  7230. int __pyx_clineno = 0;
  7231. __Pyx_RefNannySetupContext("__set__");
  7232. if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_3zmq_4core_7context_Context))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7233. __Pyx_INCREF(__pyx_v_value);
  7234. __Pyx_GIVEREF(__pyx_v_value);
  7235. __Pyx_GOTREF(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->context);
  7236. __Pyx_DECREF(((PyObject *)((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->context));
  7237. ((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->context = ((struct __pyx_obj_3zmq_4core_7context_Context *)__pyx_v_value);
  7238. __pyx_r = 0;
  7239. goto __pyx_L0;
  7240. __pyx_L1_error:;
  7241. __Pyx_AddTraceback("zmq.core.socket.Socket.context.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7242. __pyx_r = -1;
  7243. __pyx_L0:;
  7244. __Pyx_RefNannyFinishContext();
  7245. return __pyx_r;
  7246. }
  7247. static int __pyx_pf_3zmq_4core_6socket_6Socket_7context_2__del__(PyObject *__pyx_v_self); /*proto*/
  7248. static int __pyx_pf_3zmq_4core_6socket_6Socket_7context_2__del__(PyObject *__pyx_v_self) {
  7249. int __pyx_r;
  7250. __Pyx_RefNannyDeclarations
  7251. __Pyx_RefNannySetupContext("__del__");
  7252. __Pyx_INCREF(Py_None);
  7253. __Pyx_GIVEREF(Py_None);
  7254. __Pyx_GOTREF(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->context);
  7255. __Pyx_DECREF(((PyObject *)((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->context));
  7256. ((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->context = ((struct __pyx_obj_3zmq_4core_7context_Context *)Py_None);
  7257. __pyx_r = 0;
  7258. __Pyx_RefNannyFinishContext();
  7259. return __pyx_r;
  7260. }
  7261. /* "zmq/core/socket.pxd":43
  7262. * # collected until the socket it done with it.
  7263. * cdef public Context context # The zmq Context object that owns this.
  7264. * cdef public bint _closed # bool property for a closed socket. # <<<<<<<<<<<<<<
  7265. * cdef dict _attrs # dict needed for *non-sockopt* get/setattr in subclasses
  7266. *
  7267. */
  7268. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_7_closed___get__(PyObject *__pyx_v_self); /*proto*/
  7269. static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_7_closed___get__(PyObject *__pyx_v_self) {
  7270. PyObject *__pyx_r = NULL;
  7271. __Pyx_RefNannyDeclarations
  7272. PyObject *__pyx_t_1 = NULL;
  7273. int __pyx_lineno = 0;
  7274. const char *__pyx_filename = NULL;
  7275. int __pyx_clineno = 0;
  7276. __Pyx_RefNannySetupContext("__get__");
  7277. __Pyx_XDECREF(__pyx_r);
  7278. __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->_closed); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7279. __Pyx_GOTREF(__pyx_t_1);
  7280. __pyx_r = __pyx_t_1;
  7281. __pyx_t_1 = 0;
  7282. goto __pyx_L0;
  7283. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  7284. goto __pyx_L0;
  7285. __pyx_L1_error:;
  7286. __Pyx_XDECREF(__pyx_t_1);
  7287. __Pyx_AddTraceback("zmq.core.socket.Socket._closed.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7288. __pyx_r = NULL;
  7289. __pyx_L0:;
  7290. __Pyx_XGIVEREF(__pyx_r);
  7291. __Pyx_RefNannyFinishContext();
  7292. return __pyx_r;
  7293. }
  7294. static int __pyx_pf_3zmq_4core_6socket_6Socket_7_closed_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
  7295. static int __pyx_pf_3zmq_4core_6socket_6Socket_7_closed_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  7296. int __pyx_r;
  7297. __Pyx_RefNannyDeclarations
  7298. int __pyx_t_1;
  7299. int __pyx_lineno = 0;
  7300. const char *__pyx_filename = NULL;
  7301. int __pyx_clineno = 0;
  7302. __Pyx_RefNannySetupContext("__set__");
  7303. __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7304. ((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->_closed = __pyx_t_1;
  7305. __pyx_r = 0;
  7306. goto __pyx_L0;
  7307. __pyx_L1_error:;
  7308. __Pyx_AddTraceback("zmq.core.socket.Socket._closed.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7309. __pyx_r = -1;
  7310. __pyx_L0:;
  7311. __Pyx_RefNannyFinishContext();
  7312. return __pyx_r;
  7313. }
  7314. /* "buffers.pxd":79
  7315. *
  7316. *
  7317. * cdef inline int newstyle_available(): # <<<<<<<<<<<<<<
  7318. * return PY_MAJOR_VERSION >= 3 or (PY_MAJOR_VERSION >=2 and PY_MINOR_VERSION >= 6)
  7319. *
  7320. */
  7321. static CYTHON_INLINE int __pyx_f_7buffers_newstyle_available(void) {
  7322. int __pyx_r;
  7323. __Pyx_RefNannyDeclarations
  7324. int __pyx_t_1;
  7325. int __pyx_t_2;
  7326. int __pyx_t_3;
  7327. int __pyx_t_4;
  7328. __Pyx_RefNannySetupContext("newstyle_available");
  7329. /* "buffers.pxd":80
  7330. *
  7331. * cdef inline int newstyle_available():
  7332. * return PY_MAJOR_VERSION >= 3 or (PY_MAJOR_VERSION >=2 and PY_MINOR_VERSION >= 6) # <<<<<<<<<<<<<<
  7333. *
  7334. * cdef inline int memoryview_available():
  7335. */
  7336. __pyx_t_1 = (PY_MAJOR_VERSION >= 3);
  7337. if (!__pyx_t_1) {
  7338. __pyx_t_2 = (PY_MAJOR_VERSION >= 2);
  7339. if (__pyx_t_2) {
  7340. __pyx_t_3 = (PY_MINOR_VERSION >= 6);
  7341. __pyx_t_4 = __pyx_t_3;
  7342. } else {
  7343. __pyx_t_4 = __pyx_t_2;
  7344. }
  7345. __pyx_t_2 = __pyx_t_4;
  7346. } else {
  7347. __pyx_t_2 = __pyx_t_1;
  7348. }
  7349. __pyx_r = __pyx_t_2;
  7350. goto __pyx_L0;
  7351. __pyx_r = 0;
  7352. __pyx_L0:;
  7353. __Pyx_RefNannyFinishContext();
  7354. return __pyx_r;
  7355. }
  7356. /* "buffers.pxd":82
  7357. * return PY_MAJOR_VERSION >= 3 or (PY_MAJOR_VERSION >=2 and PY_MINOR_VERSION >= 6)
  7358. *
  7359. * cdef inline int memoryview_available(): # <<<<<<<<<<<<<<
  7360. * return PY_MAJOR_VERSION >= 3 or (PY_MAJOR_VERSION >=2 and PY_MINOR_VERSION >= 7)
  7361. *
  7362. */
  7363. static CYTHON_INLINE int __pyx_f_7buffers_memoryview_available(void) {
  7364. int __pyx_r;
  7365. __Pyx_RefNannyDeclarations
  7366. int __pyx_t_1;
  7367. int __pyx_t_2;
  7368. int __pyx_t_3;
  7369. int __pyx_t_4;
  7370. __Pyx_RefNannySetupContext("memoryview_available");
  7371. /* "buffers.pxd":83
  7372. *
  7373. * cdef inline int memoryview_available():
  7374. * return PY_MAJOR_VERSION >= 3 or (PY_MAJOR_VERSION >=2 and PY_MINOR_VERSION >= 7) # <<<<<<<<<<<<<<
  7375. *
  7376. * cdef inline int oldstyle_available():
  7377. */
  7378. __pyx_t_1 = (PY_MAJOR_VERSION >= 3);
  7379. if (!__pyx_t_1) {
  7380. __pyx_t_2 = (PY_MAJOR_VERSION >= 2);
  7381. if (__pyx_t_2) {
  7382. __pyx_t_3 = (PY_MINOR_VERSION >= 7);
  7383. __pyx_t_4 = __pyx_t_3;
  7384. } else {
  7385. __pyx_t_4 = __pyx_t_2;
  7386. }
  7387. __pyx_t_2 = __pyx_t_4;
  7388. } else {
  7389. __pyx_t_2 = __pyx_t_1;
  7390. }
  7391. __pyx_r = __pyx_t_2;
  7392. goto __pyx_L0;
  7393. __pyx_r = 0;
  7394. __pyx_L0:;
  7395. __Pyx_RefNannyFinishContext();
  7396. return __pyx_r;
  7397. }
  7398. /* "buffers.pxd":85
  7399. * return PY_MAJOR_VERSION >= 3 or (PY_MAJOR_VERSION >=2 and PY_MINOR_VERSION >= 7)
  7400. *
  7401. * cdef inline int oldstyle_available(): # <<<<<<<<<<<<<<
  7402. * return PY_MAJOR_VERSION < 3
  7403. *
  7404. */
  7405. static CYTHON_INLINE int __pyx_f_7buffers_oldstyle_available(void) {
  7406. int __pyx_r;
  7407. __Pyx_RefNannyDeclarations
  7408. __Pyx_RefNannySetupContext("oldstyle_available");
  7409. /* "buffers.pxd":86
  7410. *
  7411. * cdef inline int oldstyle_available():
  7412. * return PY_MAJOR_VERSION < 3 # <<<<<<<<<<<<<<
  7413. *
  7414. * cdef inline int check_buffer(object ob):
  7415. */
  7416. __pyx_r = (PY_MAJOR_VERSION < 3);
  7417. goto __pyx_L0;
  7418. __pyx_r = 0;
  7419. __pyx_L0:;
  7420. __Pyx_RefNannyFinishContext();
  7421. return __pyx_r;
  7422. }
  7423. /* "buffers.pxd":88
  7424. * return PY_MAJOR_VERSION < 3
  7425. *
  7426. * cdef inline int check_buffer(object ob): # <<<<<<<<<<<<<<
  7427. * """Version independent check for whether an object is a buffer.
  7428. *
  7429. */
  7430. static CYTHON_INLINE int __pyx_f_7buffers_check_buffer(PyObject *__pyx_v_ob) {
  7431. int __pyx_r;
  7432. __Pyx_RefNannyDeclarations
  7433. int __pyx_t_1;
  7434. long __pyx_t_2;
  7435. __Pyx_RefNannySetupContext("check_buffer");
  7436. /* "buffers.pxd":100
  7437. * int : 0 if no buffer interface, 3 if newstyle buffer interface, 2 if oldstyle.
  7438. * """
  7439. * if newstyle_available(): # <<<<<<<<<<<<<<
  7440. * if PyObject_CheckBuffer(ob):
  7441. * return 3
  7442. */
  7443. __pyx_t_1 = __pyx_f_7buffers_newstyle_available();
  7444. if (__pyx_t_1) {
  7445. /* "buffers.pxd":101
  7446. * """
  7447. * if newstyle_available():
  7448. * if PyObject_CheckBuffer(ob): # <<<<<<<<<<<<<<
  7449. * return 3
  7450. * if oldstyle_available():
  7451. */
  7452. __pyx_t_1 = PyObject_CheckBuffer(__pyx_v_ob);
  7453. if (__pyx_t_1) {
  7454. /* "buffers.pxd":102
  7455. * if newstyle_available():
  7456. * if PyObject_CheckBuffer(ob):
  7457. * return 3 # <<<<<<<<<<<<<<
  7458. * if oldstyle_available():
  7459. * return PyObject_CheckReadBuffer(ob) and 2
  7460. */
  7461. __pyx_r = 3;
  7462. goto __pyx_L0;
  7463. goto __pyx_L4;
  7464. }
  7465. __pyx_L4:;
  7466. goto __pyx_L3;
  7467. }
  7468. __pyx_L3:;
  7469. /* "buffers.pxd":103
  7470. * if PyObject_CheckBuffer(ob):
  7471. * return 3
  7472. * if oldstyle_available(): # <<<<<<<<<<<<<<
  7473. * return PyObject_CheckReadBuffer(ob) and 2
  7474. * return 0
  7475. */
  7476. __pyx_t_1 = __pyx_f_7buffers_oldstyle_available();
  7477. if (__pyx_t_1) {
  7478. /* "buffers.pxd":104
  7479. * return 3
  7480. * if oldstyle_available():
  7481. * return PyObject_CheckReadBuffer(ob) and 2 # <<<<<<<<<<<<<<
  7482. * return 0
  7483. *
  7484. */
  7485. __pyx_t_1 = PyObject_CheckReadBuffer(__pyx_v_ob);
  7486. if (__pyx_t_1) {
  7487. __pyx_t_2 = 2;
  7488. } else {
  7489. __pyx_t_2 = __pyx_t_1;
  7490. }
  7491. __pyx_r = __pyx_t_2;
  7492. goto __pyx_L0;
  7493. goto __pyx_L5;
  7494. }
  7495. __pyx_L5:;
  7496. /* "buffers.pxd":105
  7497. * if oldstyle_available():
  7498. * return PyObject_CheckReadBuffer(ob) and 2
  7499. * return 0 # <<<<<<<<<<<<<<
  7500. *
  7501. *
  7502. */
  7503. __pyx_r = 0;
  7504. goto __pyx_L0;
  7505. __pyx_r = 0;
  7506. __pyx_L0:;
  7507. __Pyx_RefNannyFinishContext();
  7508. return __pyx_r;
  7509. }
  7510. /* "buffers.pxd":108
  7511. *
  7512. *
  7513. * cdef inline object asbuffer(object ob, int writable, int format, # <<<<<<<<<<<<<<
  7514. * void **base, Py_ssize_t *size,
  7515. * Py_ssize_t *itemsize):
  7516. */
  7517. static CYTHON_INLINE PyObject *__pyx_f_7buffers_asbuffer(PyObject *__pyx_v_ob, int __pyx_v_writable, int __pyx_v_format, void **__pyx_v_base, Py_ssize_t *__pyx_v_size, Py_ssize_t *__pyx_v_itemsize) {
  7518. void *__pyx_v_bptr;
  7519. Py_ssize_t __pyx_v_blen;
  7520. Py_ssize_t __pyx_v_bitemlen;
  7521. PyObject *__pyx_v_bfmt = 0;
  7522. Py_buffer __pyx_v_view;
  7523. int __pyx_v_flags;
  7524. int __pyx_v_mode;
  7525. PyObject *__pyx_v_dtype = NULL;
  7526. PyObject *__pyx_r = NULL;
  7527. __Pyx_RefNannyDeclarations
  7528. int __pyx_t_1;
  7529. PyObject *__pyx_t_2 = NULL;
  7530. PyObject *__pyx_t_3 = NULL;
  7531. int __pyx_t_4;
  7532. PyObject *__pyx_t_5 = NULL;
  7533. PyObject *__pyx_t_6 = NULL;
  7534. PyObject *__pyx_t_7 = NULL;
  7535. Py_ssize_t __pyx_t_8;
  7536. PyObject *__pyx_t_9 = NULL;
  7537. PyObject *__pyx_t_10 = NULL;
  7538. PyObject *__pyx_t_11 = NULL;
  7539. PyObject *__pyx_t_12 = NULL;
  7540. PyObject *__pyx_t_13 = NULL;
  7541. PyObject *__pyx_t_14 = NULL;
  7542. PyObject *__pyx_t_15 = NULL;
  7543. PyObject *__pyx_t_16 = NULL;
  7544. int __pyx_lineno = 0;
  7545. const char *__pyx_filename = NULL;
  7546. int __pyx_clineno = 0;
  7547. __Pyx_RefNannySetupContext("asbuffer");
  7548. /* "buffers.pxd":135
  7549. * """
  7550. *
  7551. * cdef void *bptr = NULL # <<<<<<<<<<<<<<
  7552. * cdef Py_ssize_t blen = 0, bitemlen = 0
  7553. * cdef str bfmt = None
  7554. */
  7555. __pyx_v_bptr = NULL;
  7556. /* "buffers.pxd":136
  7557. *
  7558. * cdef void *bptr = NULL
  7559. * cdef Py_ssize_t blen = 0, bitemlen = 0 # <<<<<<<<<<<<<<
  7560. * cdef str bfmt = None
  7561. * cdef Py_buffer view
  7562. */
  7563. __pyx_v_blen = 0;
  7564. __pyx_v_bitemlen = 0;
  7565. /* "buffers.pxd":137
  7566. * cdef void *bptr = NULL
  7567. * cdef Py_ssize_t blen = 0, bitemlen = 0
  7568. * cdef str bfmt = None # <<<<<<<<<<<<<<
  7569. * cdef Py_buffer view
  7570. * cdef int flags = PyBUF_SIMPLE
  7571. */
  7572. __Pyx_INCREF(Py_None);
  7573. __pyx_v_bfmt = ((PyObject*)Py_None);
  7574. /* "buffers.pxd":139
  7575. * cdef str bfmt = None
  7576. * cdef Py_buffer view
  7577. * cdef int flags = PyBUF_SIMPLE # <<<<<<<<<<<<<<
  7578. * cdef int mode = 0
  7579. *
  7580. */
  7581. __pyx_v_flags = PyBUF_SIMPLE;
  7582. /* "buffers.pxd":140
  7583. * cdef Py_buffer view
  7584. * cdef int flags = PyBUF_SIMPLE
  7585. * cdef int mode = 0 # <<<<<<<<<<<<<<
  7586. *
  7587. * mode = check_buffer(ob)
  7588. */
  7589. __pyx_v_mode = 0;
  7590. /* "buffers.pxd":142
  7591. * cdef int mode = 0
  7592. *
  7593. * mode = check_buffer(ob) # <<<<<<<<<<<<<<
  7594. * if mode == 0:
  7595. * raise TypeError("%r does not provide a buffer interface."%ob)
  7596. */
  7597. __pyx_v_mode = __pyx_f_7buffers_check_buffer(__pyx_v_ob);
  7598. /* "buffers.pxd":143
  7599. *
  7600. * mode = check_buffer(ob)
  7601. * if mode == 0: # <<<<<<<<<<<<<<
  7602. * raise TypeError("%r does not provide a buffer interface."%ob)
  7603. *
  7604. */
  7605. __pyx_t_1 = (__pyx_v_mode == 0);
  7606. if (__pyx_t_1) {
  7607. /* "buffers.pxd":144
  7608. * mode = check_buffer(ob)
  7609. * if mode == 0:
  7610. * raise TypeError("%r does not provide a buffer interface."%ob) # <<<<<<<<<<<<<<
  7611. *
  7612. * if mode == 3:
  7613. */
  7614. __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_36), __pyx_v_ob); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7615. __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  7616. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7617. __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  7618. PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
  7619. __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
  7620. __pyx_t_2 = 0;
  7621. __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7622. __Pyx_GOTREF(__pyx_t_2);
  7623. __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  7624. __Pyx_Raise(__pyx_t_2, 0, 0, 0);
  7625. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7626. {__pyx_filename = __pyx_f[2]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7627. goto __pyx_L3;
  7628. }
  7629. __pyx_L3:;
  7630. /* "buffers.pxd":146
  7631. * raise TypeError("%r does not provide a buffer interface."%ob)
  7632. *
  7633. * if mode == 3: # <<<<<<<<<<<<<<
  7634. * flags = PyBUF_ANY_CONTIGUOUS
  7635. * if writable:
  7636. */
  7637. __pyx_t_1 = (__pyx_v_mode == 3);
  7638. if (__pyx_t_1) {
  7639. /* "buffers.pxd":147
  7640. *
  7641. * if mode == 3:
  7642. * flags = PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<<
  7643. * if writable:
  7644. * flags |= PyBUF_WRITABLE
  7645. */
  7646. __pyx_v_flags = PyBUF_ANY_CONTIGUOUS;
  7647. /* "buffers.pxd":148
  7648. * if mode == 3:
  7649. * flags = PyBUF_ANY_CONTIGUOUS
  7650. * if writable: # <<<<<<<<<<<<<<
  7651. * flags |= PyBUF_WRITABLE
  7652. * if format:
  7653. */
  7654. if (__pyx_v_writable) {
  7655. /* "buffers.pxd":149
  7656. * flags = PyBUF_ANY_CONTIGUOUS
  7657. * if writable:
  7658. * flags |= PyBUF_WRITABLE # <<<<<<<<<<<<<<
  7659. * if format:
  7660. * flags |= PyBUF_FORMAT
  7661. */
  7662. __pyx_v_flags = (__pyx_v_flags | PyBUF_WRITABLE);
  7663. goto __pyx_L5;
  7664. }
  7665. __pyx_L5:;
  7666. /* "buffers.pxd":150
  7667. * if writable:
  7668. * flags |= PyBUF_WRITABLE
  7669. * if format: # <<<<<<<<<<<<<<
  7670. * flags |= PyBUF_FORMAT
  7671. * PyObject_GetBuffer(ob, &view, flags)
  7672. */
  7673. if (__pyx_v_format) {
  7674. /* "buffers.pxd":151
  7675. * flags |= PyBUF_WRITABLE
  7676. * if format:
  7677. * flags |= PyBUF_FORMAT # <<<<<<<<<<<<<<
  7678. * PyObject_GetBuffer(ob, &view, flags)
  7679. * bptr = view.buf
  7680. */
  7681. __pyx_v_flags = (__pyx_v_flags | PyBUF_FORMAT);
  7682. goto __pyx_L6;
  7683. }
  7684. __pyx_L6:;
  7685. /* "buffers.pxd":152
  7686. * if format:
  7687. * flags |= PyBUF_FORMAT
  7688. * PyObject_GetBuffer(ob, &view, flags) # <<<<<<<<<<<<<<
  7689. * bptr = view.buf
  7690. * blen = view.len
  7691. */
  7692. __pyx_t_4 = PyObject_GetBuffer(__pyx_v_ob, (&__pyx_v_view), __pyx_v_flags); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7693. /* "buffers.pxd":153
  7694. * flags |= PyBUF_FORMAT
  7695. * PyObject_GetBuffer(ob, &view, flags)
  7696. * bptr = view.buf # <<<<<<<<<<<<<<
  7697. * blen = view.len
  7698. * if format:
  7699. */
  7700. __pyx_v_bptr = __pyx_v_view.buf;
  7701. /* "buffers.pxd":154
  7702. * PyObject_GetBuffer(ob, &view, flags)
  7703. * bptr = view.buf
  7704. * blen = view.len # <<<<<<<<<<<<<<
  7705. * if format:
  7706. * if view.format != NULL:
  7707. */
  7708. __pyx_v_blen = __pyx_v_view.len;
  7709. /* "buffers.pxd":155
  7710. * bptr = view.buf
  7711. * blen = view.len
  7712. * if format: # <<<<<<<<<<<<<<
  7713. * if view.format != NULL:
  7714. * bfmt = view.format
  7715. */
  7716. if (__pyx_v_format) {
  7717. /* "buffers.pxd":156
  7718. * blen = view.len
  7719. * if format:
  7720. * if view.format != NULL: # <<<<<<<<<<<<<<
  7721. * bfmt = view.format
  7722. * bitemlen = view.itemsize
  7723. */
  7724. __pyx_t_1 = (__pyx_v_view.format != NULL);
  7725. if (__pyx_t_1) {
  7726. /* "buffers.pxd":157
  7727. * if format:
  7728. * if view.format != NULL:
  7729. * bfmt = view.format # <<<<<<<<<<<<<<
  7730. * bitemlen = view.itemsize
  7731. * PyBuffer_Release(&view)
  7732. */
  7733. __pyx_t_2 = PyBytes_FromString(__pyx_v_view.format); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7734. __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  7735. if (!(likely(PyString_CheckExact(((PyObject *)__pyx_t_2)))||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(((PyObject *)__pyx_t_2))->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7736. __Pyx_DECREF(((PyObject *)__pyx_v_bfmt));
  7737. __pyx_v_bfmt = ((PyObject*)__pyx_t_2);
  7738. __pyx_t_2 = 0;
  7739. /* "buffers.pxd":158
  7740. * if view.format != NULL:
  7741. * bfmt = view.format
  7742. * bitemlen = view.itemsize # <<<<<<<<<<<<<<
  7743. * PyBuffer_Release(&view)
  7744. * else: # oldstyle
  7745. */
  7746. __pyx_v_bitemlen = __pyx_v_view.itemsize;
  7747. goto __pyx_L8;
  7748. }
  7749. __pyx_L8:;
  7750. goto __pyx_L7;
  7751. }
  7752. __pyx_L7:;
  7753. /* "buffers.pxd":159
  7754. * bfmt = view.format
  7755. * bitemlen = view.itemsize
  7756. * PyBuffer_Release(&view) # <<<<<<<<<<<<<<
  7757. * else: # oldstyle
  7758. * if writable:
  7759. */
  7760. PyBuffer_Release((&__pyx_v_view));
  7761. goto __pyx_L4;
  7762. }
  7763. /*else*/ {
  7764. /* "buffers.pxd":161
  7765. * PyBuffer_Release(&view)
  7766. * else: # oldstyle
  7767. * if writable: # <<<<<<<<<<<<<<
  7768. * PyObject_AsWriteBuffer(ob, &bptr, &blen)
  7769. * else:
  7770. */
  7771. if (__pyx_v_writable) {
  7772. /* "buffers.pxd":162
  7773. * else: # oldstyle
  7774. * if writable:
  7775. * PyObject_AsWriteBuffer(ob, &bptr, &blen) # <<<<<<<<<<<<<<
  7776. * else:
  7777. * PyObject_AsReadBuffer(ob, <const_void **>&bptr, &blen)
  7778. */
  7779. __pyx_t_4 = PyObject_AsWriteBuffer(__pyx_v_ob, (&__pyx_v_bptr), (&__pyx_v_blen)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7780. goto __pyx_L9;
  7781. }
  7782. /*else*/ {
  7783. /* "buffers.pxd":164
  7784. * PyObject_AsWriteBuffer(ob, &bptr, &blen)
  7785. * else:
  7786. * PyObject_AsReadBuffer(ob, <const_void **>&bptr, &blen) # <<<<<<<<<<<<<<
  7787. * if format:
  7788. * try: # numpy.ndarray
  7789. */
  7790. __pyx_t_4 = PyObject_AsReadBuffer(__pyx_v_ob, ((const void **)(&__pyx_v_bptr)), (&__pyx_v_blen)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  7791. }
  7792. __pyx_L9:;
  7793. /* "buffers.pxd":165
  7794. * else:
  7795. * PyObject_AsReadBuffer(ob, <const_void **>&bptr, &blen)
  7796. * if format: # <<<<<<<<<<<<<<
  7797. * try: # numpy.ndarray
  7798. * dtype = ob.dtype
  7799. */
  7800. if (__pyx_v_format) {
  7801. /* "buffers.pxd":166
  7802. * PyObject_AsReadBuffer(ob, <const_void **>&bptr, &blen)
  7803. * if format:
  7804. * try: # numpy.ndarray # <<<<<<<<<<<<<<
  7805. * dtype = ob.dtype
  7806. * bfmt = dtype.char
  7807. */
  7808. {
  7809. __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
  7810. __Pyx_XGOTREF(__pyx_t_5);
  7811. __Pyx_XGOTREF(__pyx_t_6);
  7812. __Pyx_XGOTREF(__pyx_t_7);
  7813. /*try:*/ {
  7814. /* "buffers.pxd":167
  7815. * if format:
  7816. * try: # numpy.ndarray
  7817. * dtype = ob.dtype # <<<<<<<<<<<<<<
  7818. * bfmt = dtype.char
  7819. * bitemlen = dtype.itemsize
  7820. */
  7821. __pyx_t_2 = PyObject_GetAttr(__pyx_v_ob, __pyx_n_s__dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
  7822. __Pyx_GOTREF(__pyx_t_2);
  7823. __pyx_v_dtype = __pyx_t_2;
  7824. __pyx_t_2 = 0;
  7825. /* "buffers.pxd":168
  7826. * try: # numpy.ndarray
  7827. * dtype = ob.dtype
  7828. * bfmt = dtype.char # <<<<<<<<<<<<<<
  7829. * bitemlen = dtype.itemsize
  7830. * except AttributeError:
  7831. */
  7832. __pyx_t_2 = PyObject_GetAttr(__pyx_v_dtype, __pyx_n_s__char); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
  7833. __Pyx_GOTREF(__pyx_t_2);
  7834. if (!(likely(PyString_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
  7835. __Pyx_DECREF(((PyObject *)__pyx_v_bfmt));
  7836. __pyx_v_bfmt = ((PyObject*)__pyx_t_2);
  7837. __pyx_t_2 = 0;
  7838. /* "buffers.pxd":169
  7839. * dtype = ob.dtype
  7840. * bfmt = dtype.char
  7841. * bitemlen = dtype.itemsize # <<<<<<<<<<<<<<
  7842. * except AttributeError:
  7843. * try: # array.array
  7844. */
  7845. __pyx_t_2 = PyObject_GetAttr(__pyx_v_dtype, __pyx_n_s__itemsize); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
  7846. __Pyx_GOTREF(__pyx_t_2);
  7847. __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
  7848. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7849. __pyx_v_bitemlen = __pyx_t_8;
  7850. }
  7851. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  7852. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  7853. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  7854. goto __pyx_L18_try_end;
  7855. __pyx_L11_error:;
  7856. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  7857. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  7858. /* "buffers.pxd":170
  7859. * bfmt = dtype.char
  7860. * bitemlen = dtype.itemsize
  7861. * except AttributeError: # <<<<<<<<<<<<<<
  7862. * try: # array.array
  7863. * bfmt = ob.typecode
  7864. */
  7865. __pyx_t_4 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
  7866. if (__pyx_t_4) {
  7867. __Pyx_AddTraceback("buffers.asbuffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7868. if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_9) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L13_except_error;}
  7869. __Pyx_GOTREF(__pyx_t_2);
  7870. __Pyx_GOTREF(__pyx_t_3);
  7871. __Pyx_GOTREF(__pyx_t_9);
  7872. /* "buffers.pxd":171
  7873. * bitemlen = dtype.itemsize
  7874. * except AttributeError:
  7875. * try: # array.array # <<<<<<<<<<<<<<
  7876. * bfmt = ob.typecode
  7877. * bitemlen = ob.itemsize
  7878. */
  7879. {
  7880. __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
  7881. __Pyx_XGOTREF(__pyx_t_10);
  7882. __Pyx_XGOTREF(__pyx_t_11);
  7883. __Pyx_XGOTREF(__pyx_t_12);
  7884. /*try:*/ {
  7885. /* "buffers.pxd":172
  7886. * except AttributeError:
  7887. * try: # array.array
  7888. * bfmt = ob.typecode # <<<<<<<<<<<<<<
  7889. * bitemlen = ob.itemsize
  7890. * except AttributeError:
  7891. */
  7892. __pyx_t_13 = PyObject_GetAttr(__pyx_v_ob, __pyx_n_s__typecode); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L21_error;}
  7893. __Pyx_GOTREF(__pyx_t_13);
  7894. if (!(likely(PyString_CheckExact(__pyx_t_13))||((__pyx_t_13) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_13)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L21_error;}
  7895. __Pyx_DECREF(((PyObject *)__pyx_v_bfmt));
  7896. __pyx_v_bfmt = ((PyObject*)__pyx_t_13);
  7897. __pyx_t_13 = 0;
  7898. /* "buffers.pxd":173
  7899. * try: # array.array
  7900. * bfmt = ob.typecode
  7901. * bitemlen = ob.itemsize # <<<<<<<<<<<<<<
  7902. * except AttributeError:
  7903. * if isinstance(ob, bytes):
  7904. */
  7905. __pyx_t_13 = PyObject_GetAttr(__pyx_v_ob, __pyx_n_s__itemsize); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L21_error;}
  7906. __Pyx_GOTREF(__pyx_t_13);
  7907. __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_13); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L21_error;}
  7908. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  7909. __pyx_v_bitemlen = __pyx_t_8;
  7910. }
  7911. __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
  7912. __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  7913. __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
  7914. goto __pyx_L28_try_end;
  7915. __pyx_L21_error:;
  7916. __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
  7917. /* "buffers.pxd":174
  7918. * bfmt = ob.typecode
  7919. * bitemlen = ob.itemsize
  7920. * except AttributeError: # <<<<<<<<<<<<<<
  7921. * if isinstance(ob, bytes):
  7922. * bfmt = "B"
  7923. */
  7924. __pyx_t_4 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
  7925. if (__pyx_t_4) {
  7926. __Pyx_AddTraceback("buffers.asbuffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7927. if (__Pyx_GetException(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
  7928. __Pyx_GOTREF(__pyx_t_13);
  7929. __Pyx_GOTREF(__pyx_t_14);
  7930. __Pyx_GOTREF(__pyx_t_15);
  7931. /* "buffers.pxd":175
  7932. * bitemlen = ob.itemsize
  7933. * except AttributeError:
  7934. * if isinstance(ob, bytes): # <<<<<<<<<<<<<<
  7935. * bfmt = "B"
  7936. * bitemlen = 1
  7937. */
  7938. __pyx_t_16 = ((PyObject *)((PyObject*)(&PyBytes_Type)));
  7939. __Pyx_INCREF(__pyx_t_16);
  7940. __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_ob, __pyx_t_16);
  7941. __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  7942. if (__pyx_t_1) {
  7943. /* "buffers.pxd":176
  7944. * except AttributeError:
  7945. * if isinstance(ob, bytes):
  7946. * bfmt = "B" # <<<<<<<<<<<<<<
  7947. * bitemlen = 1
  7948. * else:
  7949. */
  7950. __Pyx_INCREF(((PyObject *)__pyx_n_s__B));
  7951. __Pyx_DECREF(((PyObject *)__pyx_v_bfmt));
  7952. __pyx_v_bfmt = __pyx_n_s__B;
  7953. /* "buffers.pxd":177
  7954. * if isinstance(ob, bytes):
  7955. * bfmt = "B"
  7956. * bitemlen = 1 # <<<<<<<<<<<<<<
  7957. * else:
  7958. * # nothing found
  7959. */
  7960. __pyx_v_bitemlen = 1;
  7961. goto __pyx_L31;
  7962. }
  7963. /*else*/ {
  7964. /* "buffers.pxd":180
  7965. * else:
  7966. * # nothing found
  7967. * bfmt = None # <<<<<<<<<<<<<<
  7968. * bitemlen = 0
  7969. * if base: base[0] = <void *>bptr
  7970. */
  7971. __Pyx_INCREF(Py_None);
  7972. __Pyx_DECREF(((PyObject *)__pyx_v_bfmt));
  7973. __pyx_v_bfmt = ((PyObject*)Py_None);
  7974. /* "buffers.pxd":181
  7975. * # nothing found
  7976. * bfmt = None
  7977. * bitemlen = 0 # <<<<<<<<<<<<<<
  7978. * if base: base[0] = <void *>bptr
  7979. * if size: size[0] = <Py_ssize_t>blen
  7980. */
  7981. __pyx_v_bitemlen = 0;
  7982. }
  7983. __pyx_L31:;
  7984. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  7985. __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  7986. __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  7987. goto __pyx_L22_exception_handled;
  7988. }
  7989. __pyx_L23_except_error:;
  7990. __Pyx_XGIVEREF(__pyx_t_10);
  7991. __Pyx_XGIVEREF(__pyx_t_11);
  7992. __Pyx_XGIVEREF(__pyx_t_12);
  7993. __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
  7994. goto __pyx_L13_except_error;
  7995. __pyx_L22_exception_handled:;
  7996. __Pyx_XGIVEREF(__pyx_t_10);
  7997. __Pyx_XGIVEREF(__pyx_t_11);
  7998. __Pyx_XGIVEREF(__pyx_t_12);
  7999. __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
  8000. __pyx_L28_try_end:;
  8001. }
  8002. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8003. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  8004. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  8005. goto __pyx_L12_exception_handled;
  8006. }
  8007. __pyx_L13_except_error:;
  8008. __Pyx_XGIVEREF(__pyx_t_5);
  8009. __Pyx_XGIVEREF(__pyx_t_6);
  8010. __Pyx_XGIVEREF(__pyx_t_7);
  8011. __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
  8012. goto __pyx_L1_error;
  8013. __pyx_L12_exception_handled:;
  8014. __Pyx_XGIVEREF(__pyx_t_5);
  8015. __Pyx_XGIVEREF(__pyx_t_6);
  8016. __Pyx_XGIVEREF(__pyx_t_7);
  8017. __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
  8018. __pyx_L18_try_end:;
  8019. }
  8020. goto __pyx_L10;
  8021. }
  8022. __pyx_L10:;
  8023. }
  8024. __pyx_L4:;
  8025. /* "buffers.pxd":182
  8026. * bfmt = None
  8027. * bitemlen = 0
  8028. * if base: base[0] = <void *>bptr # <<<<<<<<<<<<<<
  8029. * if size: size[0] = <Py_ssize_t>blen
  8030. * if itemsize: itemsize[0] = <Py_ssize_t>bitemlen
  8031. */
  8032. __pyx_t_1 = (__pyx_v_base != 0);
  8033. if (__pyx_t_1) {
  8034. (__pyx_v_base[0]) = ((void *)__pyx_v_bptr);
  8035. goto __pyx_L32;
  8036. }
  8037. __pyx_L32:;
  8038. /* "buffers.pxd":183
  8039. * bitemlen = 0
  8040. * if base: base[0] = <void *>bptr
  8041. * if size: size[0] = <Py_ssize_t>blen # <<<<<<<<<<<<<<
  8042. * if itemsize: itemsize[0] = <Py_ssize_t>bitemlen
  8043. * return bfmt
  8044. */
  8045. __pyx_t_1 = (__pyx_v_size != 0);
  8046. if (__pyx_t_1) {
  8047. (__pyx_v_size[0]) = ((Py_ssize_t)__pyx_v_blen);
  8048. goto __pyx_L33;
  8049. }
  8050. __pyx_L33:;
  8051. /* "buffers.pxd":184
  8052. * if base: base[0] = <void *>bptr
  8053. * if size: size[0] = <Py_ssize_t>blen
  8054. * if itemsize: itemsize[0] = <Py_ssize_t>bitemlen # <<<<<<<<<<<<<<
  8055. * return bfmt
  8056. *
  8057. */
  8058. __pyx_t_1 = (__pyx_v_itemsize != 0);
  8059. if (__pyx_t_1) {
  8060. (__pyx_v_itemsize[0]) = ((Py_ssize_t)__pyx_v_bitemlen);
  8061. goto __pyx_L34;
  8062. }
  8063. __pyx_L34:;
  8064. /* "buffers.pxd":185
  8065. * if size: size[0] = <Py_ssize_t>blen
  8066. * if itemsize: itemsize[0] = <Py_ssize_t>bitemlen
  8067. * return bfmt # <<<<<<<<<<<<<<
  8068. *
  8069. *
  8070. */
  8071. __Pyx_XDECREF(__pyx_r);
  8072. __Pyx_INCREF(((PyObject *)__pyx_v_bfmt));
  8073. __pyx_r = ((PyObject *)__pyx_v_bfmt);
  8074. goto __pyx_L0;
  8075. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  8076. goto __pyx_L0;
  8077. __pyx_L1_error:;
  8078. __Pyx_XDECREF(__pyx_t_2);
  8079. __Pyx_XDECREF(__pyx_t_3);
  8080. __Pyx_XDECREF(__pyx_t_9);
  8081. __Pyx_XDECREF(__pyx_t_13);
  8082. __Pyx_XDECREF(__pyx_t_14);
  8083. __Pyx_XDECREF(__pyx_t_15);
  8084. __Pyx_XDECREF(__pyx_t_16);
  8085. __Pyx_AddTraceback("buffers.asbuffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8086. __pyx_r = 0;
  8087. __pyx_L0:;
  8088. __Pyx_XDECREF(__pyx_v_bfmt);
  8089. __Pyx_XDECREF(__pyx_v_dtype);
  8090. __Pyx_XGIVEREF(__pyx_r);
  8091. __Pyx_RefNannyFinishContext();
  8092. return __pyx_r;
  8093. }
  8094. /* "buffers.pxd":188
  8095. *
  8096. *
  8097. * cdef inline object asbuffer_r(object ob, void **base, Py_ssize_t *size): # <<<<<<<<<<<<<<
  8098. * """Wrapper for standard calls to asbuffer with a readonly buffer."""
  8099. * asbuffer(ob, 0, 0, base, size, NULL)
  8100. */
  8101. static CYTHON_INLINE PyObject *__pyx_f_7buffers_asbuffer_r(PyObject *__pyx_v_ob, void **__pyx_v_base, Py_ssize_t *__pyx_v_size) {
  8102. PyObject *__pyx_r = NULL;
  8103. __Pyx_RefNannyDeclarations
  8104. PyObject *__pyx_t_1 = NULL;
  8105. int __pyx_lineno = 0;
  8106. const char *__pyx_filename = NULL;
  8107. int __pyx_clineno = 0;
  8108. __Pyx_RefNannySetupContext("asbuffer_r");
  8109. /* "buffers.pxd":190
  8110. * cdef inline object asbuffer_r(object ob, void **base, Py_ssize_t *size):
  8111. * """Wrapper for standard calls to asbuffer with a readonly buffer."""
  8112. * asbuffer(ob, 0, 0, base, size, NULL) # <<<<<<<<<<<<<<
  8113. * return ob
  8114. *
  8115. */
  8116. __pyx_t_1 = __pyx_f_7buffers_asbuffer(__pyx_v_ob, 0, 0, __pyx_v_base, __pyx_v_size, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  8117. __Pyx_GOTREF(__pyx_t_1);
  8118. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8119. /* "buffers.pxd":191
  8120. * """Wrapper for standard calls to asbuffer with a readonly buffer."""
  8121. * asbuffer(ob, 0, 0, base, size, NULL)
  8122. * return ob # <<<<<<<<<<<<<<
  8123. *
  8124. *
  8125. */
  8126. __Pyx_XDECREF(__pyx_r);
  8127. __Pyx_INCREF(__pyx_v_ob);
  8128. __pyx_r = __pyx_v_ob;
  8129. goto __pyx_L0;
  8130. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  8131. goto __pyx_L0;
  8132. __pyx_L1_error:;
  8133. __Pyx_XDECREF(__pyx_t_1);
  8134. __Pyx_AddTraceback("buffers.asbuffer_r", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8135. __pyx_r = 0;
  8136. __pyx_L0:;
  8137. __Pyx_XGIVEREF(__pyx_r);
  8138. __Pyx_RefNannyFinishContext();
  8139. return __pyx_r;
  8140. }
  8141. /* "buffers.pxd":194
  8142. *
  8143. *
  8144. * cdef inline object asbuffer_w(object ob, void **base, Py_ssize_t *size): # <<<<<<<<<<<<<<
  8145. * """Wrapper for standard calls to asbuffer with a writable buffer."""
  8146. * asbuffer(ob, 1, 0, base, size, NULL)
  8147. */
  8148. static CYTHON_INLINE PyObject *__pyx_f_7buffers_asbuffer_w(PyObject *__pyx_v_ob, void **__pyx_v_base, Py_ssize_t *__pyx_v_size) {
  8149. PyObject *__pyx_r = NULL;
  8150. __Pyx_RefNannyDeclarations
  8151. PyObject *__pyx_t_1 = NULL;
  8152. int __pyx_lineno = 0;
  8153. const char *__pyx_filename = NULL;
  8154. int __pyx_clineno = 0;
  8155. __Pyx_RefNannySetupContext("asbuffer_w");
  8156. /* "buffers.pxd":196
  8157. * cdef inline object asbuffer_w(object ob, void **base, Py_ssize_t *size):
  8158. * """Wrapper for standard calls to asbuffer with a writable buffer."""
  8159. * asbuffer(ob, 1, 0, base, size, NULL) # <<<<<<<<<<<<<<
  8160. * return ob
  8161. *
  8162. */
  8163. __pyx_t_1 = __pyx_f_7buffers_asbuffer(__pyx_v_ob, 1, 0, __pyx_v_base, __pyx_v_size, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  8164. __Pyx_GOTREF(__pyx_t_1);
  8165. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8166. /* "buffers.pxd":197
  8167. * """Wrapper for standard calls to asbuffer with a writable buffer."""
  8168. * asbuffer(ob, 1, 0, base, size, NULL)
  8169. * return ob # <<<<<<<<<<<<<<
  8170. *
  8171. * #------------------------------------------------------------------------------
  8172. */
  8173. __Pyx_XDECREF(__pyx_r);
  8174. __Pyx_INCREF(__pyx_v_ob);
  8175. __pyx_r = __pyx_v_ob;
  8176. goto __pyx_L0;
  8177. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  8178. goto __pyx_L0;
  8179. __pyx_L1_error:;
  8180. __Pyx_XDECREF(__pyx_t_1);
  8181. __Pyx_AddTraceback("buffers.asbuffer_w", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8182. __pyx_r = 0;
  8183. __pyx_L0:;
  8184. __Pyx_XGIVEREF(__pyx_r);
  8185. __Pyx_RefNannyFinishContext();
  8186. return __pyx_r;
  8187. }
  8188. /* "buffers.pxd":203
  8189. * #------------------------------------------------------------------------------
  8190. *
  8191. * cdef inline object frombuffer_3(void *ptr, Py_ssize_t s, int readonly): # <<<<<<<<<<<<<<
  8192. * """Python 3 version of frombuffer.
  8193. *
  8194. */
  8195. static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer_3(void *__pyx_v_ptr, Py_ssize_t __pyx_v_s, int __pyx_v_readonly) {
  8196. Py_buffer __pyx_v_pybuf;
  8197. Py_ssize_t *__pyx_v_shape;
  8198. PyObject *__pyx_v_astr = 0;
  8199. PyObject *__pyx_r = NULL;
  8200. __Pyx_RefNannyDeclarations
  8201. Py_ssize_t __pyx_t_1[1];
  8202. int __pyx_t_2;
  8203. PyObject *__pyx_t_3 = NULL;
  8204. int __pyx_lineno = 0;
  8205. const char *__pyx_filename = NULL;
  8206. int __pyx_clineno = 0;
  8207. __Pyx_RefNannySetupContext("frombuffer_3");
  8208. /* "buffers.pxd":210
  8209. * """
  8210. * cdef Py_buffer pybuf
  8211. * cdef Py_ssize_t *shape = [s] # <<<<<<<<<<<<<<
  8212. * cdef str astr=""
  8213. * if newstyle_available():
  8214. */
  8215. __pyx_t_1[0] = __pyx_v_s;
  8216. __pyx_v_shape = __pyx_t_1;
  8217. /* "buffers.pxd":211
  8218. * cdef Py_buffer pybuf
  8219. * cdef Py_ssize_t *shape = [s]
  8220. * cdef str astr="" # <<<<<<<<<<<<<<
  8221. * if newstyle_available():
  8222. * PyBuffer_FillInfo(&pybuf, astr, ptr, s, readonly, PyBUF_SIMPLE)
  8223. */
  8224. __Pyx_INCREF(((PyObject *)__pyx_kp_s_37));
  8225. __pyx_v_astr = __pyx_kp_s_37;
  8226. /* "buffers.pxd":212
  8227. * cdef Py_ssize_t *shape = [s]
  8228. * cdef str astr=""
  8229. * if newstyle_available(): # <<<<<<<<<<<<<<
  8230. * PyBuffer_FillInfo(&pybuf, astr, ptr, s, readonly, PyBUF_SIMPLE)
  8231. * pybuf.format = "B"
  8232. */
  8233. __pyx_t_2 = __pyx_f_7buffers_newstyle_available();
  8234. if (__pyx_t_2) {
  8235. /* "buffers.pxd":213
  8236. * cdef str astr=""
  8237. * if newstyle_available():
  8238. * PyBuffer_FillInfo(&pybuf, astr, ptr, s, readonly, PyBUF_SIMPLE) # <<<<<<<<<<<<<<
  8239. * pybuf.format = "B"
  8240. * pybuf.shape = shape
  8241. */
  8242. __pyx_t_2 = PyBuffer_FillInfo((&__pyx_v_pybuf), ((PyObject *)__pyx_v_astr), __pyx_v_ptr, __pyx_v_s, __pyx_v_readonly, PyBUF_SIMPLE); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  8243. /* "buffers.pxd":214
  8244. * if newstyle_available():
  8245. * PyBuffer_FillInfo(&pybuf, astr, ptr, s, readonly, PyBUF_SIMPLE)
  8246. * pybuf.format = "B" # <<<<<<<<<<<<<<
  8247. * pybuf.shape = shape
  8248. * return PyMemoryView_FromBuffer(&pybuf)
  8249. */
  8250. __pyx_v_pybuf.format = __pyx_k__B;
  8251. /* "buffers.pxd":215
  8252. * PyBuffer_FillInfo(&pybuf, astr, ptr, s, readonly, PyBUF_SIMPLE)
  8253. * pybuf.format = "B"
  8254. * pybuf.shape = shape # <<<<<<<<<<<<<<
  8255. * return PyMemoryView_FromBuffer(&pybuf)
  8256. * else:
  8257. */
  8258. __pyx_v_pybuf.shape = __pyx_v_shape;
  8259. /* "buffers.pxd":216
  8260. * pybuf.format = "B"
  8261. * pybuf.shape = shape
  8262. * return PyMemoryView_FromBuffer(&pybuf) # <<<<<<<<<<<<<<
  8263. * else:
  8264. * raise NotImplementedError("New style buffers not available.")
  8265. */
  8266. __Pyx_XDECREF(__pyx_r);
  8267. __pyx_t_3 = PyMemoryView_FromBuffer((&__pyx_v_pybuf)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  8268. __Pyx_GOTREF(__pyx_t_3);
  8269. __pyx_r = __pyx_t_3;
  8270. __pyx_t_3 = 0;
  8271. goto __pyx_L0;
  8272. goto __pyx_L3;
  8273. }
  8274. /*else*/ {
  8275. /* "buffers.pxd":218
  8276. * return PyMemoryView_FromBuffer(&pybuf)
  8277. * else:
  8278. * raise NotImplementedError("New style buffers not available.") # <<<<<<<<<<<<<<
  8279. *
  8280. *
  8281. */
  8282. __pyx_t_3 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_k_tuple_39), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  8283. __Pyx_GOTREF(__pyx_t_3);
  8284. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  8285. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  8286. {__pyx_filename = __pyx_f[2]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  8287. }
  8288. __pyx_L3:;
  8289. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  8290. goto __pyx_L0;
  8291. __pyx_L1_error:;
  8292. __Pyx_XDECREF(__pyx_t_3);
  8293. __Pyx_AddTraceback("buffers.frombuffer_3", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8294. __pyx_r = 0;
  8295. __pyx_L0:;
  8296. __Pyx_XDECREF(__pyx_v_astr);
  8297. __Pyx_XGIVEREF(__pyx_r);
  8298. __Pyx_RefNannyFinishContext();
  8299. return __pyx_r;
  8300. }
  8301. /* "buffers.pxd":221
  8302. *
  8303. *
  8304. * cdef inline object frombuffer_2(void *ptr, Py_ssize_t s, int readonly): # <<<<<<<<<<<<<<
  8305. * """Python 2 version of frombuffer.
  8306. *
  8307. */
  8308. static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer_2(void *__pyx_v_ptr, Py_ssize_t __pyx_v_s, int __pyx_v_readonly) {
  8309. PyObject *__pyx_r = NULL;
  8310. __Pyx_RefNannyDeclarations
  8311. int __pyx_t_1;
  8312. PyObject *__pyx_t_2 = NULL;
  8313. int __pyx_lineno = 0;
  8314. const char *__pyx_filename = NULL;
  8315. int __pyx_clineno = 0;
  8316. __Pyx_RefNannySetupContext("frombuffer_2");
  8317. /* "buffers.pxd":227
  8318. * """
  8319. *
  8320. * if oldstyle_available(): # <<<<<<<<<<<<<<
  8321. * if readonly:
  8322. * return PyBuffer_FromMemory(ptr, s)
  8323. */
  8324. __pyx_t_1 = __pyx_f_7buffers_oldstyle_available();
  8325. if (__pyx_t_1) {
  8326. /* "buffers.pxd":228
  8327. *
  8328. * if oldstyle_available():
  8329. * if readonly: # <<<<<<<<<<<<<<
  8330. * return PyBuffer_FromMemory(ptr, s)
  8331. * else:
  8332. */
  8333. if (__pyx_v_readonly) {
  8334. /* "buffers.pxd":229
  8335. * if oldstyle_available():
  8336. * if readonly:
  8337. * return PyBuffer_FromMemory(ptr, s) # <<<<<<<<<<<<<<
  8338. * else:
  8339. * return PyBuffer_FromReadWriteMemory(ptr, s)
  8340. */
  8341. __Pyx_XDECREF(__pyx_r);
  8342. __pyx_t_2 = PyBuffer_FromMemory(__pyx_v_ptr, __pyx_v_s); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  8343. __Pyx_GOTREF(__pyx_t_2);
  8344. __pyx_r = __pyx_t_2;
  8345. __pyx_t_2 = 0;
  8346. goto __pyx_L0;
  8347. goto __pyx_L4;
  8348. }
  8349. /*else*/ {
  8350. /* "buffers.pxd":231
  8351. * return PyBuffer_FromMemory(ptr, s)
  8352. * else:
  8353. * return PyBuffer_FromReadWriteMemory(ptr, s) # <<<<<<<<<<<<<<
  8354. * else:
  8355. * raise NotImplementedError("Old style buffers not available.")
  8356. */
  8357. __Pyx_XDECREF(__pyx_r);
  8358. __pyx_t_2 = PyBuffer_FromReadWriteMemory(__pyx_v_ptr, __pyx_v_s); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  8359. __Pyx_GOTREF(__pyx_t_2);
  8360. __pyx_r = __pyx_t_2;
  8361. __pyx_t_2 = 0;
  8362. goto __pyx_L0;
  8363. }
  8364. __pyx_L4:;
  8365. goto __pyx_L3;
  8366. }
  8367. /*else*/ {
  8368. /* "buffers.pxd":233
  8369. * return PyBuffer_FromReadWriteMemory(ptr, s)
  8370. * else:
  8371. * raise NotImplementedError("Old style buffers not available.") # <<<<<<<<<<<<<<
  8372. *
  8373. *
  8374. */
  8375. __pyx_t_2 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_k_tuple_41), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  8376. __Pyx_GOTREF(__pyx_t_2);
  8377. __Pyx_Raise(__pyx_t_2, 0, 0, 0);
  8378. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8379. {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  8380. }
  8381. __pyx_L3:;
  8382. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  8383. goto __pyx_L0;
  8384. __pyx_L1_error:;
  8385. __Pyx_XDECREF(__pyx_t_2);
  8386. __Pyx_AddTraceback("buffers.frombuffer_2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8387. __pyx_r = 0;
  8388. __pyx_L0:;
  8389. __Pyx_XGIVEREF(__pyx_r);
  8390. __Pyx_RefNannyFinishContext();
  8391. return __pyx_r;
  8392. }
  8393. /* "buffers.pxd":236
  8394. *
  8395. *
  8396. * cdef inline object frombuffer(void *ptr, Py_ssize_t s, int readonly): # <<<<<<<<<<<<<<
  8397. * """Create a Python Buffer/View of a C array.
  8398. *
  8399. */
  8400. static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer(void *__pyx_v_ptr, Py_ssize_t __pyx_v_s, int __pyx_v_readonly) {
  8401. PyObject *__pyx_r = NULL;
  8402. __Pyx_RefNannyDeclarations
  8403. int __pyx_t_1;
  8404. PyObject *__pyx_t_2 = NULL;
  8405. int __pyx_lineno = 0;
  8406. const char *__pyx_filename = NULL;
  8407. int __pyx_clineno = 0;
  8408. __Pyx_RefNannySetupContext("frombuffer");
  8409. /* "buffers.pxd":253
  8410. * """
  8411. * # oldstyle first priority for now
  8412. * if oldstyle_available(): # <<<<<<<<<<<<<<
  8413. * return frombuffer_2(ptr, s, readonly)
  8414. * else:
  8415. */
  8416. __pyx_t_1 = __pyx_f_7buffers_oldstyle_available();
  8417. if (__pyx_t_1) {
  8418. /* "buffers.pxd":254
  8419. * # oldstyle first priority for now
  8420. * if oldstyle_available():
  8421. * return frombuffer_2(ptr, s, readonly) # <<<<<<<<<<<<<<
  8422. * else:
  8423. * return frombuffer_3(ptr, s, readonly)
  8424. */
  8425. __Pyx_XDECREF(__pyx_r);
  8426. __pyx_t_2 = __pyx_f_7buffers_frombuffer_2(__pyx_v_ptr, __pyx_v_s, __pyx_v_readonly); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  8427. __Pyx_GOTREF(__pyx_t_2);
  8428. __pyx_r = __pyx_t_2;
  8429. __pyx_t_2 = 0;
  8430. goto __pyx_L0;
  8431. goto __pyx_L3;
  8432. }
  8433. /*else*/ {
  8434. /* "buffers.pxd":256
  8435. * return frombuffer_2(ptr, s, readonly)
  8436. * else:
  8437. * return frombuffer_3(ptr, s, readonly) # <<<<<<<<<<<<<<
  8438. *
  8439. *
  8440. */
  8441. __Pyx_XDECREF(__pyx_r);
  8442. __pyx_t_2 = __pyx_f_7buffers_frombuffer_3(__pyx_v_ptr, __pyx_v_s, __pyx_v_readonly); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  8443. __Pyx_GOTREF(__pyx_t_2);
  8444. __pyx_r = __pyx_t_2;
  8445. __pyx_t_2 = 0;
  8446. goto __pyx_L0;
  8447. }
  8448. __pyx_L3:;
  8449. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  8450. goto __pyx_L0;
  8451. __pyx_L1_error:;
  8452. __Pyx_XDECREF(__pyx_t_2);
  8453. __Pyx_AddTraceback("buffers.frombuffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8454. __pyx_r = 0;
  8455. __pyx_L0:;
  8456. __Pyx_XGIVEREF(__pyx_r);
  8457. __Pyx_RefNannyFinishContext();
  8458. return __pyx_r;
  8459. }
  8460. /* "buffers.pxd":259
  8461. *
  8462. *
  8463. * cdef inline object frombuffer_r(void *ptr, Py_ssize_t s): # <<<<<<<<<<<<<<
  8464. * """Wrapper for readonly view frombuffer."""
  8465. * return frombuffer(ptr, s, 1)
  8466. */
  8467. static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer_r(void *__pyx_v_ptr, Py_ssize_t __pyx_v_s) {
  8468. PyObject *__pyx_r = NULL;
  8469. __Pyx_RefNannyDeclarations
  8470. PyObject *__pyx_t_1 = NULL;
  8471. int __pyx_lineno = 0;
  8472. const char *__pyx_filename = NULL;
  8473. int __pyx_clineno = 0;
  8474. __Pyx_RefNannySetupContext("frombuffer_r");
  8475. /* "buffers.pxd":261
  8476. * cdef inline object frombuffer_r(void *ptr, Py_ssize_t s):
  8477. * """Wrapper for readonly view frombuffer."""
  8478. * return frombuffer(ptr, s, 1) # <<<<<<<<<<<<<<
  8479. *
  8480. *
  8481. */
  8482. __Pyx_XDECREF(__pyx_r);
  8483. __pyx_t_1 = __pyx_f_7buffers_frombuffer(__pyx_v_ptr, __pyx_v_s, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  8484. __Pyx_GOTREF(__pyx_t_1);
  8485. __pyx_r = __pyx_t_1;
  8486. __pyx_t_1 = 0;
  8487. goto __pyx_L0;
  8488. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  8489. goto __pyx_L0;
  8490. __pyx_L1_error:;
  8491. __Pyx_XDECREF(__pyx_t_1);
  8492. __Pyx_AddTraceback("buffers.frombuffer_r", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8493. __pyx_r = 0;
  8494. __pyx_L0:;
  8495. __Pyx_XGIVEREF(__pyx_r);
  8496. __Pyx_RefNannyFinishContext();
  8497. return __pyx_r;
  8498. }
  8499. /* "buffers.pxd":264
  8500. *
  8501. *
  8502. * cdef inline object frombuffer_w(void *ptr, Py_ssize_t s): # <<<<<<<<<<<<<<
  8503. * """Wrapper for writable view frombuffer."""
  8504. * return frombuffer(ptr, s, 0)
  8505. */
  8506. static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer_w(void *__pyx_v_ptr, Py_ssize_t __pyx_v_s) {
  8507. PyObject *__pyx_r = NULL;
  8508. __Pyx_RefNannyDeclarations
  8509. PyObject *__pyx_t_1 = NULL;
  8510. int __pyx_lineno = 0;
  8511. const char *__pyx_filename = NULL;
  8512. int __pyx_clineno = 0;
  8513. __Pyx_RefNannySetupContext("frombuffer_w");
  8514. /* "buffers.pxd":266
  8515. * cdef inline object frombuffer_w(void *ptr, Py_ssize_t s):
  8516. * """Wrapper for writable view frombuffer."""
  8517. * return frombuffer(ptr, s, 0) # <<<<<<<<<<<<<<
  8518. *
  8519. * #------------------------------------------------------------------------------
  8520. */
  8521. __Pyx_XDECREF(__pyx_r);
  8522. __pyx_t_1 = __pyx_f_7buffers_frombuffer(__pyx_v_ptr, __pyx_v_s, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  8523. __Pyx_GOTREF(__pyx_t_1);
  8524. __pyx_r = __pyx_t_1;
  8525. __pyx_t_1 = 0;
  8526. goto __pyx_L0;
  8527. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  8528. goto __pyx_L0;
  8529. __pyx_L1_error:;
  8530. __Pyx_XDECREF(__pyx_t_1);
  8531. __Pyx_AddTraceback("buffers.frombuffer_w", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8532. __pyx_r = 0;
  8533. __pyx_L0:;
  8534. __Pyx_XGIVEREF(__pyx_r);
  8535. __Pyx_RefNannyFinishContext();
  8536. return __pyx_r;
  8537. }
  8538. /* "buffers.pxd":273
  8539. * #------------------------------------------------------------------------------
  8540. *
  8541. * cdef inline object viewfromobject(object obj, int readonly): # <<<<<<<<<<<<<<
  8542. * """Construct a Python Buffer/View object from another Python object.
  8543. *
  8544. */
  8545. static CYTHON_INLINE PyObject *__pyx_f_7buffers_viewfromobject(PyObject *__pyx_v_obj, int __pyx_v_readonly) {
  8546. PyObject *__pyx_r = NULL;
  8547. __Pyx_RefNannyDeclarations
  8548. int __pyx_t_1;
  8549. PyObject *__pyx_t_2 = NULL;
  8550. int __pyx_lineno = 0;
  8551. const char *__pyx_filename = NULL;
  8552. int __pyx_clineno = 0;
  8553. __Pyx_RefNannySetupContext("viewfromobject");
  8554. /* "buffers.pxd":289
  8555. * Buffer/View of the original object.
  8556. * """
  8557. * if not memoryview_available(): # <<<<<<<<<<<<<<
  8558. * if readonly:
  8559. * return PyBuffer_FromObject(obj, 0, Py_END_OF_BUFFER)
  8560. */
  8561. __pyx_t_1 = (!__pyx_f_7buffers_memoryview_available());
  8562. if (__pyx_t_1) {
  8563. /* "buffers.pxd":290
  8564. * """
  8565. * if not memoryview_available():
  8566. * if readonly: # <<<<<<<<<<<<<<
  8567. * return PyBuffer_FromObject(obj, 0, Py_END_OF_BUFFER)
  8568. * else:
  8569. */
  8570. if (__pyx_v_readonly) {
  8571. /* "buffers.pxd":291
  8572. * if not memoryview_available():
  8573. * if readonly:
  8574. * return PyBuffer_FromObject(obj, 0, Py_END_OF_BUFFER) # <<<<<<<<<<<<<<
  8575. * else:
  8576. * return PyBuffer_FromReadWriteObject(obj, 0, Py_END_OF_BUFFER)
  8577. */
  8578. __Pyx_XDECREF(__pyx_r);
  8579. __pyx_t_2 = PyBuffer_FromObject(__pyx_v_obj, 0, Py_END_OF_BUFFER); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  8580. __Pyx_GOTREF(__pyx_t_2);
  8581. __pyx_r = __pyx_t_2;
  8582. __pyx_t_2 = 0;
  8583. goto __pyx_L0;
  8584. goto __pyx_L4;
  8585. }
  8586. /*else*/ {
  8587. /* "buffers.pxd":293
  8588. * return PyBuffer_FromObject(obj, 0, Py_END_OF_BUFFER)
  8589. * else:
  8590. * return PyBuffer_FromReadWriteObject(obj, 0, Py_END_OF_BUFFER) # <<<<<<<<<<<<<<
  8591. * else:
  8592. * return PyMemoryView_FromObject(obj)
  8593. */
  8594. __Pyx_XDECREF(__pyx_r);
  8595. __pyx_t_2 = PyBuffer_FromReadWriteObject(__pyx_v_obj, 0, Py_END_OF_BUFFER); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  8596. __Pyx_GOTREF(__pyx_t_2);
  8597. __pyx_r = __pyx_t_2;
  8598. __pyx_t_2 = 0;
  8599. goto __pyx_L0;
  8600. }
  8601. __pyx_L4:;
  8602. goto __pyx_L3;
  8603. }
  8604. /*else*/ {
  8605. /* "buffers.pxd":295
  8606. * return PyBuffer_FromReadWriteObject(obj, 0, Py_END_OF_BUFFER)
  8607. * else:
  8608. * return PyMemoryView_FromObject(obj) # <<<<<<<<<<<<<<
  8609. *
  8610. *
  8611. */
  8612. __Pyx_XDECREF(__pyx_r);
  8613. __pyx_t_2 = PyMemoryView_FromObject(__pyx_v_obj); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  8614. __Pyx_GOTREF(__pyx_t_2);
  8615. __pyx_r = __pyx_t_2;
  8616. __pyx_t_2 = 0;
  8617. goto __pyx_L0;
  8618. }
  8619. __pyx_L3:;
  8620. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  8621. goto __pyx_L0;
  8622. __pyx_L1_error:;
  8623. __Pyx_XDECREF(__pyx_t_2);
  8624. __Pyx_AddTraceback("buffers.viewfromobject", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8625. __pyx_r = 0;
  8626. __pyx_L0:;
  8627. __Pyx_XGIVEREF(__pyx_r);
  8628. __Pyx_RefNannyFinishContext();
  8629. return __pyx_r;
  8630. }
  8631. /* "buffers.pxd":298
  8632. *
  8633. *
  8634. * cdef inline object viewfromobject_r(object obj): # <<<<<<<<<<<<<<
  8635. * """Wrapper for readonly viewfromobject."""
  8636. * return viewfromobject(obj, 1)
  8637. */
  8638. static CYTHON_INLINE PyObject *__pyx_f_7buffers_viewfromobject_r(PyObject *__pyx_v_obj) {
  8639. PyObject *__pyx_r = NULL;
  8640. __Pyx_RefNannyDeclarations
  8641. PyObject *__pyx_t_1 = NULL;
  8642. int __pyx_lineno = 0;
  8643. const char *__pyx_filename = NULL;
  8644. int __pyx_clineno = 0;
  8645. __Pyx_RefNannySetupContext("viewfromobject_r");
  8646. /* "buffers.pxd":300
  8647. * cdef inline object viewfromobject_r(object obj):
  8648. * """Wrapper for readonly viewfromobject."""
  8649. * return viewfromobject(obj, 1) # <<<<<<<<<<<<<<
  8650. *
  8651. *
  8652. */
  8653. __Pyx_XDECREF(__pyx_r);
  8654. __pyx_t_1 = __pyx_f_7buffers_viewfromobject(__pyx_v_obj, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  8655. __Pyx_GOTREF(__pyx_t_1);
  8656. __pyx_r = __pyx_t_1;
  8657. __pyx_t_1 = 0;
  8658. goto __pyx_L0;
  8659. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  8660. goto __pyx_L0;
  8661. __pyx_L1_error:;
  8662. __Pyx_XDECREF(__pyx_t_1);
  8663. __Pyx_AddTraceback("buffers.viewfromobject_r", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8664. __pyx_r = 0;
  8665. __pyx_L0:;
  8666. __Pyx_XGIVEREF(__pyx_r);
  8667. __Pyx_RefNannyFinishContext();
  8668. return __pyx_r;
  8669. }
  8670. /* "buffers.pxd":303
  8671. *
  8672. *
  8673. * cdef inline object viewfromobject_w(object obj): # <<<<<<<<<<<<<<
  8674. * """Wrapper for writable viewfromobject."""
  8675. * return viewfromobject(obj, 0)
  8676. */
  8677. static CYTHON_INLINE PyObject *__pyx_f_7buffers_viewfromobject_w(PyObject *__pyx_v_obj) {
  8678. PyObject *__pyx_r = NULL;
  8679. __Pyx_RefNannyDeclarations
  8680. PyObject *__pyx_t_1 = NULL;
  8681. int __pyx_lineno = 0;
  8682. const char *__pyx_filename = NULL;
  8683. int __pyx_clineno = 0;
  8684. __Pyx_RefNannySetupContext("viewfromobject_w");
  8685. /* "buffers.pxd":305
  8686. * cdef inline object viewfromobject_w(object obj):
  8687. * """Wrapper for writable viewfromobject."""
  8688. * return viewfromobject(obj, 0) # <<<<<<<<<<<<<<
  8689. */
  8690. __Pyx_XDECREF(__pyx_r);
  8691. __pyx_t_1 = __pyx_f_7buffers_viewfromobject(__pyx_v_obj, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  8692. __Pyx_GOTREF(__pyx_t_1);
  8693. __pyx_r = __pyx_t_1;
  8694. __pyx_t_1 = 0;
  8695. goto __pyx_L0;
  8696. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  8697. goto __pyx_L0;
  8698. __pyx_L1_error:;
  8699. __Pyx_XDECREF(__pyx_t_1);
  8700. __Pyx_AddTraceback("buffers.viewfromobject_w", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8701. __pyx_r = 0;
  8702. __pyx_L0:;
  8703. __Pyx_XGIVEREF(__pyx_r);
  8704. __Pyx_RefNannyFinishContext();
  8705. return __pyx_r;
  8706. }
  8707. static struct __pyx_vtabstruct_3zmq_4core_6socket_Socket __pyx_vtable_3zmq_4core_6socket_Socket;
  8708. static PyObject *__pyx_tp_new_3zmq_4core_6socket_Socket(PyTypeObject *t, PyObject *a, PyObject *k) {
  8709. struct __pyx_obj_3zmq_4core_6socket_Socket *p;
  8710. PyObject *o = (*t->tp_alloc)(t, 0);
  8711. if (!o) return 0;
  8712. p = ((struct __pyx_obj_3zmq_4core_6socket_Socket *)o);
  8713. p->__pyx_vtab = __pyx_vtabptr_3zmq_4core_6socket_Socket;
  8714. p->context = ((struct __pyx_obj_3zmq_4core_7context_Context *)Py_None); Py_INCREF(Py_None);
  8715. p->_attrs = ((PyObject*)Py_None); Py_INCREF(Py_None);
  8716. if (__pyx_pf_3zmq_4core_6socket_6Socket___cinit__(o, a, k) < 0) {
  8717. Py_DECREF(o); o = 0;
  8718. }
  8719. return o;
  8720. }
  8721. static void __pyx_tp_dealloc_3zmq_4core_6socket_Socket(PyObject *o) {
  8722. struct __pyx_obj_3zmq_4core_6socket_Socket *p = (struct __pyx_obj_3zmq_4core_6socket_Socket *)o;
  8723. {
  8724. PyObject *etype, *eval, *etb;
  8725. PyErr_Fetch(&etype, &eval, &etb);
  8726. ++Py_REFCNT(o);
  8727. __pyx_pf_3zmq_4core_6socket_6Socket_2__dealloc__(o);
  8728. if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
  8729. --Py_REFCNT(o);
  8730. PyErr_Restore(etype, eval, etb);
  8731. }
  8732. Py_XDECREF(((PyObject *)p->context));
  8733. Py_XDECREF(((PyObject *)p->_attrs));
  8734. (*Py_TYPE(o)->tp_free)(o);
  8735. }
  8736. static int __pyx_tp_traverse_3zmq_4core_6socket_Socket(PyObject *o, visitproc v, void *a) {
  8737. int e;
  8738. struct __pyx_obj_3zmq_4core_6socket_Socket *p = (struct __pyx_obj_3zmq_4core_6socket_Socket *)o;
  8739. if (p->context) {
  8740. e = (*v)(((PyObject*)p->context), a); if (e) return e;
  8741. }
  8742. if (p->_attrs) {
  8743. e = (*v)(p->_attrs, a); if (e) return e;
  8744. }
  8745. return 0;
  8746. }
  8747. static int __pyx_tp_clear_3zmq_4core_6socket_Socket(PyObject *o) {
  8748. struct __pyx_obj_3zmq_4core_6socket_Socket *p = (struct __pyx_obj_3zmq_4core_6socket_Socket *)o;
  8749. PyObject* tmp;
  8750. tmp = ((PyObject*)p->context);
  8751. p->context = ((struct __pyx_obj_3zmq_4core_7context_Context *)Py_None); Py_INCREF(Py_None);
  8752. Py_XDECREF(tmp);
  8753. tmp = ((PyObject*)p->_attrs);
  8754. p->_attrs = ((PyObject*)Py_None); Py_INCREF(Py_None);
  8755. Py_XDECREF(tmp);
  8756. return 0;
  8757. }
  8758. static PyObject *__pyx_tp_getattro_3zmq_4core_6socket_Socket(PyObject *o, PyObject *n) {
  8759. PyObject *v = PyObject_GenericGetAttr(o, n);
  8760. if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
  8761. PyErr_Clear();
  8762. v = __pyx_pf_3zmq_4core_6socket_6Socket_11__getattr__(o, n);
  8763. }
  8764. return v;
  8765. }
  8766. static int __pyx_tp_setattro_3zmq_4core_6socket_Socket(PyObject *o, PyObject *n, PyObject *v) {
  8767. if (v) {
  8768. return __pyx_pf_3zmq_4core_6socket_6Socket_10__setattr__(o, n, v);
  8769. }
  8770. else {
  8771. return PyObject_GenericSetAttr(o, n, 0);
  8772. }
  8773. }
  8774. static PyObject *__pyx_getprop_3zmq_4core_6socket_6Socket_socket_type(PyObject *o, void *x) {
  8775. return __pyx_pf_3zmq_4core_6socket_6Socket_11socket_type___get__(o);
  8776. }
  8777. static int __pyx_setprop_3zmq_4core_6socket_6Socket_socket_type(PyObject *o, PyObject *v, void *x) {
  8778. if (v) {
  8779. return __pyx_pf_3zmq_4core_6socket_6Socket_11socket_type_1__set__(o, v);
  8780. }
  8781. else {
  8782. PyErr_SetString(PyExc_NotImplementedError, "__del__");
  8783. return -1;
  8784. }
  8785. }
  8786. static PyObject *__pyx_getprop_3zmq_4core_6socket_6Socket_context(PyObject *o, void *x) {
  8787. return __pyx_pf_3zmq_4core_6socket_6Socket_7context___get__(o);
  8788. }
  8789. static int __pyx_setprop_3zmq_4core_6socket_6Socket_context(PyObject *o, PyObject *v, void *x) {
  8790. if (v) {
  8791. return __pyx_pf_3zmq_4core_6socket_6Socket_7context_1__set__(o, v);
  8792. }
  8793. else {
  8794. return __pyx_pf_3zmq_4core_6socket_6Socket_7context_2__del__(o);
  8795. }
  8796. }
  8797. static PyObject *__pyx_getprop_3zmq_4core_6socket_6Socket__closed(PyObject *o, void *x) {
  8798. return __pyx_pf_3zmq_4core_6socket_6Socket_7_closed___get__(o);
  8799. }
  8800. static int __pyx_setprop_3zmq_4core_6socket_6Socket__closed(PyObject *o, PyObject *v, void *x) {
  8801. if (v) {
  8802. return __pyx_pf_3zmq_4core_6socket_6Socket_7_closed_1__set__(o, v);
  8803. }
  8804. else {
  8805. PyErr_SetString(PyExc_NotImplementedError, "__del__");
  8806. return -1;
  8807. }
  8808. }
  8809. static PyMethodDef __pyx_methods_3zmq_4core_6socket_Socket[] = {
  8810. {__Pyx_NAMESTR("__del__"), (PyCFunction)__pyx_pf_3zmq_4core_6socket_6Socket_1__del__, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_3zmq_4core_6socket_6Socket_1__del__)},
  8811. {__Pyx_NAMESTR("closed"), (PyCFunction)__pyx_pf_3zmq_4core_6socket_6Socket_4closed, METH_NOARGS, __Pyx_DOCSTR(0)},
  8812. {__Pyx_NAMESTR("close"), (PyCFunction)__pyx_pf_3zmq_4core_6socket_6Socket_5close, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4core_6socket_6Socket_5close)},
  8813. {__Pyx_NAMESTR("setsockopt"), (PyCFunction)__pyx_pf_3zmq_4core_6socket_6Socket_6setsockopt, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4core_6socket_6Socket_6setsockopt)},
  8814. {__Pyx_NAMESTR("getsockopt"), (PyCFunction)__pyx_pf_3zmq_4core_6socket_6Socket_7getsockopt, METH_O, __Pyx_DOCSTR(__pyx_doc_3zmq_4core_6socket_6Socket_7getsockopt)},
  8815. {__Pyx_NAMESTR("setsockopt_unicode"), (PyCFunction)__pyx_pf_3zmq_4core_6socket_6Socket_8setsockopt_unicode, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4core_6socket_6Socket_8setsockopt_unicode)},
  8816. {__Pyx_NAMESTR("getsockopt_unicode"), (PyCFunction)__pyx_pf_3zmq_4core_6socket_6Socket_9getsockopt_unicode, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4core_6socket_6Socket_9getsockopt_unicode)},
  8817. {__Pyx_NAMESTR("__getattr__"), (PyCFunction)__pyx_pf_3zmq_4core_6socket_6Socket_11__getattr__, METH_O|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_3zmq_4core_6socket_6Socket_11__getattr__)},
  8818. {__Pyx_NAMESTR("bind"), (PyCFunction)__pyx_pf_3zmq_4core_6socket_6Socket_12bind, METH_O, __Pyx_DOCSTR(__pyx_doc_3zmq_4core_6socket_6Socket_12bind)},
  8819. {__Pyx_NAMESTR("bind_to_random_port"), (PyCFunction)__pyx_pf_3zmq_4core_6socket_6Socket_13bind_to_random_port, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4core_6socket_6Socket_13bind_to_random_port)},
  8820. {__Pyx_NAMESTR("connect"), (PyCFunction)__pyx_pf_3zmq_4core_6socket_6Socket_14connect, METH_O, __Pyx_DOCSTR(__pyx_doc_3zmq_4core_6socket_6Socket_14connect)},
  8821. {__Pyx_NAMESTR("send"), (PyCFunction)__pyx_pf_3zmq_4core_6socket_6Socket_15send, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4core_6socket_6Socket_15send)},
  8822. {__Pyx_NAMESTR("recv"), (PyCFunction)__pyx_pf_3zmq_4core_6socket_6Socket_16recv, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4core_6socket_6Socket_16recv)},
  8823. {__Pyx_NAMESTR("send_multipart"), (PyCFunction)__pyx_pf_3zmq_4core_6socket_6Socket_17send_multipart, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4core_6socket_6Socket_17send_multipart)},
  8824. {__Pyx_NAMESTR("recv_multipart"), (PyCFunction)__pyx_pf_3zmq_4core_6socket_6Socket_18recv_multipart, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4core_6socket_6Socket_18recv_multipart)},
  8825. {__Pyx_NAMESTR("send_unicode"), (PyCFunction)__pyx_pf_3zmq_4core_6socket_6Socket_19send_unicode, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4core_6socket_6Socket_19send_unicode)},
  8826. {__Pyx_NAMESTR("recv_unicode"), (PyCFunction)__pyx_pf_3zmq_4core_6socket_6Socket_20recv_unicode, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4core_6socket_6Socket_20recv_unicode)},
  8827. {__Pyx_NAMESTR("send_pyobj"), (PyCFunction)__pyx_pf_3zmq_4core_6socket_6Socket_21send_pyobj, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4core_6socket_6Socket_21send_pyobj)},
  8828. {__Pyx_NAMESTR("recv_pyobj"), (PyCFunction)__pyx_pf_3zmq_4core_6socket_6Socket_22recv_pyobj, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4core_6socket_6Socket_22recv_pyobj)},
  8829. {__Pyx_NAMESTR("send_json"), (PyCFunction)__pyx_pf_3zmq_4core_6socket_6Socket_23send_json, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4core_6socket_6Socket_23send_json)},
  8830. {__Pyx_NAMESTR("recv_json"), (PyCFunction)__pyx_pf_3zmq_4core_6socket_6Socket_24recv_json, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4core_6socket_6Socket_24recv_json)},
  8831. {__Pyx_NAMESTR("poll"), (PyCFunction)__pyx_pf_3zmq_4core_6socket_6Socket_25poll, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4core_6socket_6Socket_25poll)},
  8832. {0, 0, 0, 0}
  8833. };
  8834. static struct PyGetSetDef __pyx_getsets_3zmq_4core_6socket_Socket[] = {
  8835. {(char *)"socket_type", __pyx_getprop_3zmq_4core_6socket_6Socket_socket_type, __pyx_setprop_3zmq_4core_6socket_6Socket_socket_type, 0, 0},
  8836. {(char *)"context", __pyx_getprop_3zmq_4core_6socket_6Socket_context, __pyx_setprop_3zmq_4core_6socket_6Socket_context, 0, 0},
  8837. {(char *)"_closed", __pyx_getprop_3zmq_4core_6socket_6Socket__closed, __pyx_setprop_3zmq_4core_6socket_6Socket__closed, 0, 0},
  8838. {0, 0, 0, 0, 0}
  8839. };
  8840. static PyNumberMethods __pyx_tp_as_number_Socket = {
  8841. 0, /*nb_add*/
  8842. 0, /*nb_subtract*/
  8843. 0, /*nb_multiply*/
  8844. #if PY_MAJOR_VERSION < 3
  8845. 0, /*nb_divide*/
  8846. #endif
  8847. 0, /*nb_remainder*/
  8848. 0, /*nb_divmod*/
  8849. 0, /*nb_power*/
  8850. 0, /*nb_negative*/
  8851. 0, /*nb_positive*/
  8852. 0, /*nb_absolute*/
  8853. 0, /*nb_nonzero*/
  8854. 0, /*nb_invert*/
  8855. 0, /*nb_lshift*/
  8856. 0, /*nb_rshift*/
  8857. 0, /*nb_and*/
  8858. 0, /*nb_xor*/
  8859. 0, /*nb_or*/
  8860. #if PY_MAJOR_VERSION < 3
  8861. 0, /*nb_coerce*/
  8862. #endif
  8863. 0, /*nb_int*/
  8864. #if PY_MAJOR_VERSION < 3
  8865. 0, /*nb_long*/
  8866. #else
  8867. 0, /*reserved*/
  8868. #endif
  8869. 0, /*nb_float*/
  8870. #if PY_MAJOR_VERSION < 3
  8871. 0, /*nb_oct*/
  8872. #endif
  8873. #if PY_MAJOR_VERSION < 3
  8874. 0, /*nb_hex*/
  8875. #endif
  8876. 0, /*nb_inplace_add*/
  8877. 0, /*nb_inplace_subtract*/
  8878. 0, /*nb_inplace_multiply*/
  8879. #if PY_MAJOR_VERSION < 3
  8880. 0, /*nb_inplace_divide*/
  8881. #endif
  8882. 0, /*nb_inplace_remainder*/
  8883. 0, /*nb_inplace_power*/
  8884. 0, /*nb_inplace_lshift*/
  8885. 0, /*nb_inplace_rshift*/
  8886. 0, /*nb_inplace_and*/
  8887. 0, /*nb_inplace_xor*/
  8888. 0, /*nb_inplace_or*/
  8889. 0, /*nb_floor_divide*/
  8890. 0, /*nb_true_divide*/
  8891. 0, /*nb_inplace_floor_divide*/
  8892. 0, /*nb_inplace_true_divide*/
  8893. #if PY_VERSION_HEX >= 0x02050000
  8894. 0, /*nb_index*/
  8895. #endif
  8896. };
  8897. static PySequenceMethods __pyx_tp_as_sequence_Socket = {
  8898. 0, /*sq_length*/
  8899. 0, /*sq_concat*/
  8900. 0, /*sq_repeat*/
  8901. 0, /*sq_item*/
  8902. 0, /*sq_slice*/
  8903. 0, /*sq_ass_item*/
  8904. 0, /*sq_ass_slice*/
  8905. 0, /*sq_contains*/
  8906. 0, /*sq_inplace_concat*/
  8907. 0, /*sq_inplace_repeat*/
  8908. };
  8909. static PyMappingMethods __pyx_tp_as_mapping_Socket = {
  8910. 0, /*mp_length*/
  8911. 0, /*mp_subscript*/
  8912. 0, /*mp_ass_subscript*/
  8913. };
  8914. static PyBufferProcs __pyx_tp_as_buffer_Socket = {
  8915. #if PY_MAJOR_VERSION < 3
  8916. 0, /*bf_getreadbuffer*/
  8917. #endif
  8918. #if PY_MAJOR_VERSION < 3
  8919. 0, /*bf_getwritebuffer*/
  8920. #endif
  8921. #if PY_MAJOR_VERSION < 3
  8922. 0, /*bf_getsegcount*/
  8923. #endif
  8924. #if PY_MAJOR_VERSION < 3
  8925. 0, /*bf_getcharbuffer*/
  8926. #endif
  8927. #if PY_VERSION_HEX >= 0x02060000
  8928. 0, /*bf_getbuffer*/
  8929. #endif
  8930. #if PY_VERSION_HEX >= 0x02060000
  8931. 0, /*bf_releasebuffer*/
  8932. #endif
  8933. };
  8934. static PyTypeObject __pyx_type_3zmq_4core_6socket_Socket = {
  8935. PyVarObject_HEAD_INIT(0, 0)
  8936. __Pyx_NAMESTR("zmq.core.socket.Socket"), /*tp_name*/
  8937. sizeof(struct __pyx_obj_3zmq_4core_6socket_Socket), /*tp_basicsize*/
  8938. 0, /*tp_itemsize*/
  8939. __pyx_tp_dealloc_3zmq_4core_6socket_Socket, /*tp_dealloc*/
  8940. 0, /*tp_print*/
  8941. 0, /*tp_getattr*/
  8942. 0, /*tp_setattr*/
  8943. #if PY_MAJOR_VERSION < 3
  8944. 0, /*tp_compare*/
  8945. #else
  8946. 0, /*reserved*/
  8947. #endif
  8948. 0, /*tp_repr*/
  8949. &__pyx_tp_as_number_Socket, /*tp_as_number*/
  8950. &__pyx_tp_as_sequence_Socket, /*tp_as_sequence*/
  8951. &__pyx_tp_as_mapping_Socket, /*tp_as_mapping*/
  8952. 0, /*tp_hash*/
  8953. 0, /*tp_call*/
  8954. 0, /*tp_str*/
  8955. __pyx_tp_getattro_3zmq_4core_6socket_Socket, /*tp_getattro*/
  8956. __pyx_tp_setattro_3zmq_4core_6socket_Socket, /*tp_setattro*/
  8957. &__pyx_tp_as_buffer_Socket, /*tp_as_buffer*/
  8958. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  8959. __Pyx_DOCSTR("Socket(context, socket_type)\n\n A 0MQ socket.\n\n These objects will generally be constructed via the socket() method of a Context object.\n \n Note: 0MQ Sockets are *not* threadsafe. **DO NOT** share them across threads.\n \n Parameters\n ----------\n context : Context\n The 0MQ Context this Socket belongs to.\n socket_type : int\n The socket type, which can be any of the 0MQ socket types: \n REQ, REP, PUB, SUB, PAIR, XREQ, DEALER, XREP, ROUTER, PULL, PUSH, XPUB, XSUB.\n \n See Also\n --------\n .Context.socket : method for creating a socket bound to a Context.\n "), /*tp_doc*/
  8960. __pyx_tp_traverse_3zmq_4core_6socket_Socket, /*tp_traverse*/
  8961. __pyx_tp_clear_3zmq_4core_6socket_Socket, /*tp_clear*/
  8962. 0, /*tp_richcompare*/
  8963. 0, /*tp_weaklistoffset*/
  8964. 0, /*tp_iter*/
  8965. 0, /*tp_iternext*/
  8966. __pyx_methods_3zmq_4core_6socket_Socket, /*tp_methods*/
  8967. 0, /*tp_members*/
  8968. __pyx_getsets_3zmq_4core_6socket_Socket, /*tp_getset*/
  8969. 0, /*tp_base*/
  8970. 0, /*tp_dict*/
  8971. 0, /*tp_descr_get*/
  8972. 0, /*tp_descr_set*/
  8973. 0, /*tp_dictoffset*/
  8974. __pyx_pf_3zmq_4core_6socket_6Socket_3__init__, /*tp_init*/
  8975. 0, /*tp_alloc*/
  8976. __pyx_tp_new_3zmq_4core_6socket_Socket, /*tp_new*/
  8977. 0, /*tp_free*/
  8978. 0, /*tp_is_gc*/
  8979. 0, /*tp_bases*/
  8980. 0, /*tp_mro*/
  8981. 0, /*tp_cache*/
  8982. 0, /*tp_subclasses*/
  8983. 0, /*tp_weaklist*/
  8984. 0, /*tp_del*/
  8985. #if PY_VERSION_HEX >= 0x02060000
  8986. 0, /*tp_version_tag*/
  8987. #endif
  8988. };
  8989. static PyMethodDef __pyx_methods[] = {
  8990. {0, 0, 0, 0}
  8991. };
  8992. char* __pyx_import_star_type_names[] = {
  8993. "__pyx_opt_args_3zmq_4core_6socket__send_copy",
  8994. "Socket",
  8995. "__pyx_opt_args_3zmq_4core_6socket_6Socket_send",
  8996. "const_void_ptr",
  8997. "zmq_pollitem_t",
  8998. "Context",
  8999. "fd_t",
  9000. "zmq_free_fn",
  9001. "__pyx_opt_args_3zmq_4core_6socket__recv_message",
  9002. "zmq_msg_t",
  9003. "int64_t",
  9004. "__pyx_opt_args_3zmq_4core_6socket_6Socket_recv",
  9005. "__pyx_opt_args_3zmq_4core_6socket__recv_copy",
  9006. "Message",
  9007. "__pyx_opt_args_3zmq_4core_6socket__send_message",
  9008. "Py_ssize_t",
  9009. 0
  9010. };
  9011. static int __pyx_import_star_set(PyObject *o, PyObject* py_name, char *name) {
  9012. char** type_name = __pyx_import_star_type_names;
  9013. while (*type_name) {
  9014. if (__Pyx_StrEq(name, *type_name)) {
  9015. PyErr_Format(PyExc_TypeError, "Cannot overwrite C type %s", name);
  9016. goto bad;
  9017. }
  9018. type_name++;
  9019. }
  9020. if (0);
  9021. else {
  9022. if (PyObject_SetAttr(__pyx_m, py_name, o) < 0) goto bad;
  9023. }
  9024. return 0;
  9025. bad:
  9026. return -1;
  9027. }
  9028. /* import_all_from is an unexposed function from ceval.c */
  9029. static int
  9030. __Pyx_import_all_from(PyObject *locals, PyObject *v)
  9031. {
  9032. PyObject *all = __Pyx_GetAttrString(v, "__all__");
  9033. PyObject *dict, *name, *value;
  9034. int skip_leading_underscores = 0;
  9035. int pos, err;
  9036. if (all == NULL) {
  9037. if (!PyErr_ExceptionMatches(PyExc_AttributeError))
  9038. return -1; /* Unexpected error */
  9039. PyErr_Clear();
  9040. dict = __Pyx_GetAttrString(v, "__dict__");
  9041. if (dict == NULL) {
  9042. if (!PyErr_ExceptionMatches(PyExc_AttributeError))
  9043. return -1;
  9044. PyErr_SetString(PyExc_ImportError,
  9045. "from-import-* object has no __dict__ and no __all__");
  9046. return -1;
  9047. }
  9048. #if PY_MAJOR_VERSION < 3
  9049. all = PyObject_CallMethod(dict, (char *)"keys", NULL);
  9050. #else
  9051. all = PyMapping_Keys(dict);
  9052. #endif
  9053. Py_DECREF(dict);
  9054. if (all == NULL)
  9055. return -1;
  9056. skip_leading_underscores = 1;
  9057. }
  9058. for (pos = 0, err = 0; ; pos++) {
  9059. name = PySequence_GetItem(all, pos);
  9060. if (name == NULL) {
  9061. if (!PyErr_ExceptionMatches(PyExc_IndexError))
  9062. err = -1;
  9063. else
  9064. PyErr_Clear();
  9065. break;
  9066. }
  9067. if (skip_leading_underscores &&
  9068. #if PY_MAJOR_VERSION < 3
  9069. PyString_Check(name) &&
  9070. PyString_AS_STRING(name)[0] == '_')
  9071. #else
  9072. PyUnicode_Check(name) &&
  9073. PyUnicode_AS_UNICODE(name)[0] == '_')
  9074. #endif
  9075. {
  9076. Py_DECREF(name);
  9077. continue;
  9078. }
  9079. value = PyObject_GetAttr(v, name);
  9080. if (value == NULL)
  9081. err = -1;
  9082. else if (PyDict_CheckExact(locals))
  9083. err = PyDict_SetItem(locals, name, value);
  9084. else
  9085. err = PyObject_SetItem(locals, name, value);
  9086. Py_DECREF(name);
  9087. Py_XDECREF(value);
  9088. if (err != 0)
  9089. break;
  9090. }
  9091. Py_DECREF(all);
  9092. return err;
  9093. }
  9094. static int __pyx_import_star(PyObject* m) {
  9095. int i;
  9096. int ret = -1;
  9097. char* s;
  9098. PyObject *locals = 0;
  9099. PyObject *list = 0;
  9100. #if PY_MAJOR_VERSION >= 3
  9101. PyObject *utf8_name = 0;
  9102. #endif
  9103. PyObject *name;
  9104. PyObject *item;
  9105. locals = PyDict_New(); if (!locals) goto bad;
  9106. if (__Pyx_import_all_from(locals, m) < 0) goto bad;
  9107. list = PyDict_Items(locals); if (!list) goto bad;
  9108. for(i=0; i<PyList_GET_SIZE(list); i++) {
  9109. name = PyTuple_GET_ITEM(PyList_GET_ITEM(list, i), 0);
  9110. item = PyTuple_GET_ITEM(PyList_GET_ITEM(list, i), 1);
  9111. #if PY_MAJOR_VERSION >= 3
  9112. utf8_name = PyUnicode_AsUTF8String(name);
  9113. if (!utf8_name) goto bad;
  9114. s = PyBytes_AS_STRING(utf8_name);
  9115. if (__pyx_import_star_set(item, name, s) < 0) goto bad;
  9116. Py_DECREF(utf8_name); utf8_name = 0;
  9117. #else
  9118. s = PyString_AsString(name);
  9119. if (!s) goto bad;
  9120. if (__pyx_import_star_set(item, name, s) < 0) goto bad;
  9121. #endif
  9122. }
  9123. ret = 0;
  9124. bad:
  9125. Py_XDECREF(locals);
  9126. Py_XDECREF(list);
  9127. #if PY_MAJOR_VERSION >= 3
  9128. Py_XDECREF(utf8_name);
  9129. #endif
  9130. return ret;
  9131. }
  9132. #if PY_MAJOR_VERSION >= 3
  9133. static struct PyModuleDef __pyx_moduledef = {
  9134. PyModuleDef_HEAD_INIT,
  9135. __Pyx_NAMESTR("socket"),
  9136. __Pyx_DOCSTR(__pyx_k_42), /* m_doc */
  9137. -1, /* m_size */
  9138. __pyx_methods /* m_methods */,
  9139. NULL, /* m_reload */
  9140. NULL, /* m_traverse */
  9141. NULL, /* m_clear */
  9142. NULL /* m_free */
  9143. };
  9144. #endif
  9145. static __Pyx_StringTabEntry __pyx_string_tab[] = {
  9146. {&__pyx_kp_s_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 0, 1, 0},
  9147. {&__pyx_kp_s_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 1, 0},
  9148. {&__pyx_kp_s_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 0, 1, 0},
  9149. {&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0},
  9150. {&__pyx_kp_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 0},
  9151. {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0},
  9152. {&__pyx_kp_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 0},
  9153. {&__pyx_kp_s_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 0, 1, 0},
  9154. {&__pyx_kp_s_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 0, 1, 0},
  9155. {&__pyx_kp_s_33, __pyx_k_33, sizeof(__pyx_k_33), 0, 0, 1, 0},
  9156. {&__pyx_kp_s_36, __pyx_k_36, sizeof(__pyx_k_36), 0, 0, 1, 0},
  9157. {&__pyx_kp_s_37, __pyx_k_37, sizeof(__pyx_k_37), 0, 0, 1, 0},
  9158. {&__pyx_kp_s_38, __pyx_k_38, sizeof(__pyx_k_38), 0, 0, 1, 0},
  9159. {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0},
  9160. {&__pyx_kp_s_40, __pyx_k_40, sizeof(__pyx_k_40), 0, 0, 1, 0},
  9161. {&__pyx_n_s_43, __pyx_k_43, sizeof(__pyx_k_43), 0, 0, 1, 1},
  9162. {&__pyx_n_s_44, __pyx_k_44, sizeof(__pyx_k_44), 0, 0, 1, 1},
  9163. {&__pyx_n_s_45, __pyx_k_45, sizeof(__pyx_k_45), 0, 0, 1, 1},
  9164. {&__pyx_n_s_46, __pyx_k_46, sizeof(__pyx_k_46), 0, 0, 1, 1},
  9165. {&__pyx_n_s_47, __pyx_k_47, sizeof(__pyx_k_47), 0, 0, 1, 1},
  9166. {&__pyx_n_s_48, __pyx_k_48, sizeof(__pyx_k_48), 0, 0, 1, 1},
  9167. {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0},
  9168. {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0},
  9169. {&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0},
  9170. {&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0},
  9171. {&__pyx_n_s__AttributeError, __pyx_k__AttributeError, sizeof(__pyx_k__AttributeError), 0, 0, 1, 1},
  9172. {&__pyx_n_s__B, __pyx_k__B, sizeof(__pyx_k__B), 0, 0, 1, 1},
  9173. {&__pyx_n_s__ENOTSOCK, __pyx_k__ENOTSOCK, sizeof(__pyx_k__ENOTSOCK), 0, 0, 1, 1},
  9174. {&__pyx_n_s__ENOTSUP, __pyx_k__ENOTSUP, sizeof(__pyx_k__ENOTSUP), 0, 0, 1, 1},
  9175. {&__pyx_n_s__ImportError, __pyx_k__ImportError, sizeof(__pyx_k__ImportError), 0, 0, 1, 1},
  9176. {&__pyx_n_s__NotImplementedError, __pyx_k__NotImplementedError, sizeof(__pyx_k__NotImplementedError), 0, 0, 1, 1},
  9177. {&__pyx_n_s__POLLERR, __pyx_k__POLLERR, sizeof(__pyx_k__POLLERR), 0, 0, 1, 1},
  9178. {&__pyx_n_s__POLLIN, __pyx_k__POLLIN, sizeof(__pyx_k__POLLIN), 0, 0, 1, 1},
  9179. {&__pyx_n_s__Poller, __pyx_k__Poller, sizeof(__pyx_k__Poller), 0, 0, 1, 1},
  9180. {&__pyx_n_s__SNDMORE, __pyx_k__SNDMORE, sizeof(__pyx_k__SNDMORE), 0, 0, 1, 1},
  9181. {&__pyx_n_s__Socket, __pyx_k__Socket, sizeof(__pyx_k__Socket), 0, 0, 1, 1},
  9182. {&__pyx_n_s__TypeError, __pyx_k__TypeError, sizeof(__pyx_k__TypeError), 0, 0, 1, 1},
  9183. {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1},
  9184. {&__pyx_n_s__ZMQBindError, __pyx_k__ZMQBindError, sizeof(__pyx_k__ZMQBindError), 0, 0, 1, 1},
  9185. {&__pyx_n_s__ZMQError, __pyx_k__ZMQError, sizeof(__pyx_k__ZMQError), 0, 0, 1, 1},
  9186. {&__pyx_n_s____all__, __pyx_k____all__, sizeof(__pyx_k____all__), 0, 0, 1, 1},
  9187. {&__pyx_n_s____class__, __pyx_k____class__, sizeof(__pyx_k____class__), 0, 0, 1, 1},
  9188. {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
  9189. {&__pyx_n_s____module__, __pyx_k____module__, sizeof(__pyx_k____module__), 0, 0, 1, 1},
  9190. {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
  9191. {&__pyx_n_s___handle, __pyx_k___handle, sizeof(__pyx_k___handle), 0, 0, 1, 1},
  9192. {&__pyx_n_s__addr, __pyx_k__addr, sizeof(__pyx_k__addr), 0, 0, 1, 1},
  9193. {&__pyx_n_s__basestring, __pyx_k__basestring, sizeof(__pyx_k__basestring), 0, 0, 1, 1},
  9194. {&__pyx_n_s__bind, __pyx_k__bind, sizeof(__pyx_k__bind), 0, 0, 1, 1},
  9195. {&__pyx_n_s__buffer, __pyx_k__buffer, sizeof(__pyx_k__buffer), 0, 0, 1, 1},
  9196. {&__pyx_n_s__bytes, __pyx_k__bytes, sizeof(__pyx_k__bytes), 0, 0, 1, 1},
  9197. {&__pyx_n_s__bytes_sockopts, __pyx_k__bytes_sockopts, sizeof(__pyx_k__bytes_sockopts), 0, 0, 1, 1},
  9198. {&__pyx_n_s__cPickle, __pyx_k__cPickle, sizeof(__pyx_k__cPickle), 0, 0, 1, 1},
  9199. {&__pyx_n_s__char, __pyx_k__char, sizeof(__pyx_k__char), 0, 0, 1, 1},
  9200. {&__pyx_n_s__close, __pyx_k__close, sizeof(__pyx_k__close), 0, 0, 1, 1},
  9201. {&__pyx_n_s__closed, __pyx_k__closed, sizeof(__pyx_k__closed), 0, 0, 1, 1},
  9202. {&__pyx_n_s__codecs, __pyx_k__codecs, sizeof(__pyx_k__codecs), 0, 0, 1, 1},
  9203. {&__pyx_n_s__constants, __pyx_k__constants, sizeof(__pyx_k__constants), 0, 0, 1, 1},
  9204. {&__pyx_n_s__context, __pyx_k__context, sizeof(__pyx_k__context), 0, 0, 1, 1},
  9205. {&__pyx_n_s__copy, __pyx_k__copy, sizeof(__pyx_k__copy), 0, 0, 1, 1},
  9206. {&__pyx_n_s__copy_mod, __pyx_k__copy_mod, sizeof(__pyx_k__copy_mod), 0, 0, 1, 1},
  9207. {&__pyx_n_s__data, __pyx_k__data, sizeof(__pyx_k__data), 0, 0, 1, 1},
  9208. {&__pyx_n_s__decode, __pyx_k__decode, sizeof(__pyx_k__decode), 0, 0, 1, 1},
  9209. {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1},
  9210. {&__pyx_n_s__dumps, __pyx_k__dumps, sizeof(__pyx_k__dumps), 0, 0, 1, 1},
  9211. {&__pyx_n_s__encode, __pyx_k__encode, sizeof(__pyx_k__encode), 0, 0, 1, 1},
  9212. {&__pyx_n_s__encoding, __pyx_k__encoding, sizeof(__pyx_k__encoding), 0, 0, 1, 1},
  9213. {&__pyx_n_s__flags, __pyx_k__flags, sizeof(__pyx_k__flags), 0, 0, 1, 1},
  9214. {&__pyx_n_s__getsockopt, __pyx_k__getsockopt, sizeof(__pyx_k__getsockopt), 0, 0, 1, 1},
  9215. {&__pyx_n_s__int64_sockopts, __pyx_k__int64_sockopts, sizeof(__pyx_k__int64_sockopts), 0, 0, 1, 1},
  9216. {&__pyx_n_s__itemsize, __pyx_k__itemsize, sizeof(__pyx_k__itemsize), 0, 0, 1, 1},
  9217. {&__pyx_n_s__jsonapi, __pyx_k__jsonapi, sizeof(__pyx_k__jsonapi), 0, 0, 1, 1},
  9218. {&__pyx_n_s__jsonmod, __pyx_k__jsonmod, sizeof(__pyx_k__jsonmod), 0, 0, 1, 1},
  9219. {&__pyx_n_s__linger, __pyx_k__linger, sizeof(__pyx_k__linger), 0, 0, 1, 1},
  9220. {&__pyx_n_s__loads, __pyx_k__loads, sizeof(__pyx_k__loads), 0, 0, 1, 1},
  9221. {&__pyx_n_s__max_port, __pyx_k__max_port, sizeof(__pyx_k__max_port), 0, 0, 1, 1},
  9222. {&__pyx_n_s__max_tries, __pyx_k__max_tries, sizeof(__pyx_k__max_tries), 0, 0, 1, 1},
  9223. {&__pyx_n_s__min_port, __pyx_k__min_port, sizeof(__pyx_k__min_port), 0, 0, 1, 1},
  9224. {&__pyx_n_s__msg_parts, __pyx_k__msg_parts, sizeof(__pyx_k__msg_parts), 0, 0, 1, 1},
  9225. {&__pyx_n_s__obj, __pyx_k__obj, sizeof(__pyx_k__obj), 0, 0, 1, 1},
  9226. {&__pyx_n_s__option, __pyx_k__option, sizeof(__pyx_k__option), 0, 0, 1, 1},
  9227. {&__pyx_n_s__optval, __pyx_k__optval, sizeof(__pyx_k__optval), 0, 0, 1, 1},
  9228. {&__pyx_n_s__pickle, __pyx_k__pickle, sizeof(__pyx_k__pickle), 0, 0, 1, 1},
  9229. {&__pyx_n_s__poll, __pyx_k__poll, sizeof(__pyx_k__poll), 0, 0, 1, 1},
  9230. {&__pyx_n_s__prefix, __pyx_k__prefix, sizeof(__pyx_k__prefix), 0, 0, 1, 1},
  9231. {&__pyx_n_s__property, __pyx_k__property, sizeof(__pyx_k__property), 0, 0, 1, 1},
  9232. {&__pyx_n_s__protocol, __pyx_k__protocol, sizeof(__pyx_k__protocol), 0, 0, 1, 1},
  9233. {&__pyx_n_s__random, __pyx_k__random, sizeof(__pyx_k__random), 0, 0, 1, 1},
  9234. {&__pyx_n_s__randrange, __pyx_k__randrange, sizeof(__pyx_k__randrange), 0, 0, 1, 1},
  9235. {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1},
  9236. {&__pyx_n_s__recv, __pyx_k__recv, sizeof(__pyx_k__recv), 0, 0, 1, 1},
  9237. {&__pyx_n_s__register, __pyx_k__register, sizeof(__pyx_k__register), 0, 0, 1, 1},
  9238. {&__pyx_n_s__send, __pyx_k__send, sizeof(__pyx_k__send), 0, 0, 1, 1},
  9239. {&__pyx_n_s__setsockopt, __pyx_k__setsockopt, sizeof(__pyx_k__setsockopt), 0, 0, 1, 1},
  9240. {&__pyx_n_s__socket_type, __pyx_k__socket_type, sizeof(__pyx_k__socket_type), 0, 0, 1, 1},
  9241. {&__pyx_n_s__struct, __pyx_k__struct, sizeof(__pyx_k__struct), 0, 0, 1, 1},
  9242. {&__pyx_n_s__sys, __pyx_k__sys, sizeof(__pyx_k__sys), 0, 0, 1, 1},
  9243. {&__pyx_n_s__time, __pyx_k__time, sizeof(__pyx_k__time), 0, 0, 1, 1},
  9244. {&__pyx_n_s__timeout, __pyx_k__timeout, sizeof(__pyx_k__timeout), 0, 0, 1, 1},
  9245. {&__pyx_n_s__track, __pyx_k__track, sizeof(__pyx_k__track), 0, 0, 1, 1},
  9246. {&__pyx_n_s__tracker, __pyx_k__tracker, sizeof(__pyx_k__tracker), 0, 0, 1, 1},
  9247. {&__pyx_n_s__typecode, __pyx_k__typecode, sizeof(__pyx_k__typecode), 0, 0, 1, 1},
  9248. {&__pyx_n_s__u, __pyx_k__u, sizeof(__pyx_k__u), 0, 0, 1, 1},
  9249. {&__pyx_n_s__unicode, __pyx_k__unicode, sizeof(__pyx_k__unicode), 0, 0, 1, 1},
  9250. {&__pyx_n_s__upper, __pyx_k__upper, sizeof(__pyx_k__upper), 0, 0, 1, 1},
  9251. {&__pyx_n_s__xrange, __pyx_k__xrange, sizeof(__pyx_k__xrange), 0, 0, 1, 1},
  9252. {&__pyx_n_s__zmq, __pyx_k__zmq, sizeof(__pyx_k__zmq), 0, 0, 1, 1},
  9253. {0, 0, 0, 0, 0, 0, 0}
  9254. };
  9255. static int __Pyx_InitCachedBuiltins(void) {
  9256. __pyx_builtin_property = __Pyx_GetName(__pyx_b, __pyx_n_s__property); if (!__pyx_builtin_property) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9257. __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9258. __pyx_builtin_AttributeError = __Pyx_GetName(__pyx_b, __pyx_n_s__AttributeError); if (!__pyx_builtin_AttributeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9259. #if PY_MAJOR_VERSION >= 3
  9260. __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9261. #else
  9262. __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__xrange); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9263. #endif
  9264. __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9265. __pyx_builtin_ImportError = __Pyx_GetName(__pyx_b, __pyx_n_s__ImportError); if (!__pyx_builtin_ImportError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9266. __pyx_builtin_NotImplementedError = __Pyx_GetName(__pyx_b, __pyx_n_s__NotImplementedError); if (!__pyx_builtin_NotImplementedError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9267. return 0;
  9268. __pyx_L1_error:;
  9269. return -1;
  9270. }
  9271. static int __Pyx_InitCachedConstants(void) {
  9272. __Pyx_RefNannyDeclarations
  9273. __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants");
  9274. /* "zmq/core/socket.pyx":285
  9275. * _check_closed(self, True)
  9276. * if isinstance(optval, unicode):
  9277. * raise TypeError("unicode not allowed, use setsockopt_unicode") # <<<<<<<<<<<<<<
  9278. *
  9279. * if option in constants.bytes_sockopts:
  9280. */
  9281. __pyx_k_tuple_3 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9282. __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_3));
  9283. __Pyx_INCREF(((PyObject *)__pyx_kp_s_2));
  9284. PyTuple_SET_ITEM(__pyx_k_tuple_3, 0, ((PyObject *)__pyx_kp_s_2));
  9285. __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2));
  9286. __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_3));
  9287. /* "zmq/core/socket.pyx":407
  9288. * """
  9289. * if not isinstance(optval, unicode):
  9290. * raise TypeError("unicode strings only") # <<<<<<<<<<<<<<
  9291. * return self.setsockopt(option, optval.encode(encoding))
  9292. *
  9293. */
  9294. __pyx_k_tuple_8 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9295. __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_8));
  9296. __Pyx_INCREF(((PyObject *)__pyx_kp_s_7));
  9297. PyTuple_SET_ITEM(__pyx_k_tuple_8, 0, ((PyObject *)__pyx_kp_s_7));
  9298. __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_7));
  9299. __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8));
  9300. /* "zmq/core/socket.pyx":482
  9301. * _check_closed(self, True)
  9302. * if isinstance(addr, unicode):
  9303. * addr = addr.encode('utf-8') # <<<<<<<<<<<<<<
  9304. * if not isinstance(addr, bytes):
  9305. * raise TypeError('expected str, got: %r' % addr)
  9306. */
  9307. __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9308. __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_12));
  9309. __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
  9310. PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_s_6));
  9311. __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
  9312. __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12));
  9313. /* "zmq/core/socket.pyx":525
  9314. * else:
  9315. * return port
  9316. * raise ZMQBindError("Could not bind socket to random port.") # <<<<<<<<<<<<<<
  9317. *
  9318. * def connect(self, addr):
  9319. */
  9320. __pyx_k_tuple_16 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9321. __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_16));
  9322. __Pyx_INCREF(((PyObject *)__pyx_kp_s_15));
  9323. PyTuple_SET_ITEM(__pyx_k_tuple_16, 0, ((PyObject *)__pyx_kp_s_15));
  9324. __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_15));
  9325. __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16));
  9326. /* "zmq/core/socket.pyx":545
  9327. * _check_closed(self, True)
  9328. * if isinstance(addr, unicode):
  9329. * addr = addr.encode('utf-8') # <<<<<<<<<<<<<<
  9330. * if not isinstance(addr, bytes):
  9331. * raise TypeError('expected str, got: %r' % addr)
  9332. */
  9333. __pyx_k_tuple_17 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9334. __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_17));
  9335. __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
  9336. PyTuple_SET_ITEM(__pyx_k_tuple_17, 0, ((PyObject *)__pyx_kp_s_6));
  9337. __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
  9338. __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17));
  9339. /* "zmq/core/socket.pyx":599
  9340. *
  9341. * if isinstance(data, unicode):
  9342. * raise TypeError("unicode not allowed, use send_unicode") # <<<<<<<<<<<<<<
  9343. *
  9344. * if copy:
  9345. */
  9346. __pyx_k_tuple_21 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9347. __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_21));
  9348. __Pyx_INCREF(((PyObject *)__pyx_kp_s_20));
  9349. PyTuple_SET_ITEM(__pyx_k_tuple_21, 0, ((PyObject *)__pyx_kp_s_20));
  9350. __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_20));
  9351. __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_21));
  9352. /* "zmq/core/socket.pyx":610
  9353. * if isinstance(data, Message):
  9354. * if track and not data.tracker:
  9355. * raise ValueError('Not a tracked message') # <<<<<<<<<<<<<<
  9356. * msg = data
  9357. * else:
  9358. */
  9359. __pyx_k_tuple_23 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9360. __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_23));
  9361. __Pyx_INCREF(((PyObject *)__pyx_kp_s_22));
  9362. PyTuple_SET_ITEM(__pyx_k_tuple_23, 0, ((PyObject *)__pyx_kp_s_22));
  9363. __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_22));
  9364. __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_23));
  9365. /* "zmq/core/socket.pyx":743
  9366. * """
  9367. * if not isinstance(u, basestring):
  9368. * raise TypeError("unicode/str objects only") # <<<<<<<<<<<<<<
  9369. * return self.send(u.encode(encoding), flags=flags, copy=copy)
  9370. *
  9371. */
  9372. __pyx_k_tuple_32 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9373. __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_32));
  9374. __Pyx_INCREF(((PyObject *)__pyx_kp_s_31));
  9375. PyTuple_SET_ITEM(__pyx_k_tuple_32, 0, ((PyObject *)__pyx_kp_s_31));
  9376. __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_31));
  9377. __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_32));
  9378. /* "zmq/core/socket.pyx":816
  9379. * """
  9380. * if jsonapi.jsonmod is None:
  9381. * raise ImportError('jsonlib{1,2}, json or simplejson library is required.') # <<<<<<<<<<<<<<
  9382. * else:
  9383. * msg = jsonapi.dumps(obj)
  9384. */
  9385. __pyx_k_tuple_34 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9386. __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_34));
  9387. __Pyx_INCREF(((PyObject *)__pyx_kp_s_33));
  9388. PyTuple_SET_ITEM(__pyx_k_tuple_34, 0, ((PyObject *)__pyx_kp_s_33));
  9389. __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_33));
  9390. __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_34));
  9391. /* "zmq/core/socket.pyx":837
  9392. * """
  9393. * if jsonapi.jsonmod is None:
  9394. * raise ImportError('jsonlib{1,2}, json or simplejson library is required.') # <<<<<<<<<<<<<<
  9395. * else:
  9396. * msg = self.recv(flags)
  9397. */
  9398. __pyx_k_tuple_35 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9399. __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_35));
  9400. __Pyx_INCREF(((PyObject *)__pyx_kp_s_33));
  9401. PyTuple_SET_ITEM(__pyx_k_tuple_35, 0, ((PyObject *)__pyx_kp_s_33));
  9402. __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_33));
  9403. __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_35));
  9404. /* "buffers.pxd":218
  9405. * return PyMemoryView_FromBuffer(&pybuf)
  9406. * else:
  9407. * raise NotImplementedError("New style buffers not available.") # <<<<<<<<<<<<<<
  9408. *
  9409. *
  9410. */
  9411. __pyx_k_tuple_39 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_39)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9412. __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_39));
  9413. __Pyx_INCREF(((PyObject *)__pyx_kp_s_38));
  9414. PyTuple_SET_ITEM(__pyx_k_tuple_39, 0, ((PyObject *)__pyx_kp_s_38));
  9415. __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_38));
  9416. __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_39));
  9417. /* "buffers.pxd":233
  9418. * return PyBuffer_FromReadWriteMemory(ptr, s)
  9419. * else:
  9420. * raise NotImplementedError("Old style buffers not available.") # <<<<<<<<<<<<<<
  9421. *
  9422. *
  9423. */
  9424. __pyx_k_tuple_41 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_41)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9425. __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_41));
  9426. __Pyx_INCREF(((PyObject *)__pyx_kp_s_40));
  9427. PyTuple_SET_ITEM(__pyx_k_tuple_41, 0, ((PyObject *)__pyx_kp_s_40));
  9428. __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_40));
  9429. __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_41));
  9430. __Pyx_RefNannyFinishContext();
  9431. return 0;
  9432. __pyx_L1_error:;
  9433. __Pyx_RefNannyFinishContext();
  9434. return -1;
  9435. }
  9436. static int __Pyx_InitGlobals(void) {
  9437. if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  9438. __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  9439. __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  9440. __pyx_int_100 = PyInt_FromLong(100); if (unlikely(!__pyx_int_100)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  9441. __pyx_int_49152 = PyInt_FromLong(49152); if (unlikely(!__pyx_int_49152)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  9442. __pyx_int_65536 = PyInt_FromLong(65536); if (unlikely(!__pyx_int_65536)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  9443. return 0;
  9444. __pyx_L1_error:;
  9445. return -1;
  9446. }
  9447. #if PY_MAJOR_VERSION < 3
  9448. PyMODINIT_FUNC initsocket(void); /*proto*/
  9449. PyMODINIT_FUNC initsocket(void)
  9450. #else
  9451. PyMODINIT_FUNC PyInit_socket(void); /*proto*/
  9452. PyMODINIT_FUNC PyInit_socket(void)
  9453. #endif
  9454. {
  9455. PyObject *__pyx_t_1 = NULL;
  9456. PyObject *__pyx_t_2 = NULL;
  9457. PyObject *__pyx_t_3 = NULL;
  9458. PyObject *__pyx_t_4 = NULL;
  9459. PyObject *__pyx_t_5 = NULL;
  9460. PyObject *__pyx_t_6 = NULL;
  9461. PyObject *__pyx_t_7 = NULL;
  9462. PyObject *__pyx_t_8 = NULL;
  9463. __Pyx_RefNannyDeclarations
  9464. #if CYTHON_REFNANNY
  9465. __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  9466. if (!__Pyx_RefNanny) {
  9467. PyErr_Clear();
  9468. __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
  9469. if (!__Pyx_RefNanny)
  9470. Py_FatalError("failed to import 'refnanny' module");
  9471. }
  9472. #endif
  9473. __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_socket(void)");
  9474. if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9475. __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;}
  9476. __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;}
  9477. #ifdef __pyx_binding_PyCFunctionType_USED
  9478. if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9479. #endif
  9480. /*--- Library function declarations ---*/
  9481. /*--- Threads initialization code ---*/
  9482. #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  9483. #ifdef WITH_THREAD /* Python build with threading support? */
  9484. PyEval_InitThreads();
  9485. #endif
  9486. #endif
  9487. /*--- Module creation code ---*/
  9488. #if PY_MAJOR_VERSION < 3
  9489. __pyx_m = Py_InitModule4(__Pyx_NAMESTR("socket"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_42), 0, PYTHON_API_VERSION);
  9490. #else
  9491. __pyx_m = PyModule_Create(&__pyx_moduledef);
  9492. #endif
  9493. if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  9494. #if PY_MAJOR_VERSION < 3
  9495. Py_INCREF(__pyx_m);
  9496. #endif
  9497. __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME));
  9498. if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  9499. if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  9500. /*--- Initialize various global constants etc. ---*/
  9501. if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9502. if (__pyx_module_is_main_zmq__core__socket) {
  9503. 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;};
  9504. }
  9505. /*--- Builtin init code ---*/
  9506. if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9507. /*--- Constants init code ---*/
  9508. if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9509. /*--- Global init code ---*/
  9510. /*--- Variable export code ---*/
  9511. /*--- Function export code ---*/
  9512. /*--- Type init code ---*/
  9513. __pyx_vtabptr_3zmq_4core_6socket_Socket = &__pyx_vtable_3zmq_4core_6socket_Socket;
  9514. __pyx_vtable_3zmq_4core_6socket_Socket.send = (PyObject *(*)(struct __pyx_obj_3zmq_4core_6socket_Socket *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_3zmq_4core_6socket_6Socket_send *__pyx_optional_args))__pyx_f_3zmq_4core_6socket_6Socket_send;
  9515. __pyx_vtable_3zmq_4core_6socket_Socket.recv = (PyObject *(*)(struct __pyx_obj_3zmq_4core_6socket_Socket *, int __pyx_skip_dispatch, struct __pyx_opt_args_3zmq_4core_6socket_6Socket_recv *__pyx_optional_args))__pyx_f_3zmq_4core_6socket_6Socket_recv;
  9516. if (PyType_Ready(&__pyx_type_3zmq_4core_6socket_Socket) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9517. {
  9518. PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_3zmq_4core_6socket_Socket, "__setattr__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9519. if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
  9520. __pyx_wrapperbase_3zmq_4core_6socket_6Socket_10__setattr__ = *((PyWrapperDescrObject *)wrapper)->d_base;
  9521. __pyx_wrapperbase_3zmq_4core_6socket_6Socket_10__setattr__.doc = __pyx_doc_3zmq_4core_6socket_6Socket_10__setattr__;
  9522. ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_3zmq_4core_6socket_6Socket_10__setattr__;
  9523. }
  9524. }
  9525. {
  9526. PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_3zmq_4core_6socket_Socket, "__getattr__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9527. if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
  9528. __pyx_wrapperbase_3zmq_4core_6socket_6Socket_11__getattr__ = *((PyWrapperDescrObject *)wrapper)->d_base;
  9529. __pyx_wrapperbase_3zmq_4core_6socket_6Socket_11__getattr__.doc = __pyx_doc_3zmq_4core_6socket_6Socket_11__getattr__;
  9530. ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_3zmq_4core_6socket_6Socket_11__getattr__;
  9531. }
  9532. }
  9533. if (__Pyx_SetVtable(__pyx_type_3zmq_4core_6socket_Socket.tp_dict, __pyx_vtabptr_3zmq_4core_6socket_Socket) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9534. if (__Pyx_SetAttrString(__pyx_m, "Socket", (PyObject *)&__pyx_type_3zmq_4core_6socket_Socket) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9535. __pyx_ptype_3zmq_4core_6socket_Socket = &__pyx_type_3zmq_4core_6socket_Socket;
  9536. /*--- Type import code ---*/
  9537. __pyx_ptype_3zmq_4core_7message_MessageTracker = __Pyx_ImportType("zmq.core.message", "MessageTracker", sizeof(struct __pyx_obj_3zmq_4core_7message_MessageTracker), 1); if (unlikely(!__pyx_ptype_3zmq_4core_7message_MessageTracker)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9538. __pyx_ptype_3zmq_4core_7message_Message = __Pyx_ImportType("zmq.core.message", "Message", sizeof(struct __pyx_obj_3zmq_4core_7message_Message), 1); if (unlikely(!__pyx_ptype_3zmq_4core_7message_Message)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9539. __pyx_vtabptr_3zmq_4core_7message_Message = (struct __pyx_vtabstruct_3zmq_4core_7message_Message*)__Pyx_GetVtable(__pyx_ptype_3zmq_4core_7message_Message->tp_dict); if (unlikely(!__pyx_vtabptr_3zmq_4core_7message_Message)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9540. __pyx_ptype_3zmq_4core_7context_Context = __Pyx_ImportType("zmq.core.context", "Context", sizeof(struct __pyx_obj_3zmq_4core_7context_Context), 1); if (unlikely(!__pyx_ptype_3zmq_4core_7context_Context)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9541. __pyx_vtabptr_3zmq_4core_7context_Context = (struct __pyx_vtabstruct_3zmq_4core_7context_Context*)__Pyx_GetVtable(__pyx_ptype_3zmq_4core_7context_Context->tp_dict); if (unlikely(!__pyx_vtabptr_3zmq_4core_7context_Context)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9542. __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[5]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9543. __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[6]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9544. /*--- Variable import code ---*/
  9545. /*--- Function import code ---*/
  9546. __pyx_t_1 = __Pyx_ImportModule("zmq.core.message"); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9547. if (__Pyx_ImportFunction(__pyx_t_1, "copy_zmq_msg_bytes", (void (**)(void))&__pyx_f_3zmq_4core_7message_copy_zmq_msg_bytes, "PyObject *(zmq_msg_t *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9548. Py_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  9549. /*--- Execution code ---*/
  9550. /* "zmq/core/socket.pyx":48
  9551. * #-----------------------------------------------------------------------------
  9552. *
  9553. * import copy as copy_mod # <<<<<<<<<<<<<<
  9554. * import time
  9555. * import sys
  9556. */
  9557. __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__copy), 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9558. __Pyx_GOTREF(__pyx_t_2);
  9559. if (PyObject_SetAttr(__pyx_m, __pyx_n_s__copy_mod, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9560. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  9561. /* "zmq/core/socket.pyx":49
  9562. *
  9563. * import copy as copy_mod
  9564. * import time # <<<<<<<<<<<<<<
  9565. * import sys
  9566. * import random
  9567. */
  9568. __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__time), 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9569. __Pyx_GOTREF(__pyx_t_2);
  9570. if (PyObject_SetAttr(__pyx_m, __pyx_n_s__time, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9571. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  9572. /* "zmq/core/socket.pyx":50
  9573. * import copy as copy_mod
  9574. * import time
  9575. * import sys # <<<<<<<<<<<<<<
  9576. * import random
  9577. * import struct
  9578. */
  9579. __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__sys), 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9580. __Pyx_GOTREF(__pyx_t_2);
  9581. if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sys, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9582. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  9583. /* "zmq/core/socket.pyx":51
  9584. * import time
  9585. * import sys
  9586. * import random # <<<<<<<<<<<<<<
  9587. * import struct
  9588. * import codecs
  9589. */
  9590. __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__random), 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9591. __Pyx_GOTREF(__pyx_t_2);
  9592. if (PyObject_SetAttr(__pyx_m, __pyx_n_s__random, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9593. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  9594. /* "zmq/core/socket.pyx":52
  9595. * import sys
  9596. * import random
  9597. * import struct # <<<<<<<<<<<<<<
  9598. * import codecs
  9599. *
  9600. */
  9601. __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__struct), 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9602. __Pyx_GOTREF(__pyx_t_2);
  9603. if (PyObject_SetAttr(__pyx_m, __pyx_n_s__struct, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9604. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  9605. /* "zmq/core/socket.pyx":53
  9606. * import random
  9607. * import struct
  9608. * import codecs # <<<<<<<<<<<<<<
  9609. *
  9610. * from zmq.utils import jsonapi
  9611. */
  9612. __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__codecs), 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9613. __Pyx_GOTREF(__pyx_t_2);
  9614. if (PyObject_SetAttr(__pyx_m, __pyx_n_s__codecs, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9615. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  9616. /* "zmq/core/socket.pyx":55
  9617. * import codecs
  9618. *
  9619. * from zmq.utils import jsonapi # <<<<<<<<<<<<<<
  9620. *
  9621. * try:
  9622. */
  9623. __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9624. __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  9625. __Pyx_INCREF(((PyObject *)__pyx_n_s__jsonapi));
  9626. PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__jsonapi));
  9627. __Pyx_GIVEREF(((PyObject *)__pyx_n_s__jsonapi));
  9628. __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s_43), ((PyObject *)__pyx_t_2), -1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9629. __Pyx_GOTREF(__pyx_t_3);
  9630. __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  9631. __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__jsonapi); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9632. __Pyx_GOTREF(__pyx_t_2);
  9633. if (PyObject_SetAttr(__pyx_m, __pyx_n_s__jsonapi, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9634. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  9635. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  9636. /* "zmq/core/socket.pyx":57
  9637. * from zmq.utils import jsonapi
  9638. *
  9639. * try: # <<<<<<<<<<<<<<
  9640. * import cPickle
  9641. * pickle = cPickle
  9642. */
  9643. {
  9644. __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
  9645. __Pyx_XGOTREF(__pyx_t_4);
  9646. __Pyx_XGOTREF(__pyx_t_5);
  9647. __Pyx_XGOTREF(__pyx_t_6);
  9648. /*try:*/ {
  9649. /* "zmq/core/socket.pyx":58
  9650. *
  9651. * try:
  9652. * import cPickle # <<<<<<<<<<<<<<
  9653. * pickle = cPickle
  9654. * except:
  9655. */
  9656. __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s__cPickle), 0, -1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
  9657. __Pyx_GOTREF(__pyx_t_3);
  9658. if (PyObject_SetAttr(__pyx_m, __pyx_n_s__cPickle, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
  9659. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  9660. /* "zmq/core/socket.pyx":59
  9661. * try:
  9662. * import cPickle
  9663. * pickle = cPickle # <<<<<<<<<<<<<<
  9664. * except:
  9665. * cPickle = None
  9666. */
  9667. __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__cPickle); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
  9668. __Pyx_GOTREF(__pyx_t_3);
  9669. if (PyObject_SetAttr(__pyx_m, __pyx_n_s__pickle, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
  9670. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  9671. }
  9672. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  9673. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  9674. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  9675. goto __pyx_L9_try_end;
  9676. __pyx_L2_error:;
  9677. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  9678. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  9679. /* "zmq/core/socket.pyx":60
  9680. * import cPickle
  9681. * pickle = cPickle
  9682. * except: # <<<<<<<<<<<<<<
  9683. * cPickle = None
  9684. * import pickle
  9685. */
  9686. /*except:*/ {
  9687. __Pyx_AddTraceback("zmq.core.socket", __pyx_clineno, __pyx_lineno, __pyx_filename);
  9688. if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;}
  9689. __Pyx_GOTREF(__pyx_t_3);
  9690. __Pyx_GOTREF(__pyx_t_2);
  9691. __Pyx_GOTREF(__pyx_t_7);
  9692. /* "zmq/core/socket.pyx":61
  9693. * pickle = cPickle
  9694. * except:
  9695. * cPickle = None # <<<<<<<<<<<<<<
  9696. * import pickle
  9697. *
  9698. */
  9699. if (PyObject_SetAttr(__pyx_m, __pyx_n_s__cPickle, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;}
  9700. /* "zmq/core/socket.pyx":62
  9701. * except:
  9702. * cPickle = None
  9703. * import pickle # <<<<<<<<<<<<<<
  9704. *
  9705. * import zmq
  9706. */
  9707. __pyx_t_8 = __Pyx_Import(((PyObject *)__pyx_n_s__pickle), 0, -1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;}
  9708. __Pyx_GOTREF(__pyx_t_8);
  9709. if (PyObject_SetAttr(__pyx_m, __pyx_n_s__pickle, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;}
  9710. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  9711. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  9712. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  9713. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  9714. goto __pyx_L3_exception_handled;
  9715. }
  9716. __pyx_L4_except_error:;
  9717. __Pyx_XGIVEREF(__pyx_t_4);
  9718. __Pyx_XGIVEREF(__pyx_t_5);
  9719. __Pyx_XGIVEREF(__pyx_t_6);
  9720. __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
  9721. goto __pyx_L1_error;
  9722. __pyx_L3_exception_handled:;
  9723. __Pyx_XGIVEREF(__pyx_t_4);
  9724. __Pyx_XGIVEREF(__pyx_t_5);
  9725. __Pyx_XGIVEREF(__pyx_t_6);
  9726. __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
  9727. __pyx_L9_try_end:;
  9728. }
  9729. /* "zmq/core/socket.pyx":64
  9730. * import pickle
  9731. *
  9732. * import zmq # <<<<<<<<<<<<<<
  9733. * from zmq.core import constants
  9734. * from zmq.core.constants import *
  9735. */
  9736. __pyx_t_7 = __Pyx_Import(((PyObject *)__pyx_n_s__zmq), 0, -1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9737. __Pyx_GOTREF(__pyx_t_7);
  9738. if (PyObject_SetAttr(__pyx_m, __pyx_n_s__zmq, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9739. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  9740. /* "zmq/core/socket.pyx":65
  9741. *
  9742. * import zmq
  9743. * from zmq.core import constants # <<<<<<<<<<<<<<
  9744. * from zmq.core.constants import *
  9745. * from zmq.core.error import ZMQError, ZMQBindError
  9746. */
  9747. __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9748. __Pyx_GOTREF(((PyObject *)__pyx_t_7));
  9749. __Pyx_INCREF(((PyObject *)__pyx_n_s__constants));
  9750. PyList_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_n_s__constants));
  9751. __Pyx_GIVEREF(((PyObject *)__pyx_n_s__constants));
  9752. __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s_44), ((PyObject *)__pyx_t_7), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9753. __Pyx_GOTREF(__pyx_t_2);
  9754. __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
  9755. __pyx_t_7 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__constants); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9756. __Pyx_GOTREF(__pyx_t_7);
  9757. if (PyObject_SetAttr(__pyx_m, __pyx_n_s__constants, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9758. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  9759. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  9760. /* "zmq/core/socket.pyx":66
  9761. * import zmq
  9762. * from zmq.core import constants
  9763. * from zmq.core.constants import * # <<<<<<<<<<<<<<
  9764. * from zmq.core.error import ZMQError, ZMQBindError
  9765. * from zmq.utils.strtypes import bytes,unicode,basestring
  9766. */
  9767. __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9768. __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  9769. __Pyx_INCREF(((PyObject *)__pyx_n_s_46));
  9770. PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s_46));
  9771. __Pyx_GIVEREF(((PyObject *)__pyx_n_s_46));
  9772. __pyx_t_7 = __Pyx_Import(((PyObject *)__pyx_n_s_45), ((PyObject *)__pyx_t_2), -1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9773. __Pyx_GOTREF(__pyx_t_7);
  9774. __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  9775. if (__pyx_import_star(__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  9776. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  9777. /* "zmq/core/socket.pyx":67
  9778. * from zmq.core import constants
  9779. * from zmq.core.constants import *
  9780. * from zmq.core.error import ZMQError, ZMQBindError # <<<<<<<<<<<<<<
  9781. * from zmq.utils.strtypes import bytes,unicode,basestring
  9782. *
  9783. */
  9784. __pyx_t_7 = PyList_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9785. __Pyx_GOTREF(((PyObject *)__pyx_t_7));
  9786. __Pyx_INCREF(((PyObject *)__pyx_n_s__ZMQError));
  9787. PyList_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_n_s__ZMQError));
  9788. __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ZMQError));
  9789. __Pyx_INCREF(((PyObject *)__pyx_n_s__ZMQBindError));
  9790. PyList_SET_ITEM(__pyx_t_7, 1, ((PyObject *)__pyx_n_s__ZMQBindError));
  9791. __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ZMQBindError));
  9792. __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s_47), ((PyObject *)__pyx_t_7), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9793. __Pyx_GOTREF(__pyx_t_2);
  9794. __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
  9795. __pyx_t_7 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9796. __Pyx_GOTREF(__pyx_t_7);
  9797. if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ZMQError, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9798. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  9799. __pyx_t_7 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__ZMQBindError); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9800. __Pyx_GOTREF(__pyx_t_7);
  9801. if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ZMQBindError, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9802. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  9803. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  9804. /* "zmq/core/socket.pyx":68
  9805. * from zmq.core.constants import *
  9806. * from zmq.core.error import ZMQError, ZMQBindError
  9807. * from zmq.utils.strtypes import bytes,unicode,basestring # <<<<<<<<<<<<<<
  9808. *
  9809. * #-----------------------------------------------------------------------------
  9810. */
  9811. __pyx_t_2 = PyList_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9812. __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  9813. __Pyx_INCREF(((PyObject *)__pyx_n_s__bytes));
  9814. PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__bytes));
  9815. __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bytes));
  9816. __Pyx_INCREF(((PyObject *)__pyx_n_s__unicode));
  9817. PyList_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__unicode));
  9818. __Pyx_GIVEREF(((PyObject *)__pyx_n_s__unicode));
  9819. __Pyx_INCREF(((PyObject *)__pyx_n_s__basestring));
  9820. PyList_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_n_s__basestring));
  9821. __Pyx_GIVEREF(((PyObject *)__pyx_n_s__basestring));
  9822. __pyx_t_7 = __Pyx_Import(((PyObject *)__pyx_n_s_48), ((PyObject *)__pyx_t_2), -1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9823. __Pyx_GOTREF(__pyx_t_7);
  9824. __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  9825. __pyx_t_2 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__bytes); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9826. __Pyx_GOTREF(__pyx_t_2);
  9827. if (PyObject_SetAttr(__pyx_m, __pyx_n_s__bytes, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9828. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  9829. __pyx_t_2 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__unicode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9830. __Pyx_GOTREF(__pyx_t_2);
  9831. if (PyObject_SetAttr(__pyx_m, __pyx_n_s__unicode, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9832. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  9833. __pyx_t_2 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__basestring); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9834. __Pyx_GOTREF(__pyx_t_2);
  9835. if (PyObject_SetAttr(__pyx_m, __pyx_n_s__basestring, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9836. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  9837. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  9838. /* "zmq/core/socket.pyx":99
  9839. * return False
  9840. *
  9841. * cdef inline Message _recv_message(void *handle, int flags=0, track=False): # <<<<<<<<<<<<<<
  9842. * """Receive a message in a non-copying manner and return a Message."""
  9843. * cdef int rc
  9844. */
  9845. __pyx_t_7 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9846. __Pyx_GOTREF(__pyx_t_7);
  9847. __pyx_k_1 = __pyx_t_7;
  9848. __Pyx_GIVEREF(__pyx_t_7);
  9849. __pyx_t_7 = 0;
  9850. /* "zmq/core/socket.pyx":227
  9851. *
  9852. * @property
  9853. * def closed(self): # <<<<<<<<<<<<<<
  9854. * return _check_closed(self, False)
  9855. *
  9856. */
  9857. __pyx_t_7 = __Pyx_GetName((PyObject *)__pyx_ptype_3zmq_4core_6socket_Socket, __pyx_n_s__closed); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9858. __Pyx_GOTREF(__pyx_t_7);
  9859. __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9860. __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  9861. PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_7);
  9862. __Pyx_GIVEREF(__pyx_t_7);
  9863. __pyx_t_7 = 0;
  9864. __pyx_t_7 = PyObject_Call(__pyx_builtin_property, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9865. __Pyx_GOTREF(__pyx_t_7);
  9866. __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  9867. if (PyDict_SetItem((PyObject *)__pyx_ptype_3zmq_4core_6socket_Socket->tp_dict, __pyx_n_s__closed, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9868. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  9869. PyType_Modified(__pyx_ptype_3zmq_4core_6socket_Socket);
  9870. /* "zmq/core/socket.pyx":559
  9871. * #-------------------------------------------------------------------------
  9872. *
  9873. * cpdef object send(self, object data, int flags=0, copy=True, track=False): # <<<<<<<<<<<<<<
  9874. * """s.send(data, flags=0, copy=True, track=False)
  9875. *
  9876. */
  9877. __pyx_t_7 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9878. __Pyx_GOTREF(__pyx_t_7);
  9879. __pyx_k_18 = __pyx_t_7;
  9880. __Pyx_GIVEREF(__pyx_t_7);
  9881. __pyx_t_7 = 0;
  9882. __pyx_t_7 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9883. __Pyx_GOTREF(__pyx_t_7);
  9884. __pyx_k_19 = __pyx_t_7;
  9885. __Pyx_GIVEREF(__pyx_t_7);
  9886. __pyx_t_7 = 0;
  9887. /* "zmq/core/socket.pyx":616
  9888. * return _send_message(self.handle, msg, flags)
  9889. *
  9890. * cpdef object recv(self, int flags=0, copy=True, track=False): # <<<<<<<<<<<<<<
  9891. * """s.recv(flags=0, copy=True, track=False)
  9892. *
  9893. */
  9894. __pyx_t_7 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9895. __Pyx_GOTREF(__pyx_t_7);
  9896. __pyx_k_24 = __pyx_t_7;
  9897. __Pyx_GIVEREF(__pyx_t_7);
  9898. __pyx_t_7 = 0;
  9899. __pyx_t_7 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9900. __Pyx_GOTREF(__pyx_t_7);
  9901. __pyx_k_25 = __pyx_t_7;
  9902. __Pyx_GIVEREF(__pyx_t_7);
  9903. __pyx_t_7 = 0;
  9904. /* "zmq/core/socket.pyx":654
  9905. * return _recv_message(self.handle, flags, track)
  9906. *
  9907. * def send_multipart(self, msg_parts, int flags=0, copy=True, track=False, prefix=None): # <<<<<<<<<<<<<<
  9908. * """s.send_multipart(msg_parts, flags=0, copy=True, track=False, prefix=None)
  9909. *
  9910. */
  9911. __pyx_t_7 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9912. __Pyx_GOTREF(__pyx_t_7);
  9913. __pyx_k_26 = __pyx_t_7;
  9914. __Pyx_GIVEREF(__pyx_t_7);
  9915. __pyx_t_7 = 0;
  9916. __pyx_t_7 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9917. __Pyx_GOTREF(__pyx_t_7);
  9918. __pyx_k_27 = __pyx_t_7;
  9919. __Pyx_GIVEREF(__pyx_t_7);
  9920. __pyx_t_7 = 0;
  9921. /* "zmq/core/socket.pyx":694
  9922. * return self.send(msg_parts[-1], flags, copy=copy, track=track)
  9923. *
  9924. * def recv_multipart(self, int flags=0, copy=True, track=False): # <<<<<<<<<<<<<<
  9925. * """s.recv_multipart(flags=0, copy=True, track=False)
  9926. *
  9927. */
  9928. __pyx_t_7 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9929. __Pyx_GOTREF(__pyx_t_7);
  9930. __pyx_k_28 = __pyx_t_7;
  9931. __Pyx_GIVEREF(__pyx_t_7);
  9932. __pyx_t_7 = 0;
  9933. __pyx_t_7 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9934. __Pyx_GOTREF(__pyx_t_7);
  9935. __pyx_k_29 = __pyx_t_7;
  9936. __Pyx_GIVEREF(__pyx_t_7);
  9937. __pyx_t_7 = 0;
  9938. /* "zmq/core/socket.pyx":728
  9939. * return parts
  9940. *
  9941. * def send_unicode(self, u, int flags=0, copy=False, encoding='utf-8'): # <<<<<<<<<<<<<<
  9942. * """s.send_unicode(u, flags=0, copy=False, encoding='utf-8')
  9943. *
  9944. */
  9945. __pyx_t_7 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9946. __Pyx_GOTREF(__pyx_t_7);
  9947. __pyx_k_30 = __pyx_t_7;
  9948. __Pyx_GIVEREF(__pyx_t_7);
  9949. __pyx_t_7 = 0;
  9950. /* "zmq/core/socket.pyx":876
  9951. *
  9952. *
  9953. * __all__ = ['Socket'] # <<<<<<<<<<<<<<
  9954. */
  9955. __pyx_t_7 = PyList_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9956. __Pyx_GOTREF(((PyObject *)__pyx_t_7));
  9957. __Pyx_INCREF(((PyObject *)__pyx_n_s__Socket));
  9958. PyList_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_n_s__Socket));
  9959. __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Socket));
  9960. if (PyObject_SetAttr(__pyx_m, __pyx_n_s____all__, ((PyObject *)__pyx_t_7)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9961. __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
  9962. /* "zmq/core/socket.pyx":1
  9963. * """0MQ Socket class.""" # <<<<<<<<<<<<<<
  9964. *
  9965. * #
  9966. */
  9967. __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9968. __Pyx_GOTREF(((PyObject *)__pyx_t_7));
  9969. if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_7)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  9970. __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
  9971. /* "buffers.pxd":303
  9972. *
  9973. *
  9974. * cdef inline object viewfromobject_w(object obj): # <<<<<<<<<<<<<<
  9975. * """Wrapper for writable viewfromobject."""
  9976. * return viewfromobject(obj, 0)
  9977. */
  9978. goto __pyx_L0;
  9979. __pyx_L1_error:;
  9980. __Pyx_XDECREF(__pyx_t_1);
  9981. __Pyx_XDECREF(__pyx_t_2);
  9982. __Pyx_XDECREF(__pyx_t_3);
  9983. __Pyx_XDECREF(__pyx_t_7);
  9984. __Pyx_XDECREF(__pyx_t_8);
  9985. if (__pyx_m) {
  9986. __Pyx_AddTraceback("init zmq.core.socket", __pyx_clineno, __pyx_lineno, __pyx_filename);
  9987. Py_DECREF(__pyx_m); __pyx_m = 0;
  9988. } else if (!PyErr_Occurred()) {
  9989. PyErr_SetString(PyExc_ImportError, "init zmq.core.socket");
  9990. }
  9991. __pyx_L0:;
  9992. __Pyx_RefNannyFinishContext();
  9993. #if PY_MAJOR_VERSION < 3
  9994. return;
  9995. #else
  9996. return __pyx_m;
  9997. #endif
  9998. }
  9999. /* Runtime support code */
  10000. #if CYTHON_REFNANNY
  10001. static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
  10002. PyObject *m = NULL, *p = NULL;
  10003. void *r = NULL;
  10004. m = PyImport_ImportModule((char *)modname);
  10005. if (!m) goto end;
  10006. p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
  10007. if (!p) goto end;
  10008. r = PyLong_AsVoidPtr(p);
  10009. end:
  10010. Py_XDECREF(p);
  10011. Py_XDECREF(m);
  10012. return (__Pyx_RefNannyAPIStruct *)r;
  10013. }
  10014. #endif /* CYTHON_REFNANNY */
  10015. static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
  10016. PyObject *result;
  10017. result = PyObject_GetAttr(dict, name);
  10018. if (!result) {
  10019. if (dict != __pyx_b) {
  10020. PyErr_Clear();
  10021. result = PyObject_GetAttr(__pyx_b, name);
  10022. }
  10023. if (!result) {
  10024. PyErr_SetObject(PyExc_NameError, name);
  10025. }
  10026. }
  10027. return result;
  10028. }
  10029. static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
  10030. PyObject *tmp_type, *tmp_value, *tmp_tb;
  10031. PyThreadState *tstate = PyThreadState_GET();
  10032. tmp_type = tstate->curexc_type;
  10033. tmp_value = tstate->curexc_value;
  10034. tmp_tb = tstate->curexc_traceback;
  10035. tstate->curexc_type = type;
  10036. tstate->curexc_value = value;
  10037. tstate->curexc_traceback = tb;
  10038. Py_XDECREF(tmp_type);
  10039. Py_XDECREF(tmp_value);
  10040. Py_XDECREF(tmp_tb);
  10041. }
  10042. static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
  10043. PyThreadState *tstate = PyThreadState_GET();
  10044. *type = tstate->curexc_type;
  10045. *value = tstate->curexc_value;
  10046. *tb = tstate->curexc_traceback;
  10047. tstate->curexc_type = 0;
  10048. tstate->curexc_value = 0;
  10049. tstate->curexc_traceback = 0;
  10050. }
  10051. #if PY_MAJOR_VERSION < 3
  10052. static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
  10053. /* cause is unused */
  10054. Py_XINCREF(type);
  10055. Py_XINCREF(value);
  10056. Py_XINCREF(tb);
  10057. /* First, check the traceback argument, replacing None with NULL. */
  10058. if (tb == Py_None) {
  10059. Py_DECREF(tb);
  10060. tb = 0;
  10061. }
  10062. else if (tb != NULL && !PyTraceBack_Check(tb)) {
  10063. PyErr_SetString(PyExc_TypeError,
  10064. "raise: arg 3 must be a traceback or None");
  10065. goto raise_error;
  10066. }
  10067. /* Next, replace a missing value with None */
  10068. if (value == NULL) {
  10069. value = Py_None;
  10070. Py_INCREF(value);
  10071. }
  10072. #if PY_VERSION_HEX < 0x02050000
  10073. if (!PyClass_Check(type))
  10074. #else
  10075. if (!PyType_Check(type))
  10076. #endif
  10077. {
  10078. /* Raising an instance. The value should be a dummy. */
  10079. if (value != Py_None) {
  10080. PyErr_SetString(PyExc_TypeError,
  10081. "instance exception may not have a separate value");
  10082. goto raise_error;
  10083. }
  10084. /* Normalize to raise <class>, <instance> */
  10085. Py_DECREF(value);
  10086. value = type;
  10087. #if PY_VERSION_HEX < 0x02050000
  10088. if (PyInstance_Check(type)) {
  10089. type = (PyObject*) ((PyInstanceObject*)type)->in_class;
  10090. Py_INCREF(type);
  10091. }
  10092. else {
  10093. type = 0;
  10094. PyErr_SetString(PyExc_TypeError,
  10095. "raise: exception must be an old-style class or instance");
  10096. goto raise_error;
  10097. }
  10098. #else
  10099. type = (PyObject*) Py_TYPE(type);
  10100. Py_INCREF(type);
  10101. if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
  10102. PyErr_SetString(PyExc_TypeError,
  10103. "raise: exception class must be a subclass of BaseException");
  10104. goto raise_error;
  10105. }
  10106. #endif
  10107. }
  10108. __Pyx_ErrRestore(type, value, tb);
  10109. return;
  10110. raise_error:
  10111. Py_XDECREF(value);
  10112. Py_XDECREF(type);
  10113. Py_XDECREF(tb);
  10114. return;
  10115. }
  10116. #else /* Python 3+ */
  10117. static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
  10118. if (tb == Py_None) {
  10119. tb = 0;
  10120. } else if (tb && !PyTraceBack_Check(tb)) {
  10121. PyErr_SetString(PyExc_TypeError,
  10122. "raise: arg 3 must be a traceback or None");
  10123. goto bad;
  10124. }
  10125. if (value == Py_None)
  10126. value = 0;
  10127. if (PyExceptionInstance_Check(type)) {
  10128. if (value) {
  10129. PyErr_SetString(PyExc_TypeError,
  10130. "instance exception may not have a separate value");
  10131. goto bad;
  10132. }
  10133. value = type;
  10134. type = (PyObject*) Py_TYPE(value);
  10135. } else if (!PyExceptionClass_Check(type)) {
  10136. PyErr_SetString(PyExc_TypeError,
  10137. "raise: exception class must be a subclass of BaseException");
  10138. goto bad;
  10139. }
  10140. if (cause) {
  10141. PyObject *fixed_cause;
  10142. if (PyExceptionClass_Check(cause)) {
  10143. fixed_cause = PyObject_CallObject(cause, NULL);
  10144. if (fixed_cause == NULL)
  10145. goto bad;
  10146. }
  10147. else if (PyExceptionInstance_Check(cause)) {
  10148. fixed_cause = cause;
  10149. Py_INCREF(fixed_cause);
  10150. }
  10151. else {
  10152. PyErr_SetString(PyExc_TypeError,
  10153. "exception causes must derive from "
  10154. "BaseException");
  10155. goto bad;
  10156. }
  10157. if (!value) {
  10158. value = PyObject_CallObject(type, NULL);
  10159. }
  10160. PyException_SetCause(value, fixed_cause);
  10161. }
  10162. PyErr_SetObject(type, value);
  10163. if (tb) {
  10164. PyThreadState *tstate = PyThreadState_GET();
  10165. PyObject* tmp_tb = tstate->curexc_traceback;
  10166. if (tb != tmp_tb) {
  10167. Py_INCREF(tb);
  10168. tstate->curexc_traceback = tb;
  10169. Py_XDECREF(tmp_tb);
  10170. }
  10171. }
  10172. bad:
  10173. return;
  10174. }
  10175. #endif
  10176. static void __Pyx_RaiseArgtupleInvalid(
  10177. const char* func_name,
  10178. int exact,
  10179. Py_ssize_t num_min,
  10180. Py_ssize_t num_max,
  10181. Py_ssize_t num_found)
  10182. {
  10183. Py_ssize_t num_expected;
  10184. const char *more_or_less;
  10185. if (num_found < num_min) {
  10186. num_expected = num_min;
  10187. more_or_less = "at least";
  10188. } else {
  10189. num_expected = num_max;
  10190. more_or_less = "at most";
  10191. }
  10192. if (exact) {
  10193. more_or_less = "exactly";
  10194. }
  10195. PyErr_Format(PyExc_TypeError,
  10196. "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)",
  10197. func_name, more_or_less, num_expected,
  10198. (num_expected == 1) ? "" : "s", num_found);
  10199. }
  10200. static void __Pyx_RaiseDoubleKeywordsError(
  10201. const char* func_name,
  10202. PyObject* kw_name)
  10203. {
  10204. PyErr_Format(PyExc_TypeError,
  10205. #if PY_MAJOR_VERSION >= 3
  10206. "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
  10207. #else
  10208. "%s() got multiple values for keyword argument '%s'", func_name,
  10209. PyString_AS_STRING(kw_name));
  10210. #endif
  10211. }
  10212. static int __Pyx_ParseOptionalKeywords(
  10213. PyObject *kwds,
  10214. PyObject **argnames[],
  10215. PyObject *kwds2,
  10216. PyObject *values[],
  10217. Py_ssize_t num_pos_args,
  10218. const char* function_name)
  10219. {
  10220. PyObject *key = 0, *value = 0;
  10221. Py_ssize_t pos = 0;
  10222. PyObject*** name;
  10223. PyObject*** first_kw_arg = argnames + num_pos_args;
  10224. while (PyDict_Next(kwds, &pos, &key, &value)) {
  10225. name = first_kw_arg;
  10226. while (*name && (**name != key)) name++;
  10227. if (*name) {
  10228. values[name-argnames] = value;
  10229. } else {
  10230. #if PY_MAJOR_VERSION < 3
  10231. if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) {
  10232. #else
  10233. if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) {
  10234. #endif
  10235. goto invalid_keyword_type;
  10236. } else {
  10237. for (name = first_kw_arg; *name; name++) {
  10238. #if PY_MAJOR_VERSION >= 3
  10239. if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
  10240. PyUnicode_Compare(**name, key) == 0) break;
  10241. #else
  10242. if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
  10243. _PyString_Eq(**name, key)) break;
  10244. #endif
  10245. }
  10246. if (*name) {
  10247. values[name-argnames] = value;
  10248. } else {
  10249. /* unexpected keyword found */
  10250. for (name=argnames; name != first_kw_arg; name++) {
  10251. if (**name == key) goto arg_passed_twice;
  10252. #if PY_MAJOR_VERSION >= 3
  10253. if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
  10254. PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice;
  10255. #else
  10256. if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
  10257. _PyString_Eq(**name, key)) goto arg_passed_twice;
  10258. #endif
  10259. }
  10260. if (kwds2) {
  10261. if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
  10262. } else {
  10263. goto invalid_keyword;
  10264. }
  10265. }
  10266. }
  10267. }
  10268. }
  10269. return 0;
  10270. arg_passed_twice:
  10271. __Pyx_RaiseDoubleKeywordsError(function_name, **name);
  10272. goto bad;
  10273. invalid_keyword_type:
  10274. PyErr_Format(PyExc_TypeError,
  10275. "%s() keywords must be strings", function_name);
  10276. goto bad;
  10277. invalid_keyword:
  10278. PyErr_Format(PyExc_TypeError,
  10279. #if PY_MAJOR_VERSION < 3
  10280. "%s() got an unexpected keyword argument '%s'",
  10281. function_name, PyString_AsString(key));
  10282. #else
  10283. "%s() got an unexpected keyword argument '%U'",
  10284. function_name, key);
  10285. #endif
  10286. bad:
  10287. return -1;
  10288. }
  10289. static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
  10290. const char *name, int exact)
  10291. {
  10292. if (!type) {
  10293. PyErr_Format(PyExc_SystemError, "Missing type object");
  10294. return 0;
  10295. }
  10296. if (none_allowed && obj == Py_None) return 1;
  10297. else if (exact) {
  10298. if (Py_TYPE(obj) == type) return 1;
  10299. }
  10300. else {
  10301. if (PyObject_TypeCheck(obj, type)) return 1;
  10302. }
  10303. PyErr_Format(PyExc_TypeError,
  10304. "Argument '%s' has incorrect type (expected %s, got %s)",
  10305. name, type->tp_name, Py_TYPE(obj)->tp_name);
  10306. return 0;
  10307. }
  10308. static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
  10309. PyObject *local_type, *local_value, *local_tb;
  10310. PyObject *tmp_type, *tmp_value, *tmp_tb;
  10311. PyThreadState *tstate = PyThreadState_GET();
  10312. local_type = tstate->curexc_type;
  10313. local_value = tstate->curexc_value;
  10314. local_tb = tstate->curexc_traceback;
  10315. tstate->curexc_type = 0;
  10316. tstate->curexc_value = 0;
  10317. tstate->curexc_traceback = 0;
  10318. PyErr_NormalizeException(&local_type, &local_value, &local_tb);
  10319. if (unlikely(tstate->curexc_type))
  10320. goto bad;
  10321. #if PY_MAJOR_VERSION >= 3
  10322. if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
  10323. goto bad;
  10324. #endif
  10325. *type = local_type;
  10326. *value = local_value;
  10327. *tb = local_tb;
  10328. Py_INCREF(local_type);
  10329. Py_INCREF(local_value);
  10330. Py_INCREF(local_tb);
  10331. tmp_type = tstate->exc_type;
  10332. tmp_value = tstate->exc_value;
  10333. tmp_tb = tstate->exc_traceback;
  10334. tstate->exc_type = local_type;
  10335. tstate->exc_value = local_value;
  10336. tstate->exc_traceback = local_tb;
  10337. /* Make sure tstate is in a consistent state when we XDECREF
  10338. these objects (XDECREF may run arbitrary code). */
  10339. Py_XDECREF(tmp_type);
  10340. Py_XDECREF(tmp_value);
  10341. Py_XDECREF(tmp_tb);
  10342. return 0;
  10343. bad:
  10344. *type = 0;
  10345. *value = 0;
  10346. *tb = 0;
  10347. Py_XDECREF(local_type);
  10348. Py_XDECREF(local_value);
  10349. Py_XDECREF(local_tb);
  10350. return -1;
  10351. }
  10352. static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void) {
  10353. PyErr_SetString(PyExc_TypeError, "'NoneType' object is unsubscriptable");
  10354. }
  10355. static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
  10356. if (unlikely(!type)) {
  10357. PyErr_Format(PyExc_SystemError, "Missing type object");
  10358. return 0;
  10359. }
  10360. if (likely(PyObject_TypeCheck(obj, type)))
  10361. return 1;
  10362. PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
  10363. Py_TYPE(obj)->tp_name, type->tp_name);
  10364. return 0;
  10365. }
  10366. static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
  10367. PyThreadState *tstate = PyThreadState_GET();
  10368. *type = tstate->exc_type;
  10369. *value = tstate->exc_value;
  10370. *tb = tstate->exc_traceback;
  10371. Py_XINCREF(*type);
  10372. Py_XINCREF(*value);
  10373. Py_XINCREF(*tb);
  10374. }
  10375. static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) {
  10376. PyObject *tmp_type, *tmp_value, *tmp_tb;
  10377. PyThreadState *tstate = PyThreadState_GET();
  10378. tmp_type = tstate->exc_type;
  10379. tmp_value = tstate->exc_value;
  10380. tmp_tb = tstate->exc_traceback;
  10381. tstate->exc_type = type;
  10382. tstate->exc_value = value;
  10383. tstate->exc_traceback = tb;
  10384. Py_XDECREF(tmp_type);
  10385. Py_XDECREF(tmp_value);
  10386. Py_XDECREF(tmp_tb);
  10387. }
  10388. static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) {
  10389. PyObject *py_import = 0;
  10390. PyObject *empty_list = 0;
  10391. PyObject *module = 0;
  10392. PyObject *global_dict = 0;
  10393. PyObject *empty_dict = 0;
  10394. PyObject *list;
  10395. py_import = __Pyx_GetAttrString(__pyx_b, "__import__");
  10396. if (!py_import)
  10397. goto bad;
  10398. if (from_list)
  10399. list = from_list;
  10400. else {
  10401. empty_list = PyList_New(0);
  10402. if (!empty_list)
  10403. goto bad;
  10404. list = empty_list;
  10405. }
  10406. global_dict = PyModule_GetDict(__pyx_m);
  10407. if (!global_dict)
  10408. goto bad;
  10409. empty_dict = PyDict_New();
  10410. if (!empty_dict)
  10411. goto bad;
  10412. #if PY_VERSION_HEX >= 0x02050000
  10413. {
  10414. PyObject *py_level = PyInt_FromLong(level);
  10415. if (!py_level)
  10416. goto bad;
  10417. module = PyObject_CallFunctionObjArgs(py_import,
  10418. name, global_dict, empty_dict, list, py_level, NULL);
  10419. Py_DECREF(py_level);
  10420. }
  10421. #else
  10422. if (level>0) {
  10423. PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4.");
  10424. goto bad;
  10425. }
  10426. module = PyObject_CallFunctionObjArgs(py_import,
  10427. name, global_dict, empty_dict, list, NULL);
  10428. #endif
  10429. bad:
  10430. Py_XDECREF(empty_list);
  10431. Py_XDECREF(py_import);
  10432. Py_XDECREF(empty_dict);
  10433. return module;
  10434. }
  10435. static CYTHON_INLINE pyzmq_int64_t __Pyx_PyInt_from_py_pyzmq_int64_t(PyObject* x) {
  10436. const pyzmq_int64_t neg_one = (pyzmq_int64_t)-1, const_zero = (pyzmq_int64_t)0;
  10437. const int is_unsigned = const_zero < neg_one;
  10438. if (sizeof(pyzmq_int64_t) == sizeof(char)) {
  10439. if (is_unsigned)
  10440. return (pyzmq_int64_t)__Pyx_PyInt_AsUnsignedChar(x);
  10441. else
  10442. return (pyzmq_int64_t)__Pyx_PyInt_AsSignedChar(x);
  10443. } else if (sizeof(pyzmq_int64_t) == sizeof(short)) {
  10444. if (is_unsigned)
  10445. return (pyzmq_int64_t)__Pyx_PyInt_AsUnsignedShort(x);
  10446. else
  10447. return (pyzmq_int64_t)__Pyx_PyInt_AsSignedShort(x);
  10448. } else if (sizeof(pyzmq_int64_t) == sizeof(int)) {
  10449. if (is_unsigned)
  10450. return (pyzmq_int64_t)__Pyx_PyInt_AsUnsignedInt(x);
  10451. else
  10452. return (pyzmq_int64_t)__Pyx_PyInt_AsSignedInt(x);
  10453. } else if (sizeof(pyzmq_int64_t) == sizeof(long)) {
  10454. if (is_unsigned)
  10455. return (pyzmq_int64_t)__Pyx_PyInt_AsUnsignedLong(x);
  10456. else
  10457. return (pyzmq_int64_t)__Pyx_PyInt_AsSignedLong(x);
  10458. } else if (sizeof(pyzmq_int64_t) == sizeof(PY_LONG_LONG)) {
  10459. if (is_unsigned)
  10460. return (pyzmq_int64_t)__Pyx_PyInt_AsUnsignedLongLong(x);
  10461. else
  10462. return (pyzmq_int64_t)__Pyx_PyInt_AsSignedLongLong(x);
  10463. } else {
  10464. pyzmq_int64_t val;
  10465. PyObject *v = __Pyx_PyNumber_Int(x);
  10466. #if PY_VERSION_HEX < 0x03000000
  10467. if (likely(v) && !PyLong_Check(v)) {
  10468. PyObject *tmp = v;
  10469. v = PyNumber_Long(tmp);
  10470. Py_DECREF(tmp);
  10471. }
  10472. #endif
  10473. if (likely(v)) {
  10474. int one = 1; int is_little = (int)*(unsigned char *)&one;
  10475. unsigned char *bytes = (unsigned char *)&val;
  10476. int ret = _PyLong_AsByteArray((PyLongObject *)v,
  10477. bytes, sizeof(val),
  10478. is_little, !is_unsigned);
  10479. Py_DECREF(v);
  10480. if (likely(!ret))
  10481. return val;
  10482. }
  10483. return (pyzmq_int64_t)-1;
  10484. }
  10485. }
  10486. static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_pyzmq_int64_t(pyzmq_int64_t val) {
  10487. const pyzmq_int64_t neg_one = (pyzmq_int64_t)-1, const_zero = (pyzmq_int64_t)0;
  10488. const int is_unsigned = const_zero < neg_one;
  10489. if ((sizeof(pyzmq_int64_t) == sizeof(char)) ||
  10490. (sizeof(pyzmq_int64_t) == sizeof(short))) {
  10491. return PyInt_FromLong((long)val);
  10492. } else if ((sizeof(pyzmq_int64_t) == sizeof(int)) ||
  10493. (sizeof(pyzmq_int64_t) == sizeof(long))) {
  10494. if (is_unsigned)
  10495. return PyLong_FromUnsignedLong((unsigned long)val);
  10496. else
  10497. return PyInt_FromLong((long)val);
  10498. } else if (sizeof(pyzmq_int64_t) == sizeof(PY_LONG_LONG)) {
  10499. if (is_unsigned)
  10500. return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val);
  10501. else
  10502. return PyLong_FromLongLong((PY_LONG_LONG)val);
  10503. } else {
  10504. int one = 1; int little = (int)*(unsigned char *)&one;
  10505. unsigned char *bytes = (unsigned char *)&val;
  10506. return _PyLong_FromByteArray(bytes, sizeof(pyzmq_int64_t),
  10507. little, !is_unsigned);
  10508. }
  10509. }
  10510. static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_ZMQ_FD_T(ZMQ_FD_T val) {
  10511. const ZMQ_FD_T neg_one = (ZMQ_FD_T)-1, const_zero = (ZMQ_FD_T)0;
  10512. const int is_unsigned = const_zero < neg_one;
  10513. if ((sizeof(ZMQ_FD_T) == sizeof(char)) ||
  10514. (sizeof(ZMQ_FD_T) == sizeof(short))) {
  10515. return PyInt_FromLong((long)val);
  10516. } else if ((sizeof(ZMQ_FD_T) == sizeof(int)) ||
  10517. (sizeof(ZMQ_FD_T) == sizeof(long))) {
  10518. if (is_unsigned)
  10519. return PyLong_FromUnsignedLong((unsigned long)val);
  10520. else
  10521. return PyInt_FromLong((long)val);
  10522. } else if (sizeof(ZMQ_FD_T) == sizeof(PY_LONG_LONG)) {
  10523. if (is_unsigned)
  10524. return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val);
  10525. else
  10526. return PyLong_FromLongLong((PY_LONG_LONG)val);
  10527. } else {
  10528. int one = 1; int little = (int)*(unsigned char *)&one;
  10529. unsigned char *bytes = (unsigned char *)&val;
  10530. return _PyLong_FromByteArray(bytes, sizeof(ZMQ_FD_T),
  10531. little, !is_unsigned);
  10532. }
  10533. }
  10534. static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
  10535. PyObject *r = PyObject_GetAttr(o, n);
  10536. if (!r) {
  10537. if (!PyErr_ExceptionMatches(PyExc_AttributeError))
  10538. goto bad;
  10539. PyErr_Clear();
  10540. r = d;
  10541. Py_INCREF(d);
  10542. }
  10543. return r;
  10544. bad:
  10545. return NULL;
  10546. }
  10547. static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
  10548. if (s1 == s2) { /* as done by PyObject_RichCompareBool(); also catches the (interned) empty string */
  10549. return (equals == Py_EQ);
  10550. } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
  10551. if (PyBytes_GET_SIZE(s1) != PyBytes_GET_SIZE(s2)) {
  10552. return (equals == Py_NE);
  10553. } else if (PyBytes_GET_SIZE(s1) == 1) {
  10554. if (equals == Py_EQ)
  10555. return (PyBytes_AS_STRING(s1)[0] == PyBytes_AS_STRING(s2)[0]);
  10556. else
  10557. return (PyBytes_AS_STRING(s1)[0] != PyBytes_AS_STRING(s2)[0]);
  10558. } else {
  10559. int result = memcmp(PyBytes_AS_STRING(s1), PyBytes_AS_STRING(s2), (size_t)PyBytes_GET_SIZE(s1));
  10560. return (equals == Py_EQ) ? (result == 0) : (result != 0);
  10561. }
  10562. } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
  10563. return (equals == Py_NE);
  10564. } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
  10565. return (equals == Py_NE);
  10566. } else {
  10567. int result;
  10568. PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
  10569. if (!py_result)
  10570. return -1;
  10571. result = __Pyx_PyObject_IsTrue(py_result);
  10572. Py_DECREF(py_result);
  10573. return result;
  10574. }
  10575. }
  10576. static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
  10577. if (s1 == s2) { /* as done by PyObject_RichCompareBool(); also catches the (interned) empty string */
  10578. return (equals == Py_EQ);
  10579. } else if (PyUnicode_CheckExact(s1) & PyUnicode_CheckExact(s2)) {
  10580. if (PyUnicode_GET_SIZE(s1) != PyUnicode_GET_SIZE(s2)) {
  10581. return (equals == Py_NE);
  10582. } else if (PyUnicode_GET_SIZE(s1) == 1) {
  10583. if (equals == Py_EQ)
  10584. return (PyUnicode_AS_UNICODE(s1)[0] == PyUnicode_AS_UNICODE(s2)[0]);
  10585. else
  10586. return (PyUnicode_AS_UNICODE(s1)[0] != PyUnicode_AS_UNICODE(s2)[0]);
  10587. } else {
  10588. int result = PyUnicode_Compare(s1, s2);
  10589. if ((result == -1) && unlikely(PyErr_Occurred()))
  10590. return -1;
  10591. return (equals == Py_EQ) ? (result == 0) : (result != 0);
  10592. }
  10593. } else if ((s1 == Py_None) & PyUnicode_CheckExact(s2)) {
  10594. return (equals == Py_NE);
  10595. } else if ((s2 == Py_None) & PyUnicode_CheckExact(s1)) {
  10596. return (equals == Py_NE);
  10597. } else {
  10598. int result;
  10599. PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
  10600. if (!py_result)
  10601. return -1;
  10602. result = __Pyx_PyObject_IsTrue(py_result);
  10603. Py_DECREF(py_result);
  10604. return result;
  10605. }
  10606. }
  10607. static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
  10608. const unsigned char neg_one = (unsigned char)-1, const_zero = 0;
  10609. const int is_unsigned = neg_one > const_zero;
  10610. if (sizeof(unsigned char) < sizeof(long)) {
  10611. long val = __Pyx_PyInt_AsLong(x);
  10612. if (unlikely(val != (long)(unsigned char)val)) {
  10613. if (!unlikely(val == -1 && PyErr_Occurred())) {
  10614. PyErr_SetString(PyExc_OverflowError,
  10615. (is_unsigned && unlikely(val < 0)) ?
  10616. "can't convert negative value to unsigned char" :
  10617. "value too large to convert to unsigned char");
  10618. }
  10619. return (unsigned char)-1;
  10620. }
  10621. return (unsigned char)val;
  10622. }
  10623. return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x);
  10624. }
  10625. static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) {
  10626. const unsigned short neg_one = (unsigned short)-1, const_zero = 0;
  10627. const int is_unsigned = neg_one > const_zero;
  10628. if (sizeof(unsigned short) < sizeof(long)) {
  10629. long val = __Pyx_PyInt_AsLong(x);
  10630. if (unlikely(val != (long)(unsigned short)val)) {
  10631. if (!unlikely(val == -1 && PyErr_Occurred())) {
  10632. PyErr_SetString(PyExc_OverflowError,
  10633. (is_unsigned && unlikely(val < 0)) ?
  10634. "can't convert negative value to unsigned short" :
  10635. "value too large to convert to unsigned short");
  10636. }
  10637. return (unsigned short)-1;
  10638. }
  10639. return (unsigned short)val;
  10640. }
  10641. return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x);
  10642. }
  10643. static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) {
  10644. const unsigned int neg_one = (unsigned int)-1, const_zero = 0;
  10645. const int is_unsigned = neg_one > const_zero;
  10646. if (sizeof(unsigned int) < sizeof(long)) {
  10647. long val = __Pyx_PyInt_AsLong(x);
  10648. if (unlikely(val != (long)(unsigned int)val)) {
  10649. if (!unlikely(val == -1 && PyErr_Occurred())) {
  10650. PyErr_SetString(PyExc_OverflowError,
  10651. (is_unsigned && unlikely(val < 0)) ?
  10652. "can't convert negative value to unsigned int" :
  10653. "value too large to convert to unsigned int");
  10654. }
  10655. return (unsigned int)-1;
  10656. }
  10657. return (unsigned int)val;
  10658. }
  10659. return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x);
  10660. }
  10661. static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) {
  10662. const char neg_one = (char)-1, const_zero = 0;
  10663. const int is_unsigned = neg_one > const_zero;
  10664. if (sizeof(char) < sizeof(long)) {
  10665. long val = __Pyx_PyInt_AsLong(x);
  10666. if (unlikely(val != (long)(char)val)) {
  10667. if (!unlikely(val == -1 && PyErr_Occurred())) {
  10668. PyErr_SetString(PyExc_OverflowError,
  10669. (is_unsigned && unlikely(val < 0)) ?
  10670. "can't convert negative value to char" :
  10671. "value too large to convert to char");
  10672. }
  10673. return (char)-1;
  10674. }
  10675. return (char)val;
  10676. }
  10677. return (char)__Pyx_PyInt_AsLong(x);
  10678. }
  10679. static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) {
  10680. const short neg_one = (short)-1, const_zero = 0;
  10681. const int is_unsigned = neg_one > const_zero;
  10682. if (sizeof(short) < sizeof(long)) {
  10683. long val = __Pyx_PyInt_AsLong(x);
  10684. if (unlikely(val != (long)(short)val)) {
  10685. if (!unlikely(val == -1 && PyErr_Occurred())) {
  10686. PyErr_SetString(PyExc_OverflowError,
  10687. (is_unsigned && unlikely(val < 0)) ?
  10688. "can't convert negative value to short" :
  10689. "value too large to convert to short");
  10690. }
  10691. return (short)-1;
  10692. }
  10693. return (short)val;
  10694. }
  10695. return (short)__Pyx_PyInt_AsLong(x);
  10696. }
  10697. static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) {
  10698. const int neg_one = (int)-1, const_zero = 0;
  10699. const int is_unsigned = neg_one > const_zero;
  10700. if (sizeof(int) < sizeof(long)) {
  10701. long val = __Pyx_PyInt_AsLong(x);
  10702. if (unlikely(val != (long)(int)val)) {
  10703. if (!unlikely(val == -1 && PyErr_Occurred())) {
  10704. PyErr_SetString(PyExc_OverflowError,
  10705. (is_unsigned && unlikely(val < 0)) ?
  10706. "can't convert negative value to int" :
  10707. "value too large to convert to int");
  10708. }
  10709. return (int)-1;
  10710. }
  10711. return (int)val;
  10712. }
  10713. return (int)__Pyx_PyInt_AsLong(x);
  10714. }
  10715. static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) {
  10716. const signed char neg_one = (signed char)-1, const_zero = 0;
  10717. const int is_unsigned = neg_one > const_zero;
  10718. if (sizeof(signed char) < sizeof(long)) {
  10719. long val = __Pyx_PyInt_AsLong(x);
  10720. if (unlikely(val != (long)(signed char)val)) {
  10721. if (!unlikely(val == -1 && PyErr_Occurred())) {
  10722. PyErr_SetString(PyExc_OverflowError,
  10723. (is_unsigned && unlikely(val < 0)) ?
  10724. "can't convert negative value to signed char" :
  10725. "value too large to convert to signed char");
  10726. }
  10727. return (signed char)-1;
  10728. }
  10729. return (signed char)val;
  10730. }
  10731. return (signed char)__Pyx_PyInt_AsSignedLong(x);
  10732. }
  10733. static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) {
  10734. const signed short neg_one = (signed short)-1, const_zero = 0;
  10735. const int is_unsigned = neg_one > const_zero;
  10736. if (sizeof(signed short) < sizeof(long)) {
  10737. long val = __Pyx_PyInt_AsLong(x);
  10738. if (unlikely(val != (long)(signed short)val)) {
  10739. if (!unlikely(val == -1 && PyErr_Occurred())) {
  10740. PyErr_SetString(PyExc_OverflowError,
  10741. (is_unsigned && unlikely(val < 0)) ?
  10742. "can't convert negative value to signed short" :
  10743. "value too large to convert to signed short");
  10744. }
  10745. return (signed short)-1;
  10746. }
  10747. return (signed short)val;
  10748. }
  10749. return (signed short)__Pyx_PyInt_AsSignedLong(x);
  10750. }
  10751. static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) {
  10752. const signed int neg_one = (signed int)-1, const_zero = 0;
  10753. const int is_unsigned = neg_one > const_zero;
  10754. if (sizeof(signed int) < sizeof(long)) {
  10755. long val = __Pyx_PyInt_AsLong(x);
  10756. if (unlikely(val != (long)(signed int)val)) {
  10757. if (!unlikely(val == -1 && PyErr_Occurred())) {
  10758. PyErr_SetString(PyExc_OverflowError,
  10759. (is_unsigned && unlikely(val < 0)) ?
  10760. "can't convert negative value to signed int" :
  10761. "value too large to convert to signed int");
  10762. }
  10763. return (signed int)-1;
  10764. }
  10765. return (signed int)val;
  10766. }
  10767. return (signed int)__Pyx_PyInt_AsSignedLong(x);
  10768. }
  10769. static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) {
  10770. const int neg_one = (int)-1, const_zero = 0;
  10771. const int is_unsigned = neg_one > const_zero;
  10772. if (sizeof(int) < sizeof(long)) {
  10773. long val = __Pyx_PyInt_AsLong(x);
  10774. if (unlikely(val != (long)(int)val)) {
  10775. if (!unlikely(val == -1 && PyErr_Occurred())) {
  10776. PyErr_SetString(PyExc_OverflowError,
  10777. (is_unsigned && unlikely(val < 0)) ?
  10778. "can't convert negative value to int" :
  10779. "value too large to convert to int");
  10780. }
  10781. return (int)-1;
  10782. }
  10783. return (int)val;
  10784. }
  10785. return (int)__Pyx_PyInt_AsLong(x);
  10786. }
  10787. static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
  10788. const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
  10789. const int is_unsigned = neg_one > const_zero;
  10790. #if PY_VERSION_HEX < 0x03000000
  10791. if (likely(PyInt_Check(x))) {
  10792. long val = PyInt_AS_LONG(x);
  10793. if (is_unsigned && unlikely(val < 0)) {
  10794. PyErr_SetString(PyExc_OverflowError,
  10795. "can't convert negative value to unsigned long");
  10796. return (unsigned long)-1;
  10797. }
  10798. return (unsigned long)val;
  10799. } else
  10800. #endif
  10801. if (likely(PyLong_Check(x))) {
  10802. if (is_unsigned) {
  10803. if (unlikely(Py_SIZE(x) < 0)) {
  10804. PyErr_SetString(PyExc_OverflowError,
  10805. "can't convert negative value to unsigned long");
  10806. return (unsigned long)-1;
  10807. }
  10808. return (unsigned long)PyLong_AsUnsignedLong(x);
  10809. } else {
  10810. return (unsigned long)PyLong_AsLong(x);
  10811. }
  10812. } else {
  10813. unsigned long val;
  10814. PyObject *tmp = __Pyx_PyNumber_Int(x);
  10815. if (!tmp) return (unsigned long)-1;
  10816. val = __Pyx_PyInt_AsUnsignedLong(tmp);
  10817. Py_DECREF(tmp);
  10818. return val;
  10819. }
  10820. }
  10821. static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
  10822. const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
  10823. const int is_unsigned = neg_one > const_zero;
  10824. #if PY_VERSION_HEX < 0x03000000
  10825. if (likely(PyInt_Check(x))) {
  10826. long val = PyInt_AS_LONG(x);
  10827. if (is_unsigned && unlikely(val < 0)) {
  10828. PyErr_SetString(PyExc_OverflowError,
  10829. "can't convert negative value to unsigned PY_LONG_LONG");
  10830. return (unsigned PY_LONG_LONG)-1;
  10831. }
  10832. return (unsigned PY_LONG_LONG)val;
  10833. } else
  10834. #endif
  10835. if (likely(PyLong_Check(x))) {
  10836. if (is_unsigned) {
  10837. if (unlikely(Py_SIZE(x) < 0)) {
  10838. PyErr_SetString(PyExc_OverflowError,
  10839. "can't convert negative value to unsigned PY_LONG_LONG");
  10840. return (unsigned PY_LONG_LONG)-1;
  10841. }
  10842. return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
  10843. } else {
  10844. return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x);
  10845. }
  10846. } else {
  10847. unsigned PY_LONG_LONG val;
  10848. PyObject *tmp = __Pyx_PyNumber_Int(x);
  10849. if (!tmp) return (unsigned PY_LONG_LONG)-1;
  10850. val = __Pyx_PyInt_AsUnsignedLongLong(tmp);
  10851. Py_DECREF(tmp);
  10852. return val;
  10853. }
  10854. }
  10855. static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
  10856. const long neg_one = (long)-1, const_zero = 0;
  10857. const int is_unsigned = neg_one > const_zero;
  10858. #if PY_VERSION_HEX < 0x03000000
  10859. if (likely(PyInt_Check(x))) {
  10860. long val = PyInt_AS_LONG(x);
  10861. if (is_unsigned && unlikely(val < 0)) {
  10862. PyErr_SetString(PyExc_OverflowError,
  10863. "can't convert negative value to long");
  10864. return (long)-1;
  10865. }
  10866. return (long)val;
  10867. } else
  10868. #endif
  10869. if (likely(PyLong_Check(x))) {
  10870. if (is_unsigned) {
  10871. if (unlikely(Py_SIZE(x) < 0)) {
  10872. PyErr_SetString(PyExc_OverflowError,
  10873. "can't convert negative value to long");
  10874. return (long)-1;
  10875. }
  10876. return (long)PyLong_AsUnsignedLong(x);
  10877. } else {
  10878. return (long)PyLong_AsLong(x);
  10879. }
  10880. } else {
  10881. long val;
  10882. PyObject *tmp = __Pyx_PyNumber_Int(x);
  10883. if (!tmp) return (long)-1;
  10884. val = __Pyx_PyInt_AsLong(tmp);
  10885. Py_DECREF(tmp);
  10886. return val;
  10887. }
  10888. }
  10889. static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
  10890. const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
  10891. const int is_unsigned = neg_one > const_zero;
  10892. #if PY_VERSION_HEX < 0x03000000
  10893. if (likely(PyInt_Check(x))) {
  10894. long val = PyInt_AS_LONG(x);
  10895. if (is_unsigned && unlikely(val < 0)) {
  10896. PyErr_SetString(PyExc_OverflowError,
  10897. "can't convert negative value to PY_LONG_LONG");
  10898. return (PY_LONG_LONG)-1;
  10899. }
  10900. return (PY_LONG_LONG)val;
  10901. } else
  10902. #endif
  10903. if (likely(PyLong_Check(x))) {
  10904. if (is_unsigned) {
  10905. if (unlikely(Py_SIZE(x) < 0)) {
  10906. PyErr_SetString(PyExc_OverflowError,
  10907. "can't convert negative value to PY_LONG_LONG");
  10908. return (PY_LONG_LONG)-1;
  10909. }
  10910. return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
  10911. } else {
  10912. return (PY_LONG_LONG)PyLong_AsLongLong(x);
  10913. }
  10914. } else {
  10915. PY_LONG_LONG val;
  10916. PyObject *tmp = __Pyx_PyNumber_Int(x);
  10917. if (!tmp) return (PY_LONG_LONG)-1;
  10918. val = __Pyx_PyInt_AsLongLong(tmp);
  10919. Py_DECREF(tmp);
  10920. return val;
  10921. }
  10922. }
  10923. static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
  10924. const signed long neg_one = (signed long)-1, const_zero = 0;
  10925. const int is_unsigned = neg_one > const_zero;
  10926. #if PY_VERSION_HEX < 0x03000000
  10927. if (likely(PyInt_Check(x))) {
  10928. long val = PyInt_AS_LONG(x);
  10929. if (is_unsigned && unlikely(val < 0)) {
  10930. PyErr_SetString(PyExc_OverflowError,
  10931. "can't convert negative value to signed long");
  10932. return (signed long)-1;
  10933. }
  10934. return (signed long)val;
  10935. } else
  10936. #endif
  10937. if (likely(PyLong_Check(x))) {
  10938. if (is_unsigned) {
  10939. if (unlikely(Py_SIZE(x) < 0)) {
  10940. PyErr_SetString(PyExc_OverflowError,
  10941. "can't convert negative value to signed long");
  10942. return (signed long)-1;
  10943. }