/* Generated by Cython 0.12.1 on Sat Aug 28 18:18:29 2010 */

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#include "structmember.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#else

#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#endif
#if PY_VERSION_HEX < 0x02040000
  #define METH_COEXIST 0
  #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type)
  #define PyDict_Contains(d,o)   PySequence_Contains(d,o)
#endif

#if PY_VERSION_HEX < 0x02050000
  typedef int Py_ssize_t;
  #define PY_SSIZE_T_MAX INT_MAX
  #define PY_SSIZE_T_MIN INT_MIN
  #define PY_FORMAT_SIZE_T ""
  #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
  #define PyInt_AsSsize_t(o)   PyInt_AsLong(o)
  #define PyNumber_Index(o)    PyNumber_Int(o)
  #define PyIndex_Check(o)     PyNumber_Check(o)
  #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
#endif

#if PY_VERSION_HEX < 0x02060000
  #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
  #define Py_TYPE(ob)   (((PyObject*)(ob))->ob_type)
  #define Py_SIZE(ob)   (((PyVarObject*)(ob))->ob_size)
  #define PyVarObject_HEAD_INIT(type, size) \
          PyObject_HEAD_INIT(type) size,
  #define PyType_Modified(t)

  typedef struct {
     void *buf;
     PyObject *obj;
     Py_ssize_t len;
     Py_ssize_t itemsize;
     int readonly;
     int ndim;
     char *format;
     Py_ssize_t *shape;
     Py_ssize_t *strides;
     Py_ssize_t *suboffsets;
     void *internal;
  } Py_buffer;

  #define PyBUF_SIMPLE 0
  #define PyBUF_WRITABLE 0x0001
  #define PyBUF_FORMAT 0x0004
  #define PyBUF_ND 0x0008
  #define PyBUF_STRIDES (0x0010 | PyBUF_ND)
  #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
  #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
  #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
  #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)

#endif

#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
#endif

#if PY_MAJOR_VERSION >= 3
  #define Py_TPFLAGS_CHECKTYPES 0
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif

#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif

#if PY_MAJOR_VERSION >= 3
  #define PyBaseString_Type            PyUnicode_Type
  #define PyString_Type                PyUnicode_Type
  #define PyString_CheckExact          PyUnicode_CheckExact
#else
  #define PyBytes_Type                 PyString_Type
  #define PyBytes_CheckExact           PyString_CheckExact
#endif

#if PY_MAJOR_VERSION >= 3
  #define PyInt_Type                   PyLong_Type
  #define PyInt_Check(op)              PyLong_Check(op)
  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
  #define PyInt_FromString             PyLong_FromString
  #define PyInt_FromUnicode            PyLong_FromUnicode
  #define PyInt_FromLong               PyLong_FromLong
  #define PyInt_FromSize_t             PyLong_FromSize_t
  #define PyInt_FromSsize_t            PyLong_FromSsize_t
  #define PyInt_AsLong                 PyLong_AsLong
  #define PyInt_AS_LONG                PyLong_AS_LONG
  #define PyInt_AsSsize_t              PyLong_AsSsize_t
  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#else
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)

#endif

#if PY_MAJOR_VERSION >= 3
  #define PyMethod_New(func, self, klass) PyInstanceMethod_New(func)
#endif

#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
  #ifndef __fastcall
    #define __fastcall
  #endif
#else
  #define _USE_MATH_DEFINES
#endif

#if PY_VERSION_HEX < 0x02050000
  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),((char *)(n)))
  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),((char *)(n)))
#else
  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),(n))
  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),(n))
#endif

#if PY_VERSION_HEX < 0x02050000
  #define __Pyx_NAMESTR(n) ((char *)(n))
  #define __Pyx_DOCSTR(n)  ((char *)(n))
#else
  #define __Pyx_NAMESTR(n) (n)
  #define __Pyx_DOCSTR(n)  (n)
#endif
#ifdef __cplusplus
#define __PYX_EXTERN_C extern "C"
#else
#define __PYX_EXTERN_C extern
#endif
#include <math.h>
#define __PYX_HAVE_API__zmq___zmq
#include "stdlib.h"
#include "errno.h"
#include "string.h"
#include "zmq_compat.h"
#include "zmq.h"

#ifndef CYTHON_INLINE
  #if defined(__GNUC__)
    #define CYTHON_INLINE __inline__
  #elif defined(_MSC_VER)
    #define CYTHON_INLINE __inline
  #else
    #define CYTHON_INLINE 
  #endif
#endif

typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/


/* Type Conversion Predeclarations */

#if PY_MAJOR_VERSION < 3
#define __Pyx_PyBytes_FromString          PyString_FromString
#define __Pyx_PyBytes_FromStringAndSize   PyString_FromStringAndSize
#define __Pyx_PyBytes_AsString            PyString_AsString
#else
#define __Pyx_PyBytes_FromString          PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize   PyBytes_FromStringAndSize
#define __Pyx_PyBytes_AsString            PyBytes_AsString
#endif

#define __Pyx_PyBytes_FromUString(s)      __Pyx_PyBytes_FromString((char*)s)
#define __Pyx_PyBytes_AsUString(s)        ((unsigned char*) __Pyx_PyBytes_AsString(s))

#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);

#if !defined(T_PYSSIZET)
#if PY_VERSION_HEX < 0x02050000
#define T_PYSSIZET T_INT
#elif !defined(T_LONGLONG)
#define T_PYSSIZET \
        ((sizeof(Py_ssize_t) == sizeof(int))  ? T_INT  : \
        ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : -1))
#else
#define T_PYSSIZET \
        ((sizeof(Py_ssize_t) == sizeof(int))          ? T_INT      : \
        ((sizeof(Py_ssize_t) == sizeof(long))         ? T_LONG     : \
        ((sizeof(Py_ssize_t) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1)))
#endif
#endif


#if !defined(T_ULONGLONG)
#define __Pyx_T_UNSIGNED_INT(x) \
        ((sizeof(x) == sizeof(unsigned char))  ? T_UBYTE : \
        ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \
        ((sizeof(x) == sizeof(unsigned int))   ? T_UINT : \
        ((sizeof(x) == sizeof(unsigned long))  ? T_ULONG : -1))))
#else
#define __Pyx_T_UNSIGNED_INT(x) \
        ((sizeof(x) == sizeof(unsigned char))  ? T_UBYTE : \
        ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \
        ((sizeof(x) == sizeof(unsigned int))   ? T_UINT : \
        ((sizeof(x) == sizeof(unsigned long))  ? T_ULONG : \
        ((sizeof(x) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1)))))
#endif
#if !defined(T_LONGLONG)
#define __Pyx_T_SIGNED_INT(x) \
        ((sizeof(x) == sizeof(char))  ? T_BYTE : \
        ((sizeof(x) == sizeof(short)) ? T_SHORT : \
        ((sizeof(x) == sizeof(int))   ? T_INT : \
        ((sizeof(x) == sizeof(long))  ? T_LONG : -1))))
#else
#define __Pyx_T_SIGNED_INT(x) \
        ((sizeof(x) == sizeof(char))  ? T_BYTE : \
        ((sizeof(x) == sizeof(short)) ? T_SHORT : \
        ((sizeof(x) == sizeof(int))   ? T_INT : \
        ((sizeof(x) == sizeof(long))  ? T_LONG : \
        ((sizeof(x) == sizeof(PY_LONG_LONG))   ? T_LONGLONG : -1)))))
#endif

#define __Pyx_T_FLOATING(x) \
        ((sizeof(x) == sizeof(float)) ? T_FLOAT : \
        ((sizeof(x) == sizeof(double)) ? T_DOUBLE : -1))

#if !defined(T_SIZET)
#if !defined(T_ULONGLONG)
#define T_SIZET \
        ((sizeof(size_t) == sizeof(unsigned int))  ? T_UINT  : \
        ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : -1))
#else
#define T_SIZET \
        ((sizeof(size_t) == sizeof(unsigned int))          ? T_UINT      : \
        ((sizeof(size_t) == sizeof(unsigned long))         ? T_ULONG     : \
        ((sizeof(size_t) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1)))
#endif
#endif

static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);

#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))


#ifdef __GNUC__
/* Test for GCC > 2.95 */
#if __GNUC__ > 2 ||               (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) 
#define likely(x)   __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
#else /* __GNUC__ > 2 ... */
#define likely(x)   (x)
#define unlikely(x) (x)
#endif /* __GNUC__ > 2 ... */
#else /* __GNUC__ */
#define likely(x)   (x)
#define unlikely(x) (x)
#endif /* __GNUC__ */
    
static PyObject *__pyx_m;
static PyObject *__pyx_b;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;
static const char **__pyx_f;


/* Type declarations */

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":292
 * 
 * 
 * cdef class Message:             # <<<<<<<<<<<<<<
 *     """A Message class for non-copy send/recvs.
 * 
 */

struct __pyx_obj_3zmq_4_zmq_Message {
  PyObject_HEAD
  struct __pyx_vtabstruct_3zmq_4_zmq_Message *__pyx_vtab;
  zmq_msg_t zmq_msg;
  PyObject *data;
};

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":422
 * 
 * 
 * cdef class Socket:             # <<<<<<<<<<<<<<
 *     """A 0MQ socket.
 * 
 */

struct __pyx_obj_3zmq_4_zmq_Socket {
  PyObject_HEAD
  void *handle;
  int socket_type;
  struct __pyx_obj_3zmq_4_zmq_Context *context;
  PyObject *closed;
};

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":381
 * 
 * 
 * cdef class Context:             # <<<<<<<<<<<<<<
 *     """Manage the lifecycle of a 0MQ context.
 * 
 */

struct __pyx_obj_3zmq_4_zmq_Context {
  PyObject_HEAD
  void *handle;
};


/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":292
 * 
 * 
 * cdef class Message:             # <<<<<<<<<<<<<<
 *     """A Message class for non-copy send/recvs.
 * 
 */

struct __pyx_vtabstruct_3zmq_4_zmq_Message {
  struct __pyx_obj_3zmq_4_zmq_Message *(*fast_copy)(struct __pyx_obj_3zmq_4_zmq_Message *);
};
static struct __pyx_vtabstruct_3zmq_4_zmq_Message *__pyx_vtabptr_3zmq_4_zmq_Message;

#ifndef CYTHON_REFNANNY
  #define CYTHON_REFNANNY 0
#endif

#if CYTHON_REFNANNY
  typedef struct {
    void (*INCREF)(void*, PyObject*, int);
    void (*DECREF)(void*, PyObject*, int);
    void (*GOTREF)(void*, PyObject*, int);
    void (*GIVEREF)(void*, PyObject*, int);
    void* (*SetupContext)(const char*, int, const char*);
    void (*FinishContext)(void**);
  } __Pyx_RefNannyAPIStruct;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) {
    PyObject *m = NULL, *p = NULL;
    void *r = NULL;
    m = PyImport_ImportModule((char *)modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
  end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
  }
  #define __Pyx_RefNannySetupContext(name)           void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
  #define __Pyx_RefNannyFinishContext()           __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0)
#else
  #define __Pyx_RefNannySetupContext(name)
  #define __Pyx_RefNannyFinishContext()
  #define __Pyx_INCREF(r) Py_INCREF(r)
  #define __Pyx_DECREF(r) Py_DECREF(r)
  #define __Pyx_GOTREF(r)
  #define __Pyx_GIVEREF(r)
  #define __Pyx_XDECREF(r) Py_XDECREF(r)
#endif /* CYTHON_REFNANNY */
#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0)
#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0)

static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/

static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name, PyObject* kw_name); /*proto*/

static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
    Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/

static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,     const char* function_name); /*proto*/

static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/

static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/


static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (!j) return NULL;
    r = PyObject_GetItem(o, j);
    Py_DECREF(j);
    return r;
}


#define __Pyx_GetItemInt_List(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \
                                                    __Pyx_GetItemInt_List_Fast(o, i, size <= sizeof(long)) : \
                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))

static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, int fits_long) {
    if (likely(o != Py_None)) {
        if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
            PyObject *r = PyList_GET_ITEM(o, i);
            Py_INCREF(r);
            return r;
        }
        else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
            PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
            Py_INCREF(r);
            return r;
        }
    }
    return __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i));
}

#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \
                                                    __Pyx_GetItemInt_Tuple_Fast(o, i, size <= sizeof(long)) : \
                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))

static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, int fits_long) {
    if (likely(o != Py_None)) {
        if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
            PyObject *r = PyTuple_GET_ITEM(o, i);
            Py_INCREF(r);
            return r;
        }
        else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
            PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
            Py_INCREF(r);
            return r;
        }
    }
    return __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i));
}


#define __Pyx_GetItemInt(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \
                                                    __Pyx_GetItemInt_Fast(o, i, size <= sizeof(long)) : \
                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))

static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int fits_long) {
    PyObject *r;
    if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) {
        r = PyList_GET_ITEM(o, i);
        Py_INCREF(r);
    }
    else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
        r = PyTuple_GET_ITEM(o, i);
        Py_INCREF(r);
    }
    else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) {
        r = PySequence_GetItem(o, i);
    }
    else {
        r = __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i));
    }
    return r;
}

static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
    if (likely(PyList_CheckExact(L))) {
        if (PyList_Append(L, x) < 0) return NULL;
        Py_INCREF(Py_None);
        return Py_None; /* this is just to have an accurate signature */
    }
    else {
        PyObject *r, *m;
        m = __Pyx_GetAttrString(L, "append");
        if (!m) return NULL;
        r = PyObject_CallFunctionObjArgs(m, x, NULL);
        Py_DECREF(m);
        return r;
    }
}

static CYTHON_INLINE long __Pyx_NegateNonNeg(long b) { return unlikely(b < 0) ? b : !b; }
static CYTHON_INLINE PyObject* __Pyx_PyBoolOrNull_FromLong(long b) {
    return unlikely(b < 0) ? NULL : __Pyx_PyBool_FromLong(b);
}

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void);

static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/
static int __Pyx_EndUnpack(PyObject *); /*proto*/

static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/

static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact); /*proto*/

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/

static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/

static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, const char *modname); /*proto*/

static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/

#ifndef __PYX_FORCE_INIT_THREADS
  #if PY_VERSION_HEX < 0x02040200
    #define __PYX_FORCE_INIT_THREADS 1
  #else
    #define __PYX_FORCE_INIT_THREADS 0
  #endif
#endif

static CYTHON_INLINE pyzmq_int64_t __Pyx_PyInt_from_py_pyzmq_int64_t(PyObject *);

static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_pyzmq_int64_t(pyzmq_int64_t);

static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);

static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);

static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);

static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *);

static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *);

static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *);

static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);

static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);

static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);

static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);

static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);

static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *);

static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);

static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);

static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);

static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/

static void __Pyx_AddTraceback(const char *funcname); /*proto*/

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
/* Module declarations from stdlib */

/* Module declarations from python_ref */

/* Module declarations from python_string */

/* Module declarations from zmq._zmq */

static PyTypeObject *__pyx_ptype_3zmq_4_zmq_Message = 0;
static PyTypeObject *__pyx_ptype_3zmq_4_zmq_Context = 0;
static PyTypeObject *__pyx_ptype_3zmq_4_zmq_Socket = 0;
static CYTHON_INLINE void *__pyx_f_3zmq_4_zmq_memnew(size_t); /*proto*/
static CYTHON_INLINE void __pyx_f_3zmq_4_zmq_memdel(void *); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_3zmq_4_zmq_allocate(size_t, void **); /*proto*/
static void __pyx_f_3zmq_4_zmq_free_python_msg(void *, void *); /*proto*/
#define __Pyx_MODULE_NAME "zmq._zmq"
int __pyx_module_is_main_zmq___zmq = 0;

/* Implementation of zmq._zmq */
static PyObject *__pyx_builtin_ImportError;
static PyObject *__pyx_builtin_Exception;
static PyObject *__pyx_builtin_object;
static PyObject *__pyx_builtin_MemoryError;
static PyObject *__pyx_builtin_TypeError;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_ValueError;
static char __pyx_k_1[] = "%i.%i.%i";
static char __pyx_k_2[] = "expected str, got: %r";
static char __pyx_k_3[] = "expected int, got: %r";
static char __pyx_k_4[] = "%s:%s";
static char __pyx_k_5[] = "Could not bind socket to random port.";
static char __pyx_k_10[] = "json or simplejson library is required.";
static char __pyx_k_11[] = ",";
static char __pyx_k_12[] = ":";
static char __pyx_k_13[] = "fileno() must return an valid integer fd";
static char __pyx_k_14[] = "Socket must be a 0MQ socket, an integer fd or have a fileno() method: %r";
static char __pyx_k_17[] = "Python bindings for 0MQ.";
static char __pyx_k_18[] = "Base exception class for 0MQ errors in Python.";
static char __pyx_k_19[] = "An error for bind_to_random_port.";
static char __pyx_k_20[] = "An stateful poll interface that mirrors Python's built-in poll.";
static char __pyx_k__fd[] = "fd";
static char __pyx_k__HWM[] = "HWM";
static char __pyx_k__PUB[] = "PUB";
static char __pyx_k__REP[] = "REP";
static char __pyx_k__REQ[] = "REQ";
static char __pyx_k__SUB[] = "SUB";
static char __pyx_k__msg[] = "msg";
static char __pyx_k__obj[] = "obj";
static char __pyx_k__EFSM[] = "EFSM";
static char __pyx_k__PAIR[] = "PAIR";
static char __pyx_k__RATE[] = "RATE";
static char __pyx_k__SWAP[] = "SWAP";
static char __pyx_k__XREP[] = "XREP";
static char __pyx_k__XREQ[] = "XREQ";
static char __pyx_k__addr[] = "addr";
static char __pyx_k__bind[] = "bind";
static char __pyx_k__copy[] = "copy";
static char __pyx_k__data[] = "data";
static char __pyx_k__json[] = "json";
static char __pyx_k__poll[] = "poll";
static char __pyx_k__recv[] = "recv";
static char __pyx_k__self[] = "self";
static char __pyx_k__send[] = "send";
static char __pyx_k__ETERM[] = "ETERM";
static char __pyx_k__QUEUE[] = "QUEUE";
static char __pyx_k___poll[] = "_poll";
static char __pyx_k__close[] = "close";
static char __pyx_k__dumps[] = "dumps";
static char __pyx_k__errno[] = "errno";
static char __pyx_k__error[] = "error";
static char __pyx_k__flags[] = "flags";
static char __pyx_k__items[] = "items";
static char __pyx_k__loads[] = "loads";
static char __pyx_k__range[] = "range";
static char __pyx_k__rlist[] = "rlist";
static char __pyx_k__wlist[] = "wlist";
static char __pyx_k__xlist[] = "xlist";
static char __pyx_k__EAGAIN[] = "EAGAIN";
static char __pyx_k__EINVAL[] = "EINVAL";
static char __pyx_k__POLLIN[] = "POLLIN";
static char __pyx_k__Poller[] = "Poller";
static char __pyx_k__RCVBUF[] = "RCVBUF";
static char __pyx_k__SNDBUF[] = "SNDBUF";
static char __pyx_k__Socket[] = "Socket";
static char __pyx_k__closed[] = "closed";
static char __pyx_k__device[] = "device";
static char __pyx_k__events[] = "events";
static char __pyx_k__fileno[] = "fileno";
static char __pyx_k__handle[] = "handle";
static char __pyx_k__modify[] = "modify";
static char __pyx_k__object[] = "object";
static char __pyx_k__option[] = "option";
static char __pyx_k__optval[] = "optval";
static char __pyx_k__pickle[] = "pickle";
static char __pyx_k__random[] = "random";
static char __pyx_k__select[] = "select";
static char __pyx_k__socket[] = "socket";
static char __pyx_k__struct[] = "struct";
static char __pyx_k__Context[] = "Context";
static char __pyx_k__ENOBUFS[] = "ENOBUFS";
static char __pyx_k__ENOTSUP[] = "ENOTSUP";
static char __pyx_k__Message[] = "Message";
static char __pyx_k__NOBLOCK[] = "NOBLOCK";
static char __pyx_k__POLLERR[] = "POLLERR";
static char __pyx_k__POLLOUT[] = "POLLOUT";
static char __pyx_k__RCVMORE[] = "RCVMORE";
static char __pyx_k__SNDMORE[] = "SNDMORE";
static char __pyx_k____all__[] = "__all__";
static char __pyx_k____str__[] = "__str__";
static char __pyx_k__cPickle[] = "cPickle";
static char __pyx_k__context[] = "context";
static char __pyx_k__isocket[] = "isocket";
static char __pyx_k__osocket[] = "osocket";
static char __pyx_k__rcvmore[] = "rcvmore";
static char __pyx_k__revents[] = "revents";
static char __pyx_k__sockets[] = "sockets";
static char __pyx_k__timeout[] = "timeout";
static char __pyx_k__zmq_msg[] = "zmq_msg";
static char __pyx_k__AFFINITY[] = "AFFINITY";
static char __pyx_k__EMTHREAD[] = "EMTHREAD";
static char __pyx_k__ENETDOWN[] = "ENETDOWN";
static char __pyx_k__IDENTITY[] = "IDENTITY";
static char __pyx_k__STREAMER[] = "STREAMER";
static char __pyx_k__UPSTREAM[] = "UPSTREAM";
static char __pyx_k__ZMQError[] = "ZMQError";
static char __pyx_k____init__[] = "__init__";
static char __pyx_k____main__[] = "__main__";
static char __pyx_k__copy_mod[] = "copy_mod";
static char __pyx_k__max_port[] = "max_port";
static char __pyx_k__min_port[] = "min_port";
static char __pyx_k__protocol[] = "protocol";
static char __pyx_k__register[] = "register";
static char __pyx_k__strerror[] = "strerror";
static char __pyx_k__Exception[] = "Exception";
static char __pyx_k__FORWARDER[] = "FORWARDER";
static char __pyx_k__SUBSCRIBE[] = "SUBSCRIBE";
static char __pyx_k__TypeError[] = "TypeError";
static char __pyx_k__fast_copy[] = "fast_copy";
static char __pyx_k__max_tries[] = "max_tries";
static char __pyx_k__msg_parts[] = "msg_parts";
static char __pyx_k__randrange[] = "randrange";
static char __pyx_k__DOWNSTREAM[] = "DOWNSTREAM";
static char __pyx_k__EADDRINUSE[] = "EADDRINUSE";
static char __pyx_k__MCAST_LOOP[] = "MCAST_LOOP";
static char __pyx_k__ValueError[] = "ValueError";
static char __pyx_k___recv_copy[] = "_recv_copy";
static char __pyx_k___send_copy[] = "_send_copy";
static char __pyx_k__getsockopt[] = "getsockopt";
static char __pyx_k__io_threads[] = "io_threads";
static char __pyx_k__separators[] = "separators";
static char __pyx_k__simplejson[] = "simplejson";
static char __pyx_k__unregister[] = "unregister";
static char __pyx_k__EINPROGRESS[] = "EINPROGRESS";
static char __pyx_k__ImportError[] = "ImportError";
static char __pyx_k__MemoryError[] = "MemoryError";
static char __pyx_k__UNSUBSCRIBE[] = "UNSUBSCRIBE";
static char __pyx_k__device_type[] = "device_type";
static char __pyx_k__socket_type[] = "socket_type";
static char __pyx_k__zmq_version[] = "zmq_version";
static char __pyx_k__ECONNREFUSED[] = "ECONNREFUSED";
static char __pyx_k__RECOVERY_IVL[] = "RECOVERY_IVL";
static char __pyx_k__ZMQBaseError[] = "ZMQBaseError";
static char __pyx_k__ZMQBindError[] = "ZMQBindError";
static char __pyx_k__EADDRNOTAVAIL[] = "EADDRNOTAVAIL";
static char __pyx_k___check_closed[] = "_check_closed";
static char __pyx_k___recv_message[] = "_recv_message";
static char __pyx_k___send_message[] = "_send_message";
static char __pyx_k__ENOCOMPATPROTO[] = "ENOCOMPATPROTO";
static char __pyx_k__EPROTONOSUPPORT[] = "EPROTONOSUPPORT";
static PyObject *__pyx_kp_s_1;
static PyObject *__pyx_kp_s_10;
static PyObject *__pyx_kp_s_11;
static PyObject *__pyx_kp_s_12;
static PyObject *__pyx_kp_s_13;
static PyObject *__pyx_kp_s_14;
static PyObject *__pyx_kp_s_18;
static PyObject *__pyx_kp_s_19;
static PyObject *__pyx_kp_s_2;
static PyObject *__pyx_kp_s_20;
static PyObject *__pyx_kp_s_3;
static PyObject *__pyx_kp_s_4;
static PyObject *__pyx_kp_s_5;
static PyObject *__pyx_n_s__AFFINITY;
static PyObject *__pyx_n_s__Context;
static PyObject *__pyx_n_s__DOWNSTREAM;
static PyObject *__pyx_n_s__EADDRINUSE;
static PyObject *__pyx_n_s__EADDRNOTAVAIL;
static PyObject *__pyx_n_s__EAGAIN;
static PyObject *__pyx_n_s__ECONNREFUSED;
static PyObject *__pyx_n_s__EFSM;
static PyObject *__pyx_n_s__EINPROGRESS;
static PyObject *__pyx_n_s__EINVAL;
static PyObject *__pyx_n_s__EMTHREAD;
static PyObject *__pyx_n_s__ENETDOWN;
static PyObject *__pyx_n_s__ENOBUFS;
static PyObject *__pyx_n_s__ENOCOMPATPROTO;
static PyObject *__pyx_n_s__ENOTSUP;
static PyObject *__pyx_n_s__EPROTONOSUPPORT;
static PyObject *__pyx_n_s__ETERM;
static PyObject *__pyx_n_s__Exception;
static PyObject *__pyx_n_s__FORWARDER;
static PyObject *__pyx_n_s__HWM;
static PyObject *__pyx_n_s__IDENTITY;
static PyObject *__pyx_n_s__ImportError;
static PyObject *__pyx_n_s__MCAST_LOOP;
static PyObject *__pyx_n_s__MemoryError;
static PyObject *__pyx_n_s__Message;
static PyObject *__pyx_n_s__NOBLOCK;
static PyObject *__pyx_n_s__PAIR;
static PyObject *__pyx_n_s__POLLERR;
static PyObject *__pyx_n_s__POLLIN;
static PyObject *__pyx_n_s__POLLOUT;
static PyObject *__pyx_n_s__PUB;
static PyObject *__pyx_n_s__Poller;
static PyObject *__pyx_n_s__QUEUE;
static PyObject *__pyx_n_s__RATE;
static PyObject *__pyx_n_s__RCVBUF;
static PyObject *__pyx_n_s__RCVMORE;
static PyObject *__pyx_n_s__RECOVERY_IVL;
static PyObject *__pyx_n_s__REP;
static PyObject *__pyx_n_s__REQ;
static PyObject *__pyx_n_s__SNDBUF;
static PyObject *__pyx_n_s__SNDMORE;
static PyObject *__pyx_n_s__STREAMER;
static PyObject *__pyx_n_s__SUB;
static PyObject *__pyx_n_s__SUBSCRIBE;
static PyObject *__pyx_n_s__SWAP;
static PyObject *__pyx_n_s__Socket;
static PyObject *__pyx_n_s__TypeError;
static PyObject *__pyx_n_s__UNSUBSCRIBE;
static PyObject *__pyx_n_s__UPSTREAM;
static PyObject *__pyx_n_s__ValueError;
static PyObject *__pyx_n_s__XREP;
static PyObject *__pyx_n_s__XREQ;
static PyObject *__pyx_n_s__ZMQBaseError;
static PyObject *__pyx_n_s__ZMQBindError;
static PyObject *__pyx_n_s__ZMQError;
static PyObject *__pyx_n_s____all__;
static PyObject *__pyx_n_s____init__;
static PyObject *__pyx_n_s____main__;
static PyObject *__pyx_n_s____str__;
static PyObject *__pyx_n_s___check_closed;
static PyObject *__pyx_n_s___poll;
static PyObject *__pyx_n_s___recv_copy;
static PyObject *__pyx_n_s___recv_message;
static PyObject *__pyx_n_s___send_copy;
static PyObject *__pyx_n_s___send_message;
static PyObject *__pyx_n_s__addr;
static PyObject *__pyx_n_s__bind;
static PyObject *__pyx_n_s__cPickle;
static PyObject *__pyx_n_s__close;
static PyObject *__pyx_n_s__closed;
static PyObject *__pyx_n_s__context;
static PyObject *__pyx_n_s__copy;
static PyObject *__pyx_n_s__copy_mod;
static PyObject *__pyx_n_s__data;
static PyObject *__pyx_n_s__device;
static PyObject *__pyx_n_s__device_type;
static PyObject *__pyx_n_s__dumps;
static PyObject *__pyx_n_s__errno;
static PyObject *__pyx_n_s__error;
static PyObject *__pyx_n_s__events;
static PyObject *__pyx_n_s__fast_copy;
static PyObject *__pyx_n_s__fd;
static PyObject *__pyx_n_s__fileno;
static PyObject *__pyx_n_s__flags;
static PyObject *__pyx_n_s__getsockopt;
static PyObject *__pyx_n_s__handle;
static PyObject *__pyx_n_s__io_threads;
static PyObject *__pyx_n_s__isocket;
static PyObject *__pyx_n_s__items;
static PyObject *__pyx_n_s__json;
static PyObject *__pyx_n_s__loads;
static PyObject *__pyx_n_s__max_port;
static PyObject *__pyx_n_s__max_tries;
static PyObject *__pyx_n_s__min_port;
static PyObject *__pyx_n_s__modify;
static PyObject *__pyx_n_s__msg;
static PyObject *__pyx_n_s__msg_parts;
static PyObject *__pyx_n_s__obj;
static PyObject *__pyx_n_s__object;
static PyObject *__pyx_n_s__option;
static PyObject *__pyx_n_s__optval;
static PyObject *__pyx_n_s__osocket;
static PyObject *__pyx_n_s__pickle;
static PyObject *__pyx_n_s__poll;
static PyObject *__pyx_n_s__protocol;
static PyObject *__pyx_n_s__random;
static PyObject *__pyx_n_s__randrange;
static PyObject *__pyx_n_s__range;
static PyObject *__pyx_n_s__rcvmore;
static PyObject *__pyx_n_s__recv;
static PyObject *__pyx_n_s__register;
static PyObject *__pyx_n_s__revents;
static PyObject *__pyx_n_s__rlist;
static PyObject *__pyx_n_s__select;
static PyObject *__pyx_n_s__self;
static PyObject *__pyx_n_s__send;
static PyObject *__pyx_n_s__separators;
static PyObject *__pyx_n_s__simplejson;
static PyObject *__pyx_n_s__socket;
static PyObject *__pyx_n_s__socket_type;
static PyObject *__pyx_n_s__sockets;
static PyObject *__pyx_n_s__strerror;
static PyObject *__pyx_n_s__struct;
static PyObject *__pyx_n_s__timeout;
static PyObject *__pyx_n_s__unregister;
static PyObject *__pyx_n_s__wlist;
static PyObject *__pyx_n_s__xlist;
static PyObject *__pyx_n_s__zmq_msg;
static PyObject *__pyx_n_s__zmq_version;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_neg_1;
static PyObject *__pyx_int_100;
static PyObject *__pyx_int_2000;
static PyObject *__pyx_int_20000;
static PyObject *__pyx_k_6;
static PyObject *__pyx_k_7;
static PyObject *__pyx_k_8;
static PyObject *__pyx_k_9;
static PyObject *__pyx_k_15;
static PyObject *__pyx_k_16;

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/allocate.pxi":9
 * #---------------------------------------------------------------------
 * 
 * cdef inline void *memnew(size_t n):             # <<<<<<<<<<<<<<
 *     if n == 0: n = 1
 *     return malloc(n)
 */

static CYTHON_INLINE void *__pyx_f_3zmq_4_zmq_memnew(size_t __pyx_v_n) {
  void *__pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("memnew");

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/allocate.pxi":10
 * 
 * cdef inline void *memnew(size_t n):
 *     if n == 0: n = 1             # <<<<<<<<<<<<<<
 *     return malloc(n)
 * 
 */
  __pyx_t_1 = (__pyx_v_n == 0);
  if (__pyx_t_1) {
    __pyx_v_n = 1;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/allocate.pxi":11
 * cdef inline void *memnew(size_t n):
 *     if n == 0: n = 1
 *     return malloc(n)             # <<<<<<<<<<<<<<
 * 
 * cdef inline void memdel(void *p):
 */
  __pyx_r = malloc(__pyx_v_n);
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/allocate.pxi":13
 *     return malloc(n)
 * 
 * cdef inline void memdel(void *p):             # <<<<<<<<<<<<<<
 *     if p != NULL: free(p)
 * 
 */

static CYTHON_INLINE void __pyx_f_3zmq_4_zmq_memdel(void *__pyx_v_p) {
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("memdel");

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/allocate.pxi":14
 * 
 * cdef inline void memdel(void *p):
 *     if p != NULL: free(p)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object allocate(size_t n, void **pp):
 */
  __pyx_t_1 = (__pyx_v_p != NULL);
  if (__pyx_t_1) {
    free(__pyx_v_p);
    goto __pyx_L3;
  }
  __pyx_L3:;

  __Pyx_RefNannyFinishContext();
}

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/allocate.pxi":16
 *     if p != NULL: free(p)
 * 
 * cdef inline object allocate(size_t n, void **pp):             # <<<<<<<<<<<<<<
 *     cdef object cob
 *     cdef void *p = memnew(n)
 */

static CYTHON_INLINE PyObject *__pyx_f_3zmq_4_zmq_allocate(size_t __pyx_v_n, void **__pyx_v_pp) {
  PyObject *__pyx_v_cob;
  void *__pyx_v_p;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("allocate");
  __pyx_v_cob = Py_None; __Pyx_INCREF(Py_None);

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/allocate.pxi":18
 * cdef inline object allocate(size_t n, void **pp):
 *     cdef object cob
 *     cdef void *p = memnew(n)             # <<<<<<<<<<<<<<
 *     if p == NULL: raise MemoryError
 *     try:    cob = PyCObject_FromVoidPtr(p, memdel)
 */
  __pyx_v_p = __pyx_f_3zmq_4_zmq_memnew(__pyx_v_n);

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/allocate.pxi":19
 *     cdef object cob
 *     cdef void *p = memnew(n)
 *     if p == NULL: raise MemoryError             # <<<<<<<<<<<<<<
 *     try:    cob = PyCObject_FromVoidPtr(p, memdel)
 *     except: memdel(p); raise
 */
  __pyx_t_1 = (__pyx_v_p == NULL);
  if (__pyx_t_1) {
    __Pyx_Raise(__pyx_builtin_MemoryError, 0, 0);
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/allocate.pxi":20
 *     cdef void *p = memnew(n)
 *     if p == NULL: raise MemoryError
 *     try:    cob = PyCObject_FromVoidPtr(p, memdel)             # <<<<<<<<<<<<<<
 *     except: memdel(p); raise
 *     pp[0] = p
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {
      __pyx_t_2 = PyCObject_FromVoidPtr(__pyx_v_p, __pyx_f_3zmq_4_zmq_memdel); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_v_cob);
      __pyx_v_cob = __pyx_t_2;
      __pyx_t_2 = 0;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L11_try_end;
    __pyx_L4_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/allocate.pxi":21
 *     if p == NULL: raise MemoryError
 *     try:    cob = PyCObject_FromVoidPtr(p, memdel)
 *     except: memdel(p); raise             # <<<<<<<<<<<<<<
 *     pp[0] = p
 *     return cob
 */
    /*except:*/ {
      __Pyx_AddTraceback("zmq._zmq.allocate");
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_f_3zmq_4_zmq_memdel(__pyx_v_p);
      __Pyx_GIVEREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_ErrRestore(__pyx_t_2, __pyx_t_3, __pyx_t_4);
      __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0; 
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L5_exception_handled;
    }
    __pyx_L6_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L5_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L11_try_end:;
  }

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/allocate.pxi":22
 *     try:    cob = PyCObject_FromVoidPtr(p, memdel)
 *     except: memdel(p); raise
 *     pp[0] = p             # <<<<<<<<<<<<<<
 *     return cob
 */
  (__pyx_v_pp[0]) = __pyx_v_p;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/allocate.pxi":23
 *     except: memdel(p); raise
 *     pp[0] = p
 *     return cob             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_cob);
  __pyx_r = __pyx_v_cob;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("zmq._zmq.allocate");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_cob);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":239
 * 
 * 
 * def strerror(errnum):             # <<<<<<<<<<<<<<
 *     """Return the error string given the error number."""
 *     return zmq_strerror(errnum)
 */

static PyObject *__pyx_pf_3zmq_4_zmq_strerror(PyObject *__pyx_self, PyObject *__pyx_v_errnum); /*proto*/
static char __pyx_doc_3zmq_4_zmq_strerror[] = "Return the error string given the error number.";
static PyObject *__pyx_pf_3zmq_4_zmq_strerror(PyObject *__pyx_self, PyObject *__pyx_v_errnum) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("strerror");
  __pyx_self = __pyx_self;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":241
 * def strerror(errnum):
 *     """Return the error string given the error number."""
 *     return zmq_strerror(errnum)             # <<<<<<<<<<<<<<
 * 
 * class ZMQBaseError(Exception):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_errnum); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = __Pyx_PyBytes_FromString(zmq_strerror(__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __pyx_r = ((PyObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("zmq._zmq.strerror");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":249
 *     """Base exception class for 0MQ errors in Python."""
 * 
 *     def __init__(self, error=None):             # <<<<<<<<<<<<<<
 *         """Wrap an errno style error.
 * 
 */

static PyObject *__pyx_pf_3zmq_4_zmq_8ZMQError___init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3zmq_4_zmq_8ZMQError___init__[] = "Wrap an errno style error.\n\n        Parameters\n        ----------\n        error : int\n            The ZMQ errno or None.  If None, then zmq_errno() is called and\n            used.\n        ";
static PyMethodDef __pyx_mdef_3zmq_4_zmq_8ZMQError___init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pf_3zmq_4_zmq_8ZMQError___init__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4_zmq_8ZMQError___init__)};
static PyObject *__pyx_pf_3zmq_4_zmq_8ZMQError___init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_error = 0;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__error,0};
  __Pyx_RefNannySetupContext("__init__");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__error);
        if (unlikely(value)) { values[1] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_self = values[0];
    __pyx_v_error = values[1];
  } else {
    __pyx_v_error = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_error = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("zmq._zmq.ZMQError.__init__");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_self);
  __Pyx_INCREF(__pyx_v_error);

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":258
 *             used.
 *         """
 *         if error is None:             # <<<<<<<<<<<<<<
 *             error = zmq_errno()
 *         if type(error) == int:
 */
  __pyx_t_1 = (__pyx_v_error == Py_None);
  if (__pyx_t_1) {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":259
 *         """
 *         if error is None:
 *             error = zmq_errno()             # <<<<<<<<<<<<<<
 *         if type(error) == int:
 *             self.strerror = strerror(error)
 */
    __pyx_t_2 = PyInt_FromLong(zmq_errno()); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_v_error);
    __pyx_v_error = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":260
 *         if error is None:
 *             error = zmq_errno()
 *         if type(error) == int:             # <<<<<<<<<<<<<<
 *             self.strerror = strerror(error)
 *             self.errno = error
 */
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_error)), ((PyObject *)((PyObject*)&PyInt_Type)), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_1) {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":261
 *             error = zmq_errno()
 *         if type(error) == int:
 *             self.strerror = strerror(error)             # <<<<<<<<<<<<<<
 *             self.errno = error
 *         else:
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__strerror); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_error);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_error);
    __Pyx_GIVEREF(__pyx_v_error);
    __pyx_t_4 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__strerror, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":262
 *         if type(error) == int:
 *             self.strerror = strerror(error)
 *             self.errno = error             # <<<<<<<<<<<<<<
 *         else:
 *             self.strerror = str(error)
 */
    if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__errno, __pyx_v_error) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L7;
  }
  /*else*/ {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":264
 *             self.errno = error
 *         else:
 *             self.strerror = str(error)             # <<<<<<<<<<<<<<
 *             self.errno = None
 * 
 */
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_error);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_error);
    __Pyx_GIVEREF(__pyx_v_error);
    __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)&PyString_Type)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__strerror, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":265
 *         else:
 *             self.strerror = str(error)
 *             self.errno = None             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
 */
    if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__errno, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L7:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("zmq._zmq.ZMQError.__init__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_self);
  __Pyx_DECREF(__pyx_v_error);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":267
 *             self.errno = None
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return self.strerror
 * 
 */

static PyObject *__pyx_pf_3zmq_4_zmq_8ZMQError___str__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_3zmq_4_zmq_8ZMQError___str__ = {__Pyx_NAMESTR("__str__"), (PyCFunction)__pyx_pf_3zmq_4_zmq_8ZMQError___str__, METH_O, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pf_3zmq_4_zmq_8ZMQError___str__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__str__");
  __pyx_self = __pyx_self;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":268
 * 
 *     def __str__(self):
 *         return self.strerror             # <<<<<<<<<<<<<<
 * 
 * class ZMQBindError(ZMQBaseError):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__strerror); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("zmq._zmq.ZMQError.__str__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":279
 * 
 * 
 * def zmq_version():             # <<<<<<<<<<<<<<
 *     """Return the version of ZeroMQ itself."""
 *     cdef int major, minor, patch
 */

static PyObject *__pyx_pf_3zmq_4_zmq_zmq_version(PyObject *__pyx_self, PyObject *unused); /*proto*/
static char __pyx_doc_3zmq_4_zmq_zmq_version[] = "Return the version of ZeroMQ itself.";
static PyObject *__pyx_pf_3zmq_4_zmq_zmq_version(PyObject *__pyx_self, PyObject *unused) {
  int __pyx_v_major;
  int __pyx_v_minor;
  int __pyx_v_patch;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("zmq_version");
  __pyx_self = __pyx_self;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":282
 *     """Return the version of ZeroMQ itself."""
 *     cdef int major, minor, patch
 *     _zmq_version(&major, &minor, &patch)             # <<<<<<<<<<<<<<
 *     return '%i.%i.%i' % (major, minor, patch)
 * 
 */
  zmq_version((&__pyx_v_major), (&__pyx_v_minor), (&__pyx_v_patch));

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":283
 *     cdef int major, minor, patch
 *     _zmq_version(&major, &minor, &patch)
 *     return '%i.%i.%i' % (major, minor, patch)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(__pyx_v_major); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyInt_FromLong(__pyx_v_minor); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyInt_FromLong(__pyx_v_patch); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("zmq._zmq.zmq_version");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":286
 * 
 * 
 * cdef void free_python_msg(void *data, void *hint) with gil:             # <<<<<<<<<<<<<<
 *     """A function for DECREF'ing Python based messages."""
 *     if hint != NULL:
 */

static  void __pyx_f_3zmq_4_zmq_free_python_msg(void *__pyx_v_data, void *__pyx_v_hint) {
  int __pyx_t_1;
  PyGILState_STATE _save = PyGILState_Ensure();
  __Pyx_RefNannySetupContext("free_python_msg");

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":288
 * cdef void free_python_msg(void *data, void *hint) with gil:
 *     """A function for DECREF'ing Python based messages."""
 *     if hint != NULL:             # <<<<<<<<<<<<<<
 *         Py_DECREF(<object>hint)
 * 
 */
  __pyx_t_1 = (__pyx_v_hint != NULL);
  if (__pyx_t_1) {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":289
 *     """A function for DECREF'ing Python based messages."""
 *     if hint != NULL:
 *         Py_DECREF(<object>hint)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    Py_DECREF(((PyObject *)__pyx_v_hint));
    goto __pyx_L3;
  }
  __pyx_L3:;

  __Pyx_RefNannyFinishContext();
  PyGILState_Release(_save);
}

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":308
 *     cdef object data
 * 
 *     def __cinit__(self, object data=None):             # <<<<<<<<<<<<<<
 *         cdef int rc
 *         # Save the data object in case the user wants the the data as a str.
 */

static int __pyx_pf_3zmq_4_zmq_7Message___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_3zmq_4_zmq_7Message___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_data = 0;
  int __pyx_v_rc;
  char *__pyx_v_data_c;
  Py_ssize_t __pyx_v_data_len_c;
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__data,0};
  __Pyx_RefNannySetupContext("__cinit__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    values[0] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 1) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data);
        if (unlikely(value)) { values[0] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_data = values[0];
  } else {
    __pyx_v_data = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: __pyx_v_data = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("zmq._zmq.Message.__cinit__");
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_v_data);

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":311
 *         cdef int rc
 *         # Save the data object in case the user wants the the data as a str.
 *         self.data = data             # <<<<<<<<<<<<<<
 *         cdef char *data_c = NULL
 *         cdef Py_ssize_t data_len_c
 */
  __Pyx_INCREF(__pyx_v_data);
  __Pyx_GIVEREF(__pyx_v_data);
  __Pyx_GOTREF(((struct __pyx_obj_3zmq_4_zmq_Message *)__pyx_v_self)->data);
  __Pyx_DECREF(((struct __pyx_obj_3zmq_4_zmq_Message *)__pyx_v_self)->data);
  ((struct __pyx_obj_3zmq_4_zmq_Message *)__pyx_v_self)->data = __pyx_v_data;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":312
 *         # Save the data object in case the user wants the the data as a str.
 *         self.data = data
 *         cdef char *data_c = NULL             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t data_len_c
 * 
 */
  __pyx_v_data_c = NULL;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":315
 *         cdef Py_ssize_t data_len_c
 * 
 *         if data is None:             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 rc = zmq_msg_init(&self.zmq_msg)
 */
  __pyx_t_1 = (__pyx_v_data == Py_None);
  if (__pyx_t_1) {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":316
 * 
 *         if data is None:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 rc = zmq_msg_init(&self.zmq_msg)
 *             if rc != 0:
 */
    { PyThreadState *_save;
      Py_UNBLOCK_THREADS
      /*try:*/ {

        /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":317
 *         if data is None:
 *             with nogil:
 *                 rc = zmq_msg_init(&self.zmq_msg)             # <<<<<<<<<<<<<<
 *             if rc != 0:
 *                 raise ZMQError()
 */
        __pyx_v_rc = zmq_msg_init((&((struct __pyx_obj_3zmq_4_zmq_Message *)__pyx_v_self)->zmq_msg));
      }
      /*finally:*/ {

        /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":316
 * 
 *         if data is None:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 rc = zmq_msg_init(&self.zmq_msg)
 *             if rc != 0:
 */
        Py_BLOCK_THREADS
      }
    }

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":318
 *             with nogil:
 *                 rc = zmq_msg_init(&self.zmq_msg)
 *             if rc != 0:             # <<<<<<<<<<<<<<
 *                 raise ZMQError()
 *         else:
 */
    __pyx_t_1 = (__pyx_v_rc != 0);
    if (__pyx_t_1) {

      /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":319
 *                 rc = zmq_msg_init(&self.zmq_msg)
 *             if rc != 0:
 *                 raise ZMQError()             # <<<<<<<<<<<<<<
 *         else:
 *             PyString_AsStringAndSize(data, &data_c, &data_len_c)
 */
      __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_Raise(__pyx_t_3, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L10;
    }
    __pyx_L10:;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":321
 *                 raise ZMQError()
 *         else:
 *             PyString_AsStringAndSize(data, &data_c, &data_len_c)             # <<<<<<<<<<<<<<
 *             # We INCREF the *original* Python object (not self) and pass it
 *             # as the hint below. This allows other copies of this Message
 */
    __pyx_t_4 = PyString_AsStringAndSize(__pyx_v_data, (&__pyx_v_data_c), (&__pyx_v_data_len_c)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":325
 *             # as the hint below. This allows other copies of this Message
 *             # object to take over the ref counting of data properly.
 *             Py_INCREF(data)             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 rc = zmq_msg_init_data(
 */
    Py_INCREF(__pyx_v_data);

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":326
 *             # object to take over the ref counting of data properly.
 *             Py_INCREF(data)
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 rc = zmq_msg_init_data(
 *                     &self.zmq_msg, <void *>data_c, data_len_c,
 */
    { PyThreadState *_save;
      Py_UNBLOCK_THREADS
      /*try:*/ {

        /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":330
 *                     &self.zmq_msg, <void *>data_c, data_len_c,
 *                     <zmq_free_fn *>free_python_msg, <void *>data
 *                 )             # <<<<<<<<<<<<<<
 *             if rc != 0:
 *                 Py_DECREF(data)
 */
        __pyx_v_rc = zmq_msg_init_data((&((struct __pyx_obj_3zmq_4_zmq_Message *)__pyx_v_self)->zmq_msg), ((void *)__pyx_v_data_c), __pyx_v_data_len_c, ((zmq_free_fn *)__pyx_f_3zmq_4_zmq_free_python_msg), ((void *)__pyx_v_data));
      }
      /*finally:*/ {

        /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":326
 *             # object to take over the ref counting of data properly.
 *             Py_INCREF(data)
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 rc = zmq_msg_init_data(
 *                     &self.zmq_msg, <void *>data_c, data_len_c,
 */
        Py_BLOCK_THREADS
      }
    }

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":331
 *                     <zmq_free_fn *>free_python_msg, <void *>data
 *                 )
 *             if rc != 0:             # <<<<<<<<<<<<<<
 *                 Py_DECREF(data)
 *                 raise ZMQError()
 */
    __pyx_t_1 = (__pyx_v_rc != 0);
    if (__pyx_t_1) {

      /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":332
 *                 )
 *             if rc != 0:
 *                 Py_DECREF(data)             # <<<<<<<<<<<<<<
 *                 raise ZMQError()
 * 
 */
      Py_DECREF(__pyx_v_data);

      /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":333
 *             if rc != 0:
 *                 Py_DECREF(data)
 *                 raise ZMQError()             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
      __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_Raise(__pyx_t_2, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L14;
    }
    __pyx_L14:;
  }
  __pyx_L6:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("zmq._zmq.Message.__cinit__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_self);
  __Pyx_DECREF(__pyx_v_data);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":335
 *                 raise ZMQError()
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         cdef int rc
 *         # This simply decreases the 0MQ ref-count of zmq_msg.
 */

static void __pyx_pf_3zmq_4_zmq_7Message___dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pf_3zmq_4_zmq_7Message___dealloc__(PyObject *__pyx_v_self) {
  int __pyx_v_rc;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__dealloc__");
  __Pyx_INCREF((PyObject *)__pyx_v_self);

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":338
 *         cdef int rc
 *         # This simply decreases the 0MQ ref-count of zmq_msg.
 *         rc = zmq_msg_close(&self.zmq_msg)             # <<<<<<<<<<<<<<
 *         if rc != 0:
 *             raise ZMQError()
 */
  __pyx_v_rc = zmq_msg_close((&((struct __pyx_obj_3zmq_4_zmq_Message *)__pyx_v_self)->zmq_msg));

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":339
 *         # This simply decreases the 0MQ ref-count of zmq_msg.
 *         rc = zmq_msg_close(&self.zmq_msg)
 *         if rc != 0:             # <<<<<<<<<<<<<<
 *             raise ZMQError()
 * 
 */
  __pyx_t_1 = (__pyx_v_rc != 0);
  if (__pyx_t_1) {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":340
 *         rc = zmq_msg_close(&self.zmq_msg)
 *         if rc != 0:
 *             raise ZMQError()             # <<<<<<<<<<<<<<
 * 
 *     def __copy__(self):
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("zmq._zmq.Message.__dealloc__");
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_self);
  __Pyx_RefNannyFinishContext();
}

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":342
 *             raise ZMQError()
 * 
 *     def __copy__(self):             # <<<<<<<<<<<<<<
 *         """Create a shallow copy of the message.
 * 
 */

static PyObject *__pyx_pf_3zmq_4_zmq_7Message___copy__(PyObject *__pyx_v_self, PyObject *unused); /*proto*/
static char __pyx_doc_3zmq_4_zmq_7Message___copy__[] = "Create a shallow copy of the message.\n\n        This does not copy the contents of the Message, just the pointer.\n        This will increment the 0MQ ref count of the message, but not\n        the ref count of the Python object. That is only done once when\n        the Python is first turned into a 0MQ message.\n        ";
static PyObject *__pyx_pf_3zmq_4_zmq_7Message___copy__(PyObject *__pyx_v_self, PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__copy__");

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":350
 *         the Python is first turned into a 0MQ message.
 *         """
 *         return self.fast_copy()             # <<<<<<<<<<<<<<
 * 
 *     cdef Message fast_copy(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_3zmq_4_zmq_Message *)((struct __pyx_obj_3zmq_4_zmq_Message *)__pyx_v_self)->__pyx_vtab)->fast_copy(((struct __pyx_obj_3zmq_4_zmq_Message *)__pyx_v_self))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("zmq._zmq.Message.__copy__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":352
 *         return self.fast_copy()
 * 
 *     cdef Message fast_copy(self):             # <<<<<<<<<<<<<<
 *         """Fast, cdef'd version of shallow copy of the message."""
 *         cdef Message new_msg
 */

static  struct __pyx_obj_3zmq_4_zmq_Message *__pyx_f_3zmq_4_zmq_7Message_fast_copy(struct __pyx_obj_3zmq_4_zmq_Message *__pyx_v_self) {
  struct __pyx_obj_3zmq_4_zmq_Message *__pyx_v_new_msg;
  struct __pyx_obj_3zmq_4_zmq_Message *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("fast_copy");
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __pyx_v_new_msg = ((struct __pyx_obj_3zmq_4_zmq_Message *)Py_None); __Pyx_INCREF(Py_None);

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":355
 *         """Fast, cdef'd version of shallow copy of the message."""
 *         cdef Message new_msg
 *         new_msg = Message()             # <<<<<<<<<<<<<<
 *         # This does not copy the contents, but just increases the ref-count
 *         # of the zmq_msg by one.
 */
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3zmq_4_zmq_Message)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_new_msg));
  __pyx_v_new_msg = ((struct __pyx_obj_3zmq_4_zmq_Message *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":358
 *         # This does not copy the contents, but just increases the ref-count
 *         # of the zmq_msg by one.
 *         zmq_msg_copy(&new_msg.zmq_msg, &self.zmq_msg)             # <<<<<<<<<<<<<<
 *         # Copy the ref to data so the copy won't create a copy when str is
 *         # called.
 */
  zmq_msg_copy((&__pyx_v_new_msg->zmq_msg), (&__pyx_v_self->zmq_msg));

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":361
 *         # Copy the ref to data so the copy won't create a copy when str is
 *         # called.
 *         if self.data is not None:             # <<<<<<<<<<<<<<
 *             new_msg.data = self.data
 *         return new_msg
 */
  __pyx_t_2 = (__pyx_v_self->data != Py_None);
  if (__pyx_t_2) {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":362
 *         # called.
 *         if self.data is not None:
 *             new_msg.data = self.data             # <<<<<<<<<<<<<<
 *         return new_msg
 * 
 */
    __Pyx_INCREF(__pyx_v_self->data);
    __Pyx_GIVEREF(__pyx_v_self->data);
    __Pyx_GOTREF(__pyx_v_new_msg->data);
    __Pyx_DECREF(__pyx_v_new_msg->data);
    __pyx_v_new_msg->data = __pyx_v_self->data;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":363
 *         if self.data is not None:
 *             new_msg.data = self.data
 *         return new_msg             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_new_msg));
  __pyx_r = __pyx_v_new_msg;
  goto __pyx_L0;

  __pyx_r = ((struct __pyx_obj_3zmq_4_zmq_Message *)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("zmq._zmq.Message.fast_copy");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_new_msg);
  __Pyx_DECREF((PyObject *)__pyx_v_self);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":365
 *         return new_msg
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         """Return the length of the message in bytes."""
 *         return <int>zmq_msg_size(&self.zmq_msg)
 */

static Py_ssize_t __pyx_pf_3zmq_4_zmq_7Message___len__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_3zmq_4_zmq_7Message___len__[] = "Return the length of the message in bytes.";
static Py_ssize_t __pyx_pf_3zmq_4_zmq_7Message___len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannySetupContext("__len__");

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":367
 *     def __len__(self):
 *         """Return the length of the message in bytes."""
 *         return <int>zmq_msg_size(&self.zmq_msg)             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
 */
  __pyx_r = ((int)zmq_msg_size((&((struct __pyx_obj_3zmq_4_zmq_Message *)__pyx_v_self)->zmq_msg)));
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":369
 *         return <int>zmq_msg_size(&self.zmq_msg)
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         """Return the str form of the message."""
 *         cdef char *data_c = NULL
 */

static PyObject *__pyx_pf_3zmq_4_zmq_7Message___str__(PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_3zmq_4_zmq_7Message___str__[] = "Return the str form of the message.";
static PyObject *__pyx_pf_3zmq_4_zmq_7Message___str__(PyObject *__pyx_v_self) {
  char *__pyx_v_data_c;
  Py_ssize_t __pyx_v_data_len_c;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__str__");
  __Pyx_INCREF((PyObject *)__pyx_v_self);

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":371
 *     def __str__(self):
 *         """Return the str form of the message."""
 *         cdef char *data_c = NULL             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t data_len_c
 *         if self.data is None:
 */
  __pyx_v_data_c = NULL;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":373
 *         cdef char *data_c = NULL
 *         cdef Py_ssize_t data_len_c
 *         if self.data is None:             # <<<<<<<<<<<<<<
 *             data_c = <char *>zmq_msg_data(&self.zmq_msg)
 *             data_len_c = zmq_msg_size(&self.zmq_msg)
 */
  __pyx_t_1 = (((struct __pyx_obj_3zmq_4_zmq_Message *)__pyx_v_self)->data == Py_None);
  if (__pyx_t_1) {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":374
 *         cdef Py_ssize_t data_len_c
 *         if self.data is None:
 *             data_c = <char *>zmq_msg_data(&self.zmq_msg)             # <<<<<<<<<<<<<<
 *             data_len_c = zmq_msg_size(&self.zmq_msg)
 *             return PyString_FromStringAndSize(data_c, data_len_c)
 */
    __pyx_v_data_c = ((char *)zmq_msg_data((&((struct __pyx_obj_3zmq_4_zmq_Message *)__pyx_v_self)->zmq_msg)));

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":375
 *         if self.data is None:
 *             data_c = <char *>zmq_msg_data(&self.zmq_msg)
 *             data_len_c = zmq_msg_size(&self.zmq_msg)             # <<<<<<<<<<<<<<
 *             return PyString_FromStringAndSize(data_c, data_len_c)
 *         else:
 */
    __pyx_v_data_len_c = zmq_msg_size((&((struct __pyx_obj_3zmq_4_zmq_Message *)__pyx_v_self)->zmq_msg));

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":376
 *             data_c = <char *>zmq_msg_data(&self.zmq_msg)
 *             data_len_c = zmq_msg_size(&self.zmq_msg)
 *             return PyString_FromStringAndSize(data_c, data_len_c)             # <<<<<<<<<<<<<<
 *         else:
 *             return self.data
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyString_FromStringAndSize(__pyx_v_data_c, __pyx_v_data_len_c); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":378
 *             return PyString_FromStringAndSize(data_c, data_len_c)
 *         else:
 *             return self.data             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((struct __pyx_obj_3zmq_4_zmq_Message *)__pyx_v_self)->data);
    __pyx_r = ((struct __pyx_obj_3zmq_4_zmq_Message *)__pyx_v_self)->data;
    goto __pyx_L0;
  }
  __pyx_L5:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("zmq._zmq.Message.__str__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_self);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":395
 *     cdef void *handle
 * 
 *     def __cinit__(self, int io_threads=1):             # <<<<<<<<<<<<<<
 *         self.handle = NULL
 *         if not io_threads > 0:
 */

static int __pyx_pf_3zmq_4_zmq_7Context___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_3zmq_4_zmq_7Context___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_io_threads;
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__io_threads,0};
  __Pyx_RefNannySetupContext("__cinit__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 1) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__io_threads);
        if (unlikely(value)) { values[0] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    if (values[0]) {
      __pyx_v_io_threads = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_io_threads == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_io_threads = ((int)1);
    }
  } else {
    __pyx_v_io_threads = ((int)1);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: __pyx_v_io_threads = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_io_threads == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("zmq._zmq.Context.__cinit__");
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF((PyObject *)__pyx_v_self);

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":396
 * 
 *     def __cinit__(self, int io_threads=1):
 *         self.handle = NULL             # <<<<<<<<<<<<<<
 *         if not io_threads > 0:
 *             raise ZMQError(EINVAL)
 */
  ((struct __pyx_obj_3zmq_4_zmq_Context *)__pyx_v_self)->handle = NULL;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":397
 *     def __cinit__(self, int io_threads=1):
 *         self.handle = NULL
 *         if not io_threads > 0:             # <<<<<<<<<<<<<<
 *             raise ZMQError(EINVAL)
 *         self.handle = zmq_init(io_threads)
 */
  __pyx_t_1 = (!(__pyx_v_io_threads > 0));
  if (__pyx_t_1) {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":398
 *         self.handle = NULL
 *         if not io_threads > 0:
 *             raise ZMQError(EINVAL)             # <<<<<<<<<<<<<<
 *         self.handle = zmq_init(io_threads)
 *         if self.handle == NULL:
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__EINVAL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":399
 *         if not io_threads > 0:
 *             raise ZMQError(EINVAL)
 *         self.handle = zmq_init(io_threads)             # <<<<<<<<<<<<<<
 *         if self.handle == NULL:
 *             raise ZMQError()
 */
  ((struct __pyx_obj_3zmq_4_zmq_Context *)__pyx_v_self)->handle = zmq_init(__pyx_v_io_threads);

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":400
 *             raise ZMQError(EINVAL)
 *         self.handle = zmq_init(io_threads)
 *         if self.handle == NULL:             # <<<<<<<<<<<<<<
 *             raise ZMQError()
 * 
 */
  __pyx_t_1 = (((struct __pyx_obj_3zmq_4_zmq_Context *)__pyx_v_self)->handle == NULL);
  if (__pyx_t_1) {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":401
 *         self.handle = zmq_init(io_threads)
 *         if self.handle == NULL:
 *             raise ZMQError()             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L7;
  }
  __pyx_L7:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("zmq._zmq.Context.__cinit__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_self);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":403
 *             raise ZMQError()
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         cdef int rc
 *         if self.handle != NULL:
 */

static void __pyx_pf_3zmq_4_zmq_7Context___dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pf_3zmq_4_zmq_7Context___dealloc__(PyObject *__pyx_v_self) {
  int __pyx_v_rc;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__dealloc__");
  __Pyx_INCREF((PyObject *)__pyx_v_self);

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":405
 *     def __dealloc__(self):
 *         cdef int rc
 *         if self.handle != NULL:             # <<<<<<<<<<<<<<
 *             rc = zmq_term(self.handle)
 *             if rc != 0:
 */
  __pyx_t_1 = (((struct __pyx_obj_3zmq_4_zmq_Context *)__pyx_v_self)->handle != NULL);
  if (__pyx_t_1) {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":406
 *         cdef int rc
 *         if self.handle != NULL:
 *             rc = zmq_term(self.handle)             # <<<<<<<<<<<<<<
 *             if rc != 0:
 *                 raise ZMQError()
 */
    __pyx_v_rc = zmq_term(((struct __pyx_obj_3zmq_4_zmq_Context *)__pyx_v_self)->handle);

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":407
 *         if self.handle != NULL:
 *             rc = zmq_term(self.handle)
 *             if rc != 0:             # <<<<<<<<<<<<<<
 *                 raise ZMQError()
 * 
 */
    __pyx_t_1 = (__pyx_v_rc != 0);
    if (__pyx_t_1) {

      /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":408
 *             rc = zmq_term(self.handle)
 *             if rc != 0:
 *                 raise ZMQError()             # <<<<<<<<<<<<<<
 * 
 *     def socket(self, int socket_type):
 */
      __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_Raise(__pyx_t_3, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L6;
    }
    __pyx_L6:;
    goto __pyx_L5;
  }
  __pyx_L5:;

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("zmq._zmq.Context.__dealloc__");
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_self);
  __Pyx_RefNannyFinishContext();
}

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":410
 *                 raise ZMQError()
 * 
 *     def socket(self, int socket_type):             # <<<<<<<<<<<<<<
 *         """Create a Socket associated with this Context.
 * 
 */

static PyObject *__pyx_pf_3zmq_4_zmq_7Context_socket(PyObject *__pyx_v_self, PyObject *__pyx_arg_socket_type); /*proto*/
static char __pyx_doc_3zmq_4_zmq_7Context_socket[] = "Create a Socket associated with this Context.\n\n        Parameters\n        ----------\n        socket_type : int\n            The socket type, which can be any of the 0MQ socket types: \n            REQ, REP, PUB, SUB, PAIR, XREQ, XREP, UPSTREAM, DOWNSTREAM.\n        ";
static PyObject *__pyx_pf_3zmq_4_zmq_7Context_socket(PyObject *__pyx_v_self, PyObject *__pyx_arg_socket_type) {
  int __pyx_v_socket_type;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("socket");
  assert(__pyx_arg_socket_type); {
    __pyx_v_socket_type = __Pyx_PyInt_AsInt(__pyx_arg_socket_type); if (unlikely((__pyx_v_socket_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("zmq._zmq.Context.socket");
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":419
 *             REQ, REP, PUB, SUB, PAIR, XREQ, XREP, UPSTREAM, DOWNSTREAM.
 *         """
 *         return Socket(self, socket_type)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(__pyx_v_socket_type); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3zmq_4_zmq_Socket)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("zmq._zmq.Context.socket");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":440
 *     # Hold on to a reference to the context to make sure it is not garbage
 *     # collected until the socket it done with it.
 *     cdef public Context context             # <<<<<<<<<<<<<<
 *     cdef public object closed
 * 
 */

static PyObject *__pyx_pf_3zmq_4_zmq_6Socket_7context___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_3zmq_4_zmq_6Socket_7context___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_3zmq_4_zmq_Socket *)__pyx_v_self)->context));
  __pyx_r = ((PyObject *)((struct __pyx_obj_3zmq_4_zmq_Socket *)__pyx_v_self)->context);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_3zmq_4_zmq_6Socket_7context___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_3zmq_4_zmq_6Socket_7context___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_3zmq_4_zmq_Context))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_3zmq_4_zmq_Socket *)__pyx_v_self)->context);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_3zmq_4_zmq_Socket *)__pyx_v_self)->context));
  ((struct __pyx_obj_3zmq_4_zmq_Socket *)__pyx_v_self)->context = ((struct __pyx_obj_3zmq_4_zmq_Context *)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("zmq._zmq.Socket.context.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":443
 *     cdef public object closed
 * 
 *     def __cinit__(self, Context context, int socket_type):             # <<<<<<<<<<<<<<
 *         self.handle = NULL
 *         self.context = context
 */

static int __pyx_pf_3zmq_4_zmq_6Socket___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_3zmq_4_zmq_6Socket___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_3zmq_4_zmq_Context *__pyx_v_context = 0;
  int __pyx_v_socket_type;
  int __pyx_r;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__context,&__pyx_n_s__socket_type,0};
  __Pyx_RefNannySetupContext("__cinit__");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__context);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__socket_type);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_context = ((struct __pyx_obj_3zmq_4_zmq_Context *)values[0]);
    __pyx_v_socket_type = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_socket_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_context = ((struct __pyx_obj_3zmq_4_zmq_Context *)PyTuple_GET_ITEM(__pyx_args, 0));
    __pyx_v_socket_type = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_socket_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("zmq._zmq.Socket.__cinit__");
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_INCREF((PyObject *)__pyx_v_context);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_context), __pyx_ptype_3zmq_4_zmq_Context, 1, "context", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":444
 * 
 *     def __cinit__(self, Context context, int socket_type):
 *         self.handle = NULL             # <<<<<<<<<<<<<<
 *         self.context = context
 *         self.socket_type = socket_type
 */
  ((struct __pyx_obj_3zmq_4_zmq_Socket *)__pyx_v_self)->handle = NULL;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":445
 *     def __cinit__(self, Context context, int socket_type):
 *         self.handle = NULL
 *         self.context = context             # <<<<<<<<<<<<<<
 *         self.socket_type = socket_type
 *         self.handle = zmq_socket(context.handle, socket_type)
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_context));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_context));
  __Pyx_GOTREF(((struct __pyx_obj_3zmq_4_zmq_Socket *)__pyx_v_self)->context);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_3zmq_4_zmq_Socket *)__pyx_v_self)->context));
  ((struct __pyx_obj_3zmq_4_zmq_Socket *)__pyx_v_self)->context = __pyx_v_context;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":446
 *         self.handle = NULL
 *         self.context = context
 *         self.socket_type = socket_type             # <<<<<<<<<<<<<<
 *         self.handle = zmq_socket(context.handle, socket_type)
 *         if self.handle == NULL:
 */
  ((struct __pyx_obj_3zmq_4_zmq_Socket *)__pyx_v_self)->socket_type = __pyx_v_socket_type;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":447
 *         self.context = context
 *         self.socket_type = socket_type
 *         self.handle = zmq_socket(context.handle, socket_type)             # <<<<<<<<<<<<<<
 *         if self.handle == NULL:
 *             raise ZMQError()
 */
  ((struct __pyx_obj_3zmq_4_zmq_Socket *)__pyx_v_self)->handle = zmq_socket(__pyx_v_context->handle, __pyx_v_socket_type);

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":448
 *         self.socket_type = socket_type
 *         self.handle = zmq_socket(context.handle, socket_type)
 *         if self.handle == NULL:             # <<<<<<<<<<<<<<
 *             raise ZMQError()
 *         self.closed = False
 */
  __pyx_t_1 = (((struct __pyx_obj_3zmq_4_zmq_Socket *)__pyx_v_self)->handle == NULL);
  if (__pyx_t_1) {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":449
 *         self.handle = zmq_socket(context.handle, socket_type)
 *         if self.handle == NULL:
 *             raise ZMQError()             # <<<<<<<<<<<<<<
 *         self.closed = False
 * 
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":450
 *         if self.handle == NULL:
 *             raise ZMQError()
 *         self.closed = False             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(((struct __pyx_obj_3zmq_4_zmq_Socket *)__pyx_v_self)->closed);
  __Pyx_DECREF(((struct __pyx_obj_3zmq_4_zmq_Socket *)__pyx_v_self)->closed);
  ((struct __pyx_obj_3zmq_4_zmq_Socket *)__pyx_v_self)->closed = __pyx_t_3;
  __pyx_t_3 = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("zmq._zmq.Socket.__cinit__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_self);
  __Pyx_DECREF((PyObject *)__pyx_v_context);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":452
 *         self.closed = False
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         self.close()
 * 
 */

static void __pyx_pf_3zmq_4_zmq_6Socket___dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pf_3zmq_4_zmq_6Socket___dealloc__(PyObject *__pyx_v_self) {
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__dealloc__");

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":453
 * 
 *     def __dealloc__(self):
 *         self.close()             # <<<<<<<<<<<<<<
 * 
 *     def close(self):
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__close); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("zmq._zmq.Socket.__dealloc__");
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
}

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":455
 *         self.close()
 * 
 *     def close(self):             # <<<<<<<<<<<<<<
 *         """Close the socket.
 * 
 */

static PyObject *__pyx_pf_3zmq_4_zmq_6Socket_close(PyObject *__pyx_v_self, PyObject *unused); /*proto*/
static char __pyx_doc_3zmq_4_zmq_6Socket_close[] = "Close the socket.\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        ";
static PyObject *__pyx_pf_3zmq_4_zmq_6Socket_close(PyObject *__pyx_v_self, PyObject *unused) {
  int __pyx_v_rc;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("close");
  __Pyx_INCREF((PyObject *)__pyx_v_self);

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":463
 *         """
 *         cdef int rc
 *         if self.handle != NULL and not self.closed:             # <<<<<<<<<<<<<<
 *             rc = zmq_close(self.handle)
 *             if rc != 0:
 */
  __pyx_t_1 = (((struct __pyx_obj_3zmq_4_zmq_Socket *)__pyx_v_self)->handle != NULL);
  if (__pyx_t_1) {
    __pyx_t_2 = __Pyx_PyObject_IsTrue(((struct __pyx_obj_3zmq_4_zmq_Socket *)__pyx_v_self)->closed); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = (!__pyx_t_2);
    __pyx_t_2 = __pyx_t_3;
  } else {
    __pyx_t_2 = __pyx_t_1;
  }
  if (__pyx_t_2) {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":464
 *         cdef int rc
 *         if self.handle != NULL and not self.closed:
 *             rc = zmq_close(self.handle)             # <<<<<<<<<<<<<<
 *             if rc != 0:
 *                 raise ZMQError()
 */
    __pyx_v_rc = zmq_close(((struct __pyx_obj_3zmq_4_zmq_Socket *)__pyx_v_self)->handle);

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":465
 *         if self.handle != NULL and not self.closed:
 *             rc = zmq_close(self.handle)
 *             if rc != 0:             # <<<<<<<<<<<<<<
 *                 raise ZMQError()
 *             self.handle = NULL
 */
    __pyx_t_2 = (__pyx_v_rc != 0);
    if (__pyx_t_2) {

      /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":466
 *             rc = zmq_close(self.handle)
 *             if rc != 0:
 *                 raise ZMQError()             # <<<<<<<<<<<<<<
 *             self.handle = NULL
 *             self.closed = True
 */
      __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_Raise(__pyx_t_5, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":467
 *             if rc != 0:
 *                 raise ZMQError()
 *             self.handle = NULL             # <<<<<<<<<<<<<<
 *             self.closed = True
 * 
 */
    ((struct __pyx_obj_3zmq_4_zmq_Socket *)__pyx_v_self)->handle = NULL;

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":468
 *                 raise ZMQError()
 *             self.handle = NULL
 *             self.closed = True             # <<<<<<<<<<<<<<
 * 
 *     def _check_closed(self):
 */
    __pyx_t_5 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_GOTREF(((struct __pyx_obj_3zmq_4_zmq_Socket *)__pyx_v_self)->closed);
    __Pyx_DECREF(((struct __pyx_obj_3zmq_4_zmq_Socket *)__pyx_v_self)->closed);
    ((struct __pyx_obj_3zmq_4_zmq_Socket *)__pyx_v_self)->closed = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("zmq._zmq.Socket.close");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_self);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":470
 *             self.closed = True
 * 
 *     def _check_closed(self):             # <<<<<<<<<<<<<<
 *         if self.closed:
 *             raise ZMQError(ENOTSUP)
 */

static PyObject *__pyx_pf_3zmq_4_zmq_6Socket__check_closed(PyObject *__pyx_v_self, PyObject *unused); /*proto*/
static PyObject *__pyx_pf_3zmq_4_zmq_6Socket__check_closed(PyObject *__pyx_v_self, PyObject *unused) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("_check_closed");
  __Pyx_INCREF((PyObject *)__pyx_v_self);

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":471
 * 
 *     def _check_closed(self):
 *         if self.closed:             # <<<<<<<<<<<<<<
 *             raise ZMQError(ENOTSUP)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(((struct __pyx_obj_3zmq_4_zmq_Socket *)__pyx_v_self)->closed); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":472
 *     def _check_closed(self):
 *         if self.closed:
 *             raise ZMQError(ENOTSUP)             # <<<<<<<<<<<<<<
 * 
 *     def setsockopt(self, int option, optval):
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__ENOTSUP); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("zmq._zmq.Socket._check_closed");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_self);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":474
 *             raise ZMQError(ENOTSUP)
 * 
 *     def setsockopt(self, int option, optval):             # <<<<<<<<<<<<<<
 *         """Set socket options.
 * 
 */

static PyObject *__pyx_pf_3zmq_4_zmq_6Socket_setsockopt(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3zmq_4_zmq_6Socket_setsockopt[] = "Set socket options.\n\n        See the 0MQ documentation for details on specific options.\n\n        Parameters\n        ----------\n        option : str\n            The name of the option to set. Can be any of: SUBSCRIBE, \n            UNSUBSCRIBE, IDENTITY, HWM, SWAP, AFFINITY, RATE, \n            RECOVERY_IVL, MCAST_LOOP, SNDBUF, RCVBUF.\n        optval : int or str\n            The value of the option to set.\n        ";
static PyObject *__pyx_pf_3zmq_4_zmq_6Socket_setsockopt(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_option;
  PyObject *__pyx_v_optval = 0;
  pyzmq_int64_t __pyx_v_optval_int_c;
  int __pyx_v_rc;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  char *__pyx_t_8;
  Py_ssize_t __pyx_t_9;
  pyzmq_int64_t __pyx_t_10;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__option,&__pyx_n_s__optval,0};
  __Pyx_RefNannySetupContext("setsockopt");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__option);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__optval);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("setsockopt", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "setsockopt") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_option = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_option == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_optval = values[1];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_option = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_option == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_optval = PyTuple_GET_ITEM(__pyx_args, 1);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("setsockopt", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("zmq._zmq.Socket.setsockopt");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_v_optval);

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":491
 *         cdef int rc
 * 
 *         self._check_closed()             # <<<<<<<<<<<<<<
 * 
 *         if option in [SUBSCRIBE, UNSUBSCRIBE, IDENTITY]:
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___check_closed); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":493
 *         self._check_closed()
 * 
 *         if option in [SUBSCRIBE, UNSUBSCRIBE, IDENTITY]:             # <<<<<<<<<<<<<<
 *             if not isinstance(optval, str):
 *                 raise TypeError('expected str, got: %r' % optval)
 */
  __pyx_t_3 = __pyx_v_option;
  __pyx_t_2 = PyInt_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__SUBSCRIBE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_6 = ((int)__pyx_t_5);
  if (!__pyx_t_6) {
    __pyx_t_4 = PyInt_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__UNSUBSCRIBE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_RichCompare(__pyx_t_4, __pyx_t_1, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_7 = ((int)__pyx_t_5);
    __pyx_t_5 = __pyx_t_7;
  } else {
    __pyx_t_5 = __pyx_t_6;
  }
  if (!__pyx_t_5) {
    __pyx_t_2 = PyInt_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__IDENTITY); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_6 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_7 = ((int)__pyx_t_6);
    __pyx_t_6 = __pyx_t_7;
  } else {
    __pyx_t_6 = __pyx_t_5;
  }
  __pyx_t_5 = __pyx_t_6;
  if (__pyx_t_5) {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":494
 * 
 *         if option in [SUBSCRIBE, UNSUBSCRIBE, IDENTITY]:
 *             if not isinstance(optval, str):             # <<<<<<<<<<<<<<
 *                 raise TypeError('expected str, got: %r' % optval)
 *             rc = zmq_setsockopt(
 */
    __pyx_t_5 = PyObject_TypeCheck(__pyx_v_optval, ((PyTypeObject *)((PyObject*)&PyString_Type))); 
    __pyx_t_6 = (!__pyx_t_5);
    if (__pyx_t_6) {

      /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":495
 *         if option in [SUBSCRIBE, UNSUBSCRIBE, IDENTITY]:
 *             if not isinstance(optval, str):
 *                 raise TypeError('expected str, got: %r' % optval)             # <<<<<<<<<<<<<<
 *             rc = zmq_setsockopt(
 *                 self.handle, option,
 */
      __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_2), __pyx_v_optval); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_Raise(__pyx_t_4, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":498
 *             rc = zmq_setsockopt(
 *                 self.handle, option,
 *                 PyString_AsString(optval), PyString_Size(optval)             # <<<<<<<<<<<<<<
 *             )
 *         elif option in [HWM, SWAP, AFFINITY, RATE, RECOVERY_IVL,
 */
    __pyx_t_8 = PyString_AsString(__pyx_v_optval); if (unlikely(__pyx_t_8 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_9 = PyString_Size(__pyx_v_optval); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_rc = zmq_setsockopt(((struct __pyx_obj_3zmq_4_zmq_Socket *)__pyx_v_self)->handle, __pyx_v_option, __pyx_t_8, __pyx_t_9);
    goto __pyx_L6;
  }

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":500
 *                 PyString_AsString(optval), PyString_Size(optval)
 *             )
 *         elif option in [HWM, SWAP, AFFINITY, RATE, RECOVERY_IVL,             # <<<<<<<<<<<<<<
 *                         MCAST_LOOP, SNDBUF, RCVBUF]:
 *             if not isinstance(optval, int):
 */
  __pyx_t_3 = __pyx_v_option;
  __pyx_t_4 = PyInt_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__HWM); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_4, __pyx_t_1, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = ((int)__pyx_t_6);
  if (!__pyx_t_5) {
    __pyx_t_2 = PyInt_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__SWAP); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_6 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_7 = ((int)__pyx_t_6);
    __pyx_t_6 = __pyx_t_7;
  } else {
    __pyx_t_6 = __pyx_t_5;
  }
  if (!__pyx_t_6) {
    __pyx_t_4 = PyInt_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__AFFINITY); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_RichCompare(__pyx_t_4, __pyx_t_1, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_7 = ((int)__pyx_t_5);
    __pyx_t_5 = __pyx_t_7;
  } else {
    __pyx_t_5 = __pyx_t_6;
  }
  if (!__pyx_t_5) {
    __pyx_t_2 = PyInt_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__RATE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_6 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_7 = ((int)__pyx_t_6);
    __pyx_t_6 = __pyx_t_7;
  } else {
    __pyx_t_6 = __pyx_t_5;
  }
  if (!__pyx_t_6) {
    __pyx_t_4 = PyInt_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__RECOVERY_IVL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_RichCompare(__pyx_t_4, __pyx_t_1, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_7 = ((int)__pyx_t_5);
    __pyx_t_5 = __pyx_t_7;
  } else {
    __pyx_t_5 = __pyx_t_6;
  }
  if (!__pyx_t_5) {
    __pyx_t_2 = PyInt_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":501
 *             )
 *         elif option in [HWM, SWAP, AFFINITY, RATE, RECOVERY_IVL,
 *                         MCAST_LOOP, SNDBUF, RCVBUF]:             # <<<<<<<<<<<<<<
 *             if not isinstance(optval, int):
 *                 raise TypeError('expected int, got: %r' % optval)
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__MCAST_LOOP); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_6 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_7 = ((int)__pyx_t_6);
    __pyx_t_6 = __pyx_t_7;
  } else {
    __pyx_t_6 = __pyx_t_5;
  }
  if (!__pyx_t_6) {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":500
 *                 PyString_AsString(optval), PyString_Size(optval)
 *             )
 *         elif option in [HWM, SWAP, AFFINITY, RATE, RECOVERY_IVL,             # <<<<<<<<<<<<<<
 *                         MCAST_LOOP, SNDBUF, RCVBUF]:
 *             if not isinstance(optval, int):
 */
    __pyx_t_4 = PyInt_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":501
 *             )
 *         elif option in [HWM, SWAP, AFFINITY, RATE, RECOVERY_IVL,
 *                         MCAST_LOOP, SNDBUF, RCVBUF]:             # <<<<<<<<<<<<<<
 *             if not isinstance(optval, int):
 *                 raise TypeError('expected int, got: %r' % optval)
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__SNDBUF); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_RichCompare(__pyx_t_4, __pyx_t_1, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_7 = ((int)__pyx_t_5);
    __pyx_t_5 = __pyx_t_7;
  } else {
    __pyx_t_5 = __pyx_t_6;
  }
  if (!__pyx_t_5) {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":500
 *                 PyString_AsString(optval), PyString_Size(optval)
 *             )
 *         elif option in [HWM, SWAP, AFFINITY, RATE, RECOVERY_IVL,             # <<<<<<<<<<<<<<
 *                         MCAST_LOOP, SNDBUF, RCVBUF]:
 *             if not isinstance(optval, int):
 */
    __pyx_t_2 = PyInt_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":501
 *             )
 *         elif option in [HWM, SWAP, AFFINITY, RATE, RECOVERY_IVL,
 *                         MCAST_LOOP, SNDBUF, RCVBUF]:             # <<<<<<<<<<<<<<
 *             if not isinstance(optval, int):
 *                 raise TypeError('expected int, got: %r' % optval)
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__RCVBUF); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_6 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_7 = ((int)__pyx_t_6);
    __pyx_t_6 = __pyx_t_7;
  } else {
    __pyx_t_6 = __pyx_t_5;
  }
  __pyx_t_5 = __pyx_t_6;
  if (__pyx_t_5) {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":502
 *         elif option in [HWM, SWAP, AFFINITY, RATE, RECOVERY_IVL,
 *                         MCAST_LOOP, SNDBUF, RCVBUF]:
 *             if not isinstance(optval, int):             # <<<<<<<<<<<<<<
 *                 raise TypeError('expected int, got: %r' % optval)
 *             optval_int_c = optval
 */
    __pyx_t_5 = PyObject_TypeCheck(__pyx_v_optval, ((PyTypeObject *)((PyObject*)&PyInt_Type))); 
    __pyx_t_6 = (!__pyx_t_5);
    if (__pyx_t_6) {

      /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":503
 *                         MCAST_LOOP, SNDBUF, RCVBUF]:
 *             if not isinstance(optval, int):
 *                 raise TypeError('expected int, got: %r' % optval)             # <<<<<<<<<<<<<<
 *             optval_int_c = optval
 *             rc = zmq_setsockopt(
 */
      __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_3), __pyx_v_optval); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_Raise(__pyx_t_4, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":504
 *             if not isinstance(optval, int):
 *                 raise TypeError('expected int, got: %r' % optval)
 *             optval_int_c = optval             # <<<<<<<<<<<<<<
 *             rc = zmq_setsockopt(
 *                 self.handle, option,
 */
    __pyx_t_10 = __Pyx_PyInt_from_py_pyzmq_int64_t(__pyx_v_optval); if (unlikely((__pyx_t_10 == (pyzmq_int64_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_optval_int_c = __pyx_t_10;

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":507
 *             rc = zmq_setsockopt(
 *                 self.handle, option,
 *                 &optval_int_c, sizeof(int64_t)             # <<<<<<<<<<<<<<
 *             )
 *         else:
 */
    __pyx_v_rc = zmq_setsockopt(((struct __pyx_obj_3zmq_4_zmq_Socket *)__pyx_v_self)->handle, __pyx_v_option, (&__pyx_v_optval_int_c), (sizeof(pyzmq_int64_t)));
    goto __pyx_L6;
  }
  /*else*/ {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":510
 *             )
 *         else:
 *             raise ZMQError(EINVAL)             # <<<<<<<<<<<<<<
 * 
 *         if rc != 0:
 */
    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__EINVAL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_t_4, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L6:;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":512
 *             raise ZMQError(EINVAL)
 * 
 *         if rc != 0:             # <<<<<<<<<<<<<<
 *             raise ZMQError()
 * 
 */
  __pyx_t_6 = (__pyx_v_rc != 0);
  if (__pyx_t_6) {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":513
 * 
 *         if rc != 0:
 *             raise ZMQError()             # <<<<<<<<<<<<<<
 * 
 *     def getsockopt(self, int option):
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L9;
  }
  __pyx_L9:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("zmq._zmq.Socket.setsockopt");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_self);
  __Pyx_DECREF(__pyx_v_optval);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":515
 *             raise ZMQError()
 * 
 *     def getsockopt(self, int option):             # <<<<<<<<<<<<<<
 *         """Get the value of a socket option.
 * 
 */

static PyObject *__pyx_pf_3zmq_4_zmq_6Socket_getsockopt(PyObject *__pyx_v_self, PyObject *__pyx_arg_option); /*proto*/
static char __pyx_doc_3zmq_4_zmq_6Socket_getsockopt[] = "Get the value of a socket option.\n\n        See the 0MQ documentation for details on specific options.\n\n        Parameters\n        ----------\n        option : str\n            The name of the option to set. Can be any of: \n            IDENTITY, HWM, SWAP, AFFINITY, RATE, \n            RECOVERY_IVL, MCAST_LOOP, SNDBUF, RCVBUF, RCVMORE.\n\n        Returns\n        -------\n        The value of the option as a string or int.\n        ";
static PyObject *__pyx_pf_3zmq_4_zmq_6Socket_getsockopt(PyObject *__pyx_v_self, PyObject *__pyx_arg_option) {
  int __pyx_v_option;
  pyzmq_int64_t __pyx_v_optval_int_c;
  char __pyx_v_identity_str_c[255];
  size_t __pyx_v_sz;
  int __pyx_v_rc;
  PyObject *__pyx_v_result;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  __Pyx_RefNannySetupContext("getsockopt");
  assert(__pyx_arg_option); {
    __pyx_v_option = __Pyx_PyInt_AsInt(__pyx_arg_option); if (unlikely((__pyx_v_option == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("zmq._zmq.Socket.getsockopt");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __pyx_v_result = Py_None; __Pyx_INCREF(Py_None);

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":536
 *         cdef int rc
 * 
 *         self._check_closed()             # <<<<<<<<<<<<<<
 * 
 *         if option in [IDENTITY]:
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___check_closed); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":538
 *         self._check_closed()
 * 
 *         if option in [IDENTITY]:             # <<<<<<<<<<<<<<
 *             sz = 255
 *             rc = zmq_getsockopt(self.handle, option, <void *>identity_str_c, &sz)
 */
  __pyx_t_3 = __pyx_v_option;
  __pyx_t_2 = PyInt_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__IDENTITY); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_EQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_6 = ((int)__pyx_t_5);
  if (__pyx_t_6) {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":539
 * 
 *         if option in [IDENTITY]:
 *             sz = 255             # <<<<<<<<<<<<<<
 *             rc = zmq_getsockopt(self.handle, option, <void *>identity_str_c, &sz)
 *             if rc != 0:
 */
    __pyx_v_sz = 255;

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":540
 *         if option in [IDENTITY]:
 *             sz = 255
 *             rc = zmq_getsockopt(self.handle, option, <void *>identity_str_c, &sz)             # <<<<<<<<<<<<<<
 *             if rc != 0:
 *                 raise ZMQError()
 */
    __pyx_v_rc = zmq_getsockopt(((struct __pyx_obj_3zmq_4_zmq_Socket *)__pyx_v_self)->handle, __pyx_v_option, ((void *)__pyx_v_identity_str_c), (&__pyx_v_sz));

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":541
 *             sz = 255
 *             rc = zmq_getsockopt(self.handle, option, <void *>identity_str_c, &sz)
 *             if rc != 0:             # <<<<<<<<<<<<<<
 *                 raise ZMQError()
 *             result = PyString_FromStringAndSize(<char *>identity_str_c, sz)
 */
    __pyx_t_6 = (__pyx_v_rc != 0);
    if (__pyx_t_6) {

      /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":542
 *             rc = zmq_getsockopt(self.handle, option, <void *>identity_str_c, &sz)
 *             if rc != 0:
 *                 raise ZMQError()             # <<<<<<<<<<<<<<
 *             result = PyString_FromStringAndSize(<char *>identity_str_c, sz)
 *         elif option in [HWM, SWAP, AFFINITY, RATE, RECOVERY_IVL,
 */
      __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_Raise(__pyx_t_1, 0, 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":543
 *             if rc != 0:
 *                 raise ZMQError()
 *             result = PyString_FromStringAndSize(<char *>identity_str_c, sz)             # <<<<<<<<<<<<<<
 *         elif option in [HWM, SWAP, AFFINITY, RATE, RECOVERY_IVL,
 *                         MCAST_LOOP, SNDBUF, RCVBUF, RCVMORE]:
 */
    __pyx_t_1 = PyString_FromStringAndSize(((char *)__pyx_v_identity_str_c), __pyx_v_sz); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_v_result);
    __pyx_v_result = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L5;
  }

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":544
 *                 raise ZMQError()
 *             result = PyString_FromStringAndSize(<char *>identity_str_c, sz)
 *         elif option in [HWM, SWAP, AFFINITY, RATE, RECOVERY_IVL,             # <<<<<<<<<<<<<<
 *                         MCAST_LOOP, SNDBUF, RCVBUF, RCVMORE]:
 *             sz = sizeof(int64_t)
 */
  __pyx_t_3 = __pyx_v_option;
  __pyx_t_1 = PyInt_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__HWM); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = ((int)__pyx_t_6);
  if (!__pyx_t_5) {
    __pyx_t_2 = PyInt_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__SWAP); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_7 = ((int)__pyx_t_6);
    __pyx_t_6 = __pyx_t_7;
  } else {
    __pyx_t_6 = __pyx_t_5;
  }
  if (!__pyx_t_6) {
    __pyx_t_1 = PyInt_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__AFFINITY); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_7 = ((int)__pyx_t_5);
    __pyx_t_5 = __pyx_t_7;
  } else {
    __pyx_t_5 = __pyx_t_6;
  }
  if (!__pyx_t_5) {
    __pyx_t_2 = PyInt_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__RATE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_7 = ((int)__pyx_t_6);
    __pyx_t_6 = __pyx_t_7;
  } else {
    __pyx_t_6 = __pyx_t_5;
  }
  if (!__pyx_t_6) {
    __pyx_t_1 = PyInt_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__RECOVERY_IVL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_7 = ((int)__pyx_t_5);
    __pyx_t_5 = __pyx_t_7;
  } else {
    __pyx_t_5 = __pyx_t_6;
  }
  if (!__pyx_t_5) {
    __pyx_t_2 = PyInt_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":545
 *             result = PyString_FromStringAndSize(<char *>identity_str_c, sz)
 *         elif option in [HWM, SWAP, AFFINITY, RATE, RECOVERY_IVL,
 *                         MCAST_LOOP, SNDBUF, RCVBUF, RCVMORE]:             # <<<<<<<<<<<<<<
 *             sz = sizeof(int64_t)
 *             rc = zmq_getsockopt(self.handle, option, <void *>&optval_int_c, &sz)
 */
    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__MCAST_LOOP); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_7 = ((int)__pyx_t_6);
    __pyx_t_6 = __pyx_t_7;
  } else {
    __pyx_t_6 = __pyx_t_5;
  }
  if (!__pyx_t_6) {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":544
 *                 raise ZMQError()
 *             result = PyString_FromStringAndSize(<char *>identity_str_c, sz)
 *         elif option in [HWM, SWAP, AFFINITY, RATE, RECOVERY_IVL,             # <<<<<<<<<<<<<<
 *                         MCAST_LOOP, SNDBUF, RCVBUF, RCVMORE]:
 *             sz = sizeof(int64_t)
 */
    __pyx_t_1 = PyInt_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":545
 *             result = PyString_FromStringAndSize(<char *>identity_str_c, sz)
 *         elif option in [HWM, SWAP, AFFINITY, RATE, RECOVERY_IVL,
 *                         MCAST_LOOP, SNDBUF, RCVBUF, RCVMORE]:             # <<<<<<<<<<<<<<
 *             sz = sizeof(int64_t)
 *             rc = zmq_getsockopt(self.handle, option, <void *>&optval_int_c, &sz)
 */
    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__SNDBUF); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_7 = ((int)__pyx_t_5);
    __pyx_t_5 = __pyx_t_7;
  } else {
    __pyx_t_5 = __pyx_t_6;
  }
  if (!__pyx_t_5) {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":544
 *                 raise ZMQError()
 *             result = PyString_FromStringAndSize(<char *>identity_str_c, sz)
 *         elif option in [HWM, SWAP, AFFINITY, RATE, RECOVERY_IVL,             # <<<<<<<<<<<<<<
 *                         MCAST_LOOP, SNDBUF, RCVBUF, RCVMORE]:
 *             sz = sizeof(int64_t)
 */
    __pyx_t_2 = PyInt_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":545
 *             result = PyString_FromStringAndSize(<char *>identity_str_c, sz)
 *         elif option in [HWM, SWAP, AFFINITY, RATE, RECOVERY_IVL,
 *                         MCAST_LOOP, SNDBUF, RCVBUF, RCVMORE]:             # <<<<<<<<<<<<<<
 *             sz = sizeof(int64_t)
 *             rc = zmq_getsockopt(self.handle, option, <void *>&optval_int_c, &sz)
 */
    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__RCVBUF); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_7 = ((int)__pyx_t_6);
    __pyx_t_6 = __pyx_t_7;
  } else {
    __pyx_t_6 = __pyx_t_5;
  }
  if (!__pyx_t_6) {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":544
 *                 raise ZMQError()
 *             result = PyString_FromStringAndSize(<char *>identity_str_c, sz)
 *         elif option in [HWM, SWAP, AFFINITY, RATE, RECOVERY_IVL,             # <<<<<<<<<<<<<<
 *                         MCAST_LOOP, SNDBUF, RCVBUF, RCVMORE]:
 *             sz = sizeof(int64_t)
 */
    __pyx_t_1 = PyInt_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":545
 *             result = PyString_FromStringAndSize(<char *>identity_str_c, sz)
 *         elif option in [HWM, SWAP, AFFINITY, RATE, RECOVERY_IVL,
 *                         MCAST_LOOP, SNDBUF, RCVBUF, RCVMORE]:             # <<<<<<<<<<<<<<
 *             sz = sizeof(int64_t)
 *             rc = zmq_getsockopt(self.handle, option, <void *>&optval_int_c, &sz)
 */
    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__RCVMORE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_7 = ((int)__pyx_t_5);
    __pyx_t_5 = __pyx_t_7;
  } else {
    __pyx_t_5 = __pyx_t_6;
  }
  __pyx_t_6 = __pyx_t_5;
  if (__pyx_t_6) {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":546
 *         elif option in [HWM, SWAP, AFFINITY, RATE, RECOVERY_IVL,
 *                         MCAST_LOOP, SNDBUF, RCVBUF, RCVMORE]:
 *             sz = sizeof(int64_t)             # <<<<<<<<<<<<<<
 *             rc = zmq_getsockopt(self.handle, option, <void *>&optval_int_c, &sz)
 *             if rc != 0:
 */
    __pyx_v_sz = (sizeof(pyzmq_int64_t));

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":547
 *                         MCAST_LOOP, SNDBUF, RCVBUF, RCVMORE]:
 *             sz = sizeof(int64_t)
 *             rc = zmq_getsockopt(self.handle, option, <void *>&optval_int_c, &sz)             # <<<<<<<<<<<<<<
 *             if rc != 0:
 *                 raise ZMQError()
 */
    __pyx_v_rc = zmq_getsockopt(((struct __pyx_obj_3zmq_4_zmq_Socket *)__pyx_v_self)->handle, __pyx_v_option, ((void *)(&__pyx_v_optval_int_c)), (&__pyx_v_sz));

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":548
 *             sz = sizeof(int64_t)
 *             rc = zmq_getsockopt(self.handle, option, <void *>&optval_int_c, &sz)
 *             if rc != 0:             # <<<<<<<<<<<<<<
 *                 raise ZMQError()
 *             result = optval_int_c
 */
    __pyx_t_6 = (__pyx_v_rc != 0);
    if (__pyx_t_6) {

      /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":549
 *             rc = zmq_getsockopt(self.handle, option, <void *>&optval_int_c, &sz)
 *             if rc != 0:
 *                 raise ZMQError()             # <<<<<<<<<<<<<<
 *             result = optval_int_c
 *         else:
 */
      __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_Raise(__pyx_t_4, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":550
 *             if rc != 0:
 *                 raise ZMQError()
 *             result = optval_int_c             # <<<<<<<<<<<<<<
 *         else:
 *             raise ZMQError()
 */
    __pyx_t_4 = __Pyx_PyInt_to_py_pyzmq_int64_t(__pyx_v_optval_int_c); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_v_result);
    __pyx_v_result = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":552
 *             result = optval_int_c
 *         else:
 *             raise ZMQError()             # <<<<<<<<<<<<<<
 * 
 *         return result
 */
    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L5:;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":554
 *             raise ZMQError()
 * 
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     def bind(self, addr):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("zmq._zmq.Socket.getsockopt");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_result);
  __Pyx_DECREF((PyObject *)__pyx_v_self);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":556
 *         return result
 * 
 *     def bind(self, addr):             # <<<<<<<<<<<<<<
 *         """Bind the socket to an address.
 * 
 */

static PyObject *__pyx_pf_3zmq_4_zmq_6Socket_bind(PyObject *__pyx_v_self, PyObject *__pyx_v_addr); /*proto*/
static char __pyx_doc_3zmq_4_zmq_6Socket_bind[] = "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 :meth:`Sockiet.connect` to\n        connect to this socket.\n\n        Parameters\n        ----------\n        addr : str\n            The address string. This has the form 'protocol://interface:port',\n            for example 'tcp://127.0.0.1:5555'. Protocols supported are\n            tcp, upd, pgm, inproc and ipc.\n        ";
static PyObject *__pyx_pf_3zmq_4_zmq_6Socket_bind(PyObject *__pyx_v_self, PyObject *__pyx_v_addr) {
  int __pyx_v_rc;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  char *__pyx_t_5;
  __Pyx_RefNannySetupContext("bind");
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_v_addr);

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":572
 *         cdef int rc
 * 
 *         self._check_closed()             # <<<<<<<<<<<<<<
 * 
 *         if not isinstance(addr, str):
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___check_closed); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":574
 *         self._check_closed()
 * 
 *         if not isinstance(addr, str):             # <<<<<<<<<<<<<<
 *             raise TypeError('expected str, got: %r' % addr)
 *         rc = zmq_bind(self.handle, addr)
 */
  __pyx_t_3 = PyObject_TypeCheck(__pyx_v_addr, ((PyTypeObject *)((PyObject*)&PyString_Type))); 
  __pyx_t_4 = (!__pyx_t_3);
  if (__pyx_t_4) {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":575
 * 
 *         if not isinstance(addr, str):
 *             raise TypeError('expected str, got: %r' % addr)             # <<<<<<<<<<<<<<
 *         rc = zmq_bind(self.handle, addr)
 *         if rc != 0:
 */
    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_2), __pyx_v_addr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":576
 *         if not isinstance(addr, str):
 *             raise TypeError('expected str, got: %r' % addr)
 *         rc = zmq_bind(self.handle, addr)             # <<<<<<<<<<<<<<
 *         if rc != 0:
 *             raise ZMQError()
 */
  __pyx_t_5 = __Pyx_PyBytes_AsString(__pyx_v_addr); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_rc = zmq_bind(((struct __pyx_obj_3zmq_4_zmq_Socket *)__pyx_v_self)->handle, __pyx_t_5);

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":577
 *             raise TypeError('expected str, got: %r' % addr)
 *         rc = zmq_bind(self.handle, addr)
 *         if rc != 0:             # <<<<<<<<<<<<<<
 *             raise ZMQError()
 * 
 */
  __pyx_t_4 = (__pyx_v_rc != 0);
  if (__pyx_t_4) {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":578
 *         rc = zmq_bind(self.handle, addr)
 *         if rc != 0:
 *             raise ZMQError()             # <<<<<<<<<<<<<<
 * 
 *     def bind_to_random_port(self, addr, min_port=2000, max_port=20000, max_tries=100):
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("zmq._zmq.Socket.bind");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_self);
  __Pyx_DECREF(__pyx_v_addr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":580
 *             raise ZMQError()
 * 
 *     def bind_to_random_port(self, addr, min_port=2000, max_port=20000, max_tries=100):             # <<<<<<<<<<<<<<
 *         """Bind this socket to a random port in a range.
 * 
 */

static PyObject *__pyx_pf_3zmq_4_zmq_6Socket_bind_to_random_port(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3zmq_4_zmq_6Socket_bind_to_random_port[] = "Bind this socket to a random port in a range.\n\n        Parameters\n        ----------\n        addr : str\n            The address string without the port to pass to :meth:`Socket.bind`.\n        min_port : int\n            The minimum port in the range of ports to try.\n        max_port : int\n            The maximum port in the range of ports to try.\n        max_tries : int\n            The number of attempt to bind.\n\n        Returns\n        -------\n        port : int\n            The port the socket was bound to.\n        ";
static PyObject *__pyx_pf_3zmq_4_zmq_6Socket_bind_to_random_port(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_addr = 0;
  PyObject *__pyx_v_min_port = 0;
  PyObject *__pyx_v_max_port = 0;
  PyObject *__pyx_v_max_tries = 0;
  PyObject *__pyx_v_i;
  PyObject *__pyx_v_port;
  PyObject *__pyx_r = NULL;
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__addr,&__pyx_n_s__min_port,&__pyx_n_s__max_port,&__pyx_n_s__max_tries,0};
  __Pyx_RefNannySetupContext("bind_to_random_port");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((PyObject *)__pyx_int_2000);
    values[2] = ((PyObject *)__pyx_int_20000);
    values[3] = ((PyObject *)__pyx_int_100);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__addr);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 1) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__min_port);
        if (unlikely(value)) { values[1] = value; kw_args--; }
      }
      case  2:
      if (kw_args > 1) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_port);
        if (unlikely(value)) { values[2] = value; kw_args--; }
      }
      case  3:
      if (kw_args > 1) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_tries);
        if (unlikely(value)) { values[3] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "bind_to_random_port") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_addr = values[0];
    __pyx_v_min_port = values[1];
    __pyx_v_max_port = values[2];
    __pyx_v_max_tries = values[3];
  } else {
    __pyx_v_min_port = ((PyObject *)__pyx_int_2000);
    __pyx_v_max_port = ((PyObject *)__pyx_int_20000);
    __pyx_v_max_tries = ((PyObject *)__pyx_int_100);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  4: __pyx_v_max_tries = PyTuple_GET_ITEM(__pyx_args, 3);
      case  3: __pyx_v_max_port = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: __pyx_v_min_port = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_addr = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("bind_to_random_port", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("zmq._zmq.Socket.bind_to_random_port");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_v_addr);
  __Pyx_INCREF(__pyx_v_min_port);
  __Pyx_INCREF(__pyx_v_max_port);
  __Pyx_INCREF(__pyx_v_max_tries);
  __pyx_v_i = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_port = Py_None; __Pyx_INCREF(Py_None);

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":599
 *             The port the socket was bound to.
 *         """
 *         for i in range(max_tries):             # <<<<<<<<<<<<<<
 *             try:
 *                 port = random.randrange(min_port, max_port)
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_max_tries);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_max_tries);
  __Pyx_GIVEREF(__pyx_v_max_tries);
  __pyx_t_3 = PyObject_Call(__pyx_builtin_range, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) {
    __pyx_t_1 = 0; __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2);
  } else {
    __pyx_t_1 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  for (;;) {
    if (likely(PyList_CheckExact(__pyx_t_2))) {
      if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++;
    } else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
      if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++;
    } else {
      __pyx_t_3 = PyIter_Next(__pyx_t_2);
      if (!__pyx_t_3) {
        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_DECREF(__pyx_v_i);
    __pyx_v_i = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":600
 *         """
 *         for i in range(max_tries):
 *             try:             # <<<<<<<<<<<<<<
 *                 port = random.randrange(min_port, max_port)
 *                 self.bind('%s:%s' % (addr, port))
 */
    {
      PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
      __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
      __Pyx_XGOTREF(__pyx_save_exc_type);
      __Pyx_XGOTREF(__pyx_save_exc_value);
      __Pyx_XGOTREF(__pyx_save_exc_tb);
      /*try:*/ {

        /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":601
 *         for i in range(max_tries):
 *             try:
 *                 port = random.randrange(min_port, max_port)             # <<<<<<<<<<<<<<
 *                 self.bind('%s:%s' % (addr, port))
 *             except ZMQError:
 */
        __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__random); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__randrange); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_v_min_port);
        PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_min_port);
        __Pyx_GIVEREF(__pyx_v_min_port);
        __Pyx_INCREF(__pyx_v_max_port);
        PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_max_port);
        __Pyx_GIVEREF(__pyx_v_max_port);
        __pyx_t_5 = PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_v_port);
        __pyx_v_port = __pyx_t_5;
        __pyx_t_5 = 0;

        /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":602
 *             try:
 *                 port = random.randrange(min_port, max_port)
 *                 self.bind('%s:%s' % (addr, port))             # <<<<<<<<<<<<<<
 *             except ZMQError:
 *                 pass
 */
        __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__bind); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_v_addr);
        PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_addr);
        __Pyx_GIVEREF(__pyx_v_addr);
        __Pyx_INCREF(__pyx_v_port);
        PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_port);
        __Pyx_GIVEREF(__pyx_v_port);
        __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_4), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
        __Pyx_GOTREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_4);
        __pyx_t_4 = 0;
        __pyx_t_4 = PyObject_Call(__pyx_t_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      /*else:*/ {

        /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":606
 *                 pass
 *             else:
 *                 return port             # <<<<<<<<<<<<<<
 *         raise ZMQBindError("Could not bind socket to random port.")
 * 
 */
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_v_port);
        __pyx_r = __pyx_v_port;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        goto __pyx_L11_except_return;
      }
      __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
      __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
      __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
      goto __pyx_L15_try_end;
      __pyx_L8_error:;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":603
 *                 port = random.randrange(min_port, max_port)
 *                 self.bind('%s:%s' % (addr, port))
 *             except ZMQError:             # <<<<<<<<<<<<<<
 *                 pass
 *             else:
 */
      __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L10_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = PyErr_ExceptionMatches(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        PyErr_Restore(0,0,0);
        goto __pyx_L9_exception_handled;
      }
      __pyx_L10_except_error:;
      __Pyx_XGIVEREF(__pyx_save_exc_type);
      __Pyx_XGIVEREF(__pyx_save_exc_value);
      __Pyx_XGIVEREF(__pyx_save_exc_tb);
      __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
      goto __pyx_L1_error;
      __pyx_L11_except_return:;
      __Pyx_XGIVEREF(__pyx_save_exc_type);
      __Pyx_XGIVEREF(__pyx_save_exc_value);
      __Pyx_XGIVEREF(__pyx_save_exc_tb);
      __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
      goto __pyx_L0;
      __pyx_L9_exception_handled:;
      __Pyx_XGIVEREF(__pyx_save_exc_type);
      __Pyx_XGIVEREF(__pyx_save_exc_value);
      __Pyx_XGIVEREF(__pyx_save_exc_tb);
      __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
      __pyx_L15_try_end:;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":607
 *             else:
 *                 return port
 *         raise ZMQBindError("Could not bind socket to random port.")             # <<<<<<<<<<<<<<
 * 
 *     def connect(self, addr):
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQBindError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_5));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_5));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_5));
  __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_Raise(__pyx_t_3, 0, 0);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("zmq._zmq.Socket.bind_to_random_port");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_i);
  __Pyx_DECREF(__pyx_v_port);
  __Pyx_DECREF((PyObject *)__pyx_v_self);
  __Pyx_DECREF(__pyx_v_addr);
  __Pyx_DECREF(__pyx_v_min_port);
  __Pyx_DECREF(__pyx_v_max_port);
  __Pyx_DECREF(__pyx_v_max_tries);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":609
 *         raise ZMQBindError("Could not bind socket to random port.")
 * 
 *     def connect(self, addr):             # <<<<<<<<<<<<<<
 *         """Connect to a remote 0MQ socket.
 * 
 */

static PyObject *__pyx_pf_3zmq_4_zmq_6Socket_connect(PyObject *__pyx_v_self, PyObject *__pyx_v_addr); /*proto*/
static char __pyx_doc_3zmq_4_zmq_6Socket_connect[] = "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.\n        ";
static PyObject *__pyx_pf_3zmq_4_zmq_6Socket_connect(PyObject *__pyx_v_self, PyObject *__pyx_v_addr) {
  int __pyx_v_rc;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  char *__pyx_t_5;
  __Pyx_RefNannySetupContext("connect");
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_v_addr);

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":621
 *         cdef int rc
 * 
 *         self._check_closed()             # <<<<<<<<<<<<<<
 * 
 *         if not isinstance(addr, str):
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___check_closed); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":623
 *         self._check_closed()
 * 
 *         if not isinstance(addr, str):             # <<<<<<<<<<<<<<
 *             raise TypeError('expected str, got: %r' % addr)
 *         rc = zmq_connect(self.handle, addr)
 */
  __pyx_t_3 = PyObject_TypeCheck(__pyx_v_addr, ((PyTypeObject *)((PyObject*)&PyString_Type))); 
  __pyx_t_4 = (!__pyx_t_3);
  if (__pyx_t_4) {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":624
 * 
 *         if not isinstance(addr, str):
 *             raise TypeError('expected str, got: %r' % addr)             # <<<<<<<<<<<<<<
 *         rc = zmq_connect(self.handle, addr)
 *         if rc != 0:
 */
    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_2), __pyx_v_addr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":625
 *         if not isinstance(addr, str):
 *             raise TypeError('expected str, got: %r' % addr)
 *         rc = zmq_connect(self.handle, addr)             # <<<<<<<<<<<<<<
 *         if rc != 0:
 *             raise ZMQError()
 */
  __pyx_t_5 = __Pyx_PyBytes_AsString(__pyx_v_addr); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_rc = zmq_connect(((struct __pyx_obj_3zmq_4_zmq_Socket *)__pyx_v_self)->handle, __pyx_t_5);

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":626
 *             raise TypeError('expected str, got: %r' % addr)
 *         rc = zmq_connect(self.handle, addr)
 *         if rc != 0:             # <<<<<<<<<<<<<<
 *             raise ZMQError()
 * 
 */
  __pyx_t_4 = (__pyx_v_rc != 0);
  if (__pyx_t_4) {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":627
 *         rc = zmq_connect(self.handle, addr)
 *         if rc != 0:
 *             raise ZMQError()             # <<<<<<<<<<<<<<
 * 
 *     #-------------------------------------------------------------------------
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("zmq._zmq.Socket.connect");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_self);
  __Pyx_DECREF(__pyx_v_addr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":633
 *     #-------------------------------------------------------------------------
 * 
 *     def send(self, object data, int flags=0, bool copy=True):             # <<<<<<<<<<<<<<
 *         """Send a message on this socket.
 * 
 */

static PyObject *__pyx_pf_3zmq_4_zmq_6Socket_send(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3zmq_4_zmq_6Socket_send[] = "Send a message on this socket.\n\n        This queues the message to be sent by the IO thread at a later time.\n\n        Parameters\n        ----------\n        data : object, str, Message\n            The content of the message.\n        flags : int\n            Any supported flag: NOBLOCK, SNDMORE.\n        copy : bool\n            Should the message be sent in a copying or non-copying manner.\n\n        Returns\n        -------\n        None if message was sent, raises an exception otherwise.\n        ";
static PyObject *__pyx_pf_3zmq_4_zmq_6Socket_send(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_data = 0;
  int __pyx_v_flags;
  PyObject *__pyx_v_copy = 0;
  PyObject *__pyx_v_msg;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__data,&__pyx_n_s__flags,&__pyx_n_s__copy,0};
  __Pyx_RefNannySetupContext("send");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    values[2] = (PyObject*)__pyx_k_6;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 1) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags);
        if (unlikely(value)) { values[1] = value; kw_args--; }
      }
      case  2:
      if (kw_args > 1) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__copy);
        if (unlikely(value)) { values[2] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "send") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_data = values[0];
    if (values[1]) {
      __pyx_v_flags = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_flags = ((int)0);
    }
    __pyx_v_copy = ((PyObject *)values[2]);
  } else {
    __pyx_v_flags = ((int)0);
    __pyx_v_copy = __pyx_k_6;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: __pyx_v_copy = ((PyObject *)PyTuple_GET_ITEM(__pyx_args, 2));
      case  2: __pyx_v_flags = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  1: __pyx_v_data = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("send", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("zmq._zmq.Socket.send");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_v_data);
  __Pyx_INCREF(__pyx_v_copy);
  __pyx_v_msg = Py_None; __Pyx_INCREF(Py_None);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_copy), &PyBool_Type, 1, "copy", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":651
 *         None if message was sent, raises an exception otherwise.
 *         """
 *         self._check_closed()             # <<<<<<<<<<<<<<
 *         if isinstance(data, Message):
 *             return self._send_message(data, flags)
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___check_closed); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":652
 *         """
 *         self._check_closed()
 *         if isinstance(data, Message):             # <<<<<<<<<<<<<<
 *             return self._send_message(data, flags)
 *         elif copy:
 */
  __pyx_t_3 = PyObject_TypeCheck(__pyx_v_data, ((PyTypeObject *)((PyObject*)__pyx_ptype_3zmq_4_zmq_Message))); 
  if (__pyx_t_3) {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":653
 *         self._check_closed()
 *         if isinstance(data, Message):
 *             return self._send_message(data, flags)             # <<<<<<<<<<<<<<
 *         elif copy:
 *             return self._send_copy(data, flags)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___send_message); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyInt_FromLong(__pyx_v_flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_data);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_data);
    __Pyx_GIVEREF(__pyx_v_data);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    goto __pyx_L6;
  }

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":654
 *         if isinstance(data, Message):
 *             return self._send_message(data, flags)
 *         elif copy:             # <<<<<<<<<<<<<<
 *             return self._send_copy(data, flags)
 *         else:
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_copy)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_3) {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":655
 *             return self._send_message(data, flags)
 *         elif copy:
 *             return self._send_copy(data, flags)             # <<<<<<<<<<<<<<
 *         else:
 *             # I am not sure which non-copy implemntation to use here.
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___send_copy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyInt_FromLong(__pyx_v_flags); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_data);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_data);
    __Pyx_GIVEREF(__pyx_v_data);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":659
 *             # I am not sure which non-copy implemntation to use here.
 *             # It probably doesn't matter though.
 *             msg = Message(data)             # <<<<<<<<<<<<<<
 *             return self._send_message(msg, flags)
 *             # return self._send_nocopy(msg, flags)
 */
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_data);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_data);
    __Pyx_GIVEREF(__pyx_v_data);
    __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3zmq_4_zmq_Message)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_v_msg);
    __pyx_v_msg = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":660
 *             # It probably doesn't matter though.
 *             msg = Message(data)
 *             return self._send_message(msg, flags)             # <<<<<<<<<<<<<<
 *             # return self._send_nocopy(msg, flags)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___send_message); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyInt_FromLong(__pyx_v_flags); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_msg);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_msg);
    __Pyx_GIVEREF(__pyx_v_msg);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }
  __pyx_L6:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("zmq._zmq.Socket.send");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_msg);
  __Pyx_DECREF((PyObject *)__pyx_v_self);
  __Pyx_DECREF(__pyx_v_data);
  __Pyx_DECREF(__pyx_v_copy);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":663
 *             # return self._send_nocopy(msg, flags)
 * 
 *     def _send_message(self, Message msg, int flags=0):             # <<<<<<<<<<<<<<
 *         """Send a Message on this socket in a non-copy manner."""
 *         cdef int rc
 */

static PyObject *__pyx_pf_3zmq_4_zmq_6Socket__send_message(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3zmq_4_zmq_6Socket__send_message[] = "Send a Message on this socket in a non-copy manner.";
static PyObject *__pyx_pf_3zmq_4_zmq_6Socket__send_message(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_3zmq_4_zmq_Message *__pyx_v_msg = 0;
  int __pyx_v_flags;
  int __pyx_v_rc;
  struct __pyx_obj_3zmq_4_zmq_Message *__pyx_v_msg_copy;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__msg,&__pyx_n_s__flags,0};
  __Pyx_RefNannySetupContext("_send_message");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__msg);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 1) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags);
        if (unlikely(value)) { values[1] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_send_message") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_msg = ((struct __pyx_obj_3zmq_4_zmq_Message *)values[0]);
    if (values[1]) {
      __pyx_v_flags = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_flags = ((int)0);
    }
  } else {
    __pyx_v_flags = ((int)0);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_flags = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  1: __pyx_v_msg = ((struct __pyx_obj_3zmq_4_zmq_Message *)PyTuple_GET_ITEM(__pyx_args, 0));
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_send_message", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("zmq._zmq.Socket._send_message");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_INCREF((PyObject *)__pyx_v_msg);
  __pyx_v_msg_copy = ((struct __pyx_obj_3zmq_4_zmq_Message *)Py_None); __Pyx_INCREF(Py_None);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_msg), __pyx_ptype_3zmq_4_zmq_Message, 1, "msg", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":670
 *         # Always copy so the original message isn't garbage collected.
 *         # This doesn't do a real copy, just a reference.
 *         msg_copy = msg.fast_copy()             # <<<<<<<<<<<<<<
 *         # msg_copy = copy_mod.copy(msg)
 *         with nogil:
 */
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_3zmq_4_zmq_Message *)__pyx_v_msg->__pyx_vtab)->fast_copy(__pyx_v_msg)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_msg_copy));
  __pyx_v_msg_copy = ((struct __pyx_obj_3zmq_4_zmq_Message *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":672
 *         msg_copy = msg.fast_copy()
 *         # msg_copy = copy_mod.copy(msg)
 *         with nogil:             # <<<<<<<<<<<<<<
 *             rc = zmq_send(self.handle, &msg.zmq_msg, flags)
 * 
 */
  { PyThreadState *_save;
    Py_UNBLOCK_THREADS
    /*try:*/ {

      /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":673
 *         # msg_copy = copy_mod.copy(msg)
 *         with nogil:
 *             rc = zmq_send(self.handle, &msg.zmq_msg, flags)             # <<<<<<<<<<<<<<
 * 
 *         if rc != 0:
 */
      __pyx_v_rc = zmq_send(((struct __pyx_obj_3zmq_4_zmq_Socket *)__pyx_v_self)->handle, (&__pyx_v_msg->zmq_msg), __pyx_v_flags);
    }
    /*finally:*/ {

      /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":672
 *         msg_copy = msg.fast_copy()
 *         # msg_copy = copy_mod.copy(msg)
 *         with nogil:             # <<<<<<<<<<<<<<
 *             rc = zmq_send(self.handle, &msg.zmq_msg, flags)
 * 
 */
      Py_BLOCK_THREADS
    }
  }

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":675
 *             rc = zmq_send(self.handle, &msg.zmq_msg, flags)
 * 
 *         if rc != 0:             # <<<<<<<<<<<<<<
 *             raise ZMQError()
 * 
 */
  __pyx_t_2 = (__pyx_v_rc != 0);
  if (__pyx_t_2) {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":676
 * 
 *         if rc != 0:
 *             raise ZMQError()             # <<<<<<<<<<<<<<
 * 
 *     def _send_copy(self, object msg, int flags=0):
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L9;
  }
  __pyx_L9:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("zmq._zmq.Socket._send_message");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_msg_copy);
  __Pyx_DECREF((PyObject *)__pyx_v_self);
  __Pyx_DECREF((PyObject *)__pyx_v_msg);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":678
 *             raise ZMQError()
 * 
 *     def _send_copy(self, object msg, int flags=0):             # <<<<<<<<<<<<<<
 *         """Send a message on this socket by copying its content."""
 *         cdef int rc, rc2
 */

static PyObject *__pyx_pf_3zmq_4_zmq_6Socket__send_copy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3zmq_4_zmq_6Socket__send_copy[] = "Send a message on this socket by copying its content.";
static PyObject *__pyx_pf_3zmq_4_zmq_6Socket__send_copy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_msg = 0;
  int __pyx_v_flags;
  int __pyx_v_rc;
  int __pyx_v_rc2;
  zmq_msg_t __pyx_v_data;
  char *__pyx_v_msg_c;
  Py_ssize_t __pyx_v_msg_c_len;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__msg,&__pyx_n_s__flags,0};
  __Pyx_RefNannySetupContext("_send_copy");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__msg);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 1) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags);
        if (unlikely(value)) { values[1] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_send_copy") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_msg = values[0];
    if (values[1]) {
      __pyx_v_flags = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_flags = ((int)0);
    }
  } else {
    __pyx_v_flags = ((int)0);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_flags = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  1: __pyx_v_msg = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_send_copy", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("zmq._zmq.Socket._send_copy");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_v_msg);

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":685
 *         cdef Py_ssize_t msg_c_len
 * 
 *         if not isinstance(msg, str):             # <<<<<<<<<<<<<<
 *             raise TypeError('expected str, got: %r' % msg)
 * 
 */
  __pyx_t_1 = PyObject_TypeCheck(__pyx_v_msg, ((PyTypeObject *)((PyObject*)&PyString_Type))); 
  __pyx_t_2 = (!__pyx_t_1);
  if (__pyx_t_2) {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":686
 * 
 *         if not isinstance(msg, str):
 *             raise TypeError('expected str, got: %r' % msg)             # <<<<<<<<<<<<<<
 * 
 *         PyString_AsStringAndSize(msg, &msg_c, &msg_c_len)
 */
    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_2), __pyx_v_msg); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":688
 *             raise TypeError('expected str, got: %r' % msg)
 * 
 *         PyString_AsStringAndSize(msg, &msg_c, &msg_c_len)             # <<<<<<<<<<<<<<
 *         # Copy the msg before sending. This avoids any complications with
 *         # the GIL, etc.
 */
  __pyx_t_5 = PyString_AsStringAndSize(__pyx_v_msg, (&__pyx_v_msg_c), (&__pyx_v_msg_c_len)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":692
 *         # the GIL, etc.
 *         # If zmq_msg_init_* fails do we need to call zmq_msg_close?
 *         rc = zmq_msg_init_size(&data, msg_c_len)             # <<<<<<<<<<<<<<
 *         memcpy(zmq_msg_data(&data), msg_c, zmq_msg_size(&data))
 * 
 */
  __pyx_v_rc = zmq_msg_init_size((&__pyx_v_data), __pyx_v_msg_c_len);

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":693
 *         # If zmq_msg_init_* fails do we need to call zmq_msg_close?
 *         rc = zmq_msg_init_size(&data, msg_c_len)
 *         memcpy(zmq_msg_data(&data), msg_c, zmq_msg_size(&data))             # <<<<<<<<<<<<<<
 * 
 *         if rc != 0:
 */
  memcpy(zmq_msg_data((&__pyx_v_data)), __pyx_v_msg_c, zmq_msg_size((&__pyx_v_data)));

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":695
 *         memcpy(zmq_msg_data(&data), msg_c, zmq_msg_size(&data))
 * 
 *         if rc != 0:             # <<<<<<<<<<<<<<
 *             raise ZMQError()
 * 
 */
  __pyx_t_2 = (__pyx_v_rc != 0);
  if (__pyx_t_2) {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":696
 * 
 *         if rc != 0:
 *             raise ZMQError()             # <<<<<<<<<<<<<<
 * 
 *         with nogil:
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":698
 *             raise ZMQError()
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             rc = zmq_send(self.handle, &data, flags)
 *         rc2 = zmq_msg_close(&data)
 */
  { PyThreadState *_save;
    Py_UNBLOCK_THREADS
    /*try:*/ {

      /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":699
 * 
 *         with nogil:
 *             rc = zmq_send(self.handle, &data, flags)             # <<<<<<<<<<<<<<
 *         rc2 = zmq_msg_close(&data)
 * 
 */
      __pyx_v_rc = zmq_send(((struct __pyx_obj_3zmq_4_zmq_Socket *)__pyx_v_self)->handle, (&__pyx_v_data), __pyx_v_flags);
    }
    /*finally:*/ {

      /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":698
 *             raise ZMQError()
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             rc = zmq_send(self.handle, &data, flags)
 *         rc2 = zmq_msg_close(&data)
 */
      Py_BLOCK_THREADS
    }
  }

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":700
 *         with nogil:
 *             rc = zmq_send(self.handle, &data, flags)
 *         rc2 = zmq_msg_close(&data)             # <<<<<<<<<<<<<<
 * 
 *         # Shouldn't the error handling for zmq_msg_close come after that
 */
  __pyx_v_rc2 = zmq_msg_close((&__pyx_v_data));

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":704
 *         # Shouldn't the error handling for zmq_msg_close come after that
 *         # of zmq_send?
 *         if rc2 != 0:             # <<<<<<<<<<<<<<
 *             raise ZMQError()
 * 
 */
  __pyx_t_2 = (__pyx_v_rc2 != 0);
  if (__pyx_t_2) {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":705
 *         # of zmq_send?
 *         if rc2 != 0:
 *             raise ZMQError()             # <<<<<<<<<<<<<<
 * 
 *         if rc != 0:
 */
    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L11;
  }
  __pyx_L11:;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":707
 *             raise ZMQError()
 * 
 *         if rc != 0:             # <<<<<<<<<<<<<<
 *             raise ZMQError()
 * 
 */
  __pyx_t_2 = (__pyx_v_rc != 0);
  if (__pyx_t_2) {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":708
 * 
 *         if rc != 0:
 *             raise ZMQError()             # <<<<<<<<<<<<<<
 * 
 *     def _send_nocopy(self, object msg, int flags=0):
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L12;
  }
  __pyx_L12:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("zmq._zmq.Socket._send_copy");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_self);
  __Pyx_DECREF(__pyx_v_msg);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":710
 *             raise ZMQError()
 * 
 *     def _send_nocopy(self, object msg, int flags=0):             # <<<<<<<<<<<<<<
 *         """Send a Python string on this socket in a non-copy manner.
 * 
 */

static PyObject *__pyx_pf_3zmq_4_zmq_6Socket__send_nocopy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3zmq_4_zmq_6Socket__send_nocopy[] = "Send a Python string on this socket in a non-copy manner.\n\n        This method is not being used currently, as the same functionality\n        is provided by self._send_message(Message(data)). This may eventually\n        be removed.\n        ";
static PyObject *__pyx_pf_3zmq_4_zmq_6Socket__send_nocopy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_msg = 0;
  int __pyx_v_flags;
  int __pyx_v_rc;
  zmq_msg_t __pyx_v_data;
  char *__pyx_v_msg_c;
  Py_ssize_t __pyx_v_msg_c_len;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__msg,&__pyx_n_s__flags,0};
  __Pyx_RefNannySetupContext("_send_nocopy");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__msg);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 1) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags);
        if (unlikely(value)) { values[1] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_send_nocopy") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_msg = values[0];
    if (values[1]) {
      __pyx_v_flags = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_flags = ((int)0);
    }
  } else {
    __pyx_v_flags = ((int)0);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_flags = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  1: __pyx_v_msg = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_send_nocopy", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("zmq._zmq.Socket._send_nocopy");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_v_msg);

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":722
 *         cdef Py_ssize_t msg_c_len
 * 
 *         if not isinstance(msg, str):             # <<<<<<<<<<<<<<
 *             raise TypeError('expected str, got: %r' % msg)
 * 
 */
  __pyx_t_1 = PyObject_TypeCheck(__pyx_v_msg, ((PyTypeObject *)((PyObject*)&PyString_Type))); 
  __pyx_t_2 = (!__pyx_t_1);
  if (__pyx_t_2) {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":723
 * 
 *         if not isinstance(msg, str):
 *             raise TypeError('expected str, got: %r' % msg)             # <<<<<<<<<<<<<<
 * 
 *         PyString_AsStringAndSize(msg, &msg_c, &msg_c_len)
 */
    __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_2), __pyx_v_msg); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":725
 *             raise TypeError('expected str, got: %r' % msg)
 * 
 *         PyString_AsStringAndSize(msg, &msg_c, &msg_c_len)             # <<<<<<<<<<<<<<
 *         Py_INCREF(msg) # We INCREF to prevent Python from gc'ing msg
 *         rc = zmq_msg_init_data(
 */
  __pyx_t_5 = PyString_AsStringAndSize(__pyx_v_msg, (&__pyx_v_msg_c), (&__pyx_v_msg_c_len)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":726
 * 
 *         PyString_AsStringAndSize(msg, &msg_c, &msg_c_len)
 *         Py_INCREF(msg) # We INCREF to prevent Python from gc'ing msg             # <<<<<<<<<<<<<<
 *         rc = zmq_msg_init_data(
 *             &data, <void *>msg_c, msg_c_len,
 */
  Py_INCREF(__pyx_v_msg);

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":730
 *             &data, <void *>msg_c, msg_c_len,
 *             <zmq_free_fn *>free_python_msg, <void *>msg
 *         )             # <<<<<<<<<<<<<<
 * 
 *         if rc != 0:
 */
  __pyx_v_rc = zmq_msg_init_data((&__pyx_v_data), ((void *)__pyx_v_msg_c), __pyx_v_msg_c_len, ((zmq_free_fn *)__pyx_f_3zmq_4_zmq_free_python_msg), ((void *)__pyx_v_msg));

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":732
 *         )
 * 
 *         if rc != 0:             # <<<<<<<<<<<<<<
 *             # If zmq_msg_init_data fails it does not call zmq_free_fn,
 *             # so we Py_DECREF.
 */
  __pyx_t_2 = (__pyx_v_rc != 0);
  if (__pyx_t_2) {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":735
 *             # If zmq_msg_init_data fails it does not call zmq_free_fn,
 *             # so we Py_DECREF.
 *             Py_DECREF(msg)             # <<<<<<<<<<<<<<
 *             raise ZMQError()
 * 
 */
    Py_DECREF(__pyx_v_msg);

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":736
 *             # so we Py_DECREF.
 *             Py_DECREF(msg)
 *             raise ZMQError()             # <<<<<<<<<<<<<<
 * 
 *         with nogil:
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":738
 *             raise ZMQError()
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             rc = zmq_send(self.handle, &data, flags)
 * 
 */
  { PyThreadState *_save;
    Py_UNBLOCK_THREADS
    /*try:*/ {

      /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":739
 * 
 *         with nogil:
 *             rc = zmq_send(self.handle, &data, flags)             # <<<<<<<<<<<<<<
 * 
 *         if rc != 0:
 */
      __pyx_v_rc = zmq_send(((struct __pyx_obj_3zmq_4_zmq_Socket *)__pyx_v_self)->handle, (&__pyx_v_data), __pyx_v_flags);
    }
    /*finally:*/ {

      /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":738
 *             raise ZMQError()
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             rc = zmq_send(self.handle, &data, flags)
 * 
 */
      Py_BLOCK_THREADS
    }
  }

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":741
 *             rc = zmq_send(self.handle, &data, flags)
 * 
 *         if rc != 0:             # <<<<<<<<<<<<<<
 *             # If zmq_send fails it does not call zmq_free_fn, so we Py_DECREF.
 *             Py_DECREF(msg)
 */
  __pyx_t_2 = (__pyx_v_rc != 0);
  if (__pyx_t_2) {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":743
 *         if rc != 0:
 *             # If zmq_send fails it does not call zmq_free_fn, so we Py_DECREF.
 *             Py_DECREF(msg)             # <<<<<<<<<<<<<<
 *             zmq_msg_close(&data)
 *             raise ZMQError()
 */
    Py_DECREF(__pyx_v_msg);

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":744
 *             # If zmq_send fails it does not call zmq_free_fn, so we Py_DECREF.
 *             Py_DECREF(msg)
 *             zmq_msg_close(&data)             # <<<<<<<<<<<<<<
 *             raise ZMQError()
 * 
 */
    zmq_msg_close((&__pyx_v_data));

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":745
 *             Py_DECREF(msg)
 *             zmq_msg_close(&data)
 *             raise ZMQError()             # <<<<<<<<<<<<<<
 * 
 *         rc = zmq_msg_close(&data)
 */
    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L11;
  }
  __pyx_L11:;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":747
 *             raise ZMQError()
 * 
 *         rc = zmq_msg_close(&data)             # <<<<<<<<<<<<<<
 *         if rc != 0:
 *             raise ZMQError()
 */
  __pyx_v_rc = zmq_msg_close((&__pyx_v_data));

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":748
 * 
 *         rc = zmq_msg_close(&data)
 *         if rc != 0:             # <<<<<<<<<<<<<<
 *             raise ZMQError()
 * 
 */
  __pyx_t_2 = (__pyx_v_rc != 0);
  if (__pyx_t_2) {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":749
 *         rc = zmq_msg_close(&data)
 *         if rc != 0:
 *             raise ZMQError()             # <<<<<<<<<<<<<<
 * 
 *     def recv(self, int flags=0, copy=True):
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L12;
  }
  __pyx_L12:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("zmq._zmq.Socket._send_nocopy");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_self);
  __Pyx_DECREF(__pyx_v_msg);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":751
 *             raise ZMQError()
 * 
 *     def recv(self, int flags=0, copy=True):             # <<<<<<<<<<<<<<
 *         """Receive a message.
 * 
 */

static PyObject *__pyx_pf_3zmq_4_zmq_6Socket_recv(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3zmq_4_zmq_6Socket_recv[] = "Receive a message.\n\n        Parameters\n        ----------\n        flags : int\n            Any supported flag: NOBLOCK. If NOBLOCK is set, this method\n            will return None if a message is not ready. If NOBLOCK is not\n            set, then this method will block until a message arrives.\n        copy : bool\n            Should the message be received in a copying or non-copying manner.\n            If False a Message object is returned, if True a string copy of\n            message is returned.\n        Returns\n        -------\n        msg : str\n            The returned message, or raises ZMQError otherwise.\n        ";
static PyObject *__pyx_pf_3zmq_4_zmq_6Socket_recv(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_flags;
  PyObject *__pyx_v_copy = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__flags,&__pyx_n_s__copy,0};
  __Pyx_RefNannySetupContext("recv");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    values[1] = __pyx_k_7;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 1) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags);
        if (unlikely(value)) { values[0] = value; kw_args--; }
      }
      case  1:
      if (kw_args > 1) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__copy);
        if (unlikely(value)) { values[1] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "recv") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    if (values[0]) {
      __pyx_v_flags = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_flags = ((int)0);
    }
    __pyx_v_copy = values[1];
  } else {
    __pyx_v_flags = ((int)0);
    __pyx_v_copy = __pyx_k_7;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_copy = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_flags = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("recv", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("zmq._zmq.Socket.recv");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_v_copy);

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":769
 *             The returned message, or raises ZMQError otherwise.
 *         """
 *         self._check_closed()             # <<<<<<<<<<<<<<
 *         if copy:
 *             # This could be implemented by simple calling _recv_message and
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___check_closed); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":770
 *         """
 *         self._check_closed()
 *         if copy:             # <<<<<<<<<<<<<<
 *             # This could be implemented by simple calling _recv_message and
 *             # then casting to a str.
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_copy); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_3) {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":773
 *             # This could be implemented by simple calling _recv_message and
 *             # then casting to a str.
 *             return self._recv_copy(flags)             # <<<<<<<<<<<<<<
 *         else:
 *             return self._recv_message(flags)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___recv_copy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyInt_FromLong(__pyx_v_flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":775
 *             return self._recv_copy(flags)
 *         else:
 *             return self._recv_message(flags)             # <<<<<<<<<<<<<<
 * 
 *     def _recv_message(self, int flags=0):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___recv_message); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyInt_FromLong(__pyx_v_flags); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }
  __pyx_L6:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("zmq._zmq.Socket.recv");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_self);
  __Pyx_DECREF(__pyx_v_copy);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":777
 *             return self._recv_message(flags)
 * 
 *     def _recv_message(self, int flags=0):             # <<<<<<<<<<<<<<
 *         """Receive a message in a non-copying manner and return a Message."""
 *         cdef int rc
 */

static PyObject *__pyx_pf_3zmq_4_zmq_6Socket__recv_message(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3zmq_4_zmq_6Socket__recv_message[] = "Receive a message in a non-copying manner and return a Message.";
static PyObject *__pyx_pf_3zmq_4_zmq_6Socket__recv_message(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_flags;
  int __pyx_v_rc;
  struct __pyx_obj_3zmq_4_zmq_Message *__pyx_v_msg;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__flags,0};
  __Pyx_RefNannySetupContext("_recv_message");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 1) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags);
        if (unlikely(value)) { values[0] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_recv_message") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    if (values[0]) {
      __pyx_v_flags = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_flags = ((int)0);
    }
  } else {
    __pyx_v_flags = ((int)0);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: __pyx_v_flags = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_recv_message", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("zmq._zmq.Socket._recv_message");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __pyx_v_msg = ((struct __pyx_obj_3zmq_4_zmq_Message *)Py_None); __Pyx_INCREF(Py_None);

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":781
 *         cdef int rc
 *         cdef Message msg
 *         msg = Message()             # <<<<<<<<<<<<<<
 * 
 *         with nogil:
 */
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_3zmq_4_zmq_Message)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_v_msg));
  __pyx_v_msg = ((struct __pyx_obj_3zmq_4_zmq_Message *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":783
 *         msg = Message()
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             rc = zmq_recv(self.handle, &msg.zmq_msg, flags)
 * 
 */
  { PyThreadState *_save;
    Py_UNBLOCK_THREADS
    /*try:*/ {

      /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":784
 * 
 *         with nogil:
 *             rc = zmq_recv(self.handle, &msg.zmq_msg, flags)             # <<<<<<<<<<<<<<
 * 
 *         if rc != 0:
 */
      __pyx_v_rc = zmq_recv(((struct __pyx_obj_3zmq_4_zmq_Socket *)__pyx_v_self)->handle, (&__pyx_v_msg->zmq_msg), __pyx_v_flags);
    }
    /*finally:*/ {

      /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":783
 *         msg = Message()
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             rc = zmq_recv(self.handle, &msg.zmq_msg, flags)
 * 
 */
      Py_BLOCK_THREADS
    }
  }

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":786
 *             rc = zmq_recv(self.handle, &msg.zmq_msg, flags)
 * 
 *         if rc != 0:             # <<<<<<<<<<<<<<
 *             raise ZMQError()
 *         return msg
 */
  __pyx_t_2 = (__pyx_v_rc != 0);
  if (__pyx_t_2) {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":787
 * 
 *         if rc != 0:
 *             raise ZMQError()             # <<<<<<<<<<<<<<
 *         return msg
 * 
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L9;
  }
  __pyx_L9:;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":788
 *         if rc != 0:
 *             raise ZMQError()
 *         return msg             # <<<<<<<<<<<<<<
 * 
 *     def _recv_copy(self, int flags=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_msg));
  __pyx_r = ((PyObject *)__pyx_v_msg);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("zmq._zmq.Socket._recv_message");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_msg);
  __Pyx_DECREF((PyObject *)__pyx_v_self);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":790
 *         return msg
 * 
 *     def _recv_copy(self, int flags=0):             # <<<<<<<<<<<<<<
 *         """Receive a message in a copying manner as a string."""
 *         cdef int rc
 */

static PyObject *__pyx_pf_3zmq_4_zmq_6Socket__recv_copy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3zmq_4_zmq_6Socket__recv_copy[] = "Receive a message in a copying manner as a string.";
static PyObject *__pyx_pf_3zmq_4_zmq_6Socket__recv_copy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_flags;
  int __pyx_v_rc;
  zmq_msg_t __pyx_v_data;
  PyObject *__pyx_v_msg;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__flags,0};
  __Pyx_RefNannySetupContext("_recv_copy");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 1) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags);
        if (unlikely(value)) { values[0] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_recv_copy") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    if (values[0]) {
      __pyx_v_flags = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_flags = ((int)0);
    }
  } else {
    __pyx_v_flags = ((int)0);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: __pyx_v_flags = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_recv_copy", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("zmq._zmq.Socket._recv_copy");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __pyx_v_msg = Py_None; __Pyx_INCREF(Py_None);

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":795
 *         cdef zmq_msg_t data
 * 
 *         rc = zmq_msg_init(&data)             # <<<<<<<<<<<<<<
 *         if rc != 0:
 *             raise ZMQError()
 */
  __pyx_v_rc = zmq_msg_init((&__pyx_v_data));

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":796
 * 
 *         rc = zmq_msg_init(&data)
 *         if rc != 0:             # <<<<<<<<<<<<<<
 *             raise ZMQError()
 * 
 */
  __pyx_t_1 = (__pyx_v_rc != 0);
  if (__pyx_t_1) {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":797
 *         rc = zmq_msg_init(&data)
 *         if rc != 0:
 *             raise ZMQError()             # <<<<<<<<<<<<<<
 * 
 *         with nogil:
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":799
 *             raise ZMQError()
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             rc = zmq_recv(self.handle, &data, flags)
 * 
 */
  { PyThreadState *_save;
    Py_UNBLOCK_THREADS
    /*try:*/ {

      /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":800
 * 
 *         with nogil:
 *             rc = zmq_recv(self.handle, &data, flags)             # <<<<<<<<<<<<<<
 * 
 *         if rc != 0:
 */
      __pyx_v_rc = zmq_recv(((struct __pyx_obj_3zmq_4_zmq_Socket *)__pyx_v_self)->handle, (&__pyx_v_data), __pyx_v_flags);
    }
    /*finally:*/ {

      /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":799
 *             raise ZMQError()
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             rc = zmq_recv(self.handle, &data, flags)
 * 
 */
      Py_BLOCK_THREADS
    }
  }

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":802
 *             rc = zmq_recv(self.handle, &data, flags)
 * 
 *         if rc != 0:             # <<<<<<<<<<<<<<
 *             raise ZMQError()
 * 
 */
  __pyx_t_1 = (__pyx_v_rc != 0);
  if (__pyx_t_1) {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":803
 * 
 *         if rc != 0:
 *             raise ZMQError()             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L10;
  }
  __pyx_L10:;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":805
 *             raise ZMQError()
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             msg = PyString_FromStringAndSize(
 *                 <char *>zmq_msg_data(&data),
 */
  /*try:*/ {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":808
 *             msg = PyString_FromStringAndSize(
 *                 <char *>zmq_msg_data(&data),
 *                 zmq_msg_size(&data)             # <<<<<<<<<<<<<<
 *             )
 *         finally:
 */
    __pyx_t_2 = PyString_FromStringAndSize(((char *)zmq_msg_data((&__pyx_v_data))), zmq_msg_size((&__pyx_v_data))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L12;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_v_msg);
    __pyx_v_msg = __pyx_t_2;
    __pyx_t_2 = 0;
  }
  /*finally:*/ {
    int __pyx_why;
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
    int __pyx_exc_lineno;
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 0; goto __pyx_L13;
    __pyx_L12: {
      __pyx_why = 4;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
      __pyx_exc_lineno = __pyx_lineno;
      goto __pyx_L13;
    }
    __pyx_L13:;

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":811
 *             )
 *         finally:
 *             rc = zmq_msg_close(&data)             # <<<<<<<<<<<<<<
 * 
 *         if rc != 0:
 */
    __pyx_v_rc = zmq_msg_close((&__pyx_v_data));
    switch (__pyx_why) {
      case 4: {
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
        __pyx_lineno = __pyx_exc_lineno;
        __pyx_exc_type = 0;
        __pyx_exc_value = 0;
        __pyx_exc_tb = 0;
        goto __pyx_L1_error;
      }
    }
  }

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":813
 *             rc = zmq_msg_close(&data)
 * 
 *         if rc != 0:             # <<<<<<<<<<<<<<
 *             raise ZMQError()
 *         return msg
 */
  __pyx_t_1 = (__pyx_v_rc != 0);
  if (__pyx_t_1) {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":814
 * 
 *         if rc != 0:
 *             raise ZMQError()             # <<<<<<<<<<<<<<
 *         return msg
 * 
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L15;
  }
  __pyx_L15:;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":815
 *         if rc != 0:
 *             raise ZMQError()
 *         return msg             # <<<<<<<<<<<<<<
 * 
 *     def send_multipart(self, msg_parts, int flags=0, copy=True):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_msg);
  __pyx_r = __pyx_v_msg;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("zmq._zmq.Socket._recv_copy");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_msg);
  __Pyx_DECREF((PyObject *)__pyx_v_self);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":817
 *         return msg
 * 
 *     def send_multipart(self, msg_parts, int flags=0, copy=True):             # <<<<<<<<<<<<<<
 *         """Send a sequence of messages as a multipart message.
 * 
 */

static PyObject *__pyx_pf_3zmq_4_zmq_6Socket_send_multipart(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3zmq_4_zmq_6Socket_send_multipart[] = "Send a sequence of messages as a multipart message.\n\n        Parameters\n        ----------\n        msg_parts : iterable\n            A sequence of messages to send as a multipart message.\n        flags : int\n            Only the NOBLOCK flagis supported, SNDMORE is handled\n            automatically.\n        ";
static PyObject *__pyx_pf_3zmq_4_zmq_6Socket_send_multipart(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_msg_parts = 0;
  int __pyx_v_flags;
  PyObject *__pyx_v_copy = 0;
  PyObject *__pyx_v_msg;
  PyObject *__pyx_r = NULL;
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__msg_parts,&__pyx_n_s__flags,&__pyx_n_s__copy,0};
  __Pyx_RefNannySetupContext("send_multipart");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    values[2] = __pyx_k_8;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__msg_parts);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 1) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags);
        if (unlikely(value)) { values[1] = value; kw_args--; }
      }
      case  2:
      if (kw_args > 1) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__copy);
        if (unlikely(value)) { values[2] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "send_multipart") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_msg_parts = values[0];
    if (values[1]) {
      __pyx_v_flags = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_flags = ((int)0);
    }
    __pyx_v_copy = values[2];
  } else {
    __pyx_v_flags = ((int)0);
    __pyx_v_copy = __pyx_k_8;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: __pyx_v_copy = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: __pyx_v_flags = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  1: __pyx_v_msg_parts = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("send_multipart", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("zmq._zmq.Socket.send_multipart");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_v_msg_parts);
  __Pyx_INCREF(__pyx_v_copy);
  __pyx_v_msg = Py_None; __Pyx_INCREF(Py_None);

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":828
 *             automatically.
 *         """
 *         for msg in msg_parts[:-1]:             # <<<<<<<<<<<<<<
 *             self.send(msg, SNDMORE|flags, copy=copy)
 *         # Send the last part without the SNDMORE flag.
 */
  __pyx_t_2 = PySequence_GetSlice(__pyx_v_msg_parts, 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
    __pyx_t_1 = 0; __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3);
  } else {
    __pyx_t_1 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (likely(PyList_CheckExact(__pyx_t_3))) {
      if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_3)) break;
      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_2); __pyx_t_1++;
    } else if (likely(PyTuple_CheckExact(__pyx_t_3))) {
      if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_2); __pyx_t_1++;
    } else {
      __pyx_t_2 = PyIter_Next(__pyx_t_3);
      if (!__pyx_t_2) {
        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_DECREF(__pyx_v_msg);
    __pyx_v_msg = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":829
 *         """
 *         for msg in msg_parts[:-1]:
 *             self.send(msg, SNDMORE|flags, copy=copy)             # <<<<<<<<<<<<<<
 *         # Send the last part without the SNDMORE flag.
 *         self.send(msg_parts[-1], flags)
 */
    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__send); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__SNDMORE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyInt_FromLong(__pyx_v_flags); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyNumber_Or(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_msg);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_msg);
    __Pyx_GIVEREF(__pyx_v_msg);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
    if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__copy), __pyx_v_copy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_2, __pyx_t_5, ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":831
 *             self.send(msg, SNDMORE|flags, copy=copy)
 *         # Send the last part without the SNDMORE flag.
 *         self.send(msg_parts[-1], flags)             # <<<<<<<<<<<<<<
 * 
 *     def recv_multipart(self, int flags=0, copy=True):
 */
  __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__send); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_msg_parts, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = PyInt_FromLong(__pyx_v_flags); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __pyx_t_4 = 0;
  __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("zmq._zmq.Socket.send_multipart");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_msg);
  __Pyx_DECREF((PyObject *)__pyx_v_self);
  __Pyx_DECREF(__pyx_v_msg_parts);
  __Pyx_DECREF(__pyx_v_copy);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":833
 *         self.send(msg_parts[-1], flags)
 * 
 *     def recv_multipart(self, int flags=0, copy=True):             # <<<<<<<<<<<<<<
 *         """Receive a multipart message as a list of messages.
 * 
 */

static PyObject *__pyx_pf_3zmq_4_zmq_6Socket_recv_multipart(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3zmq_4_zmq_6Socket_recv_multipart[] = "Receive a multipart message as a list of messages.\n\n        Parameters\n        ----------\n        flags : int\n            Any supported flag: NOBLOCK. If NOBLOCK is set, this method\n            will return None if a message is not ready. If NOBLOCK is not\n            set, then this method will block until a message arrives.\n\n        Returns\n        -------\n        msg_parts : list\n            A list of messages in the multipart message.\n        ";
static PyObject *__pyx_pf_3zmq_4_zmq_6Socket_recv_multipart(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_flags;
  PyObject *__pyx_v_copy = 0;
  PyObject *__pyx_v_parts;
  PyObject *__pyx_v_part;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__flags,&__pyx_n_s__copy,0};
  __Pyx_RefNannySetupContext("recv_multipart");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    values[1] = __pyx_k_9;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 1) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags);
        if (unlikely(value)) { values[0] = value; kw_args--; }
      }
      case  1:
      if (kw_args > 1) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__copy);
        if (unlikely(value)) { values[1] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "recv_multipart") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    if (values[0]) {
      __pyx_v_flags = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_flags = ((int)0);
    }
    __pyx_v_copy = values[1];
  } else {
    __pyx_v_flags = ((int)0);
    __pyx_v_copy = __pyx_k_9;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_copy = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_flags = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("recv_multipart", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("zmq._zmq.Socket.recv_multipart");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_v_copy);
  __pyx_v_parts = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_part = Py_None; __Pyx_INCREF(Py_None);

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":848
 *             A list of messages in the multipart message.
 *         """
 *         parts = []             # <<<<<<<<<<<<<<
 *         while True:
 *             part = self.recv(flags, copy=copy)
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_DECREF(__pyx_v_parts);
  __pyx_v_parts = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":849
 *         """
 *         parts = []
 *         while True:             # <<<<<<<<<<<<<<
 *             part = self.recv(flags, copy=copy)
 *             parts.append(part)
 */
  while (1) {
    __pyx_t_2 = 1;
    if (!__pyx_t_2) break;

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":850
 *         parts = []
 *         while True:
 *             part = self.recv(flags, copy=copy)             # <<<<<<<<<<<<<<
 *             parts.append(part)
 *             if self.rcvmore():
 */
    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__recv); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyInt_FromLong(__pyx_v_flags); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__copy), __pyx_v_copy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_1, __pyx_t_4, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_v_part);
    __pyx_v_part = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":851
 *         while True:
 *             part = self.recv(flags, copy=copy)
 *             parts.append(part)             # <<<<<<<<<<<<<<
 *             if self.rcvmore():
 *                 continue
 */
    __pyx_t_5 = __Pyx_PyObject_Append(__pyx_v_parts, __pyx_v_part); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":852
 *             part = self.recv(flags, copy=copy)
 *             parts.append(part)
 *             if self.rcvmore():             # <<<<<<<<<<<<<<
 *                 continue
 *             else:
 */
    __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__rcvmore); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_2) {

      /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":853
 *             parts.append(part)
 *             if self.rcvmore():
 *                 continue             # <<<<<<<<<<<<<<
 *             else:
 *                 break
 */
      goto __pyx_L6_continue;
      goto __pyx_L8;
    }
    /*else*/ {

      /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":855
 *                 continue
 *             else:
 *                 break             # <<<<<<<<<<<<<<
 *         return parts
 * 
 */
      goto __pyx_L7_break;
    }
    __pyx_L8:;
    __pyx_L6_continue:;
  }
  __pyx_L7_break:;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":856
 *             else:
 *                 break
 *         return parts             # <<<<<<<<<<<<<<
 * 
 *     def rcvmore(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_parts);
  __pyx_r = __pyx_v_parts;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("zmq._zmq.Socket.recv_multipart");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_parts);
  __Pyx_DECREF(__pyx_v_part);
  __Pyx_DECREF((PyObject *)__pyx_v_self);
  __Pyx_DECREF(__pyx_v_copy);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":858
 *         return parts
 * 
 *     def rcvmore(self):             # <<<<<<<<<<<<<<
 *         """Are there more parts to a multipart message."""
 *         more = self.getsockopt(RCVMORE)
 */

static PyObject *__pyx_pf_3zmq_4_zmq_6Socket_rcvmore(PyObject *__pyx_v_self, PyObject *unused); /*proto*/
static char __pyx_doc_3zmq_4_zmq_6Socket_rcvmore[] = "Are there more parts to a multipart message.";
static PyObject *__pyx_pf_3zmq_4_zmq_6Socket_rcvmore(PyObject *__pyx_v_self, PyObject *unused) {
  PyObject *__pyx_v_more;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("rcvmore");
  __pyx_v_more = Py_None; __Pyx_INCREF(Py_None);

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":860
 *     def rcvmore(self):
 *         """Are there more parts to a multipart message."""
 *         more = self.getsockopt(RCVMORE)             # <<<<<<<<<<<<<<
 *         return bool(more)
 * 
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__getsockopt); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__RCVMORE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_v_more);
  __pyx_v_more = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":861
 *         """Are there more parts to a multipart message."""
 *         more = self.getsockopt(RCVMORE)
 *         return bool(more)             # <<<<<<<<<<<<<<
 * 
 *     def send_pyobj(self, obj, flags=0, protocol=-1):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_more);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_more);
  __Pyx_GIVEREF(__pyx_v_more);
  __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)&PyBool_Type)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("zmq._zmq.Socket.rcvmore");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_more);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":863
 *         return bool(more)
 * 
 *     def send_pyobj(self, obj, flags=0, protocol=-1):             # <<<<<<<<<<<<<<
 *         """Send a Python object as a message using pickle to serialize.
 * 
 */

static PyObject *__pyx_pf_3zmq_4_zmq_6Socket_send_pyobj(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3zmq_4_zmq_6Socket_send_pyobj[] = "Send a Python object as a message using pickle to serialize.\n\n        Parameters\n        ----------\n        obj : Python object\n            The Python object to send.\n        flags : int\n            Any valid send flag.\n        protocol : int\n            The pickle protocol number to use. Default of -1 will select\n            the highest supported number. Use 0 for multiple platform\n            support.\n        ";
static PyObject *__pyx_pf_3zmq_4_zmq_6Socket_send_pyobj(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_obj = 0;
  PyObject *__pyx_v_flags = 0;
  PyObject *__pyx_v_protocol = 0;
  PyObject *__pyx_v_msg;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__obj,&__pyx_n_s__flags,&__pyx_n_s__protocol,0};
  __Pyx_RefNannySetupContext("send_pyobj");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)__pyx_int_0);
    values[2] = ((PyObject *)__pyx_int_neg_1);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__obj);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 1) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags);
        if (unlikely(value)) { values[1] = value; kw_args--; }
      }
      case  2:
      if (kw_args > 1) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__protocol);
        if (unlikely(value)) { values[2] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "send_pyobj") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_obj = values[0];
    __pyx_v_flags = values[1];
    __pyx_v_protocol = values[2];
  } else {
    __pyx_v_flags = ((PyObject *)__pyx_int_0);
    __pyx_v_protocol = ((PyObject *)__pyx_int_neg_1);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: __pyx_v_protocol = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: __pyx_v_flags = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_obj = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("send_pyobj", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("zmq._zmq.Socket.send_pyobj");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_msg = Py_None; __Pyx_INCREF(Py_None);

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":877
 *             support.
 *         """
 *         msg = pickle.dumps(obj, protocol)             # <<<<<<<<<<<<<<
 *         return self.send(msg, flags)
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__pickle); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__dumps); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_obj);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_obj);
  __Pyx_GIVEREF(__pyx_v_obj);
  __Pyx_INCREF(__pyx_v_protocol);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_protocol);
  __Pyx_GIVEREF(__pyx_v_protocol);
  __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_v_msg);
  __pyx_v_msg = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":878
 *         """
 *         msg = pickle.dumps(obj, protocol)
 *         return self.send(msg, flags)             # <<<<<<<<<<<<<<
 * 
 *     def recv_pyobj(self, flags=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__send); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_msg);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_msg);
  __Pyx_GIVEREF(__pyx_v_msg);
  __Pyx_INCREF(__pyx_v_flags);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_flags);
  __Pyx_GIVEREF(__pyx_v_flags);
  __pyx_t_2 = PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("zmq._zmq.Socket.send_pyobj");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_msg);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":880
 *         return self.send(msg, flags)
 * 
 *     def recv_pyobj(self, flags=0):             # <<<<<<<<<<<<<<
 *         """Receive a Python object as a message using pickle to serialize.
 * 
 */

static PyObject *__pyx_pf_3zmq_4_zmq_6Socket_recv_pyobj(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3zmq_4_zmq_6Socket_recv_pyobj[] = "Receive a Python object as a message using pickle to serialize.\n\n        Parameters\n        ----------\n        flags : int\n            Any valid recv flag.\n\n        Returns\n        -------\n        obj : Python object\n            The Python object that arrives as a message.\n        ";
static PyObject *__pyx_pf_3zmq_4_zmq_6Socket_recv_pyobj(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_flags = 0;
  PyObject *__pyx_v_s;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__flags,0};
  __Pyx_RefNannySetupContext("recv_pyobj");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    values[0] = ((PyObject *)__pyx_int_0);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 1) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags);
        if (unlikely(value)) { values[0] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "recv_pyobj") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_flags = values[0];
  } else {
    __pyx_v_flags = ((PyObject *)__pyx_int_0);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: __pyx_v_flags = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("recv_pyobj", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("zmq._zmq.Socket.recv_pyobj");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_s = Py_None; __Pyx_INCREF(Py_None);

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":893
 *             The Python object that arrives as a message.
 *         """
 *         s = self.recv(flags)             # <<<<<<<<<<<<<<
 *         return pickle.loads(s)
 * 
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__recv); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_flags);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_flags);
  __Pyx_GIVEREF(__pyx_v_flags);
  __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_v_s);
  __pyx_v_s = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":894
 *         """
 *         s = self.recv(flags)
 *         return pickle.loads(s)             # <<<<<<<<<<<<<<
 * 
 *     def send_json(self, obj, flags=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__pickle); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__loads); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_s);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_s);
  __Pyx_GIVEREF(__pyx_v_s);
  __pyx_t_1 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("zmq._zmq.Socket.recv_pyobj");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_s);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":896
 *         return pickle.loads(s)
 * 
 *     def send_json(self, obj, flags=0):             # <<<<<<<<<<<<<<
 *         """Send a Python object as a message using json to serialize.
 * 
 */

static PyObject *__pyx_pf_3zmq_4_zmq_6Socket_send_json(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3zmq_4_zmq_6Socket_send_json[] = "Send a Python object as a message using json to serialize.\n\n        Parameters\n        ----------\n        obj : Python object\n            The Python object to send.\n        flags : int\n            Any valid send flag.\n        ";
static PyObject *__pyx_pf_3zmq_4_zmq_6Socket_send_json(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_obj = 0;
  PyObject *__pyx_v_flags = 0;
  PyObject *__pyx_v_msg;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__obj,&__pyx_n_s__flags,0};
  __Pyx_RefNannySetupContext("send_json");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)__pyx_int_0);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__obj);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 1) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags);
        if (unlikely(value)) { values[1] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "send_json") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_obj = values[0];
    __pyx_v_flags = values[1];
  } else {
    __pyx_v_flags = ((PyObject *)__pyx_int_0);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_flags = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_obj = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("send_json", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("zmq._zmq.Socket.send_json");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_v_obj);
  __Pyx_INCREF(__pyx_v_flags);
  __pyx_v_msg = Py_None; __Pyx_INCREF(Py_None);

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":906
 *             Any valid send flag.
 *         """
 *         if json is None:             # <<<<<<<<<<<<<<
 *             raise ImportError('json or simplejson library is required.')
 *         else:
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__json); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 906; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__pyx_t_1 == Py_None);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":907
 *         """
 *         if json is None:
 *             raise ImportError('json or simplejson library is required.')             # <<<<<<<<<<<<<<
 *         else:
 *             msg = json.dumps(obj, separators=(',',':'))
 */
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_10));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
    __pyx_t_3 = PyObject_Call(__pyx_builtin_ImportError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  /*else*/ {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":909
 *             raise ImportError('json or simplejson library is required.')
 *         else:
 *             msg = json.dumps(obj, separators=(',',':'))             # <<<<<<<<<<<<<<
 *             return self.send(msg, flags)
 * 
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__json); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__dumps); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_obj);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_obj);
    __Pyx_GIVEREF(__pyx_v_obj);
    __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_11));
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_11));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_11));
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_12));
    PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_kp_s_12));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_12));
    if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__separators), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_1, __pyx_t_3, ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_v_msg);
    __pyx_v_msg = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":910
 *         else:
 *             msg = json.dumps(obj, separators=(',',':'))
 *             return self.send(msg, flags)             # <<<<<<<<<<<<<<
 * 
 *     def recv_json(self, flags=0):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__send); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_msg);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_msg);
    __Pyx_GIVEREF(__pyx_v_msg);
    __Pyx_INCREF(__pyx_v_flags);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_flags);
    __Pyx_GIVEREF(__pyx_v_flags);
    __pyx_t_3 = PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }
  __pyx_L6:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("zmq._zmq.Socket.send_json");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_msg);
  __Pyx_DECREF((PyObject *)__pyx_v_self);
  __Pyx_DECREF(__pyx_v_obj);
  __Pyx_DECREF(__pyx_v_flags);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":912
 *             return self.send(msg, flags)
 * 
 *     def recv_json(self, flags=0):             # <<<<<<<<<<<<<<
 *         """Receive a Python object as a message using json to serialize.
 * 
 */

static PyObject *__pyx_pf_3zmq_4_zmq_6Socket_recv_json(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3zmq_4_zmq_6Socket_recv_json[] = "Receive a Python object as a message using json to serialize.\n\n        Parameters\n        ----------\n        flags : int\n            Any valid recv flag.\n\n        Returns\n        -------\n        obj : Python object\n            The Python object that arrives as a message.\n        ";
static PyObject *__pyx_pf_3zmq_4_zmq_6Socket_recv_json(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_flags = 0;
  PyObject *__pyx_v_msg;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__flags,0};
  __Pyx_RefNannySetupContext("recv_json");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[1] = {0};
    values[0] = ((PyObject *)__pyx_int_0);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      if (kw_args > 1) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags);
        if (unlikely(value)) { values[0] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "recv_json") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_flags = values[0];
  } else {
    __pyx_v_flags = ((PyObject *)__pyx_int_0);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  1: __pyx_v_flags = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("recv_json", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("zmq._zmq.Socket.recv_json");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_v_flags);
  __pyx_v_msg = Py_None; __Pyx_INCREF(Py_None);

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":925
 *             The Python object that arrives as a message.
 *         """
 *         if json is None:             # <<<<<<<<<<<<<<
 *             raise ImportError('json or simplejson library is required.')
 *         else:
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__json); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__pyx_t_1 == Py_None);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":926
 *         """
 *         if json is None:
 *             raise ImportError('json or simplejson library is required.')             # <<<<<<<<<<<<<<
 *         else:
 *             msg = self.recv(flags)
 */
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_10));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
    __pyx_t_3 = PyObject_Call(__pyx_builtin_ImportError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  /*else*/ {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":928
 *             raise ImportError('json or simplejson library is required.')
 *         else:
 *             msg = self.recv(flags)             # <<<<<<<<<<<<<<
 *             return json.loads(msg)
 * 
 */
    __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__recv); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_flags);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_flags);
    __Pyx_GIVEREF(__pyx_v_flags);
    __pyx_t_4 = PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_v_msg);
    __pyx_v_msg = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":929
 *         else:
 *             msg = self.recv(flags)
 *             return json.loads(msg)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__json); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__loads); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_msg);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_msg);
    __Pyx_GIVEREF(__pyx_v_msg);
    __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }
  __pyx_L6:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("zmq._zmq.Socket.recv_json");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_msg);
  __Pyx_DECREF((PyObject *)__pyx_v_self);
  __Pyx_DECREF(__pyx_v_flags);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":964
 * 
 * 
 * def _poll(sockets, long timeout=-1):             # <<<<<<<<<<<<<<
 *     """Poll a set of 0MQ sockets, native file descs. or sockets.
 * 
 */

static PyObject *__pyx_pf_3zmq_4_zmq__poll(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3zmq_4_zmq__poll[] = "Poll a set of 0MQ sockets, native file descs. or sockets.\n\n    Parameters\n    ----------\n    sockets : list of tuples of (socket, flags)\n        Each element of this list is a two-tuple containing a socket\n        and a flags. The socket may be a 0MQ socket or any object with\n        a :meth:`fileno` method. The flags can be zmq.POLLIN (for detecting\n        for incoming messages), zmq.POLLOUT (for detecting that send is OK)\n        or zmq.POLLIN|zmq.POLLOUT for detecting both.\n    timeout : int\n        The number of microseconds to poll for. Negative means no timeout.\n    ";
static PyObject *__pyx_pf_3zmq_4_zmq__poll(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_sockets = 0;
  long __pyx_v_timeout;
  int __pyx_v_rc;
  int __pyx_v_i;
  zmq_pollitem_t *__pyx_v_pollitems;
  int __pyx_v_nsockets;
  struct __pyx_obj_3zmq_4_zmq_Socket *__pyx_v_current_socket;
  PyObject *__pyx_v_pollitems_o;
  PyObject *__pyx_v_s;
  PyObject *__pyx_v_events;
  PyObject *__pyx_v_fileno;
  PyObject *__pyx_v_results;
  PyObject *__pyx_v_revents;
  PyObject *__pyx_r = NULL;
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  short __pyx_t_7;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__sockets,&__pyx_n_s__timeout,0};
  __Pyx_RefNannySetupContext("_poll");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sockets);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__timeout);
        if (unlikely(value)) { values[1] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_poll") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 964; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_sockets = values[0];
    if (values[1]) {
      __pyx_v_timeout = __Pyx_PyInt_AsLong(values[1]); if (unlikely((__pyx_v_timeout == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 964; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_timeout = ((long)-1);
    }
  } else {
    __pyx_v_timeout = ((long)-1);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_timeout = __Pyx_PyInt_AsLong(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_timeout == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 964; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      case  1: __pyx_v_sockets = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_poll", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 964; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("zmq._zmq._poll");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_sockets);
  __pyx_v_current_socket = ((struct __pyx_obj_3zmq_4_zmq_Socket *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_pollitems_o = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_s = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_events = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_fileno = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_results = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_revents = Py_None; __Pyx_INCREF(Py_None);

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":979
 *     """
 *     cdef int rc, i
 *     cdef zmq_pollitem_t *pollitems = NULL             # <<<<<<<<<<<<<<
 *     cdef int nsockets = len(sockets)
 *     cdef Socket current_socket
 */
  __pyx_v_pollitems = NULL;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":980
 *     cdef int rc, i
 *     cdef zmq_pollitem_t *pollitems = NULL
 *     cdef int nsockets = len(sockets)             # <<<<<<<<<<<<<<
 *     cdef Socket current_socket
 *     pollitems_o = allocate(nsockets*sizeof(zmq_pollitem_t),<void**>&pollitems)
 */
  __pyx_t_1 = PyObject_Length(__pyx_v_sockets); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nsockets = __pyx_t_1;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":982
 *     cdef int nsockets = len(sockets)
 *     cdef Socket current_socket
 *     pollitems_o = allocate(nsockets*sizeof(zmq_pollitem_t),<void**>&pollitems)             # <<<<<<<<<<<<<<
 * 
 *     for i in range(nsockets):
 */
  __pyx_t_2 = __pyx_f_3zmq_4_zmq_allocate((__pyx_v_nsockets * (sizeof(zmq_pollitem_t))), ((void **)(&__pyx_v_pollitems))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_v_pollitems_o);
  __pyx_v_pollitems_o = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":984
 *     pollitems_o = allocate(nsockets*sizeof(zmq_pollitem_t),<void**>&pollitems)
 * 
 *     for i in range(nsockets):             # <<<<<<<<<<<<<<
 *         s = sockets[i][0]
 *         events = sockets[i][1]
 */
  __pyx_t_3 = __pyx_v_nsockets;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":985
 * 
 *     for i in range(nsockets):
 *         s = sockets[i][0]             # <<<<<<<<<<<<<<
 *         events = sockets[i][1]
 *         if isinstance(s, Socket):
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_sockets, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 985; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 985; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_v_s);
    __pyx_v_s = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":986
 *     for i in range(nsockets):
 *         s = sockets[i][0]
 *         events = sockets[i][1]             # <<<<<<<<<<<<<<
 *         if isinstance(s, Socket):
 *             current_socket = s
 */
    __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_sockets, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_5, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_v_events);
    __pyx_v_events = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":987
 *         s = sockets[i][0]
 *         events = sockets[i][1]
 *         if isinstance(s, Socket):             # <<<<<<<<<<<<<<
 *             current_socket = s
 *             pollitems[i].socket = current_socket.handle
 */
    __pyx_t_6 = PyObject_TypeCheck(__pyx_v_s, ((PyTypeObject *)((PyObject*)__pyx_ptype_3zmq_4_zmq_Socket))); 
    if (__pyx_t_6) {

      /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":988
 *         events = sockets[i][1]
 *         if isinstance(s, Socket):
 *             current_socket = s             # <<<<<<<<<<<<<<
 *             pollitems[i].socket = current_socket.handle
 *             pollitems[i].events = events
 */
      if (!(likely(((__pyx_v_s) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_s, __pyx_ptype_3zmq_4_zmq_Socket))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_INCREF(__pyx_v_s);
      __Pyx_DECREF(((PyObject *)__pyx_v_current_socket));
      __pyx_v_current_socket = ((struct __pyx_obj_3zmq_4_zmq_Socket *)__pyx_v_s);

      /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":989
 *         if isinstance(s, Socket):
 *             current_socket = s
 *             pollitems[i].socket = current_socket.handle             # <<<<<<<<<<<<<<
 *             pollitems[i].events = events
 *             pollitems[i].revents = 0
 */
      (__pyx_v_pollitems[__pyx_v_i]).socket = __pyx_v_current_socket->handle;

      /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":990
 *             current_socket = s
 *             pollitems[i].socket = current_socket.handle
 *             pollitems[i].events = events             # <<<<<<<<<<<<<<
 *             pollitems[i].revents = 0
 *         elif isinstance(s, int):
 */
      __pyx_t_7 = __Pyx_PyInt_AsShort(__pyx_v_events); if (unlikely((__pyx_t_7 == (short)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      (__pyx_v_pollitems[__pyx_v_i]).events = __pyx_t_7;

      /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":991
 *             pollitems[i].socket = current_socket.handle
 *             pollitems[i].events = events
 *             pollitems[i].revents = 0             # <<<<<<<<<<<<<<
 *         elif isinstance(s, int):
 *             pollitems[i].socket = NULL
 */
      (__pyx_v_pollitems[__pyx_v_i]).revents = 0;
      goto __pyx_L8;
    }

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":992
 *             pollitems[i].events = events
 *             pollitems[i].revents = 0
 *         elif isinstance(s, int):             # <<<<<<<<<<<<<<
 *             pollitems[i].socket = NULL
 *             pollitems[i].fd = s
 */
    __pyx_t_6 = PyObject_TypeCheck(__pyx_v_s, ((PyTypeObject *)((PyObject*)&PyInt_Type))); 
    if (__pyx_t_6) {

      /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":993
 *             pollitems[i].revents = 0
 *         elif isinstance(s, int):
 *             pollitems[i].socket = NULL             # <<<<<<<<<<<<<<
 *             pollitems[i].fd = s
 *             pollitems[i].events = events
 */
      (__pyx_v_pollitems[__pyx_v_i]).socket = NULL;

      /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":994
 *         elif isinstance(s, int):
 *             pollitems[i].socket = NULL
 *             pollitems[i].fd = s             # <<<<<<<<<<<<<<
 *             pollitems[i].events = events
 *             pollitems[i].revents = 0
 */
      __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_v_s); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 994; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      (__pyx_v_pollitems[__pyx_v_i]).fd = __pyx_t_8;

      /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":995
 *             pollitems[i].socket = NULL
 *             pollitems[i].fd = s
 *             pollitems[i].events = events             # <<<<<<<<<<<<<<
 *             pollitems[i].revents = 0
 *         elif hasattr(s, 'fileno'):
 */
      __pyx_t_7 = __Pyx_PyInt_AsShort(__pyx_v_events); if (unlikely((__pyx_t_7 == (short)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 995; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      (__pyx_v_pollitems[__pyx_v_i]).events = __pyx_t_7;

      /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":996
 *             pollitems[i].fd = s
 *             pollitems[i].events = events
 *             pollitems[i].revents = 0             # <<<<<<<<<<<<<<
 *         elif hasattr(s, 'fileno'):
 *             try:
 */
      (__pyx_v_pollitems[__pyx_v_i]).revents = 0;
      goto __pyx_L8;
    }

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":997
 *             pollitems[i].events = events
 *             pollitems[i].revents = 0
 *         elif hasattr(s, 'fileno'):             # <<<<<<<<<<<<<<
 *             try:
 *                 fileno = int(s.fileno())
 */
    __pyx_t_6 = PyObject_HasAttr(__pyx_v_s, ((PyObject *)__pyx_n_s__fileno)); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_6) {

      /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":998
 *             pollitems[i].revents = 0
 *         elif hasattr(s, 'fileno'):
 *             try:             # <<<<<<<<<<<<<<
 *                 fileno = int(s.fileno())
 *             except:
 */
      {
        PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
        __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
        __Pyx_XGOTREF(__pyx_save_exc_type);
        __Pyx_XGOTREF(__pyx_save_exc_value);
        __Pyx_XGOTREF(__pyx_save_exc_tb);
        /*try:*/ {

          /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":999
 *         elif hasattr(s, 'fileno'):
 *             try:
 *                 fileno = int(s.fileno())             # <<<<<<<<<<<<<<
 *             except:
 *                 raise ValueError('fileno() must return an valid integer fd')
 */
          __pyx_t_2 = PyObject_GetAttr(__pyx_v_s, __pyx_n_s__fileno); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 999; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 999; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 999; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
          __Pyx_GOTREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5);
          __Pyx_GIVEREF(__pyx_t_5);
          __pyx_t_5 = 0;
          __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)&PyInt_Type)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 999; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_v_fileno);
          __pyx_v_fileno = __pyx_t_5;
          __pyx_t_5 = 0;
        }
        /*else:*/ {

          /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1003
 *                 raise ValueError('fileno() must return an valid integer fd')
 *             else:
 *                 pollitems[i].socket = NULL             # <<<<<<<<<<<<<<
 *                 pollitems[i].fd = fileno
 *                 pollitems[i].events = events
 */
          (__pyx_v_pollitems[__pyx_v_i]).socket = NULL;

          /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1004
 *             else:
 *                 pollitems[i].socket = NULL
 *                 pollitems[i].fd = fileno             # <<<<<<<<<<<<<<
 *                 pollitems[i].events = events
 *                 pollitems[i].revents = 0
 */
          __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_v_fileno); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1004; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;}
          (__pyx_v_pollitems[__pyx_v_i]).fd = __pyx_t_8;

          /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1005
 *                 pollitems[i].socket = NULL
 *                 pollitems[i].fd = fileno
 *                 pollitems[i].events = events             # <<<<<<<<<<<<<<
 *                 pollitems[i].revents = 0
 *         else:
 */
          __pyx_t_7 = __Pyx_PyInt_AsShort(__pyx_v_events); if (unlikely((__pyx_t_7 == (short)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1005; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;}
          (__pyx_v_pollitems[__pyx_v_i]).events = __pyx_t_7;

          /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1006
 *                 pollitems[i].fd = fileno
 *                 pollitems[i].events = events
 *                 pollitems[i].revents = 0             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError(
 */
          (__pyx_v_pollitems[__pyx_v_i]).revents = 0;
        }
        __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
        __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
        __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
        goto __pyx_L16_try_end;
        __pyx_L9_error:;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1000
 *             try:
 *                 fileno = int(s.fileno())
 *             except:             # <<<<<<<<<<<<<<
 *                 raise ValueError('fileno() must return an valid integer fd')
 *             else:
 */
        /*except:*/ {
          __Pyx_AddTraceback("zmq._zmq._poll");
          if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_2, &__pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1000; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GOTREF(__pyx_t_9);

          /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1001
 *                 fileno = int(s.fileno())
 *             except:
 *                 raise ValueError('fileno() must return an valid integer fd')             # <<<<<<<<<<<<<<
 *             else:
 *                 pollitems[i].socket = NULL
 */
          __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1001; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;}
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_INCREF(((PyObject *)__pyx_kp_s_13));
          PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_kp_s_13));
          __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_13));
          __pyx_t_11 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_10, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1001; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;}
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_Raise(__pyx_t_11, 0, 0);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1001; __pyx_clineno = __LINE__; goto __pyx_L11_except_error;}
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          goto __pyx_L10_exception_handled;
        }
        __pyx_L11_except_error:;
        __Pyx_XGIVEREF(__pyx_save_exc_type);
        __Pyx_XGIVEREF(__pyx_save_exc_value);
        __Pyx_XGIVEREF(__pyx_save_exc_tb);
        __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
        goto __pyx_L1_error;
        __pyx_L10_exception_handled:;
        __Pyx_XGIVEREF(__pyx_save_exc_type);
        __Pyx_XGIVEREF(__pyx_save_exc_value);
        __Pyx_XGIVEREF(__pyx_save_exc_tb);
        __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
        __pyx_L16_try_end:;
      }
      goto __pyx_L8;
    }
    /*else*/ {

      /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1011
 *                 "Socket must be a 0MQ socket, an integer fd or have "
 *                 "a fileno() method: %r" % s
 *             )             # <<<<<<<<<<<<<<
 * 
 *     # int zmq_poll (zmq_pollitem_t *items, int nitems, long timeout)
 */
      __pyx_t_9 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_14), __pyx_v_s); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1010; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1008; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_9);
      __pyx_t_9 = 0;
      __pyx_t_9 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1008; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_Raise(__pyx_t_9, 0, 0);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1008; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_L8:;
  }

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1014
 * 
 *     # int zmq_poll (zmq_pollitem_t *items, int nitems, long timeout)
 *     with nogil:             # <<<<<<<<<<<<<<
 *         rc = zmq_poll(pollitems, nsockets, timeout)
 *     if rc == -1:
 */
  { PyThreadState *_save;
    Py_UNBLOCK_THREADS
    /*try:*/ {

      /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1015
 *     # int zmq_poll (zmq_pollitem_t *items, int nitems, long timeout)
 *     with nogil:
 *         rc = zmq_poll(pollitems, nsockets, timeout)             # <<<<<<<<<<<<<<
 *     if rc == -1:
 *         raise ZMQError()
 */
      __pyx_v_rc = zmq_poll(__pyx_v_pollitems, __pyx_v_nsockets, __pyx_v_timeout);
    }
    /*finally:*/ {

      /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1014
 * 
 *     # int zmq_poll (zmq_pollitem_t *items, int nitems, long timeout)
 *     with nogil:             # <<<<<<<<<<<<<<
 *         rc = zmq_poll(pollitems, nsockets, timeout)
 *     if rc == -1:
 */
      Py_BLOCK_THREADS
    }
  }

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1016
 *     with nogil:
 *         rc = zmq_poll(pollitems, nsockets, timeout)
 *     if rc == -1:             # <<<<<<<<<<<<<<
 *         raise ZMQError()
 * 
 */
  __pyx_t_6 = (__pyx_v_rc == -1);
  if (__pyx_t_6) {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1017
 *         rc = zmq_poll(pollitems, nsockets, timeout)
 *     if rc == -1:
 *         raise ZMQError()             # <<<<<<<<<<<<<<
 * 
 *     results = []
 */
    __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1017; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_2 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1017; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1017; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L22;
  }
  __pyx_L22:;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1019
 *         raise ZMQError()
 * 
 *     results = []             # <<<<<<<<<<<<<<
 *     for i in range(nsockets):
 *         s = sockets[i][0]
 */
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_DECREF(__pyx_v_results);
  __pyx_v_results = ((PyObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1020
 * 
 *     results = []
 *     for i in range(nsockets):             # <<<<<<<<<<<<<<
 *         s = sockets[i][0]
 *         # Return the fd for sockets, for compat. with select.poll.
 */
  __pyx_t_3 = __pyx_v_nsockets;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1021
 *     results = []
 *     for i in range(nsockets):
 *         s = sockets[i][0]             # <<<<<<<<<<<<<<
 *         # Return the fd for sockets, for compat. with select.poll.
 *         if hasattr(s, 'fileno'):
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_sockets, __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_v_s);
    __pyx_v_s = __pyx_t_9;
    __pyx_t_9 = 0;

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1023
 *         s = sockets[i][0]
 *         # Return the fd for sockets, for compat. with select.poll.
 *         if hasattr(s, 'fileno'):             # <<<<<<<<<<<<<<
 *             s = s.fileno()
 *         revents = pollitems[i].revents
 */
    __pyx_t_6 = PyObject_HasAttr(__pyx_v_s, ((PyObject *)__pyx_n_s__fileno)); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_6) {

      /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1024
 *         # Return the fd for sockets, for compat. with select.poll.
 *         if hasattr(s, 'fileno'):
 *             s = s.fileno()             # <<<<<<<<<<<<<<
 *         revents = pollitems[i].revents
 *         # Only return sockets with non-zero status for compat. with select.poll.
 */
      __pyx_t_9 = PyObject_GetAttr(__pyx_v_s, __pyx_n_s__fileno); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_2 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_v_s);
      __pyx_v_s = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L25;
    }
    __pyx_L25:;

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1025
 *         if hasattr(s, 'fileno'):
 *             s = s.fileno()
 *         revents = pollitems[i].revents             # <<<<<<<<<<<<<<
 *         # Only return sockets with non-zero status for compat. with select.poll.
 *         if revents > 0:
 */
    __pyx_t_2 = PyInt_FromLong((__pyx_v_pollitems[__pyx_v_i]).revents); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_v_revents);
    __pyx_v_revents = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1027
 *         revents = pollitems[i].revents
 *         # Only return sockets with non-zero status for compat. with select.poll.
 *         if revents > 0:             # <<<<<<<<<<<<<<
 *             results.append((s, revents))
 * 
 */
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_revents, __pyx_int_0, Py_GT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_6) {

      /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1028
 *         # Only return sockets with non-zero status for compat. with select.poll.
 *         if revents > 0:
 *             results.append((s, revents))             # <<<<<<<<<<<<<<
 * 
 *     return results
 */
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1028; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_v_s);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_s);
      __Pyx_GIVEREF(__pyx_v_s);
      __Pyx_INCREF(__pyx_v_revents);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_revents);
      __Pyx_GIVEREF(__pyx_v_revents);
      __pyx_t_9 = __Pyx_PyObject_Append(__pyx_v_results, __pyx_t_2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1028; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L26;
    }
    __pyx_L26:;
  }

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1030
 *             results.append((s, revents))
 * 
 *     return results             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_results);
  __pyx_r = __pyx_v_results;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("zmq._zmq._poll");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_current_socket);
  __Pyx_DECREF(__pyx_v_pollitems_o);
  __Pyx_DECREF(__pyx_v_s);
  __Pyx_DECREF(__pyx_v_events);
  __Pyx_DECREF(__pyx_v_fileno);
  __Pyx_DECREF(__pyx_v_results);
  __Pyx_DECREF(__pyx_v_revents);
  __Pyx_DECREF(__pyx_v_sockets);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1036
 *     """An stateful poll interface that mirrors Python's built-in poll."""
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.sockets = {}
 * 
 */

static PyObject *__pyx_pf_3zmq_4_zmq_6Poller___init__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_3zmq_4_zmq_6Poller___init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pf_3zmq_4_zmq_6Poller___init__, METH_O, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pf_3zmq_4_zmq_6Poller___init__(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__init__");
  __pyx_self = __pyx_self;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1037
 * 
 *     def __init__(self):
 *         self.sockets = {}             # <<<<<<<<<<<<<<
 * 
 *     def register(self, socket, flags=POLLIN|POLLOUT):
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1037; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__sockets, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1037; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("zmq._zmq.Poller.__init__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1039
 *         self.sockets = {}
 * 
 *     def register(self, socket, flags=POLLIN|POLLOUT):             # <<<<<<<<<<<<<<
 *         """Register a 0MQ socket or native fd for I/O monitoring.
 * 
 */

static PyObject *__pyx_pf_3zmq_4_zmq_6Poller_register(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3zmq_4_zmq_6Poller_register[] = "Register a 0MQ socket or native fd for I/O monitoring.\n\n        Parameters\n        ----------\n        socket : zmq.Socket or native socket\n            A zmq.Socket or any Python object having a :meth:`fileno` \n            method that returns a valid file descriptor.\n        flags : int\n            The events to watch for.  Can be POLLIN, POLLOUT or POLLIN|POLLOUT.\n        ";
static PyMethodDef __pyx_mdef_3zmq_4_zmq_6Poller_register = {__Pyx_NAMESTR("register"), (PyCFunction)__pyx_pf_3zmq_4_zmq_6Poller_register, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4_zmq_6Poller_register)};
static PyObject *__pyx_pf_3zmq_4_zmq_6Poller_register(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_socket = 0;
  PyObject *__pyx_v_flags = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__socket,&__pyx_n_s__flags,0};
  __Pyx_RefNannySetupContext("register");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    values[2] = __pyx_k_15;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__socket);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("register", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags);
        if (unlikely(value)) { values[2] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "register") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_self = values[0];
    __pyx_v_socket = values[1];
    __pyx_v_flags = values[2];
  } else {
    __pyx_v_flags = __pyx_k_15;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3:
      __pyx_v_flags = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2:
      __pyx_v_socket = PyTuple_GET_ITEM(__pyx_args, 1);
      __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("register", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("zmq._zmq.Poller.register");
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1050
 *             The events to watch for.  Can be POLLIN, POLLOUT or POLLIN|POLLOUT.
 *         """
 *         self.sockets[socket] = flags             # <<<<<<<<<<<<<<
 * 
 *     def modify(self, socket, flags=POLLIN|POLLOUT):
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__sockets); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_1, __pyx_v_socket, __pyx_v_flags) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("zmq._zmq.Poller.register");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1052
 *         self.sockets[socket] = flags
 * 
 *     def modify(self, socket, flags=POLLIN|POLLOUT):             # <<<<<<<<<<<<<<
 *         """Modify the flags for an already registered 0MQ socket or native fd."""
 *         self.register(socket, flags)
 */

static PyObject *__pyx_pf_3zmq_4_zmq_6Poller_modify(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3zmq_4_zmq_6Poller_modify[] = "Modify the flags for an already registered 0MQ socket or native fd.";
static PyMethodDef __pyx_mdef_3zmq_4_zmq_6Poller_modify = {__Pyx_NAMESTR("modify"), (PyCFunction)__pyx_pf_3zmq_4_zmq_6Poller_modify, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4_zmq_6Poller_modify)};
static PyObject *__pyx_pf_3zmq_4_zmq_6Poller_modify(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_socket = 0;
  PyObject *__pyx_v_flags = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__socket,&__pyx_n_s__flags,0};
  __Pyx_RefNannySetupContext("modify");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    values[2] = __pyx_k_16;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__socket);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("modify", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags);
        if (unlikely(value)) { values[2] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "modify") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_self = values[0];
    __pyx_v_socket = values[1];
    __pyx_v_flags = values[2];
  } else {
    __pyx_v_flags = __pyx_k_16;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3:
      __pyx_v_flags = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2:
      __pyx_v_socket = PyTuple_GET_ITEM(__pyx_args, 1);
      __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("modify", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("zmq._zmq.Poller.modify");
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1054
 *     def modify(self, socket, flags=POLLIN|POLLOUT):
 *         """Modify the flags for an already registered 0MQ socket or native fd."""
 *         self.register(socket, flags)             # <<<<<<<<<<<<<<
 * 
 *     def unregister(self, socket):
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__register); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1054; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1054; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_socket);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_socket);
  __Pyx_GIVEREF(__pyx_v_socket);
  __Pyx_INCREF(__pyx_v_flags);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_flags);
  __Pyx_GIVEREF(__pyx_v_flags);
  __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1054; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("zmq._zmq.Poller.modify");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1056
 *         self.register(socket, flags)
 * 
 *     def unregister(self, socket):             # <<<<<<<<<<<<<<
 *         """Remove a 0MQ socket or native fd for I/O monitoring.
 * 
 */

static PyObject *__pyx_pf_3zmq_4_zmq_6Poller_unregister(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3zmq_4_zmq_6Poller_unregister[] = "Remove a 0MQ socket or native fd for I/O monitoring.\n\n        Parameters\n        ----------\n        socket : Socket\n            The socket instance to stop polling.\n        ";
static PyMethodDef __pyx_mdef_3zmq_4_zmq_6Poller_unregister = {__Pyx_NAMESTR("unregister"), (PyCFunction)__pyx_pf_3zmq_4_zmq_6Poller_unregister, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4_zmq_6Poller_unregister)};
static PyObject *__pyx_pf_3zmq_4_zmq_6Poller_unregister(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_socket = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__socket,0};
  __Pyx_RefNannySetupContext("unregister");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__socket);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("unregister", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "unregister") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_self = values[0];
    __pyx_v_socket = values[1];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_socket = PyTuple_GET_ITEM(__pyx_args, 1);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("unregister", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("zmq._zmq.Poller.unregister");
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1064
 *             The socket instance to stop polling.
 *         """
 *         del self.sockets[socket]             # <<<<<<<<<<<<<<
 * 
 *     def poll(self, timeout=None):
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__sockets); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_DelItem(__pyx_t_1, __pyx_v_socket) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("zmq._zmq.Poller.unregister");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1066
 *         del self.sockets[socket]
 * 
 *     def poll(self, timeout=None):             # <<<<<<<<<<<<<<
 *         """Poll the registered 0MQ or native fds for I/O.
 * 
 */

static PyObject *__pyx_pf_3zmq_4_zmq_6Poller_poll(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3zmq_4_zmq_6Poller_poll[] = "Poll the registered 0MQ or native fds for I/O.\n\n        Parameters\n        ----------\n        timeout : float, int\n            The timeout in milliseconds. If None, no timeout (infinite). This\n            is in milliseconds to be compatible with :func:`select.poll`. The\n            underlying zmq_poll uses microseconds and we convert to that in\n            this function.\n        ";
static PyMethodDef __pyx_mdef_3zmq_4_zmq_6Poller_poll = {__Pyx_NAMESTR("poll"), (PyCFunction)__pyx_pf_3zmq_4_zmq_6Poller_poll, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4_zmq_6Poller_poll)};
static PyObject *__pyx_pf_3zmq_4_zmq_6Poller_poll(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_timeout = 0;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__timeout,0};
  __Pyx_RefNannySetupContext("poll");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__timeout);
        if (unlikely(value)) { values[1] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "poll") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1066; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_self = values[0];
    __pyx_v_timeout = values[1];
  } else {
    __pyx_v_timeout = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_timeout = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("poll", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1066; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("zmq._zmq.Poller.poll");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_self);
  __Pyx_INCREF(__pyx_v_timeout);

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1077
 *             this function.
 *         """
 *         if timeout is None:             # <<<<<<<<<<<<<<
 *             timeout = -1
 *         # Convert from ms -> us for zmq_poll.
 */
  __pyx_t_1 = (__pyx_v_timeout == Py_None);
  if (__pyx_t_1) {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1078
 *         """
 *         if timeout is None:
 *             timeout = -1             # <<<<<<<<<<<<<<
 *         # Convert from ms -> us for zmq_poll.
 *         timeout = int(timeout*1000.0)
 */
    __Pyx_INCREF(__pyx_int_neg_1);
    __Pyx_DECREF(__pyx_v_timeout);
    __pyx_v_timeout = __pyx_int_neg_1;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1080
 *             timeout = -1
 *         # Convert from ms -> us for zmq_poll.
 *         timeout = int(timeout*1000.0)             # <<<<<<<<<<<<<<
 *         if timeout < 0:
 *             timeout = -1
 */
  __pyx_t_2 = PyFloat_FromDouble(1000.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyNumber_Multiply(__pyx_v_timeout, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)&PyInt_Type)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_v_timeout);
  __pyx_v_timeout = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1081
 *         # Convert from ms -> us for zmq_poll.
 *         timeout = int(timeout*1000.0)
 *         if timeout < 0:             # <<<<<<<<<<<<<<
 *             timeout = -1
 *         return _poll(self.sockets.items(), timeout=timeout)
 */
  __pyx_t_3 = PyObject_RichCompare(__pyx_v_timeout, __pyx_int_0, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_1) {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1082
 *         timeout = int(timeout*1000.0)
 *         if timeout < 0:
 *             timeout = -1             # <<<<<<<<<<<<<<
 *         return _poll(self.sockets.items(), timeout=timeout)
 * 
 */
    __Pyx_INCREF(__pyx_int_neg_1);
    __Pyx_DECREF(__pyx_v_timeout);
    __pyx_v_timeout = __pyx_int_neg_1;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1083
 *         if timeout < 0:
 *             timeout = -1
 *         return _poll(self.sockets.items(), timeout=timeout)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s___poll); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__sockets); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__items); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__timeout), __pyx_v_timeout) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_3, __pyx_t_4, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("zmq._zmq.Poller.poll");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_self);
  __Pyx_DECREF(__pyx_v_timeout);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1086
 * 
 * 
 * def select(rlist, wlist, xlist, timeout=None):             # <<<<<<<<<<<<<<
 *     """Return the result of poll as a lists of sockets ready for r/w.
 * 
 */

static PyObject *__pyx_pf_3zmq_4_zmq_select(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3zmq_4_zmq_select[] = "Return the result of poll as a lists of sockets ready for r/w.\n\n    This has the same interface as Python's built-in :func:`select` function.\n\n    Parameters\n    ----------\n    timeout : float, int\n        The timeout in seconds. This is in seconds to be compatible with\n        :func:`select.select`. The underlying zmq_poll uses microseconds and\n        we convert to that in this function.\n    ";
static PyObject *__pyx_pf_3zmq_4_zmq_select(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_rlist = 0;
  PyObject *__pyx_v_wlist = 0;
  PyObject *__pyx_v_xlist = 0;
  PyObject *__pyx_v_timeout = 0;
  PyObject *__pyx_v_sockets;
  PyObject *__pyx_v_s;
  PyObject *__pyx_v_flags;
  PyObject *__pyx_v_return_sockets;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__rlist,&__pyx_n_s__wlist,&__pyx_n_s__xlist,&__pyx_n_s__timeout,0};
  __Pyx_RefNannySetupContext("select");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[4] = {0,0,0,0};
    values[3] = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__rlist);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__wlist);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("select", 0, 3, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xlist);
      if (likely(values[2])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("select", 0, 3, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  3:
      if (kw_args > 0) {
        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__timeout);
        if (unlikely(value)) { values[3] = value; kw_args--; }
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "select") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_rlist = values[0];
    __pyx_v_wlist = values[1];
    __pyx_v_xlist = values[2];
    __pyx_v_timeout = values[3];
  } else {
    __pyx_v_timeout = ((PyObject *)Py_None);
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  4:
      __pyx_v_timeout = PyTuple_GET_ITEM(__pyx_args, 3);
      case  3:
      __pyx_v_xlist = PyTuple_GET_ITEM(__pyx_args, 2);
      __pyx_v_wlist = PyTuple_GET_ITEM(__pyx_args, 1);
      __pyx_v_rlist = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("select", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("zmq._zmq.select");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_rlist);
  __Pyx_INCREF(__pyx_v_wlist);
  __Pyx_INCREF(__pyx_v_xlist);
  __Pyx_INCREF(__pyx_v_timeout);
  __pyx_v_sockets = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_s = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_flags = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_return_sockets = Py_None; __Pyx_INCREF(Py_None);

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1098
 *         we convert to that in this function.
 *     """
 *     if timeout is None:             # <<<<<<<<<<<<<<
 *         timeout = -1
 *     # Convert from sec -> us for zmq_poll.
 */
  __pyx_t_1 = (__pyx_v_timeout == Py_None);
  if (__pyx_t_1) {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1099
 *     """
 *     if timeout is None:
 *         timeout = -1             # <<<<<<<<<<<<<<
 *     # Convert from sec -> us for zmq_poll.
 *     timeout = int(timeout*1000000.0)
 */
    __Pyx_INCREF(__pyx_int_neg_1);
    __Pyx_DECREF(__pyx_v_timeout);
    __pyx_v_timeout = __pyx_int_neg_1;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1101
 *         timeout = -1
 *     # Convert from sec -> us for zmq_poll.
 *     timeout = int(timeout*1000000.0)             # <<<<<<<<<<<<<<
 *     if timeout < 0:
 *         timeout = -1
 */
  __pyx_t_2 = PyFloat_FromDouble(1000000.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyNumber_Multiply(__pyx_v_timeout, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)&PyInt_Type)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_v_timeout);
  __pyx_v_timeout = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1102
 *     # Convert from sec -> us for zmq_poll.
 *     timeout = int(timeout*1000000.0)
 *     if timeout < 0:             # <<<<<<<<<<<<<<
 *         timeout = -1
 *     sockets = []
 */
  __pyx_t_3 = PyObject_RichCompare(__pyx_v_timeout, __pyx_int_0, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_1) {

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1103
 *     timeout = int(timeout*1000000.0)
 *     if timeout < 0:
 *         timeout = -1             # <<<<<<<<<<<<<<
 *     sockets = []
 *     for s in set(rlist + wlist + xlist):
 */
    __Pyx_INCREF(__pyx_int_neg_1);
    __Pyx_DECREF(__pyx_v_timeout);
    __pyx_v_timeout = __pyx_int_neg_1;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1104
 *     if timeout < 0:
 *         timeout = -1
 *     sockets = []             # <<<<<<<<<<<<<<
 *     for s in set(rlist + wlist + xlist):
 *         flags = 0
 */
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_DECREF(__pyx_v_sockets);
  __pyx_v_sockets = ((PyObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1105
 *         timeout = -1
 *     sockets = []
 *     for s in set(rlist + wlist + xlist):             # <<<<<<<<<<<<<<
 *         flags = 0
 *         if s in rlist:
 */
  __pyx_t_3 = PyNumber_Add(__pyx_v_rlist, __pyx_v_wlist); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyNumber_Add(__pyx_t_3, __pyx_v_xlist); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)&PySet_Type)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    {
      __pyx_t_2 = PyIter_Next(__pyx_t_3);
      if (!__pyx_t_2) {
        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_DECREF(__pyx_v_s);
    __pyx_v_s = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1106
 *     sockets = []
 *     for s in set(rlist + wlist + xlist):
 *         flags = 0             # <<<<<<<<<<<<<<
 *         if s in rlist:
 *             flags |= POLLIN
 */
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_DECREF(__pyx_v_flags);
    __pyx_v_flags = __pyx_int_0;

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1107
 *     for s in set(rlist + wlist + xlist):
 *         flags = 0
 *         if s in rlist:             # <<<<<<<<<<<<<<
 *             flags |= POLLIN
 *         if s in wlist:
 */
    __pyx_t_1 = ((PySequence_Contains(__pyx_v_rlist, __pyx_v_s))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_1) {

      /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1108
 *         flags = 0
 *         if s in rlist:
 *             flags |= POLLIN             # <<<<<<<<<<<<<<
 *         if s in wlist:
 *             flags |= POLLOUT
 */
      __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__POLLIN); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = PyNumber_InPlaceOr(__pyx_v_flags, __pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_v_flags);
      __pyx_v_flags = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L10;
    }
    __pyx_L10:;

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1109
 *         if s in rlist:
 *             flags |= POLLIN
 *         if s in wlist:             # <<<<<<<<<<<<<<
 *             flags |= POLLOUT
 *         if s in xlist:
 */
    __pyx_t_1 = ((PySequence_Contains(__pyx_v_wlist, __pyx_v_s))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_1) {

      /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1110
 *             flags |= POLLIN
 *         if s in wlist:
 *             flags |= POLLOUT             # <<<<<<<<<<<<<<
 *         if s in xlist:
 *             flags |= POLLERR
 */
      __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__POLLOUT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_2 = PyNumber_InPlaceOr(__pyx_v_flags, __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_v_flags);
      __pyx_v_flags = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L11;
    }
    __pyx_L11:;

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1111
 *         if s in wlist:
 *             flags |= POLLOUT
 *         if s in xlist:             # <<<<<<<<<<<<<<
 *             flags |= POLLERR
 *         sockets.append((s, flags))
 */
    __pyx_t_1 = ((PySequence_Contains(__pyx_v_xlist, __pyx_v_s))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_1) {

      /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1112
 *             flags |= POLLOUT
 *         if s in xlist:
 *             flags |= POLLERR             # <<<<<<<<<<<<<<
 *         sockets.append((s, flags))
 *     return_sockets = _poll(sockets, timeout)
 */
      __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__POLLERR); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = PyNumber_InPlaceOr(__pyx_v_flags, __pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_v_flags);
      __pyx_v_flags = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L12;
    }
    __pyx_L12:;

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1113
 *         if s in xlist:
 *             flags |= POLLERR
 *         sockets.append((s, flags))             # <<<<<<<<<<<<<<
 *     return_sockets = _poll(sockets, timeout)
 *     rlist, wlist, xlist = [], [], []
 */
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_s);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_s);
    __Pyx_GIVEREF(__pyx_v_s);
    __Pyx_INCREF(__pyx_v_flags);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_flags);
    __Pyx_GIVEREF(__pyx_v_flags);
    __pyx_t_2 = __Pyx_PyObject_Append(__pyx_v_sockets, __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1114
 *             flags |= POLLERR
 *         sockets.append((s, flags))
 *     return_sockets = _poll(sockets, timeout)             # <<<<<<<<<<<<<<
 *     rlist, wlist, xlist = [], [], []
 *     for s, flags in return_sockets:
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s___poll); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_sockets);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_sockets);
  __Pyx_GIVEREF(__pyx_v_sockets);
  __Pyx_INCREF(__pyx_v_timeout);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_timeout);
  __Pyx_GIVEREF(__pyx_v_timeout);
  __pyx_t_5 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_v_return_sockets);
  __pyx_v_return_sockets = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1115
 *         sockets.append((s, flags))
 *     return_sockets = _poll(sockets, timeout)
 *     rlist, wlist, xlist = [], [], []             # <<<<<<<<<<<<<<
 *     for s, flags in return_sockets:
 *         if flags & POLLIN:
 */
  __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_DECREF(__pyx_v_rlist);
  __pyx_v_rlist = ((PyObject *)__pyx_t_5);
  __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_v_wlist);
  __pyx_v_wlist = ((PyObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_v_xlist);
  __pyx_v_xlist = ((PyObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1116
 *     return_sockets = _poll(sockets, timeout)
 *     rlist, wlist, xlist = [], [], []
 *     for s, flags in return_sockets:             # <<<<<<<<<<<<<<
 *         if flags & POLLIN:
 *             rlist.append(s)
 */
  if (PyList_CheckExact(__pyx_v_return_sockets) || PyTuple_CheckExact(__pyx_v_return_sockets)) {
    __pyx_t_4 = 0; __pyx_t_3 = __pyx_v_return_sockets; __Pyx_INCREF(__pyx_t_3);
  } else {
    __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_return_sockets); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
  }
  for (;;) {
    if (likely(PyList_CheckExact(__pyx_t_3))) {
      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
    } else if (likely(PyTuple_CheckExact(__pyx_t_3))) {
      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++;
    } else {
      __pyx_t_2 = PyIter_Next(__pyx_t_3);
      if (!__pyx_t_2) {
        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    if (PyTuple_CheckExact(__pyx_t_2) && likely(PyTuple_GET_SIZE(__pyx_t_2) == 2)) {
      PyObject* tuple = __pyx_t_2;
      __pyx_t_5 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_5);
      __pyx_t_6 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_v_s);
      __pyx_v_s = __pyx_t_5;
      __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_v_flags);
      __pyx_v_flags = __pyx_t_6;
      __pyx_t_6 = 0;
    } else {
      __pyx_t_7 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_5 = __Pyx_UnpackItem(__pyx_t_7, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_UnpackItem(__pyx_t_7, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_EndUnpack(__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_v_s);
      __pyx_v_s = __pyx_t_5;
      __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_v_flags);
      __pyx_v_flags = __pyx_t_6;
      __pyx_t_6 = 0;
    }

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1117
 *     rlist, wlist, xlist = [], [], []
 *     for s, flags in return_sockets:
 *         if flags & POLLIN:             # <<<<<<<<<<<<<<
 *             rlist.append(s)
 *         if flags & POLLOUT:
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__POLLIN); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = PyNumber_And(__pyx_v_flags, __pyx_t_2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (__pyx_t_1) {

      /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1118
 *     for s, flags in return_sockets:
 *         if flags & POLLIN:
 *             rlist.append(s)             # <<<<<<<<<<<<<<
 *         if flags & POLLOUT:
 *             wlist.append(s)
 */
      __pyx_t_6 = __Pyx_PyObject_Append(__pyx_v_rlist, __pyx_v_s); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L15;
    }
    __pyx_L15:;

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1119
 *         if flags & POLLIN:
 *             rlist.append(s)
 *         if flags & POLLOUT:             # <<<<<<<<<<<<<<
 *             wlist.append(s)
 *         if flags & POLLERR:
 */
    __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__POLLOUT); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_2 = PyNumber_And(__pyx_v_flags, __pyx_t_6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_1) {

      /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1120
 *             rlist.append(s)
 *         if flags & POLLOUT:
 *             wlist.append(s)             # <<<<<<<<<<<<<<
 *         if flags & POLLERR:
 *             xlist.append(s)
 */
      __pyx_t_2 = __Pyx_PyObject_Append(__pyx_v_wlist, __pyx_v_s); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L16;
    }
    __pyx_L16:;

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1121
 *         if flags & POLLOUT:
 *             wlist.append(s)
 *         if flags & POLLERR:             # <<<<<<<<<<<<<<
 *             xlist.append(s)
 *     return rlist, wlist, xlist
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__POLLERR); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = PyNumber_And(__pyx_v_flags, __pyx_t_2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (__pyx_t_1) {

      /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1122
 *             wlist.append(s)
 *         if flags & POLLERR:
 *             xlist.append(s)             # <<<<<<<<<<<<<<
 *     return rlist, wlist, xlist
 * 
 */
      __pyx_t_6 = __Pyx_PyObject_Append(__pyx_v_xlist, __pyx_v_s); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L17;
    }
    __pyx_L17:;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1123
 *         if flags & POLLERR:
 *             xlist.append(s)
 *     return rlist, wlist, xlist             # <<<<<<<<<<<<<<
 * 
 * def device(device_type, isocket, osocket):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_rlist);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_rlist);
  __Pyx_GIVEREF(__pyx_v_rlist);
  __Pyx_INCREF(__pyx_v_wlist);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_wlist);
  __Pyx_GIVEREF(__pyx_v_wlist);
  __Pyx_INCREF(__pyx_v_xlist);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_xlist);
  __Pyx_GIVEREF(__pyx_v_xlist);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("zmq._zmq.select");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_sockets);
  __Pyx_DECREF(__pyx_v_s);
  __Pyx_DECREF(__pyx_v_flags);
  __Pyx_DECREF(__pyx_v_return_sockets);
  __Pyx_DECREF(__pyx_v_rlist);
  __Pyx_DECREF(__pyx_v_wlist);
  __Pyx_DECREF(__pyx_v_xlist);
  __Pyx_DECREF(__pyx_v_timeout);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1125
 *     return rlist, wlist, xlist
 * 
 * def device(device_type, isocket, osocket):             # <<<<<<<<<<<<<<
 *     """Start a zeromq device.
 * 
 */

static PyObject *__pyx_pf_3zmq_4_zmq_device(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_3zmq_4_zmq_device[] = "Start a zeromq device.\n\n    Parameters\n    ----------\n    device_type : (QUEUE, FORWARDER, STREAMER)\n        The type of device to start.\n    isocket : Socket\n        The Socket instance for the incoming traffic.\n    osocket : Socket\n        The Socket instance for the outbound traffic.\n    ";
static PyObject *__pyx_pf_3zmq_4_zmq_device(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_device_type = 0;
  PyObject *__pyx_v_isocket = 0;
  PyObject *__pyx_v_osocket = 0;
  struct __pyx_obj_3zmq_4_zmq_Socket *__pyx_v__isocket = 0;
  struct __pyx_obj_3zmq_4_zmq_Socket *__pyx_v__osocket = 0;
  void *__pyx_v_ihandle;
  void *__pyx_v_ohandle;
  int __pyx_v_dtype;
  int __pyx_v_result;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__device_type,&__pyx_n_s__isocket,&__pyx_n_s__osocket,0};
  __Pyx_RefNannySetupContext("device");
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  0:
      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__device_type);
      if (likely(values[0])) kw_args--;
      else goto __pyx_L5_argtuple_error;
      case  1:
      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__isocket);
      if (likely(values[1])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("device", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  2:
      values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__osocket);
      if (likely(values[2])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("device", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    }
    if (unlikely(kw_args > 0)) {
      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "device") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_device_type = values[0];
    __pyx_v_isocket = values[1];
    __pyx_v_osocket = values[2];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_device_type = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_isocket = PyTuple_GET_ITEM(__pyx_args, 1);
    __pyx_v_osocket = PyTuple_GET_ITEM(__pyx_args, 2);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("device", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("zmq._zmq.device");
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_device_type);
  __Pyx_INCREF(__pyx_v_isocket);
  __Pyx_INCREF(__pyx_v_osocket);

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1137
 *         The Socket instance for the outbound traffic.
 *     """
 *     cdef Socket _isocket = isocket             # <<<<<<<<<<<<<<
 *     cdef Socket _osocket = osocket
 *     cdef void *ihandle = _isocket.handle
 */
  if (!(likely(((__pyx_v_isocket) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_isocket, __pyx_ptype_3zmq_4_zmq_Socket))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_isocket);
  __pyx_v__isocket = ((struct __pyx_obj_3zmq_4_zmq_Socket *)__pyx_v_isocket);

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1138
 *     """
 *     cdef Socket _isocket = isocket
 *     cdef Socket _osocket = osocket             # <<<<<<<<<<<<<<
 *     cdef void *ihandle = _isocket.handle
 *     cdef void *ohandle = _osocket.handle
 */
  if (!(likely(((__pyx_v_osocket) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_osocket, __pyx_ptype_3zmq_4_zmq_Socket))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_osocket);
  __pyx_v__osocket = ((struct __pyx_obj_3zmq_4_zmq_Socket *)__pyx_v_osocket);

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1139
 *     cdef Socket _isocket = isocket
 *     cdef Socket _osocket = osocket
 *     cdef void *ihandle = _isocket.handle             # <<<<<<<<<<<<<<
 *     cdef void *ohandle = _osocket.handle
 *     cdef int dtype = device_type
 */
  __pyx_v_ihandle = __pyx_v__isocket->handle;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1140
 *     cdef Socket _osocket = osocket
 *     cdef void *ihandle = _isocket.handle
 *     cdef void *ohandle = _osocket.handle             # <<<<<<<<<<<<<<
 *     cdef int dtype = device_type
 *     cdef int result = 0
 */
  __pyx_v_ohandle = __pyx_v__osocket->handle;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1141
 *     cdef void *ihandle = _isocket.handle
 *     cdef void *ohandle = _osocket.handle
 *     cdef int dtype = device_type             # <<<<<<<<<<<<<<
 *     cdef int result = 0
 *     with nogil:
 */
  __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_device_type); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_dtype = __pyx_t_1;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1142
 *     cdef void *ohandle = _osocket.handle
 *     cdef int dtype = device_type
 *     cdef int result = 0             # <<<<<<<<<<<<<<
 *     with nogil:
 *         result = zmq_device(dtype, ihandle, ohandle)
 */
  __pyx_v_result = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1143
 *     cdef int dtype = device_type
 *     cdef int result = 0
 *     with nogil:             # <<<<<<<<<<<<<<
 *         result = zmq_device(dtype, ihandle, ohandle)
 *     return result
 */
  { PyThreadState *_save;
    Py_UNBLOCK_THREADS
    /*try:*/ {

      /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1144
 *     cdef int result = 0
 *     with nogil:
 *         result = zmq_device(dtype, ihandle, ohandle)             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
      __pyx_v_result = zmq_device(__pyx_v_dtype, __pyx_v_ihandle, __pyx_v_ohandle);
    }
    /*finally:*/ {

      /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1143
 *     cdef int dtype = device_type
 *     cdef int result = 0
 *     with nogil:             # <<<<<<<<<<<<<<
 *         result = zmq_device(dtype, ihandle, ohandle)
 *     return result
 */
      Py_BLOCK_THREADS
    }
  }

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1145
 *     with nogil:
 *         result = zmq_device(dtype, ihandle, ohandle)
 *     return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyInt_FromLong(__pyx_v_result); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("zmq._zmq.device");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v__isocket);
  __Pyx_XDECREF((PyObject *)__pyx_v__osocket);
  __Pyx_DECREF(__pyx_v_device_type);
  __Pyx_DECREF(__pyx_v_isocket);
  __Pyx_DECREF(__pyx_v_osocket);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static struct __pyx_vtabstruct_3zmq_4_zmq_Message __pyx_vtable_3zmq_4_zmq_Message;

static PyObject *__pyx_tp_new_3zmq_4_zmq_Message(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_3zmq_4_zmq_Message *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_3zmq_4_zmq_Message *)o);
  p->__pyx_vtab = __pyx_vtabptr_3zmq_4_zmq_Message;
  p->data = Py_None; Py_INCREF(Py_None);
  if (__pyx_pf_3zmq_4_zmq_7Message___cinit__(o, a, k) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_3zmq_4_zmq_Message(PyObject *o) {
  struct __pyx_obj_3zmq_4_zmq_Message *p = (struct __pyx_obj_3zmq_4_zmq_Message *)o;
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pf_3zmq_4_zmq_7Message___dealloc__(o);
    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_XDECREF(p->data);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_3zmq_4_zmq_Message(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_3zmq_4_zmq_Message *p = (struct __pyx_obj_3zmq_4_zmq_Message *)o;
  if (p->data) {
    e = (*v)(p->data, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_3zmq_4_zmq_Message(PyObject *o) {
  struct __pyx_obj_3zmq_4_zmq_Message *p = (struct __pyx_obj_3zmq_4_zmq_Message *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->data);
  p->data = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static struct PyMethodDef __pyx_methods_3zmq_4_zmq_Message[] = {
  {__Pyx_NAMESTR("__copy__"), (PyCFunction)__pyx_pf_3zmq_4_zmq_7Message___copy__, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_3zmq_4_zmq_7Message___copy__)},
  {__Pyx_NAMESTR("__str__"), (PyCFunction)__pyx_pf_3zmq_4_zmq_7Message___str__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(__pyx_doc_3zmq_4_zmq_7Message___str__)},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_Message = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION >= 3
  0, /*reserved*/
  #else
  0, /*nb_long*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX)
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_Message = {
  __pyx_pf_3zmq_4_zmq_7Message___len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_Message = {
  __pyx_pf_3zmq_4_zmq_7Message___len__, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_Message = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

PyTypeObject __pyx_type_3zmq_4_zmq_Message = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("zmq._zmq.Message"), /*tp_name*/
  sizeof(struct __pyx_obj_3zmq_4_zmq_Message), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_3zmq_4_zmq_Message, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_compare*/
  0, /*tp_repr*/
  &__pyx_tp_as_number_Message, /*tp_as_number*/
  &__pyx_tp_as_sequence_Message, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_Message, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  __pyx_pf_3zmq_4_zmq_7Message___str__, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_Message, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("A Message class for non-copy send/recvs.\n\n    This class is only needed if you want to do non-copying send and recvs.\n    When you pass a string to this class, like ``Message(s)``, the \n    ref-count of s is increased by two: once because Message saves s as \n    an instance attribute and another because a ZMQ message is created that\n    points to the buffer of s. This second ref-count increase makes sure\n    that s lives until all messages that use it have been sent. Once 0MQ\n    sends all the messages and it doesn't need the buffer of s, 0MQ will call\n    Py_DECREF(s).\n    "), /*tp_doc*/
  __pyx_tp_traverse_3zmq_4_zmq_Message, /*tp_traverse*/
  __pyx_tp_clear_3zmq_4_zmq_Message, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_3zmq_4_zmq_Message, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_3zmq_4_zmq_Message, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyObject *__pyx_tp_new_3zmq_4_zmq_Context(PyTypeObject *t, PyObject *a, PyObject *k) {
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  if (__pyx_pf_3zmq_4_zmq_7Context___cinit__(o, a, k) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_3zmq_4_zmq_Context(PyObject *o) {
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pf_3zmq_4_zmq_7Context___dealloc__(o);
    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  (*Py_TYPE(o)->tp_free)(o);
}

static struct PyMethodDef __pyx_methods_3zmq_4_zmq_Context[] = {
  {__Pyx_NAMESTR("socket"), (PyCFunction)__pyx_pf_3zmq_4_zmq_7Context_socket, METH_O, __Pyx_DOCSTR(__pyx_doc_3zmq_4_zmq_7Context_socket)},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_Context = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION >= 3
  0, /*reserved*/
  #else
  0, /*nb_long*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX)
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_Context = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_Context = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_Context = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

PyTypeObject __pyx_type_3zmq_4_zmq_Context = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("zmq._zmq.Context"), /*tp_name*/
  sizeof(struct __pyx_obj_3zmq_4_zmq_Context), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_3zmq_4_zmq_Context, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_compare*/
  0, /*tp_repr*/
  &__pyx_tp_as_number_Context, /*tp_as_number*/
  &__pyx_tp_as_sequence_Context, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_Context, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_Context, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
  __Pyx_DOCSTR("Manage the lifecycle of a 0MQ context.\n\n    This class no longer takes any flags or the number of application\n    threads.\n\n    Parameters\n    ----------\n    io_threads : int\n        The number of IO threads.\n    "), /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_3zmq_4_zmq_Context, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_3zmq_4_zmq_Context, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyObject *__pyx_tp_new_3zmq_4_zmq_Socket(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_3zmq_4_zmq_Socket *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_3zmq_4_zmq_Socket *)o);
  p->context = ((struct __pyx_obj_3zmq_4_zmq_Context *)Py_None); Py_INCREF(Py_None);
  p->closed = Py_None; Py_INCREF(Py_None);
  if (__pyx_pf_3zmq_4_zmq_6Socket___cinit__(o, a, k) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_3zmq_4_zmq_Socket(PyObject *o) {
  struct __pyx_obj_3zmq_4_zmq_Socket *p = (struct __pyx_obj_3zmq_4_zmq_Socket *)o;
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pf_3zmq_4_zmq_6Socket___dealloc__(o);
    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_XDECREF(((PyObject *)p->context));
  Py_XDECREF(p->closed);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_3zmq_4_zmq_Socket(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_3zmq_4_zmq_Socket *p = (struct __pyx_obj_3zmq_4_zmq_Socket *)o;
  if (p->context) {
    e = (*v)(((PyObject*)p->context), a); if (e) return e;
  }
  if (p->closed) {
    e = (*v)(p->closed, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_3zmq_4_zmq_Socket(PyObject *o) {
  struct __pyx_obj_3zmq_4_zmq_Socket *p = (struct __pyx_obj_3zmq_4_zmq_Socket *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->context);
  p->context = ((struct __pyx_obj_3zmq_4_zmq_Context *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->closed);
  p->closed = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_3zmq_4_zmq_6Socket_context(PyObject *o, void *x) {
  return __pyx_pf_3zmq_4_zmq_6Socket_7context___get__(o);
}

static int __pyx_setprop_3zmq_4_zmq_6Socket_context(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_3zmq_4_zmq_6Socket_7context___set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static struct PyMethodDef __pyx_methods_3zmq_4_zmq_Socket[] = {
  {__Pyx_NAMESTR("close"), (PyCFunction)__pyx_pf_3zmq_4_zmq_6Socket_close, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_3zmq_4_zmq_6Socket_close)},
  {__Pyx_NAMESTR("_check_closed"), (PyCFunction)__pyx_pf_3zmq_4_zmq_6Socket__check_closed, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("setsockopt"), (PyCFunction)__pyx_pf_3zmq_4_zmq_6Socket_setsockopt, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4_zmq_6Socket_setsockopt)},
  {__Pyx_NAMESTR("getsockopt"), (PyCFunction)__pyx_pf_3zmq_4_zmq_6Socket_getsockopt, METH_O, __Pyx_DOCSTR(__pyx_doc_3zmq_4_zmq_6Socket_getsockopt)},
  {__Pyx_NAMESTR("bind"), (PyCFunction)__pyx_pf_3zmq_4_zmq_6Socket_bind, METH_O, __Pyx_DOCSTR(__pyx_doc_3zmq_4_zmq_6Socket_bind)},
  {__Pyx_NAMESTR("bind_to_random_port"), (PyCFunction)__pyx_pf_3zmq_4_zmq_6Socket_bind_to_random_port, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4_zmq_6Socket_bind_to_random_port)},
  {__Pyx_NAMESTR("connect"), (PyCFunction)__pyx_pf_3zmq_4_zmq_6Socket_connect, METH_O, __Pyx_DOCSTR(__pyx_doc_3zmq_4_zmq_6Socket_connect)},
  {__Pyx_NAMESTR("send"), (PyCFunction)__pyx_pf_3zmq_4_zmq_6Socket_send, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4_zmq_6Socket_send)},
  {__Pyx_NAMESTR("_send_message"), (PyCFunction)__pyx_pf_3zmq_4_zmq_6Socket__send_message, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4_zmq_6Socket__send_message)},
  {__Pyx_NAMESTR("_send_copy"), (PyCFunction)__pyx_pf_3zmq_4_zmq_6Socket__send_copy, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4_zmq_6Socket__send_copy)},
  {__Pyx_NAMESTR("_send_nocopy"), (PyCFunction)__pyx_pf_3zmq_4_zmq_6Socket__send_nocopy, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4_zmq_6Socket__send_nocopy)},
  {__Pyx_NAMESTR("recv"), (PyCFunction)__pyx_pf_3zmq_4_zmq_6Socket_recv, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4_zmq_6Socket_recv)},
  {__Pyx_NAMESTR("_recv_message"), (PyCFunction)__pyx_pf_3zmq_4_zmq_6Socket__recv_message, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4_zmq_6Socket__recv_message)},
  {__Pyx_NAMESTR("_recv_copy"), (PyCFunction)__pyx_pf_3zmq_4_zmq_6Socket__recv_copy, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4_zmq_6Socket__recv_copy)},
  {__Pyx_NAMESTR("send_multipart"), (PyCFunction)__pyx_pf_3zmq_4_zmq_6Socket_send_multipart, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4_zmq_6Socket_send_multipart)},
  {__Pyx_NAMESTR("recv_multipart"), (PyCFunction)__pyx_pf_3zmq_4_zmq_6Socket_recv_multipart, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4_zmq_6Socket_recv_multipart)},
  {__Pyx_NAMESTR("rcvmore"), (PyCFunction)__pyx_pf_3zmq_4_zmq_6Socket_rcvmore, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_3zmq_4_zmq_6Socket_rcvmore)},
  {__Pyx_NAMESTR("send_pyobj"), (PyCFunction)__pyx_pf_3zmq_4_zmq_6Socket_send_pyobj, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4_zmq_6Socket_send_pyobj)},
  {__Pyx_NAMESTR("recv_pyobj"), (PyCFunction)__pyx_pf_3zmq_4_zmq_6Socket_recv_pyobj, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4_zmq_6Socket_recv_pyobj)},
  {__Pyx_NAMESTR("send_json"), (PyCFunction)__pyx_pf_3zmq_4_zmq_6Socket_send_json, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4_zmq_6Socket_send_json)},
  {__Pyx_NAMESTR("recv_json"), (PyCFunction)__pyx_pf_3zmq_4_zmq_6Socket_recv_json, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4_zmq_6Socket_recv_json)},
  {0, 0, 0, 0}
};

static struct PyMemberDef __pyx_members_3zmq_4_zmq_Socket[] = {
  {(char *)"socket_type", T_INT, offsetof(struct __pyx_obj_3zmq_4_zmq_Socket, socket_type), 0, 0},
  {(char *)"closed", T_OBJECT, offsetof(struct __pyx_obj_3zmq_4_zmq_Socket, closed), 0, 0},
  {0, 0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_3zmq_4_zmq_Socket[] = {
  {(char *)"context", __pyx_getprop_3zmq_4_zmq_6Socket_context, __pyx_setprop_3zmq_4_zmq_6Socket_context, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_Socket = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION >= 3
  0, /*reserved*/
  #else
  0, /*nb_long*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if (PY_MAJOR_VERSION >= 3) || (Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX)
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_Socket = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_Socket = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_Socket = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

PyTypeObject __pyx_type_3zmq_4_zmq_Socket = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("zmq._zmq.Socket"), /*tp_name*/
  sizeof(struct __pyx_obj_3zmq_4_zmq_Socket), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_3zmq_4_zmq_Socket, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_compare*/
  0, /*tp_repr*/
  &__pyx_tp_as_number_Socket, /*tp_as_number*/
  &__pyx_tp_as_sequence_Socket, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_Socket, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_Socket, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  __Pyx_DOCSTR("A 0MQ socket.\n\n    Socket(context, socket_type)\n\n    Parameters\n    ----------\n    context : Context\n        The 0MQ Context this Socket belongs to.\n    socket_type : int\n        The socket type, which can be any of the 0MQ socket types: \n        REQ, REP, PUB, SUB, PAIR, XREQ, XREP, UPSTREAM, DOWNSTREAM.\n    "), /*tp_doc*/
  __pyx_tp_traverse_3zmq_4_zmq_Socket, /*tp_traverse*/
  __pyx_tp_clear_3zmq_4_zmq_Socket, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_3zmq_4_zmq_Socket, /*tp_methods*/
  __pyx_members_3zmq_4_zmq_Socket, /*tp_members*/
  __pyx_getsets_3zmq_4_zmq_Socket, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_3zmq_4_zmq_Socket, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static struct PyMethodDef __pyx_methods[] = {
  {__Pyx_NAMESTR("strerror"), (PyCFunction)__pyx_pf_3zmq_4_zmq_strerror, METH_O, __Pyx_DOCSTR(__pyx_doc_3zmq_4_zmq_strerror)},
  {__Pyx_NAMESTR("zmq_version"), (PyCFunction)__pyx_pf_3zmq_4_zmq_zmq_version, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_3zmq_4_zmq_zmq_version)},
  {__Pyx_NAMESTR("_poll"), (PyCFunction)__pyx_pf_3zmq_4_zmq__poll, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4_zmq__poll)},
  {__Pyx_NAMESTR("select"), (PyCFunction)__pyx_pf_3zmq_4_zmq_select, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4_zmq_select)},
  {__Pyx_NAMESTR("device"), (PyCFunction)__pyx_pf_3zmq_4_zmq_device, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4_zmq_device)},
  {0, 0, 0, 0}
};

static void __pyx_init_filenames(void); /*proto*/

#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    __Pyx_NAMESTR("_zmq"),
    __Pyx_DOCSTR(__pyx_k_17), /* m_doc */
    -1, /* m_size */
    __pyx_methods /* m_methods */,
    NULL, /* m_reload */
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0},
  {&__pyx_kp_s_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 0, 1, 0},
  {&__pyx_kp_s_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 1, 0},
  {&__pyx_kp_s_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 0, 1, 0},
  {&__pyx_kp_s_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 0, 1, 0},
  {&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0},
  {&__pyx_kp_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 0},
  {&__pyx_kp_s_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 1, 0},
  {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0},
  {&__pyx_kp_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 0},
  {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0},
  {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0},
  {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0},
  {&__pyx_n_s__AFFINITY, __pyx_k__AFFINITY, sizeof(__pyx_k__AFFINITY), 0, 0, 1, 1},
  {&__pyx_n_s__Context, __pyx_k__Context, sizeof(__pyx_k__Context), 0, 0, 1, 1},
  {&__pyx_n_s__DOWNSTREAM, __pyx_k__DOWNSTREAM, sizeof(__pyx_k__DOWNSTREAM), 0, 0, 1, 1},
  {&__pyx_n_s__EADDRINUSE, __pyx_k__EADDRINUSE, sizeof(__pyx_k__EADDRINUSE), 0, 0, 1, 1},
  {&__pyx_n_s__EADDRNOTAVAIL, __pyx_k__EADDRNOTAVAIL, sizeof(__pyx_k__EADDRNOTAVAIL), 0, 0, 1, 1},
  {&__pyx_n_s__EAGAIN, __pyx_k__EAGAIN, sizeof(__pyx_k__EAGAIN), 0, 0, 1, 1},
  {&__pyx_n_s__ECONNREFUSED, __pyx_k__ECONNREFUSED, sizeof(__pyx_k__ECONNREFUSED), 0, 0, 1, 1},
  {&__pyx_n_s__EFSM, __pyx_k__EFSM, sizeof(__pyx_k__EFSM), 0, 0, 1, 1},
  {&__pyx_n_s__EINPROGRESS, __pyx_k__EINPROGRESS, sizeof(__pyx_k__EINPROGRESS), 0, 0, 1, 1},
  {&__pyx_n_s__EINVAL, __pyx_k__EINVAL, sizeof(__pyx_k__EINVAL), 0, 0, 1, 1},
  {&__pyx_n_s__EMTHREAD, __pyx_k__EMTHREAD, sizeof(__pyx_k__EMTHREAD), 0, 0, 1, 1},
  {&__pyx_n_s__ENETDOWN, __pyx_k__ENETDOWN, sizeof(__pyx_k__ENETDOWN), 0, 0, 1, 1},
  {&__pyx_n_s__ENOBUFS, __pyx_k__ENOBUFS, sizeof(__pyx_k__ENOBUFS), 0, 0, 1, 1},
  {&__pyx_n_s__ENOCOMPATPROTO, __pyx_k__ENOCOMPATPROTO, sizeof(__pyx_k__ENOCOMPATPROTO), 0, 0, 1, 1},
  {&__pyx_n_s__ENOTSUP, __pyx_k__ENOTSUP, sizeof(__pyx_k__ENOTSUP), 0, 0, 1, 1},
  {&__pyx_n_s__EPROTONOSUPPORT, __pyx_k__EPROTONOSUPPORT, sizeof(__pyx_k__EPROTONOSUPPORT), 0, 0, 1, 1},
  {&__pyx_n_s__ETERM, __pyx_k__ETERM, sizeof(__pyx_k__ETERM), 0, 0, 1, 1},
  {&__pyx_n_s__Exception, __pyx_k__Exception, sizeof(__pyx_k__Exception), 0, 0, 1, 1},
  {&__pyx_n_s__FORWARDER, __pyx_k__FORWARDER, sizeof(__pyx_k__FORWARDER), 0, 0, 1, 1},
  {&__pyx_n_s__HWM, __pyx_k__HWM, sizeof(__pyx_k__HWM), 0, 0, 1, 1},
  {&__pyx_n_s__IDENTITY, __pyx_k__IDENTITY, sizeof(__pyx_k__IDENTITY), 0, 0, 1, 1},
  {&__pyx_n_s__ImportError, __pyx_k__ImportError, sizeof(__pyx_k__ImportError), 0, 0, 1, 1},
  {&__pyx_n_s__MCAST_LOOP, __pyx_k__MCAST_LOOP, sizeof(__pyx_k__MCAST_LOOP), 0, 0, 1, 1},
  {&__pyx_n_s__MemoryError, __pyx_k__MemoryError, sizeof(__pyx_k__MemoryError), 0, 0, 1, 1},
  {&__pyx_n_s__Message, __pyx_k__Message, sizeof(__pyx_k__Message), 0, 0, 1, 1},
  {&__pyx_n_s__NOBLOCK, __pyx_k__NOBLOCK, sizeof(__pyx_k__NOBLOCK), 0, 0, 1, 1},
  {&__pyx_n_s__PAIR, __pyx_k__PAIR, sizeof(__pyx_k__PAIR), 0, 0, 1, 1},
  {&__pyx_n_s__POLLERR, __pyx_k__POLLERR, sizeof(__pyx_k__POLLERR), 0, 0, 1, 1},
  {&__pyx_n_s__POLLIN, __pyx_k__POLLIN, sizeof(__pyx_k__POLLIN), 0, 0, 1, 1},
  {&__pyx_n_s__POLLOUT, __pyx_k__POLLOUT, sizeof(__pyx_k__POLLOUT), 0, 0, 1, 1},
  {&__pyx_n_s__PUB, __pyx_k__PUB, sizeof(__pyx_k__PUB), 0, 0, 1, 1},
  {&__pyx_n_s__Poller, __pyx_k__Poller, sizeof(__pyx_k__Poller), 0, 0, 1, 1},
  {&__pyx_n_s__QUEUE, __pyx_k__QUEUE, sizeof(__pyx_k__QUEUE), 0, 0, 1, 1},
  {&__pyx_n_s__RATE, __pyx_k__RATE, sizeof(__pyx_k__RATE), 0, 0, 1, 1},
  {&__pyx_n_s__RCVBUF, __pyx_k__RCVBUF, sizeof(__pyx_k__RCVBUF), 0, 0, 1, 1},
  {&__pyx_n_s__RCVMORE, __pyx_k__RCVMORE, sizeof(__pyx_k__RCVMORE), 0, 0, 1, 1},
  {&__pyx_n_s__RECOVERY_IVL, __pyx_k__RECOVERY_IVL, sizeof(__pyx_k__RECOVERY_IVL), 0, 0, 1, 1},
  {&__pyx_n_s__REP, __pyx_k__REP, sizeof(__pyx_k__REP), 0, 0, 1, 1},
  {&__pyx_n_s__REQ, __pyx_k__REQ, sizeof(__pyx_k__REQ), 0, 0, 1, 1},
  {&__pyx_n_s__SNDBUF, __pyx_k__SNDBUF, sizeof(__pyx_k__SNDBUF), 0, 0, 1, 1},
  {&__pyx_n_s__SNDMORE, __pyx_k__SNDMORE, sizeof(__pyx_k__SNDMORE), 0, 0, 1, 1},
  {&__pyx_n_s__STREAMER, __pyx_k__STREAMER, sizeof(__pyx_k__STREAMER), 0, 0, 1, 1},
  {&__pyx_n_s__SUB, __pyx_k__SUB, sizeof(__pyx_k__SUB), 0, 0, 1, 1},
  {&__pyx_n_s__SUBSCRIBE, __pyx_k__SUBSCRIBE, sizeof(__pyx_k__SUBSCRIBE), 0, 0, 1, 1},
  {&__pyx_n_s__SWAP, __pyx_k__SWAP, sizeof(__pyx_k__SWAP), 0, 0, 1, 1},
  {&__pyx_n_s__Socket, __pyx_k__Socket, sizeof(__pyx_k__Socket), 0, 0, 1, 1},
  {&__pyx_n_s__TypeError, __pyx_k__TypeError, sizeof(__pyx_k__TypeError), 0, 0, 1, 1},
  {&__pyx_n_s__UNSUBSCRIBE, __pyx_k__UNSUBSCRIBE, sizeof(__pyx_k__UNSUBSCRIBE), 0, 0, 1, 1},
  {&__pyx_n_s__UPSTREAM, __pyx_k__UPSTREAM, sizeof(__pyx_k__UPSTREAM), 0, 0, 1, 1},
  {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1},
  {&__pyx_n_s__XREP, __pyx_k__XREP, sizeof(__pyx_k__XREP), 0, 0, 1, 1},
  {&__pyx_n_s__XREQ, __pyx_k__XREQ, sizeof(__pyx_k__XREQ), 0, 0, 1, 1},
  {&__pyx_n_s__ZMQBaseError, __pyx_k__ZMQBaseError, sizeof(__pyx_k__ZMQBaseError), 0, 0, 1, 1},
  {&__pyx_n_s__ZMQBindError, __pyx_k__ZMQBindError, sizeof(__pyx_k__ZMQBindError), 0, 0, 1, 1},
  {&__pyx_n_s__ZMQError, __pyx_k__ZMQError, sizeof(__pyx_k__ZMQError), 0, 0, 1, 1},
  {&__pyx_n_s____all__, __pyx_k____all__, sizeof(__pyx_k____all__), 0, 0, 1, 1},
  {&__pyx_n_s____init__, __pyx_k____init__, sizeof(__pyx_k____init__), 0, 0, 1, 1},
  {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
  {&__pyx_n_s____str__, __pyx_k____str__, sizeof(__pyx_k____str__), 0, 0, 1, 1},
  {&__pyx_n_s___check_closed, __pyx_k___check_closed, sizeof(__pyx_k___check_closed), 0, 0, 1, 1},
  {&__pyx_n_s___poll, __pyx_k___poll, sizeof(__pyx_k___poll), 0, 0, 1, 1},
  {&__pyx_n_s___recv_copy, __pyx_k___recv_copy, sizeof(__pyx_k___recv_copy), 0, 0, 1, 1},
  {&__pyx_n_s___recv_message, __pyx_k___recv_message, sizeof(__pyx_k___recv_message), 0, 0, 1, 1},
  {&__pyx_n_s___send_copy, __pyx_k___send_copy, sizeof(__pyx_k___send_copy), 0, 0, 1, 1},
  {&__pyx_n_s___send_message, __pyx_k___send_message, sizeof(__pyx_k___send_message), 0, 0, 1, 1},
  {&__pyx_n_s__addr, __pyx_k__addr, sizeof(__pyx_k__addr), 0, 0, 1, 1},
  {&__pyx_n_s__bind, __pyx_k__bind, sizeof(__pyx_k__bind), 0, 0, 1, 1},
  {&__pyx_n_s__cPickle, __pyx_k__cPickle, sizeof(__pyx_k__cPickle), 0, 0, 1, 1},
  {&__pyx_n_s__close, __pyx_k__close, sizeof(__pyx_k__close), 0, 0, 1, 1},
  {&__pyx_n_s__closed, __pyx_k__closed, sizeof(__pyx_k__closed), 0, 0, 1, 1},
  {&__pyx_n_s__context, __pyx_k__context, sizeof(__pyx_k__context), 0, 0, 1, 1},
  {&__pyx_n_s__copy, __pyx_k__copy, sizeof(__pyx_k__copy), 0, 0, 1, 1},
  {&__pyx_n_s__copy_mod, __pyx_k__copy_mod, sizeof(__pyx_k__copy_mod), 0, 0, 1, 1},
  {&__pyx_n_s__data, __pyx_k__data, sizeof(__pyx_k__data), 0, 0, 1, 1},
  {&__pyx_n_s__device, __pyx_k__device, sizeof(__pyx_k__device), 0, 0, 1, 1},
  {&__pyx_n_s__device_type, __pyx_k__device_type, sizeof(__pyx_k__device_type), 0, 0, 1, 1},
  {&__pyx_n_s__dumps, __pyx_k__dumps, sizeof(__pyx_k__dumps), 0, 0, 1, 1},
  {&__pyx_n_s__errno, __pyx_k__errno, sizeof(__pyx_k__errno), 0, 0, 1, 1},
  {&__pyx_n_s__error, __pyx_k__error, sizeof(__pyx_k__error), 0, 0, 1, 1},
  {&__pyx_n_s__events, __pyx_k__events, sizeof(__pyx_k__events), 0, 0, 1, 1},
  {&__pyx_n_s__fast_copy, __pyx_k__fast_copy, sizeof(__pyx_k__fast_copy), 0, 0, 1, 1},
  {&__pyx_n_s__fd, __pyx_k__fd, sizeof(__pyx_k__fd), 0, 0, 1, 1},
  {&__pyx_n_s__fileno, __pyx_k__fileno, sizeof(__pyx_k__fileno), 0, 0, 1, 1},
  {&__pyx_n_s__flags, __pyx_k__flags, sizeof(__pyx_k__flags), 0, 0, 1, 1},
  {&__pyx_n_s__getsockopt, __pyx_k__getsockopt, sizeof(__pyx_k__getsockopt), 0, 0, 1, 1},
  {&__pyx_n_s__handle, __pyx_k__handle, sizeof(__pyx_k__handle), 0, 0, 1, 1},
  {&__pyx_n_s__io_threads, __pyx_k__io_threads, sizeof(__pyx_k__io_threads), 0, 0, 1, 1},
  {&__pyx_n_s__isocket, __pyx_k__isocket, sizeof(__pyx_k__isocket), 0, 0, 1, 1},
  {&__pyx_n_s__items, __pyx_k__items, sizeof(__pyx_k__items), 0, 0, 1, 1},
  {&__pyx_n_s__json, __pyx_k__json, sizeof(__pyx_k__json), 0, 0, 1, 1},
  {&__pyx_n_s__loads, __pyx_k__loads, sizeof(__pyx_k__loads), 0, 0, 1, 1},
  {&__pyx_n_s__max_port, __pyx_k__max_port, sizeof(__pyx_k__max_port), 0, 0, 1, 1},
  {&__pyx_n_s__max_tries, __pyx_k__max_tries, sizeof(__pyx_k__max_tries), 0, 0, 1, 1},
  {&__pyx_n_s__min_port, __pyx_k__min_port, sizeof(__pyx_k__min_port), 0, 0, 1, 1},
  {&__pyx_n_s__modify, __pyx_k__modify, sizeof(__pyx_k__modify), 0, 0, 1, 1},
  {&__pyx_n_s__msg, __pyx_k__msg, sizeof(__pyx_k__msg), 0, 0, 1, 1},
  {&__pyx_n_s__msg_parts, __pyx_k__msg_parts, sizeof(__pyx_k__msg_parts), 0, 0, 1, 1},
  {&__pyx_n_s__obj, __pyx_k__obj, sizeof(__pyx_k__obj), 0, 0, 1, 1},
  {&__pyx_n_s__object, __pyx_k__object, sizeof(__pyx_k__object), 0, 0, 1, 1},
  {&__pyx_n_s__option, __pyx_k__option, sizeof(__pyx_k__option), 0, 0, 1, 1},
  {&__pyx_n_s__optval, __pyx_k__optval, sizeof(__pyx_k__optval), 0, 0, 1, 1},
  {&__pyx_n_s__osocket, __pyx_k__osocket, sizeof(__pyx_k__osocket), 0, 0, 1, 1},
  {&__pyx_n_s__pickle, __pyx_k__pickle, sizeof(__pyx_k__pickle), 0, 0, 1, 1},
  {&__pyx_n_s__poll, __pyx_k__poll, sizeof(__pyx_k__poll), 0, 0, 1, 1},
  {&__pyx_n_s__protocol, __pyx_k__protocol, sizeof(__pyx_k__protocol), 0, 0, 1, 1},
  {&__pyx_n_s__random, __pyx_k__random, sizeof(__pyx_k__random), 0, 0, 1, 1},
  {&__pyx_n_s__randrange, __pyx_k__randrange, sizeof(__pyx_k__randrange), 0, 0, 1, 1},
  {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1},
  {&__pyx_n_s__rcvmore, __pyx_k__rcvmore, sizeof(__pyx_k__rcvmore), 0, 0, 1, 1},
  {&__pyx_n_s__recv, __pyx_k__recv, sizeof(__pyx_k__recv), 0, 0, 1, 1},
  {&__pyx_n_s__register, __pyx_k__register, sizeof(__pyx_k__register), 0, 0, 1, 1},
  {&__pyx_n_s__revents, __pyx_k__revents, sizeof(__pyx_k__revents), 0, 0, 1, 1},
  {&__pyx_n_s__rlist, __pyx_k__rlist, sizeof(__pyx_k__rlist), 0, 0, 1, 1},
  {&__pyx_n_s__select, __pyx_k__select, sizeof(__pyx_k__select), 0, 0, 1, 1},
  {&__pyx_n_s__self, __pyx_k__self, sizeof(__pyx_k__self), 0, 0, 1, 1},
  {&__pyx_n_s__send, __pyx_k__send, sizeof(__pyx_k__send), 0, 0, 1, 1},
  {&__pyx_n_s__separators, __pyx_k__separators, sizeof(__pyx_k__separators), 0, 0, 1, 1},
  {&__pyx_n_s__simplejson, __pyx_k__simplejson, sizeof(__pyx_k__simplejson), 0, 0, 1, 1},
  {&__pyx_n_s__socket, __pyx_k__socket, sizeof(__pyx_k__socket), 0, 0, 1, 1},
  {&__pyx_n_s__socket_type, __pyx_k__socket_type, sizeof(__pyx_k__socket_type), 0, 0, 1, 1},
  {&__pyx_n_s__sockets, __pyx_k__sockets, sizeof(__pyx_k__sockets), 0, 0, 1, 1},
  {&__pyx_n_s__strerror, __pyx_k__strerror, sizeof(__pyx_k__strerror), 0, 0, 1, 1},
  {&__pyx_n_s__struct, __pyx_k__struct, sizeof(__pyx_k__struct), 0, 0, 1, 1},
  {&__pyx_n_s__timeout, __pyx_k__timeout, sizeof(__pyx_k__timeout), 0, 0, 1, 1},
  {&__pyx_n_s__unregister, __pyx_k__unregister, sizeof(__pyx_k__unregister), 0, 0, 1, 1},
  {&__pyx_n_s__wlist, __pyx_k__wlist, sizeof(__pyx_k__wlist), 0, 0, 1, 1},
  {&__pyx_n_s__xlist, __pyx_k__xlist, sizeof(__pyx_k__xlist), 0, 0, 1, 1},
  {&__pyx_n_s__zmq_msg, __pyx_k__zmq_msg, sizeof(__pyx_k__zmq_msg), 0, 0, 1, 1},
  {&__pyx_n_s__zmq_version, __pyx_k__zmq_version, sizeof(__pyx_k__zmq_version), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_ImportError = __Pyx_GetName(__pyx_b, __pyx_n_s__ImportError); if (!__pyx_builtin_ImportError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_Exception = __Pyx_GetName(__pyx_b, __pyx_n_s__Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_object = __Pyx_GetName(__pyx_b, __pyx_n_s__object); if (!__pyx_builtin_object) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_MemoryError = __Pyx_GetName(__pyx_b, __pyx_n_s__MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  return 0;
  __pyx_L1_error:;
  return -1;
}

static int __Pyx_InitGlobals(void) {
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_100 = PyInt_FromLong(100); if (unlikely(!__pyx_int_100)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_2000 = PyInt_FromLong(2000); if (unlikely(!__pyx_int_2000)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_20000 = PyInt_FromLong(20000); if (unlikely(!__pyx_int_20000)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  return 0;
  __pyx_L1_error:;
  return -1;
}

#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC init_zmq(void); /*proto*/
PyMODINIT_FUNC init_zmq(void)
#else
PyMODINIT_FUNC PyInit__zmq(void); /*proto*/
PyMODINIT_FUNC PyInit__zmq(void)
#endif
{
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  #if CYTHON_REFNANNY
  void* __pyx_refnanny = NULL;
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  if (!__Pyx_RefNanny) {
      PyErr_Clear();
      __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
      if (!__Pyx_RefNanny)
          Py_FatalError("failed to import 'refnanny' module");
  }
  __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit__zmq(void)", __LINE__, __FILE__);
  #endif
  __pyx_init_filenames();
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #if PY_MAJOR_VERSION < 3
  __pyx_empty_bytes = PyString_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #else
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  /*--- Library function declarations ---*/
  /*--- Threads initialization code ---*/
  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  #ifdef WITH_THREAD /* Python build with threading support? */
  PyEval_InitThreads();
  #endif
  #endif
  /*--- Module creation code ---*/
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_zmq"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_17), 0, PYTHON_API_VERSION);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  #if PY_MAJOR_VERSION < 3
  Py_INCREF(__pyx_m);
  #endif
  __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME));
  if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  /*--- Initialize various global constants etc. ---*/
  if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_module_is_main_zmq___zmq) {
    if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  }
  /*--- Builtin init code ---*/
  if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Global init code ---*/
  /*--- Function export code ---*/
  /*--- Type init code ---*/
  __pyx_vtabptr_3zmq_4_zmq_Message = &__pyx_vtable_3zmq_4_zmq_Message;
  #if PY_MAJOR_VERSION >= 3
  __pyx_vtable_3zmq_4_zmq_Message.fast_copy = (struct __pyx_obj_3zmq_4_zmq_Message *(*)(struct __pyx_obj_3zmq_4_zmq_Message *))__pyx_f_3zmq_4_zmq_7Message_fast_copy;
  #else
  *(void(**)(void))&__pyx_vtable_3zmq_4_zmq_Message.fast_copy = (void(*)(void))__pyx_f_3zmq_4_zmq_7Message_fast_copy;
  #endif
  if (PyType_Ready(&__pyx_type_3zmq_4_zmq_Message) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_3zmq_4_zmq_Message.tp_dict, __pyx_vtabptr_3zmq_4_zmq_Message) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "Message", (PyObject *)&__pyx_type_3zmq_4_zmq_Message) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_3zmq_4_zmq_Message = &__pyx_type_3zmq_4_zmq_Message;
  if (PyType_Ready(&__pyx_type_3zmq_4_zmq_Context) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "Context", (PyObject *)&__pyx_type_3zmq_4_zmq_Context) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_3zmq_4_zmq_Context = &__pyx_type_3zmq_4_zmq_Context;
  if (PyType_Ready(&__pyx_type_3zmq_4_zmq_Socket) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "Socket", (PyObject *)&__pyx_type_3zmq_4_zmq_Socket) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 422; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_3zmq_4_zmq_Socket = &__pyx_type_3zmq_4_zmq_Socket;
  /*--- Type import code ---*/
  /*--- Function import code ---*/
  /*--- Execution code ---*/

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":40
 * # In newer versions of Cython (at least 0.12.1) this is called automatically.
 * # We should wait for a few releases and then remove this call.
 * PyEval_InitThreads()             # <<<<<<<<<<<<<<
 * 
 * import copy as copy_mod
 */
  PyEval_InitThreads();

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":42
 * PyEval_InitThreads()
 * 
 * import copy as copy_mod             # <<<<<<<<<<<<<<
 * import cPickle as pickle
 * import random
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__copy), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__copy_mod, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":43
 * 
 * import copy as copy_mod
 * import cPickle as pickle             # <<<<<<<<<<<<<<
 * import random
 * import struct
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__cPickle), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__pickle, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":44
 * import copy as copy_mod
 * import cPickle as pickle
 * import random             # <<<<<<<<<<<<<<
 * import struct
 * 
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__random), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__random, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":45
 * import cPickle as pickle
 * import random
 * import struct             # <<<<<<<<<<<<<<
 * 
 * try:
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__struct), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__struct, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":47
 * import struct
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import json
 * except ImportError:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":48
 * 
 * try:
 *     import json             # <<<<<<<<<<<<<<
 * except ImportError:
 *     try:
 */
      __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__json), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__json, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L9_try_end;
    __pyx_L2_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":49
 * try:
 *     import json
 * except ImportError:             # <<<<<<<<<<<<<<
 *     try:
 *         import simplejson as json
 */
    __pyx_t_2 = PyErr_ExceptionMatches(__pyx_builtin_ImportError);
    if (__pyx_t_2) {
      __Pyx_AddTraceback("zmq._zmq");
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_4);

      /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":50
 *     import json
 * except ImportError:
 *     try:             # <<<<<<<<<<<<<<
 *         import simplejson as json
 *     except ImportError:
 */
      {
        PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
        __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
        __Pyx_XGOTREF(__pyx_save_exc_type);
        __Pyx_XGOTREF(__pyx_save_exc_value);
        __Pyx_XGOTREF(__pyx_save_exc_tb);
        /*try:*/ {

          /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":51
 * except ImportError:
 *     try:
 *         import simplejson as json             # <<<<<<<<<<<<<<
 *     except ImportError:
 *         json = None
 */
          __pyx_t_5 = __Pyx_Import(((PyObject *)__pyx_n_s__simplejson), 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
          __Pyx_GOTREF(__pyx_t_5);
          if (PyObject_SetAttr(__pyx_m, __pyx_n_s__json, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        }
        __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
        __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
        __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
        goto __pyx_L19_try_end;
        __pyx_L12_error:;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":52
 *     try:
 *         import simplejson as json
 *     except ImportError:             # <<<<<<<<<<<<<<
 *         json = None
 * 
 */
        __pyx_t_2 = PyErr_ExceptionMatches(__pyx_builtin_ImportError);
        if (__pyx_t_2) {
          __Pyx_AddTraceback("zmq._zmq");
          if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_GOTREF(__pyx_t_7);

          /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":53
 *         import simplejson as json
 *     except ImportError:
 *         json = None             # <<<<<<<<<<<<<<
 * 
 * include "allocate.pxi"
 */
          if (PyObject_SetAttr(__pyx_m, __pyx_n_s__json, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;}
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          goto __pyx_L13_exception_handled;
        }
        __pyx_L14_except_error:;
        __Pyx_XGIVEREF(__pyx_save_exc_type);
        __Pyx_XGIVEREF(__pyx_save_exc_value);
        __Pyx_XGIVEREF(__pyx_save_exc_tb);
        __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
        goto __pyx_L4_except_error;
        __pyx_L13_exception_handled:;
        __Pyx_XGIVEREF(__pyx_save_exc_type);
        __Pyx_XGIVEREF(__pyx_save_exc_value);
        __Pyx_XGIVEREF(__pyx_save_exc_tb);
        __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
        __pyx_L19_try_end:;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L3_exception_handled;
    }
    __pyx_L4_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L3_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L9_try_end:;
  }

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":183
 * #-----------------------------------------------------------------------------
 * 
 * NOBLOCK = ZMQ_NOBLOCK             # <<<<<<<<<<<<<<
 * PAIR = ZMQ_PAIR
 * PUB = ZMQ_PUB
 */
  __pyx_t_4 = PyInt_FromLong(ZMQ_NOBLOCK); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__NOBLOCK, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":184
 * 
 * NOBLOCK = ZMQ_NOBLOCK
 * PAIR = ZMQ_PAIR             # <<<<<<<<<<<<<<
 * PUB = ZMQ_PUB
 * SUB = ZMQ_SUB
 */
  __pyx_t_4 = PyInt_FromLong(ZMQ_PAIR); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__PAIR, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":185
 * NOBLOCK = ZMQ_NOBLOCK
 * PAIR = ZMQ_PAIR
 * PUB = ZMQ_PUB             # <<<<<<<<<<<<<<
 * SUB = ZMQ_SUB
 * REQ = ZMQ_REQ
 */
  __pyx_t_4 = PyInt_FromLong(ZMQ_PUB); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__PUB, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":186
 * PAIR = ZMQ_PAIR
 * PUB = ZMQ_PUB
 * SUB = ZMQ_SUB             # <<<<<<<<<<<<<<
 * REQ = ZMQ_REQ
 * REP = ZMQ_REP
 */
  __pyx_t_4 = PyInt_FromLong(ZMQ_SUB); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__SUB, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":187
 * PUB = ZMQ_PUB
 * SUB = ZMQ_SUB
 * REQ = ZMQ_REQ             # <<<<<<<<<<<<<<
 * REP = ZMQ_REP
 * XREQ = ZMQ_XREQ
 */
  __pyx_t_4 = PyInt_FromLong(ZMQ_REQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__REQ, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":188
 * SUB = ZMQ_SUB
 * REQ = ZMQ_REQ
 * REP = ZMQ_REP             # <<<<<<<<<<<<<<
 * XREQ = ZMQ_XREQ
 * XREP = ZMQ_XREP
 */
  __pyx_t_4 = PyInt_FromLong(ZMQ_REP); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__REP, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":189
 * REQ = ZMQ_REQ
 * REP = ZMQ_REP
 * XREQ = ZMQ_XREQ             # <<<<<<<<<<<<<<
 * XREP = ZMQ_XREP
 * UPSTREAM = ZMQ_UPSTREAM
 */
  __pyx_t_4 = PyInt_FromLong(ZMQ_XREQ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__XREQ, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":190
 * REP = ZMQ_REP
 * XREQ = ZMQ_XREQ
 * XREP = ZMQ_XREP             # <<<<<<<<<<<<<<
 * UPSTREAM = ZMQ_UPSTREAM
 * DOWNSTREAM = ZMQ_DOWNSTREAM
 */
  __pyx_t_4 = PyInt_FromLong(ZMQ_XREP); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__XREP, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":191
 * XREQ = ZMQ_XREQ
 * XREP = ZMQ_XREP
 * UPSTREAM = ZMQ_UPSTREAM             # <<<<<<<<<<<<<<
 * DOWNSTREAM = ZMQ_DOWNSTREAM
 * HWM = ZMQ_HWM
 */
  __pyx_t_4 = PyInt_FromLong(ZMQ_UPSTREAM); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__UPSTREAM, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":192
 * XREP = ZMQ_XREP
 * UPSTREAM = ZMQ_UPSTREAM
 * DOWNSTREAM = ZMQ_DOWNSTREAM             # <<<<<<<<<<<<<<
 * HWM = ZMQ_HWM
 * SWAP = ZMQ_SWAP
 */
  __pyx_t_4 = PyInt_FromLong(ZMQ_DOWNSTREAM); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DOWNSTREAM, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":193
 * UPSTREAM = ZMQ_UPSTREAM
 * DOWNSTREAM = ZMQ_DOWNSTREAM
 * HWM = ZMQ_HWM             # <<<<<<<<<<<<<<
 * SWAP = ZMQ_SWAP
 * AFFINITY = ZMQ_AFFINITY
 */
  __pyx_t_4 = PyInt_FromLong(ZMQ_HWM); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__HWM, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":194
 * DOWNSTREAM = ZMQ_DOWNSTREAM
 * HWM = ZMQ_HWM
 * SWAP = ZMQ_SWAP             # <<<<<<<<<<<<<<
 * AFFINITY = ZMQ_AFFINITY
 * IDENTITY = ZMQ_IDENTITY
 */
  __pyx_t_4 = PyInt_FromLong(ZMQ_SWAP); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__SWAP, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":195
 * HWM = ZMQ_HWM
 * SWAP = ZMQ_SWAP
 * AFFINITY = ZMQ_AFFINITY             # <<<<<<<<<<<<<<
 * IDENTITY = ZMQ_IDENTITY
 * SUBSCRIBE = ZMQ_SUBSCRIBE
 */
  __pyx_t_4 = PyInt_FromLong(ZMQ_AFFINITY); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__AFFINITY, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":196
 * SWAP = ZMQ_SWAP
 * AFFINITY = ZMQ_AFFINITY
 * IDENTITY = ZMQ_IDENTITY             # <<<<<<<<<<<<<<
 * SUBSCRIBE = ZMQ_SUBSCRIBE
 * UNSUBSCRIBE = ZMQ_UNSUBSCRIBE
 */
  __pyx_t_4 = PyInt_FromLong(ZMQ_IDENTITY); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__IDENTITY, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":197
 * AFFINITY = ZMQ_AFFINITY
 * IDENTITY = ZMQ_IDENTITY
 * SUBSCRIBE = ZMQ_SUBSCRIBE             # <<<<<<<<<<<<<<
 * UNSUBSCRIBE = ZMQ_UNSUBSCRIBE
 * RATE = ZMQ_RATE
 */
  __pyx_t_4 = PyInt_FromLong(ZMQ_SUBSCRIBE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__SUBSCRIBE, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":198
 * IDENTITY = ZMQ_IDENTITY
 * SUBSCRIBE = ZMQ_SUBSCRIBE
 * UNSUBSCRIBE = ZMQ_UNSUBSCRIBE             # <<<<<<<<<<<<<<
 * RATE = ZMQ_RATE
 * RECOVERY_IVL = ZMQ_RECOVERY_IVL
 */
  __pyx_t_4 = PyInt_FromLong(ZMQ_UNSUBSCRIBE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__UNSUBSCRIBE, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":199
 * SUBSCRIBE = ZMQ_SUBSCRIBE
 * UNSUBSCRIBE = ZMQ_UNSUBSCRIBE
 * RATE = ZMQ_RATE             # <<<<<<<<<<<<<<
 * RECOVERY_IVL = ZMQ_RECOVERY_IVL
 * MCAST_LOOP = ZMQ_MCAST_LOOP
 */
  __pyx_t_4 = PyInt_FromLong(ZMQ_RATE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__RATE, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":200
 * UNSUBSCRIBE = ZMQ_UNSUBSCRIBE
 * RATE = ZMQ_RATE
 * RECOVERY_IVL = ZMQ_RECOVERY_IVL             # <<<<<<<<<<<<<<
 * MCAST_LOOP = ZMQ_MCAST_LOOP
 * SNDBUF = ZMQ_SNDBUF
 */
  __pyx_t_4 = PyInt_FromLong(ZMQ_RECOVERY_IVL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__RECOVERY_IVL, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":201
 * RATE = ZMQ_RATE
 * RECOVERY_IVL = ZMQ_RECOVERY_IVL
 * MCAST_LOOP = ZMQ_MCAST_LOOP             # <<<<<<<<<<<<<<
 * SNDBUF = ZMQ_SNDBUF
 * RCVBUF = ZMQ_RCVBUF
 */
  __pyx_t_4 = PyInt_FromLong(ZMQ_MCAST_LOOP); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__MCAST_LOOP, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":202
 * RECOVERY_IVL = ZMQ_RECOVERY_IVL
 * MCAST_LOOP = ZMQ_MCAST_LOOP
 * SNDBUF = ZMQ_SNDBUF             # <<<<<<<<<<<<<<
 * RCVBUF = ZMQ_RCVBUF
 * RCVMORE = ZMQ_RCVMORE
 */
  __pyx_t_4 = PyInt_FromLong(ZMQ_SNDBUF); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__SNDBUF, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":203
 * MCAST_LOOP = ZMQ_MCAST_LOOP
 * SNDBUF = ZMQ_SNDBUF
 * RCVBUF = ZMQ_RCVBUF             # <<<<<<<<<<<<<<
 * RCVMORE = ZMQ_RCVMORE
 * SNDMORE = ZMQ_SNDMORE
 */
  __pyx_t_4 = PyInt_FromLong(ZMQ_RCVBUF); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__RCVBUF, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":204
 * SNDBUF = ZMQ_SNDBUF
 * RCVBUF = ZMQ_RCVBUF
 * RCVMORE = ZMQ_RCVMORE             # <<<<<<<<<<<<<<
 * SNDMORE = ZMQ_SNDMORE
 * POLLIN = ZMQ_POLLIN
 */
  __pyx_t_4 = PyInt_FromLong(ZMQ_RCVMORE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__RCVMORE, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":205
 * RCVBUF = ZMQ_RCVBUF
 * RCVMORE = ZMQ_RCVMORE
 * SNDMORE = ZMQ_SNDMORE             # <<<<<<<<<<<<<<
 * POLLIN = ZMQ_POLLIN
 * POLLOUT = ZMQ_POLLOUT
 */
  __pyx_t_4 = PyInt_FromLong(ZMQ_SNDMORE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__SNDMORE, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":206
 * RCVMORE = ZMQ_RCVMORE
 * SNDMORE = ZMQ_SNDMORE
 * POLLIN = ZMQ_POLLIN             # <<<<<<<<<<<<<<
 * POLLOUT = ZMQ_POLLOUT
 * POLLERR = ZMQ_POLLERR
 */
  __pyx_t_4 = PyInt_FromLong(ZMQ_POLLIN); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__POLLIN, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":207
 * SNDMORE = ZMQ_SNDMORE
 * POLLIN = ZMQ_POLLIN
 * POLLOUT = ZMQ_POLLOUT             # <<<<<<<<<<<<<<
 * POLLERR = ZMQ_POLLERR
 * STREAMER = ZMQ_STREAMER
 */
  __pyx_t_4 = PyInt_FromLong(ZMQ_POLLOUT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__POLLOUT, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":208
 * POLLIN = ZMQ_POLLIN
 * POLLOUT = ZMQ_POLLOUT
 * POLLERR = ZMQ_POLLERR             # <<<<<<<<<<<<<<
 * STREAMER = ZMQ_STREAMER
 * FORWARDER = ZMQ_FORWARDER
 */
  __pyx_t_4 = PyInt_FromLong(ZMQ_POLLERR); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__POLLERR, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":209
 * POLLOUT = ZMQ_POLLOUT
 * POLLERR = ZMQ_POLLERR
 * STREAMER = ZMQ_STREAMER             # <<<<<<<<<<<<<<
 * FORWARDER = ZMQ_FORWARDER
 * QUEUE = ZMQ_QUEUE
 */
  __pyx_t_4 = PyInt_FromLong(ZMQ_STREAMER); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__STREAMER, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":210
 * POLLERR = ZMQ_POLLERR
 * STREAMER = ZMQ_STREAMER
 * FORWARDER = ZMQ_FORWARDER             # <<<<<<<<<<<<<<
 * QUEUE = ZMQ_QUEUE
 * 
 */
  __pyx_t_4 = PyInt_FromLong(ZMQ_FORWARDER); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__FORWARDER, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":211
 * STREAMER = ZMQ_STREAMER
 * FORWARDER = ZMQ_FORWARDER
 * QUEUE = ZMQ_QUEUE             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_4 = PyInt_FromLong(ZMQ_QUEUE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__QUEUE, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":219
 * 
 * # Often used (these are alse in errno.)
 * EAGAIN = ZMQ_EAGAIN             # <<<<<<<<<<<<<<
 * EINVAL = ZMQ_EINVAL
 * 
 */
  __pyx_t_4 = PyInt_FromLong(EAGAIN); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__EAGAIN, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":220
 * # Often used (these are alse in errno.)
 * EAGAIN = ZMQ_EAGAIN
 * EINVAL = ZMQ_EINVAL             # <<<<<<<<<<<<<<
 * 
 * # For Windows compatability
 */
  __pyx_t_4 = PyInt_FromLong(EINVAL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__EINVAL, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":223
 * 
 * # For Windows compatability
 * ENOTSUP = ZMQ_ENOTSUP             # <<<<<<<<<<<<<<
 * EPROTONOSUPPORT = ZMQ_EPROTONOSUPPORT
 * ENOBUFS = ZMQ_ENOBUFS
 */
  __pyx_t_4 = PyInt_FromLong(ENOTSUP); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ENOTSUP, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":224
 * # For Windows compatability
 * ENOTSUP = ZMQ_ENOTSUP
 * EPROTONOSUPPORT = ZMQ_EPROTONOSUPPORT             # <<<<<<<<<<<<<<
 * ENOBUFS = ZMQ_ENOBUFS
 * ENETDOWN = ZMQ_ENETDOWN
 */
  __pyx_t_4 = PyInt_FromLong(EPROTONOSUPPORT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__EPROTONOSUPPORT, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":225
 * ENOTSUP = ZMQ_ENOTSUP
 * EPROTONOSUPPORT = ZMQ_EPROTONOSUPPORT
 * ENOBUFS = ZMQ_ENOBUFS             # <<<<<<<<<<<<<<
 * ENETDOWN = ZMQ_ENETDOWN
 * EADDRINUSE = ZMQ_EADDRINUSE
 */
  __pyx_t_4 = PyInt_FromLong(ENOBUFS); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ENOBUFS, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":226
 * EPROTONOSUPPORT = ZMQ_EPROTONOSUPPORT
 * ENOBUFS = ZMQ_ENOBUFS
 * ENETDOWN = ZMQ_ENETDOWN             # <<<<<<<<<<<<<<
 * EADDRINUSE = ZMQ_EADDRINUSE
 * EADDRNOTAVAIL = ZMQ_EADDRNOTAVAIL
 */
  __pyx_t_4 = PyInt_FromLong(ENETDOWN); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ENETDOWN, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":227
 * ENOBUFS = ZMQ_ENOBUFS
 * ENETDOWN = ZMQ_ENETDOWN
 * EADDRINUSE = ZMQ_EADDRINUSE             # <<<<<<<<<<<<<<
 * EADDRNOTAVAIL = ZMQ_EADDRNOTAVAIL
 * ECONNREFUSED = ZMQ_ECONNREFUSED
 */
  __pyx_t_4 = PyInt_FromLong(EADDRINUSE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__EADDRINUSE, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":228
 * ENETDOWN = ZMQ_ENETDOWN
 * EADDRINUSE = ZMQ_EADDRINUSE
 * EADDRNOTAVAIL = ZMQ_EADDRNOTAVAIL             # <<<<<<<<<<<<<<
 * ECONNREFUSED = ZMQ_ECONNREFUSED
 * EINPROGRESS = ZMQ_EINPROGRESS
 */
  __pyx_t_4 = PyInt_FromLong(EADDRNOTAVAIL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__EADDRNOTAVAIL, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":229
 * EADDRINUSE = ZMQ_EADDRINUSE
 * EADDRNOTAVAIL = ZMQ_EADDRNOTAVAIL
 * ECONNREFUSED = ZMQ_ECONNREFUSED             # <<<<<<<<<<<<<<
 * EINPROGRESS = ZMQ_EINPROGRESS
 * 
 */
  __pyx_t_4 = PyInt_FromLong(ECONNREFUSED); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ECONNREFUSED, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":230
 * EADDRNOTAVAIL = ZMQ_EADDRNOTAVAIL
 * ECONNREFUSED = ZMQ_ECONNREFUSED
 * EINPROGRESS = ZMQ_EINPROGRESS             # <<<<<<<<<<<<<<
 * 
 * # 0MQ Native
 */
  __pyx_t_4 = PyInt_FromLong(EINPROGRESS); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__EINPROGRESS, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":233
 * 
 * # 0MQ Native
 * EMTHREAD = ZMQ_EMTHREAD             # <<<<<<<<<<<<<<
 * EFSM = ZMQ_EFSM
 * ENOCOMPATPROTO = ZMQ_ENOCOMPATPROTO
 */
  __pyx_t_4 = PyInt_FromLong(EMTHREAD); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__EMTHREAD, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":234
 * # 0MQ Native
 * EMTHREAD = ZMQ_EMTHREAD
 * EFSM = ZMQ_EFSM             # <<<<<<<<<<<<<<
 * ENOCOMPATPROTO = ZMQ_ENOCOMPATPROTO
 * ETERM = ZMQ_ETERM
 */
  __pyx_t_4 = PyInt_FromLong(EFSM); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__EFSM, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":235
 * EMTHREAD = ZMQ_EMTHREAD
 * EFSM = ZMQ_EFSM
 * ENOCOMPATPROTO = ZMQ_ENOCOMPATPROTO             # <<<<<<<<<<<<<<
 * ETERM = ZMQ_ETERM
 * 
 */
  __pyx_t_4 = PyInt_FromLong(ENOCOMPATPROTO); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ENOCOMPATPROTO, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":236
 * EFSM = ZMQ_EFSM
 * ENOCOMPATPROTO = ZMQ_ENOCOMPATPROTO
 * ETERM = ZMQ_ETERM             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_4 = PyInt_FromLong(ETERM); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ETERM, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":243
 *     return zmq_strerror(errnum)
 * 
 * class ZMQBaseError(Exception):             # <<<<<<<<<<<<<<
 *     pass
 * 
 */
  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_builtin_Exception);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_Exception);
  __Pyx_GIVEREF(__pyx_builtin_Exception);
  __pyx_t_1 = __Pyx_CreateClass(__pyx_t_3, ((PyObject *)__pyx_t_4), __pyx_n_s__ZMQBaseError, "zmq._zmq"); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ZMQBaseError, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":246
 *     pass
 * 
 * class ZMQError(ZMQBaseError):             # <<<<<<<<<<<<<<
 *     """Base exception class for 0MQ errors in Python."""
 * 
 */
  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQBaseError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  if (PyDict_SetItemString(((PyObject *)__pyx_t_4), "__doc__", ((PyObject *)__pyx_kp_s_18)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __Pyx_CreateClass(__pyx_t_3, ((PyObject *)__pyx_t_4), __pyx_n_s__ZMQError, "zmq._zmq"); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":249
 *     """Base exception class for 0MQ errors in Python."""
 * 
 *     def __init__(self, error=None):             # <<<<<<<<<<<<<<
 *         """Wrap an errno style error.
 * 
 */
  __pyx_t_3 = PyCFunction_New(&__pyx_mdef_3zmq_4_zmq_8ZMQError___init__, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = PyMethod_New(__pyx_t_3, 0, __pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyObject_SetAttr(__pyx_t_1, __pyx_n_s____init__, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":267
 *             self.errno = None
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return self.strerror
 * 
 */
  __pyx_t_7 = PyCFunction_New(&__pyx_mdef_3zmq_4_zmq_8ZMQError___str__, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_3 = PyMethod_New(__pyx_t_7, 0, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (PyObject_SetAttr(__pyx_t_1, __pyx_n_s____str__, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ZMQError, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":270
 *         return self.strerror
 * 
 * class ZMQBindError(ZMQBaseError):             # <<<<<<<<<<<<<<
 *     """An error for bind_to_random_port."""
 *     pass
 */
  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQBaseError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  if (PyDict_SetItemString(((PyObject *)__pyx_t_4), "__doc__", ((PyObject *)__pyx_kp_s_19)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = __Pyx_CreateClass(__pyx_t_3, ((PyObject *)__pyx_t_4), __pyx_n_s__ZMQBindError, "zmq._zmq"); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ZMQBindError, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":633
 *     #-------------------------------------------------------------------------
 * 
 *     def send(self, object data, int flags=0, bool copy=True):             # <<<<<<<<<<<<<<
 *         """Send a message on this socket.
 * 
 */
  __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (!(likely(PyBool_Check(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bool, got %.200s", Py_TYPE(__pyx_t_4)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_k_6 = ((PyObject *)__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":751
 *             raise ZMQError()
 * 
 *     def recv(self, int flags=0, copy=True):             # <<<<<<<<<<<<<<
 *         """Receive a message.
 * 
 */
  __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 751; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_k_7 = __pyx_t_4;
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":817
 *         return msg
 * 
 *     def send_multipart(self, msg_parts, int flags=0, copy=True):             # <<<<<<<<<<<<<<
 *         """Send a sequence of messages as a multipart message.
 * 
 */
  __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_k_8 = __pyx_t_4;
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":833
 *         self.send(msg_parts[-1], flags)
 * 
 *     def recv_multipart(self, int flags=0, copy=True):             # <<<<<<<<<<<<<<
 *         """Receive a multipart message as a list of messages.
 * 
 */
  __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_k_9 = __pyx_t_4;
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1033
 * 
 * 
 * class Poller(object):             # <<<<<<<<<<<<<<
 *     """An stateful poll interface that mirrors Python's built-in poll."""
 * 
 */
  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  if (PyDict_SetItemString(((PyObject *)__pyx_t_4), "__doc__", ((PyObject *)__pyx_kp_s_20)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_CreateClass(__pyx_t_1, ((PyObject *)__pyx_t_4), __pyx_n_s__Poller, "zmq._zmq"); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1036
 *     """An stateful poll interface that mirrors Python's built-in poll."""
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.sockets = {}
 * 
 */
  __pyx_t_1 = PyCFunction_New(&__pyx_mdef_3zmq_4_zmq_6Poller___init__, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = PyMethod_New(__pyx_t_1, 0, __pyx_t_3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyObject_SetAttr(__pyx_t_3, __pyx_n_s____init__, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1039
 *         self.sockets = {}
 * 
 *     def register(self, socket, flags=POLLIN|POLLOUT):             # <<<<<<<<<<<<<<
 *         """Register a 0MQ socket or native fd for I/O monitoring.
 * 
 */
  __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__POLLIN); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__POLLOUT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = PyNumber_Or(__pyx_t_7, __pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_k_15 = __pyx_t_6;
  __Pyx_GIVEREF(__pyx_t_6);
  __pyx_t_6 = 0;
  __pyx_t_6 = PyCFunction_New(&__pyx_mdef_3zmq_4_zmq_6Poller_register, 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = PyMethod_New(__pyx_t_6, 0, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (PyObject_SetAttr(__pyx_t_3, __pyx_n_s__register, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1052
 *         self.sockets[socket] = flags
 * 
 *     def modify(self, socket, flags=POLLIN|POLLOUT):             # <<<<<<<<<<<<<<
 *         """Modify the flags for an already registered 0MQ socket or native fd."""
 *         self.register(socket, flags)
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__POLLIN); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__POLLOUT); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = PyNumber_Or(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_k_16 = __pyx_t_7;
  __Pyx_GIVEREF(__pyx_t_7);
  __pyx_t_7 = 0;
  __pyx_t_7 = PyCFunction_New(&__pyx_mdef_3zmq_4_zmq_6Poller_modify, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = PyMethod_New(__pyx_t_7, 0, __pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (PyObject_SetAttr(__pyx_t_3, __pyx_n_s__modify, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1056
 *         self.register(socket, flags)
 * 
 *     def unregister(self, socket):             # <<<<<<<<<<<<<<
 *         """Remove a 0MQ socket or native fd for I/O monitoring.
 * 
 */
  __pyx_t_6 = PyCFunction_New(&__pyx_mdef_3zmq_4_zmq_6Poller_unregister, 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = PyMethod_New(__pyx_t_6, 0, __pyx_t_3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (PyObject_SetAttr(__pyx_t_3, __pyx_n_s__unregister, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1066
 *         del self.sockets[socket]
 * 
 *     def poll(self, timeout=None):             # <<<<<<<<<<<<<<
 *         """Poll the registered 0MQ or native fds for I/O.
 * 
 */
  __pyx_t_7 = PyCFunction_New(&__pyx_mdef_3zmq_4_zmq_6Poller_poll, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1066; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = PyMethod_New(__pyx_t_7, 0, __pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1066; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (PyObject_SetAttr(__pyx_t_3, __pyx_n_s__poll, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1066; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__Poller, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;

  /* "/Users/bgranger/Documents/Computation/zeromq/pyzmq/zmq/_zmq.pyx":1148
 * 
 * 
 * __all__ = [             # <<<<<<<<<<<<<<
 *     'zmq_version',
 *     'Message',
 */
  __pyx_t_4 = PyList_New(54); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__zmq_version));
  PyList_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_n_s__zmq_version));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__zmq_version));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__Message));
  PyList_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_n_s__Message));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Message));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__Context));
  PyList_SET_ITEM(__pyx_t_4, 2, ((PyObject *)__pyx_n_s__Context));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Context));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__Socket));
  PyList_SET_ITEM(__pyx_t_4, 3, ((PyObject *)__pyx_n_s__Socket));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Socket));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ZMQBaseError));
  PyList_SET_ITEM(__pyx_t_4, 4, ((PyObject *)__pyx_n_s__ZMQBaseError));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ZMQBaseError));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ZMQError));
  PyList_SET_ITEM(__pyx_t_4, 5, ((PyObject *)__pyx_n_s__ZMQError));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ZMQError));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ZMQBindError));
  PyList_SET_ITEM(__pyx_t_4, 6, ((PyObject *)__pyx_n_s__ZMQBindError));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ZMQBindError));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__NOBLOCK));
  PyList_SET_ITEM(__pyx_t_4, 7, ((PyObject *)__pyx_n_s__NOBLOCK));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__NOBLOCK));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__PAIR));
  PyList_SET_ITEM(__pyx_t_4, 8, ((PyObject *)__pyx_n_s__PAIR));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PAIR));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__PUB));
  PyList_SET_ITEM(__pyx_t_4, 9, ((PyObject *)__pyx_n_s__PUB));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PUB));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__SUB));
  PyList_SET_ITEM(__pyx_t_4, 10, ((PyObject *)__pyx_n_s__SUB));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__SUB));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__REQ));
  PyList_SET_ITEM(__pyx_t_4, 11, ((PyObject *)__pyx_n_s__REQ));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__REQ));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__REP));
  PyList_SET_ITEM(__pyx_t_4, 12, ((PyObject *)__pyx_n_s__REP));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__REP));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__XREQ));
  PyList_SET_ITEM(__pyx_t_4, 13, ((PyObject *)__pyx_n_s__XREQ));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__XREQ));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__XREP));
  PyList_SET_ITEM(__pyx_t_4, 14, ((PyObject *)__pyx_n_s__XREP));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__XREP));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__UPSTREAM));
  PyList_SET_ITEM(__pyx_t_4, 15, ((PyObject *)__pyx_n_s__UPSTREAM));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__UPSTREAM));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__DOWNSTREAM));
  PyList_SET_ITEM(__pyx_t_4, 16, ((PyObject *)__pyx_n_s__DOWNSTREAM));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__DOWNSTREAM));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__HWM));
  PyList_SET_ITEM(__pyx_t_4, 17, ((PyObject *)__pyx_n_s__HWM));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__HWM));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__SWAP));
  PyList_SET_ITEM(__pyx_t_4, 18, ((PyObject *)__pyx_n_s__SWAP));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__SWAP));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__AFFINITY));
  PyList_SET_ITEM(__pyx_t_4, 19, ((PyObject *)__pyx_n_s__AFFINITY));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__AFFINITY));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__IDENTITY));
  PyList_SET_ITEM(__pyx_t_4, 20, ((PyObject *)__pyx_n_s__IDENTITY));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__IDENTITY));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__SUBSCRIBE));
  PyList_SET_ITEM(__pyx_t_4, 21, ((PyObject *)__pyx_n_s__SUBSCRIBE));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__SUBSCRIBE));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__UNSUBSCRIBE));
  PyList_SET_ITEM(__pyx_t_4, 22, ((PyObject *)__pyx_n_s__UNSUBSCRIBE));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__UNSUBSCRIBE));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__RATE));
  PyList_SET_ITEM(__pyx_t_4, 23, ((PyObject *)__pyx_n_s__RATE));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__RATE));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__RECOVERY_IVL));
  PyList_SET_ITEM(__pyx_t_4, 24, ((PyObject *)__pyx_n_s__RECOVERY_IVL));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__RECOVERY_IVL));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__MCAST_LOOP));
  PyList_SET_ITEM(__pyx_t_4, 25, ((PyObject *)__pyx_n_s__MCAST_LOOP));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__MCAST_LOOP));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__SNDBUF));
  PyList_SET_ITEM(__pyx_t_4, 26, ((PyObject *)__pyx_n_s__SNDBUF));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__SNDBUF));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__RCVBUF));
  PyList_SET_ITEM(__pyx_t_4, 27, ((PyObject *)__pyx_n_s__RCVBUF));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__RCVBUF));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__SNDMORE));
  PyList_SET_ITEM(__pyx_t_4, 28, ((PyObject *)__pyx_n_s__SNDMORE));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__SNDMORE));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__RCVMORE));
  PyList_SET_ITEM(__pyx_t_4, 29, ((PyObject *)__pyx_n_s__RCVMORE));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__RCVMORE));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__POLLIN));
  PyList_SET_ITEM(__pyx_t_4, 30, ((PyObject *)__pyx_n_s__POLLIN));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__POLLIN));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__POLLOUT));
  PyList_SET_ITEM(__pyx_t_4, 31, ((PyObject *)__pyx_n_s__POLLOUT));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__POLLOUT));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__POLLERR));
  PyList_SET_ITEM(__pyx_t_4, 32, ((PyObject *)__pyx_n_s__POLLERR));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__POLLERR));
  __Pyx_INCREF(((PyObject *)__pyx_n_s___poll));
  PyList_SET_ITEM(__pyx_t_4, 33, ((PyObject *)__pyx_n_s___poll));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s___poll));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__select));
  PyList_SET_ITEM(__pyx_t_4, 34, ((PyObject *)__pyx_n_s__select));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__select));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__STREAMER));
  PyList_SET_ITEM(__pyx_t_4, 35, ((PyObject *)__pyx_n_s__STREAMER));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__STREAMER));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__FORWARDER));
  PyList_SET_ITEM(__pyx_t_4, 36, ((PyObject *)__pyx_n_s__FORWARDER));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__FORWARDER));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__QUEUE));
  PyList_SET_ITEM(__pyx_t_4, 37, ((PyObject *)__pyx_n_s__QUEUE));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__QUEUE));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__device));
  PyList_SET_ITEM(__pyx_t_4, 38, ((PyObject *)__pyx_n_s__device));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__device));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__Poller));
  PyList_SET_ITEM(__pyx_t_4, 39, ((PyObject *)__pyx_n_s__Poller));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Poller));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__EAGAIN));
  PyList_SET_ITEM(__pyx_t_4, 40, ((PyObject *)__pyx_n_s__EAGAIN));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__EAGAIN));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__EINVAL));
  PyList_SET_ITEM(__pyx_t_4, 41, ((PyObject *)__pyx_n_s__EINVAL));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__EINVAL));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ENOTSUP));
  PyList_SET_ITEM(__pyx_t_4, 42, ((PyObject *)__pyx_n_s__ENOTSUP));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ENOTSUP));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__EPROTONOSUPPORT));
  PyList_SET_ITEM(__pyx_t_4, 43, ((PyObject *)__pyx_n_s__EPROTONOSUPPORT));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__EPROTONOSUPPORT));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ENOBUFS));
  PyList_SET_ITEM(__pyx_t_4, 44, ((PyObject *)__pyx_n_s__ENOBUFS));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ENOBUFS));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ENETDOWN));
  PyList_SET_ITEM(__pyx_t_4, 45, ((PyObject *)__pyx_n_s__ENETDOWN));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ENETDOWN));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__EADDRINUSE));
  PyList_SET_ITEM(__pyx_t_4, 46, ((PyObject *)__pyx_n_s__EADDRINUSE));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__EADDRINUSE));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__EADDRNOTAVAIL));
  PyList_SET_ITEM(__pyx_t_4, 47, ((PyObject *)__pyx_n_s__EADDRNOTAVAIL));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__EADDRNOTAVAIL));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ECONNREFUSED));
  PyList_SET_ITEM(__pyx_t_4, 48, ((PyObject *)__pyx_n_s__ECONNREFUSED));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ECONNREFUSED));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__EINPROGRESS));
  PyList_SET_ITEM(__pyx_t_4, 49, ((PyObject *)__pyx_n_s__EINPROGRESS));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__EINPROGRESS));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__EMTHREAD));
  PyList_SET_ITEM(__pyx_t_4, 50, ((PyObject *)__pyx_n_s__EMTHREAD));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__EMTHREAD));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__EFSM));
  PyList_SET_ITEM(__pyx_t_4, 51, ((PyObject *)__pyx_n_s__EFSM));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__EFSM));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ENOCOMPATPROTO));
  PyList_SET_ITEM(__pyx_t_4, 52, ((PyObject *)__pyx_n_s__ENOCOMPATPROTO));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ENOCOMPATPROTO));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__ETERM));
  PyList_SET_ITEM(__pyx_t_4, 53, ((PyObject *)__pyx_n_s__ETERM));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ETERM));
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____all__, ((PyObject *)__pyx_t_4)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;

  /* "/Library/Frameworks/Python.framework/Versions/6.2/lib/python2.6/site-packages/Cython/Includes/stdlib.pxd":2
 * 
 * cdef extern from "stdlib.h" nogil:             # <<<<<<<<<<<<<<
 *     void free(void *ptr)
 *     void *malloc(size_t size)
 */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  if (__pyx_m) {
    __Pyx_AddTraceback("init zmq._zmq");
    Py_DECREF(__pyx_m); __pyx_m = 0;
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init zmq._zmq");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if PY_MAJOR_VERSION < 3
  return;
  #else
  return __pyx_m;
  #endif
}

static const char *__pyx_filenames[] = {
  "_zmq.pyx",
  "allocate.pxi",
};

/* Runtime support code */

static void __pyx_init_filenames(void) {
  __pyx_f = __pyx_filenames;
}

static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *local_type, *local_value, *local_tb;
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();
    local_type = tstate->curexc_type;
    local_value = tstate->curexc_value;
    local_tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
    PyErr_NormalizeException(&local_type, &local_value, &local_tb);
    if (unlikely(tstate->curexc_type))
        goto bad;
    #if PY_MAJOR_VERSION >= 3
    if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
        goto bad;
    #endif
    *type = local_type;
    *value = local_value;
    *tb = local_tb;
    Py_INCREF(local_type);
    Py_INCREF(local_value);
    Py_INCREF(local_tb);
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = local_type;
    tstate->exc_value = local_value;
    tstate->exc_traceback = local_tb;
    /* Make sure tstate is in a consistent state when we XDECREF
       these objects (XDECREF may run arbitrary code). */
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
    return 0;
bad:
    *type = 0;
    *value = 0;
    *tb = 0;
    Py_XDECREF(local_type);
    Py_XDECREF(local_value);
    Py_XDECREF(local_tb);
    return -1;
}


static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name,
    PyObject* kw_name)
{
    PyErr_Format(PyExc_TypeError,
        #if PY_MAJOR_VERSION >= 3
        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
        #else
        "%s() got multiple values for keyword argument '%s'", func_name,
        PyString_AS_STRING(kw_name));
        #endif
}

static void __Pyx_RaiseArgtupleInvalid(
    const char* func_name,
    int exact,
    Py_ssize_t num_min,
    Py_ssize_t num_max,
    Py_ssize_t num_found)
{
    Py_ssize_t num_expected;
    const char *number, *more_or_less;

    if (num_found < num_min) {
        num_expected = num_min;
        more_or_less = "at least";
    } else {
        num_expected = num_max;
        more_or_less = "at most";
    }
    if (exact) {
        more_or_less = "exactly";
    }
    number = (num_expected == 1) ? "" : "s";
    PyErr_Format(PyExc_TypeError,
        #if PY_VERSION_HEX < 0x02050000
            "%s() takes %s %d positional argument%s (%d given)",
        #else
            "%s() takes %s %zd positional argument%s (%zd given)",
        #endif
        func_name, more_or_less, num_expected, number, num_found);
}

static int __Pyx_ParseOptionalKeywords(
    PyObject *kwds,
    PyObject **argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject *key = 0, *value = 0;
    Py_ssize_t pos = 0;
    PyObject*** name;
    PyObject*** first_kw_arg = argnames + num_pos_args;

    while (PyDict_Next(kwds, &pos, &key, &value)) {
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            values[name-argnames] = value;
        } else {
            #if PY_MAJOR_VERSION < 3
            if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) {
            #else
            if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) {
            #endif
                goto invalid_keyword_type;
            } else {
                for (name = first_kw_arg; *name; name++) {
                    #if PY_MAJOR_VERSION >= 3
                    if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
                        PyUnicode_Compare(**name, key) == 0) break;
                    #else
                    if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
                        _PyString_Eq(**name, key)) break;
                    #endif
                }
                if (*name) {
                    values[name-argnames] = value;
                } else {
                    /* unexpected keyword found */
                    for (name=argnames; name != first_kw_arg; name++) {
                        if (**name == key) goto arg_passed_twice;
                        #if PY_MAJOR_VERSION >= 3
                        if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
                            PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice;
                        #else
                        if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
                            _PyString_Eq(**name, key)) goto arg_passed_twice;
                        #endif
                    }
                    if (kwds2) {
                        if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
                    } else {
                        goto invalid_keyword;
                    }
                }
            }
        }
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, **name);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%s() keywords must be strings", function_name);
    goto bad;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%s() got an unexpected keyword argument '%s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    return -1;
}

static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    if (unlikely(!type)) {
        PyErr_Format(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (likely(PyObject_TypeCheck(obj, type)))
        return 1;
    PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
                 Py_TYPE(obj)->tp_name, type->tp_name);
    return 0;
}

static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();

    tmp_type = tstate->curexc_type;
    tmp_value = tstate->curexc_value;
    tmp_tb = tstate->curexc_traceback;
    tstate->curexc_type = type;
    tstate->curexc_value = value;
    tstate->curexc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}

static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
    PyThreadState *tstate = PyThreadState_GET();
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;

    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
}



static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
        #if PY_VERSION_HEX < 0x02050000
                 "need more than %d value%s to unpack", (int)index,
        #else
                 "need more than %zd value%s to unpack", index,
        #endif
                 (index == 1) ? "" : "s");
}

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void) {
    PyErr_SetString(PyExc_ValueError, "too many values to unpack");
}

static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) {
    PyObject *item;
    if (!(item = PyIter_Next(iter))) {
        if (!PyErr_Occurred()) {
            __Pyx_RaiseNeedMoreValuesError(index);
        }
    }
    return item;
}

static int __Pyx_EndUnpack(PyObject *iter) {
    PyObject *item;
    if ((item = PyIter_Next(iter))) {
        Py_DECREF(item);
        __Pyx_RaiseTooManyValuesError();
        return -1;
    }
    else if (!PyErr_Occurred())
        return 0;
    else
        return -1;
}

static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
    PyThreadState *tstate = PyThreadState_GET();
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
}

static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = type;
    tstate->exc_value = value;
    tstate->exc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}

static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact)
{
    if (!type) {
        PyErr_Format(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (none_allowed && obj == Py_None) return 1;
    else if (exact) {
        if (Py_TYPE(obj) == type) return 1;
    }
    else {
        if (PyObject_TypeCheck(obj, type)) return 1;
    }
    PyErr_Format(PyExc_TypeError,
        "Argument '%s' has incorrect type (expected %s, got %s)",
        name, type->tp_name, Py_TYPE(obj)->tp_name);
    return 0;
}

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) {
    PyObject *__import__ = 0;
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    __import__ = __Pyx_GetAttrString(__pyx_b, "__import__");
    if (!__import__)
        goto bad;
    if (from_list)
        list = from_list;
    else {
        empty_list = PyList_New(0);
        if (!empty_list)
            goto bad;
        list = empty_list;
    }
    global_dict = PyModule_GetDict(__pyx_m);
    if (!global_dict)
        goto bad;
    empty_dict = PyDict_New();
    if (!empty_dict)
        goto bad;
    module = PyObject_CallFunctionObjArgs(__import__,
        name, global_dict, empty_dict, list, NULL);
bad:
    Py_XDECREF(empty_list);
    Py_XDECREF(__import__);
    Py_XDECREF(empty_dict);
    return module;
}

static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
    PyObject *result;
    result = PyObject_GetAttr(dict, name);
    if (!result)
        PyErr_SetObject(PyExc_NameError, name);
    return result;
}

static PyObject *__Pyx_CreateClass(
    PyObject *bases, PyObject *dict, PyObject *name, const char *modname)
{
    PyObject *py_modname;
    PyObject *result = 0;

    #if PY_MAJOR_VERSION < 3
    py_modname = PyString_FromString(modname);
    #else
    py_modname = PyUnicode_FromString(modname);
    #endif
    if (!py_modname)
        goto bad;
    if (PyDict_SetItemString(dict, "__module__", py_modname) < 0)
        goto bad;
    #if PY_MAJOR_VERSION < 3
    result = PyClass_New(bases, dict, name);
    #else
    result = PyObject_CallFunctionObjArgs((PyObject *)&PyType_Type, name, bases, dict, NULL);
    #endif
bad:
    Py_XDECREF(py_modname);
    return result;
}

#if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
    Py_XINCREF(type);
    Py_XINCREF(value);
    Py_XINCREF(tb);
    /* First, check the traceback argument, replacing None with NULL. */
    if (tb == Py_None) {
        Py_DECREF(tb);
        tb = 0;
    }
    else if (tb != NULL && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto raise_error;
    }
    /* Next, replace a missing value with None */
    if (value == NULL) {
        value = Py_None;
        Py_INCREF(value);
    }
    #if PY_VERSION_HEX < 0x02050000
    if (!PyClass_Check(type))
    #else
    if (!PyType_Check(type))
    #endif
    {
        /* Raising an instance.  The value should be a dummy. */
        if (value != Py_None) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        /* Normalize to raise <class>, <instance> */
        Py_DECREF(value);
        value = type;
        #if PY_VERSION_HEX < 0x02050000
            if (PyInstance_Check(type)) {
                type = (PyObject*) ((PyInstanceObject*)type)->in_class;
                Py_INCREF(type);
            }
            else {
                type = 0;
                PyErr_SetString(PyExc_TypeError,
                    "raise: exception must be an old-style class or instance");
                goto raise_error;
            }
        #else
            type = (PyObject*) Py_TYPE(type);
            Py_INCREF(type);
            if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
                PyErr_SetString(PyExc_TypeError,
                    "raise: exception class must be a subclass of BaseException");
                goto raise_error;
            }
        #endif
    }

    __Pyx_ErrRestore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}

#else /* Python 3+ */

static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
    if (tb == Py_None) {
        tb = 0;
    } else if (tb && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto bad;
    }
    if (value == Py_None)
        value = 0;

    if (PyExceptionInstance_Check(type)) {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto bad;
        }
        value = type;
        type = (PyObject*) Py_TYPE(value);
    } else if (!PyExceptionClass_Check(type)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }

    PyErr_SetObject(type, value);

    if (tb) {
        PyThreadState *tstate = PyThreadState_GET();
        PyObject* tmp_tb = tstate->curexc_traceback;
        if (tb != tmp_tb) {
            Py_INCREF(tb);
            tstate->curexc_traceback = tb;
            Py_XDECREF(tmp_tb);
        }
    }

bad:
    return;
}
#endif

static CYTHON_INLINE pyzmq_int64_t __Pyx_PyInt_from_py_pyzmq_int64_t(PyObject* x) {
    const pyzmq_int64_t neg_one = (pyzmq_int64_t)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(pyzmq_int64_t) == sizeof(char)) {
        if (is_unsigned)
            return (pyzmq_int64_t)__Pyx_PyInt_AsUnsignedChar(x);
        else
            return (pyzmq_int64_t)__Pyx_PyInt_AsSignedChar(x);
    } else if (sizeof(pyzmq_int64_t) == sizeof(short)) {
        if (is_unsigned)
            return (pyzmq_int64_t)__Pyx_PyInt_AsUnsignedShort(x);
        else
            return (pyzmq_int64_t)__Pyx_PyInt_AsSignedShort(x);
    } else if (sizeof(pyzmq_int64_t) == sizeof(int)) {
        if (is_unsigned)
            return (pyzmq_int64_t)__Pyx_PyInt_AsUnsignedInt(x);
        else
            return (pyzmq_int64_t)__Pyx_PyInt_AsSignedInt(x);
    } else if (sizeof(pyzmq_int64_t) == sizeof(long)) {
        if (is_unsigned)
            return (pyzmq_int64_t)__Pyx_PyInt_AsUnsignedLong(x);
        else
            return (pyzmq_int64_t)__Pyx_PyInt_AsSignedLong(x);
    } else if (sizeof(pyzmq_int64_t) == sizeof(PY_LONG_LONG)) {
        if (is_unsigned)
            return (pyzmq_int64_t)__Pyx_PyInt_AsUnsignedLongLong(x);
        else
            return (pyzmq_int64_t)__Pyx_PyInt_AsSignedLongLong(x);
#if 0
    } else if (sizeof(pyzmq_int64_t) > sizeof(short) &&
               sizeof(pyzmq_int64_t) < sizeof(int)) { /*  __int32 ILP64 ? */
        if (is_unsigned)
            return (pyzmq_int64_t)__Pyx_PyInt_AsUnsignedInt(x);
        else
            return (pyzmq_int64_t)__Pyx_PyInt_AsSignedInt(x);
#endif
    }
    PyErr_SetString(PyExc_TypeError, "pyzmq_int64_t");
    return (pyzmq_int64_t)-1;
}

static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_pyzmq_int64_t(pyzmq_int64_t val) {
    const pyzmq_int64_t neg_one = (pyzmq_int64_t)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(pyzmq_int64_t) <  sizeof(long)) {
        return PyInt_FromLong((long)val);
    } else if (sizeof(pyzmq_int64_t) == sizeof(long)) {
        if (is_unsigned)
            return PyLong_FromUnsignedLong((unsigned long)val);
        else
            return PyInt_FromLong((long)val);
    } else { /* (sizeof(pyzmq_int64_t) > sizeof(long)) */
        if (is_unsigned)
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val);
        else
            return PyLong_FromLongLong((PY_LONG_LONG)val);
    }
}

static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
    const unsigned char neg_one = (unsigned char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned char" :
                    "value too large to convert to unsigned char");
            }
            return (unsigned char)-1;
        }
        return (unsigned char)val;
    }
    return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) {
    const unsigned short neg_one = (unsigned short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned short" :
                    "value too large to convert to unsigned short");
            }
            return (unsigned short)-1;
        }
        return (unsigned short)val;
    }
    return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) {
    const unsigned int neg_one = (unsigned int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned int" :
                    "value too large to convert to unsigned int");
            }
            return (unsigned int)-1;
        }
        return (unsigned int)val;
    }
    return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) {
    const char neg_one = (char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to char" :
                    "value too large to convert to char");
            }
            return (char)-1;
        }
        return (char)val;
    }
    return (char)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) {
    const short neg_one = (short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to short" :
                    "value too large to convert to short");
            }
            return (short)-1;
        }
        return (short)val;
    }
    return (short)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) {
    const int neg_one = (int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to int" :
                    "value too large to convert to int");
            }
            return (int)-1;
        }
        return (int)val;
    }
    return (int)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) {
    const signed char neg_one = (signed char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed char" :
                    "value too large to convert to signed char");
            }
            return (signed char)-1;
        }
        return (signed char)val;
    }
    return (signed char)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) {
    const signed short neg_one = (signed short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed short" :
                    "value too large to convert to signed short");
            }
            return (signed short)-1;
        }
        return (signed short)val;
    }
    return (signed short)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) {
    const signed int neg_one = (signed int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed int" :
                    "value too large to convert to signed int");
            }
            return (signed int)-1;
        }
        return (signed int)val;
    }
    return (signed int)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
    const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned long");
            return (unsigned long)-1;
        }
        return (unsigned long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned long");
                return (unsigned long)-1;
            }
            return PyLong_AsUnsignedLong(x);
        } else {
            return PyLong_AsLong(x);
        }
    } else {
        unsigned long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (unsigned long)-1;
        val = __Pyx_PyInt_AsUnsignedLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
    const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned PY_LONG_LONG");
            return (unsigned PY_LONG_LONG)-1;
        }
        return (unsigned PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned PY_LONG_LONG");
                return (unsigned PY_LONG_LONG)-1;
            }
            return PyLong_AsUnsignedLongLong(x);
        } else {
            return PyLong_AsLongLong(x);
        }
    } else {
        unsigned PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (unsigned PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsUnsignedLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
    const long neg_one = (long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to long");
            return (long)-1;
        }
        return (long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to long");
                return (long)-1;
            }
            return PyLong_AsUnsignedLong(x);
        } else {
            return PyLong_AsLong(x);
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (long)-1;
        val = __Pyx_PyInt_AsLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
    const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to PY_LONG_LONG");
            return (PY_LONG_LONG)-1;
        }
        return (PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to PY_LONG_LONG");
                return (PY_LONG_LONG)-1;
            }
            return PyLong_AsUnsignedLongLong(x);
        } else {
            return PyLong_AsLongLong(x);
        }
    } else {
        PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
    const signed long neg_one = (signed long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to signed long");
            return (signed long)-1;
        }
        return (signed long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to signed long");
                return (signed long)-1;
            }
            return PyLong_AsUnsignedLong(x);
        } else {
            return PyLong_AsLong(x);
        }
    } else {
        signed long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (signed long)-1;
        val = __Pyx_PyInt_AsSignedLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
    const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to signed PY_LONG_LONG");
            return (signed PY_LONG_LONG)-1;
        }
        return (signed PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to signed PY_LONG_LONG");
                return (signed PY_LONG_LONG)-1;
            }
            return PyLong_AsUnsignedLongLong(x);
        } else {
            return PyLong_AsLongLong(x);
        }
    } else {
        signed PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (signed PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsSignedLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
#if PY_VERSION_HEX < 0x03010000
    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
#else
    PyObject *ob = PyCapsule_New(vtable, 0, 0);
#endif
    if (!ob)
        goto bad;
    if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0)
        goto bad;
    Py_DECREF(ob);
    return 0;
bad:
    Py_XDECREF(ob);
    return -1;
}

#include "compile.h"
#include "frameobject.h"
#include "traceback.h"

static void __Pyx_AddTraceback(const char *funcname) {
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    PyObject *py_globals = 0;
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;

    #if PY_MAJOR_VERSION < 3
    py_srcfile = PyString_FromString(__pyx_filename);
    #else
    py_srcfile = PyUnicode_FromString(__pyx_filename);
    #endif
    if (!py_srcfile) goto bad;
    if (__pyx_clineno) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        #else
        py_funcname = PyUnicode_FromString(funcname);
        #endif
    }
    if (!py_funcname) goto bad;
    py_globals = PyModule_GetDict(__pyx_m);
    if (!py_globals) goto bad;
    py_code = PyCode_New(
        0,            /*int argcount,*/
        #if PY_MAJOR_VERSION >= 3
        0,            /*int kwonlyargcount,*/
        #endif
        0,            /*int nlocals,*/
        0,            /*int stacksize,*/
        0,            /*int flags,*/
        __pyx_empty_bytes, /*PyObject *code,*/
        __pyx_empty_tuple,  /*PyObject *consts,*/
        __pyx_empty_tuple,  /*PyObject *names,*/
        __pyx_empty_tuple,  /*PyObject *varnames,*/
        __pyx_empty_tuple,  /*PyObject *freevars,*/
        __pyx_empty_tuple,  /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        __pyx_lineno,   /*int firstlineno,*/
        __pyx_empty_bytes  /*PyObject *lnotab*/
    );
    if (!py_code) goto bad;
    py_frame = PyFrame_New(
        PyThreadState_GET(), /*PyThreadState *tstate,*/
        py_code,             /*PyCodeObject *code,*/
        py_globals,          /*PyObject *globals,*/
        0                    /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    py_frame->f_lineno = __pyx_lineno;
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        #if PY_MAJOR_VERSION < 3
        if (t->is_unicode) {
            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
        } else if (t->intern) {
            *t->p = PyString_InternFromString(t->s);
        } else {
            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        }
        #else  /* Python 3+ has unicode identifiers */
        if (t->is_unicode | t->is_str) {
            if (t->intern) {
                *t->p = PyUnicode_InternFromString(t->s);
            } else if (t->encoding) {
                *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
            } else {
                *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
            }
        } else {
            *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
        }
        #endif
        if (!*t->p)
            return -1;
        ++t;
    }
    return 0;
}

/* Type Conversion Functions */

static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   if (x == Py_True) return 1;
   else if ((x == Py_False) | (x == Py_None)) return 0;
   else return PyObject_IsTrue(x);
}

static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
  PyNumberMethods *m;
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_VERSION_HEX < 0x03000000
  if (PyInt_Check(x) || PyLong_Check(x))
#else
  if (PyLong_Check(x))
#endif
    return Py_INCREF(x), x;
  m = Py_TYPE(x)->tp_as_number;
#if PY_VERSION_HEX < 0x03000000
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = PyNumber_Long(x);
  }
#else
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Long(x);
  }
#endif
  if (res) {
#if PY_VERSION_HEX < 0x03000000
    if (!PyInt_Check(res) && !PyLong_Check(res)) {
#else
    if (!PyLong_Check(res)) {
#endif
      PyErr_Format(PyExc_TypeError,
                   "__%s__ returned non-%s (type %.200s)",
                   name, name, Py_TYPE(res)->tp_name);
      Py_DECREF(res);
      return NULL;
    }
  }
  else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_TypeError,
                    "an integer is required");
  }
  return res;
}

static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject* x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}

static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
#if PY_VERSION_HEX < 0x02050000
   if (ival <= LONG_MAX)
       return PyInt_FromLong((long)ival);
   else {
       unsigned char *bytes = (unsigned char *) &ival;
       int one = 1; int little = (int)*(unsigned char*)&one;
       return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
   }
#else
   return PyInt_FromSize_t(ival);
#endif
}

static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
   unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
   if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
       return (size_t)-1;
   } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
       PyErr_SetString(PyExc_OverflowError,
                       "value too large to convert to size_t");
       return (size_t)-1;
   }
   return (size_t)val;
}


#endif /* Py_PYTHON_H */
