1/* Generated by Cython 0.21.2 */
2
3#define PY_SSIZE_T_CLEAN
4#ifndef CYTHON_USE_PYLONG_INTERNALS
5#ifdef PYLONG_BITS_IN_DIGIT
6#define CYTHON_USE_PYLONG_INTERNALS 0
7#else
8#include "pyconfig.h"
9#ifdef PYLONG_BITS_IN_DIGIT
10#define CYTHON_USE_PYLONG_INTERNALS 1
11#else
12#define CYTHON_USE_PYLONG_INTERNALS 0
13#endif
14#endif
15#endif
16#include "Python.h"
17#ifndef Py_PYTHON_H
18    #error Python headers needed to compile C extensions, please install development version of Python.
19#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000)
20    #error Cython requires Python 2.6+ or Python 3.2+.
21#else
22#define CYTHON_ABI "0_21_2"
23#include <stddef.h>
24#ifndef offsetof
25#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
26#endif
27#if !defined(WIN32) && !defined(MS_WINDOWS)
28  #ifndef __stdcall
29    #define __stdcall
30  #endif
31  #ifndef __cdecl
32    #define __cdecl
33  #endif
34  #ifndef __fastcall
35    #define __fastcall
36  #endif
37#endif
38#ifndef DL_IMPORT
39  #define DL_IMPORT(t) t
40#endif
41#ifndef DL_EXPORT
42  #define DL_EXPORT(t) t
43#endif
44#ifndef PY_LONG_LONG
45  #define PY_LONG_LONG LONG_LONG
46#endif
47#ifndef Py_HUGE_VAL
48  #define Py_HUGE_VAL HUGE_VAL
49#endif
50#ifdef PYPY_VERSION
51#define CYTHON_COMPILING_IN_PYPY 1
52#define CYTHON_COMPILING_IN_CPYTHON 0
53#else
54#define CYTHON_COMPILING_IN_PYPY 0
55#define CYTHON_COMPILING_IN_CPYTHON 1
56#endif
57#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600
58#define Py_OptimizeFlag 0
59#endif
60#define __PYX_BUILD_PY_SSIZE_T "n"
61#define CYTHON_FORMAT_SSIZE_T "z"
62#if PY_MAJOR_VERSION < 3
63  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
64  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
65          PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
66  #define __Pyx_DefaultClassType PyClass_Type
67#else
68  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
69  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
70          PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
71  #define __Pyx_DefaultClassType PyType_Type
72#endif
73#if PY_MAJOR_VERSION >= 3
74  #define Py_TPFLAGS_CHECKTYPES 0
75  #define Py_TPFLAGS_HAVE_INDEX 0
76  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
77#endif
78#if PY_VERSION_HEX < 0x030400a1 && !defined(Py_TPFLAGS_HAVE_FINALIZE)
79  #define Py_TPFLAGS_HAVE_FINALIZE 0
80#endif
81#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
82  #define CYTHON_PEP393_ENABLED 1
83  #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ? \
84                                              0 : _PyUnicode_Ready((PyObject *)(op)))
85  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
86  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
87  #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
88  #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
89  #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
90#else
91  #define CYTHON_PEP393_ENABLED 0
92  #define __Pyx_PyUnicode_READY(op)       (0)
93  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
94  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
95  #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
96  #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
97  #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
98#endif
99#if CYTHON_COMPILING_IN_PYPY
100  #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
101  #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
102  #define __Pyx_PyFrozenSet_Size(s)         PyObject_Size(s)
103#else
104  #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
105  #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ? \
106      PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
107  #define __Pyx_PyFrozenSet_Size(s)         PySet_Size(s)
108#endif
109#define __Pyx_PyString_FormatSafe(a, b)   ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
110#define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
111#if PY_MAJOR_VERSION >= 3
112  #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
113#else
114  #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
115#endif
116#if PY_MAJOR_VERSION >= 3
117  #define PyBaseString_Type            PyUnicode_Type
118  #define PyStringObject               PyUnicodeObject
119  #define PyString_Type                PyUnicode_Type
120  #define PyString_Check               PyUnicode_Check
121  #define PyString_CheckExact          PyUnicode_CheckExact
122#endif
123#if PY_MAJOR_VERSION >= 3
124  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
125  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
126#else
127  #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
128  #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
129#endif
130#ifndef PySet_CheckExact
131  #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
132#endif
133#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
134#if PY_MAJOR_VERSION >= 3
135  #define PyIntObject                  PyLongObject
136  #define PyInt_Type                   PyLong_Type
137  #define PyInt_Check(op)              PyLong_Check(op)
138  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
139  #define PyInt_FromString             PyLong_FromString
140  #define PyInt_FromUnicode            PyLong_FromUnicode
141  #define PyInt_FromLong               PyLong_FromLong
142  #define PyInt_FromSize_t             PyLong_FromSize_t
143  #define PyInt_FromSsize_t            PyLong_FromSsize_t
144  #define PyInt_AsLong                 PyLong_AsLong
145  #define PyInt_AS_LONG                PyLong_AS_LONG
146  #define PyInt_AsSsize_t              PyLong_AsSsize_t
147  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
148  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
149  #define PyNumber_Int                 PyNumber_Long
150#endif
151#if PY_MAJOR_VERSION >= 3
152  #define PyBoolObject                 PyLongObject
153#endif
154#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
155  #ifndef PyUnicode_InternFromString
156    #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
157  #endif
158#endif
159#if PY_VERSION_HEX < 0x030200A4
160  typedef long Py_hash_t;
161  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
162  #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
163#else
164  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
165  #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
166#endif
167#if PY_MAJOR_VERSION >= 3
168  #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
169#else
170  #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
171#endif
172#ifndef CYTHON_INLINE
173  #if defined(__GNUC__)
174    #define CYTHON_INLINE __inline__
175  #elif defined(_MSC_VER)
176    #define CYTHON_INLINE __inline
177  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
178    #define CYTHON_INLINE inline
179  #else
180    #define CYTHON_INLINE
181  #endif
182#endif
183#ifndef CYTHON_RESTRICT
184  #if defined(__GNUC__)
185    #define CYTHON_RESTRICT __restrict__
186  #elif defined(_MSC_VER) && _MSC_VER >= 1400
187    #define CYTHON_RESTRICT __restrict
188  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
189    #define CYTHON_RESTRICT restrict
190  #else
191    #define CYTHON_RESTRICT
192  #endif
193#endif
194#ifdef NAN
195#define __PYX_NAN() ((float) NAN)
196#else
197static CYTHON_INLINE float __PYX_NAN() {
198  /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and
199   a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is
200   a quiet NaN. */
201  float value;
202  memset(&value, 0xFF, sizeof(value));
203  return value;
204}
205#endif
206#ifdef __cplusplus
207template<typename T>
208void __Pyx_call_destructor(T* x) {
209    x->~T();
210}
211#endif
212
213
214#if PY_MAJOR_VERSION >= 3
215  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
216  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
217#else
218  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
219  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
220#endif
221
222#ifndef __PYX_EXTERN_C
223  #ifdef __cplusplus
224    #define __PYX_EXTERN_C extern "C"
225  #else
226    #define __PYX_EXTERN_C extern
227  #endif
228#endif
229
230#if defined(WIN32) || defined(MS_WINDOWS)
231#define _USE_MATH_DEFINES
232#endif
233#include <math.h>
234#define __PYX_HAVE__zmq__backend__cython__socket
235#define __PYX_HAVE_API__zmq__backend__cython__socket
236#include "pyversion_compat.h"
237#include "errno.h"
238#include "string.h"
239#include "stdio.h"
240#include "pythread.h"
241#include "zmq_compat.h"
242#include "zmq.h"
243#include "zmq_utils.h"
244#include "ipcmaxlen.h"
245#include "getpid_compat.h"
246#ifdef _OPENMP
247#include <omp.h>
248#endif /* _OPENMP */
249
250#ifdef PYREX_WITHOUT_ASSERTIONS
251#define CYTHON_WITHOUT_ASSERTIONS
252#endif
253
254#ifndef CYTHON_UNUSED
255# if defined(__GNUC__)
256#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
257#     define CYTHON_UNUSED __attribute__ ((__unused__))
258#   else
259#     define CYTHON_UNUSED
260#   endif
261# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
262#   define CYTHON_UNUSED __attribute__ ((__unused__))
263# else
264#   define CYTHON_UNUSED
265# endif
266#endif
267typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding;
268                const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
269
270#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
271#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
272#define __PYX_DEFAULT_STRING_ENCODING ""
273#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
274#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
275#define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (    \
276    (sizeof(type) < sizeof(Py_ssize_t))  ||             \
277    (sizeof(type) > sizeof(Py_ssize_t) &&               \
278          likely(v < (type)PY_SSIZE_T_MAX ||            \
279                 v == (type)PY_SSIZE_T_MAX)  &&         \
280          (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||       \
281                                v == (type)PY_SSIZE_T_MIN)))  ||  \
282    (sizeof(type) == sizeof(Py_ssize_t) &&              \
283          (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||        \
284                               v == (type)PY_SSIZE_T_MAX)))  )
285static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
286static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
287#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
288#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
289#define __Pyx_PyBytes_FromString        PyBytes_FromString
290#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
291static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
292#if PY_MAJOR_VERSION < 3
293    #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
294    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
295#else
296    #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
297    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
298#endif
299#define __Pyx_PyObject_AsSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
300#define __Pyx_PyObject_AsUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
301#define __Pyx_PyObject_FromUString(s)  __Pyx_PyObject_FromString((const char*)s)
302#define __Pyx_PyBytes_FromUString(s)   __Pyx_PyBytes_FromString((const char*)s)
303#define __Pyx_PyByteArray_FromUString(s)   __Pyx_PyByteArray_FromString((const char*)s)
304#define __Pyx_PyStr_FromUString(s)     __Pyx_PyStr_FromString((const char*)s)
305#define __Pyx_PyUnicode_FromUString(s) __Pyx_PyUnicode_FromString((const char*)s)
306#if PY_MAJOR_VERSION < 3
307static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
308{
309    const Py_UNICODE *u_end = u;
310    while (*u_end++) ;
311    return (size_t)(u_end - u - 1);
312}
313#else
314#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
315#endif
316#define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
317#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
318#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
319#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
320#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
321static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
322static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
323static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
324static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
325#if CYTHON_COMPILING_IN_CPYTHON
326#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
327#else
328#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
329#endif
330#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
331#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
332static int __Pyx_sys_getdefaultencoding_not_ascii;
333static int __Pyx_init_sys_getdefaultencoding_params(void) {
334    PyObject* sys;
335    PyObject* default_encoding = NULL;
336    PyObject* ascii_chars_u = NULL;
337    PyObject* ascii_chars_b = NULL;
338    const char* default_encoding_c;
339    sys = PyImport_ImportModule("sys");
340    if (!sys) goto bad;
341    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
342    Py_DECREF(sys);
343    if (!default_encoding) goto bad;
344    default_encoding_c = PyBytes_AsString(default_encoding);
345    if (!default_encoding_c) goto bad;
346    if (strcmp(default_encoding_c, "ascii") == 0) {
347        __Pyx_sys_getdefaultencoding_not_ascii = 0;
348    } else {
349        char ascii_chars[128];
350        int c;
351        for (c = 0; c < 128; c++) {
352            ascii_chars[c] = c;
353        }
354        __Pyx_sys_getdefaultencoding_not_ascii = 1;
355        ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
356        if (!ascii_chars_u) goto bad;
357        ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
358        if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
359            PyErr_Format(
360                PyExc_ValueError,
361                "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
362                default_encoding_c);
363            goto bad;
364        }
365        Py_DECREF(ascii_chars_u);
366        Py_DECREF(ascii_chars_b);
367    }
368    Py_DECREF(default_encoding);
369    return 0;
370bad:
371    Py_XDECREF(default_encoding);
372    Py_XDECREF(ascii_chars_u);
373    Py_XDECREF(ascii_chars_b);
374    return -1;
375}
376#endif
377#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
378#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
379#else
380#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
381#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
382static char* __PYX_DEFAULT_STRING_ENCODING;
383static int __Pyx_init_sys_getdefaultencoding_params(void) {
384    PyObject* sys;
385    PyObject* default_encoding = NULL;
386    char* default_encoding_c;
387    sys = PyImport_ImportModule("sys");
388    if (!sys) goto bad;
389    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
390    Py_DECREF(sys);
391    if (!default_encoding) goto bad;
392    default_encoding_c = PyBytes_AsString(default_encoding);
393    if (!default_encoding_c) goto bad;
394    __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
395    if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
396    strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
397    Py_DECREF(default_encoding);
398    return 0;
399bad:
400    Py_XDECREF(default_encoding);
401    return -1;
402}
403#endif
404#endif
405
406
407/* Test for GCC > 2.95 */
408#if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
409  #define likely(x)   __builtin_expect(!!(x), 1)
410  #define unlikely(x) __builtin_expect(!!(x), 0)
411#else /* !__GNUC__ or GCC < 2.95 */
412  #define likely(x)   (x)
413  #define unlikely(x) (x)
414#endif /* __GNUC__ */
415
416static PyObject *__pyx_m;
417static PyObject *__pyx_d;
418static PyObject *__pyx_b;
419static PyObject *__pyx_empty_tuple;
420static PyObject *__pyx_empty_bytes;
421static int __pyx_lineno;
422static int __pyx_clineno = 0;
423static const char * __pyx_cfilenm= __FILE__;
424static const char *__pyx_filename;
425
426
427static const char *__pyx_f[] = {
428  "zmq/backend/cython/socket.pyx",
429  "zmq/backend/cython/socket.pxd",
430  "zmq/backend/cython/checkrc.pxd",
431  "zmq/backend/cython/message.pxd",
432  "zmq/utils/buffers.pxd",
433  "zmq/backend/cython/context.pxd",
434  "type.pxd",
435  "bool.pxd",
436  "complex.pxd",
437};
438
439/*--- Type declarations ---*/
440struct __pyx_obj_3zmq_7backend_6cython_7context_Context;
441struct __pyx_obj_3zmq_7backend_6cython_7message_MessageTracker;
442struct __pyx_obj_3zmq_7backend_6cython_7message_Frame;
443struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket;
444struct __pyx_opt_args_3zmq_7backend_6cython_6socket_6Socket_send;
445struct __pyx_opt_args_3zmq_7backend_6cython_6socket_6Socket_recv;
446struct __pyx_opt_args_3zmq_7backend_6cython_6socket__recv_frame;
447struct __pyx_opt_args_3zmq_7backend_6cython_6socket__recv_copy;
448struct __pyx_opt_args_3zmq_7backend_6cython_6socket__send_frame;
449struct __pyx_opt_args_3zmq_7backend_6cython_6socket__send_copy;
450
451/* "zmq/backend/cython/socket.pxd":45
452 *
453 *     # cpdef methods for direct-cython access:
454 *     cpdef object send(self, object data, int flags=*, copy=*, track=*)             # <<<<<<<<<<<<<<
455 *     cpdef object recv(self, int flags=*, copy=*, track=*)
456 *
457 */
458struct __pyx_opt_args_3zmq_7backend_6cython_6socket_6Socket_send {
459  int __pyx_n;
460  int flags;
461  PyObject *copy;
462  PyObject *track;
463};
464
465/* "zmq/backend/cython/socket.pxd":46
466 *     # cpdef methods for direct-cython access:
467 *     cpdef object send(self, object data, int flags=*, copy=*, track=*)
468 *     cpdef object recv(self, int flags=*, copy=*, track=*)             # <<<<<<<<<<<<<<
469 *
470 */
471struct __pyx_opt_args_3zmq_7backend_6cython_6socket_6Socket_recv {
472  int __pyx_n;
473  int flags;
474  PyObject *copy;
475  PyObject *track;
476};
477
478/* "zmq/backend/cython/socket.pyx":121
479 *     return False
480 *
481 * cdef inline Frame _recv_frame(void *handle, int flags=0, track=False):             # <<<<<<<<<<<<<<
482 *     """Receive a message in a non-copying manner and return a Frame."""
483 *     cdef int rc
484 */
485struct __pyx_opt_args_3zmq_7backend_6cython_6socket__recv_frame {
486  int __pyx_n;
487  int flags;
488  PyObject *track;
489};
490
491/* "zmq/backend/cython/socket.pyx":133
492 *     return msg
493 *
494 * cdef inline object _recv_copy(void *handle, int flags=0):             # <<<<<<<<<<<<<<
495 *     """Receive a message and return a copy"""
496 *     cdef zmq_msg_t zmq_msg
497 */
498struct __pyx_opt_args_3zmq_7backend_6cython_6socket__recv_copy {
499  int __pyx_n;
500  int flags;
501};
502
503/* "zmq/backend/cython/socket.pyx":144
504 *     return msg_bytes
505 *
506 * cdef inline object _send_frame(void *handle, Frame msg, int flags=0):             # <<<<<<<<<<<<<<
507 *     """Send a Frame on this socket in a non-copy manner."""
508 *     cdef int rc
509 */
510struct __pyx_opt_args_3zmq_7backend_6cython_6socket__send_frame {
511  int __pyx_n;
512  int flags;
513};
514
515/* "zmq/backend/cython/socket.pyx":160
516 *
517 *
518 * cdef inline object _send_copy(void *handle, object msg, int flags=0):             # <<<<<<<<<<<<<<
519 *     """Send a message on this socket by copying its content."""
520 *     cdef int rc, rc2
521 */
522struct __pyx_opt_args_3zmq_7backend_6cython_6socket__send_copy {
523  int __pyx_n;
524  int flags;
525};
526
527/* "context.pxd":26
528 * #-----------------------------------------------------------------------------
529 *
530 * cdef class Context:             # <<<<<<<<<<<<<<
531 *
532 *     cdef object __weakref__     # enable weakref
533 */
534struct __pyx_obj_3zmq_7backend_6cython_7context_Context {
535  PyObject_HEAD
536  struct __pyx_vtabstruct_3zmq_7backend_6cython_7context_Context *__pyx_vtab;
537  PyObject *__weakref__;
538  void *handle;
539  int _shadow;
540  void **_sockets;
541  size_t _n_sockets;
542  size_t _max_sockets;
543  int _pid;
544  int closed;
545};
546
547
548/* "message.pxd":34
549 * #-----------------------------------------------------------------------------
550 *
551 * cdef class MessageTracker(object):             # <<<<<<<<<<<<<<
552 *
553 *     cdef set events  # Message Event objects to track.
554 */
555struct __pyx_obj_3zmq_7backend_6cython_7message_MessageTracker {
556  PyObject_HEAD
557  PyObject *events;
558  PyObject *peers;
559};
560
561
562/* "message.pxd":40
563 *
564 *
565 * cdef class Frame:             # <<<<<<<<<<<<<<
566 *
567 *     cdef zmq_msg_t zmq_msg
568 */
569struct __pyx_obj_3zmq_7backend_6cython_7message_Frame {
570  PyObject_HEAD
571  struct __pyx_vtabstruct_3zmq_7backend_6cython_7message_Frame *__pyx_vtab;
572  zmq_msg_t zmq_msg;
573  PyObject *_data;
574  PyObject *_buffer;
575  PyObject *_bytes;
576  int _failed_init;
577  PyObject *tracker_event;
578  PyObject *tracker;
579  int more;
580};
581
582
583/* "zmq/backend/cython/socket.pxd":33
584 *
585 *
586 * cdef class Socket:             # <<<<<<<<<<<<<<
587 *
588 *     cdef object __weakref__     # enable weakref
589 */
590struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket {
591  PyObject_HEAD
592  struct __pyx_vtabstruct_3zmq_7backend_6cython_6socket_Socket *__pyx_vtab;
593  PyObject *__weakref__;
594  void *handle;
595  int _shadow;
596  struct __pyx_obj_3zmq_7backend_6cython_7context_Context *context;
597  int _closed;
598  int _pid;
599};
600
601
602
603/* "context.pxd":26
604 * #-----------------------------------------------------------------------------
605 *
606 * cdef class Context:             # <<<<<<<<<<<<<<
607 *
608 *     cdef object __weakref__     # enable weakref
609 */
610
611struct __pyx_vtabstruct_3zmq_7backend_6cython_7context_Context {
612  int (*_term)(struct __pyx_obj_3zmq_7backend_6cython_7context_Context *);
613  void (*_add_socket)(struct __pyx_obj_3zmq_7backend_6cython_7context_Context *, void *);
614  void (*_remove_socket)(struct __pyx_obj_3zmq_7backend_6cython_7context_Context *, void *);
615};
616static struct __pyx_vtabstruct_3zmq_7backend_6cython_7context_Context *__pyx_vtabptr_3zmq_7backend_6cython_7context_Context;
617
618
619/* "message.pxd":40
620 *
621 *
622 * cdef class Frame:             # <<<<<<<<<<<<<<
623 *
624 *     cdef zmq_msg_t zmq_msg
625 */
626
627struct __pyx_vtabstruct_3zmq_7backend_6cython_7message_Frame {
628  struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *(*fast_copy)(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *);
629  PyObject *(*_getbuffer)(struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *);
630};
631static struct __pyx_vtabstruct_3zmq_7backend_6cython_7message_Frame *__pyx_vtabptr_3zmq_7backend_6cython_7message_Frame;
632
633
634/* "zmq/backend/cython/socket.pyx":185
635 *
636 *
637 * cdef class Socket:             # <<<<<<<<<<<<<<
638 *     """Socket(context, socket_type)
639 *
640 */
641
642struct __pyx_vtabstruct_3zmq_7backend_6cython_6socket_Socket {
643  PyObject *(*send)(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_3zmq_7backend_6cython_6socket_6Socket_send *__pyx_optional_args);
644  PyObject *(*recv)(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *, int __pyx_skip_dispatch, struct __pyx_opt_args_3zmq_7backend_6cython_6socket_6Socket_recv *__pyx_optional_args);
645};
646static struct __pyx_vtabstruct_3zmq_7backend_6cython_6socket_Socket *__pyx_vtabptr_3zmq_7backend_6cython_6socket_Socket;
647#ifndef CYTHON_REFNANNY
648  #define CYTHON_REFNANNY 0
649#endif
650#if CYTHON_REFNANNY
651  typedef struct {
652    void (*INCREF)(void*, PyObject*, int);
653    void (*DECREF)(void*, PyObject*, int);
654    void (*GOTREF)(void*, PyObject*, int);
655    void (*GIVEREF)(void*, PyObject*, int);
656    void* (*SetupContext)(const char*, int, const char*);
657    void (*FinishContext)(void**);
658  } __Pyx_RefNannyAPIStruct;
659  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
660  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
661  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
662#ifdef WITH_THREAD
663  #define __Pyx_RefNannySetupContext(name, acquire_gil) \
664          if (acquire_gil) { \
665              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \
666              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
667              PyGILState_Release(__pyx_gilstate_save); \
668          } else { \
669              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
670          }
671#else
672  #define __Pyx_RefNannySetupContext(name, acquire_gil) \
673          __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
674#endif
675  #define __Pyx_RefNannyFinishContext() \
676          __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
677  #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
678  #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
679  #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
680  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
681  #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
682  #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
683  #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
684  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
685#else
686  #define __Pyx_RefNannyDeclarations
687  #define __Pyx_RefNannySetupContext(name, acquire_gil)
688  #define __Pyx_RefNannyFinishContext()
689  #define __Pyx_INCREF(r) Py_INCREF(r)
690  #define __Pyx_DECREF(r) Py_DECREF(r)
691  #define __Pyx_GOTREF(r)
692  #define __Pyx_GIVEREF(r)
693  #define __Pyx_XINCREF(r) Py_XINCREF(r)
694  #define __Pyx_XDECREF(r) Py_XDECREF(r)
695  #define __Pyx_XGOTREF(r)
696  #define __Pyx_XGIVEREF(r)
697#endif
698#define __Pyx_XDECREF_SET(r, v) do {                            \
699        PyObject *tmp = (PyObject *) r;                         \
700        r = v; __Pyx_XDECREF(tmp);                              \
701    } while (0)
702#define __Pyx_DECREF_SET(r, v) do {                             \
703        PyObject *tmp = (PyObject *) r;                         \
704        r = v; __Pyx_DECREF(tmp);                               \
705    } while (0)
706#define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
707#define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
708
709#if CYTHON_COMPILING_IN_CPYTHON
710static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
711    PyTypeObject* tp = Py_TYPE(obj);
712    if (likely(tp->tp_getattro))
713        return tp->tp_getattro(obj, attr_name);
714#if PY_MAJOR_VERSION < 3
715    if (likely(tp->tp_getattr))
716        return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
717#endif
718    return PyObject_GetAttr(obj, attr_name);
719}
720#else
721#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
722#endif
723
724static PyObject *__Pyx_GetBuiltinName(PyObject *name);
725
726static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);
727
728#if CYTHON_COMPILING_IN_CPYTHON
729static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
730#else
731#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
732#endif
733
734#if CYTHON_COMPILING_IN_CPYTHON
735static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
736#endif
737
738static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
739
740static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb);
741static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb);
742
743static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
744
745static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
746
747static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
748
749static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \
750    PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \
751    const char* function_name);
752
753static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
754    Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
755
756static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
757    const char *name, int exact);
758
759#if CYTHON_COMPILING_IN_CPYTHON
760static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
761#else
762#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
763#endif
764
765static void __Pyx_WriteUnraisable(const char *name, int clineno,
766                                  int lineno, const char *filename,
767                                  int full_traceback);
768
769static CYTHON_INLINE int __Pyx_PySequence_Contains(PyObject* item, PyObject* seq, int eq) {
770    int result = PySequence_Contains(seq, item);
771    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
772}
773
774#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
775    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \
776    __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) : \
777    (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) : \
778               __Pyx_GetItemInt_Generic(o, to_py_func(i))))
779#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
780    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \
781    __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) : \
782    (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
783static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
784                                                              int wraparound, int boundscheck);
785#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
786    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \
787    __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) : \
788    (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
789static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
790                                                              int wraparound, int boundscheck);
791static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
792static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
793                                                     int is_list, int wraparound, int boundscheck);
794
795static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
796
797static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb);
798static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb);
799
800static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
801
802static int __Pyx_SetVtable(PyObject *dict, void *vtable);
803
804static void* __Pyx_GetVtable(PyObject *dict);
805
806static PyObject *__Pyx_GetNameInClass(PyObject *nmspace, PyObject *name);
807
808typedef struct {
809    int code_line;
810    PyCodeObject* code_object;
811} __Pyx_CodeObjectCacheEntry;
812struct __Pyx_CodeObjectCache {
813    int count;
814    int max_count;
815    __Pyx_CodeObjectCacheEntry* entries;
816};
817static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
818static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
819static PyCodeObject *__pyx_find_code_object(int code_line);
820static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
821
822static void __Pyx_AddTraceback(const char *funcname, int c_line,
823                               int py_line, const char *filename);
824
825static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
826
827static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
828
829static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
830
831static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *);
832
833#ifndef __PYX_FORCE_INIT_THREADS
834  #define __PYX_FORCE_INIT_THREADS 0
835#endif
836
837static CYTHON_INLINE pyzmq_int64_t __Pyx_PyInt_As_pyzmq_int64_t(PyObject *);
838
839static CYTHON_INLINE PyObject* __Pyx_PyInt_From_pyzmq_int64_t(pyzmq_int64_t value);
840
841static CYTHON_INLINE PyObject* __Pyx_PyInt_From_ZMQ_FD_T(ZMQ_FD_T value);
842
843static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
844
845static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
846
847static CYTHON_INLINE int __Pyx_StrEq(const char *, const char *); /*proto*/
848
849static int __Pyx_check_binary_version(void);
850
851#if !defined(__Pyx_PyIdentifier_FromString)
852#if PY_MAJOR_VERSION < 3
853  #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
854#else
855  #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
856#endif
857#endif
858
859static PyObject *__Pyx_ImportModule(const char *name);
860
861static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict);
862
863static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
864
865static PyObject *__pyx_f_3zmq_7backend_6cython_6socket_6Socket_send(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, PyObject *__pyx_v_data, int __pyx_skip_dispatch, struct __pyx_opt_args_3zmq_7backend_6cython_6socket_6Socket_send *__pyx_optional_args); /* proto*/
866static PyObject *__pyx_f_3zmq_7backend_6cython_6socket_6Socket_recv(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_3zmq_7backend_6cython_6socket_6Socket_recv *__pyx_optional_args); /* proto*/
867
868/* Module declarations from 'zmq.backend.cython.context' */
869static PyTypeObject *__pyx_ptype_3zmq_7backend_6cython_7context_Context = 0;
870
871/* Module declarations from 'libc.errno' */
872
873/* Module declarations from 'libc.string' */
874
875/* Module declarations from 'cpython.version' */
876
877/* Module declarations from 'cpython.ref' */
878
879/* Module declarations from 'cpython.exc' */
880
881/* Module declarations from 'cpython.module' */
882
883/* Module declarations from 'cpython.mem' */
884
885/* Module declarations from 'cpython.tuple' */
886
887/* Module declarations from 'cpython.list' */
888
889/* Module declarations from 'libc.stdio' */
890
891/* Module declarations from 'cpython.object' */
892
893/* Module declarations from 'cpython.sequence' */
894
895/* Module declarations from 'cpython.mapping' */
896
897/* Module declarations from 'cpython.iterator' */
898
899/* Module declarations from '__builtin__' */
900
901/* Module declarations from 'cpython.type' */
902static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
903
904/* Module declarations from 'cpython.number' */
905
906/* Module declarations from 'cpython.int' */
907
908/* Module declarations from '__builtin__' */
909
910/* Module declarations from 'cpython.bool' */
911static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0;
912
913/* Module declarations from 'cpython.long' */
914
915/* Module declarations from 'cpython.float' */
916
917/* Module declarations from '__builtin__' */
918
919/* Module declarations from 'cpython.complex' */
920static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0;
921
922/* Module declarations from 'cpython.string' */
923
924/* Module declarations from 'cpython.unicode' */
925
926/* Module declarations from 'cpython.dict' */
927
928/* Module declarations from 'cpython.instance' */
929
930/* Module declarations from 'cpython.function' */
931
932/* Module declarations from 'cpython.method' */
933
934/* Module declarations from 'cpython.weakref' */
935
936/* Module declarations from 'cpython.getargs' */
937
938/* Module declarations from 'cpython.pythread' */
939
940/* Module declarations from 'cpython.pystate' */
941
942/* Module declarations from 'cpython.cobject' */
943
944/* Module declarations from 'cpython.oldbuffer' */
945
946/* Module declarations from 'cpython.set' */
947
948/* Module declarations from 'cpython.buffer' */
949
950/* Module declarations from 'cpython.bytes' */
951
952/* Module declarations from 'cpython.pycapsule' */
953
954/* Module declarations from 'cpython' */
955
956/* Module declarations from 'buffers' */
957static CYTHON_INLINE int __pyx_f_7buffers_memoryview_available(void); /*proto*/
958static CYTHON_INLINE int __pyx_f_7buffers_oldstyle_available(void); /*proto*/
959static CYTHON_INLINE int __pyx_f_7buffers_check_buffer(PyObject *); /*proto*/
960static CYTHON_INLINE PyObject *__pyx_f_7buffers_asbuffer(PyObject *, int, int, void **, Py_ssize_t *, Py_ssize_t *); /*proto*/
961static CYTHON_INLINE PyObject *__pyx_f_7buffers_asbuffer_r(PyObject *, void **, Py_ssize_t *); /*proto*/
962static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer_3(void *, Py_ssize_t, int); /*proto*/
963static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer_2(void *, Py_ssize_t, int); /*proto*/
964static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer(void *, Py_ssize_t, int); /*proto*/
965static CYTHON_INLINE PyObject *__pyx_f_7buffers_viewfromobject(PyObject *, int); /*proto*/
966static CYTHON_INLINE PyObject *__pyx_f_7buffers_viewfromobject_r(PyObject *); /*proto*/
967
968/* Module declarations from 'zmq.backend.cython.libzmq' */
969
970/* Module declarations from 'zmq.backend.cython.message' */
971static PyTypeObject *__pyx_ptype_3zmq_7backend_6cython_7message_MessageTracker = 0;
972static PyTypeObject *__pyx_ptype_3zmq_7backend_6cython_7message_Frame = 0;
973static CYTHON_INLINE PyObject *__pyx_f_3zmq_7backend_6cython_7message_copy_zmq_msg_bytes(zmq_msg_t *); /*proto*/
974
975/* Module declarations from 'zmq.backend.cython.checkrc' */
976static CYTHON_INLINE int __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(int); /*proto*/
977
978/* Module declarations from 'zmq.backend.cython.socket' */
979static PyTypeObject *__pyx_ptype_3zmq_7backend_6cython_6socket_Socket = 0;
980static CYTHON_INLINE PyObject *__pyx_f_3zmq_7backend_6cython_6socket__check_closed(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *); /*proto*/
981static CYTHON_INLINE PyObject *__pyx_f_3zmq_7backend_6cython_6socket__check_closed_deep(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *); /*proto*/
982static CYTHON_INLINE struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_f_3zmq_7backend_6cython_6socket__recv_frame(void *, struct __pyx_opt_args_3zmq_7backend_6cython_6socket__recv_frame *__pyx_optional_args); /*proto*/
983static CYTHON_INLINE PyObject *__pyx_f_3zmq_7backend_6cython_6socket__recv_copy(void *, struct __pyx_opt_args_3zmq_7backend_6cython_6socket__recv_copy *__pyx_optional_args); /*proto*/
984static CYTHON_INLINE PyObject *__pyx_f_3zmq_7backend_6cython_6socket__send_frame(void *, struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *, struct __pyx_opt_args_3zmq_7backend_6cython_6socket__send_frame *__pyx_optional_args); /*proto*/
985static CYTHON_INLINE PyObject *__pyx_f_3zmq_7backend_6cython_6socket__send_copy(void *, PyObject *, struct __pyx_opt_args_3zmq_7backend_6cython_6socket__send_copy *__pyx_optional_args); /*proto*/
986#define __Pyx_MODULE_NAME "zmq.backend.cython.socket"
987int __pyx_module_is_main_zmq__backend__cython__socket = 0;
988
989/* Implementation of 'zmq.backend.cython.socket' */
990static PyObject *__pyx_builtin_property;
991static PyObject *__pyx_builtin_TypeError;
992static PyObject *__pyx_builtin_ValueError;
993static PyObject *__pyx_builtin_AttributeError;
994static PyObject *__pyx_builtin_NotImplementedError;
995static int __pyx_pf_3zmq_7backend_6cython_6socket_6Socket___init__(CYTHON_UNUSED struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_context, CYTHON_UNUSED PyObject *__pyx_v_socket_type, CYTHON_UNUSED PyObject *__pyx_v_shadow); /* proto */
996static int __pyx_pf_3zmq_7backend_6cython_6socket_6Socket_2__cinit__(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, struct __pyx_obj_3zmq_7backend_6cython_7context_Context *__pyx_v_context, int __pyx_v_socket_type, size_t __pyx_v_shadow, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
997static void __pyx_pf_3zmq_7backend_6cython_6socket_6Socket_4__dealloc__(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self); /* proto */
998static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_6underlying(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self); /* proto */
999static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_8closed(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self); /* proto */
1000static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_10close(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, PyObject *__pyx_v_linger); /* proto */
1001static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_12set(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, int __pyx_v_option, PyObject *__pyx_v_optval); /* proto */
1002static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_14get(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, int __pyx_v_option); /* proto */
1003static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_16bind(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, PyObject *__pyx_v_addr); /* proto */
1004static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_18connect(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, PyObject *__pyx_v_addr); /* proto */
1005static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_20unbind(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, PyObject *__pyx_v_addr); /* proto */
1006static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_22disconnect(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, PyObject *__pyx_v_addr); /* proto */
1007static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_24monitor(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, PyObject *__pyx_v_addr, int __pyx_v_events); /* proto */
1008static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_26send(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, PyObject *__pyx_v_data, int __pyx_v_flags, PyObject *__pyx_v_copy, PyObject *__pyx_v_track); /* proto */
1009static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_28recv(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, int __pyx_v_flags, PyObject *__pyx_v_copy, PyObject *__pyx_v_track); /* proto */
1010static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_7context___get__(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self); /* proto */
1011static int __pyx_pf_3zmq_7backend_6cython_6socket_6Socket_7context_2__set__(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
1012static int __pyx_pf_3zmq_7backend_6cython_6socket_6Socket_7context_4__del__(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self); /* proto */
1013static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_7_closed___get__(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self); /* proto */
1014static int __pyx_pf_3zmq_7backend_6cython_6socket_6Socket_7_closed_2__set__(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
1015static PyObject *__pyx_tp_new_3zmq_7backend_6cython_6socket_Socket(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
1016static char __pyx_k_B[] = "B";
1017static char __pyx_k__6[] = "://";
1018static char __pyx_k__22[] = "";
1019static char __pyx_k__24[] = "*";
1020static char __pyx_k_all[] = "__all__";
1021static char __pyx_k_msg[] = "msg";
1022static char __pyx_k_sys[] = "sys";
1023static char __pyx_k_zmq[] = "zmq";
1024static char __pyx_k_addr[] = "addr";
1025static char __pyx_k_char[] = "char";
1026static char __pyx_k_copy[] = "copy";
1027static char __pyx_k_data[] = "data";
1028static char __pyx_k_main[] = "__main__";
1029static char __pyx_k_recv[] = "recv";
1030static char __pyx_k_send[] = "send";
1031static char __pyx_k_test[] = "__test__";
1032static char __pyx_k_time[] = "time";
1033static char __pyx_k_Again[] = "Again";
1034static char __pyx_k_Frame[] = "Frame";
1035static char __pyx_k_ascii[] = "ascii";
1036static char __pyx_k_bytes[] = "bytes";
1037static char __pyx_k_dtype[] = "dtype";
1038static char __pyx_k_flags[] = "flags";
1039static char __pyx_k_split[] = "split";
1040static char __pyx_k_track[] = "track";
1041static char __pyx_k_utf_8[] = "utf-8";
1042static char __pyx_k_Socket[] = "Socket";
1043static char __pyx_k_buffer[] = "buffer";
1044static char __pyx_k_closed[] = "closed";
1045static char __pyx_k_codecs[] = "codecs";
1046static char __pyx_k_decode[] = "decode";
1047static char __pyx_k_encode[] = "encode";
1048static char __pyx_k_events[] = "events";
1049static char __pyx_k_format[] = "format";
1050static char __pyx_k_import[] = "__import__";
1051static char __pyx_k_linger[] = "linger";
1052static char __pyx_k_option[] = "option";
1053static char __pyx_k_optval[] = "optval";
1054static char __pyx_k_pickle[] = "pickle";
1055static char __pyx_k_random[] = "random";
1056static char __pyx_k_shadow[] = "shadow";
1057static char __pyx_k_struct[] = "struct";
1058static char __pyx_k_unbind[] = "unbind";
1059static char __pyx_k_RCVMORE[] = "RCVMORE";
1060static char __pyx_k_cPickle[] = "cPickle";
1061static char __pyx_k_context[] = "context";
1062static char __pyx_k_jsonapi[] = "jsonapi";
1063static char __pyx_k_monitor[] = "monitor";
1064static char __pyx_k_replace[] = "replace";
1065static char __pyx_k_tracker[] = "tracker";
1066static char __pyx_k_unicode[] = "unicode";
1067static char __pyx_k_ENOTSOCK[] = "ENOTSOCK";
1068static char __pyx_k_ZMQError[] = "ZMQError";
1069static char __pyx_k_copy_mod[] = "copy_mod";
1070static char __pyx_k_itemsize[] = "itemsize";
1071static char __pyx_k_property[] = "property";
1072static char __pyx_k_typecode[] = "typecode";
1073static char __pyx_k_TypeError[] = "TypeError";
1074static char __pyx_k_constants[] = "constants";
1075static char __pyx_k_zmq_error[] = "zmq.error";
1076static char __pyx_k_zmq_utils[] = "zmq.utils";
1077static char __pyx_k_ValueError[] = "ValueError";
1078static char __pyx_k_basestring[] = "basestring";
1079static char __pyx_k_disconnect[] = "disconnect";
1080static char __pyx_k_getsockopt[] = "getsockopt";
1081static char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
1082static char __pyx_k_underlying[] = "underlying";
1083static char __pyx_k_fd_sockopts[] = "fd_sockopts";
1084static char __pyx_k_socket_type[] = "socket_type";
1085static char __pyx_k_ZMQBindError[] = "ZMQBindError";
1086static char __pyx_k_check_version[] = "_check_version";
1087static char __pyx_k_AttributeError[] = "AttributeError";
1088static char __pyx_k_bytes_sockopts[] = "bytes_sockopts";
1089static char __pyx_k_int64_sockopts[] = "int64_sockopts";
1090static char __pyx_k_0MQ_Socket_class[] = "0MQ Socket class.";
1091static char __pyx_k_IPC_PATH_MAX_LEN[] = "IPC_PATH_MAX_LEN";
1092static char __pyx_k_ContextTerminated[] = "ContextTerminated";
1093static char __pyx_k_expected_int_got_r[] = "expected int, got: %r";
1094static char __pyx_k_expected_str_got_r[] = "expected str, got: %r";
1095static char __pyx_k_zmq_backend_cython[] = "zmq.backend.cython";
1096static char __pyx_k_zmq_utils_strtypes[] = "zmq.utils.strtypes";
1097static char __pyx_k_NotImplementedError[] = "NotImplementedError";
1098static char __pyx_k_expected_bytes_got_r[] = "expected bytes, got: %r";
1099static char __pyx_k_Not_a_tracked_message[] = "Not a tracked message";
1100static char __pyx_k_context_must_be_specified[] = "context must be specified";
1101static char __pyx_k_zmq_backend_cython_constants[] = "zmq.backend.cython.constants";
1102static char __pyx_k_socket_type_must_be_specified[] = "socket_type must be specified";
1103static char __pyx_k_Old_style_buffers_not_available[] = "Old style buffers not available.";
1104static char __pyx_k_r_does_not_provide_a_buffer_int[] = "%r does not provide a buffer interface.";
1105static char __pyx_k_ipc_path_0_is_longer_than_1_char[] = "ipc path \"{0}\" is longer than {1} characters (sizeof(sockaddr_un.sun_path)). zmq.IPC_PATH_MAX_LEN constant can be used to check addr length (if it is defined).";
1106static char __pyx_k_unicode_not_allowed_use_send_str[] = "unicode not allowed, use send_string";
1107static char __pyx_k_unicode_not_allowed_use_setsocko[] = "unicode not allowed, use setsockopt_string";
1108static PyObject *__pyx_n_s_Again;
1109static PyObject *__pyx_n_s_AttributeError;
1110static PyObject *__pyx_n_b_B;
1111static PyObject *__pyx_n_s_ContextTerminated;
1112static PyObject *__pyx_n_s_ENOTSOCK;
1113static PyObject *__pyx_n_s_Frame;
1114static PyObject *__pyx_n_s_IPC_PATH_MAX_LEN;
1115static PyObject *__pyx_n_s_NotImplementedError;
1116static PyObject *__pyx_kp_s_Not_a_tracked_message;
1117static PyObject *__pyx_kp_s_Old_style_buffers_not_available;
1118static PyObject *__pyx_n_s_RCVMORE;
1119static PyObject *__pyx_n_s_Socket;
1120static PyObject *__pyx_n_s_TypeError;
1121static PyObject *__pyx_n_s_ValueError;
1122static PyObject *__pyx_n_s_ZMQBindError;
1123static PyObject *__pyx_n_s_ZMQError;
1124static PyObject *__pyx_kp_s__22;
1125static PyObject *__pyx_n_s__24;
1126static PyObject *__pyx_kp_s__6;
1127static PyObject *__pyx_n_s_addr;
1128static PyObject *__pyx_n_s_all;
1129static PyObject *__pyx_n_s_ascii;
1130static PyObject *__pyx_n_s_basestring;
1131static PyObject *__pyx_n_s_buffer;
1132static PyObject *__pyx_n_s_bytes;
1133static PyObject *__pyx_n_s_bytes_sockopts;
1134static PyObject *__pyx_n_s_cPickle;
1135static PyObject *__pyx_n_s_char;
1136static PyObject *__pyx_n_s_check_version;
1137static PyObject *__pyx_n_s_closed;
1138static PyObject *__pyx_n_s_codecs;
1139static PyObject *__pyx_n_s_constants;
1140static PyObject *__pyx_n_s_context;
1141static PyObject *__pyx_kp_s_context_must_be_specified;
1142static PyObject *__pyx_n_s_copy;
1143static PyObject *__pyx_n_s_copy_mod;
1144static PyObject *__pyx_n_s_data;
1145static PyObject *__pyx_n_s_decode;
1146static PyObject *__pyx_n_s_disconnect;
1147static PyObject *__pyx_n_s_dtype;
1148static PyObject *__pyx_n_s_encode;
1149static PyObject *__pyx_n_s_events;
1150static PyObject *__pyx_kp_s_expected_bytes_got_r;
1151static PyObject *__pyx_kp_s_expected_int_got_r;
1152static PyObject *__pyx_kp_s_expected_str_got_r;
1153static PyObject *__pyx_n_s_fd_sockopts;
1154static PyObject *__pyx_n_s_flags;
1155static PyObject *__pyx_n_s_format;
1156static PyObject *__pyx_n_s_getsockopt;
1157static PyObject *__pyx_n_s_import;
1158static PyObject *__pyx_n_s_int64_sockopts;
1159static PyObject *__pyx_kp_s_ipc_path_0_is_longer_than_1_char;
1160static PyObject *__pyx_n_s_itemsize;
1161static PyObject *__pyx_n_s_jsonapi;
1162static PyObject *__pyx_n_s_linger;
1163static PyObject *__pyx_n_s_main;
1164static PyObject *__pyx_n_s_monitor;
1165static PyObject *__pyx_n_s_msg;
1166static PyObject *__pyx_n_s_option;
1167static PyObject *__pyx_n_s_optval;
1168static PyObject *__pyx_n_s_pickle;
1169static PyObject *__pyx_n_s_property;
1170static PyObject *__pyx_n_s_pyx_vtable;
1171static PyObject *__pyx_kp_s_r_does_not_provide_a_buffer_int;
1172static PyObject *__pyx_n_s_random;
1173static PyObject *__pyx_n_s_recv;
1174static PyObject *__pyx_n_s_replace;
1175static PyObject *__pyx_n_s_send;
1176static PyObject *__pyx_n_s_shadow;
1177static PyObject *__pyx_n_s_socket_type;
1178static PyObject *__pyx_kp_s_socket_type_must_be_specified;
1179static PyObject *__pyx_n_s_split;
1180static PyObject *__pyx_n_s_struct;
1181static PyObject *__pyx_n_s_sys;
1182static PyObject *__pyx_n_s_test;
1183static PyObject *__pyx_n_s_time;
1184static PyObject *__pyx_n_s_track;
1185static PyObject *__pyx_n_s_tracker;
1186static PyObject *__pyx_n_s_typecode;
1187static PyObject *__pyx_n_s_unbind;
1188static PyObject *__pyx_n_s_underlying;
1189static PyObject *__pyx_n_s_unicode;
1190static PyObject *__pyx_kp_s_unicode_not_allowed_use_send_str;
1191static PyObject *__pyx_kp_s_unicode_not_allowed_use_setsocko;
1192static PyObject *__pyx_kp_s_utf_8;
1193static PyObject *__pyx_n_s_zmq;
1194static PyObject *__pyx_n_s_zmq_backend_cython;
1195static PyObject *__pyx_n_s_zmq_backend_cython_constants;
1196static PyObject *__pyx_n_s_zmq_error;
1197static PyObject *__pyx_n_s_zmq_utils;
1198static PyObject *__pyx_n_s_zmq_utils_strtypes;
1199static PyObject *__pyx_int_0;
1200static PyObject *__pyx_int_1;
1201static PyObject *__pyx_int_2;
1202static PyObject *__pyx_int_3;
1203static PyObject *__pyx_int_neg_1;
1204static int __pyx_k__15;
1205static PyObject *__pyx_tuple_;
1206static PyObject *__pyx_tuple__2;
1207static PyObject *__pyx_tuple__3;
1208static PyObject *__pyx_tuple__4;
1209static PyObject *__pyx_tuple__5;
1210static PyObject *__pyx_tuple__7;
1211static PyObject *__pyx_tuple__8;
1212static PyObject *__pyx_tuple__9;
1213static PyObject *__pyx_tuple__10;
1214static PyObject *__pyx_tuple__11;
1215static PyObject *__pyx_tuple__12;
1216static PyObject *__pyx_tuple__13;
1217static PyObject *__pyx_tuple__14;
1218static PyObject *__pyx_tuple__16;
1219static PyObject *__pyx_tuple__17;
1220static PyObject *__pyx_tuple__18;
1221static PyObject *__pyx_tuple__19;
1222static PyObject *__pyx_tuple__20;
1223static PyObject *__pyx_tuple__21;
1224static PyObject *__pyx_tuple__23;
1225
1226/* "zmq/backend/cython/socket.pyx":90
1227 * # true methods frequently cannot be inlined, acc. Cython docs
1228 *
1229 * cdef inline _check_closed(Socket s):             # <<<<<<<<<<<<<<
1230 *     """raise ENOTSUP if socket is closed
1231 *
1232 */
1233
1234static CYTHON_INLINE PyObject *__pyx_f_3zmq_7backend_6cython_6socket__check_closed(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_s) {
1235  PyObject *__pyx_r = NULL;
1236  __Pyx_RefNannyDeclarations
1237  int __pyx_t_1;
1238  PyObject *__pyx_t_2 = NULL;
1239  PyObject *__pyx_t_3 = NULL;
1240  PyObject *__pyx_t_4 = NULL;
1241  PyObject *__pyx_t_5 = NULL;
1242  PyObject *__pyx_t_6 = NULL;
1243  int __pyx_lineno = 0;
1244  const char *__pyx_filename = NULL;
1245  int __pyx_clineno = 0;
1246  __Pyx_RefNannySetupContext("_check_closed", 0);
1247
1248  /* "zmq/backend/cython/socket.pyx":95
1249 *     Does not do a deep check
1250 *     """
1251 *     if s._closed:             # <<<<<<<<<<<<<<
1252 *         raise ZMQError(ENOTSOCK)
1253 *
1254 */
1255  __pyx_t_1 = (__pyx_v_s->_closed != 0);
1256  if (__pyx_t_1) {
1257
1258    /* "zmq/backend/cython/socket.pyx":96
1259 *     """
1260 *     if s._closed:
1261 *         raise ZMQError(ENOTSOCK)             # <<<<<<<<<<<<<<
1262 *
1263 * cdef inline _check_closed_deep(Socket s):
1264 */
1265    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_ZMQError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1266    __Pyx_GOTREF(__pyx_t_3);
1267    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_ENOTSOCK); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1268    __Pyx_GOTREF(__pyx_t_4);
1269    __pyx_t_5 = NULL;
1270    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
1271      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
1272      if (likely(__pyx_t_5)) {
1273        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
1274        __Pyx_INCREF(__pyx_t_5);
1275        __Pyx_INCREF(function);
1276        __Pyx_DECREF_SET(__pyx_t_3, function);
1277      }
1278    }
1279    if (!__pyx_t_5) {
1280      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1281      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
1282      __Pyx_GOTREF(__pyx_t_2);
1283    } else {
1284      __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1285      __Pyx_GOTREF(__pyx_t_6);
1286      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
1287      PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_4);
1288      __Pyx_GIVEREF(__pyx_t_4);
1289      __pyx_t_4 = 0;
1290      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1291      __Pyx_GOTREF(__pyx_t_2);
1292      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
1293    }
1294    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1295    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
1296    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1297    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1298  }
1299
1300  /* "zmq/backend/cython/socket.pyx":90
1301 * # true methods frequently cannot be inlined, acc. Cython docs
1302 *
1303 * cdef inline _check_closed(Socket s):             # <<<<<<<<<<<<<<
1304 *     """raise ENOTSUP if socket is closed
1305 *
1306 */
1307
1308  /* function exit code */
1309  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
1310  goto __pyx_L0;
1311  __pyx_L1_error:;
1312  __Pyx_XDECREF(__pyx_t_2);
1313  __Pyx_XDECREF(__pyx_t_3);
1314  __Pyx_XDECREF(__pyx_t_4);
1315  __Pyx_XDECREF(__pyx_t_5);
1316  __Pyx_XDECREF(__pyx_t_6);
1317  __Pyx_AddTraceback("zmq.backend.cython.socket._check_closed", __pyx_clineno, __pyx_lineno, __pyx_filename);
1318  __pyx_r = 0;
1319  __pyx_L0:;
1320  __Pyx_XGIVEREF(__pyx_r);
1321  __Pyx_RefNannyFinishContext();
1322  return __pyx_r;
1323}
1324
1325/* "zmq/backend/cython/socket.pyx":98
1326 *         raise ZMQError(ENOTSOCK)
1327 *
1328 * cdef inline _check_closed_deep(Socket s):             # <<<<<<<<<<<<<<
1329 *     """thorough check of whether the socket has been closed,
1330 *     even if by another entity (e.g. ctx.destroy).
1331 */
1332
1333static CYTHON_INLINE PyObject *__pyx_f_3zmq_7backend_6cython_6socket__check_closed_deep(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_s) {
1334  int __pyx_v_rc;
1335  int __pyx_v_stype;
1336  size_t __pyx_v_sz;
1337  PyObject *__pyx_r = NULL;
1338  __Pyx_RefNannyDeclarations
1339  int __pyx_t_1;
1340  int __pyx_t_2;
1341  PyObject *__pyx_t_3 = NULL;
1342  PyObject *__pyx_t_4 = NULL;
1343  PyObject *__pyx_t_5 = NULL;
1344  int __pyx_t_6;
1345  int __pyx_lineno = 0;
1346  const char *__pyx_filename = NULL;
1347  int __pyx_clineno = 0;
1348  __Pyx_RefNannySetupContext("_check_closed_deep", 0);
1349
1350  /* "zmq/backend/cython/socket.pyx":109
1351 *     cdef int errno
1352 *     cdef int stype
1353 *     cdef size_t sz=sizeof(int)             # <<<<<<<<<<<<<<
1354 *     if s._closed:
1355 *         return True
1356 */
1357  __pyx_v_sz = (sizeof(int));
1358
1359  /* "zmq/backend/cython/socket.pyx":110
1360 *     cdef int stype
1361 *     cdef size_t sz=sizeof(int)
1362 *     if s._closed:             # <<<<<<<<<<<<<<
1363 *         return True
1364 *     else:
1365 */
1366  __pyx_t_1 = (__pyx_v_s->_closed != 0);
1367  if (__pyx_t_1) {
1368
1369    /* "zmq/backend/cython/socket.pyx":111
1370 *     cdef size_t sz=sizeof(int)
1371 *     if s._closed:
1372 *         return True             # <<<<<<<<<<<<<<
1373 *     else:
1374 *         rc = zmq_getsockopt(s.handle, ZMQ_TYPE, <void *>&stype, &sz)
1375 */
1376    __Pyx_XDECREF(__pyx_r);
1377    __Pyx_INCREF(Py_True);
1378    __pyx_r = Py_True;
1379    goto __pyx_L0;
1380  }
1381  /*else*/ {
1382
1383    /* "zmq/backend/cython/socket.pyx":113
1384 *         return True
1385 *     else:
1386 *         rc = zmq_getsockopt(s.handle, ZMQ_TYPE, <void *>&stype, &sz)             # <<<<<<<<<<<<<<
1387 *         if rc < 0 and zmq_errno() == ENOTSOCK:
1388 *             s._closed = True
1389 */
1390    __pyx_v_rc = zmq_getsockopt(__pyx_v_s->handle, ZMQ_TYPE, ((void *)(&__pyx_v_stype)), (&__pyx_v_sz));
1391
1392    /* "zmq/backend/cython/socket.pyx":114
1393 *     else:
1394 *         rc = zmq_getsockopt(s.handle, ZMQ_TYPE, <void *>&stype, &sz)
1395 *         if rc < 0 and zmq_errno() == ENOTSOCK:             # <<<<<<<<<<<<<<
1396 *             s._closed = True
1397 *             return True
1398 */
1399    __pyx_t_2 = ((__pyx_v_rc < 0) != 0);
1400    if (__pyx_t_2) {
1401    } else {
1402      __pyx_t_1 = __pyx_t_2;
1403      goto __pyx_L5_bool_binop_done;
1404    }
1405    __pyx_t_3 = __Pyx_PyInt_From_int(zmq_errno()); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1406    __Pyx_GOTREF(__pyx_t_3);
1407    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_ENOTSOCK); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1408    __Pyx_GOTREF(__pyx_t_4);
1409    __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1410    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1411    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
1412    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1413    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
1414    __pyx_t_1 = __pyx_t_2;
1415    __pyx_L5_bool_binop_done:;
1416    if (__pyx_t_1) {
1417
1418      /* "zmq/backend/cython/socket.pyx":115
1419 *         rc = zmq_getsockopt(s.handle, ZMQ_TYPE, <void *>&stype, &sz)
1420 *         if rc < 0 and zmq_errno() == ENOTSOCK:
1421 *             s._closed = True             # <<<<<<<<<<<<<<
1422 *             return True
1423 *         else:
1424 */
1425      __pyx_v_s->_closed = 1;
1426
1427      /* "zmq/backend/cython/socket.pyx":116
1428 *         if rc < 0 and zmq_errno() == ENOTSOCK:
1429 *             s._closed = True
1430 *             return True             # <<<<<<<<<<<<<<
1431 *         else:
1432 *             _check_rc(rc)
1433 */
1434      __Pyx_XDECREF(__pyx_r);
1435      __Pyx_INCREF(Py_True);
1436      __pyx_r = Py_True;
1437      goto __pyx_L0;
1438    }
1439    /*else*/ {
1440
1441      /* "zmq/backend/cython/socket.pyx":118
1442 *             return True
1443 *         else:
1444 *             _check_rc(rc)             # <<<<<<<<<<<<<<
1445 *     return False
1446 *
1447 */
1448      __pyx_t_6 = __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(__pyx_v_rc); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1449    }
1450  }
1451
1452  /* "zmq/backend/cython/socket.pyx":119
1453 *         else:
1454 *             _check_rc(rc)
1455 *     return False             # <<<<<<<<<<<<<<
1456 *
1457 * cdef inline Frame _recv_frame(void *handle, int flags=0, track=False):
1458 */
1459  __Pyx_XDECREF(__pyx_r);
1460  __Pyx_INCREF(Py_False);
1461  __pyx_r = Py_False;
1462  goto __pyx_L0;
1463
1464  /* "zmq/backend/cython/socket.pyx":98
1465 *         raise ZMQError(ENOTSOCK)
1466 *
1467 * cdef inline _check_closed_deep(Socket s):             # <<<<<<<<<<<<<<
1468 *     """thorough check of whether the socket has been closed,
1469 *     even if by another entity (e.g. ctx.destroy).
1470 */
1471
1472  /* function exit code */
1473  __pyx_L1_error:;
1474  __Pyx_XDECREF(__pyx_t_3);
1475  __Pyx_XDECREF(__pyx_t_4);
1476  __Pyx_XDECREF(__pyx_t_5);
1477  __Pyx_AddTraceback("zmq.backend.cython.socket._check_closed_deep", __pyx_clineno, __pyx_lineno, __pyx_filename);
1478  __pyx_r = 0;
1479  __pyx_L0:;
1480  __Pyx_XGIVEREF(__pyx_r);
1481  __Pyx_RefNannyFinishContext();
1482  return __pyx_r;
1483}
1484
1485/* "zmq/backend/cython/socket.pyx":121
1486 *     return False
1487 *
1488 * cdef inline Frame _recv_frame(void *handle, int flags=0, track=False):             # <<<<<<<<<<<<<<
1489 *     """Receive a message in a non-copying manner and return a Frame."""
1490 *     cdef int rc
1491 */
1492
1493static CYTHON_INLINE struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_f_3zmq_7backend_6cython_6socket__recv_frame(void *__pyx_v_handle, struct __pyx_opt_args_3zmq_7backend_6cython_6socket__recv_frame *__pyx_optional_args) {
1494  int __pyx_v_flags = ((int)0);
1495  PyObject *__pyx_v_track = ((PyObject *)Py_False);
1496  int __pyx_v_rc;
1497  PyObject *__pyx_v_msg = NULL;
1498  struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_cmsg = 0;
1499  struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_r = NULL;
1500  __Pyx_RefNannyDeclarations
1501  PyObject *__pyx_t_1 = NULL;
1502  PyObject *__pyx_t_2 = NULL;
1503  PyObject *__pyx_t_3 = NULL;
1504  int __pyx_t_4;
1505  int __pyx_lineno = 0;
1506  const char *__pyx_filename = NULL;
1507  int __pyx_clineno = 0;
1508  __Pyx_RefNannySetupContext("_recv_frame", 0);
1509  if (__pyx_optional_args) {
1510    if (__pyx_optional_args->__pyx_n > 0) {
1511      __pyx_v_flags = __pyx_optional_args->flags;
1512      if (__pyx_optional_args->__pyx_n > 1) {
1513        __pyx_v_track = __pyx_optional_args->track;
1514      }
1515    }
1516  }
1517
1518  /* "zmq/backend/cython/socket.pyx":124
1519 *     """Receive a message in a non-copying manner and return a Frame."""
1520 *     cdef int rc
1521 *     msg = zmq.Frame(track=track)             # <<<<<<<<<<<<<<
1522 *     cdef Frame cmsg = msg
1523 *
1524 */
1525  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_zmq); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1526  __Pyx_GOTREF(__pyx_t_1);
1527  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Frame); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1528  __Pyx_GOTREF(__pyx_t_2);
1529  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1530  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1531  __Pyx_GOTREF(__pyx_t_1);
1532  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_track, __pyx_v_track) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1533  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1534  __Pyx_GOTREF(__pyx_t_3);
1535  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1536  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1537  __pyx_v_msg = __pyx_t_3;
1538  __pyx_t_3 = 0;
1539
1540  /* "zmq/backend/cython/socket.pyx":125
1541 *     cdef int rc
1542 *     msg = zmq.Frame(track=track)
1543 *     cdef Frame cmsg = msg             # <<<<<<<<<<<<<<
1544 *
1545 *     with nogil:
1546 */
1547  if (!(likely(((__pyx_v_msg) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_msg, __pyx_ptype_3zmq_7backend_6cython_7message_Frame))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1548  __pyx_t_3 = __pyx_v_msg;
1549  __Pyx_INCREF(__pyx_t_3);
1550  __pyx_v_cmsg = ((struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *)__pyx_t_3);
1551  __pyx_t_3 = 0;
1552
1553  /* "zmq/backend/cython/socket.pyx":127
1554 *     cdef Frame cmsg = msg
1555 *
1556 *     with nogil:             # <<<<<<<<<<<<<<
1557 *         rc = zmq_msg_recv(&cmsg.zmq_msg, handle, flags)
1558 *
1559 */
1560  {
1561      #ifdef WITH_THREAD
1562      PyThreadState *_save;
1563      Py_UNBLOCK_THREADS
1564      #endif
1565      /*try:*/ {
1566
1567        /* "zmq/backend/cython/socket.pyx":128
1568 *
1569 *     with nogil:
1570 *         rc = zmq_msg_recv(&cmsg.zmq_msg, handle, flags)             # <<<<<<<<<<<<<<
1571 *
1572 *     _check_rc(rc)
1573 */
1574        __pyx_v_rc = zmq_msg_recv((&__pyx_v_cmsg->zmq_msg), __pyx_v_handle, __pyx_v_flags);
1575      }
1576
1577      /* "zmq/backend/cython/socket.pyx":127
1578 *     cdef Frame cmsg = msg
1579 *
1580 *     with nogil:             # <<<<<<<<<<<<<<
1581 *         rc = zmq_msg_recv(&cmsg.zmq_msg, handle, flags)
1582 *
1583 */
1584      /*finally:*/ {
1585        /*normal exit:*/{
1586          #ifdef WITH_THREAD
1587          Py_BLOCK_THREADS
1588          #endif
1589          goto __pyx_L5;
1590        }
1591        __pyx_L5:;
1592      }
1593  }
1594
1595  /* "zmq/backend/cython/socket.pyx":130
1596 *         rc = zmq_msg_recv(&cmsg.zmq_msg, handle, flags)
1597 *
1598 *     _check_rc(rc)             # <<<<<<<<<<<<<<
1599 *     return msg
1600 *
1601 */
1602  __pyx_t_4 = __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(__pyx_v_rc); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1603
1604  /* "zmq/backend/cython/socket.pyx":131
1605 *
1606 *     _check_rc(rc)
1607 *     return msg             # <<<<<<<<<<<<<<
1608 *
1609 * cdef inline object _recv_copy(void *handle, int flags=0):
1610 */
1611  __Pyx_XDECREF(((PyObject *)__pyx_r));
1612  if (!(likely(((__pyx_v_msg) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_msg, __pyx_ptype_3zmq_7backend_6cython_7message_Frame))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1613  __Pyx_INCREF(__pyx_v_msg);
1614  __pyx_r = ((struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *)__pyx_v_msg);
1615  goto __pyx_L0;
1616
1617  /* "zmq/backend/cython/socket.pyx":121
1618 *     return False
1619 *
1620 * cdef inline Frame _recv_frame(void *handle, int flags=0, track=False):             # <<<<<<<<<<<<<<
1621 *     """Receive a message in a non-copying manner and return a Frame."""
1622 *     cdef int rc
1623 */
1624
1625  /* function exit code */
1626  __pyx_L1_error:;
1627  __Pyx_XDECREF(__pyx_t_1);
1628  __Pyx_XDECREF(__pyx_t_2);
1629  __Pyx_XDECREF(__pyx_t_3);
1630  __Pyx_AddTraceback("zmq.backend.cython.socket._recv_frame", __pyx_clineno, __pyx_lineno, __pyx_filename);
1631  __pyx_r = 0;
1632  __pyx_L0:;
1633  __Pyx_XDECREF(__pyx_v_msg);
1634  __Pyx_XDECREF((PyObject *)__pyx_v_cmsg);
1635  __Pyx_XGIVEREF((PyObject *)__pyx_r);
1636  __Pyx_RefNannyFinishContext();
1637  return __pyx_r;
1638}
1639
1640/* "zmq/backend/cython/socket.pyx":133
1641 *     return msg
1642 *
1643 * cdef inline object _recv_copy(void *handle, int flags=0):             # <<<<<<<<<<<<<<
1644 *     """Receive a message and return a copy"""
1645 *     cdef zmq_msg_t zmq_msg
1646 */
1647
1648static CYTHON_INLINE PyObject *__pyx_f_3zmq_7backend_6cython_6socket__recv_copy(void *__pyx_v_handle, struct __pyx_opt_args_3zmq_7backend_6cython_6socket__recv_copy *__pyx_optional_args) {
1649  int __pyx_v_flags = ((int)0);
1650  zmq_msg_t __pyx_v_zmq_msg;
1651  int __pyx_v_rc;
1652  PyObject *__pyx_v_msg_bytes = NULL;
1653  PyObject *__pyx_r = NULL;
1654  __Pyx_RefNannyDeclarations
1655  int __pyx_t_1;
1656  PyObject *__pyx_t_2 = NULL;
1657  int __pyx_lineno = 0;
1658  const char *__pyx_filename = NULL;
1659  int __pyx_clineno = 0;
1660  __Pyx_RefNannySetupContext("_recv_copy", 0);
1661  if (__pyx_optional_args) {
1662    if (__pyx_optional_args->__pyx_n > 0) {
1663      __pyx_v_flags = __pyx_optional_args->flags;
1664    }
1665  }
1666
1667  /* "zmq/backend/cython/socket.pyx":136
1668 *     """Receive a message and return a copy"""
1669 *     cdef zmq_msg_t zmq_msg
1670 *     with nogil:             # <<<<<<<<<<<<<<
1671 *         zmq_msg_init (&zmq_msg)
1672 *         rc = zmq_msg_recv(&zmq_msg, handle, flags)
1673 */
1674  {
1675      #ifdef WITH_THREAD
1676      PyThreadState *_save;
1677      Py_UNBLOCK_THREADS
1678      #endif
1679      /*try:*/ {
1680
1681        /* "zmq/backend/cython/socket.pyx":137
1682 *     cdef zmq_msg_t zmq_msg
1683 *     with nogil:
1684 *         zmq_msg_init (&zmq_msg)             # <<<<<<<<<<<<<<
1685 *         rc = zmq_msg_recv(&zmq_msg, handle, flags)
1686 *     _check_rc(rc)
1687 */
1688        zmq_msg_init((&__pyx_v_zmq_msg));
1689
1690        /* "zmq/backend/cython/socket.pyx":138
1691 *     with nogil:
1692 *         zmq_msg_init (&zmq_msg)
1693 *         rc = zmq_msg_recv(&zmq_msg, handle, flags)             # <<<<<<<<<<<<<<
1694 *     _check_rc(rc)
1695 *     msg_bytes = copy_zmq_msg_bytes(&zmq_msg)
1696 */
1697        __pyx_v_rc = zmq_msg_recv((&__pyx_v_zmq_msg), __pyx_v_handle, __pyx_v_flags);
1698      }
1699
1700      /* "zmq/backend/cython/socket.pyx":136
1701 *     """Receive a message and return a copy"""
1702 *     cdef zmq_msg_t zmq_msg
1703 *     with nogil:             # <<<<<<<<<<<<<<
1704 *         zmq_msg_init (&zmq_msg)
1705 *         rc = zmq_msg_recv(&zmq_msg, handle, flags)
1706 */
1707      /*finally:*/ {
1708        /*normal exit:*/{
1709          #ifdef WITH_THREAD
1710          Py_BLOCK_THREADS
1711          #endif
1712          goto __pyx_L5;
1713        }
1714        __pyx_L5:;
1715      }
1716  }
1717
1718  /* "zmq/backend/cython/socket.pyx":139
1719 *         zmq_msg_init (&zmq_msg)
1720 *         rc = zmq_msg_recv(&zmq_msg, handle, flags)
1721 *     _check_rc(rc)             # <<<<<<<<<<<<<<
1722 *     msg_bytes = copy_zmq_msg_bytes(&zmq_msg)
1723 *     zmq_msg_close(&zmq_msg)
1724 */
1725  __pyx_t_1 = __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(__pyx_v_rc); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1726
1727  /* "zmq/backend/cython/socket.pyx":140
1728 *         rc = zmq_msg_recv(&zmq_msg, handle, flags)
1729 *     _check_rc(rc)
1730 *     msg_bytes = copy_zmq_msg_bytes(&zmq_msg)             # <<<<<<<<<<<<<<
1731 *     zmq_msg_close(&zmq_msg)
1732 *     return msg_bytes
1733 */
1734  __pyx_t_2 = __pyx_f_3zmq_7backend_6cython_7message_copy_zmq_msg_bytes((&__pyx_v_zmq_msg)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1735  __Pyx_GOTREF(__pyx_t_2);
1736  __pyx_v_msg_bytes = __pyx_t_2;
1737  __pyx_t_2 = 0;
1738
1739  /* "zmq/backend/cython/socket.pyx":141
1740 *     _check_rc(rc)
1741 *     msg_bytes = copy_zmq_msg_bytes(&zmq_msg)
1742 *     zmq_msg_close(&zmq_msg)             # <<<<<<<<<<<<<<
1743 *     return msg_bytes
1744 *
1745 */
1746  zmq_msg_close((&__pyx_v_zmq_msg));
1747
1748  /* "zmq/backend/cython/socket.pyx":142
1749 *     msg_bytes = copy_zmq_msg_bytes(&zmq_msg)
1750 *     zmq_msg_close(&zmq_msg)
1751 *     return msg_bytes             # <<<<<<<<<<<<<<
1752 *
1753 * cdef inline object _send_frame(void *handle, Frame msg, int flags=0):
1754 */
1755  __Pyx_XDECREF(__pyx_r);
1756  __Pyx_INCREF(__pyx_v_msg_bytes);
1757  __pyx_r = __pyx_v_msg_bytes;
1758  goto __pyx_L0;
1759
1760  /* "zmq/backend/cython/socket.pyx":133
1761 *     return msg
1762 *
1763 * cdef inline object _recv_copy(void *handle, int flags=0):             # <<<<<<<<<<<<<<
1764 *     """Receive a message and return a copy"""
1765 *     cdef zmq_msg_t zmq_msg
1766 */
1767
1768  /* function exit code */
1769  __pyx_L1_error:;
1770  __Pyx_XDECREF(__pyx_t_2);
1771  __Pyx_AddTraceback("zmq.backend.cython.socket._recv_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
1772  __pyx_r = 0;
1773  __pyx_L0:;
1774  __Pyx_XDECREF(__pyx_v_msg_bytes);
1775  __Pyx_XGIVEREF(__pyx_r);
1776  __Pyx_RefNannyFinishContext();
1777  return __pyx_r;
1778}
1779
1780/* "zmq/backend/cython/socket.pyx":144
1781 *     return msg_bytes
1782 *
1783 * cdef inline object _send_frame(void *handle, Frame msg, int flags=0):             # <<<<<<<<<<<<<<
1784 *     """Send a Frame on this socket in a non-copy manner."""
1785 *     cdef int rc
1786 */
1787
1788static CYTHON_INLINE PyObject *__pyx_f_3zmq_7backend_6cython_6socket__send_frame(void *__pyx_v_handle, struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_msg, struct __pyx_opt_args_3zmq_7backend_6cython_6socket__send_frame *__pyx_optional_args) {
1789  int __pyx_v_flags = ((int)0);
1790  int __pyx_v_rc;
1791  struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *__pyx_v_msg_copy = 0;
1792  PyObject *__pyx_r = NULL;
1793  __Pyx_RefNannyDeclarations
1794  PyObject *__pyx_t_1 = NULL;
1795  int __pyx_t_2;
1796  int __pyx_lineno = 0;
1797  const char *__pyx_filename = NULL;
1798  int __pyx_clineno = 0;
1799  __Pyx_RefNannySetupContext("_send_frame", 0);
1800  if (__pyx_optional_args) {
1801    if (__pyx_optional_args->__pyx_n > 0) {
1802      __pyx_v_flags = __pyx_optional_args->flags;
1803    }
1804  }
1805
1806  /* "zmq/backend/cython/socket.pyx":151
1807 *     # Always copy so the original message isn't garbage collected.
1808 *     # This doesn't do a real copy, just a reference.
1809 *     msg_copy = msg.fast_copy()             # <<<<<<<<<<<<<<
1810 *
1811 *     with nogil:
1812 */
1813  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_3zmq_7backend_6cython_7message_Frame *)__pyx_v_msg->__pyx_vtab)->fast_copy(__pyx_v_msg)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1814  __Pyx_GOTREF(__pyx_t_1);
1815  __pyx_v_msg_copy = ((struct __pyx_obj_3zmq_7backend_6cython_7message_Frame *)__pyx_t_1);
1816  __pyx_t_1 = 0;
1817
1818  /* "zmq/backend/cython/socket.pyx":153
1819 *     msg_copy = msg.fast_copy()
1820 *
1821 *     with nogil:             # <<<<<<<<<<<<<<
1822 *         rc = zmq_msg_send(&msg_copy.zmq_msg, handle, flags)
1823 *
1824 */
1825  {
1826      #ifdef WITH_THREAD
1827      PyThreadState *_save;
1828      Py_UNBLOCK_THREADS
1829      #endif
1830      /*try:*/ {
1831
1832        /* "zmq/backend/cython/socket.pyx":154
1833 *
1834 *     with nogil:
1835 *         rc = zmq_msg_send(&msg_copy.zmq_msg, handle, flags)             # <<<<<<<<<<<<<<
1836 *
1837 *     _check_rc(rc)
1838 */
1839        __pyx_v_rc = zmq_msg_send((&__pyx_v_msg_copy->zmq_msg), __pyx_v_handle, __pyx_v_flags);
1840      }
1841
1842      /* "zmq/backend/cython/socket.pyx":153
1843 *     msg_copy = msg.fast_copy()
1844 *
1845 *     with nogil:             # <<<<<<<<<<<<<<
1846 *         rc = zmq_msg_send(&msg_copy.zmq_msg, handle, flags)
1847 *
1848 */
1849      /*finally:*/ {
1850        /*normal exit:*/{
1851          #ifdef WITH_THREAD
1852          Py_BLOCK_THREADS
1853          #endif
1854          goto __pyx_L5;
1855        }
1856        __pyx_L5:;
1857      }
1858  }
1859
1860  /* "zmq/backend/cython/socket.pyx":156
1861 *         rc = zmq_msg_send(&msg_copy.zmq_msg, handle, flags)
1862 *
1863 *     _check_rc(rc)             # <<<<<<<<<<<<<<
1864 *     return msg.tracker
1865 *
1866 */
1867  __pyx_t_2 = __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(__pyx_v_rc); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1868
1869  /* "zmq/backend/cython/socket.pyx":157
1870 *
1871 *     _check_rc(rc)
1872 *     return msg.tracker             # <<<<<<<<<<<<<<
1873 *
1874 *
1875 */
1876  __Pyx_XDECREF(__pyx_r);
1877  __Pyx_INCREF(__pyx_v_msg->tracker);
1878  __pyx_r = __pyx_v_msg->tracker;
1879  goto __pyx_L0;
1880
1881  /* "zmq/backend/cython/socket.pyx":144
1882 *     return msg_bytes
1883 *
1884 * cdef inline object _send_frame(void *handle, Frame msg, int flags=0):             # <<<<<<<<<<<<<<
1885 *     """Send a Frame on this socket in a non-copy manner."""
1886 *     cdef int rc
1887 */
1888
1889  /* function exit code */
1890  __pyx_L1_error:;
1891  __Pyx_XDECREF(__pyx_t_1);
1892  __Pyx_AddTraceback("zmq.backend.cython.socket._send_frame", __pyx_clineno, __pyx_lineno, __pyx_filename);
1893  __pyx_r = 0;
1894  __pyx_L0:;
1895  __Pyx_XDECREF((PyObject *)__pyx_v_msg_copy);
1896  __Pyx_XGIVEREF(__pyx_r);
1897  __Pyx_RefNannyFinishContext();
1898  return __pyx_r;
1899}
1900
1901/* "zmq/backend/cython/socket.pyx":160
1902 *
1903 *
1904 * cdef inline object _send_copy(void *handle, object msg, int flags=0):             # <<<<<<<<<<<<<<
1905 *     """Send a message on this socket by copying its content."""
1906 *     cdef int rc, rc2
1907 */
1908
1909static CYTHON_INLINE PyObject *__pyx_f_3zmq_7backend_6cython_6socket__send_copy(void *__pyx_v_handle, PyObject *__pyx_v_msg, struct __pyx_opt_args_3zmq_7backend_6cython_6socket__send_copy *__pyx_optional_args) {
1910  int __pyx_v_flags = ((int)0);
1911  int __pyx_v_rc;
1912  int __pyx_v_rc2;
1913  zmq_msg_t __pyx_v_data;
1914  char *__pyx_v_msg_c;
1915  Py_ssize_t __pyx_v_msg_c_len;
1916  PyObject *__pyx_r = NULL;
1917  __Pyx_RefNannyDeclarations
1918  PyObject *__pyx_t_1 = NULL;
1919  int __pyx_t_2;
1920  int __pyx_lineno = 0;
1921  const char *__pyx_filename = NULL;
1922  int __pyx_clineno = 0;
1923  __Pyx_RefNannySetupContext("_send_copy", 0);
1924  if (__pyx_optional_args) {
1925    if (__pyx_optional_args->__pyx_n > 0) {
1926      __pyx_v_flags = __pyx_optional_args->flags;
1927    }
1928  }
1929
1930  /* "zmq/backend/cython/socket.pyx":165
1931 *     cdef zmq_msg_t data
1932 *     cdef char *msg_c
1933 *     cdef Py_ssize_t msg_c_len=0             # <<<<<<<<<<<<<<
1934 *
1935 *     # copy to c array:
1936 */
1937  __pyx_v_msg_c_len = 0;
1938
1939  /* "zmq/backend/cython/socket.pyx":168
1940 *
1941 *     # copy to c array:
1942 *     asbuffer_r(msg, <void **>&msg_c, &msg_c_len)             # <<<<<<<<<<<<<<
1943 *
1944 *     # Copy the msg before sending. This avoids any complications with
1945 */
1946  __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 = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1947  __Pyx_GOTREF(__pyx_t_1);
1948  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1949
1950  /* "zmq/backend/cython/socket.pyx":173
1951 *     # the GIL, etc.
1952 *     # If zmq_msg_init_* fails we must not call zmq_msg_close (Bus Error)
1953 *     rc = zmq_msg_init_size(&data, msg_c_len)             # <<<<<<<<<<<<<<
1954 *
1955 *     _check_rc(rc)
1956 */
1957  __pyx_v_rc = zmq_msg_init_size((&__pyx_v_data), __pyx_v_msg_c_len);
1958
1959  /* "zmq/backend/cython/socket.pyx":175
1960 *     rc = zmq_msg_init_size(&data, msg_c_len)
1961 *
1962 *     _check_rc(rc)             # <<<<<<<<<<<<<<
1963 *
1964 *     with nogil:
1965 */
1966  __pyx_t_2 = __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(__pyx_v_rc); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
1967
1968  /* "zmq/backend/cython/socket.pyx":177
1969 *     _check_rc(rc)
1970 *
1971 *     with nogil:             # <<<<<<<<<<<<<<
1972 *         memcpy(zmq_msg_data(&data), msg_c, zmq_msg_size(&data))
1973 *         rc = zmq_msg_send(&data, handle, flags)
1974 */
1975  {
1976      #ifdef WITH_THREAD
1977      PyThreadState *_save;
1978      Py_UNBLOCK_THREADS
1979      #endif
1980      /*try:*/ {
1981
1982        /* "zmq/backend/cython/socket.pyx":178
1983 *
1984 *     with nogil:
1985 *         memcpy(zmq_msg_data(&data), msg_c, zmq_msg_size(&data))             # <<<<<<<<<<<<<<
1986 *         rc = zmq_msg_send(&data, handle, flags)
1987 *         rc2 = zmq_msg_close(&data)
1988 */
1989        memcpy(zmq_msg_data((&__pyx_v_data)), __pyx_v_msg_c, zmq_msg_size((&__pyx_v_data)));
1990
1991        /* "zmq/backend/cython/socket.pyx":179
1992 *     with nogil:
1993 *         memcpy(zmq_msg_data(&data), msg_c, zmq_msg_size(&data))
1994 *         rc = zmq_msg_send(&data, handle, flags)             # <<<<<<<<<<<<<<
1995 *         rc2 = zmq_msg_close(&data)
1996 *     _check_rc(rc)
1997 */
1998        __pyx_v_rc = zmq_msg_send((&__pyx_v_data), __pyx_v_handle, __pyx_v_flags);
1999
2000        /* "zmq/backend/cython/socket.pyx":180
2001 *         memcpy(zmq_msg_data(&data), msg_c, zmq_msg_size(&data))
2002 *         rc = zmq_msg_send(&data, handle, flags)
2003 *         rc2 = zmq_msg_close(&data)             # <<<<<<<<<<<<<<
2004 *     _check_rc(rc)
2005 *     _check_rc(rc2)
2006 */
2007        __pyx_v_rc2 = zmq_msg_close((&__pyx_v_data));
2008      }
2009
2010      /* "zmq/backend/cython/socket.pyx":177
2011 *     _check_rc(rc)
2012 *
2013 *     with nogil:             # <<<<<<<<<<<<<<
2014 *         memcpy(zmq_msg_data(&data), msg_c, zmq_msg_size(&data))
2015 *         rc = zmq_msg_send(&data, handle, flags)
2016 */
2017      /*finally:*/ {
2018        /*normal exit:*/{
2019          #ifdef WITH_THREAD
2020          Py_BLOCK_THREADS
2021          #endif
2022          goto __pyx_L5;
2023        }
2024        __pyx_L5:;
2025      }
2026  }
2027
2028  /* "zmq/backend/cython/socket.pyx":181
2029 *         rc = zmq_msg_send(&data, handle, flags)
2030 *         rc2 = zmq_msg_close(&data)
2031 *     _check_rc(rc)             # <<<<<<<<<<<<<<
2032 *     _check_rc(rc2)
2033 *
2034 */
2035  __pyx_t_2 = __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(__pyx_v_rc); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2036
2037  /* "zmq/backend/cython/socket.pyx":182
2038 *         rc2 = zmq_msg_close(&data)
2039 *     _check_rc(rc)
2040 *     _check_rc(rc2)             # <<<<<<<<<<<<<<
2041 *
2042 *
2043 */
2044  __pyx_t_2 = __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(__pyx_v_rc2); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2045
2046  /* "zmq/backend/cython/socket.pyx":160
2047 *
2048 *
2049 * cdef inline object _send_copy(void *handle, object msg, int flags=0):             # <<<<<<<<<<<<<<
2050 *     """Send a message on this socket by copying its content."""
2051 *     cdef int rc, rc2
2052 */
2053
2054  /* function exit code */
2055  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2056  goto __pyx_L0;
2057  __pyx_L1_error:;
2058  __Pyx_XDECREF(__pyx_t_1);
2059  __Pyx_AddTraceback("zmq.backend.cython.socket._send_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
2060  __pyx_r = 0;
2061  __pyx_L0:;
2062  __Pyx_XGIVEREF(__pyx_r);
2063  __Pyx_RefNannyFinishContext();
2064  return __pyx_r;
2065}
2066
2067/* "zmq/backend/cython/socket.pyx":208
2068 *
2069 *     # no-op for the signature
2070 *     def __init__(self, context=None, socket_type=-1, shadow=0):             # <<<<<<<<<<<<<<
2071 *         pass
2072 *
2073 */
2074
2075/* Python wrapper */
2076static int __pyx_pw_3zmq_7backend_6cython_6socket_6Socket_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2077static int __pyx_pw_3zmq_7backend_6cython_6socket_6Socket_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2078  CYTHON_UNUSED PyObject *__pyx_v_context = 0;
2079  CYTHON_UNUSED PyObject *__pyx_v_socket_type = 0;
2080  CYTHON_UNUSED PyObject *__pyx_v_shadow = 0;
2081  int __pyx_lineno = 0;
2082  const char *__pyx_filename = NULL;
2083  int __pyx_clineno = 0;
2084  int __pyx_r;
2085  __Pyx_RefNannyDeclarations
2086  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
2087  {
2088    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_context,&__pyx_n_s_socket_type,&__pyx_n_s_shadow,0};
2089    PyObject* values[3] = {0,0,0};
2090    values[0] = ((PyObject *)Py_None);
2091    values[1] = ((PyObject *)__pyx_int_neg_1);
2092    values[2] = ((PyObject *)__pyx_int_0);
2093    if (unlikely(__pyx_kwds)) {
2094      Py_ssize_t kw_args;
2095      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2096      switch (pos_args) {
2097        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2098        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2099        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2100        case  0: break;
2101        default: goto __pyx_L5_argtuple_error;
2102      }
2103      kw_args = PyDict_Size(__pyx_kwds);
2104      switch (pos_args) {
2105        case  0:
2106        if (kw_args > 0) {
2107          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_context);
2108          if (value) { values[0] = value; kw_args--; }
2109        }
2110        case  1:
2111        if (kw_args > 0) {
2112          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_socket_type);
2113          if (value) { values[1] = value; kw_args--; }
2114        }
2115        case  2:
2116        if (kw_args > 0) {
2117          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_shadow);
2118          if (value) { values[2] = value; kw_args--; }
2119        }
2120      }
2121      if (unlikely(kw_args > 0)) {
2122        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2123      }
2124    } else {
2125      switch (PyTuple_GET_SIZE(__pyx_args)) {
2126        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2127        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2128        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2129        case  0: break;
2130        default: goto __pyx_L5_argtuple_error;
2131      }
2132    }
2133    __pyx_v_context = values[0];
2134    __pyx_v_socket_type = values[1];
2135    __pyx_v_shadow = values[2];
2136  }
2137  goto __pyx_L4_argument_unpacking_done;
2138  __pyx_L5_argtuple_error:;
2139  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2140  __pyx_L3_error:;
2141  __Pyx_AddTraceback("zmq.backend.cython.socket.Socket.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2142  __Pyx_RefNannyFinishContext();
2143  return -1;
2144  __pyx_L4_argument_unpacking_done:;
2145  __pyx_r = __pyx_pf_3zmq_7backend_6cython_6socket_6Socket___init__(((struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *)__pyx_v_self), __pyx_v_context, __pyx_v_socket_type, __pyx_v_shadow);
2146
2147  /* function exit code */
2148  __Pyx_RefNannyFinishContext();
2149  return __pyx_r;
2150}
2151
2152static int __pyx_pf_3zmq_7backend_6cython_6socket_6Socket___init__(CYTHON_UNUSED struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_context, CYTHON_UNUSED PyObject *__pyx_v_socket_type, CYTHON_UNUSED PyObject *__pyx_v_shadow) {
2153  int __pyx_r;
2154  __Pyx_RefNannyDeclarations
2155  __Pyx_RefNannySetupContext("__init__", 0);
2156
2157  /* function exit code */
2158  __pyx_r = 0;
2159  __Pyx_RefNannyFinishContext();
2160  return __pyx_r;
2161}
2162
2163/* "zmq/backend/cython/socket.pyx":211
2164 *         pass
2165 *
2166 *     def __cinit__(self, Context context=None, int socket_type=-1, size_t shadow=0, *args, **kwargs):             # <<<<<<<<<<<<<<
2167 *         cdef Py_ssize_t c_handle
2168 *
2169 */
2170
2171/* Python wrapper */
2172static int __pyx_pw_3zmq_7backend_6cython_6socket_6Socket_3__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2173static int __pyx_pw_3zmq_7backend_6cython_6socket_6Socket_3__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2174  struct __pyx_obj_3zmq_7backend_6cython_7context_Context *__pyx_v_context = 0;
2175  int __pyx_v_socket_type;
2176  size_t __pyx_v_shadow;
2177  CYTHON_UNUSED PyObject *__pyx_v_args = 0;
2178  CYTHON_UNUSED PyObject *__pyx_v_kwargs = 0;
2179  int __pyx_lineno = 0;
2180  const char *__pyx_filename = NULL;
2181  int __pyx_clineno = 0;
2182  int __pyx_r;
2183  __Pyx_RefNannyDeclarations
2184  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
2185  __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1;
2186  __Pyx_GOTREF(__pyx_v_kwargs);
2187  if (PyTuple_GET_SIZE(__pyx_args) > 3) {
2188    __pyx_v_args = PyTuple_GetSlice(__pyx_args, 3, PyTuple_GET_SIZE(__pyx_args));
2189    if (unlikely(!__pyx_v_args)) {
2190      __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
2191      __Pyx_RefNannyFinishContext();
2192      return -1;
2193    }
2194    __Pyx_GOTREF(__pyx_v_args);
2195  } else {
2196    __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
2197  }
2198  {
2199    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_context,&__pyx_n_s_socket_type,&__pyx_n_s_shadow,0};
2200    PyObject* values[3] = {0,0,0};
2201    values[0] = (PyObject *)((struct __pyx_obj_3zmq_7backend_6cython_7context_Context *)Py_None);
2202    if (unlikely(__pyx_kwds)) {
2203      Py_ssize_t kw_args;
2204      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2205      switch (pos_args) {
2206        default:
2207        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2208        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2209        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2210        case  0: break;
2211      }
2212      kw_args = PyDict_Size(__pyx_kwds);
2213      switch (pos_args) {
2214        case  0:
2215        if (kw_args > 0) {
2216          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_context);
2217          if (value) { values[0] = value; kw_args--; }
2218        }
2219        case  1:
2220        if (kw_args > 0) {
2221          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_socket_type);
2222          if (value) { values[1] = value; kw_args--; }
2223        }
2224        case  2:
2225        if (kw_args > 0) {
2226          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_shadow);
2227          if (value) { values[2] = value; kw_args--; }
2228        }
2229      }
2230      if (unlikely(kw_args > 0)) {
2231        const Py_ssize_t used_pos_args = (pos_args < 3) ? pos_args : 3;
2232        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, used_pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2233      }
2234    } else {
2235      switch (PyTuple_GET_SIZE(__pyx_args)) {
2236        default:
2237        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2238        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2239        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2240        case  0: break;
2241      }
2242    }
2243    __pyx_v_context = ((struct __pyx_obj_3zmq_7backend_6cython_7context_Context *)values[0]);
2244    if (values[1]) {
2245      __pyx_v_socket_type = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_socket_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2246    } else {
2247      __pyx_v_socket_type = ((int)-1);
2248    }
2249    if (values[2]) {
2250      __pyx_v_shadow = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v_shadow == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2251    } else {
2252      __pyx_v_shadow = ((size_t)0);
2253    }
2254  }
2255  goto __pyx_L4_argument_unpacking_done;
2256  __pyx_L3_error:;
2257  __Pyx_DECREF(__pyx_v_args); __pyx_v_args = 0;
2258  __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
2259  __Pyx_AddTraceback("zmq.backend.cython.socket.Socket.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2260  __Pyx_RefNannyFinishContext();
2261  return -1;
2262  __pyx_L4_argument_unpacking_done:;
2263  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_context), __pyx_ptype_3zmq_7backend_6cython_7context_Context, 1, "context", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2264  __pyx_r = __pyx_pf_3zmq_7backend_6cython_6socket_6Socket_2__cinit__(((struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *)__pyx_v_self), __pyx_v_context, __pyx_v_socket_type, __pyx_v_shadow, __pyx_v_args, __pyx_v_kwargs);
2265
2266  /* function exit code */
2267  goto __pyx_L0;
2268  __pyx_L1_error:;
2269  __pyx_r = -1;
2270  __pyx_L0:;
2271  __Pyx_XDECREF(__pyx_v_args);
2272  __Pyx_XDECREF(__pyx_v_kwargs);
2273  __Pyx_RefNannyFinishContext();
2274  return __pyx_r;
2275}
2276
2277static int __pyx_pf_3zmq_7backend_6cython_6socket_6Socket_2__cinit__(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, struct __pyx_obj_3zmq_7backend_6cython_7context_Context *__pyx_v_context, int __pyx_v_socket_type, size_t __pyx_v_shadow, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
2278  int __pyx_r;
2279  __Pyx_RefNannyDeclarations
2280  int __pyx_t_1;
2281  int __pyx_t_2;
2282  PyObject *__pyx_t_3 = NULL;
2283  PyObject *__pyx_t_4 = NULL;
2284  PyObject *__pyx_t_5 = NULL;
2285  int __pyx_lineno = 0;
2286  const char *__pyx_filename = NULL;
2287  int __pyx_clineno = 0;
2288  __Pyx_RefNannySetupContext("__cinit__", 0);
2289
2290  /* "zmq/backend/cython/socket.pyx":214
2291 *         cdef Py_ssize_t c_handle
2292 *
2293 *         self.handle = NULL             # <<<<<<<<<<<<<<
2294 *         self.context = context
2295 *         if shadow:
2296 */
2297  __pyx_v_self->handle = NULL;
2298
2299  /* "zmq/backend/cython/socket.pyx":215
2300 *
2301 *         self.handle = NULL
2302 *         self.context = context             # <<<<<<<<<<<<<<
2303 *         if shadow:
2304 *             self._shadow = True
2305 */
2306  __Pyx_INCREF(((PyObject *)__pyx_v_context));
2307  __Pyx_GIVEREF(((PyObject *)__pyx_v_context));
2308  __Pyx_GOTREF(__pyx_v_self->context);
2309  __Pyx_DECREF(((PyObject *)__pyx_v_self->context));
2310  __pyx_v_self->context = __pyx_v_context;
2311
2312  /* "zmq/backend/cython/socket.pyx":216
2313 *         self.handle = NULL
2314 *         self.context = context
2315 *         if shadow:             # <<<<<<<<<<<<<<
2316 *             self._shadow = True
2317 *             self.handle = <void *>shadow
2318 */
2319  __pyx_t_1 = (__pyx_v_shadow != 0);
2320  if (__pyx_t_1) {
2321
2322    /* "zmq/backend/cython/socket.pyx":217
2323 *         self.context = context
2324 *         if shadow:
2325 *             self._shadow = True             # <<<<<<<<<<<<<<
2326 *             self.handle = <void *>shadow
2327 *         else:
2328 */
2329    __pyx_v_self->_shadow = 1;
2330
2331    /* "zmq/backend/cython/socket.pyx":218
2332 *         if shadow:
2333 *             self._shadow = True
2334 *             self.handle = <void *>shadow             # <<<<<<<<<<<<<<
2335 *         else:
2336 *             if context is None:
2337 */
2338    __pyx_v_self->handle = ((void *)__pyx_v_shadow);
2339    goto __pyx_L3;
2340  }
2341  /*else*/ {
2342
2343    /* "zmq/backend/cython/socket.pyx":220
2344 *             self.handle = <void *>shadow
2345 *         else:
2346 *             if context is None:             # <<<<<<<<<<<<<<
2347 *                 raise TypeError("context must be specified")
2348 *             if socket_type < 0:
2349 */
2350    __pyx_t_1 = (((PyObject *)__pyx_v_context) == Py_None);
2351    __pyx_t_2 = (__pyx_t_1 != 0);
2352    if (__pyx_t_2) {
2353
2354      /* "zmq/backend/cython/socket.pyx":221
2355 *         else:
2356 *             if context is None:
2357 *                 raise TypeError("context must be specified")             # <<<<<<<<<<<<<<
2358 *             if socket_type < 0:
2359 *                 raise TypeError("socket_type must be specified")
2360 */
2361      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2362      __Pyx_GOTREF(__pyx_t_3);
2363      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
2364      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2365      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2366    }
2367
2368    /* "zmq/backend/cython/socket.pyx":222
2369 *             if context is None:
2370 *                 raise TypeError("context must be specified")
2371 *             if socket_type < 0:             # <<<<<<<<<<<<<<
2372 *                 raise TypeError("socket_type must be specified")
2373 *             self._shadow = False
2374 */
2375    __pyx_t_2 = ((__pyx_v_socket_type < 0) != 0);
2376    if (__pyx_t_2) {
2377
2378      /* "zmq/backend/cython/socket.pyx":223
2379 *                 raise TypeError("context must be specified")
2380 *             if socket_type < 0:
2381 *                 raise TypeError("socket_type must be specified")             # <<<<<<<<<<<<<<
2382 *             self._shadow = False
2383 *             self.handle = zmq_socket(context.handle, socket_type)
2384 */
2385      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2386      __Pyx_GOTREF(__pyx_t_3);
2387      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
2388      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2389      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2390    }
2391
2392    /* "zmq/backend/cython/socket.pyx":224
2393 *             if socket_type < 0:
2394 *                 raise TypeError("socket_type must be specified")
2395 *             self._shadow = False             # <<<<<<<<<<<<<<
2396 *             self.handle = zmq_socket(context.handle, socket_type)
2397 *         if self.handle == NULL:
2398 */
2399    __pyx_v_self->_shadow = 0;
2400
2401    /* "zmq/backend/cython/socket.pyx":225
2402 *                 raise TypeError("socket_type must be specified")
2403 *             self._shadow = False
2404 *             self.handle = zmq_socket(context.handle, socket_type)             # <<<<<<<<<<<<<<
2405 *         if self.handle == NULL:
2406 *             raise ZMQError()
2407 */
2408    __pyx_v_self->handle = zmq_socket(__pyx_v_context->handle, __pyx_v_socket_type);
2409  }
2410  __pyx_L3:;
2411
2412  /* "zmq/backend/cython/socket.pyx":226
2413 *             self._shadow = False
2414 *             self.handle = zmq_socket(context.handle, socket_type)
2415 *         if self.handle == NULL:             # <<<<<<<<<<<<<<
2416 *             raise ZMQError()
2417 *         self._closed = False
2418 */
2419  __pyx_t_2 = ((__pyx_v_self->handle == NULL) != 0);
2420  if (__pyx_t_2) {
2421
2422    /* "zmq/backend/cython/socket.pyx":227
2423 *             self.handle = zmq_socket(context.handle, socket_type)
2424 *         if self.handle == NULL:
2425 *             raise ZMQError()             # <<<<<<<<<<<<<<
2426 *         self._closed = False
2427 *         self._pid = getpid()
2428 */
2429    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_ZMQError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2430    __Pyx_GOTREF(__pyx_t_4);
2431    __pyx_t_5 = NULL;
2432    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
2433      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
2434      if (likely(__pyx_t_5)) {
2435        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
2436        __Pyx_INCREF(__pyx_t_5);
2437        __Pyx_INCREF(function);
2438        __Pyx_DECREF_SET(__pyx_t_4, function);
2439      }
2440    }
2441    if (__pyx_t_5) {
2442      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2443      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2444    } else {
2445      __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2446    }
2447    __Pyx_GOTREF(__pyx_t_3);
2448    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2449    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
2450    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2451    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2452  }
2453
2454  /* "zmq/backend/cython/socket.pyx":228
2455 *         if self.handle == NULL:
2456 *             raise ZMQError()
2457 *         self._closed = False             # <<<<<<<<<<<<<<
2458 *         self._pid = getpid()
2459 *         if context:
2460 */
2461  __pyx_v_self->_closed = 0;
2462
2463  /* "zmq/backend/cython/socket.pyx":229
2464 *             raise ZMQError()
2465 *         self._closed = False
2466 *         self._pid = getpid()             # <<<<<<<<<<<<<<
2467 *         if context:
2468 *             context._add_socket(self.handle)
2469 */
2470  __pyx_v_self->_pid = getpid();
2471
2472  /* "zmq/backend/cython/socket.pyx":230
2473 *         self._closed = False
2474 *         self._pid = getpid()
2475 *         if context:             # <<<<<<<<<<<<<<
2476 *             context._add_socket(self.handle)
2477 *
2478 */
2479  __pyx_t_2 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_context)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2480  if (__pyx_t_2) {
2481
2482    /* "zmq/backend/cython/socket.pyx":231
2483 *         self._pid = getpid()
2484 *         if context:
2485 *             context._add_socket(self.handle)             # <<<<<<<<<<<<<<
2486 *
2487 *     def __dealloc__(self):
2488 */
2489    ((struct __pyx_vtabstruct_3zmq_7backend_6cython_7context_Context *)__pyx_v_context->__pyx_vtab)->_add_socket(__pyx_v_context, __pyx_v_self->handle);
2490    goto __pyx_L7;
2491  }
2492  __pyx_L7:;
2493
2494  /* "zmq/backend/cython/socket.pyx":211
2495 *         pass
2496 *
2497 *     def __cinit__(self, Context context=None, int socket_type=-1, size_t shadow=0, *args, **kwargs):             # <<<<<<<<<<<<<<
2498 *         cdef Py_ssize_t c_handle
2499 *
2500 */
2501
2502  /* function exit code */
2503  __pyx_r = 0;
2504  goto __pyx_L0;
2505  __pyx_L1_error:;
2506  __Pyx_XDECREF(__pyx_t_3);
2507  __Pyx_XDECREF(__pyx_t_4);
2508  __Pyx_XDECREF(__pyx_t_5);
2509  __Pyx_AddTraceback("zmq.backend.cython.socket.Socket.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2510  __pyx_r = -1;
2511  __pyx_L0:;
2512  __Pyx_RefNannyFinishContext();
2513  return __pyx_r;
2514}
2515
2516/* "zmq/backend/cython/socket.pyx":233
2517 *             context._add_socket(self.handle)
2518 *
2519 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
2520 *         """remove from context's list
2521 *
2522 */
2523
2524/* Python wrapper */
2525static void __pyx_pw_3zmq_7backend_6cython_6socket_6Socket_5__dealloc__(PyObject *__pyx_v_self); /*proto*/
2526static void __pyx_pw_3zmq_7backend_6cython_6socket_6Socket_5__dealloc__(PyObject *__pyx_v_self) {
2527  __Pyx_RefNannyDeclarations
2528  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
2529  __pyx_pf_3zmq_7backend_6cython_6socket_6Socket_4__dealloc__(((struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *)__pyx_v_self));
2530
2531  /* function exit code */
2532  __Pyx_RefNannyFinishContext();
2533}
2534
2535static void __pyx_pf_3zmq_7backend_6cython_6socket_6Socket_4__dealloc__(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self) {
2536  __Pyx_RefNannyDeclarations
2537  int __pyx_t_1;
2538  int __pyx_t_2;
2539  int __pyx_lineno = 0;
2540  const char *__pyx_filename = NULL;
2541  int __pyx_clineno = 0;
2542  __Pyx_RefNannySetupContext("__dealloc__", 0);
2543
2544  /* "zmq/backend/cython/socket.pyx":238
2545 *         But be careful that context might not exist if called during gc
2546 *         """
2547 *         if self.handle != NULL and not self._shadow and getpid() == self._pid:             # <<<<<<<<<<<<<<
2548 *             # during gc, self.context might be NULL
2549 *             if self.context and not self.context.closed:
2550 */
2551  __pyx_t_2 = ((__pyx_v_self->handle != NULL) != 0);
2552  if (__pyx_t_2) {
2553  } else {
2554    __pyx_t_1 = __pyx_t_2;
2555    goto __pyx_L4_bool_binop_done;
2556  }
2557  __pyx_t_2 = ((!(__pyx_v_self->_shadow != 0)) != 0);
2558  if (__pyx_t_2) {
2559  } else {
2560    __pyx_t_1 = __pyx_t_2;
2561    goto __pyx_L4_bool_binop_done;
2562  }
2563  __pyx_t_2 = ((getpid() == __pyx_v_self->_pid) != 0);
2564  __pyx_t_1 = __pyx_t_2;
2565  __pyx_L4_bool_binop_done:;
2566  if (__pyx_t_1) {
2567
2568    /* "zmq/backend/cython/socket.pyx":240
2569 *         if self.handle != NULL and not self._shadow and getpid() == self._pid:
2570 *             # during gc, self.context might be NULL
2571 *             if self.context and not self.context.closed:             # <<<<<<<<<<<<<<
2572 *                 self.context._remove_socket(self.handle)
2573 *
2574 */
2575    __pyx_t_2 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_self->context)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2576    if (__pyx_t_2) {
2577    } else {
2578      __pyx_t_1 = __pyx_t_2;
2579      goto __pyx_L8_bool_binop_done;
2580    }
2581    __pyx_t_2 = ((!(__pyx_v_self->context->closed != 0)) != 0);
2582    __pyx_t_1 = __pyx_t_2;
2583    __pyx_L8_bool_binop_done:;
2584    if (__pyx_t_1) {
2585
2586      /* "zmq/backend/cython/socket.pyx":241
2587 *             # during gc, self.context might be NULL
2588 *             if self.context and not self.context.closed:
2589 *                 self.context._remove_socket(self.handle)             # <<<<<<<<<<<<<<
2590 *
2591 *     @property
2592 */
2593      ((struct __pyx_vtabstruct_3zmq_7backend_6cython_7context_Context *)__pyx_v_self->context->__pyx_vtab)->_remove_socket(__pyx_v_self->context, __pyx_v_self->handle);
2594      goto __pyx_L7;
2595    }
2596    __pyx_L7:;
2597    goto __pyx_L3;
2598  }
2599  __pyx_L3:;
2600
2601  /* "zmq/backend/cython/socket.pyx":233
2602 *             context._add_socket(self.handle)
2603 *
2604 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
2605 *         """remove from context's list
2606 *
2607 */
2608
2609  /* function exit code */
2610  goto __pyx_L0;
2611  __pyx_L1_error:;
2612  __Pyx_WriteUnraisable("zmq.backend.cython.socket.Socket.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
2613  __pyx_L0:;
2614  __Pyx_RefNannyFinishContext();
2615}
2616
2617/* "zmq/backend/cython/socket.pyx":244
2618 *
2619 *     @property
2620 *     def underlying(self):             # <<<<<<<<<<<<<<
2621 *         """The address of the underlying libzmq socket"""
2622 *         return <size_t> self.handle
2623 */
2624
2625/* Python wrapper */
2626static PyObject *__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_7underlying(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
2627static char __pyx_doc_3zmq_7backend_6cython_6socket_6Socket_6underlying[] = "The address of the underlying libzmq socket";
2628static PyObject *__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_7underlying(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
2629  PyObject *__pyx_r = 0;
2630  __Pyx_RefNannyDeclarations
2631  __Pyx_RefNannySetupContext("underlying (wrapper)", 0);
2632  __pyx_r = __pyx_pf_3zmq_7backend_6cython_6socket_6Socket_6underlying(((struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *)__pyx_v_self));
2633
2634  /* function exit code */
2635  __Pyx_RefNannyFinishContext();
2636  return __pyx_r;
2637}
2638
2639static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_6underlying(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self) {
2640  PyObject *__pyx_r = NULL;
2641  __Pyx_RefNannyDeclarations
2642  PyObject *__pyx_t_1 = NULL;
2643  int __pyx_lineno = 0;
2644  const char *__pyx_filename = NULL;
2645  int __pyx_clineno = 0;
2646  __Pyx_RefNannySetupContext("underlying", 0);
2647
2648  /* "zmq/backend/cython/socket.pyx":246
2649 *     def underlying(self):
2650 *         """The address of the underlying libzmq socket"""
2651 *         return <size_t> self.handle             # <<<<<<<<<<<<<<
2652 *
2653 *     @property
2654 */
2655  __Pyx_XDECREF(__pyx_r);
2656  __pyx_t_1 = __Pyx_PyInt_FromSize_t(((size_t)__pyx_v_self->handle)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2657  __Pyx_GOTREF(__pyx_t_1);
2658  __pyx_r = __pyx_t_1;
2659  __pyx_t_1 = 0;
2660  goto __pyx_L0;
2661
2662  /* "zmq/backend/cython/socket.pyx":244
2663 *
2664 *     @property
2665 *     def underlying(self):             # <<<<<<<<<<<<<<
2666 *         """The address of the underlying libzmq socket"""
2667 *         return <size_t> self.handle
2668 */
2669
2670  /* function exit code */
2671  __pyx_L1_error:;
2672  __Pyx_XDECREF(__pyx_t_1);
2673  __Pyx_AddTraceback("zmq.backend.cython.socket.Socket.underlying", __pyx_clineno, __pyx_lineno, __pyx_filename);
2674  __pyx_r = NULL;
2675  __pyx_L0:;
2676  __Pyx_XGIVEREF(__pyx_r);
2677  __Pyx_RefNannyFinishContext();
2678  return __pyx_r;
2679}
2680
2681/* "zmq/backend/cython/socket.pyx":249
2682 *
2683 *     @property
2684 *     def closed(self):             # <<<<<<<<<<<<<<
2685 *         return _check_closed_deep(self)
2686 *
2687 */
2688
2689/* Python wrapper */
2690static PyObject *__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_9closed(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
2691static PyObject *__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_9closed(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
2692  PyObject *__pyx_r = 0;
2693  __Pyx_RefNannyDeclarations
2694  __Pyx_RefNannySetupContext("closed (wrapper)", 0);
2695  __pyx_r = __pyx_pf_3zmq_7backend_6cython_6socket_6Socket_8closed(((struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *)__pyx_v_self));
2696
2697  /* function exit code */
2698  __Pyx_RefNannyFinishContext();
2699  return __pyx_r;
2700}
2701
2702static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_8closed(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self) {
2703  PyObject *__pyx_r = NULL;
2704  __Pyx_RefNannyDeclarations
2705  PyObject *__pyx_t_1 = NULL;
2706  int __pyx_lineno = 0;
2707  const char *__pyx_filename = NULL;
2708  int __pyx_clineno = 0;
2709  __Pyx_RefNannySetupContext("closed", 0);
2710
2711  /* "zmq/backend/cython/socket.pyx":250
2712 *     @property
2713 *     def closed(self):
2714 *         return _check_closed_deep(self)             # <<<<<<<<<<<<<<
2715 *
2716 *     def close(self, linger=None):
2717 */
2718  __Pyx_XDECREF(__pyx_r);
2719  __pyx_t_1 = __pyx_f_3zmq_7backend_6cython_6socket__check_closed_deep(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2720  __Pyx_GOTREF(__pyx_t_1);
2721  __pyx_r = __pyx_t_1;
2722  __pyx_t_1 = 0;
2723  goto __pyx_L0;
2724
2725  /* "zmq/backend/cython/socket.pyx":249
2726 *
2727 *     @property
2728 *     def closed(self):             # <<<<<<<<<<<<<<
2729 *         return _check_closed_deep(self)
2730 *
2731 */
2732
2733  /* function exit code */
2734  __pyx_L1_error:;
2735  __Pyx_XDECREF(__pyx_t_1);
2736  __Pyx_AddTraceback("zmq.backend.cython.socket.Socket.closed", __pyx_clineno, __pyx_lineno, __pyx_filename);
2737  __pyx_r = NULL;
2738  __pyx_L0:;
2739  __Pyx_XGIVEREF(__pyx_r);
2740  __Pyx_RefNannyFinishContext();
2741  return __pyx_r;
2742}
2743
2744/* "zmq/backend/cython/socket.pyx":252
2745 *         return _check_closed_deep(self)
2746 *
2747 *     def close(self, linger=None):             # <<<<<<<<<<<<<<
2748 *         """s.close(linger=None)
2749 *
2750 */
2751
2752/* Python wrapper */
2753static PyObject *__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_11close(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2754static char __pyx_doc_3zmq_7backend_6cython_6socket_6Socket_10close[] = "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        ";
2755static PyObject *__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_11close(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2756  PyObject *__pyx_v_linger = 0;
2757  int __pyx_lineno = 0;
2758  const char *__pyx_filename = NULL;
2759  int __pyx_clineno = 0;
2760  PyObject *__pyx_r = 0;
2761  __Pyx_RefNannyDeclarations
2762  __Pyx_RefNannySetupContext("close (wrapper)", 0);
2763  {
2764    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_linger,0};
2765    PyObject* values[1] = {0};
2766    values[0] = ((PyObject *)Py_None);
2767    if (unlikely(__pyx_kwds)) {
2768      Py_ssize_t kw_args;
2769      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2770      switch (pos_args) {
2771        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2772        case  0: break;
2773        default: goto __pyx_L5_argtuple_error;
2774      }
2775      kw_args = PyDict_Size(__pyx_kwds);
2776      switch (pos_args) {
2777        case  0:
2778        if (kw_args > 0) {
2779          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_linger);
2780          if (value) { values[0] = value; kw_args--; }
2781        }
2782      }
2783      if (unlikely(kw_args > 0)) {
2784        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "close") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2785      }
2786    } else {
2787      switch (PyTuple_GET_SIZE(__pyx_args)) {
2788        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2789        case  0: break;
2790        default: goto __pyx_L5_argtuple_error;
2791      }
2792    }
2793    __pyx_v_linger = values[0];
2794  }
2795  goto __pyx_L4_argument_unpacking_done;
2796  __pyx_L5_argtuple_error:;
2797  __Pyx_RaiseArgtupleInvalid("close", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
2798  __pyx_L3_error:;
2799  __Pyx_AddTraceback("zmq.backend.cython.socket.Socket.close", __pyx_clineno, __pyx_lineno, __pyx_filename);
2800  __Pyx_RefNannyFinishContext();
2801  return NULL;
2802  __pyx_L4_argument_unpacking_done:;
2803  __pyx_r = __pyx_pf_3zmq_7backend_6cython_6socket_6Socket_10close(((struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *)__pyx_v_self), __pyx_v_linger);
2804
2805  /* function exit code */
2806  __Pyx_RefNannyFinishContext();
2807  return __pyx_r;
2808}
2809
2810static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_10close(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, PyObject *__pyx_v_linger) {
2811  int __pyx_v_rc;
2812  int __pyx_v_linger_c;
2813  int __pyx_v_setlinger;
2814  PyObject *__pyx_r = NULL;
2815  __Pyx_RefNannyDeclarations
2816  int __pyx_t_1;
2817  int __pyx_t_2;
2818  int __pyx_t_3;
2819  PyObject *__pyx_t_4 = NULL;
2820  PyObject *__pyx_t_5 = NULL;
2821  PyObject *__pyx_t_6 = NULL;
2822  int __pyx_lineno = 0;
2823  const char *__pyx_filename = NULL;
2824  int __pyx_clineno = 0;
2825  __Pyx_RefNannySetupContext("close", 0);
2826
2827  /* "zmq/backend/cython/socket.pyx":263
2828 *         garbage collected.
2829 *         """
2830 *         cdef int rc=0             # <<<<<<<<<<<<<<
2831 *         cdef int linger_c
2832 *         cdef bint setlinger=False
2833 */
2834  __pyx_v_rc = 0;
2835
2836  /* "zmq/backend/cython/socket.pyx":265
2837 *         cdef int rc=0
2838 *         cdef int linger_c
2839 *         cdef bint setlinger=False             # <<<<<<<<<<<<<<
2840 *
2841 *         if linger is not None:
2842 */
2843  __pyx_v_setlinger = 0;
2844
2845  /* "zmq/backend/cython/socket.pyx":267
2846 *         cdef bint setlinger=False
2847 *
2848 *         if linger is not None:             # <<<<<<<<<<<<<<
2849 *             linger_c = linger
2850 *             setlinger=True
2851 */
2852  __pyx_t_1 = (__pyx_v_linger != Py_None);
2853  __pyx_t_2 = (__pyx_t_1 != 0);
2854  if (__pyx_t_2) {
2855
2856    /* "zmq/backend/cython/socket.pyx":268
2857 *
2858 *         if linger is not None:
2859 *             linger_c = linger             # <<<<<<<<<<<<<<
2860 *             setlinger=True
2861 *
2862 */
2863    __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_v_linger); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2864    __pyx_v_linger_c = __pyx_t_3;
2865
2866    /* "zmq/backend/cython/socket.pyx":269
2867 *         if linger is not None:
2868 *             linger_c = linger
2869 *             setlinger=True             # <<<<<<<<<<<<<<
2870 *
2871 *         if self.handle != NULL and not self._closed and getpid() == self._pid:
2872 */
2873    __pyx_v_setlinger = 1;
2874    goto __pyx_L3;
2875  }
2876  __pyx_L3:;
2877
2878  /* "zmq/backend/cython/socket.pyx":271
2879 *             setlinger=True
2880 *
2881 *         if self.handle != NULL and not self._closed and getpid() == self._pid:             # <<<<<<<<<<<<<<
2882 *             if setlinger:
2883 *                 zmq_setsockopt(self.handle, ZMQ_LINGER, &linger_c, sizeof(int))
2884 */
2885  __pyx_t_1 = ((__pyx_v_self->handle != NULL) != 0);
2886  if (__pyx_t_1) {
2887  } else {
2888    __pyx_t_2 = __pyx_t_1;
2889    goto __pyx_L5_bool_binop_done;
2890  }
2891  __pyx_t_1 = ((!(__pyx_v_self->_closed != 0)) != 0);
2892  if (__pyx_t_1) {
2893  } else {
2894    __pyx_t_2 = __pyx_t_1;
2895    goto __pyx_L5_bool_binop_done;
2896  }
2897  __pyx_t_1 = ((getpid() == __pyx_v_self->_pid) != 0);
2898  __pyx_t_2 = __pyx_t_1;
2899  __pyx_L5_bool_binop_done:;
2900  if (__pyx_t_2) {
2901
2902    /* "zmq/backend/cython/socket.pyx":272
2903 *
2904 *         if self.handle != NULL and not self._closed and getpid() == self._pid:
2905 *             if setlinger:             # <<<<<<<<<<<<<<
2906 *                 zmq_setsockopt(self.handle, ZMQ_LINGER, &linger_c, sizeof(int))
2907 *             rc = zmq_close(self.handle)
2908 */
2909    __pyx_t_2 = (__pyx_v_setlinger != 0);
2910    if (__pyx_t_2) {
2911
2912      /* "zmq/backend/cython/socket.pyx":273
2913 *         if self.handle != NULL and not self._closed and getpid() == self._pid:
2914 *             if setlinger:
2915 *                 zmq_setsockopt(self.handle, ZMQ_LINGER, &linger_c, sizeof(int))             # <<<<<<<<<<<<<<
2916 *             rc = zmq_close(self.handle)
2917 *             if rc != 0 and zmq_errno() != ENOTSOCK:
2918 */
2919      zmq_setsockopt(__pyx_v_self->handle, ZMQ_LINGER, (&__pyx_v_linger_c), (sizeof(int)));
2920      goto __pyx_L8;
2921    }
2922    __pyx_L8:;
2923
2924    /* "zmq/backend/cython/socket.pyx":274
2925 *             if setlinger:
2926 *                 zmq_setsockopt(self.handle, ZMQ_LINGER, &linger_c, sizeof(int))
2927 *             rc = zmq_close(self.handle)             # <<<<<<<<<<<<<<
2928 *             if rc != 0 and zmq_errno() != ENOTSOCK:
2929 *                 # ignore ENOTSOCK (closed by Context)
2930 */
2931    __pyx_v_rc = zmq_close(__pyx_v_self->handle);
2932
2933    /* "zmq/backend/cython/socket.pyx":275
2934 *                 zmq_setsockopt(self.handle, ZMQ_LINGER, &linger_c, sizeof(int))
2935 *             rc = zmq_close(self.handle)
2936 *             if rc != 0 and zmq_errno() != ENOTSOCK:             # <<<<<<<<<<<<<<
2937 *                 # ignore ENOTSOCK (closed by Context)
2938 *                 _check_rc(rc)
2939 */
2940    __pyx_t_1 = ((__pyx_v_rc != 0) != 0);
2941    if (__pyx_t_1) {
2942    } else {
2943      __pyx_t_2 = __pyx_t_1;
2944      goto __pyx_L10_bool_binop_done;
2945    }
2946    __pyx_t_4 = __Pyx_PyInt_From_int(zmq_errno()); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2947    __Pyx_GOTREF(__pyx_t_4);
2948    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_ENOTSOCK); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2949    __Pyx_GOTREF(__pyx_t_5);
2950    __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_NE); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2951    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2952    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2953    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2954    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2955    __pyx_t_2 = __pyx_t_1;
2956    __pyx_L10_bool_binop_done:;
2957    if (__pyx_t_2) {
2958
2959      /* "zmq/backend/cython/socket.pyx":277
2960 *             if rc != 0 and zmq_errno() != ENOTSOCK:
2961 *                 # ignore ENOTSOCK (closed by Context)
2962 *                 _check_rc(rc)             # <<<<<<<<<<<<<<
2963 *             self._closed = True
2964 *             # during gc, self.context might be NULL
2965 */
2966      __pyx_t_3 = __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(__pyx_v_rc); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2967      goto __pyx_L9;
2968    }
2969    __pyx_L9:;
2970
2971    /* "zmq/backend/cython/socket.pyx":278
2972 *                 # ignore ENOTSOCK (closed by Context)
2973 *                 _check_rc(rc)
2974 *             self._closed = True             # <<<<<<<<<<<<<<
2975 *             # during gc, self.context might be NULL
2976 *             if self.context:
2977 */
2978    __pyx_v_self->_closed = 1;
2979
2980    /* "zmq/backend/cython/socket.pyx":280
2981 *             self._closed = True
2982 *             # during gc, self.context might be NULL
2983 *             if self.context:             # <<<<<<<<<<<<<<
2984 *                 self.context._remove_socket(self.handle)
2985 *             self.handle = NULL
2986 */
2987    __pyx_t_2 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_self->context)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
2988    if (__pyx_t_2) {
2989
2990      /* "zmq/backend/cython/socket.pyx":281
2991 *             # during gc, self.context might be NULL
2992 *             if self.context:
2993 *                 self.context._remove_socket(self.handle)             # <<<<<<<<<<<<<<
2994 *             self.handle = NULL
2995 *
2996 */
2997      ((struct __pyx_vtabstruct_3zmq_7backend_6cython_7context_Context *)__pyx_v_self->context->__pyx_vtab)->_remove_socket(__pyx_v_self->context, __pyx_v_self->handle);
2998      goto __pyx_L12;
2999    }
3000    __pyx_L12:;
3001
3002    /* "zmq/backend/cython/socket.pyx":282
3003 *             if self.context:
3004 *                 self.context._remove_socket(self.handle)
3005 *             self.handle = NULL             # <<<<<<<<<<<<<<
3006 *
3007 *     def set(self, int option, optval):
3008 */
3009    __pyx_v_self->handle = NULL;
3010    goto __pyx_L4;
3011  }
3012  __pyx_L4:;
3013
3014  /* "zmq/backend/cython/socket.pyx":252
3015 *         return _check_closed_deep(self)
3016 *
3017 *     def close(self, linger=None):             # <<<<<<<<<<<<<<
3018 *         """s.close(linger=None)
3019 *
3020 */
3021
3022  /* function exit code */
3023  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3024  goto __pyx_L0;
3025  __pyx_L1_error:;
3026  __Pyx_XDECREF(__pyx_t_4);
3027  __Pyx_XDECREF(__pyx_t_5);
3028  __Pyx_XDECREF(__pyx_t_6);
3029  __Pyx_AddTraceback("zmq.backend.cython.socket.Socket.close", __pyx_clineno, __pyx_lineno, __pyx_filename);
3030  __pyx_r = NULL;
3031  __pyx_L0:;
3032  __Pyx_XGIVEREF(__pyx_r);
3033  __Pyx_RefNannyFinishContext();
3034  return __pyx_r;
3035}
3036
3037/* "zmq/backend/cython/socket.pyx":284
3038 *             self.handle = NULL
3039 *
3040 *     def set(self, int option, optval):             # <<<<<<<<<<<<<<
3041 *         """s.set(option, optval)
3042 *
3043 */
3044
3045/* Python wrapper */
3046static PyObject *__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_13set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3047static char __pyx_doc_3zmq_7backend_6cython_6socket_6Socket_12set[] = "s.set(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            \n                zmq.SUBSCRIBE, UNSUBSCRIBE, IDENTITY, HWM, LINGER, FD\n        \n        optval : int or bytes\n            The value of the option to set.\n        ";
3048static PyObject *__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_13set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3049  int __pyx_v_option;
3050  PyObject *__pyx_v_optval = 0;
3051  int __pyx_lineno = 0;
3052  const char *__pyx_filename = NULL;
3053  int __pyx_clineno = 0;
3054  PyObject *__pyx_r = 0;
3055  __Pyx_RefNannyDeclarations
3056  __Pyx_RefNannySetupContext("set (wrapper)", 0);
3057  {
3058    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_option,&__pyx_n_s_optval,0};
3059    PyObject* values[2] = {0,0};
3060    if (unlikely(__pyx_kwds)) {
3061      Py_ssize_t kw_args;
3062      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3063      switch (pos_args) {
3064        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3065        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3066        case  0: break;
3067        default: goto __pyx_L5_argtuple_error;
3068      }
3069      kw_args = PyDict_Size(__pyx_kwds);
3070      switch (pos_args) {
3071        case  0:
3072        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_option)) != 0)) kw_args--;
3073        else goto __pyx_L5_argtuple_error;
3074        case  1:
3075        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_optval)) != 0)) kw_args--;
3076        else {
3077          __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3078        }
3079      }
3080      if (unlikely(kw_args > 0)) {
3081        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3082      }
3083    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
3084      goto __pyx_L5_argtuple_error;
3085    } else {
3086      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3087      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3088    }
3089    __pyx_v_option = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_option == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3090    __pyx_v_optval = values[1];
3091  }
3092  goto __pyx_L4_argument_unpacking_done;
3093  __pyx_L5_argtuple_error:;
3094  __Pyx_RaiseArgtupleInvalid("set", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3095  __pyx_L3_error:;
3096  __Pyx_AddTraceback("zmq.backend.cython.socket.Socket.set", __pyx_clineno, __pyx_lineno, __pyx_filename);
3097  __Pyx_RefNannyFinishContext();
3098  return NULL;
3099  __pyx_L4_argument_unpacking_done:;
3100  __pyx_r = __pyx_pf_3zmq_7backend_6cython_6socket_6Socket_12set(((struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *)__pyx_v_self), __pyx_v_option, __pyx_v_optval);
3101
3102  /* function exit code */
3103  __Pyx_RefNannyFinishContext();
3104  return __pyx_r;
3105}
3106
3107static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_12set(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, int __pyx_v_option, PyObject *__pyx_v_optval) {
3108  pyzmq_int64_t __pyx_v_optval_int64_c;
3109  int __pyx_v_optval_int_c;
3110  int __pyx_v_rc;
3111  char *__pyx_v_optval_c;
3112  Py_ssize_t __pyx_v_sz;
3113  PyObject *__pyx_r = NULL;
3114  __Pyx_RefNannyDeclarations
3115  PyObject *__pyx_t_1 = NULL;
3116  int __pyx_t_2;
3117  int __pyx_t_3;
3118  PyObject *__pyx_t_4 = NULL;
3119  PyObject *__pyx_t_5 = NULL;
3120  char *__pyx_t_6;
3121  Py_ssize_t __pyx_t_7;
3122  pyzmq_int64_t __pyx_t_8;
3123  int __pyx_t_9;
3124  int __pyx_lineno = 0;
3125  const char *__pyx_filename = NULL;
3126  int __pyx_clineno = 0;
3127  __Pyx_RefNannySetupContext("set", 0);
3128
3129  /* "zmq/backend/cython/socket.pyx":308
3130 *         cdef Py_ssize_t sz
3131 *
3132 *         _check_closed(self)             # <<<<<<<<<<<<<<
3133 *         if isinstance(optval, unicode):
3134 *             raise TypeError("unicode not allowed, use setsockopt_string")
3135 */
3136  __pyx_t_1 = __pyx_f_3zmq_7backend_6cython_6socket__check_closed(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3137  __Pyx_GOTREF(__pyx_t_1);
3138  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3139
3140  /* "zmq/backend/cython/socket.pyx":309
3141 *
3142 *         _check_closed(self)
3143 *         if isinstance(optval, unicode):             # <<<<<<<<<<<<<<
3144 *             raise TypeError("unicode not allowed, use setsockopt_string")
3145 *
3146 */
3147  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_unicode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3148  __Pyx_GOTREF(__pyx_t_1);
3149  __pyx_t_2 = PyObject_IsInstance(__pyx_v_optval, __pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3150  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3151  __pyx_t_3 = (__pyx_t_2 != 0);
3152  if (__pyx_t_3) {
3153
3154    /* "zmq/backend/cython/socket.pyx":310
3155 *         _check_closed(self)
3156 *         if isinstance(optval, unicode):
3157 *             raise TypeError("unicode not allowed, use setsockopt_string")             # <<<<<<<<<<<<<<
3158 *
3159 *         if option in zmq.constants.bytes_sockopts:
3160 */
3161    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3162    __Pyx_GOTREF(__pyx_t_1);
3163    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
3164    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3165    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3166  }
3167
3168  /* "zmq/backend/cython/socket.pyx":312
3169 *             raise TypeError("unicode not allowed, use setsockopt_string")
3170 *
3171 *         if option in zmq.constants.bytes_sockopts:             # <<<<<<<<<<<<<<
3172 *             if not isinstance(optval, bytes):
3173 *                 raise TypeError('expected bytes, got: %r' % optval)
3174 */
3175  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_option); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3176  __Pyx_GOTREF(__pyx_t_1);
3177  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_zmq); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3178  __Pyx_GOTREF(__pyx_t_4);
3179  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_constants); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3180  __Pyx_GOTREF(__pyx_t_5);
3181  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3182  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_bytes_sockopts); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3183  __Pyx_GOTREF(__pyx_t_4);
3184  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3185  __pyx_t_3 = (__Pyx_PySequence_Contains(__pyx_t_1, __pyx_t_4, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3186  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3187  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3188  __pyx_t_2 = (__pyx_t_3 != 0);
3189  if (__pyx_t_2) {
3190
3191    /* "zmq/backend/cython/socket.pyx":313
3192 *
3193 *         if option in zmq.constants.bytes_sockopts:
3194 *             if not isinstance(optval, bytes):             # <<<<<<<<<<<<<<
3195 *                 raise TypeError('expected bytes, got: %r' % optval)
3196 *             optval_c = PyBytes_AsString(optval)
3197 */
3198    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_bytes); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3199    __Pyx_GOTREF(__pyx_t_4);
3200    __pyx_t_2 = PyObject_IsInstance(__pyx_v_optval, __pyx_t_4); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3201    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3202    __pyx_t_3 = ((!(__pyx_t_2 != 0)) != 0);
3203    if (__pyx_t_3) {
3204
3205      /* "zmq/backend/cython/socket.pyx":314
3206 *         if option in zmq.constants.bytes_sockopts:
3207 *             if not isinstance(optval, bytes):
3208 *                 raise TypeError('expected bytes, got: %r' % optval)             # <<<<<<<<<<<<<<
3209 *             optval_c = PyBytes_AsString(optval)
3210 *             sz = PyBytes_Size(optval)
3211 */
3212      __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_expected_bytes_got_r, __pyx_v_optval); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3213      __Pyx_GOTREF(__pyx_t_4);
3214      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3215      __Pyx_GOTREF(__pyx_t_1);
3216      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
3217      __Pyx_GIVEREF(__pyx_t_4);
3218      __pyx_t_4 = 0;
3219      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3220      __Pyx_GOTREF(__pyx_t_4);
3221      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3222      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
3223      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3224      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3225    }
3226
3227    /* "zmq/backend/cython/socket.pyx":315
3228 *             if not isinstance(optval, bytes):
3229 *                 raise TypeError('expected bytes, got: %r' % optval)
3230 *             optval_c = PyBytes_AsString(optval)             # <<<<<<<<<<<<<<
3231 *             sz = PyBytes_Size(optval)
3232 *             rc = zmq_setsockopt(
3233 */
3234    __pyx_t_6 = PyBytes_AsString(__pyx_v_optval); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3235    __pyx_v_optval_c = __pyx_t_6;
3236
3237    /* "zmq/backend/cython/socket.pyx":316
3238 *                 raise TypeError('expected bytes, got: %r' % optval)
3239 *             optval_c = PyBytes_AsString(optval)
3240 *             sz = PyBytes_Size(optval)             # <<<<<<<<<<<<<<
3241 *             rc = zmq_setsockopt(
3242 *                     self.handle, option,
3243 */
3244    __pyx_t_7 = PyBytes_Size(__pyx_v_optval); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3245    __pyx_v_sz = __pyx_t_7;
3246
3247    /* "zmq/backend/cython/socket.pyx":317
3248 *             optval_c = PyBytes_AsString(optval)
3249 *             sz = PyBytes_Size(optval)
3250 *             rc = zmq_setsockopt(             # <<<<<<<<<<<<<<
3251 *                     self.handle, option,
3252 *                     optval_c, sz
3253 */
3254    __pyx_v_rc = zmq_setsockopt(__pyx_v_self->handle, __pyx_v_option, __pyx_v_optval_c, __pyx_v_sz);
3255    goto __pyx_L4;
3256  }
3257
3258  /* "zmq/backend/cython/socket.pyx":321
3259 *                     optval_c, sz
3260 *                 )
3261 *         elif option in zmq.constants.int64_sockopts:             # <<<<<<<<<<<<<<
3262 *             if not isinstance(optval, int):
3263 *                 raise TypeError('expected int, got: %r' % optval)
3264 */
3265  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_option); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3266  __Pyx_GOTREF(__pyx_t_4);
3267  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_zmq); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3268  __Pyx_GOTREF(__pyx_t_1);
3269  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_constants); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3270  __Pyx_GOTREF(__pyx_t_5);
3271  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3272  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_int64_sockopts); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3273  __Pyx_GOTREF(__pyx_t_1);
3274  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3275  __pyx_t_3 = (__Pyx_PySequence_Contains(__pyx_t_4, __pyx_t_1, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3276  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3277  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3278  __pyx_t_2 = (__pyx_t_3 != 0);
3279  if (__pyx_t_2) {
3280
3281    /* "zmq/backend/cython/socket.pyx":322
3282 *                 )
3283 *         elif option in zmq.constants.int64_sockopts:
3284 *             if not isinstance(optval, int):             # <<<<<<<<<<<<<<
3285 *                 raise TypeError('expected int, got: %r' % optval)
3286 *             optval_int64_c = optval
3287 */
3288    __pyx_t_2 = PyInt_Check(__pyx_v_optval);
3289    __pyx_t_3 = ((!(__pyx_t_2 != 0)) != 0);
3290    if (__pyx_t_3) {
3291
3292      /* "zmq/backend/cython/socket.pyx":323
3293 *         elif option in zmq.constants.int64_sockopts:
3294 *             if not isinstance(optval, int):
3295 *                 raise TypeError('expected int, got: %r' % optval)             # <<<<<<<<<<<<<<
3296 *             optval_int64_c = optval
3297 *             rc = zmq_setsockopt(
3298 */
3299      __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_expected_int_got_r, __pyx_v_optval); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3300      __Pyx_GOTREF(__pyx_t_1);
3301      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3302      __Pyx_GOTREF(__pyx_t_4);
3303      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
3304      __Pyx_GIVEREF(__pyx_t_1);
3305      __pyx_t_1 = 0;
3306      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3307      __Pyx_GOTREF(__pyx_t_1);
3308      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3309      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
3310      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3311      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3312    }
3313
3314    /* "zmq/backend/cython/socket.pyx":324
3315 *             if not isinstance(optval, int):
3316 *                 raise TypeError('expected int, got: %r' % optval)
3317 *             optval_int64_c = optval             # <<<<<<<<<<<<<<
3318 *             rc = zmq_setsockopt(
3319 *                     self.handle, option,
3320 */
3321    __pyx_t_8 = __Pyx_PyInt_As_pyzmq_int64_t(__pyx_v_optval); if (unlikely((__pyx_t_8 == (pyzmq_int64_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3322    __pyx_v_optval_int64_c = __pyx_t_8;
3323
3324    /* "zmq/backend/cython/socket.pyx":325
3325 *                 raise TypeError('expected int, got: %r' % optval)
3326 *             optval_int64_c = optval
3327 *             rc = zmq_setsockopt(             # <<<<<<<<<<<<<<
3328 *                     self.handle, option,
3329 *                     &optval_int64_c, sizeof(int64_t)
3330 */
3331    __pyx_v_rc = zmq_setsockopt(__pyx_v_self->handle, __pyx_v_option, (&__pyx_v_optval_int64_c), (sizeof(pyzmq_int64_t)));
3332    goto __pyx_L4;
3333  }
3334  /*else*/ {
3335
3336    /* "zmq/backend/cython/socket.pyx":335
3337 *             # sockopts will still raise just the same, but it will be libzmq doing
3338 *             # the raising.
3339 *             if not isinstance(optval, int):             # <<<<<<<<<<<<<<
3340 *                 raise TypeError('expected int, got: %r' % optval)
3341 *             optval_int_c = optval
3342 */
3343    __pyx_t_3 = PyInt_Check(__pyx_v_optval);
3344    __pyx_t_2 = ((!(__pyx_t_3 != 0)) != 0);
3345    if (__pyx_t_2) {
3346
3347      /* "zmq/backend/cython/socket.pyx":336
3348 *             # the raising.
3349 *             if not isinstance(optval, int):
3350 *                 raise TypeError('expected int, got: %r' % optval)             # <<<<<<<<<<<<<<
3351 *             optval_int_c = optval
3352 *             rc = zmq_setsockopt(
3353 */
3354      __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_expected_int_got_r, __pyx_v_optval); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3355      __Pyx_GOTREF(__pyx_t_1);
3356      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3357      __Pyx_GOTREF(__pyx_t_4);
3358      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
3359      __Pyx_GIVEREF(__pyx_t_1);
3360      __pyx_t_1 = 0;
3361      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3362      __Pyx_GOTREF(__pyx_t_1);
3363      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3364      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
3365      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3366      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3367    }
3368
3369    /* "zmq/backend/cython/socket.pyx":337
3370 *             if not isinstance(optval, int):
3371 *                 raise TypeError('expected int, got: %r' % optval)
3372 *             optval_int_c = optval             # <<<<<<<<<<<<<<
3373 *             rc = zmq_setsockopt(
3374 *                     self.handle, option,
3375 */
3376    __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_v_optval); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3377    __pyx_v_optval_int_c = __pyx_t_9;
3378
3379    /* "zmq/backend/cython/socket.pyx":338
3380 *                 raise TypeError('expected int, got: %r' % optval)
3381 *             optval_int_c = optval
3382 *             rc = zmq_setsockopt(             # <<<<<<<<<<<<<<
3383 *                     self.handle, option,
3384 *                     &optval_int_c, sizeof(int)
3385 */
3386    __pyx_v_rc = zmq_setsockopt(__pyx_v_self->handle, __pyx_v_option, (&__pyx_v_optval_int_c), (sizeof(int)));
3387  }
3388  __pyx_L4:;
3389
3390  /* "zmq/backend/cython/socket.pyx":343
3391 *                 )
3392 *
3393 *         _check_rc(rc)             # <<<<<<<<<<<<<<
3394 *
3395 *     def get(self, int option):
3396 */
3397  __pyx_t_9 = __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(__pyx_v_rc); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3398
3399  /* "zmq/backend/cython/socket.pyx":284
3400 *             self.handle = NULL
3401 *
3402 *     def set(self, int option, optval):             # <<<<<<<<<<<<<<
3403 *         """s.set(option, optval)
3404 *
3405 */
3406
3407  /* function exit code */
3408  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3409  goto __pyx_L0;
3410  __pyx_L1_error:;
3411  __Pyx_XDECREF(__pyx_t_1);
3412  __Pyx_XDECREF(__pyx_t_4);
3413  __Pyx_XDECREF(__pyx_t_5);
3414  __Pyx_AddTraceback("zmq.backend.cython.socket.Socket.set", __pyx_clineno, __pyx_lineno, __pyx_filename);
3415  __pyx_r = NULL;
3416  __pyx_L0:;
3417  __Pyx_XGIVEREF(__pyx_r);
3418  __Pyx_RefNannyFinishContext();
3419  return __pyx_r;
3420}
3421
3422/* "zmq/backend/cython/socket.pyx":345
3423 *         _check_rc(rc)
3424 *
3425 *     def get(self, int option):             # <<<<<<<<<<<<<<
3426 *         """s.get(option)
3427 *
3428 */
3429
3430/* Python wrapper */
3431static PyObject *__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_15get(PyObject *__pyx_v_self, PyObject *__pyx_arg_option); /*proto*/
3432static char __pyx_doc_3zmq_7backend_6cython_6socket_6Socket_14get[] = "s.get(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            \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        ";
3433static PyObject *__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_15get(PyObject *__pyx_v_self, PyObject *__pyx_arg_option) {
3434  int __pyx_v_option;
3435  int __pyx_lineno = 0;
3436  const char *__pyx_filename = NULL;
3437  int __pyx_clineno = 0;
3438  PyObject *__pyx_r = 0;
3439  __Pyx_RefNannyDeclarations
3440  __Pyx_RefNannySetupContext("get (wrapper)", 0);
3441  assert(__pyx_arg_option); {
3442    __pyx_v_option = __Pyx_PyInt_As_int(__pyx_arg_option); if (unlikely((__pyx_v_option == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
3443  }
3444  goto __pyx_L4_argument_unpacking_done;
3445  __pyx_L3_error:;
3446  __Pyx_AddTraceback("zmq.backend.cython.socket.Socket.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
3447  __Pyx_RefNannyFinishContext();
3448  return NULL;
3449  __pyx_L4_argument_unpacking_done:;
3450  __pyx_r = __pyx_pf_3zmq_7backend_6cython_6socket_6Socket_14get(((struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *)__pyx_v_self), ((int)__pyx_v_option));
3451
3452  /* function exit code */
3453  __Pyx_RefNannyFinishContext();
3454  return __pyx_r;
3455}
3456
3457static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_14get(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, int __pyx_v_option) {
3458  pyzmq_int64_t __pyx_v_optval_int64_c;
3459  int __pyx_v_optval_int_c;
3460  ZMQ_FD_T __pyx_v_optval_fd_c;
3461  char __pyx_v_identity_str_c[255];
3462  size_t __pyx_v_sz;
3463  int __pyx_v_rc;
3464  PyObject *__pyx_v_result = NULL;
3465  PyObject *__pyx_r = NULL;
3466  __Pyx_RefNannyDeclarations
3467  PyObject *__pyx_t_1 = NULL;
3468  PyObject *__pyx_t_2 = NULL;
3469  PyObject *__pyx_t_3 = NULL;
3470  int __pyx_t_4;
3471  int __pyx_t_5;
3472  int __pyx_t_6;
3473  int __pyx_lineno = 0;
3474  const char *__pyx_filename = NULL;
3475  int __pyx_clineno = 0;
3476  __Pyx_RefNannySetupContext("get", 0);
3477
3478  /* "zmq/backend/cython/socket.pyx":372
3479 *         cdef int rc
3480 *
3481 *         _check_closed(self)             # <<<<<<<<<<<<<<
3482 *
3483 *         if option in zmq.constants.bytes_sockopts:
3484 */
3485  __pyx_t_1 = __pyx_f_3zmq_7backend_6cython_6socket__check_closed(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3486  __Pyx_GOTREF(__pyx_t_1);
3487  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3488
3489  /* "zmq/backend/cython/socket.pyx":374
3490 *         _check_closed(self)
3491 *
3492 *         if option in zmq.constants.bytes_sockopts:             # <<<<<<<<<<<<<<
3493 *             sz = 255
3494 *             rc = zmq_getsockopt(self.handle, option, <void *>identity_str_c, &sz)
3495 */
3496  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_option); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3497  __Pyx_GOTREF(__pyx_t_1);
3498  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_zmq); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3499  __Pyx_GOTREF(__pyx_t_2);
3500  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_constants); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3501  __Pyx_GOTREF(__pyx_t_3);
3502  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3503  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_bytes_sockopts); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3504  __Pyx_GOTREF(__pyx_t_2);
3505  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3506  __pyx_t_4 = (__Pyx_PySequence_Contains(__pyx_t_1, __pyx_t_2, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3507  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3508  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3509  __pyx_t_5 = (__pyx_t_4 != 0);
3510  if (__pyx_t_5) {
3511
3512    /* "zmq/backend/cython/socket.pyx":375
3513 *
3514 *         if option in zmq.constants.bytes_sockopts:
3515 *             sz = 255             # <<<<<<<<<<<<<<
3516 *             rc = zmq_getsockopt(self.handle, option, <void *>identity_str_c, &sz)
3517 *             _check_rc(rc)
3518 */
3519    __pyx_v_sz = 255;
3520
3521    /* "zmq/backend/cython/socket.pyx":376
3522 *         if option in zmq.constants.bytes_sockopts:
3523 *             sz = 255
3524 *             rc = zmq_getsockopt(self.handle, option, <void *>identity_str_c, &sz)             # <<<<<<<<<<<<<<
3525 *             _check_rc(rc)
3526 *             # strip null-terminated strings *except* identity
3527 */
3528    __pyx_v_rc = zmq_getsockopt(__pyx_v_self->handle, __pyx_v_option, ((void *)__pyx_v_identity_str_c), (&__pyx_v_sz));
3529
3530    /* "zmq/backend/cython/socket.pyx":377
3531 *             sz = 255
3532 *             rc = zmq_getsockopt(self.handle, option, <void *>identity_str_c, &sz)
3533 *             _check_rc(rc)             # <<<<<<<<<<<<<<
3534 *             # strip null-terminated strings *except* identity
3535 *             if option != ZMQ_IDENTITY and sz > 0 and (<char *>identity_str_c)[sz-1] == b'\0':
3536 */
3537    __pyx_t_6 = __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(__pyx_v_rc); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3538
3539    /* "zmq/backend/cython/socket.pyx":379
3540 *             _check_rc(rc)
3541 *             # strip null-terminated strings *except* identity
3542 *             if option != ZMQ_IDENTITY and sz > 0 and (<char *>identity_str_c)[sz-1] == b'\0':             # <<<<<<<<<<<<<<
3543 *                 sz -= 1
3544 *             result = PyBytes_FromStringAndSize(<char *>identity_str_c, sz)
3545 */
3546    __pyx_t_4 = ((__pyx_v_option != ZMQ_IDENTITY) != 0);
3547    if (__pyx_t_4) {
3548    } else {
3549      __pyx_t_5 = __pyx_t_4;
3550      goto __pyx_L5_bool_binop_done;
3551    }
3552    __pyx_t_4 = ((__pyx_v_sz > 0) != 0);
3553    if (__pyx_t_4) {
3554    } else {
3555      __pyx_t_5 = __pyx_t_4;
3556      goto __pyx_L5_bool_binop_done;
3557    }
3558    __pyx_t_4 = (((((char *)__pyx_v_identity_str_c)[(__pyx_v_sz - 1)]) == '\x00') != 0);
3559    __pyx_t_5 = __pyx_t_4;
3560    __pyx_L5_bool_binop_done:;
3561    if (__pyx_t_5) {
3562
3563      /* "zmq/backend/cython/socket.pyx":380
3564 *             # strip null-terminated strings *except* identity
3565 *             if option != ZMQ_IDENTITY and sz > 0 and (<char *>identity_str_c)[sz-1] == b'\0':
3566 *                 sz -= 1             # <<<<<<<<<<<<<<
3567 *             result = PyBytes_FromStringAndSize(<char *>identity_str_c, sz)
3568 *         elif option in zmq.constants.int64_sockopts:
3569 */
3570      __pyx_v_sz = (__pyx_v_sz - 1);
3571      goto __pyx_L4;
3572    }
3573    __pyx_L4:;
3574
3575    /* "zmq/backend/cython/socket.pyx":381
3576 *             if option != ZMQ_IDENTITY and sz > 0 and (<char *>identity_str_c)[sz-1] == b'\0':
3577 *                 sz -= 1
3578 *             result = PyBytes_FromStringAndSize(<char *>identity_str_c, sz)             # <<<<<<<<<<<<<<
3579 *         elif option in zmq.constants.int64_sockopts:
3580 *             sz = sizeof(int64_t)
3581 */
3582    __pyx_t_2 = PyBytes_FromStringAndSize(((char *)__pyx_v_identity_str_c), __pyx_v_sz); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3583    __Pyx_GOTREF(__pyx_t_2);
3584    __pyx_v_result = __pyx_t_2;
3585    __pyx_t_2 = 0;
3586    goto __pyx_L3;
3587  }
3588
3589  /* "zmq/backend/cython/socket.pyx":382
3590 *                 sz -= 1
3591 *             result = PyBytes_FromStringAndSize(<char *>identity_str_c, sz)
3592 *         elif option in zmq.constants.int64_sockopts:             # <<<<<<<<<<<<<<
3593 *             sz = sizeof(int64_t)
3594 *             rc = zmq_getsockopt(self.handle, option, <void *>&optval_int64_c, &sz)
3595 */
3596  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_option); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3597  __Pyx_GOTREF(__pyx_t_2);
3598  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_zmq); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3599  __Pyx_GOTREF(__pyx_t_1);
3600  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_constants); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3601  __Pyx_GOTREF(__pyx_t_3);
3602  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3603  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_int64_sockopts); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3604  __Pyx_GOTREF(__pyx_t_1);
3605  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3606  __pyx_t_5 = (__Pyx_PySequence_Contains(__pyx_t_2, __pyx_t_1, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3607  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3608  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3609  __pyx_t_4 = (__pyx_t_5 != 0);
3610  if (__pyx_t_4) {
3611
3612    /* "zmq/backend/cython/socket.pyx":383
3613 *             result = PyBytes_FromStringAndSize(<char *>identity_str_c, sz)
3614 *         elif option in zmq.constants.int64_sockopts:
3615 *             sz = sizeof(int64_t)             # <<<<<<<<<<<<<<
3616 *             rc = zmq_getsockopt(self.handle, option, <void *>&optval_int64_c, &sz)
3617 *             _check_rc(rc)
3618 */
3619    __pyx_v_sz = (sizeof(pyzmq_int64_t));
3620
3621    /* "zmq/backend/cython/socket.pyx":384
3622 *         elif option in zmq.constants.int64_sockopts:
3623 *             sz = sizeof(int64_t)
3624 *             rc = zmq_getsockopt(self.handle, option, <void *>&optval_int64_c, &sz)             # <<<<<<<<<<<<<<
3625 *             _check_rc(rc)
3626 *             result = optval_int64_c
3627 */
3628    __pyx_v_rc = zmq_getsockopt(__pyx_v_self->handle, __pyx_v_option, ((void *)(&__pyx_v_optval_int64_c)), (&__pyx_v_sz));
3629
3630    /* "zmq/backend/cython/socket.pyx":385
3631 *             sz = sizeof(int64_t)
3632 *             rc = zmq_getsockopt(self.handle, option, <void *>&optval_int64_c, &sz)
3633 *             _check_rc(rc)             # <<<<<<<<<<<<<<
3634 *             result = optval_int64_c
3635 *         elif option in zmq.constants.fd_sockopts:
3636 */
3637    __pyx_t_6 = __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(__pyx_v_rc); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3638
3639    /* "zmq/backend/cython/socket.pyx":386
3640 *             rc = zmq_getsockopt(self.handle, option, <void *>&optval_int64_c, &sz)
3641 *             _check_rc(rc)
3642 *             result = optval_int64_c             # <<<<<<<<<<<<<<
3643 *         elif option in zmq.constants.fd_sockopts:
3644 *             sz = sizeof(fd_t)
3645 */
3646    __pyx_t_1 = __Pyx_PyInt_From_pyzmq_int64_t(__pyx_v_optval_int64_c); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3647    __Pyx_GOTREF(__pyx_t_1);
3648    __pyx_v_result = __pyx_t_1;
3649    __pyx_t_1 = 0;
3650    goto __pyx_L3;
3651  }
3652
3653  /* "zmq/backend/cython/socket.pyx":387
3654 *             _check_rc(rc)
3655 *             result = optval_int64_c
3656 *         elif option in zmq.constants.fd_sockopts:             # <<<<<<<<<<<<<<
3657 *             sz = sizeof(fd_t)
3658 *             rc = zmq_getsockopt(self.handle, option, <void *>&optval_fd_c, &sz)
3659 */
3660  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_option); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3661  __Pyx_GOTREF(__pyx_t_1);
3662  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_zmq); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3663  __Pyx_GOTREF(__pyx_t_2);
3664  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_constants); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3665  __Pyx_GOTREF(__pyx_t_3);
3666  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3667  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_fd_sockopts); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3668  __Pyx_GOTREF(__pyx_t_2);
3669  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3670  __pyx_t_4 = (__Pyx_PySequence_Contains(__pyx_t_1, __pyx_t_2, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3671  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3672  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3673  __pyx_t_5 = (__pyx_t_4 != 0);
3674  if (__pyx_t_5) {
3675
3676    /* "zmq/backend/cython/socket.pyx":388
3677 *             result = optval_int64_c
3678 *         elif option in zmq.constants.fd_sockopts:
3679 *             sz = sizeof(fd_t)             # <<<<<<<<<<<<<<
3680 *             rc = zmq_getsockopt(self.handle, option, <void *>&optval_fd_c, &sz)
3681 *             _check_rc(rc)
3682 */
3683    __pyx_v_sz = (sizeof(ZMQ_FD_T));
3684
3685    /* "zmq/backend/cython/socket.pyx":389
3686 *         elif option in zmq.constants.fd_sockopts:
3687 *             sz = sizeof(fd_t)
3688 *             rc = zmq_getsockopt(self.handle, option, <void *>&optval_fd_c, &sz)             # <<<<<<<<<<<<<<
3689 *             _check_rc(rc)
3690 *             result = optval_fd_c
3691 */
3692    __pyx_v_rc = zmq_getsockopt(__pyx_v_self->handle, __pyx_v_option, ((void *)(&__pyx_v_optval_fd_c)), (&__pyx_v_sz));
3693
3694    /* "zmq/backend/cython/socket.pyx":390
3695 *             sz = sizeof(fd_t)
3696 *             rc = zmq_getsockopt(self.handle, option, <void *>&optval_fd_c, &sz)
3697 *             _check_rc(rc)             # <<<<<<<<<<<<<<
3698 *             result = optval_fd_c
3699 *         else:
3700 */
3701    __pyx_t_6 = __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(__pyx_v_rc); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3702
3703    /* "zmq/backend/cython/socket.pyx":391
3704 *             rc = zmq_getsockopt(self.handle, option, <void *>&optval_fd_c, &sz)
3705 *             _check_rc(rc)
3706 *             result = optval_fd_c             # <<<<<<<<<<<<<<
3707 *         else:
3708 *             # default is to assume int, which is what most new sockopts will be
3709 */
3710    __pyx_t_2 = __Pyx_PyInt_From_ZMQ_FD_T(__pyx_v_optval_fd_c); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3711    __Pyx_GOTREF(__pyx_t_2);
3712    __pyx_v_result = __pyx_t_2;
3713    __pyx_t_2 = 0;
3714    goto __pyx_L3;
3715  }
3716  /*else*/ {
3717
3718    /* "zmq/backend/cython/socket.pyx":398
3719 *             # sockopts will still raise just the same, but it will be libzmq doing
3720 *             # the raising.
3721 *             sz = sizeof(int)             # <<<<<<<<<<<<<<
3722 *             rc = zmq_getsockopt(self.handle, option, <void *>&optval_int_c, &sz)
3723 *             _check_rc(rc)
3724 */
3725    __pyx_v_sz = (sizeof(int));
3726
3727    /* "zmq/backend/cython/socket.pyx":399
3728 *             # the raising.
3729 *             sz = sizeof(int)
3730 *             rc = zmq_getsockopt(self.handle, option, <void *>&optval_int_c, &sz)             # <<<<<<<<<<<<<<
3731 *             _check_rc(rc)
3732 *             result = optval_int_c
3733 */
3734    __pyx_v_rc = zmq_getsockopt(__pyx_v_self->handle, __pyx_v_option, ((void *)(&__pyx_v_optval_int_c)), (&__pyx_v_sz));
3735
3736    /* "zmq/backend/cython/socket.pyx":400
3737 *             sz = sizeof(int)
3738 *             rc = zmq_getsockopt(self.handle, option, <void *>&optval_int_c, &sz)
3739 *             _check_rc(rc)             # <<<<<<<<<<<<<<
3740 *             result = optval_int_c
3741 *
3742 */
3743    __pyx_t_6 = __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(__pyx_v_rc); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3744
3745    /* "zmq/backend/cython/socket.pyx":401
3746 *             rc = zmq_getsockopt(self.handle, option, <void *>&optval_int_c, &sz)
3747 *             _check_rc(rc)
3748 *             result = optval_int_c             # <<<<<<<<<<<<<<
3749 *
3750 *         return result
3751 */
3752    __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_optval_int_c); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3753    __Pyx_GOTREF(__pyx_t_2);
3754    __pyx_v_result = __pyx_t_2;
3755    __pyx_t_2 = 0;
3756  }
3757  __pyx_L3:;
3758
3759  /* "zmq/backend/cython/socket.pyx":403
3760 *             result = optval_int_c
3761 *
3762 *         return result             # <<<<<<<<<<<<<<
3763 *
3764 *     def bind(self, addr):
3765 */
3766  __Pyx_XDECREF(__pyx_r);
3767  __Pyx_INCREF(__pyx_v_result);
3768  __pyx_r = __pyx_v_result;
3769  goto __pyx_L0;
3770
3771  /* "zmq/backend/cython/socket.pyx":345
3772 *         _check_rc(rc)
3773 *
3774 *     def get(self, int option):             # <<<<<<<<<<<<<<
3775 *         """s.get(option)
3776 *
3777 */
3778
3779  /* function exit code */
3780  __pyx_L1_error:;
3781  __Pyx_XDECREF(__pyx_t_1);
3782  __Pyx_XDECREF(__pyx_t_2);
3783  __Pyx_XDECREF(__pyx_t_3);
3784  __Pyx_AddTraceback("zmq.backend.cython.socket.Socket.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
3785  __pyx_r = NULL;
3786  __pyx_L0:;
3787  __Pyx_XDECREF(__pyx_v_result);
3788  __Pyx_XGIVEREF(__pyx_r);
3789  __Pyx_RefNannyFinishContext();
3790  return __pyx_r;
3791}
3792
3793/* "zmq/backend/cython/socket.pyx":405
3794 *         return result
3795 *
3796 *     def bind(self, addr):             # <<<<<<<<<<<<<<
3797 *         """s.bind(addr)
3798 *
3799 */
3800
3801/* Python wrapper */
3802static PyObject *__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_17bind(PyObject *__pyx_v_self, PyObject *__pyx_v_addr); /*proto*/
3803static char __pyx_doc_3zmq_7backend_6cython_6socket_6Socket_16bind[] = "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 include\n            tcp, udp, pgm, epgm, inproc and ipc. If the address is unicode, it is\n            encoded to utf-8 first.\n        ";
3804static PyObject *__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_17bind(PyObject *__pyx_v_self, PyObject *__pyx_v_addr) {
3805  PyObject *__pyx_r = 0;
3806  __Pyx_RefNannyDeclarations
3807  __Pyx_RefNannySetupContext("bind (wrapper)", 0);
3808  __pyx_r = __pyx_pf_3zmq_7backend_6cython_6socket_6Socket_16bind(((struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *)__pyx_v_self), ((PyObject *)__pyx_v_addr));
3809
3810  /* function exit code */
3811  __Pyx_RefNannyFinishContext();
3812  return __pyx_r;
3813}
3814
3815static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_16bind(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, PyObject *__pyx_v_addr) {
3816  int __pyx_v_rc;
3817  char *__pyx_v_c_addr;
3818  PyObject *__pyx_v_path = NULL;
3819  PyObject *__pyx_v_msg = NULL;
3820  PyObject *__pyx_r = NULL;
3821  __Pyx_RefNannyDeclarations
3822  PyObject *__pyx_t_1 = NULL;
3823  int __pyx_t_2;
3824  int __pyx_t_3;
3825  PyObject *__pyx_t_4 = NULL;
3826  char *__pyx_t_5;
3827  PyObject *__pyx_t_6 = NULL;
3828  PyObject *__pyx_t_7 = NULL;
3829  Py_ssize_t __pyx_t_8;
3830  PyObject *__pyx_t_9 = NULL;
3831  int __pyx_t_10;
3832  int __pyx_lineno = 0;
3833  const char *__pyx_filename = NULL;
3834  int __pyx_clineno = 0;
3835  __Pyx_RefNannySetupContext("bind", 0);
3836  __Pyx_INCREF(__pyx_v_addr);
3837
3838  /* "zmq/backend/cython/socket.pyx":425
3839 *         cdef char* c_addr
3840 *
3841 *         _check_closed(self)             # <<<<<<<<<<<<<<
3842 *         if isinstance(addr, unicode):
3843 *             addr = addr.encode('utf-8')
3844 */
3845  __pyx_t_1 = __pyx_f_3zmq_7backend_6cython_6socket__check_closed(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3846  __Pyx_GOTREF(__pyx_t_1);
3847  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3848
3849  /* "zmq/backend/cython/socket.pyx":426
3850 *
3851 *         _check_closed(self)
3852 *         if isinstance(addr, unicode):             # <<<<<<<<<<<<<<
3853 *             addr = addr.encode('utf-8')
3854 *         if not isinstance(addr, bytes):
3855 */
3856  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_unicode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3857  __Pyx_GOTREF(__pyx_t_1);
3858  __pyx_t_2 = PyObject_IsInstance(__pyx_v_addr, __pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3859  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3860  __pyx_t_3 = (__pyx_t_2 != 0);
3861  if (__pyx_t_3) {
3862
3863    /* "zmq/backend/cython/socket.pyx":427
3864 *         _check_closed(self)
3865 *         if isinstance(addr, unicode):
3866 *             addr = addr.encode('utf-8')             # <<<<<<<<<<<<<<
3867 *         if not isinstance(addr, bytes):
3868 *             raise TypeError('expected str, got: %r' % addr)
3869 */
3870    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_addr, __pyx_n_s_encode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3871    __Pyx_GOTREF(__pyx_t_1);
3872    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3873    __Pyx_GOTREF(__pyx_t_4);
3874    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3875    __Pyx_DECREF_SET(__pyx_v_addr, __pyx_t_4);
3876    __pyx_t_4 = 0;
3877    goto __pyx_L3;
3878  }
3879  __pyx_L3:;
3880
3881  /* "zmq/backend/cython/socket.pyx":428
3882 *         if isinstance(addr, unicode):
3883 *             addr = addr.encode('utf-8')
3884 *         if not isinstance(addr, bytes):             # <<<<<<<<<<<<<<
3885 *             raise TypeError('expected str, got: %r' % addr)
3886 *         c_addr = addr
3887 */
3888  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_bytes); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3889  __Pyx_GOTREF(__pyx_t_4);
3890  __pyx_t_3 = PyObject_IsInstance(__pyx_v_addr, __pyx_t_4); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3891  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3892  __pyx_t_2 = ((!(__pyx_t_3 != 0)) != 0);
3893  if (__pyx_t_2) {
3894
3895    /* "zmq/backend/cython/socket.pyx":429
3896 *             addr = addr.encode('utf-8')
3897 *         if not isinstance(addr, bytes):
3898 *             raise TypeError('expected str, got: %r' % addr)             # <<<<<<<<<<<<<<
3899 *         c_addr = addr
3900 *         rc = zmq_bind(self.handle, c_addr)
3901 */
3902    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_expected_str_got_r, __pyx_v_addr); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3903    __Pyx_GOTREF(__pyx_t_4);
3904    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3905    __Pyx_GOTREF(__pyx_t_1);
3906    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
3907    __Pyx_GIVEREF(__pyx_t_4);
3908    __pyx_t_4 = 0;
3909    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3910    __Pyx_GOTREF(__pyx_t_4);
3911    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3912    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
3913    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3914    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3915  }
3916
3917  /* "zmq/backend/cython/socket.pyx":430
3918 *         if not isinstance(addr, bytes):
3919 *             raise TypeError('expected str, got: %r' % addr)
3920 *         c_addr = addr             # <<<<<<<<<<<<<<
3921 *         rc = zmq_bind(self.handle, c_addr)
3922 *         if rc != 0:
3923 */
3924  __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_addr); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3925  __pyx_v_c_addr = __pyx_t_5;
3926
3927  /* "zmq/backend/cython/socket.pyx":431
3928 *             raise TypeError('expected str, got: %r' % addr)
3929 *         c_addr = addr
3930 *         rc = zmq_bind(self.handle, c_addr)             # <<<<<<<<<<<<<<
3931 *         if rc != 0:
3932 *             if IPC_PATH_MAX_LEN and zmq_errno() == ENAMETOOLONG:
3933 */
3934  __pyx_v_rc = zmq_bind(__pyx_v_self->handle, __pyx_v_c_addr);
3935
3936  /* "zmq/backend/cython/socket.pyx":432
3937 *         c_addr = addr
3938 *         rc = zmq_bind(self.handle, c_addr)
3939 *         if rc != 0:             # <<<<<<<<<<<<<<
3940 *             if IPC_PATH_MAX_LEN and zmq_errno() == ENAMETOOLONG:
3941 *                 # py3compat: addr is bytes, but msg wants str
3942 */
3943  __pyx_t_2 = ((__pyx_v_rc != 0) != 0);
3944  if (__pyx_t_2) {
3945
3946    /* "zmq/backend/cython/socket.pyx":433
3947 *         rc = zmq_bind(self.handle, c_addr)
3948 *         if rc != 0:
3949 *             if IPC_PATH_MAX_LEN and zmq_errno() == ENAMETOOLONG:             # <<<<<<<<<<<<<<
3950 *                 # py3compat: addr is bytes, but msg wants str
3951 *                 if str is unicode:
3952 */
3953    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_IPC_PATH_MAX_LEN); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3954    __Pyx_GOTREF(__pyx_t_4);
3955    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3956    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3957    if (__pyx_t_3) {
3958    } else {
3959      __pyx_t_2 = __pyx_t_3;
3960      goto __pyx_L7_bool_binop_done;
3961    }
3962    __pyx_t_3 = ((zmq_errno() == ENAMETOOLONG) != 0);
3963    __pyx_t_2 = __pyx_t_3;
3964    __pyx_L7_bool_binop_done:;
3965    if (__pyx_t_2) {
3966
3967      /* "zmq/backend/cython/socket.pyx":435
3968 *             if IPC_PATH_MAX_LEN and zmq_errno() == ENAMETOOLONG:
3969 *                 # py3compat: addr is bytes, but msg wants str
3970 *                 if str is unicode:             # <<<<<<<<<<<<<<
3971 *                     addr = addr.decode('utf-8', 'replace')
3972 *                 path = addr.split('://', 1)[-1]
3973 */
3974      __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_unicode); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3975      __Pyx_GOTREF(__pyx_t_4);
3976      __pyx_t_2 = (((PyObject*)(&PyString_Type)) == ((PyObject*)__pyx_t_4));
3977      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3978      __pyx_t_3 = (__pyx_t_2 != 0);
3979      if (__pyx_t_3) {
3980
3981        /* "zmq/backend/cython/socket.pyx":436
3982 *                 # py3compat: addr is bytes, but msg wants str
3983 *                 if str is unicode:
3984 *                     addr = addr.decode('utf-8', 'replace')             # <<<<<<<<<<<<<<
3985 *                 path = addr.split('://', 1)[-1]
3986 *                 msg = ('ipc path "{0}" is longer than {1} '
3987 */
3988        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_addr, __pyx_n_s_decode); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3989        __Pyx_GOTREF(__pyx_t_4);
3990        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
3991        __Pyx_GOTREF(__pyx_t_1);
3992        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3993        __Pyx_DECREF_SET(__pyx_v_addr, __pyx_t_1);
3994        __pyx_t_1 = 0;
3995        goto __pyx_L9;
3996      }
3997      __pyx_L9:;
3998
3999      /* "zmq/backend/cython/socket.pyx":437
4000 *                 if str is unicode:
4001 *                     addr = addr.decode('utf-8', 'replace')
4002 *                 path = addr.split('://', 1)[-1]             # <<<<<<<<<<<<<<
4003 *                 msg = ('ipc path "{0}" is longer than {1} '
4004 *                                 'characters (sizeof(sockaddr_un.sun_path)). '
4005 */
4006      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_addr, __pyx_n_s_split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4007      __Pyx_GOTREF(__pyx_t_1);
4008      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4009      __Pyx_GOTREF(__pyx_t_4);
4010      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4011      __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_4, -1, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
4012      __Pyx_GOTREF(__pyx_t_1);
4013      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4014      __pyx_v_path = __pyx_t_1;
4015      __pyx_t_1 = 0;
4016
4017      /* "zmq/backend/cython/socket.pyx":442
4018 *                                 'zmq.IPC_PATH_MAX_LEN constant can be used '
4019 *                                 'to check addr length (if it is defined).'
4020 *                                 .format(path, IPC_PATH_MAX_LEN))             # <<<<<<<<<<<<<<
4021 *                 raise ZMQError(msg=msg)
4022 *         _check_rc(rc)
4023 */
4024      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_ipc_path_0_is_longer_than_1_char, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4025      __Pyx_GOTREF(__pyx_t_4);
4026      __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_IPC_PATH_MAX_LEN); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4027      __Pyx_GOTREF(__pyx_t_6);
4028      __pyx_t_7 = NULL;
4029      __pyx_t_8 = 0;
4030      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
4031        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
4032        if (likely(__pyx_t_7)) {
4033          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
4034          __Pyx_INCREF(__pyx_t_7);
4035          __Pyx_INCREF(function);
4036          __Pyx_DECREF_SET(__pyx_t_4, function);
4037          __pyx_t_8 = 1;
4038        }
4039      }
4040      __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4041      __Pyx_GOTREF(__pyx_t_9);
4042      if (__pyx_t_7) {
4043        PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL;
4044      }
4045      __Pyx_INCREF(__pyx_v_path);
4046      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_v_path);
4047      __Pyx_GIVEREF(__pyx_v_path);
4048      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_6);
4049      __Pyx_GIVEREF(__pyx_t_6);
4050      __pyx_t_6 = 0;
4051      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4052      __Pyx_GOTREF(__pyx_t_1);
4053      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
4054      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4055      __pyx_v_msg = __pyx_t_1;
4056      __pyx_t_1 = 0;
4057
4058      /* "zmq/backend/cython/socket.pyx":443
4059 *                                 'to check addr length (if it is defined).'
4060 *                                 .format(path, IPC_PATH_MAX_LEN))
4061 *                 raise ZMQError(msg=msg)             # <<<<<<<<<<<<<<
4062 *         _check_rc(rc)
4063 *
4064 */
4065      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_ZMQError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4066      __Pyx_GOTREF(__pyx_t_1);
4067      __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4068      __Pyx_GOTREF(__pyx_t_4);
4069      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_msg, __pyx_v_msg) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4070      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_4); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4071      __Pyx_GOTREF(__pyx_t_9);
4072      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4073      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4074      __Pyx_Raise(__pyx_t_9, 0, 0, 0);
4075      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
4076      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4077    }
4078    goto __pyx_L5;
4079  }
4080  __pyx_L5:;
4081
4082  /* "zmq/backend/cython/socket.pyx":444
4083 *                                 .format(path, IPC_PATH_MAX_LEN))
4084 *                 raise ZMQError(msg=msg)
4085 *         _check_rc(rc)             # <<<<<<<<<<<<<<
4086 *
4087 *     def connect(self, addr):
4088 */
4089  __pyx_t_10 = __pyx_f_3zmq_7backend_6cython_7checkrc__check_rc(__pyx_v_rc); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4090
4091  /* "zmq/backend/cython/socket.pyx":405
4092 *         return result
4093 *
4094 *     def bind(self, addr):             # <<<<<<<<<<<<<<
4095 *         """s.bind(addr)
4096 *
4097 */
4098
4099  /* function exit code */
4100  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4101  goto __pyx_L0;
4102  __pyx_L1_error:;
4103  __Pyx_XDECREF(__pyx_t_1);
4104  __Pyx_XDECREF(__pyx_t_4);
4105  __Pyx_XDECREF(__pyx_t_6);
4106  __Pyx_XDECREF(__pyx_t_7);
4107  __Pyx_XDECREF(__pyx_t_9);
4108  __Pyx_AddTraceback("zmq.backend.cython.socket.Socket.bind", __pyx_clineno, __pyx_lineno, __pyx_filename);
4109  __pyx_r = NULL;
4110  __pyx_L0:;
4111  __Pyx_XDECREF(__pyx_v_path);
4112  __Pyx_XDECREF(__pyx_v_msg);
4113  __Pyx_XDECREF(__pyx_v_addr);
4114  __Pyx_XGIVEREF(__pyx_r);
4115  __Pyx_RefNannyFinishContext();
4116  return __pyx_r;
4117}
4118
4119/* "zmq/backend/cython/socket.pyx":446
4120 *         _check_rc(rc)
4121 *
4122 *     def connect(self, addr):             # <<<<<<<<<<<<<<
4123 *         """s.connect(addr)
4124 *
4125 */
4126
4127/* Python wrapper */
4128static PyObject *__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_19connect(PyObject *__pyx_v_self, PyObject *__pyx_v_addr); /*proto*/
4129static char __pyx_doc_3zmq_7backend_6cython_6socket_6Socket_18connect[] = "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        ";
4130static PyObject *__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_19connect(PyObject *__pyx_v_self, PyObject *__pyx_v_addr) {
4131  PyObject *__pyx_r = 0;
4132  __Pyx_RefNannyDeclarations
4133  __Pyx_RefNannySetupContext("connect (wrapper)", 0);
4134  __pyx_r = __pyx_pf_3zmq_7backend_6cython_6socket_6Socket_18connect(((struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *)__pyx_v_self), ((PyObject *)__pyx_v_addr));
4135
4136  /* function exit code */
4137  __Pyx_RefNannyFinishContext();
4138  return __pyx_r;
4139}
4140
4141static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_18connect(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, PyObject *__pyx_v_addr) {
4142  int __pyx_v_rc;
4143  char *__pyx_v_c_addr;
4144  PyObject *__pyx_r = NULL;
4145  __Pyx_RefNannyDeclarations
4146  PyObject *__pyx_t_1 = NULL;
4147  int __pyx_t_2;
4148  int __pyx_t_3;
4149  PyObject *__pyx_t_4 = NULL;
4150  char *__pyx_t_5;
4151  PyObject *__pyx_t_6 = NULL;
4152  int __pyx_lineno = 0;
4153  const char *__pyx_filename = NULL;
4154  int __pyx_clineno = 0;
4155  __Pyx_RefNannySetupContext("connect", 0);
4156  __Pyx_INCREF(__pyx_v_addr);
4157
4158  /* "zmq/backend/cython/socket.pyx":462
4159 *         cdef char* c_addr
4160 *
4161 *         _check_closed(self)             # <<<<<<<<<<<<<<
4162 *         if isinstance(addr, unicode):
4163 *             addr = addr.encode('utf-8')
4164 */
4165  __pyx_t_1 = __pyx_f_3zmq_7backend_6cython_6socket__check_closed(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4166  __Pyx_GOTREF(__pyx_t_1);
4167  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4168
4169  /* "zmq/backend/cython/socket.pyx":463
4170 *
4171 *         _check_closed(self)
4172 *         if isinstance(addr, unicode):             # <<<<<<<<<<<<<<
4173 *             addr = addr.encode('utf-8')
4174 *         if not isinstance(addr, bytes):
4175 */
4176  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_unicode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4177  __Pyx_GOTREF(__pyx_t_1);
4178  __pyx_t_2 = PyObject_IsInstance(__pyx_v_addr, __pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4179  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4180  __pyx_t_3 = (__pyx_t_2 != 0);
4181  if (__pyx_t_3) {
4182
4183    /* "zmq/backend/cython/socket.pyx":464
4184 *         _check_closed(self)
4185 *         if isinstance(addr, unicode):
4186 *             addr = addr.encode('utf-8')             # <<<<<<<<<<<<<<
4187 *         if not isinstance(addr, bytes):
4188 *             raise TypeError('expected str, got: %r' % addr)
4189 */
4190    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_addr, __pyx_n_s_encode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4191    __Pyx_GOTREF(__pyx_t_1);
4192    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4193    __Pyx_GOTREF(__pyx_t_4);
4194    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4195    __Pyx_DECREF_SET(__pyx_v_addr, __pyx_t_4);
4196    __pyx_t_4 = 0;
4197    goto __pyx_L3;
4198  }
4199  __pyx_L3:;
4200
4201  /* "zmq/backend/cython/socket.pyx":465
4202 *         if isinstance(addr, unicode):
4203 *             addr = addr.encode('utf-8')
4204 *         if not isinstance(addr, bytes):             # <<<<<<<<<<<<<<
4205 *             raise TypeError('expected str, got: %r' % addr)
4206 *         c_addr = addr
4207 */
4208  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_bytes); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4209  __Pyx_GOTREF(__pyx_t_4);
4210  __pyx_t_3 = PyObject_IsInstance(__pyx_v_addr, __pyx_t_4); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4211  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4212  __pyx_t_2 = ((!(__pyx_t_3 != 0)) != 0);
4213  if (__pyx_t_2) {
4214
4215    /* "zmq/backend/cython/socket.pyx":466
4216 *             addr = addr.encode('utf-8')
4217 *         if not isinstance(addr, bytes):
4218 *             raise TypeError('expected str, got: %r' % addr)             # <<<<<<<<<<<<<<
4219 *         c_addr = addr
4220 *
4221 */
4222    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_expected_str_got_r, __pyx_v_addr); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4223    __Pyx_GOTREF(__pyx_t_4);
4224    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4225    __Pyx_GOTREF(__pyx_t_1);
4226    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
4227    __Pyx_GIVEREF(__pyx_t_4);
4228    __pyx_t_4 = 0;
4229    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4230    __Pyx_GOTREF(__pyx_t_4);
4231    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4232    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
4233    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4234    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4235  }
4236
4237  /* "zmq/backend/cython/socket.pyx":467
4238 *         if not isinstance(addr, bytes):
4239 *             raise TypeError('expected str, got: %r' % addr)
4240 *         c_addr = addr             # <<<<<<<<<<<<<<
4241 *
4242 *         rc = zmq_connect(self.handle, c_addr)
4243 */
4244  __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_addr); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4245  __pyx_v_c_addr = __pyx_t_5;
4246
4247  /* "zmq/backend/cython/socket.pyx":469
4248 *         c_addr = addr
4249 *
4250 *         rc = zmq_connect(self.handle, c_addr)             # <<<<<<<<<<<<<<
4251 *         if rc != 0:
4252 *             raise ZMQError()
4253 */
4254  __pyx_v_rc = zmq_connect(__pyx_v_self->handle, __pyx_v_c_addr);
4255
4256  /* "zmq/backend/cython/socket.pyx":470
4257 *
4258 *         rc = zmq_connect(self.handle, c_addr)
4259 *         if rc != 0:             # <<<<<<<<<<<<<<
4260 *             raise ZMQError()
4261 *
4262 */
4263  __pyx_t_2 = ((__pyx_v_rc != 0) != 0);
4264  if (__pyx_t_2) {
4265
4266    /* "zmq/backend/cython/socket.pyx":471
4267 *         rc = zmq_connect(self.handle, c_addr)
4268 *         if rc != 0:
4269 *             raise ZMQError()             # <<<<<<<<<<<<<<
4270 *
4271 *     def unbind(self, addr):
4272 */
4273    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_ZMQError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4274    __Pyx_GOTREF(__pyx_t_1);
4275    __pyx_t_6 = NULL;
4276    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) {
4277      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
4278      if (likely(__pyx_t_6)) {
4279        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
4280        __Pyx_INCREF(__pyx_t_6);
4281        __Pyx_INCREF(function);
4282        __Pyx_DECREF_SET(__pyx_t_1, function);
4283      }
4284    }
4285    if (__pyx_t_6) {
4286      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4287      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4288    } else {
4289      __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4290    }
4291    __Pyx_GOTREF(__pyx_t_4);
4292    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4293    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
4294    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4295    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4296  }
4297
4298  /* "zmq/backend/cython/socket.pyx":446
4299 *         _check_rc(rc)
4300 *
4301 *     def connect(self, addr):             # <<<<<<<<<<<<<<
4302 *         """s.connect(addr)
4303 *
4304 */
4305
4306  /* function exit code */
4307  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4308  goto __pyx_L0;
4309  __pyx_L1_error:;
4310  __Pyx_XDECREF(__pyx_t_1);
4311  __Pyx_XDECREF(__pyx_t_4);
4312  __Pyx_XDECREF(__pyx_t_6);
4313  __Pyx_AddTraceback("zmq.backend.cython.socket.Socket.connect", __pyx_clineno, __pyx_lineno, __pyx_filename);
4314  __pyx_r = NULL;
4315  __pyx_L0:;
4316  __Pyx_XDECREF(__pyx_v_addr);
4317  __Pyx_XGIVEREF(__pyx_r);
4318  __Pyx_RefNannyFinishContext();
4319  return __pyx_r;
4320}
4321
4322/* "zmq/backend/cython/socket.pyx":473
4323 *             raise ZMQError()
4324 *
4325 *     def unbind(self, addr):             # <<<<<<<<<<<<<<
4326 *         """s.unbind(addr)
4327 *
4328 */
4329
4330/* Python wrapper */
4331static PyObject *__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_21unbind(PyObject *__pyx_v_self, PyObject *__pyx_v_addr); /*proto*/
4332static char __pyx_doc_3zmq_7backend_6cython_6socket_6Socket_20unbind[] = "s.unbind(addr)\n        \n        Unbind from an address (undoes a call to bind).\n        \n        .. versionadded:: libzmq-3.2\n        .. versionadded:: 13.0\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        ";
4333static PyObject *__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_21unbind(PyObject *__pyx_v_self, PyObject *__pyx_v_addr) {
4334  PyObject *__pyx_r = 0;
4335  __Pyx_RefNannyDeclarations
4336  __Pyx_RefNannySetupContext("unbind (wrapper)", 0);
4337  __pyx_r = __pyx_pf_3zmq_7backend_6cython_6socket_6Socket_20unbind(((struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *)__pyx_v_self), ((PyObject *)__pyx_v_addr));
4338
4339  /* function exit code */
4340  __Pyx_RefNannyFinishContext();
4341  return __pyx_r;
4342}
4343
4344static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_20unbind(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, PyObject *__pyx_v_addr) {
4345  int __pyx_v_rc;
4346  char *__pyx_v_c_addr;
4347  PyObject *__pyx_r = NULL;
4348  __Pyx_RefNannyDeclarations
4349  PyObject *__pyx_t_1 = NULL;
4350  PyObject *__pyx_t_2 = NULL;
4351  int __pyx_t_3;
4352  int __pyx_t_4;
4353  char *__pyx_t_5;
4354  PyObject *__pyx_t_6 = NULL;
4355  int __pyx_lineno = 0;
4356  const char *__pyx_filename = NULL;
4357  int __pyx_clineno = 0;
4358  __Pyx_RefNannySetupContext("unbind", 0);
4359  __Pyx_INCREF(__pyx_v_addr);
4360
4361  /* "zmq/backend/cython/socket.pyx":492
4362 *         cdef char* c_addr
4363 *
4364 *         _check_version((3,2), "unbind")             # <<<<<<<<<<<<<<
4365 *         _check_closed(self)
4366 *         if isinstance(addr, unicode):
4367 */
4368  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_check_version); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4369  __Pyx_GOTREF(__pyx_t_1);
4370  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4371  __Pyx_GOTREF(__pyx_t_2);
4372  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4373  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4374
4375  /* "zmq/backend/cython/socket.pyx":493
4376 *
4377 *         _check_version((3,2), "unbind")
4378 *         _check_closed(self)             # <<<<<<<<<<<<<<
4379 *         if isinstance(addr, unicode):
4380 *             addr = addr.encode('utf-8')
4381 */
4382  __pyx_t_2 = __pyx_f_3zmq_7backend_6cython_6socket__check_closed(__pyx_v_self); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4383  __Pyx_GOTREF(__pyx_t_2);
4384  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4385
4386  /* "zmq/backend/cython/socket.pyx":494
4387 *         _check_version((3,2), "unbind")
4388 *         _check_closed(self)
4389 *         if isinstance(addr, unicode):             # <<<<<<<<<<<<<<
4390 *             addr = addr.encode('utf-8')
4391 *         if not isinstance(addr, bytes):
4392 */
4393  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_unicode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4394  __Pyx_GOTREF(__pyx_t_2);
4395  __pyx_t_3 = PyObject_IsInstance(__pyx_v_addr, __pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4396  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4397  __pyx_t_4 = (__pyx_t_3 != 0);
4398  if (__pyx_t_4) {
4399
4400    /* "zmq/backend/cython/socket.pyx":495
4401 *         _check_closed(self)
4402 *         if isinstance(addr, unicode):
4403 *             addr = addr.encode('utf-8')             # <<<<<<<<<<<<<<
4404 *         if not isinstance(addr, bytes):
4405 *             raise TypeError('expected str, got: %r' % addr)
4406 */
4407    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_addr, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4408    __Pyx_GOTREF(__pyx_t_2);
4409    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4410    __Pyx_GOTREF(__pyx_t_1);
4411    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4412    __Pyx_DECREF_SET(__pyx_v_addr, __pyx_t_1);
4413    __pyx_t_1 = 0;
4414    goto __pyx_L3;
4415  }
4416  __pyx_L3:;
4417
4418  /* "zmq/backend/cython/socket.pyx":496
4419 *         if isinstance(addr, unicode):
4420 *             addr = addr.encode('utf-8')
4421 *         if not isinstance(addr, bytes):             # <<<<<<<<<<<<<<
4422 *             raise TypeError('expected str, got: %r' % addr)
4423 *         c_addr = addr
4424 */
4425  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_bytes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4426  __Pyx_GOTREF(__pyx_t_1);
4427  __pyx_t_4 = PyObject_IsInstance(__pyx_v_addr, __pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4428  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4429  __pyx_t_3 = ((!(__pyx_t_4 != 0)) != 0);
4430  if (__pyx_t_3) {
4431
4432    /* "zmq/backend/cython/socket.pyx":497
4433 *             addr = addr.encode('utf-8')
4434 *         if not isinstance(addr, bytes):
4435 *             raise TypeError('expected str, got: %r' % addr)             # <<<<<<<<<<<<<<
4436 *         c_addr = addr
4437 *
4438 */
4439    __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_expected_str_got_r, __pyx_v_addr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4440    __Pyx_GOTREF(__pyx_t_1);
4441    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4442    __Pyx_GOTREF(__pyx_t_2);
4443    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
4444    __Pyx_GIVEREF(__pyx_t_1);
4445    __pyx_t_1 = 0;
4446    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4447    __Pyx_GOTREF(__pyx_t_1);
4448    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4449    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
4450    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4451    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4452  }
4453
4454  /* "zmq/backend/cython/socket.pyx":498
4455 *         if not isinstance(addr, bytes):
4456 *             raise TypeError('expected str, got: %r' % addr)
4457 *         c_addr = addr             # <<<<<<<<<<<<<<
4458 *
4459 *         rc = zmq_unbind(self.handle, c_addr)
4460 */
4461  __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_addr); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4462  __pyx_v_c_addr = __pyx_t_5;
4463
4464  /* "zmq/backend/cython/socket.pyx":500
4465 *         c_addr = addr
4466 *
4467 *         rc = zmq_unbind(self.handle, c_addr)             # <<<<<<<<<<<<<<
4468 *         if rc != 0:
4469 *             raise ZMQError()
4470 */
4471  __pyx_v_rc = zmq_unbind(__pyx_v_self->handle, __pyx_v_c_addr);
4472
4473  /* "zmq/backend/cython/socket.pyx":501
4474 *
4475 *         rc = zmq_unbind(self.handle, c_addr)
4476 *         if rc != 0:             # <<<<<<<<<<<<<<
4477 *             raise ZMQError()
4478 *
4479 */
4480  __pyx_t_3 = ((__pyx_v_rc != 0) != 0);
4481  if (__pyx_t_3) {
4482
4483    /* "zmq/backend/cython/socket.pyx":502
4484 *         rc = zmq_unbind(self.handle, c_addr)
4485 *         if rc != 0:
4486 *             raise ZMQError()             # <<<<<<<<<<<<<<
4487 *
4488 *     def disconnect(self, addr):
4489 */
4490    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_ZMQError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4491    __Pyx_GOTREF(__pyx_t_2);
4492    __pyx_t_6 = NULL;
4493    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
4494      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
4495      if (likely(__pyx_t_6)) {
4496        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
4497        __Pyx_INCREF(__pyx_t_6);
4498        __Pyx_INCREF(function);
4499        __Pyx_DECREF_SET(__pyx_t_2, function);
4500      }
4501    }
4502    if (__pyx_t_6) {
4503      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4504      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4505    } else {
4506      __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4507    }
4508    __Pyx_GOTREF(__pyx_t_1);
4509    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4510    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
4511    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4512    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4513  }
4514
4515  /* "zmq/backend/cython/socket.pyx":473
4516 *             raise ZMQError()
4517 *
4518 *     def unbind(self, addr):             # <<<<<<<<<<<<<<
4519 *         """s.unbind(addr)
4520 *
4521 */
4522
4523  /* function exit code */
4524  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4525  goto __pyx_L0;
4526  __pyx_L1_error:;
4527  __Pyx_XDECREF(__pyx_t_1);
4528  __Pyx_XDECREF(__pyx_t_2);
4529  __Pyx_XDECREF(__pyx_t_6);
4530  __Pyx_AddTraceback("zmq.backend.cython.socket.Socket.unbind", __pyx_clineno, __pyx_lineno, __pyx_filename);
4531  __pyx_r = NULL;
4532  __pyx_L0:;
4533  __Pyx_XDECREF(__pyx_v_addr);
4534  __Pyx_XGIVEREF(__pyx_r);
4535  __Pyx_RefNannyFinishContext();
4536  return __pyx_r;
4537}
4538
4539/* "zmq/backend/cython/socket.pyx":504
4540 *             raise ZMQError()
4541 *
4542 *     def disconnect(self, addr):             # <<<<<<<<<<<<<<
4543 *         """s.disconnect(addr)
4544 *
4545 */
4546
4547/* Python wrapper */
4548static PyObject *__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_23disconnect(PyObject *__pyx_v_self, PyObject *__pyx_v_addr); /*proto*/
4549static char __pyx_doc_3zmq_7backend_6cython_6socket_6Socket_22disconnect[] = "s.disconnect(addr)\n\n        Disconnect from a remote 0MQ socket (undoes a call to connect).\n        \n        .. versionadded:: libzmq-3.2\n        .. versionadded:: 13.0\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        ";
4550static PyObject *__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_23disconnect(PyObject *__pyx_v_self, PyObject *__pyx_v_addr) {
4551  PyObject *__pyx_r = 0;
4552  __Pyx_RefNannyDeclarations
4553  __Pyx_RefNannySetupContext("disconnect (wrapper)", 0);
4554  __pyx_r = __pyx_pf_3zmq_7backend_6cython_6socket_6Socket_22disconnect(((struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *)__pyx_v_self), ((PyObject *)__pyx_v_addr));
4555
4556  /* function exit code */
4557  __Pyx_RefNannyFinishContext();
4558  return __pyx_r;
4559}
4560
4561static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_22disconnect(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, PyObject *__pyx_v_addr) {
4562  int __pyx_v_rc;
4563  char *__pyx_v_c_addr;
4564  PyObject *__pyx_r = NULL;
4565  __Pyx_RefNannyDeclarations
4566  PyObject *__pyx_t_1 = NULL;
4567  PyObject *__pyx_t_2 = NULL;
4568  int __pyx_t_3;
4569  int __pyx_t_4;
4570  char *__pyx_t_5;
4571  PyObject *__pyx_t_6 = NULL;
4572  int __pyx_lineno = 0;
4573  const char *__pyx_filename = NULL;
4574  int __pyx_clineno = 0;
4575  __Pyx_RefNannySetupContext("disconnect", 0);
4576  __Pyx_INCREF(__pyx_v_addr);
4577
4578  /* "zmq/backend/cython/socket.pyx":523
4579 *         cdef char* c_addr
4580 *
4581 *         _check_version((3,2), "disconnect")             # <<<<<<<<<<<<<<
4582 *         _check_closed(self)
4583 *         if isinstance(addr, unicode):
4584 */
4585  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_check_version); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4586  __Pyx_GOTREF(__pyx_t_1);
4587  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4588  __Pyx_GOTREF(__pyx_t_2);
4589  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4590  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4591
4592  /* "zmq/backend/cython/socket.pyx":524
4593 *
4594 *         _check_version((3,2), "disconnect")
4595 *         _check_closed(self)             # <<<<<<<<<<<<<<
4596 *         if isinstance(addr, unicode):
4597 *             addr = addr.encode('utf-8')
4598 */
4599  __pyx_t_2 = __pyx_f_3zmq_7backend_6cython_6socket__check_closed(__pyx_v_self); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4600  __Pyx_GOTREF(__pyx_t_2);
4601  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4602
4603  /* "zmq/backend/cython/socket.pyx":525
4604 *         _check_version((3,2), "disconnect")
4605 *         _check_closed(self)
4606 *         if isinstance(addr, unicode):             # <<<<<<<<<<<<<<
4607 *             addr = addr.encode('utf-8')
4608 *         if not isinstance(addr, bytes):
4609 */
4610  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_unicode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4611  __Pyx_GOTREF(__pyx_t_2);
4612  __pyx_t_3 = PyObject_IsInstance(__pyx_v_addr, __pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4613  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4614  __pyx_t_4 = (__pyx_t_3 != 0);
4615  if (__pyx_t_4) {
4616
4617    /* "zmq/backend/cython/socket.pyx":526
4618 *         _check_closed(self)
4619 *         if isinstance(addr, unicode):
4620 *             addr = addr.encode('utf-8')             # <<<<<<<<<<<<<<
4621 *         if not isinstance(addr, bytes):
4622 *             raise TypeError('expected str, got: %r' % addr)
4623 */
4624    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_addr, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4625    __Pyx_GOTREF(__pyx_t_2);
4626    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4627    __Pyx_GOTREF(__pyx_t_1);
4628    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4629    __Pyx_DECREF_SET(__pyx_v_addr, __pyx_t_1);
4630    __pyx_t_1 = 0;
4631    goto __pyx_L3;
4632  }
4633  __pyx_L3:;
4634
4635  /* "zmq/backend/cython/socket.pyx":527
4636 *         if isinstance(addr, unicode):
4637 *             addr = addr.encode('utf-8')
4638 *         if not isinstance(addr, bytes):             # <<<<<<<<<<<<<<
4639 *             raise TypeError('expected str, got: %r' % addr)
4640 *         c_addr = addr
4641 */
4642  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_bytes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4643  __Pyx_GOTREF(__pyx_t_1);
4644  __pyx_t_4 = PyObject_IsInstance(__pyx_v_addr, __pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4645  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4646  __pyx_t_3 = ((!(__pyx_t_4 != 0)) != 0);
4647  if (__pyx_t_3) {
4648
4649    /* "zmq/backend/cython/socket.pyx":528
4650 *             addr = addr.encode('utf-8')
4651 *         if not isinstance(addr, bytes):
4652 *             raise TypeError('expected str, got: %r' % addr)             # <<<<<<<<<<<<<<
4653 *         c_addr = addr
4654 *
4655 */
4656    __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_expected_str_got_r, __pyx_v_addr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4657    __Pyx_GOTREF(__pyx_t_1);
4658    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4659    __Pyx_GOTREF(__pyx_t_2);
4660    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
4661    __Pyx_GIVEREF(__pyx_t_1);
4662    __pyx_t_1 = 0;
4663    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4664    __Pyx_GOTREF(__pyx_t_1);
4665    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4666    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
4667    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4668    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4669  }
4670
4671  /* "zmq/backend/cython/socket.pyx":529
4672 *         if not isinstance(addr, bytes):
4673 *             raise TypeError('expected str, got: %r' % addr)
4674 *         c_addr = addr             # <<<<<<<<<<<<<<
4675 *
4676 *         rc = zmq_disconnect(self.handle, c_addr)
4677 */
4678  __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_addr); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4679  __pyx_v_c_addr = __pyx_t_5;
4680
4681  /* "zmq/backend/cython/socket.pyx":531
4682 *         c_addr = addr
4683 *
4684 *         rc = zmq_disconnect(self.handle, c_addr)             # <<<<<<<<<<<<<<
4685 *         if rc != 0:
4686 *             raise ZMQError()
4687 */
4688  __pyx_v_rc = zmq_disconnect(__pyx_v_self->handle, __pyx_v_c_addr);
4689
4690  /* "zmq/backend/cython/socket.pyx":532
4691 *
4692 *         rc = zmq_disconnect(self.handle, c_addr)
4693 *         if rc != 0:             # <<<<<<<<<<<<<<
4694 *             raise ZMQError()
4695 *
4696 */
4697  __pyx_t_3 = ((__pyx_v_rc != 0) != 0);
4698  if (__pyx_t_3) {
4699
4700    /* "zmq/backend/cython/socket.pyx":533
4701 *         rc = zmq_disconnect(self.handle, c_addr)
4702 *         if rc != 0:
4703 *             raise ZMQError()             # <<<<<<<<<<<<<<
4704 *
4705 *     def monitor(self, addr, int events=ZMQ_EVENT_ALL):
4706 */
4707    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_ZMQError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4708    __Pyx_GOTREF(__pyx_t_2);
4709    __pyx_t_6 = NULL;
4710    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
4711      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
4712      if (likely(__pyx_t_6)) {
4713        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
4714        __Pyx_INCREF(__pyx_t_6);
4715        __Pyx_INCREF(function);
4716        __Pyx_DECREF_SET(__pyx_t_2, function);
4717      }
4718    }
4719    if (__pyx_t_6) {
4720      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4721      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4722    } else {
4723      __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4724    }
4725    __Pyx_GOTREF(__pyx_t_1);
4726    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4727    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
4728    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4729    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4730  }
4731
4732  /* "zmq/backend/cython/socket.pyx":504
4733 *             raise ZMQError()
4734 *
4735 *     def disconnect(self, addr):             # <<<<<<<<<<<<<<
4736 *         """s.disconnect(addr)
4737 *
4738 */
4739
4740  /* function exit code */
4741  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4742  goto __pyx_L0;
4743  __pyx_L1_error:;
4744  __Pyx_XDECREF(__pyx_t_1);
4745  __Pyx_XDECREF(__pyx_t_2);
4746  __Pyx_XDECREF(__pyx_t_6);
4747  __Pyx_AddTraceback("zmq.backend.cython.socket.Socket.disconnect", __pyx_clineno, __pyx_lineno, __pyx_filename);
4748  __pyx_r = NULL;
4749  __pyx_L0:;
4750  __Pyx_XDECREF(__pyx_v_addr);
4751  __Pyx_XGIVEREF(__pyx_r);
4752  __Pyx_RefNannyFinishContext();
4753  return __pyx_r;
4754}
4755
4756/* "zmq/backend/cython/socket.pyx":535
4757 *             raise ZMQError()
4758 *
4759 *     def monitor(self, addr, int events=ZMQ_EVENT_ALL):             # <<<<<<<<<<<<<<
4760 *         """s.monitor(addr, flags)
4761 *
4762 */
4763
4764/* Python wrapper */
4765static PyObject *__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_25monitor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4766static char __pyx_doc_3zmq_7backend_6cython_6socket_6Socket_24monitor[] = "s.monitor(addr, flags)\n\n        Start publishing socket events on inproc.\n        See libzmq docs for zmq_monitor for details.\n        \n        While this function is available from libzmq 3.2,\n        pyzmq cannot parse monitor messages from libzmq prior to 4.0.\n        \n        .. versionadded: libzmq-3.2\n        .. versionadded: 14.0\n        \n        Parameters\n        ----------\n        addr : str\n            The inproc url used for monitoring. Passing None as\n            the addr will cause an existing socket monitor to be\n            deregistered.\n        events : int [default: zmq.EVENT_ALL]\n            The zmq event bitmask for which events will be sent to the monitor.\n        ";
4767static PyObject *__pyx_pw_3zmq_7backend_6cython_6socket_6Socket_25monitor(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4768  PyObject *__pyx_v_addr = 0;
4769  int __pyx_v_events;
4770  int __pyx_lineno = 0;
4771  const char *__pyx_filename = NULL;
4772  int __pyx_clineno = 0;
4773  PyObject *__pyx_r = 0;
4774  __Pyx_RefNannyDeclarations
4775  __Pyx_RefNannySetupContext("monitor (wrapper)", 0);
4776  {
4777    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_addr,&__pyx_n_s_events,0};
4778    PyObject* values[2] = {0,0};
4779    if (unlikely(__pyx_kwds)) {
4780      Py_ssize_t kw_args;
4781      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4782      switch (pos_args) {
4783        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4784        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4785        case  0: break;
4786        default: goto __pyx_L5_argtuple_error;
4787      }
4788      kw_args = PyDict_Size(__pyx_kwds);
4789      switch (pos_args) {
4790        case  0:
4791        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_addr)) != 0)) kw_args--;
4792        else goto __pyx_L5_argtuple_error;
4793        case  1:
4794        if (kw_args > 0) {
4795          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_events);
4796          if (value) { values[1] = value; kw_args--; }
4797        }
4798      }
4799      if (unlikely(kw_args > 0)) {
4800        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "monitor") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4801      }
4802    } else {
4803      switch (PyTuple_GET_SIZE(__pyx_args)) {
4804        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4805        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4806        break;
4807        default: goto __pyx_L5_argtuple_error;
4808      }
4809    }
4810    __pyx_v_addr = values[0];
4811    if (values[1]) {
4812      __pyx_v_events = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_events == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4813    } else {
4814      __pyx_v_events = __pyx_k__15;
4815    }
4816  }
4817  goto __pyx_L4_argument_unpacking_done;
4818  __pyx_L5_argtuple_error:;
4819  __Pyx_RaiseArgtupleInvalid("monitor", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
4820  __pyx_L3_error:;
4821  __Pyx_AddTraceback("zmq.backend.cython.socket.Socket.monitor", __pyx_clineno, __pyx_lineno, __pyx_filename);
4822  __Pyx_RefNannyFinishContext();
4823  return NULL;
4824  __pyx_L4_argument_unpacking_done:;
4825  __pyx_r = __pyx_pf_3zmq_7backend_6cython_6socket_6Socket_24monitor(((struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *)__pyx_v_self), __pyx_v_addr, __pyx_v_events);
4826
4827  /* function exit code */
4828  __Pyx_RefNannyFinishContext();
4829  return __pyx_r;
4830}
4831
4832static PyObject *__pyx_pf_3zmq_7backend_6cython_6socket_6Socket_24monitor(struct __pyx_obj_3zmq_7backend_6cython_6socket_Socket *__pyx_v_self, PyObject *__pyx_v_addr, int __pyx_v_events) {
4833  int __pyx_v_rc;
4834  int __pyx_v_c_flags;
4835  char *__pyx_v_c_addr;
4836  PyObject *__pyx_r = NULL;
4837  __Pyx_RefNannyDeclarations
4838  PyObject *__pyx_t_1 = NULL;
4839  PyObject *__pyx_t_2 = NULL;
4840  int __pyx_t_3;
4841  int __pyx_t_4;
4842  char *__pyx_t_5;
4843  int __pyx_t_6;
4844  int __pyx_lineno = 0;
4845  const char *__pyx_filename = NULL;
4846  int __pyx_clineno = 0;
4847  __Pyx_RefNannySetupContext("monitor", 0);
4848  __Pyx_INCREF(__pyx_v_addr);
4849
4850  /* "zmq/backend/cython/socket.pyx":557
4851 *         """
4852 *         cdef int rc, c_flags
4853 *         cdef char* c_addr = NULL             # <<<<<<<<<<<<<<
4854 *
4855 *         _check_version((3,2), "monitor")
4856 */
4857  __pyx_v_c_addr = NULL;
4858
4859  /* "zmq/backend/cython/socket.pyx":559
4860 *         cdef char* c_addr = NULL
4861 *
4862 *         _check_version((3,2), "monitor")             # <<<<<<<<<<<<<<
4863 *         if addr is not None:
4864 *             if isinstance(addr, unicode):
4865 */
4866  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_check_version); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4867  __Pyx_GOTREF(__pyx_t_1);
4868  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4869  __Pyx_GOTREF(__pyx_t_2);
4870  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4871  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4872
4873  /* "zmq/backend/cython/socket.pyx":560
4874 *
4875 *         _check_version((3,2), "monitor")
4876 *         if addr is not None:             # <<<<<<<<<<<<<<
4877 *             if isinstance(addr, unicode):
4878 *                 addr = addr.encode('utf-8')
4879 */
4880  __pyx_t_3 = (__pyx_v_addr != Py_None);
4881  __pyx_t_4 = (__pyx_t_3 != 0);
4882  if (__pyx_t_4) {
4883
4884    /* "zmq/backend/cython/socket.pyx":561
4885 *         _check_version((3,2), "monitor")
4886 *         if addr is not None:
4887 *             if isinstance(addr, unicode):             # <<<<<<<<<<<<<<
4888 *                 addr = addr.encode('utf-8')
4889 *             if not isinstance(addr, bytes):
4890 */
4891    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_unicode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4892    __Pyx_GOTREF(__pyx_t_2);
4893    __pyx_t_4 = PyObject_IsInstance(__pyx_v_addr, __pyx_t_2); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4894    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4895    __pyx_t_3 = (__pyx_t_4 != 0);
4896    if (__pyx_t_3) {
4897
4898      /* "zmq/backend/cython/socket.pyx":562
4899 *         if addr is not None:
4900 *             if isinstance(addr, unicode):
4901 *                 addr = addr.encode('utf-8')             # <<<<<<<<<<<<<<
4902 *             if not isinstance(addr, bytes):
4903 *                 raise TypeError('expected str, got: %r' % addr)
4904 */
4905      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_addr, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4906      __Pyx_GOTREF(__pyx_t_2);
4907      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4908      __Pyx_GOTREF(__pyx_t_1);
4909      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4910      __Pyx_DECREF_SET(__pyx_v_addr, __pyx_t_1);
4911      __pyx_t_1 = 0;
4912      goto __pyx_L4;
4913    }
4914    __pyx_L4:;
4915
4916    /* "zmq/backend/cython/socket.pyx":563
4917 *             if isinstance(addr, unicode):
4918 *                 addr = addr.encode('utf-8')
4919 *             if not isinstance(addr, bytes):             # <<<<<<<<<<<<<<
4920 *                 raise TypeError('expected str, got: %r' % addr)
4921 *             c_addr = addr
4922 */
4923    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_bytes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4924    __Pyx_GOTREF(__pyx_t_1);
4925    __pyx_t_3 = PyObject_IsInstance(__pyx_v_addr, __pyx_t_1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4926    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4927    __pyx_t_4 = ((!(__pyx_t_3 != 0)) != 0);
4928    if (__pyx_t_4) {
4929
4930      /* "zmq/backend/cython/socket.pyx":564
4931 *                 addr = addr.encode('utf-8')
4932 *             if not isinstance(addr, bytes):
4933 *                 raise TypeError('expected str, got: %r' % addr)             # <<<<<<<<<<<<<<
4934 *             c_addr = addr
4935 *         c_flags = events
4936 */
4937      __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_expected_str_got_r, __pyx_v_addr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4938      __Pyx_GOTREF(__pyx_t_1);
4939      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4940      __Pyx_GOTREF(__pyx_t_2);
4941      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
4942      __Pyx_GIVEREF(__pyx_t_1);
4943      __pyx_t_1 = 0;
4944      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4945      __Pyx_GOTREF(__pyx_t_1);
4946      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4947      __Pyx_Raise(__pyx_t_1, 0, 0, 0);
4948      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4949      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4950    }
4951
4952    /* "zmq/backend/cython/socket.pyx":565
4953 *             if not isinstance(addr, bytes):
4954 *                 raise TypeError('expected str, got: %r' % addr)
4955 *             c_addr = addr             # <<<<<<<<<<<<<<
4956 *         c_flags = events
4957 *         rc = zmq_socket_monitor(self.handle, c_addr, c_flags)
4958 */
4959    __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_addr); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
4960    __pyx_v_c_addr = __pyx_t_5;
4961    goto __pyx_L3;
4962  }
4963  __pyx_L3:;
4964
4965  /* "zmq/backend/