/zmq/core/socket.c
C | 10425 lines | 7026 code | 728 blank | 2671 comment | 1314 complexity | 979cc623d9830e0766d3d536ba0449be MD5 | raw file
Possible License(s): GPL-3.0, LGPL-3.0
- /* Generated by Cython 0.14.1 on Fri May 13 15:49:46 2011 */
- #define PY_SSIZE_T_CLEAN
- #include "Python.h"
- #ifndef Py_PYTHON_H
- #error Python headers needed to compile C extensions, please install development version of Python.
- #else
- #include <stddef.h> /* For offsetof */
- #ifndef offsetof
- #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
- #endif
- #if !defined(WIN32) && !defined(MS_WINDOWS)
- #ifndef __stdcall
- #define __stdcall
- #endif
- #ifndef __cdecl
- #define __cdecl
- #endif
- #ifndef __fastcall
- #define __fastcall
- #endif
- #endif
- #ifndef DL_IMPORT
- #define DL_IMPORT(t) t
- #endif
- #ifndef DL_EXPORT
- #define DL_EXPORT(t) t
- #endif
- #ifndef PY_LONG_LONG
- #define PY_LONG_LONG LONG_LONG
- #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 PyStringObject PyUnicodeObject
- #define PyString_Type PyUnicode_Type
- #define PyString_Check PyUnicode_Check
- #define PyString_CheckExact PyUnicode_CheckExact
- #endif
- #if PY_VERSION_HEX < 0x02060000
- #define PyBytesObject PyStringObject
- #define PyBytes_Type PyString_Type
- #define PyBytes_Check PyString_Check
- #define PyBytes_CheckExact PyString_CheckExact
- #define PyBytes_FromString PyString_FromString
- #define PyBytes_FromStringAndSize PyString_FromStringAndSize
- #define PyBytes_FromFormat PyString_FromFormat
- #define PyBytes_DecodeEscape PyString_DecodeEscape
- #define PyBytes_AsString PyString_AsString
- #define PyBytes_AsStringAndSize PyString_AsStringAndSize
- #define PyBytes_Size PyString_Size
- #define PyBytes_AS_STRING PyString_AS_STRING
- #define PyBytes_GET_SIZE PyString_GET_SIZE
- #define PyBytes_Repr PyString_Repr
- #define PyBytes_Concat PyString_Concat
- #define PyBytes_ConcatAndDel PyString_ConcatAndDel
- #endif
- #if PY_VERSION_HEX < 0x02060000
- #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type)
- #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type)
- #endif
- #ifndef PySet_CheckExact
- #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
- #endif
- #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
- #if PY_MAJOR_VERSION >= 3
- #define PyIntObject PyLongObject
- #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
- #endif
- #if PY_MAJOR_VERSION >= 3
- #define PyBoolObject PyLongObject
- #endif
- #if PY_MAJOR_VERSION >= 3
- #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) || (PY_VERSION_HEX >= 0x03010300)
- #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
- #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
- #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
- #else
- #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
- (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
- (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
- (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
- #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
- (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
- (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
- (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
- #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
- (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
- (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
- (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
- #endif
- #if PY_MAJOR_VERSION >= 3
- #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
- #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
- #if defined(WIN32) || defined(MS_WINDOWS)
- #define _USE_MATH_DEFINES
- #endif
- #include <math.h>
- #define __PYX_HAVE_API__zmq__core__socket
- #include "allocate.h"
- #include "errno.h"
- #include "string.h"
- #include "zmq_compat.h"
- #include "zmq.h"
- #include "zmq_utils.h"
- #include "pyversion_compat.h"
- #include "stdlib.h"
- #include "stdio.h"
- #include "pythread.h"
- #ifdef PYREX_WITHOUT_ASSERTIONS
- #define CYTHON_WITHOUT_ASSERTIONS
- #endif
- /* inline attribute */
- #ifndef CYTHON_INLINE
- #if defined(__GNUC__)
- #define CYTHON_INLINE __inline__
- #elif defined(_MSC_VER)
- #define CYTHON_INLINE __inline
- #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
- #define CYTHON_INLINE inline
- #else
- #define CYTHON_INLINE
- #endif
- #endif
- /* unused attribute */
- #ifndef CYTHON_UNUSED
- # if defined(__GNUC__)
- # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
- # define CYTHON_UNUSED __attribute__ ((__unused__))
- # else
- # define CYTHON_UNUSED
- # endif
- # elif defined(__ICC) || defined(__INTEL_COMPILER)
- # define CYTHON_UNUSED __attribute__ ((__unused__))
- # else
- # define CYTHON_UNUSED
- # 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 */
- #define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
- #define __Pyx_PyBytes_AsUString(s) ((unsigned char*) 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);
- 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[] = {
- "socket.pyx",
- "socket.pxd",
- "buffers.pxd",
- "message.pxd",
- "bool.pxd",
- "complex.pxd",
- };
- /* Type declarations */
- /* "zmq/core/socket.pxd":44
- *
- * # cpdef methods for direct-cython access:
- * cpdef object send(self, object data, int flags=*, copy=*, track=*) # <<<<<<<<<<<<<<
- * cpdef object recv(self, int flags=*, copy=*, track=*)
- *
- */
- struct __pyx_opt_args_3zmq_4core_6socket_6Socket_send {
- int __pyx_n;
- int flags;
- PyObject *copy;
- PyObject *track;
- };
- /* "zmq/core/socket.pxd":45
- * # cpdef methods for direct-cython access:
- * cpdef object send(self, object data, int flags=*, copy=*, track=*)
- * cpdef object recv(self, int flags=*, copy=*, track=*) # <<<<<<<<<<<<<<
- *
- */
- struct __pyx_opt_args_3zmq_4core_6socket_6Socket_recv {
- int __pyx_n;
- int flags;
- PyObject *copy;
- PyObject *track;
- };
- /* "zmq/core/socket.pyx":79
- * raise ZMQError(ENOTSUP)
- *
- * cdef inline Message _recv_message(void *handle, int flags=0, track=False): # <<<<<<<<<<<<<<
- * """Receive a message in a non-copying manner and return a Message."""
- * cdef int rc
- */
- struct __pyx_opt_args_3zmq_4core_6socket__recv_message {
- int __pyx_n;
- int flags;
- PyObject *track;
- };
- /* "zmq/core/socket.pyx":92
- * return msg
- *
- * cdef inline object _recv_copy(void *handle, int flags=0): # <<<<<<<<<<<<<<
- * """Recieve a message and return a copy"""
- * cdef zmq_msg_t zmq_msg
- */
- struct __pyx_opt_args_3zmq_4core_6socket__recv_copy {
- int __pyx_n;
- int flags;
- };
- /* "zmq/core/socket.pyx":105
- * return msg_bytes
- *
- * cdef inline object _send_message(void *handle, Message msg, int flags=0): # <<<<<<<<<<<<<<
- * """Send a Message on this socket in a non-copy manner."""
- * cdef int rc
- */
- struct __pyx_opt_args_3zmq_4core_6socket__send_message {
- int __pyx_n;
- int flags;
- };
- /* "zmq/core/socket.pyx":124
- *
- *
- * cdef inline object _send_copy(void *handle, object msg, int flags=0): # <<<<<<<<<<<<<<
- * """Send a message on this socket by copying its content."""
- * cdef int rc, rc2
- */
- struct __pyx_opt_args_3zmq_4core_6socket__send_copy {
- int __pyx_n;
- int flags;
- };
- /* "zmq/core/socket.pxd":33
- *
- *
- * cdef class Socket: # <<<<<<<<<<<<<<
- * """A 0MQ socket."""
- *
- */
- struct __pyx_obj_3zmq_4core_6socket_Socket {
- PyObject_HEAD
- struct __pyx_vtabstruct_3zmq_4core_6socket_Socket *__pyx_vtab;
- void *handle;
- int socket_type;
- PyObject *context;
- PyObject *closed;
- };
- /* "message.pxd":32
- * #-----------------------------------------------------------------------------
- *
- * cdef class MessageTracker(object): # <<<<<<<<<<<<<<
- * """A class for tracking if 0MQ is done using one or more messages."""
- *
- */
- struct __pyx_obj_3zmq_4core_7message_MessageTracker {
- PyObject_HEAD
- PyObject *events;
- PyObject *peers;
- };
- /* "message.pxd":39
- *
- *
- * cdef class Message: # <<<<<<<<<<<<<<
- * """A Message class for non-copy send/recvs."""
- *
- */
- struct __pyx_obj_3zmq_4core_7message_Message {
- PyObject_HEAD
- struct __pyx_vtabstruct_3zmq_4core_7message_Message *__pyx_vtab;
- zmq_msg_t zmq_msg;
- PyObject *_data;
- PyObject *_buffer;
- PyObject *_bytes;
- int _failed_init;
- PyObject *tracker_event;
- PyObject *tracker;
- };
- /* "zmq/core/socket.pyx":151
- *
- *
- * cdef class Socket: # <<<<<<<<<<<<<<
- * """Socket(context, socket_type)
- *
- */
- struct __pyx_vtabstruct_3zmq_4core_6socket_Socket {
- PyObject *(*send)(struct __pyx_obj_3zmq_4core_6socket_Socket *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_3zmq_4core_6socket_6Socket_send *__pyx_optional_args);
- PyObject *(*recv)(struct __pyx_obj_3zmq_4core_6socket_Socket *, int __pyx_skip_dispatch, struct __pyx_opt_args_3zmq_4core_6socket_6Socket_recv *__pyx_optional_args);
- };
- static struct __pyx_vtabstruct_3zmq_4core_6socket_Socket *__pyx_vtabptr_3zmq_4core_6socket_Socket;
- /* "message.pxd":39
- *
- *
- * cdef class Message: # <<<<<<<<<<<<<<
- * """A Message class for non-copy send/recvs."""
- *
- */
- struct __pyx_vtabstruct_3zmq_4core_7message_Message {
- struct __pyx_obj_3zmq_4core_7message_Message *(*fast_copy)(struct __pyx_obj_3zmq_4core_7message_Message *);
- PyObject *(*_getbuffer)(struct __pyx_obj_3zmq_4core_7message_Message *);
- };
- static struct __pyx_vtabstruct_3zmq_4core_7message_Message *__pyx_vtabptr_3zmq_4core_7message_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 PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*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 void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*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 void __Pyx_RaiseDoubleKeywordsError(
- const char* func_name, PyObject* kw_name); /*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 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 int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*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) : \
- __Pyx_GetItemInt_Generic(o, to_py_func(i)))
- static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) {
- 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, PyInt_FromSsize_t(i));
- }
- #define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
- __Pyx_GetItemInt_Tuple_Fast(o, i) : \
- __Pyx_GetItemInt_Generic(o, to_py_func(i)))
- static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) {
- 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, PyInt_FromSsize_t(i));
- }
- #define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
- __Pyx_GetItemInt_Fast(o, i) : \
- __Pyx_GetItemInt_Generic(o, to_py_func(i)))
- static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) {
- 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, PyInt_FromSsize_t(i));
- }
- return r;
- }
- static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*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 PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*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 int __Pyx_PyInt_AsLongDouble(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 CYTHON_INLINE int __Pyx_StrEq(const char *, const char *); /*proto*/
- static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
- static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size, int strict); /*proto*/
- static PyObject *__Pyx_ImportModule(const char *name); /*proto*/
- static void* __Pyx_GetVtable(PyObject *dict); /*proto*/
- static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig); /*proto*/
- static void __Pyx_AddTraceback(const char *funcname); /*proto*/
- static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
- /* Module declarations from zmq.core.czmq */
- /* Module declarations from zmq.core.message */
- static PyTypeObject *__pyx_ptype_3zmq_4core_7message_MessageTracker = 0;
- static PyTypeObject *__pyx_ptype_3zmq_4core_7message_Message = 0;
- static PyObject *(*__pyx_f_3zmq_4core_7message_copy_zmq_msg_bytes)(zmq_msg_t *); /*proto*/
- /* Module declarations from libc.stdlib */
- /* Module declarations from cpython.version */
- /* Module declarations from cpython.ref */
- /* Module declarations from cpython.exc */
- /* Module declarations from cpython.module */
- /* Module declarations from cpython.mem */
- /* Module declarations from cpython.tuple */
- /* Module declarations from cpython.list */
- /* Module declarations from libc.stdio */
- /* Module declarations from cpython.object */
- /* Module declarations from cpython.sequence */
- /* Module declarations from cpython.mapping */
- /* Module declarations from cpython.iterator */
- /* Module declarations from cpython.type */
- /* Module declarations from cpython.number */
- /* Module declarations from cpython.int */
- /* Module declarations from __builtin__ */
- /* Module declarations from cpython.bool */
- static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0;
- /* Module declarations from cpython.long */
- /* Module declarations from cpython.float */
- /* Module declarations from __builtin__ */
- /* Module declarations from cpython.complex */
- static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0;
- /* Module declarations from cpython.string */
- /* Module declarations from cpython.unicode */
- /* Module declarations from cpython.dict */
- /* Module declarations from cpython.instance */
- /* Module declarations from cpython.function */
- /* Module declarations from cpython.method */
- /* Module declarations from cpython.weakref */
- /* Module declarations from cpython.getargs */
- /* Module declarations from cpython.pythread */
- /* Module declarations from cpython.cobject */
- /* Module declarations from cpython.oldbuffer */
- /* Module declarations from cpython.set */
- /* Module declarations from cpython.buffer */
- /* Module declarations from cpython.bytes */
- /* Module declarations from cpython.pycapsule */
- /* Module declarations from cpython */
- /* Module declarations from buffers */
- static CYTHON_INLINE int __pyx_f_7buffers_newstyle_available(void); /*proto*/
- static CYTHON_INLINE int __pyx_f_7buffers_memoryview_available(void); /*proto*/
- static CYTHON_INLINE int __pyx_f_7buffers_oldstyle_available(void); /*proto*/
- static CYTHON_INLINE int __pyx_f_7buffers_check_buffer(PyObject *); /*proto*/
- static CYTHON_INLINE PyObject *__pyx_f_7buffers_asbuffer(PyObject *, int, int, void **, Py_ssize_t *, Py_ssize_t *); /*proto*/
- static CYTHON_INLINE PyObject *__pyx_f_7buffers_asbuffer_r(PyObject *, void **, Py_ssize_t *); /*proto*/
- static CYTHON_INLINE PyObject *__pyx_f_7buffers_asbuffer_w(PyObject *, void **, Py_ssize_t *); /*proto*/
- static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer_3(void *, Py_ssize_t, int); /*proto*/
- static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer_2(void *, Py_ssize_t, int); /*proto*/
- static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer(void *, Py_ssize_t, int); /*proto*/
- static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer_r(void *, Py_ssize_t); /*proto*/
- static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer_w(void *, Py_ssize_t); /*proto*/
- static CYTHON_INLINE PyObject *__pyx_f_7buffers_viewfromobject(PyObject *, int); /*proto*/
- static CYTHON_INLINE PyObject *__pyx_f_7buffers_viewfromobject_r(PyObject *); /*proto*/
- static CYTHON_INLINE PyObject *__pyx_f_7buffers_viewfromobject_w(PyObject *); /*proto*/
- /* Module declarations from zmq.core.socket */
- static PyTypeObject *__pyx_ptype_3zmq_4core_6socket_Socket = 0;
- static CYTHON_INLINE PyObject *__pyx_f_3zmq_4core_6socket__check_closed(struct __pyx_obj_3zmq_4core_6socket_Socket *); /*proto*/
- static CYTHON_INLINE struct __pyx_obj_3zmq_4core_7message_Message *__pyx_f_3zmq_4core_6socket__recv_message(void *, struct __pyx_opt_args_3zmq_4core_6socket__recv_message *__pyx_optional_args); /*proto*/
- static CYTHON_INLINE PyObject *__pyx_f_3zmq_4core_6socket__recv_copy(void *, struct __pyx_opt_args_3zmq_4core_6socket__recv_copy *__pyx_optional_args); /*proto*/
- static CYTHON_INLINE PyObject *__pyx_f_3zmq_4core_6socket__send_message(void *, struct __pyx_obj_3zmq_4core_7message_Message *, struct __pyx_opt_args_3zmq_4core_6socket__send_message *__pyx_optional_args); /*proto*/
- static CYTHON_INLINE PyObject *__pyx_f_3zmq_4core_6socket__send_copy(void *, PyObject *, struct __pyx_opt_args_3zmq_4core_6socket__send_copy *__pyx_optional_args); /*proto*/
- #define __Pyx_MODULE_NAME "zmq.core.socket"
- static int __pyx_module_is_main_zmq__core__socket = 0;
- /* Implementation of zmq.core.socket */
- static PyObject *__pyx_builtin_TypeError;
- static PyObject *__pyx_builtin_xrange;
- static PyObject *__pyx_builtin_ValueError;
- static PyObject *__pyx_builtin_ImportError;
- static PyObject *__pyx_builtin_AttributeError;
- static PyObject *__pyx_builtin_NotImplementedError;
- static char __pyx_k_2[] = "unicode not allowed, use setsockopt_unicode";
- static char __pyx_k_4[] = "expected str, got: %r";
- static char __pyx_k_5[] = "expected int, got: %r";
- static char __pyx_k_6[] = "utf-8";
- static char __pyx_k_7[] = "unicode strings only";
- static char __pyx_k_9[] = "option %i will not return a string to be decoded";
- static char __pyx_k_11[] = "%s:%s";
- static char __pyx_k_12[] = "Could not bind socket to random port.";
- static char __pyx_k_17[] = "unicode not allowed, use send_unicode";
- static char __pyx_k_19[] = "Not a tracked message";
- static char __pyx_k_28[] = "unicode/str objects only";
- static char __pyx_k_30[] = "jsonlib{1,2}, json or simplejson library is required.";
- static char __pyx_k_33[] = "%r does not provide a buffer interface.";
- static char __pyx_k_34[] = "";
- static char __pyx_k_35[] = "New style buffers not available.";
- static char __pyx_k_37[] = "Old style buffers not available.";
- static char __pyx_k_39[] = "0MQ Socket class.";
- static char __pyx_k_40[] = "zmq.utils";
- static char __pyx_k_41[] = "zmq.core";
- static char __pyx_k_42[] = "zmq.core.constants";
- static char __pyx_k_43[] = "*";
- static char __pyx_k_44[] = "zmq.core.error";
- static char __pyx_k_45[] = "zmq.utils.strtypes";
- static char __pyx_k__B[] = "B";
- static char __pyx_k__u[] = "u";
- static char __pyx_k__buf[] = "buf";
- static char __pyx_k__len[] = "len";
- static char __pyx_k__obj[] = "obj";
- static char __pyx_k__sys[] = "sys";
- static char __pyx_k__addr[] = "addr";
- static char __pyx_k__bind[] = "bind";
- static char __pyx_k__char[] = "char";
- static char __pyx_k__copy[] = "copy";
- static char __pyx_k__data[] = "data";
- static char __pyx_k__recv[] = "recv";
- static char __pyx_k__send[] = "send";
- static char __pyx_k__time[] = "time";
- static char __pyx_k__bytes[] = "bytes";
- static char __pyx_k__close[] = "close";
- static char __pyx_k__dtype[] = "dtype";
- static char __pyx_k__dumps[] = "dumps";
- static char __pyx_k__flags[] = "flags";
- static char __pyx_k__loads[] = "loads";
- static char __pyx_k__range[] = "range";
- static char __pyx_k__shape[] = "shape";
- static char __pyx_k__track[] = "track";
- static char __pyx_k__EINVAL[] = "EINVAL";
- static char __pyx_k__Socket[] = "Socket";
- static char __pyx_k__append[] = "append";
- static char __pyx_k__buffer[] = "buffer";
- static char __pyx_k__closed[] = "closed";
- static char __pyx_k__codecs[] = "codecs";
- static char __pyx_k__decode[] = "decode";
- static char __pyx_k__encode[] = "encode";
- static char __pyx_k__format[] = "format";
- static char __pyx_k__handle[] = "handle";
- 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__struct[] = "struct";
- static char __pyx_k__xrange[] = "xrange";
- static char __pyx_k__ENOTSUP[] = "ENOTSUP";
- static char __pyx_k__RCVMORE[] = "RCVMORE";
- static char __pyx_k__SNDMORE[] = "SNDMORE";
- static char __pyx_k____all__[] = "__all__";
- static char __pyx_k___handle[] = "_handle";
- static char __pyx_k__cPickle[] = "cPickle";
- static char __pyx_k__context[] = "context";
- static char __pyx_k__jsonapi[] = "jsonapi";
- static char __pyx_k__jsonmod[] = "jsonmod";
- static char __pyx_k__rcvmore[] = "rcvmore";
- static char __pyx_k__tracker[] = "tracker";
- static char __pyx_k__unicode[] = "unicode";
- static char __pyx_k__zmq_msg[] = "zmq_msg";
- static char __pyx_k__IDENTITY[] = "IDENTITY";
- static char __pyx_k__ZMQError[] = "ZMQError";
- static char __pyx_k____main__[] = "__main__";
- static char __pyx_k____test__[] = "__test__";
- static char __pyx_k__copy_mod[] = "copy_mod";
- static char __pyx_k__encoding[] = "encoding";
- static char __pyx_k__itemsize[] = "itemsize";
- 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__typecode[] = "typecode";
- static char __pyx_k__TypeError[] = "TypeError";
- static char __pyx_k__constants[] = "constants";
- 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__ValueError[] = "ValueError";
- static char __pyx_k__basestring[] = "basestring";
- static char __pyx_k__getsockopt[] = "getsockopt";
- static char __pyx_k__setsockopt[] = "setsockopt";
- static char __pyx_k__ImportError[] = "ImportError";
- static char __pyx_k__socket_type[] = "socket_type";
- static char __pyx_k__ZMQBindError[] = "ZMQBindError";
- static char __pyx_k__int_sockopts[] = "int_sockopts";
- static char __pyx_k__AttributeError[] = "AttributeError";
- static char __pyx_k__bytes_sockopts[] = "bytes_sockopts";
- static char __pyx_k__int64_sockopts[] = "int64_sockopts";
- static char __pyx_k__NotImplementedError[] = "NotImplementedError";
- static PyObject *__pyx_kp_s_11;
- static PyObject *__pyx_kp_s_12;
- static PyObject *__pyx_kp_s_17;
- static PyObject *__pyx_kp_s_19;
- static PyObject *__pyx_kp_s_2;
- static PyObject *__pyx_kp_s_28;
- static PyObject *__pyx_kp_s_30;
- static PyObject *__pyx_kp_s_33;
- static PyObject *__pyx_kp_s_34;
- static PyObject *__pyx_kp_s_35;
- static PyObject *__pyx_kp_s_37;
- static PyObject *__pyx_kp_s_4;
- static PyObject *__pyx_n_s_40;
- static PyObject *__pyx_n_s_41;
- static PyObject *__pyx_n_s_42;
- static PyObject *__pyx_n_s_43;
- static PyObject *__pyx_n_s_44;
- static PyObject *__pyx_n_s_45;
- static PyObject *__pyx_kp_s_5;
- static PyObject *__pyx_kp_s_6;
- static PyObject *__pyx_kp_s_7;
- static PyObject *__pyx_kp_s_9;
- static PyObject *__pyx_n_s__AttributeError;
- static PyObject *__pyx_n_s__B;
- static PyObject *__pyx_n_s__EINVAL;
- static PyObject *__pyx_n_s__ENOTSUP;
- static PyObject *__pyx_n_s__IDENTITY;
- static PyObject *__pyx_n_s__ImportError;
- static PyObject *__pyx_n_s__NotImplementedError;
- static PyObject *__pyx_n_s__RCVMORE;
- static PyObject *__pyx_n_s__SNDMORE;
- static PyObject *__pyx_n_s__Socket;
- static PyObject *__pyx_n_s__TypeError;
- static PyObject *__pyx_n_s__ValueError;
- static PyObject *__pyx_n_s__ZMQBindError;
- static PyObject *__pyx_n_s__ZMQError;
- static PyObject *__pyx_n_s____all__;
- static PyObject *__pyx_n_s____main__;
- static PyObject *__pyx_n_s____test__;
- static PyObject *__pyx_n_s___handle;
- static PyObject *__pyx_n_s__addr;
- static PyObject *__pyx_n_s__append;
- static PyObject *__pyx_n_s__basestring;
- static PyObject *__pyx_n_s__bind;
- static PyObject *__pyx_n_s__buf;
- static PyObject *__pyx_n_s__buffer;
- static PyObject *__pyx_n_s__bytes;
- static PyObject *__pyx_n_s__bytes_sockopts;
- static PyObject *__pyx_n_s__cPickle;
- static PyObject *__pyx_n_s__char;
- static PyObject *__pyx_n_s__close;
- static PyObject *__pyx_n_s__closed;
- static PyObject *__pyx_n_s__codecs;
- static PyObject *__pyx_n_s__constants;
- 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__decode;
- static PyObject *__pyx_n_s__dtype;
- static PyObject *__pyx_n_s__dumps;
- static PyObject *__pyx_n_s__encode;
- static PyObject *__pyx_n_s__encoding;
- static PyObject *__pyx_n_s__fast_copy;
- static PyObject *__pyx_n_s__flags;
- static PyObject *__pyx_n_s__format;
- static PyObject *__pyx_n_s__getsockopt;
- static PyObject *__pyx_n_s__handle;
- static PyObject *__pyx_n_s__int64_sockopts;
- static PyObject *__pyx_n_s__int_sockopts;
- static PyObject *__pyx_n_s__itemsize;
- static PyObject *__pyx_n_s__jsonapi;
- static PyObject *__pyx_n_s__jsonmod;
- static PyObject *__pyx_n_s__len;
- 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__msg_parts;
- static PyObject *__pyx_n_s__obj;
- static PyObject *__pyx_n_s__option;
- static PyObject *__pyx_n_s__optval;
- static PyObject *__pyx_n_s__pickle;
- 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__send;
- static PyObject *__pyx_n_s__setsockopt;
- static PyObject *__pyx_n_s__shape;
- static PyObject *__pyx_n_s__socket_type;
- static PyObject *__pyx_n_s__struct;
- static PyObject *__pyx_n_s__sys;
- static PyObject *__pyx_n_s__time;
- static PyObject *__pyx_n_s__track;
- static PyObject *__pyx_n_s__tracker;
- static PyObject *__pyx_n_s__typecode;
- static PyObject *__pyx_n_s__u;
- static PyObject *__pyx_n_s__unicode;
- static PyObject *__pyx_n_s__xrange;
- static PyObject *__pyx_n_s__zmq_msg;
- static PyObject *__pyx_int_0;
- static PyObject *__pyx_int_neg_1;
- static PyObject *__pyx_int_100;
- static PyObject *__pyx_int_49152;
- static PyObject *__pyx_int_65536;
- static PyObject *__pyx_k_1;
- static PyObject *__pyx_k_15;
- static PyObject *__pyx_k_16;
- static PyObject *__pyx_k_21;
- static PyObject *__pyx_k_22;
- static PyObject *__pyx_k_23;
- static PyObject *__pyx_k_24;
- static PyObject *__pyx_k_25;
- static PyObject *__pyx_k_26;
- static PyObject *__pyx_k_27;
- static PyObject *__pyx_k_tuple_3;
- static PyObject *__pyx_k_tuple_8;
- static PyObject *__pyx_k_tuple_10;
- static PyObject *__pyx_k_tuple_13;
- static PyObject *__pyx_k_tuple_14;
- static PyObject *__pyx_k_tuple_18;
- static PyObject *__pyx_k_tuple_20;
- static PyObject *__pyx_k_tuple_29;
- static PyObject *__pyx_k_tuple_31;
- static PyObject *__pyx_k_tuple_32;
- static PyObject *__pyx_k_tuple_36;
- static PyObject *__pyx_k_tuple_38;
- /* "zmq/core/socket.pyx":75
- * # true methods frequently cannot be inlined, acc. Cython docs
- *
- * cdef inline _check_closed(Socket s): # <<<<<<<<<<<<<<
- * if s.closed:
- * raise ZMQError(ENOTSUP)
- */
- static CYTHON_INLINE PyObject *__pyx_f_3zmq_4core_6socket__check_closed(struct __pyx_obj_3zmq_4core_6socket_Socket *__pyx_v_s) {
- 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");
- /* "zmq/core/socket.pyx":76
- *
- * cdef inline _check_closed(Socket s):
- * if s.closed: # <<<<<<<<<<<<<<
- * raise ZMQError(ENOTSUP)
- *
- */
- __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_s->closed); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__pyx_t_1) {
- /* "zmq/core/socket.pyx":77
- * cdef inline _check_closed(Socket s):
- * if s.closed:
- * raise ZMQError(ENOTSUP) # <<<<<<<<<<<<<<
- *
- * cdef inline Message _recv_message(void *handle, int flags=0, track=False):
- */
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __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 = 77; __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 = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__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, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(((PyObject *)__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 = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L3;
- }
- __pyx_L3:;
- __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.core.socket._check_closed");
- __pyx_r = 0;
- __pyx_L0:;
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
- }
- /* "zmq/core/socket.pyx":79
- * raise ZMQError(ENOTSUP)
- *
- * cdef inline Message _recv_message(void *handle, int flags=0, track=False): # <<<<<<<<<<<<<<
- * """Receive a message in a non-copying manner and return a Message."""
- * cdef int rc
- */
- static CYTHON_INLINE struct __pyx_obj_3zmq_4core_7message_Message *__pyx_f_3zmq_4core_6socket__recv_message(void *__pyx_v_handle, struct __pyx_opt_args_3zmq_4core_6socket__recv_message *__pyx_optional_args) {
- int __pyx_v_flags = ((int)0);
- PyObject *__pyx_v_track = __pyx_k_1;
- int __pyx_v_rc;
- struct __pyx_obj_3zmq_4core_7message_Message *__pyx_v_msg;
- struct __pyx_obj_3zmq_4core_7message_Message *__pyx_r = NULL;
- PyObject *__pyx_t_1 = NULL;
- PyObject *__pyx_t_2 = NULL;
- int __pyx_t_3;
- __Pyx_RefNannySetupContext("_recv_message");
- if (__pyx_optional_args) {
- if (__pyx_optional_args->__pyx_n > 0) {
- __pyx_v_flags = __pyx_optional_args->flags;
- if (__pyx_optional_args->__pyx_n > 1) {
- __pyx_v_track = __pyx_optional_args->track;
- }
- }
- }
- __pyx_v_msg = ((struct __pyx_obj_3zmq_4core_7message_Message *)Py_None); __Pyx_INCREF(Py_None);
- /* "zmq/core/socket.pyx":83
- * cdef int rc
- * cdef Message msg
- * msg = Message(track=track) # <<<<<<<<<<<<<<
- *
- * with nogil:
- */
- __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_1));
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__track), __pyx_v_track) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_2 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_3zmq_4core_7message_Message)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_v_msg));
- __pyx_v_msg = ((struct __pyx_obj_3zmq_4core_7message_Message *)__pyx_t_2);
- __pyx_t_2 = 0;
- /* "zmq/core/socket.pyx":85
- * msg = Message(track=track)
- *
- * with nogil: # <<<<<<<<<<<<<<
- * rc = zmq_recvmsg(handle, &msg.zmq_msg, flags)
- *
- */
- {
- #ifdef WITH_THREAD
- PyThreadState *_save;
- #endif
- Py_UNBLOCK_THREADS
- /*try:*/ {
- /* "zmq/core/socket.pyx":86
- *
- * with nogil:
- * rc = zmq_recvmsg(handle, &msg.zmq_msg, flags) # <<<<<<<<<<<<<<
- *
- * if rc < 0:
- */
- __pyx_v_rc = zmq_recvmsg(__pyx_v_handle, (&__pyx_v_msg->zmq_msg), __pyx_v_flags);
- }
- /* "zmq/core/socket.pyx":85
- * msg = Message(track=track)
- *
- * with nogil: # <<<<<<<<<<<<<<
- * rc = zmq_recvmsg(handle, &msg.zmq_msg, flags)
- *
- */
- /*finally:*/ {
- Py_BLOCK_THREADS
- }
- }
- /* "zmq/core/socket.pyx":88
- * rc = zmq_recvmsg(handle, &msg.zmq_msg, flags)
- *
- * if rc < 0: # <<<<<<<<<<<<<<
- * raise ZMQError()
- * return msg
- */
- __pyx_t_3 = (__pyx_v_rc < 0);
- if (__pyx_t_3) {
- /* "zmq/core/socket.pyx":89
- *
- * 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 = 89; __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 = 89; __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 = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L6;
- }
- __pyx_L6:;
- /* "zmq/core/socket.pyx":90
- * if rc < 0:
- * raise ZMQError()
- * return msg # <<<<<<<<<<<<<<
- *
- * cdef inline object _recv_copy(void *handle, int flags=0):
- */
- __Pyx_XDECREF(((PyObject *)__pyx_r));
- __Pyx_INCREF(((PyObject *)__pyx_v_msg));
- __pyx_r = __pyx_v_msg;
- goto __pyx_L0;
- __pyx_r = ((struct __pyx_obj_3zmq_4core_7message_Message *)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.core.socket._recv_message");
- __pyx_r = 0;
- __pyx_L0:;
- __Pyx_DECREF((PyObject *)__pyx_v_msg);
- __Pyx_XGIVEREF((PyObject *)__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
- }
- /* "zmq/core/socket.pyx":92
- * return msg
- *
- * cdef inline object _recv_copy(void *handle, int flags=0): # <<<<<<<<<<<<<<
- * """Recieve a message and return a copy"""
- * cdef zmq_msg_t zmq_msg
- */
- static CYTHON_INLINE PyObject *__pyx_f_3zmq_4core_6socket__recv_copy(void *__pyx_v_handle, struct __pyx_opt_args_3zmq_4core_6socket__recv_copy *__pyx_optional_args) {
- int __pyx_v_flags = ((int)0);
- zmq_msg_t __pyx_v_zmq_msg;
- int __pyx_v_rc;
- PyObject *__pyx_v_msg_bytes;
- PyObject *__pyx_r = NULL;
- int __pyx_t_1;
- PyObject *__pyx_t_2 = NULL;
- PyObject *__pyx_t_3 = NULL;
- __Pyx_RefNannySetupContext("_recv_copy");
- if (__pyx_optional_args) {
- if (__pyx_optional_args->__pyx_n > 0) {
- __pyx_v_flags = __pyx_optional_args->flags;
- }
- }
- __pyx_v_msg_bytes = Py_None; __Pyx_INCREF(Py_None);
- /* "zmq/core/socket.pyx":95
- * """Recieve a message and return a copy"""
- * cdef zmq_msg_t zmq_msg
- * with nogil: # <<<<<<<<<<<<<<
- * zmq_msg_init (&zmq_msg)
- * rc = zmq_recvmsg(handle, &zmq_msg, flags)
- */
- {
- #ifdef WITH_THREAD
- PyThreadState *_save;
- #endif
- Py_UNBLOCK_THREADS
- /*try:*/ {
- /* "zmq/core/socket.pyx":96
- * cdef zmq_msg_t zmq_msg
- * with nogil:
- * zmq_msg_init (&zmq_msg) # <<<<<<<<<<<<<<
- * rc = zmq_recvmsg(handle, &zmq_msg, flags)
- * if rc < 0:
- */
- zmq_msg_init((&__pyx_v_zmq_msg));
- /* "zmq/core/socket.pyx":97
- * with nogil:
- * zmq_msg_init (&zmq_msg)
- * rc = zmq_recvmsg(handle, &zmq_msg, flags) # <<<<<<<<<<<<<<
- * if rc < 0:
- * raise ZMQError()
- */
- __pyx_v_rc = zmq_recvmsg(__pyx_v_handle, (&__pyx_v_zmq_msg), __pyx_v_flags);
- }
- /* "zmq/core/socket.pyx":95
- * """Recieve a message and return a copy"""
- * cdef zmq_msg_t zmq_msg
- * with nogil: # <<<<<<<<<<<<<<
- * zmq_msg_init (&zmq_msg)
- * rc = zmq_recvmsg(handle, &zmq_msg, flags)
- */
- /*finally:*/ {
- Py_BLOCK_THREADS
- }
- }
- /* "zmq/core/socket.pyx":98
- * zmq_msg_init (&zmq_msg)
- * rc = zmq_recvmsg(handle, &zmq_msg, flags)
- * if rc < 0: # <<<<<<<<<<<<<<
- * raise ZMQError()
- * msg_bytes = copy_zmq_msg_bytes(&zmq_msg)
- */
- __pyx_t_1 = (__pyx_v_rc < 0);
- if (__pyx_t_1) {
- /* "zmq/core/socket.pyx":99
- * rc = zmq_recvmsg(handle, &zmq_msg, flags)
- * if rc < 0:
- * raise ZMQError() # <<<<<<<<<<<<<<
- * msg_bytes = copy_zmq_msg_bytes(&zmq_msg)
- * 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 = 99; __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 = 99; __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 = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L6;
- }
- __pyx_L6:;
- /* "zmq/core/socket.pyx":100
- * if rc < 0:
- * raise ZMQError()
- * msg_bytes = copy_zmq_msg_bytes(&zmq_msg) # <<<<<<<<<<<<<<
- * with nogil:
- * zmq_msg_close(&zmq_msg)
- */
- __pyx_t_3 = __pyx_f_3zmq_4core_7message_copy_zmq_msg_bytes((&__pyx_v_zmq_msg)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_v_msg_bytes);
- __pyx_v_msg_bytes = __pyx_t_3;
- __pyx_t_3 = 0;
- /* "zmq/core/socket.pyx":101
- * raise ZMQError()
- * msg_bytes = copy_zmq_msg_bytes(&zmq_msg)
- * with nogil: # <<<<<<<<<<<<<<
- * zmq_msg_close(&zmq_msg)
- * return msg_bytes
- */
- {
- #ifdef WITH_THREAD
- PyThreadState *_save;
- #endif
- Py_UNBLOCK_THREADS
- /*try:*/ {
- /* "zmq/core/socket.pyx":102
- * msg_bytes = copy_zmq_msg_bytes(&zmq_msg)
- * with nogil:
- * zmq_msg_close(&zmq_msg) # <<<<<<<<<<<<<<
- * return msg_bytes
- *
- */
- zmq_msg_close((&__pyx_v_zmq_msg));
- }
- /* "zmq/core/socket.pyx":101
- * raise ZMQError()
- * msg_bytes = copy_zmq_msg_bytes(&zmq_msg)
- * with nogil: # <<<<<<<<<<<<<<
- * zmq_msg_close(&zmq_msg)
- * return msg_bytes
- */
- /*finally:*/ {
- Py_BLOCK_THREADS
- }
- }
- /* "zmq/core/socket.pyx":103
- * with nogil:
- * zmq_msg_close(&zmq_msg)
- * return msg_bytes # <<<<<<<<<<<<<<
- *
- * cdef inline object _send_message(void *handle, Message msg, int flags=0):
- */
- __Pyx_XDECREF(__pyx_r);
- __Pyx_INCREF(__pyx_v_msg_bytes);
- __pyx_r = __pyx_v_msg_bytes;
- 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.core.socket._recv_copy");
- __pyx_r = 0;
- __pyx_L0:;
- __Pyx_DECREF(__pyx_v_msg_bytes);
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
- }
- /* "zmq/core/socket.pyx":105
- * return msg_bytes
- *
- * cdef inline object _send_message(void *handle, Message msg, int flags=0): # <<<<<<<<<<<<<<
- * """Send a Message on this socket in a non-copy manner."""
- * cdef int rc
- */
- static CYTHON_INLINE PyObject *__pyx_f_3zmq_4core_6socket__send_message(void *__pyx_v_handle, struct __pyx_obj_3zmq_4core_7message_Message *__pyx_v_msg, struct __pyx_opt_args_3zmq_4core_6socket__send_message *__pyx_optional_args) {
- int __pyx_v_flags = ((int)0);
- int __pyx_v_rc;
- struct __pyx_obj_3zmq_4core_7message_Message *__pyx_v_msg_copy;
- PyObject *__pyx_r = NULL;
- PyObject *__pyx_t_1 = NULL;
- int __pyx_t_2;
- PyObject *__pyx_t_3 = NULL;
- __Pyx_RefNannySetupContext("_send_message");
- if (__pyx_optional_args) {
- if (__pyx_optional_args->__pyx_n > 0) {
- __pyx_v_flags = __pyx_optional_args->flags;
- }
- }
- __pyx_v_msg_copy = ((struct __pyx_obj_3zmq_4core_7message_Message *)Py_None); __Pyx_INCREF(Py_None);
- /* "zmq/core/socket.pyx":112
- * # 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() # <<<<<<<<<<<<<<
- *
- * with nogil:
- */
- __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_3zmq_4core_7message_Message *)__pyx_v_msg->__pyx_vtab)->fast_copy(__pyx_v_msg)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __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_4core_7message_Message *)__pyx_t_1);
- __pyx_t_1 = 0;
- /* "zmq/core/socket.pyx":114
- * msg_copy = msg.fast_copy()
- *
- * with nogil: # <<<<<<<<<<<<<<
- * rc = zmq_sendmsg(handle, &msg_copy.zmq_msg, flags)
- *
- */
- {
- #ifdef WITH_THREAD
- PyThreadState *_save;
- #endif
- Py_UNBLOCK_THREADS
- /*try:*/ {
- /* "zmq/core/socket.pyx":115
- *
- * with nogil:
- * rc = zmq_sendmsg(handle, &msg_copy.zmq_msg, flags) # <<<<<<<<<<<<<<
- *
- * if rc < 0:
- */
- __pyx_v_rc = zmq_sendmsg(__pyx_v_handle, (&__pyx_v_msg_copy->zmq_msg), __pyx_v_flags);
- }
- /* "zmq/core/socket.pyx":114
- * msg_copy = msg.fast_copy()
- *
- * with nogil: # <<<<<<<<<<<<<<
- * rc = zmq_sendmsg(handle, &msg_copy.zmq_msg, flags)
- *
- */
- /*finally:*/ {
- Py_BLOCK_THREADS
- }
- }
- /* "zmq/core/socket.pyx":117
- * rc = zmq_sendmsg(handle, &msg_copy.zmq_msg, flags)
- *
- * if rc < 0: # <<<<<<<<<<<<<<
- * # don't pop from the Queue here, because the free_fn will
- * # still call Queue.get() even if the send fails
- */
- __pyx_t_2 = (__pyx_v_rc < 0);
- if (__pyx_t_2) {
- /* "zmq/core/socket.pyx":120
- * # don't pop from the Queue here, because the free_fn will
- * # still call Queue.get() even if the send fails
- * raise ZMQError() # <<<<<<<<<<<<<<
- * return msg.tracker
- *
- */
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __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 = 120; __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 = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L6;
- }
- __pyx_L6:;
- /* "zmq/core/socket.pyx":121
- * # still call Queue.get() even if the send fails
- * raise ZMQError()
- * return msg.tracker # <<<<<<<<<<<<<<
- *
- *
- */
- __Pyx_XDECREF(__pyx_r);
- __Pyx_INCREF(__pyx_v_msg->tracker);
- __pyx_r = __pyx_v_msg->tracker;
- 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.core.socket._send_message");
- __pyx_r = 0;
- __pyx_L0:;
- __Pyx_DECREF((PyObject *)__pyx_v_msg_copy);
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
- }
- /* "zmq/core/socket.pyx":124
- *
- *
- * cdef inline object _send_copy(void *handle, object msg, int flags=0): # <<<<<<<<<<<<<<
- * """Send a message on this socket by copying its content."""
- * cdef int rc, rc2
- */
- static CYTHON_INLINE PyObject *__pyx_f_3zmq_4core_6socket__send_copy(void *__pyx_v_handle, PyObject *__pyx_v_msg, struct __pyx_opt_args_3zmq_4core_6socket__send_copy *__pyx_optional_args) {
- int __pyx_v_flags = ((int)0);
- 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;
- PyObject *__pyx_t_1 = NULL;
- PyObject *__pyx_t_2 = NULL;
- int __pyx_t_3;
- int __pyx_t_4;
- int __pyx_t_5;
- __Pyx_RefNannySetupContext("_send_copy");
- if (__pyx_optional_args) {
- if (__pyx_optional_args->__pyx_n > 0) {
- __pyx_v_flags = __pyx_optional_args->flags;
- }
- }
- /* "zmq/core/socket.pyx":129
- * cdef zmq_msg_t data
- * cdef char *msg_c
- * cdef Py_ssize_t msg_c_len=0 # <<<<<<<<<<<<<<
- *
- * # copy to c array:
- */
- __pyx_v_msg_c_len = 0;
- /* "zmq/core/socket.pyx":132
- *
- * # copy to c array:
- * asbuffer_r(msg, <void **>&msg_c, &msg_c_len) # <<<<<<<<<<<<<<
- *
- * # Copy the msg before sending. This avoids any complications with
- */
- __pyx_t_1 = __pyx_v_msg;
- __Pyx_INCREF(__pyx_t_1);
- __pyx_t_2 = __pyx_f_7buffers_asbuffer_r(__pyx_t_1, ((void **)(&__pyx_v_msg_c)), (&__pyx_v_msg_c_len)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __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;
- /* "zmq/core/socket.pyx":137
- * # the GIL, etc.
- * # If zmq_msg_init_* fails we must not call zmq_msg_close (Bus Error)
- * with nogil: # <<<<<<<<<<<<<<
- * rc = zmq_msg_init_size(&data, msg_c_len)
- * memcpy(zmq_msg_data(&data), msg_c, zmq_msg_size(&data))
- */
- {
- #ifdef WITH_THREAD
- PyThreadState *_save;
- #endif
- Py_UNBLOCK_THREADS
- /*try:*/ {
- /* "zmq/core/socket.pyx":138
- * # If zmq_msg_init_* fails we must not call zmq_msg_close (Bus Error)
- * with nogil:
- * 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);
- /* "zmq/core/socket.pyx":139
- * with nogil:
- * 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)));
- }
- /* "zmq/core/socket.pyx":137
- * # the GIL, etc.
- * # If zmq_msg_init_* fails we must not call zmq_msg_close (Bus Error)
- * with nogil: # <<<<<<<<<<<<<<
- * rc = zmq_msg_init_size(&data, msg_c_len)
- * memcpy(zmq_msg_data(&data), msg_c, zmq_msg_size(&data))
- */
- /*finally:*/ {
- Py_BLOCK_THREADS
- }
- }
- /* "zmq/core/socket.pyx":141
- * memcpy(zmq_msg_data(&data), msg_c, zmq_msg_size(&data))
- *
- * if rc != 0: # <<<<<<<<<<<<<<
- * raise ZMQError()
- *
- */
- __pyx_t_3 = (__pyx_v_rc != 0);
- if (__pyx_t_3) {
- /* "zmq/core/socket.pyx":142
- *
- * 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 = 142; __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 = 142; __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 = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L6;
- }
- __pyx_L6:;
- /* "zmq/core/socket.pyx":144
- * raise ZMQError()
- *
- * with nogil: # <<<<<<<<<<<<<<
- * rc = zmq_sendmsg(handle, &data, flags)
- * rc2 = zmq_msg_close(&data)
- */
- {
- #ifdef WITH_THREAD
- PyThreadState *_save;
- #endif
- Py_UNBLOCK_THREADS
- /*try:*/ {
- /* "zmq/core/socket.pyx":145
- *
- * with nogil:
- * rc = zmq_sendmsg(handle, &data, flags) # <<<<<<<<<<<<<<
- * rc2 = zmq_msg_close(&data)
- * if rc < 0 or rc2 != 0:
- */
- __pyx_v_rc = zmq_sendmsg(__pyx_v_handle, (&__pyx_v_data), __pyx_v_flags);
- /* "zmq/core/socket.pyx":146
- * with nogil:
- * rc = zmq_sendmsg(handle, &data, flags)
- * rc2 = zmq_msg_close(&data) # <<<<<<<<<<<<<<
- * if rc < 0 or rc2 != 0:
- * raise ZMQError()
- */
- __pyx_v_rc2 = zmq_msg_close((&__pyx_v_data));
- }
- /* "zmq/core/socket.pyx":144
- * raise ZMQError()
- *
- * with nogil: # <<<<<<<<<<<<<<
- * rc = zmq_sendmsg(handle, &data, flags)
- * rc2 = zmq_msg_close(&data)
- */
- /*finally:*/ {
- Py_BLOCK_THREADS
- }
- }
- /* "zmq/core/socket.pyx":147
- * rc = zmq_sendmsg(handle, &data, flags)
- * rc2 = zmq_msg_close(&data)
- * if rc < 0 or rc2 != 0: # <<<<<<<<<<<<<<
- * raise ZMQError()
- *
- */
- __pyx_t_3 = (__pyx_v_rc < 0);
- if (!__pyx_t_3) {
- __pyx_t_4 = (__pyx_v_rc2 != 0);
- __pyx_t_5 = __pyx_t_4;
- } else {
- __pyx_t_5 = __pyx_t_3;
- }
- if (__pyx_t_5) {
- /* "zmq/core/socket.pyx":148
- * rc2 = zmq_msg_close(&data)
- * if rc < 0 or rc2 != 0:
- * raise ZMQError() # <<<<<<<<<<<<<<
- *
- *
- */
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __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 = 148; __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 = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L10;
- }
- __pyx_L10:;
- __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.core.socket._send_copy");
- __pyx_r = 0;
- __pyx_L0:;
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
- }
- /* "zmq/core/socket.pyx":171
- * """
- *
- * def __cinit__(self, object context, int socket_type): # <<<<<<<<<<<<<<
- * cdef Py_ssize_t c_handle
- * c_handle = context._handle
- */
- static int __pyx_pf_3zmq_4core_6socket_6Socket___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
- static int __pyx_pf_3zmq_4core_6socket_6Socket___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
- PyObject *__pyx_v_context = 0;
- int __pyx_v_socket_type;
- Py_ssize_t __pyx_v_c_handle;
- int __pyx_r;
- PyObject *__pyx_t_1 = NULL;
- Py_ssize_t __pyx_t_2;
- int __pyx_t_3;
- PyObject *__pyx_t_4 = 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 = 171; __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 = 171; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- }
- __pyx_v_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 = 171; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
- goto __pyx_L5_argtuple_error;
- } else {
- __pyx_v_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 = 171; __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 = 171; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- __pyx_L3_error:;
- __Pyx_AddTraceback("zmq.core.socket.Socket.__cinit__");
- __Pyx_RefNannyFinishContext();
- return -1;
- __pyx_L4_argument_unpacking_done:;
- /* "zmq/core/socket.pyx":173
- * def __cinit__(self, object context, int socket_type):
- * cdef Py_ssize_t c_handle
- * c_handle = context._handle # <<<<<<<<<<<<<<
- *
- * self.handle = NULL
- */
- __pyx_t_1 = PyObject_GetAttr(__pyx_v_context, __pyx_n_s___handle); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_v_c_handle = __pyx_t_2;
- /* "zmq/core/socket.pyx":175
- * c_handle = context._handle
- *
- * self.handle = NULL # <<<<<<<<<<<<<<
- * self.context = context
- * self.socket_type = socket_type
- */
- ((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->handle = NULL;
- /* "zmq/core/socket.pyx":176
- *
- * self.handle = NULL
- * self.context = context # <<<<<<<<<<<<<<
- * self.socket_type = socket_type
- * with nogil:
- */
- __Pyx_INCREF(__pyx_v_context);
- __Pyx_GIVEREF(__pyx_v_context);
- __Pyx_GOTREF(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->context);
- __Pyx_DECREF(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->context);
- ((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->context = __pyx_v_context;
- /* "zmq/core/socket.pyx":177
- * self.handle = NULL
- * self.context = context
- * self.socket_type = socket_type # <<<<<<<<<<<<<<
- * with nogil:
- * self.handle = zmq_socket(<void *>c_handle, socket_type)
- */
- ((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->socket_type = __pyx_v_socket_type;
- /* "zmq/core/socket.pyx":178
- * self.context = context
- * self.socket_type = socket_type
- * with nogil: # <<<<<<<<<<<<<<
- * self.handle = zmq_socket(<void *>c_handle, socket_type)
- * if self.handle == NULL:
- */
- {
- #ifdef WITH_THREAD
- PyThreadState *_save;
- #endif
- Py_UNBLOCK_THREADS
- /*try:*/ {
- /* "zmq/core/socket.pyx":179
- * self.socket_type = socket_type
- * with nogil:
- * self.handle = zmq_socket(<void *>c_handle, socket_type) # <<<<<<<<<<<<<<
- * if self.handle == NULL:
- * raise ZMQError()
- */
- ((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->handle = zmq_socket(((void *)__pyx_v_c_handle), __pyx_v_socket_type);
- }
- /* "zmq/core/socket.pyx":178
- * self.context = context
- * self.socket_type = socket_type
- * with nogil: # <<<<<<<<<<<<<<
- * self.handle = zmq_socket(<void *>c_handle, socket_type)
- * if self.handle == NULL:
- */
- /*finally:*/ {
- Py_BLOCK_THREADS
- }
- }
- /* "zmq/core/socket.pyx":180
- * with nogil:
- * self.handle = zmq_socket(<void *>c_handle, socket_type)
- * if self.handle == NULL: # <<<<<<<<<<<<<<
- * raise ZMQError()
- * self.closed = False
- */
- __pyx_t_3 = (((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->handle == NULL);
- if (__pyx_t_3) {
- /* "zmq/core/socket.pyx":181
- * self.handle = zmq_socket(<void *>c_handle, socket_type)
- * if self.handle == NULL:
- * raise ZMQError() # <<<<<<<<<<<<<<
- * self.closed = False
- *
- */
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __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 = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L9;
- }
- __pyx_L9:;
- /* "zmq/core/socket.pyx":182
- * if self.handle == NULL:
- * raise ZMQError()
- * self.closed = False # <<<<<<<<<<<<<<
- *
- * def __dealloc__(self):
- */
- __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_GIVEREF(__pyx_t_4);
- __Pyx_GOTREF(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->closed);
- __Pyx_DECREF(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->closed);
- ((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->closed = __pyx_t_4;
- __pyx_t_4 = 0;
- __pyx_r = 0;
- goto __pyx_L0;
- __pyx_L1_error:;
- __Pyx_XDECREF(__pyx_t_1);
- __Pyx_XDECREF(__pyx_t_4);
- __Pyx_AddTraceback("zmq.core.socket.Socket.__cinit__");
- __pyx_r = -1;
- __pyx_L0:;
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
- }
- /* "zmq/core/socket.pyx":184
- * self.closed = False
- *
- * def __dealloc__(self): # <<<<<<<<<<<<<<
- * self.close()
- *
- */
- static void __pyx_pf_3zmq_4core_6socket_6Socket_1__dealloc__(PyObject *__pyx_v_self); /*proto*/
- static void __pyx_pf_3zmq_4core_6socket_6Socket_1__dealloc__(PyObject *__pyx_v_self) {
- PyObject *__pyx_t_1 = NULL;
- PyObject *__pyx_t_2 = NULL;
- __Pyx_RefNannySetupContext("__dealloc__");
- /* "zmq/core/socket.pyx":185
- *
- * 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 = 185; __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 = 185; __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.core.socket.Socket.__dealloc__");
- __pyx_L0:;
- __Pyx_RefNannyFinishContext();
- }
- /* "zmq/core/socket.pyx":187
- * self.close()
- *
- * def close(self): # <<<<<<<<<<<<<<
- * """s.close()
- *
- */
- static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_2close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
- static char __pyx_doc_3zmq_4core_6socket_6Socket_2close[] = "s.close()\n\n 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_4core_6socket_6Socket_2close(PyObject *__pyx_v_self, CYTHON_UNUSED 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");
- /* "zmq/core/socket.pyx":197
- * """
- * cdef int rc
- * if self.handle != NULL and not self.closed: # <<<<<<<<<<<<<<
- * with nogil:
- * rc = zmq_close(self.handle)
- */
- __pyx_t_1 = (((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->handle != NULL);
- if (__pyx_t_1) {
- __pyx_t_2 = __Pyx_PyObject_IsTrue(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->closed); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __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) {
- /* "zmq/core/socket.pyx":198
- * cdef int rc
- * if self.handle != NULL and not self.closed:
- * with nogil: # <<<<<<<<<<<<<<
- * rc = zmq_close(self.handle)
- * if rc != 0:
- */
- {
- #ifdef WITH_THREAD
- PyThreadState *_save;
- #endif
- Py_UNBLOCK_THREADS
- /*try:*/ {
- /* "zmq/core/socket.pyx":199
- * if self.handle != NULL and not self.closed:
- * with nogil:
- * rc = zmq_close(self.handle) # <<<<<<<<<<<<<<
- * if rc != 0:
- * raise ZMQError()
- */
- __pyx_v_rc = zmq_close(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->handle);
- }
- /* "zmq/core/socket.pyx":198
- * cdef int rc
- * if self.handle != NULL and not self.closed:
- * with nogil: # <<<<<<<<<<<<<<
- * rc = zmq_close(self.handle)
- * if rc != 0:
- */
- /*finally:*/ {
- Py_BLOCK_THREADS
- }
- }
- /* "zmq/core/socket.pyx":200
- * with nogil:
- * rc = zmq_close(self.handle)
- * if rc != 0: # <<<<<<<<<<<<<<
- * raise ZMQError()
- * self.handle = NULL
- */
- __pyx_t_2 = (__pyx_v_rc != 0);
- if (__pyx_t_2) {
- /* "zmq/core/socket.pyx":201
- * 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 = 201; __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 = 201; __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 = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L9;
- }
- __pyx_L9:;
- /* "zmq/core/socket.pyx":202
- * if rc != 0:
- * raise ZMQError()
- * self.handle = NULL # <<<<<<<<<<<<<<
- * self.closed = True
- *
- */
- ((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->handle = NULL;
- /* "zmq/core/socket.pyx":203
- * raise ZMQError()
- * self.handle = NULL
- * self.closed = True # <<<<<<<<<<<<<<
- *
- * def setsockopt(self, int option, optval):
- */
- __pyx_t_5 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_GIVEREF(__pyx_t_5);
- __Pyx_GOTREF(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->closed);
- __Pyx_DECREF(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->closed);
- ((struct __pyx_obj_3zmq_4core_6socket_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.core.socket.Socket.close");
- __pyx_r = NULL;
- __pyx_L0:;
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
- }
- /* "zmq/core/socket.pyx":205
- * self.closed = True
- *
- * def setsockopt(self, int option, optval): # <<<<<<<<<<<<<<
- * """s.setsockopt(option, optval)
- *
- */
- static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_3setsockopt(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
- static char __pyx_doc_3zmq_4core_6socket_6Socket_3setsockopt[] = "s.setsockopt(option, optval)\n\n 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_4core_6socket_6Socket_3setsockopt(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_int64_c;
- int __pyx_v_optval_int_c;
- int __pyx_v_rc;
- char *__pyx_v_optval_c;
- Py_ssize_t __pyx_v_sz;
- 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;
- char *__pyx_t_6;
- Py_ssize_t __pyx_t_7;
- pyzmq_int64_t __pyx_t_8;
- int __pyx_t_9;
- 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 = 205; __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 = 205; __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 = 205; __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 = 205; __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 = 205; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- __pyx_L3_error:;
- __Pyx_AddTraceback("zmq.core.socket.Socket.setsockopt");
- __Pyx_RefNannyFinishContext();
- return NULL;
- __pyx_L4_argument_unpacking_done:;
- /* "zmq/core/socket.pyx":227
- * cdef Py_ssize_t sz
- *
- * _check_closed(self) # <<<<<<<<<<<<<<
- * if isinstance(optval, unicode):
- * raise TypeError("unicode not allowed, use setsockopt_unicode")
- */
- __pyx_t_1 = __pyx_v_self;
- __Pyx_INCREF(__pyx_t_1);
- __pyx_t_2 = __pyx_f_3zmq_4core_6socket__check_closed(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __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;
- /* "zmq/core/socket.pyx":228
- *
- * _check_closed(self)
- * if isinstance(optval, unicode): # <<<<<<<<<<<<<<
- * raise TypeError("unicode not allowed, use setsockopt_unicode")
- *
- */
- __pyx_t_2 = __pyx_v_optval;
- __Pyx_INCREF(__pyx_t_2);
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__unicode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = PyObject_IsInstance(__pyx_t_2, __pyx_t_1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (__pyx_t_3) {
- /* "zmq/core/socket.pyx":229
- * _check_closed(self)
- * if isinstance(optval, unicode):
- * raise TypeError("unicode not allowed, use setsockopt_unicode") # <<<<<<<<<<<<<<
- *
- * if option in constants.bytes_sockopts:
- */
- __pyx_t_1 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_Raise(__pyx_t_1, 0, 0);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L6;
- }
- __pyx_L6:;
- /* "zmq/core/socket.pyx":231
- * raise TypeError("unicode not allowed, use setsockopt_unicode")
- *
- * if option in constants.bytes_sockopts: # <<<<<<<<<<<<<<
- * if not isinstance(optval, bytes):
- * raise TypeError('expected str, got: %r' % optval)
- */
- __pyx_t_1 = PyInt_FromLong(__pyx_v_option); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__constants); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__bytes_sockopts); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_3 = ((PySequence_Contains(__pyx_t_4, __pyx_t_1))); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (__pyx_t_3) {
- /* "zmq/core/socket.pyx":232
- *
- * if option in constants.bytes_sockopts:
- * if not isinstance(optval, bytes): # <<<<<<<<<<<<<<
- * raise TypeError('expected str, got: %r' % optval)
- * optval_c = PyBytes_AsString(optval)
- */
- __pyx_t_4 = __pyx_v_optval;
- __Pyx_INCREF(__pyx_t_4);
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__bytes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = PyObject_IsInstance(__pyx_t_4, __pyx_t_1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_5 = (!__pyx_t_3);
- if (__pyx_t_5) {
- /* "zmq/core/socket.pyx":233
- * if option in constants.bytes_sockopts:
- * if not isinstance(optval, bytes):
- * raise TypeError('expected str, got: %r' % optval) # <<<<<<<<<<<<<<
- * optval_c = PyBytes_AsString(optval)
- * sz = PyBytes_Size(optval)
- */
- __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_4), __pyx_v_optval); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_1));
- __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_4));
- PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_1));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
- __pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(((PyObject *)__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 = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L8;
- }
- __pyx_L8:;
- /* "zmq/core/socket.pyx":234
- * if not isinstance(optval, bytes):
- * raise TypeError('expected str, got: %r' % optval)
- * optval_c = PyBytes_AsString(optval) # <<<<<<<<<<<<<<
- * sz = PyBytes_Size(optval)
- * with nogil:
- */
- __pyx_t_1 = __pyx_v_optval;
- __Pyx_INCREF(__pyx_t_1);
- __pyx_t_6 = PyBytes_AsString(__pyx_t_1); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_v_optval_c = __pyx_t_6;
- /* "zmq/core/socket.pyx":235
- * raise TypeError('expected str, got: %r' % optval)
- * optval_c = PyBytes_AsString(optval)
- * sz = PyBytes_Size(optval) # <<<<<<<<<<<<<<
- * with nogil:
- * rc = zmq_setsockopt(
- */
- __pyx_t_1 = __pyx_v_optval;
- __Pyx_INCREF(__pyx_t_1);
- __pyx_t_7 = PyBytes_Size(__pyx_t_1); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_v_sz = __pyx_t_7;
- /* "zmq/core/socket.pyx":236
- * optval_c = PyBytes_AsString(optval)
- * sz = PyBytes_Size(optval)
- * with nogil: # <<<<<<<<<<<<<<
- * rc = zmq_setsockopt(
- * self.handle, option,
- */
- {
- #ifdef WITH_THREAD
- PyThreadState *_save;
- #endif
- Py_UNBLOCK_THREADS
- /*try:*/ {
- /* "zmq/core/socket.pyx":240
- * self.handle, option,
- * optval_c, sz
- * ) # <<<<<<<<<<<<<<
- * elif option in constants.int64_sockopts:
- * if not isinstance(optval, int):
- */
- __pyx_v_rc = zmq_setsockopt(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->handle, __pyx_v_option, __pyx_v_optval_c, __pyx_v_sz);
- }
- /* "zmq/core/socket.pyx":236
- * optval_c = PyBytes_AsString(optval)
- * sz = PyBytes_Size(optval)
- * with nogil: # <<<<<<<<<<<<<<
- * rc = zmq_setsockopt(
- * self.handle, option,
- */
- /*finally:*/ {
- Py_BLOCK_THREADS
- }
- }
- goto __pyx_L7;
- }
- /* "zmq/core/socket.pyx":241
- * optval_c, sz
- * )
- * elif option in constants.int64_sockopts: # <<<<<<<<<<<<<<
- * if not isinstance(optval, int):
- * raise TypeError('expected int, got: %r' % optval)
- */
- __pyx_t_1 = PyInt_FromLong(__pyx_v_option); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__constants); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int64_sockopts); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_5 = ((PySequence_Contains(__pyx_t_2, __pyx_t_1))); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (__pyx_t_5) {
- /* "zmq/core/socket.pyx":242
- * )
- * elif option in constants.int64_sockopts:
- * if not isinstance(optval, int): # <<<<<<<<<<<<<<
- * raise TypeError('expected int, got: %r' % optval)
- * optval_int64_c = optval
- */
- __pyx_t_2 = __pyx_v_optval;
- __Pyx_INCREF(__pyx_t_2);
- __pyx_t_1 = ((PyObject *)((PyObject*)(&PyInt_Type)));
- __Pyx_INCREF(__pyx_t_1);
- __pyx_t_5 = __Pyx_TypeCheck(__pyx_t_2, __pyx_t_1);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_3 = (!__pyx_t_5);
- if (__pyx_t_3) {
- /* "zmq/core/socket.pyx":243
- * elif option in constants.int64_sockopts:
- * if not isinstance(optval, int):
- * raise TypeError('expected int, got: %r' % optval) # <<<<<<<<<<<<<<
- * optval_int64_c = optval
- * with nogil:
- */
- __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), __pyx_v_optval); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_1));
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_2));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
- __pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_2), NULL); 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(((PyObject *)__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 = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L12;
- }
- __pyx_L12:;
- /* "zmq/core/socket.pyx":244
- * if not isinstance(optval, int):
- * raise TypeError('expected int, got: %r' % optval)
- * optval_int64_c = optval # <<<<<<<<<<<<<<
- * with nogil:
- * rc = zmq_setsockopt(
- */
- __pyx_t_8 = __Pyx_PyInt_from_py_pyzmq_int64_t(__pyx_v_optval); if (unlikely((__pyx_t_8 == (pyzmq_int64_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_v_optval_int64_c = __pyx_t_8;
- /* "zmq/core/socket.pyx":245
- * raise TypeError('expected int, got: %r' % optval)
- * optval_int64_c = optval
- * with nogil: # <<<<<<<<<<<<<<
- * rc = zmq_setsockopt(
- * self.handle, option,
- */
- {
- #ifdef WITH_THREAD
- PyThreadState *_save;
- #endif
- Py_UNBLOCK_THREADS
- /*try:*/ {
- /* "zmq/core/socket.pyx":248
- * rc = zmq_setsockopt(
- * self.handle, option,
- * &optval_int64_c, sizeof(int64_t) # <<<<<<<<<<<<<<
- * )
- * elif option in constants.int_sockopts:
- */
- __pyx_v_rc = zmq_setsockopt(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->handle, __pyx_v_option, (&__pyx_v_optval_int64_c), (sizeof(pyzmq_int64_t)));
- }
- /* "zmq/core/socket.pyx":245
- * raise TypeError('expected int, got: %r' % optval)
- * optval_int64_c = optval
- * with nogil: # <<<<<<<<<<<<<<
- * rc = zmq_setsockopt(
- * self.handle, option,
- */
- /*finally:*/ {
- Py_BLOCK_THREADS
- }
- }
- goto __pyx_L7;
- }
- /* "zmq/core/socket.pyx":250
- * &optval_int64_c, sizeof(int64_t)
- * )
- * elif option in constants.int_sockopts: # <<<<<<<<<<<<<<
- * if not isinstance(optval, int):
- * raise TypeError('expected int, got: %r' % optval)
- */
- __pyx_t_1 = PyInt_FromLong(__pyx_v_option); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__constants); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__int_sockopts); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_3 = ((PySequence_Contains(__pyx_t_4, __pyx_t_1))); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (__pyx_t_3) {
- /* "zmq/core/socket.pyx":251
- * )
- * elif option in constants.int_sockopts:
- * if not isinstance(optval, int): # <<<<<<<<<<<<<<
- * raise TypeError('expected int, got: %r' % optval)
- * optval_int_c = optval
- */
- __pyx_t_4 = __pyx_v_optval;
- __Pyx_INCREF(__pyx_t_4);
- __pyx_t_1 = ((PyObject *)((PyObject*)(&PyInt_Type)));
- __Pyx_INCREF(__pyx_t_1);
- __pyx_t_3 = __Pyx_TypeCheck(__pyx_t_4, __pyx_t_1);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_5 = (!__pyx_t_3);
- if (__pyx_t_5) {
- /* "zmq/core/socket.pyx":252
- * elif option in constants.int_sockopts:
- * if not isinstance(optval, int):
- * raise TypeError('expected int, got: %r' % optval) # <<<<<<<<<<<<<<
- * optval_int_c = optval
- * with nogil:
- */
- __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), __pyx_v_optval); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_1));
- __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_4));
- PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_1));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
- __pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(((PyObject *)__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 = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L16;
- }
- __pyx_L16:;
- /* "zmq/core/socket.pyx":253
- * if not isinstance(optval, int):
- * raise TypeError('expected int, got: %r' % optval)
- * optval_int_c = optval # <<<<<<<<<<<<<<
- * with nogil:
- * rc = zmq_setsockopt(
- */
- __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_v_optval); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_v_optval_int_c = __pyx_t_9;
- /* "zmq/core/socket.pyx":254
- * raise TypeError('expected int, got: %r' % optval)
- * optval_int_c = optval
- * with nogil: # <<<<<<<<<<<<<<
- * rc = zmq_setsockopt(
- * self.handle, option,
- */
- {
- #ifdef WITH_THREAD
- PyThreadState *_save;
- #endif
- Py_UNBLOCK_THREADS
- /*try:*/ {
- /* "zmq/core/socket.pyx":257
- * rc = zmq_setsockopt(
- * self.handle, option,
- * &optval_int_c, sizeof(int) # <<<<<<<<<<<<<<
- * )
- * else:
- */
- __pyx_v_rc = zmq_setsockopt(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->handle, __pyx_v_option, (&__pyx_v_optval_int_c), (sizeof(int)));
- }
- /* "zmq/core/socket.pyx":254
- * raise TypeError('expected int, got: %r' % optval)
- * optval_int_c = optval
- * with nogil: # <<<<<<<<<<<<<<
- * rc = zmq_setsockopt(
- * self.handle, option,
- */
- /*finally:*/ {
- Py_BLOCK_THREADS
- }
- }
- goto __pyx_L7;
- }
- /*else*/ {
- /* "zmq/core/socket.pyx":260
- * )
- * else:
- * raise ZMQError(EINVAL) # <<<<<<<<<<<<<<
- *
- * if rc != 0:
- */
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__EINVAL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __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 = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__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, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(((PyObject *)__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 = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
- __pyx_L7:;
- /* "zmq/core/socket.pyx":262
- * raise ZMQError(EINVAL)
- *
- * if rc != 0: # <<<<<<<<<<<<<<
- * raise ZMQError()
- *
- */
- __pyx_t_5 = (__pyx_v_rc != 0);
- if (__pyx_t_5) {
- /* "zmq/core/socket.pyx":263
- *
- * if rc != 0:
- * raise ZMQError() # <<<<<<<<<<<<<<
- *
- * def getsockopt(self, int option):
- */
- __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __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 = 263; __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 = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L20;
- }
- __pyx_L20:;
- __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.core.socket.Socket.setsockopt");
- __pyx_r = NULL;
- __pyx_L0:;
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
- }
- /* "zmq/core/socket.pyx":265
- * raise ZMQError()
- *
- * def getsockopt(self, int option): # <<<<<<<<<<<<<<
- * """s.getsockopt(option)
- *
- */
- static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_4getsockopt(PyObject *__pyx_v_self, PyObject *__pyx_arg_option); /*proto*/
- static char __pyx_doc_3zmq_4core_6socket_6Socket_4getsockopt[] = "s.getsockopt(option)\n\n Get the value of a socket option.\n\n See the 0MQ documentation for details on specific options.\n\n Parameters\n ----------\n option : 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 optval : int, str\n The value of the option as a string or int.\n ";
- static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_4getsockopt(PyObject *__pyx_v_self, PyObject *__pyx_arg_option) {
- int __pyx_v_option;
- pyzmq_int64_t __pyx_v_optval_int64_c;
- int __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;
- PyObject *__pyx_t_3 = NULL;
- int __pyx_t_4;
- __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 = 265; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- }
- goto __pyx_L4_argument_unpacking_done;
- __pyx_L3_error:;
- __Pyx_AddTraceback("zmq.core.socket.Socket.getsockopt");
- __Pyx_RefNannyFinishContext();
- return NULL;
- __pyx_L4_argument_unpacking_done:;
- __pyx_v_result = Py_None; __Pyx_INCREF(Py_None);
- /* "zmq/core/socket.pyx":290
- * cdef int rc
- *
- * _check_closed(self) # <<<<<<<<<<<<<<
- *
- * if option in constants.bytes_sockopts:
- */
- __pyx_t_1 = __pyx_v_self;
- __Pyx_INCREF(__pyx_t_1);
- __pyx_t_2 = __pyx_f_3zmq_4core_6socket__check_closed(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __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;
- /* "zmq/core/socket.pyx":292
- * _check_closed(self)
- *
- * if option in constants.bytes_sockopts: # <<<<<<<<<<<<<<
- * sz = 255
- * with nogil:
- */
- __pyx_t_2 = PyInt_FromLong(__pyx_v_option); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__constants); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__bytes_sockopts); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_4 = ((PySequence_Contains(__pyx_t_3, __pyx_t_2))); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (__pyx_t_4) {
- /* "zmq/core/socket.pyx":293
- *
- * if option in constants.bytes_sockopts:
- * sz = 255 # <<<<<<<<<<<<<<
- * with nogil:
- * rc = zmq_getsockopt(self.handle, option, <void *>identity_str_c, &sz)
- */
- __pyx_v_sz = 255;
- /* "zmq/core/socket.pyx":294
- * if option in constants.bytes_sockopts:
- * sz = 255
- * with nogil: # <<<<<<<<<<<<<<
- * rc = zmq_getsockopt(self.handle, option, <void *>identity_str_c, &sz)
- * if rc != 0:
- */
- {
- #ifdef WITH_THREAD
- PyThreadState *_save;
- #endif
- Py_UNBLOCK_THREADS
- /*try:*/ {
- /* "zmq/core/socket.pyx":295
- * sz = 255
- * with nogil:
- * 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_4core_6socket_Socket *)__pyx_v_self)->handle, __pyx_v_option, ((void *)__pyx_v_identity_str_c), (&__pyx_v_sz));
- }
- /* "zmq/core/socket.pyx":294
- * if option in constants.bytes_sockopts:
- * sz = 255
- * with nogil: # <<<<<<<<<<<<<<
- * rc = zmq_getsockopt(self.handle, option, <void *>identity_str_c, &sz)
- * if rc != 0:
- */
- /*finally:*/ {
- Py_BLOCK_THREADS
- }
- }
- /* "zmq/core/socket.pyx":296
- * with nogil:
- * rc = zmq_getsockopt(self.handle, option, <void *>identity_str_c, &sz)
- * if rc != 0: # <<<<<<<<<<<<<<
- * raise ZMQError()
- * result = PyBytes_FromStringAndSize(<char *>identity_str_c, sz)
- */
- __pyx_t_4 = (__pyx_v_rc != 0);
- if (__pyx_t_4) {
- /* "zmq/core/socket.pyx":297
- * rc = zmq_getsockopt(self.handle, option, <void *>identity_str_c, &sz)
- * if rc != 0:
- * raise ZMQError() # <<<<<<<<<<<<<<
- * result = PyBytes_FromStringAndSize(<char *>identity_str_c, sz)
- * elif option in constants.int64_sockopts:
- */
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __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 = 297; __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 = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L9;
- }
- __pyx_L9:;
- /* "zmq/core/socket.pyx":298
- * if rc != 0:
- * raise ZMQError()
- * result = PyBytes_FromStringAndSize(<char *>identity_str_c, sz) # <<<<<<<<<<<<<<
- * elif option in constants.int64_sockopts:
- * sz = sizeof(int64_t)
- */
- __pyx_t_2 = ((PyObject *)PyBytes_FromStringAndSize(((char *)__pyx_v_identity_str_c), __pyx_v_sz)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_v_result);
- __pyx_v_result = __pyx_t_2;
- __pyx_t_2 = 0;
- goto __pyx_L5;
- }
- /* "zmq/core/socket.pyx":299
- * raise ZMQError()
- * result = PyBytes_FromStringAndSize(<char *>identity_str_c, sz)
- * elif option in constants.int64_sockopts: # <<<<<<<<<<<<<<
- * sz = sizeof(int64_t)
- * with nogil:
- */
- __pyx_t_2 = PyInt_FromLong(__pyx_v_option); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__constants); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__int64_sockopts); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_4 = ((PySequence_Contains(__pyx_t_1, __pyx_t_2))); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (__pyx_t_4) {
- /* "zmq/core/socket.pyx":300
- * result = PyBytes_FromStringAndSize(<char *>identity_str_c, sz)
- * elif option in constants.int64_sockopts:
- * sz = sizeof(int64_t) # <<<<<<<<<<<<<<
- * with nogil:
- * rc = zmq_getsockopt(self.handle, option, <void *>&optval_int64_c, &sz)
- */
- __pyx_v_sz = (sizeof(pyzmq_int64_t));
- /* "zmq/core/socket.pyx":301
- * elif option in constants.int64_sockopts:
- * sz = sizeof(int64_t)
- * with nogil: # <<<<<<<<<<<<<<
- * rc = zmq_getsockopt(self.handle, option, <void *>&optval_int64_c, &sz)
- * if rc != 0:
- */
- {
- #ifdef WITH_THREAD
- PyThreadState *_save;
- #endif
- Py_UNBLOCK_THREADS
- /*try:*/ {
- /* "zmq/core/socket.pyx":302
- * sz = sizeof(int64_t)
- * with nogil:
- * rc = zmq_getsockopt(self.handle, option, <void *>&optval_int64_c, &sz) # <<<<<<<<<<<<<<
- * if rc != 0:
- * raise ZMQError()
- */
- __pyx_v_rc = zmq_getsockopt(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->handle, __pyx_v_option, ((void *)(&__pyx_v_optval_int64_c)), (&__pyx_v_sz));
- }
- /* "zmq/core/socket.pyx":301
- * elif option in constants.int64_sockopts:
- * sz = sizeof(int64_t)
- * with nogil: # <<<<<<<<<<<<<<
- * rc = zmq_getsockopt(self.handle, option, <void *>&optval_int64_c, &sz)
- * if rc != 0:
- */
- /*finally:*/ {
- Py_BLOCK_THREADS
- }
- }
- /* "zmq/core/socket.pyx":303
- * with nogil:
- * rc = zmq_getsockopt(self.handle, option, <void *>&optval_int64_c, &sz)
- * if rc != 0: # <<<<<<<<<<<<<<
- * raise ZMQError()
- * result = optval_int64_c
- */
- __pyx_t_4 = (__pyx_v_rc != 0);
- if (__pyx_t_4) {
- /* "zmq/core/socket.pyx":304
- * rc = zmq_getsockopt(self.handle, option, <void *>&optval_int64_c, &sz)
- * if rc != 0:
- * raise ZMQError() # <<<<<<<<<<<<<<
- * result = optval_int64_c
- * elif option in constants.int_sockopts:
- */
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __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 = 304; __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 = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L13;
- }
- __pyx_L13:;
- /* "zmq/core/socket.pyx":305
- * if rc != 0:
- * raise ZMQError()
- * result = optval_int64_c # <<<<<<<<<<<<<<
- * elif option in constants.int_sockopts:
- * sz = sizeof(int)
- */
- __pyx_t_2 = __Pyx_PyInt_to_py_pyzmq_int64_t(__pyx_v_optval_int64_c); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_v_result);
- __pyx_v_result = __pyx_t_2;
- __pyx_t_2 = 0;
- goto __pyx_L5;
- }
- /* "zmq/core/socket.pyx":306
- * raise ZMQError()
- * result = optval_int64_c
- * elif option in constants.int_sockopts: # <<<<<<<<<<<<<<
- * sz = sizeof(int)
- * with nogil:
- */
- __pyx_t_2 = PyInt_FromLong(__pyx_v_option); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__constants); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__int_sockopts); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_4 = ((PySequence_Contains(__pyx_t_3, __pyx_t_2))); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (__pyx_t_4) {
- /* "zmq/core/socket.pyx":307
- * result = optval_int64_c
- * elif option in constants.int_sockopts:
- * sz = sizeof(int) # <<<<<<<<<<<<<<
- * with nogil:
- * rc = zmq_getsockopt(self.handle, option, <void *>&optval_int_c, &sz)
- */
- __pyx_v_sz = (sizeof(int));
- /* "zmq/core/socket.pyx":308
- * elif option in constants.int_sockopts:
- * sz = sizeof(int)
- * with nogil: # <<<<<<<<<<<<<<
- * rc = zmq_getsockopt(self.handle, option, <void *>&optval_int_c, &sz)
- * if rc != 0:
- */
- {
- #ifdef WITH_THREAD
- PyThreadState *_save;
- #endif
- Py_UNBLOCK_THREADS
- /*try:*/ {
- /* "zmq/core/socket.pyx":309
- * sz = sizeof(int)
- * with nogil:
- * 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_4core_6socket_Socket *)__pyx_v_self)->handle, __pyx_v_option, ((void *)(&__pyx_v_optval_int_c)), (&__pyx_v_sz));
- }
- /* "zmq/core/socket.pyx":308
- * elif option in constants.int_sockopts:
- * sz = sizeof(int)
- * with nogil: # <<<<<<<<<<<<<<
- * rc = zmq_getsockopt(self.handle, option, <void *>&optval_int_c, &sz)
- * if rc != 0:
- */
- /*finally:*/ {
- Py_BLOCK_THREADS
- }
- }
- /* "zmq/core/socket.pyx":310
- * with nogil:
- * rc = zmq_getsockopt(self.handle, option, <void *>&optval_int_c, &sz)
- * if rc != 0: # <<<<<<<<<<<<<<
- * raise ZMQError()
- * result = optval_int_c
- */
- __pyx_t_4 = (__pyx_v_rc != 0);
- if (__pyx_t_4) {
- /* "zmq/core/socket.pyx":311
- * rc = zmq_getsockopt(self.handle, option, <void *>&optval_int_c, &sz)
- * if rc != 0:
- * raise ZMQError() # <<<<<<<<<<<<<<
- * result = optval_int_c
- * else:
- */
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __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 = 311; __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 = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L17;
- }
- __pyx_L17:;
- /* "zmq/core/socket.pyx":312
- * if rc != 0:
- * raise ZMQError()
- * result = optval_int_c # <<<<<<<<<<<<<<
- * else:
- * raise ZMQError(EINVAL)
- */
- __pyx_t_2 = PyInt_FromLong(__pyx_v_optval_int_c); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_v_result);
- __pyx_v_result = __pyx_t_2;
- __pyx_t_2 = 0;
- goto __pyx_L5;
- }
- /*else*/ {
- /* "zmq/core/socket.pyx":314
- * result = optval_int_c
- * else:
- * raise ZMQError(EINVAL) # <<<<<<<<<<<<<<
- *
- * return result
- */
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __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 = 314; __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 = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_1));
- PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(((PyObject *)__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 = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
- __pyx_L5:;
- /* "zmq/core/socket.pyx":316
- * raise ZMQError(EINVAL)
- *
- * return result # <<<<<<<<<<<<<<
- *
- * def setsockopt_unicode(self, int option, optval, encoding='utf-8'):
- */
- __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_3);
- __Pyx_AddTraceback("zmq.core.socket.Socket.getsockopt");
- __pyx_r = NULL;
- __pyx_L0:;
- __Pyx_DECREF(__pyx_v_result);
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
- }
- /* "zmq/core/socket.pyx":318
- * return result
- *
- * def setsockopt_unicode(self, int option, optval, encoding='utf-8'): # <<<<<<<<<<<<<<
- * """s.setsockopt_unicode(option, optval, encoding='utf-8')
- *
- */
- static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_5setsockopt_unicode(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
- static char __pyx_doc_3zmq_4core_6socket_6Socket_5setsockopt_unicode[] = "s.setsockopt_unicode(option, optval, encoding='utf-8')\n\n Set socket options with a unicode object it is simply a wrapper\n for setsockopt to protect from encoding ambiguity.\n\n See the 0MQ documentation for details on specific options.\n\n Parameters\n ----------\n option : int\n The name of the option to set. Can be any of: SUBSCRIBE, \n UNSUBSCRIBE, IDENTITY\n optval : unicode\n The value of the option to set.\n encoding : str\n The encoding to be used, default is utf8\n ";
- static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_5setsockopt_unicode(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
- int __pyx_v_option;
- PyObject *__pyx_v_optval = 0;
- PyObject *__pyx_v_encoding = 0;
- PyObject *__pyx_r = NULL;
- PyObject *__pyx_t_1 = NULL;
- PyObject *__pyx_t_2 = NULL;
- int __pyx_t_3;
- int __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__option,&__pyx_n_s__optval,&__pyx_n_s__encoding,0};
- __Pyx_RefNannySetupContext("setsockopt_unicode");
- if (unlikely(__pyx_kwds)) {
- Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
- PyObject* values[3] = {0,0,0};
- values[2] = ((PyObject *)__pyx_kp_s_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__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_unicode", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- }
- case 2:
- if (kw_args > 0) {
- PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__encoding);
- if (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), "setsockopt_unicode") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __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 = 318; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- __pyx_v_optval = values[1];
- __pyx_v_encoding = values[2];
- } else {
- __pyx_v_encoding = ((PyObject *)__pyx_kp_s_6);
- switch (PyTuple_GET_SIZE(__pyx_args)) {
- case 3:
- __pyx_v_encoding = PyTuple_GET_ITEM(__pyx_args, 2);
- case 2:
- __pyx_v_optval = PyTuple_GET_ITEM(__pyx_args, 1);
- __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 = 318; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- break;
- default: goto __pyx_L5_argtuple_error;
- }
- }
- goto __pyx_L4_argument_unpacking_done;
- __pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("setsockopt_unicode", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- __pyx_L3_error:;
- __Pyx_AddTraceback("zmq.core.socket.Socket.setsockopt_unicode");
- __Pyx_RefNannyFinishContext();
- return NULL;
- __pyx_L4_argument_unpacking_done:;
- /* "zmq/core/socket.pyx":336
- * The encoding to be used, default is utf8
- * """
- * if not isinstance(optval, unicode): # <<<<<<<<<<<<<<
- * raise TypeError("unicode strings only")
- * return self.setsockopt(option, optval.encode(encoding))
- */
- __pyx_t_1 = __pyx_v_optval;
- __Pyx_INCREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__unicode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_IsInstance(__pyx_t_1, __pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_4 = (!__pyx_t_3);
- if (__pyx_t_4) {
- /* "zmq/core/socket.pyx":337
- * """
- * if not isinstance(optval, unicode):
- * raise TypeError("unicode strings only") # <<<<<<<<<<<<<<
- * return self.setsockopt(option, optval.encode(encoding))
- *
- */
- __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_Raise(__pyx_t_2, 0, 0);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L6;
- }
- __pyx_L6:;
- /* "zmq/core/socket.pyx":338
- * if not isinstance(optval, unicode):
- * raise TypeError("unicode strings only")
- * return self.setsockopt(option, optval.encode(encoding)) # <<<<<<<<<<<<<<
- *
- * def getsockopt_unicode(self, int option, encoding='utf-8'):
- */
- __Pyx_XDECREF(__pyx_r);
- __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__setsockopt); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyInt_FromLong(__pyx_v_option); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_5 = PyObject_GetAttr(__pyx_v_optval, __pyx_n_s__encode); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_6));
- __Pyx_INCREF(__pyx_v_encoding);
- PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_encoding);
- __Pyx_GIVEREF(__pyx_v_encoding);
- __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
- __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_6));
- PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
- __Pyx_GIVEREF(__pyx_t_1);
- PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_7);
- __Pyx_GIVEREF(__pyx_t_7);
- __pyx_t_1 = 0;
- __pyx_t_7 = 0;
- __pyx_t_7 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_7);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
- __pyx_r = __pyx_t_7;
- __pyx_t_7 = 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_5);
- __Pyx_XDECREF(__pyx_t_6);
- __Pyx_XDECREF(__pyx_t_7);
- __Pyx_AddTraceback("zmq.core.socket.Socket.setsockopt_unicode");
- __pyx_r = NULL;
- __pyx_L0:;
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
- }
- /* "zmq/core/socket.pyx":340
- * return self.setsockopt(option, optval.encode(encoding))
- *
- * def getsockopt_unicode(self, int option, encoding='utf-8'): # <<<<<<<<<<<<<<
- * """s.getsockopt_unicode(option, encoding='utf-8')
- *
- */
- static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_6getsockopt_unicode(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
- static char __pyx_doc_3zmq_4core_6socket_6Socket_6getsockopt_unicode[] = "s.getsockopt_unicode(option, encoding='utf-8')\n\n Get the value of a socket option.\n\n See the 0MQ documentation for details on specific options.\n\n Parameters\n ----------\n option : unicode string\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 optval : unicode\n The value of the option as a unicode string.\n ";
- static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_6getsockopt_unicode(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
- int __pyx_v_option;
- PyObject *__pyx_v_encoding = 0;
- PyObject *__pyx_r = NULL;
- int __pyx_t_1;
- PyObject *__pyx_t_2 = NULL;
- PyObject *__pyx_t_3 = NULL;
- PyObject *__pyx_t_4 = NULL;
- int __pyx_t_5;
- int __pyx_t_6;
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__option,&__pyx_n_s__encoding,0};
- __Pyx_RefNannySetupContext("getsockopt_unicode");
- if (unlikely(__pyx_kwds)) {
- Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
- PyObject* values[2] = {0,0};
- values[1] = ((PyObject *)__pyx_kp_s_6);
- 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:
- if (kw_args > 0) {
- PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__encoding);
- if (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), "getsockopt_unicode") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __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 = 340; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- __pyx_v_encoding = values[1];
- } else {
- __pyx_v_encoding = ((PyObject *)__pyx_kp_s_6);
- switch (PyTuple_GET_SIZE(__pyx_args)) {
- case 2: __pyx_v_encoding = PyTuple_GET_ITEM(__pyx_args, 1);
- case 1: __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 = 340; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- break;
- default: goto __pyx_L5_argtuple_error;
- }
- }
- goto __pyx_L4_argument_unpacking_done;
- __pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("getsockopt_unicode", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- __pyx_L3_error:;
- __Pyx_AddTraceback("zmq.core.socket.Socket.getsockopt_unicode");
- __Pyx_RefNannyFinishContext();
- return NULL;
- __pyx_L4_argument_unpacking_done:;
- /* "zmq/core/socket.pyx":359
- * The value of the option as a unicode string.
- * """
- * if option not in [IDENTITY]: # <<<<<<<<<<<<<<
- * raise TypeError("option %i will not return a string to be decoded"%option)
- * return self.getsockopt(option).decode(encoding)
- */
- __pyx_t_1 = __pyx_v_option;
- __pyx_t_2 = PyInt_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__IDENTITY); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_NE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __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;
- __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_6 = __pyx_t_5;
- if (__pyx_t_6) {
- /* "zmq/core/socket.pyx":360
- * """
- * if option not in [IDENTITY]:
- * raise TypeError("option %i will not return a string to be decoded"%option) # <<<<<<<<<<<<<<
- * return self.getsockopt(option).decode(encoding)
- *
- */
- __pyx_t_4 = PyInt_FromLong(__pyx_v_option); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_9), __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_3));
- __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 = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_4));
- PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
- __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(((PyObject *)__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 = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L6;
- }
- __pyx_L6:;
- /* "zmq/core/socket.pyx":361
- * if option not in [IDENTITY]:
- * raise TypeError("option %i will not return a string to be decoded"%option)
- * return self.getsockopt(option).decode(encoding) # <<<<<<<<<<<<<<
- *
- * def bind(self, addr):
- */
- __Pyx_XDECREF(__pyx_r);
- __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__getsockopt); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyInt_FromLong(__pyx_v_option); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __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 = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__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_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__decode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __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 = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_4));
- __Pyx_INCREF(__pyx_v_encoding);
- PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_encoding);
- __Pyx_GIVEREF(__pyx_v_encoding);
- __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(((PyObject *)__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_2);
- __Pyx_XDECREF(__pyx_t_3);
- __Pyx_XDECREF(__pyx_t_4);
- __Pyx_AddTraceback("zmq.core.socket.Socket.getsockopt_unicode");
- __pyx_r = NULL;
- __pyx_L0:;
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
- }
- /* "zmq/core/socket.pyx":363
- * return self.getsockopt(option).decode(encoding)
- *
- * def bind(self, addr): # <<<<<<<<<<<<<<
- * """s.bind(addr)
- *
- */
- static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_7bind(PyObject *__pyx_v_self, PyObject *__pyx_v_addr); /*proto*/
- static char __pyx_doc_3zmq_4core_6socket_6Socket_7bind[] = "s.bind(addr)\n\n Bind the socket to an address.\n\n This causes the socket to listen on a network port. Sockets on the\n other side of this connection will use ``Socket.connect(addr)`` to\n connect to this socket.\n\n Parameters\n ----------\n addr : str\n The address string. This has the form 'protocol://interface:port',\n for example 'tcp://127.0.0.1:5555'. Protocols supported are\n tcp, upd, pgm, inproc and ipc. If the address is unicode, it is\n encoded to utf-8 first.\n ";
- static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_7bind(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;
- void *__pyx_t_5;
- char *__pyx_t_6;
- __Pyx_RefNannySetupContext("bind");
- __Pyx_INCREF(__pyx_v_addr);
- /* "zmq/core/socket.pyx":382
- * cdef int rc
- *
- * _check_closed(self) # <<<<<<<<<<<<<<
- * if isinstance(addr, unicode):
- * addr = addr.encode('utf-8')
- */
- __pyx_t_1 = __pyx_v_self;
- __Pyx_INCREF(__pyx_t_1);
- __pyx_t_2 = __pyx_f_3zmq_4core_6socket__check_closed(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __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;
- /* "zmq/core/socket.pyx":383
- *
- * _check_closed(self)
- * if isinstance(addr, unicode): # <<<<<<<<<<<<<<
- * addr = addr.encode('utf-8')
- * if not isinstance(addr, bytes):
- */
- __pyx_t_2 = __pyx_v_addr;
- __Pyx_INCREF(__pyx_t_2);
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__unicode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = PyObject_IsInstance(__pyx_t_2, __pyx_t_1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (__pyx_t_3) {
- /* "zmq/core/socket.pyx":384
- * _check_closed(self)
- * if isinstance(addr, unicode):
- * addr = addr.encode('utf-8') # <<<<<<<<<<<<<<
- * if not isinstance(addr, bytes):
- * raise TypeError('expected str, got: %r' % addr)
- */
- __pyx_t_1 = PyObject_GetAttr(__pyx_v_addr, __pyx_n_s__encode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_v_addr);
- __pyx_v_addr = __pyx_t_2;
- __pyx_t_2 = 0;
- goto __pyx_L5;
- }
- __pyx_L5:;
- /* "zmq/core/socket.pyx":385
- * if isinstance(addr, unicode):
- * addr = addr.encode('utf-8')
- * if not isinstance(addr, bytes): # <<<<<<<<<<<<<<
- * raise TypeError('expected str, got: %r' % addr)
- * with nogil:
- */
- __pyx_t_2 = __pyx_v_addr;
- __Pyx_INCREF(__pyx_t_2);
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__bytes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = PyObject_IsInstance(__pyx_t_2, __pyx_t_1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_4 = (!__pyx_t_3);
- if (__pyx_t_4) {
- /* "zmq/core/socket.pyx":386
- * addr = addr.encode('utf-8')
- * if not isinstance(addr, bytes):
- * raise TypeError('expected str, got: %r' % addr) # <<<<<<<<<<<<<<
- * with nogil:
- * rc = zmq_bind(self.handle, addr)
- */
- __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_4), __pyx_v_addr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_1));
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_2));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
- __pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(((PyObject *)__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 = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L6;
- }
- __pyx_L6:;
- /* "zmq/core/socket.pyx":387
- * if not isinstance(addr, bytes):
- * raise TypeError('expected str, got: %r' % addr)
- * with nogil: # <<<<<<<<<<<<<<
- * rc = zmq_bind(self.handle, addr)
- * if rc != 0:
- */
- {
- #ifdef WITH_THREAD
- PyThreadState *_save;
- #endif
- Py_UNBLOCK_THREADS
- /*try:*/ {
- /* "zmq/core/socket.pyx":388
- * raise TypeError('expected str, got: %r' % addr)
- * with nogil:
- * rc = zmq_bind(self.handle, addr) # <<<<<<<<<<<<<<
- * if rc != 0:
- * raise ZMQError()
- */
- __pyx_t_5 = ((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->handle;
- __pyx_t_6 = PyBytes_AsString(__pyx_v_addr); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L8;}
- __pyx_v_rc = zmq_bind(__pyx_t_5, __pyx_t_6);
- }
- /* "zmq/core/socket.pyx":387
- * if not isinstance(addr, bytes):
- * raise TypeError('expected str, got: %r' % addr)
- * with nogil: # <<<<<<<<<<<<<<
- * rc = zmq_bind(self.handle, addr)
- * if rc != 0:
- */
- /*finally:*/ {
- int __pyx_why;
- __pyx_why = 0; goto __pyx_L9;
- __pyx_L8: __pyx_why = 4; goto __pyx_L9;
- __pyx_L9:;
- Py_BLOCK_THREADS
- switch (__pyx_why) {
- case 4: goto __pyx_L1_error;
- }
- }
- }
- /* "zmq/core/socket.pyx":389
- * with nogil:
- * rc = zmq_bind(self.handle, addr)
- * if rc != 0: # <<<<<<<<<<<<<<
- * raise ZMQError()
- *
- */
- __pyx_t_4 = (__pyx_v_rc != 0);
- if (__pyx_t_4) {
- /* "zmq/core/socket.pyx":390
- * rc = zmq_bind(self.handle, addr)
- * if rc != 0:
- * raise ZMQError() # <<<<<<<<<<<<<<
- *
- * def bind_to_random_port(self, addr, min_port=49152, max_port=65536, max_tries=100):
- */
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __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 = 390; __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 = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L11;
- }
- __pyx_L11:;
- __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.core.socket.Socket.bind");
- __pyx_r = NULL;
- __pyx_L0:;
- __Pyx_DECREF(__pyx_v_addr);
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
- }
- /* "zmq/core/socket.pyx":392
- * raise ZMQError()
- *
- * def bind_to_random_port(self, addr, min_port=49152, max_port=65536, max_tries=100): # <<<<<<<<<<<<<<
- * """s.bind_to_random_port(addr, min_port=49152, max_port=65536, max_tries=100)
- *
- */
- static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_8bind_to_random_port(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
- static char __pyx_doc_3zmq_4core_6socket_6Socket_8bind_to_random_port[] = "s.bind_to_random_port(addr, min_port=49152, max_port=65536, max_tries=100)\n\n Bind this socket to a random port in a range.\n\n Parameters\n ----------\n addr : str\n The address string without the port to pass to ``Socket.bind()``.\n min_port : int, optional\n The minimum port in the range of ports to try (inclusive).\n max_port : int, optional\n The maximum port in the range of ports to try (exclusive).\n max_tries : int, optional\n The maximum number of bind attempts to make.\n\n Returns\n -------\n port : int\n The port the socket was bound to.\n \n Raises\n ------\n ZMQBindError\n if `max_tries` reached before successful bind\n ";
- static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_8bind_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_49152);
- values[2] = ((PyObject *)__pyx_int_65536);
- 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 > 0) {
- PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__min_port);
- if (value) { values[1] = value; kw_args--; }
- }
- case 2:
- if (kw_args > 0) {
- PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_port);
- if (value) { values[2] = value; kw_args--; }
- }
- case 3:
- if (kw_args > 0) {
- PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_tries);
- if (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 = 392; __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_49152);
- __pyx_v_max_port = ((PyObject *)__pyx_int_65536);
- __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 = 392; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- __pyx_L3_error:;
- __Pyx_AddTraceback("zmq.core.socket.Socket.bind_to_random_port");
- __Pyx_RefNannyFinishContext();
- return NULL;
- __pyx_L4_argument_unpacking_done:;
- __pyx_v_i = Py_None; __Pyx_INCREF(Py_None);
- __pyx_v_port = Py_None; __Pyx_INCREF(Py_None);
- /* "zmq/core/socket.pyx":418
- * if `max_tries` reached before successful bind
- * """
- * for i in xrange(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 = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__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_xrange, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(((PyObject *)__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 = 418; __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 = 418; __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;
- /* "zmq/core/socket.pyx":419
- * """
- * for i in xrange(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:*/ {
- /* "zmq/core/socket.pyx":420
- * for i in xrange(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 = 420; __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 = 420; __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 = 420; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
- __Pyx_GOTREF(((PyObject *)__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, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_v_port);
- __pyx_v_port = __pyx_t_5;
- __pyx_t_5 = 0;
- /* "zmq/core/socket.pyx":421
- * 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 = 421; __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 = 421; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
- __Pyx_GOTREF(((PyObject *)__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_11), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_4));
- __Pyx_DECREF(((PyObject *)__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 = 421; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_3));
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
- __pyx_t_4 = 0;
- __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- }
- /*else:*/ {
- /* "zmq/core/socket.pyx":425
- * 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;
- /* "zmq/core/socket.pyx":422
- * 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 = 422; __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;
- /* "zmq/core/socket.pyx":426
- * 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 = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_13), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __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 = 426; __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.core.socket.Socket.bind_to_random_port");
- __pyx_r = NULL;
- __pyx_L0:;
- __Pyx_DECREF(__pyx_v_i);
- __Pyx_DECREF(__pyx_v_port);
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
- }
- /* "zmq/core/socket.pyx":428
- * raise ZMQBindError("Could not bind socket to random port.")
- *
- * def connect(self, addr): # <<<<<<<<<<<<<<
- * """s.connect(addr)
- *
- */
- static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_9connect(PyObject *__pyx_v_self, PyObject *__pyx_v_addr); /*proto*/
- static char __pyx_doc_3zmq_4core_6socket_6Socket_9connect[] = "s.connect(addr)\n\n Connect to a remote 0MQ socket.\n\n Parameters\n ----------\n addr : str\n The address string. This has the form 'protocol://interface:port',\n for example 'tcp://127.0.0.1:5555'. Protocols supported are\n tcp, upd, pgm, inproc and ipc. If the address is unicode, it is\n encoded to utf-8 first.\n ";
- static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_9connect(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;
- void *__pyx_t_5;
- char *__pyx_t_6;
- __Pyx_RefNannySetupContext("connect");
- __Pyx_INCREF(__pyx_v_addr);
- /* "zmq/core/socket.pyx":443
- * cdef int rc
- *
- * _check_closed(self) # <<<<<<<<<<<<<<
- * if isinstance(addr, unicode):
- * addr = addr.encode('utf-8')
- */
- __pyx_t_1 = __pyx_v_self;
- __Pyx_INCREF(__pyx_t_1);
- __pyx_t_2 = __pyx_f_3zmq_4core_6socket__check_closed(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __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;
- /* "zmq/core/socket.pyx":444
- *
- * _check_closed(self)
- * if isinstance(addr, unicode): # <<<<<<<<<<<<<<
- * addr = addr.encode('utf-8')
- * if not isinstance(addr, bytes):
- */
- __pyx_t_2 = __pyx_v_addr;
- __Pyx_INCREF(__pyx_t_2);
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__unicode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = PyObject_IsInstance(__pyx_t_2, __pyx_t_1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (__pyx_t_3) {
- /* "zmq/core/socket.pyx":445
- * _check_closed(self)
- * if isinstance(addr, unicode):
- * addr = addr.encode('utf-8') # <<<<<<<<<<<<<<
- * if not isinstance(addr, bytes):
- * raise TypeError('expected str, got: %r' % addr)
- */
- __pyx_t_1 = PyObject_GetAttr(__pyx_v_addr, __pyx_n_s__encode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_v_addr);
- __pyx_v_addr = __pyx_t_2;
- __pyx_t_2 = 0;
- goto __pyx_L5;
- }
- __pyx_L5:;
- /* "zmq/core/socket.pyx":446
- * if isinstance(addr, unicode):
- * addr = addr.encode('utf-8')
- * if not isinstance(addr, bytes): # <<<<<<<<<<<<<<
- * raise TypeError('expected str, got: %r' % addr)
- * with nogil:
- */
- __pyx_t_2 = __pyx_v_addr;
- __Pyx_INCREF(__pyx_t_2);
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__bytes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = PyObject_IsInstance(__pyx_t_2, __pyx_t_1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_4 = (!__pyx_t_3);
- if (__pyx_t_4) {
- /* "zmq/core/socket.pyx":447
- * addr = addr.encode('utf-8')
- * if not isinstance(addr, bytes):
- * raise TypeError('expected str, got: %r' % addr) # <<<<<<<<<<<<<<
- * with nogil:
- * rc = zmq_connect(self.handle, addr)
- */
- __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_4), __pyx_v_addr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_1));
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_2));
- PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
- __pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(((PyObject *)__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 = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L6;
- }
- __pyx_L6:;
- /* "zmq/core/socket.pyx":448
- * if not isinstance(addr, bytes):
- * raise TypeError('expected str, got: %r' % addr)
- * with nogil: # <<<<<<<<<<<<<<
- * rc = zmq_connect(self.handle, addr)
- * if rc != 0:
- */
- {
- #ifdef WITH_THREAD
- PyThreadState *_save;
- #endif
- Py_UNBLOCK_THREADS
- /*try:*/ {
- /* "zmq/core/socket.pyx":449
- * raise TypeError('expected str, got: %r' % addr)
- * with nogil:
- * rc = zmq_connect(self.handle, addr) # <<<<<<<<<<<<<<
- * if rc != 0:
- * raise ZMQError()
- */
- __pyx_t_5 = ((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->handle;
- __pyx_t_6 = PyBytes_AsString(__pyx_v_addr); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L8;}
- __pyx_v_rc = zmq_connect(__pyx_t_5, __pyx_t_6);
- }
- /* "zmq/core/socket.pyx":448
- * if not isinstance(addr, bytes):
- * raise TypeError('expected str, got: %r' % addr)
- * with nogil: # <<<<<<<<<<<<<<
- * rc = zmq_connect(self.handle, addr)
- * if rc != 0:
- */
- /*finally:*/ {
- int __pyx_why;
- __pyx_why = 0; goto __pyx_L9;
- __pyx_L8: __pyx_why = 4; goto __pyx_L9;
- __pyx_L9:;
- Py_BLOCK_THREADS
- switch (__pyx_why) {
- case 4: goto __pyx_L1_error;
- }
- }
- }
- /* "zmq/core/socket.pyx":450
- * with nogil:
- * rc = zmq_connect(self.handle, addr)
- * if rc != 0: # <<<<<<<<<<<<<<
- * raise ZMQError()
- *
- */
- __pyx_t_4 = (__pyx_v_rc != 0);
- if (__pyx_t_4) {
- /* "zmq/core/socket.pyx":451
- * rc = zmq_connect(self.handle, addr)
- * if rc != 0:
- * raise ZMQError() # <<<<<<<<<<<<<<
- *
- * #-------------------------------------------------------------------------
- */
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __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 = 451; __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 = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L11;
- }
- __pyx_L11:;
- __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.core.socket.Socket.connect");
- __pyx_r = NULL;
- __pyx_L0:;
- __Pyx_DECREF(__pyx_v_addr);
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
- }
- /* "zmq/core/socket.pyx":457
- * #-------------------------------------------------------------------------
- *
- * cpdef object send(self, object data, int flags=0, copy=True, track=False): # <<<<<<<<<<<<<<
- * """s.send(data, flags=0, copy=True, track=False)
- *
- */
- static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_10send(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
- static PyObject *__pyx_f_3zmq_4core_6socket_6Socket_send(struct __pyx_obj_3zmq_4core_6socket_Socket *__pyx_v_self, PyObject *__pyx_v_data, int __pyx_skip_dispatch, struct __pyx_opt_args_3zmq_4core_6socket_6Socket_send *__pyx_optional_args) {
- int __pyx_v_flags = ((int)0);
- PyObject *__pyx_v_copy = __pyx_k_15;
- PyObject *__pyx_v_track = __pyx_k_16;
- PyObject *__pyx_v_msg;
- PyObject *__pyx_r = NULL;
- PyObject *__pyx_t_1 = NULL;
- PyObject *__pyx_t_2 = NULL;
- PyObject *__pyx_t_3 = NULL;
- int __pyx_t_4;
- void *__pyx_t_5;
- struct __pyx_opt_args_3zmq_4core_6socket__send_copy __pyx_t_6;
- int __pyx_t_7;
- int __pyx_t_8;
- struct __pyx_opt_args_3zmq_4core_6socket__send_message __pyx_t_9;
- __Pyx_RefNannySetupContext("send");
- if (__pyx_optional_args) {
- if (__pyx_optional_args->__pyx_n > 0) {
- __pyx_v_flags = __pyx_optional_args->flags;
- if (__pyx_optional_args->__pyx_n > 1) {
- __pyx_v_copy = __pyx_optional_args->copy;
- if (__pyx_optional_args->__pyx_n > 2) {
- __pyx_v_track = __pyx_optional_args->track;
- }
- }
- }
- }
- __Pyx_INCREF(__pyx_v_data);
- __pyx_v_msg = Py_None; __Pyx_INCREF(Py_None);
- /* Check if called by wrapper */
- if (unlikely(__pyx_skip_dispatch)) ;
- /* Check if overriden in Python */
- else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
- __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__send); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_3zmq_4core_6socket_6Socket_10send)) {
- __Pyx_XDECREF(__pyx_r);
- __pyx_t_2 = PyInt_FromLong(__pyx_v_flags); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_3));
- __Pyx_INCREF(__pyx_v_data);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_data);
- __Pyx_GIVEREF(__pyx_v_data);
- PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
- __Pyx_GIVEREF(__pyx_t_2);
- __Pyx_INCREF(__pyx_v_copy);
- PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_copy);
- __Pyx_GIVEREF(__pyx_v_copy);
- __Pyx_INCREF(__pyx_v_track);
- PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_v_track);
- __Pyx_GIVEREF(__pyx_v_track);
- __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
- __pyx_r = __pyx_t_2;
- __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- goto __pyx_L0;
- }
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- }
- /* "zmq/core/socket.pyx":494
- *
- * """
- * _check_closed(self) # <<<<<<<<<<<<<<
- *
- * if isinstance(data, unicode):
- */
- __pyx_t_1 = ((PyObject *)__pyx_v_self);
- __Pyx_INCREF(__pyx_t_1);
- __pyx_t_2 = __pyx_f_3zmq_4core_6socket__check_closed(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __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;
- /* "zmq/core/socket.pyx":496
- * _check_closed(self)
- *
- * if isinstance(data, unicode): # <<<<<<<<<<<<<<
- * raise TypeError("unicode not allowed, use send_unicode")
- *
- */
- __pyx_t_2 = __pyx_v_data;
- __Pyx_INCREF(__pyx_t_2);
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__unicode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_4 = PyObject_IsInstance(__pyx_t_2, __pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (__pyx_t_4) {
- /* "zmq/core/socket.pyx":497
- *
- * if isinstance(data, unicode):
- * raise TypeError("unicode not allowed, use send_unicode") # <<<<<<<<<<<<<<
- *
- * if copy:
- */
- __pyx_t_1 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_18), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_Raise(__pyx_t_1, 0, 0);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L3;
- }
- __pyx_L3:;
- /* "zmq/core/socket.pyx":499
- * raise TypeError("unicode not allowed, use send_unicode")
- *
- * if copy: # <<<<<<<<<<<<<<
- * # msg.bytes never returns the input data object
- * # it is always a copy, but always the same copy
- */
- __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_copy); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__pyx_t_4) {
- /* "zmq/core/socket.pyx":502
- * # msg.bytes never returns the input data object
- * # it is always a copy, but always the same copy
- * if isinstance(data, Message): # <<<<<<<<<<<<<<
- * data = data.buffer
- * return _send_copy(self.handle, data, flags)
- */
- __pyx_t_1 = __pyx_v_data;
- __Pyx_INCREF(__pyx_t_1);
- __pyx_t_2 = ((PyObject *)((PyObject*)__pyx_ptype_3zmq_4core_7message_Message));
- __Pyx_INCREF(__pyx_t_2);
- __pyx_t_4 = __Pyx_TypeCheck(__pyx_t_1, __pyx_t_2);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (__pyx_t_4) {
- /* "zmq/core/socket.pyx":503
- * # it is always a copy, but always the same copy
- * if isinstance(data, Message):
- * data = data.buffer # <<<<<<<<<<<<<<
- * return _send_copy(self.handle, data, flags)
- * else:
- */
- __pyx_t_2 = PyObject_GetAttr(__pyx_v_data, __pyx_n_s__buffer); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_v_data);
- __pyx_v_data = __pyx_t_2;
- __pyx_t_2 = 0;
- goto __pyx_L5;
- }
- __pyx_L5:;
- /* "zmq/core/socket.pyx":504
- * if isinstance(data, Message):
- * data = data.buffer
- * return _send_copy(self.handle, data, flags) # <<<<<<<<<<<<<<
- * else:
- * if isinstance(data, Message):
- */
- __Pyx_XDECREF(__pyx_r);
- __pyx_t_5 = __pyx_v_self->handle;
- __pyx_t_2 = __pyx_v_data;
- __Pyx_INCREF(__pyx_t_2);
- __pyx_t_6.__pyx_n = 1;
- __pyx_t_6.flags = __pyx_v_flags;
- __pyx_t_1 = __pyx_f_3zmq_4core_6socket__send_copy(__pyx_t_5, __pyx_t_2, &__pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __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;
- goto __pyx_L4;
- }
- /*else*/ {
- /* "zmq/core/socket.pyx":506
- * return _send_copy(self.handle, data, flags)
- * else:
- * if isinstance(data, Message): # <<<<<<<<<<<<<<
- * if track and not data.tracker:
- * raise ValueError('Not a tracked message')
- */
- __pyx_t_1 = __pyx_v_data;
- __Pyx_INCREF(__pyx_t_1);
- __pyx_t_2 = ((PyObject *)((PyObject*)__pyx_ptype_3zmq_4core_7message_Message));
- __Pyx_INCREF(__pyx_t_2);
- __pyx_t_4 = __Pyx_TypeCheck(__pyx_t_1, __pyx_t_2);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (__pyx_t_4) {
- /* "zmq/core/socket.pyx":507
- * else:
- * if isinstance(data, Message):
- * if track and not data.tracker: # <<<<<<<<<<<<<<
- * raise ValueError('Not a tracked message')
- * msg = data
- */
- __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_track); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__pyx_t_4) {
- __pyx_t_2 = PyObject_GetAttr(__pyx_v_data, __pyx_n_s__tracker); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_8 = (!__pyx_t_7);
- __pyx_t_7 = __pyx_t_8;
- } else {
- __pyx_t_7 = __pyx_t_4;
- }
- if (__pyx_t_7) {
- /* "zmq/core/socket.pyx":508
- * if isinstance(data, Message):
- * if track and not data.tracker:
- * raise ValueError('Not a tracked message') # <<<<<<<<<<<<<<
- * msg = data
- * else:
- */
- __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_20), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_Raise(__pyx_t_2, 0, 0);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L7;
- }
- __pyx_L7:;
- /* "zmq/core/socket.pyx":509
- * if track and not data.tracker:
- * raise ValueError('Not a tracked message')
- * msg = data # <<<<<<<<<<<<<<
- * else:
- * msg = Message(data, track=track)
- */
- __Pyx_INCREF(__pyx_v_data);
- __Pyx_DECREF(__pyx_v_msg);
- __pyx_v_msg = __pyx_v_data;
- goto __pyx_L6;
- }
- /*else*/ {
- /* "zmq/core/socket.pyx":511
- * msg = data
- * else:
- * msg = Message(data, track=track) # <<<<<<<<<<<<<<
- * return _send_message(self.handle, msg, flags)
- *
- */
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_2));
- __Pyx_INCREF(__pyx_v_data);
- PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_data);
- __Pyx_GIVEREF(__pyx_v_data);
- __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_1));
- if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__track), __pyx_v_track) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_3 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_3zmq_4core_7message_Message)), ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_v_msg);
- __pyx_v_msg = __pyx_t_3;
- __pyx_t_3 = 0;
- }
- __pyx_L6:;
- /* "zmq/core/socket.pyx":512
- * else:
- * msg = Message(data, track=track)
- * return _send_message(self.handle, msg, flags) # <<<<<<<<<<<<<<
- *
- * cpdef object recv(self, int flags=0, copy=True, track=False):
- */
- __Pyx_XDECREF(__pyx_r);
- __pyx_t_5 = __pyx_v_self->handle;
- if (!(likely(((__pyx_v_msg) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_msg, __pyx_ptype_3zmq_4core_7message_Message))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_3 = __pyx_v_msg;
- __Pyx_INCREF(__pyx_t_3);
- __pyx_t_9.__pyx_n = 1;
- __pyx_t_9.flags = __pyx_v_flags;
- __pyx_t_1 = __pyx_f_3zmq_4core_6socket__send_message(__pyx_t_5, ((struct __pyx_obj_3zmq_4core_7message_Message *)__pyx_t_3), &__pyx_t_9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_r = __pyx_t_1;
- __pyx_t_1 = 0;
- goto __pyx_L0;
- }
- __pyx_L4:;
- __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.core.socket.Socket.send");
- __pyx_r = 0;
- __pyx_L0:;
- __Pyx_DECREF(__pyx_v_msg);
- __Pyx_DECREF(__pyx_v_data);
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
- }
- /* "zmq/core/socket.pyx":457
- * #-------------------------------------------------------------------------
- *
- * cpdef object send(self, object data, int flags=0, copy=True, track=False): # <<<<<<<<<<<<<<
- * """s.send(data, flags=0, copy=True, track=False)
- *
- */
- static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_10send(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
- static char __pyx_doc_3zmq_4core_6socket_6Socket_10send[] = "s.send(data, flags=0, copy=True, track=False)\n\n Send a message on this socket.\n\n This queues the message to be sent by the IO thread at a later time.\n\n Parameters\n ----------\n data : object, str, Message\n The content of the message.\n flags : int\n Any supported flag: NOBLOCK, SNDMORE.\n copy : bool\n Should the message be sent in a copying or non-copying manner.\n track : bool\n Should the message be tracked for notification that ZMQ has\n finished with it? (ignored if copy=True)\n\n Returns\n -------\n None : if `copy` or not track\n None if message was sent, raises an exception otherwise.\n MessageTracker : if track and not copy\n a MessageTracker object, whose `pending` property will\n be True until the send is completed.\n \n Raises\n ------\n TypeError\n If a unicode object is passed\n ValueError\n If `track=True`, but an untracked Message is passed.\n ZMQError\n If the send does not succeed for any reason.\n \n ";
- static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_10send(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_track = 0;
- 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;
- struct __pyx_opt_args_3zmq_4core_6socket_6Socket_send __pyx_t_6;
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__data,&__pyx_n_s__flags,&__pyx_n_s__copy,&__pyx_n_s__track,0};
- __Pyx_RefNannySetupContext("send");
- if (unlikely(__pyx_kwds)) {
- Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
- PyObject* values[4] = {0,0,0,0};
- values[2] = __pyx_k_15;
- values[3] = __pyx_k_16;
- 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__data);
- 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__flags);
- if (value) { values[1] = value; kw_args--; }
- }
- case 2:
- if (kw_args > 0) {
- PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__copy);
- if (value) { values[2] = value; kw_args--; }
- }
- case 3:
- if (kw_args > 0) {
- PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__track);
- if (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), "send") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __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 = 457; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- } else {
- __pyx_v_flags = ((int)0);
- }
- __pyx_v_copy = values[2];
- __pyx_v_track = values[3];
- } else {
- __pyx_v_flags = ((int)0);
- __pyx_v_copy = __pyx_k_15;
- __pyx_v_track = __pyx_k_16;
- switch (PyTuple_GET_SIZE(__pyx_args)) {
- case 4: __pyx_v_track = PyTuple_GET_ITEM(__pyx_args, 3);
- 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 = 457; __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, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- __pyx_L3_error:;
- __Pyx_AddTraceback("zmq.core.socket.Socket.send");
- __Pyx_RefNannyFinishContext();
- return NULL;
- __pyx_L4_argument_unpacking_done:;
- __Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __pyx_v_data;
- __Pyx_INCREF(__pyx_t_1);
- __pyx_t_2 = __pyx_v_flags;
- __pyx_t_3 = __pyx_v_copy;
- __Pyx_INCREF(__pyx_t_3);
- __pyx_t_4 = __pyx_v_track;
- __Pyx_INCREF(__pyx_t_4);
- __pyx_t_6.__pyx_n = 3;
- __pyx_t_6.flags = __pyx_t_2;
- __pyx_t_6.copy = __pyx_t_3;
- __pyx_t_6.track = __pyx_t_4;
- __pyx_t_5 = ((struct __pyx_vtabstruct_3zmq_4core_6socket_Socket *)((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->__pyx_vtab)->send(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self), __pyx_t_1, 1, &__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __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(__pyx_t_4); __pyx_t_4 = 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_1);
- __Pyx_XDECREF(__pyx_t_3);
- __Pyx_XDECREF(__pyx_t_4);
- __Pyx_XDECREF(__pyx_t_5);
- __Pyx_AddTraceback("zmq.core.socket.Socket.send");
- __pyx_r = NULL;
- __pyx_L0:;
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
- }
- /* "zmq/core/socket.pyx":514
- * return _send_message(self.handle, msg, flags)
- *
- * cpdef object recv(self, int flags=0, copy=True, track=False): # <<<<<<<<<<<<<<
- * """s.recv(flags=0, copy=True, track=False)
- *
- */
- static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_11recv(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
- static PyObject *__pyx_f_3zmq_4core_6socket_6Socket_recv(struct __pyx_obj_3zmq_4core_6socket_Socket *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_3zmq_4core_6socket_6Socket_recv *__pyx_optional_args) {
- int __pyx_v_flags = ((int)0);
- PyObject *__pyx_v_copy = __pyx_k_21;
- PyObject *__pyx_v_track = __pyx_k_22;
- PyObject *__pyx_r = NULL;
- PyObject *__pyx_t_1 = NULL;
- PyObject *__pyx_t_2 = NULL;
- PyObject *__pyx_t_3 = NULL;
- int __pyx_t_4;
- struct __pyx_opt_args_3zmq_4core_6socket__recv_copy __pyx_t_5;
- void *__pyx_t_6;
- int __pyx_t_7;
- struct __pyx_opt_args_3zmq_4core_6socket__recv_message __pyx_t_8;
- __Pyx_RefNannySetupContext("recv");
- if (__pyx_optional_args) {
- if (__pyx_optional_args->__pyx_n > 0) {
- __pyx_v_flags = __pyx_optional_args->flags;
- if (__pyx_optional_args->__pyx_n > 1) {
- __pyx_v_copy = __pyx_optional_args->copy;
- if (__pyx_optional_args->__pyx_n > 2) {
- __pyx_v_track = __pyx_optional_args->track;
- }
- }
- }
- }
- /* Check if called by wrapper */
- if (unlikely(__pyx_skip_dispatch)) ;
- /* Check if overriden in Python */
- else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
- __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__recv); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_3zmq_4core_6socket_6Socket_11recv)) {
- __Pyx_XDECREF(__pyx_r);
- __pyx_t_2 = PyInt_FromLong(__pyx_v_flags); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_3));
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
- __Pyx_GIVEREF(__pyx_t_2);
- __Pyx_INCREF(__pyx_v_copy);
- PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_copy);
- __Pyx_GIVEREF(__pyx_v_copy);
- __Pyx_INCREF(__pyx_v_track);
- PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_track);
- __Pyx_GIVEREF(__pyx_v_track);
- __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
- __pyx_r = __pyx_t_2;
- __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- goto __pyx_L0;
- }
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- }
- /* "zmq/core/socket.pyx":545
- * for any of the reasons zmq_recvmsg might fail.
- * """
- * _check_closed(self) # <<<<<<<<<<<<<<
- *
- * if copy:
- */
- __pyx_t_1 = ((PyObject *)__pyx_v_self);
- __Pyx_INCREF(__pyx_t_1);
- __pyx_t_2 = __pyx_f_3zmq_4core_6socket__check_closed(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __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;
- /* "zmq/core/socket.pyx":547
- * _check_closed(self)
- *
- * if copy: # <<<<<<<<<<<<<<
- * return _recv_copy(self.handle, flags)
- * else:
- */
- __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_copy); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__pyx_t_4) {
- /* "zmq/core/socket.pyx":548
- *
- * if copy:
- * return _recv_copy(self.handle, flags) # <<<<<<<<<<<<<<
- * else:
- * return _recv_message(self.handle, flags, track)
- */
- __Pyx_XDECREF(__pyx_r);
- __pyx_t_5.__pyx_n = 1;
- __pyx_t_5.flags = __pyx_v_flags;
- __pyx_t_2 = __pyx_f_3zmq_4core_6socket__recv_copy(__pyx_v_self->handle, &__pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __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_L3;
- }
- /*else*/ {
- /* "zmq/core/socket.pyx":550
- * return _recv_copy(self.handle, flags)
- * else:
- * return _recv_message(self.handle, flags, track) # <<<<<<<<<<<<<<
- *
- * def send_multipart(self, msg_parts, int flags=0, copy=True, track=False):
- */
- __Pyx_XDECREF(__pyx_r);
- __pyx_t_6 = __pyx_v_self->handle;
- __pyx_t_7 = __pyx_v_flags;
- __pyx_t_2 = __pyx_v_track;
- __Pyx_INCREF(__pyx_t_2);
- __pyx_t_8.__pyx_n = 2;
- __pyx_t_8.flags = __pyx_t_7;
- __pyx_t_8.track = __pyx_t_2;
- __pyx_t_1 = ((PyObject *)__pyx_f_3zmq_4core_6socket__recv_message(__pyx_t_6, &__pyx_t_8)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __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_L3:;
- __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.core.socket.Socket.recv");
- __pyx_r = 0;
- __pyx_L0:;
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
- }
- /* "zmq/core/socket.pyx":514
- * return _send_message(self.handle, msg, flags)
- *
- * cpdef object recv(self, int flags=0, copy=True, track=False): # <<<<<<<<<<<<<<
- * """s.recv(flags=0, copy=True, track=False)
- *
- */
- static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_11recv(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
- static char __pyx_doc_3zmq_4core_6socket_6Socket_11recv[] = "s.recv(flags=0, copy=True, track=False)\n\n Receive a message.\n\n Parameters\n ----------\n flags : int\n Any supported flag: NOBLOCK. If NOBLOCK is set, this method\n will raise a ZMQError with EAGAIN if a message is not ready.\n If NOBLOCK is not set, then this method will block until a\n message arrives.\n copy : bool\n Should the message be received in a copying or non-copying manner?\n If False a Message object is returned, if True a string copy of\n message is returned.\n track : bool\n Should the message be tracked for notification that ZMQ has\n finished with it? (ignored if copy=True)\n\n Returns\n -------\n msg : str, Message\n The returned message. If `copy` is False, then it will be a Message,\n otherwise a str.\n \n Raises\n ------\n ZMQError\n for any of the reasons zmq_recvmsg might fail.\n ";
- static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_11recv(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
- int __pyx_v_flags;
- PyObject *__pyx_v_copy = 0;
- PyObject *__pyx_v_track = 0;
- PyObject *__pyx_r = NULL;
- int __pyx_t_1;
- PyObject *__pyx_t_2 = NULL;
- PyObject *__pyx_t_3 = NULL;
- PyObject *__pyx_t_4 = NULL;
- struct __pyx_opt_args_3zmq_4core_6socket_6Socket_recv __pyx_t_5;
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__flags,&__pyx_n_s__copy,&__pyx_n_s__track,0};
- __Pyx_RefNannySetupContext("recv");
- if (unlikely(__pyx_kwds)) {
- Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
- PyObject* values[3] = {0,0,0};
- values[1] = __pyx_k_21;
- values[2] = __pyx_k_22;
- 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:
- if (kw_args > 0) {
- PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags);
- if (value) { values[0] = value; kw_args--; }
- }
- case 1:
- if (kw_args > 0) {
- PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__copy);
- if (value) { values[1] = value; kw_args--; }
- }
- case 2:
- if (kw_args > 0) {
- PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__track);
- if (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), "recv") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __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 = 514; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- } else {
- __pyx_v_flags = ((int)0);
- }
- __pyx_v_copy = values[1];
- __pyx_v_track = values[2];
- } else {
- __pyx_v_flags = ((int)0);
- __pyx_v_copy = __pyx_k_21;
- __pyx_v_track = __pyx_k_22;
- switch (PyTuple_GET_SIZE(__pyx_args)) {
- case 3: __pyx_v_track = PyTuple_GET_ITEM(__pyx_args, 2);
- 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 = 514; __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, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- __pyx_L3_error:;
- __Pyx_AddTraceback("zmq.core.socket.Socket.recv");
- __Pyx_RefNannyFinishContext();
- return NULL;
- __pyx_L4_argument_unpacking_done:;
- __Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __pyx_v_flags;
- __pyx_t_2 = __pyx_v_copy;
- __Pyx_INCREF(__pyx_t_2);
- __pyx_t_3 = __pyx_v_track;
- __Pyx_INCREF(__pyx_t_3);
- __pyx_t_5.__pyx_n = 3;
- __pyx_t_5.flags = __pyx_t_1;
- __pyx_t_5.copy = __pyx_t_2;
- __pyx_t_5.track = __pyx_t_3;
- __pyx_t_4 = ((struct __pyx_vtabstruct_3zmq_4core_6socket_Socket *)((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->__pyx_vtab)->recv(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self), 1, &__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __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;
- __pyx_r = __pyx_t_4;
- __pyx_t_4 = 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_AddTraceback("zmq.core.socket.Socket.recv");
- __pyx_r = NULL;
- __pyx_L0:;
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
- }
- /* "zmq/core/socket.pyx":552
- * return _recv_message(self.handle, flags, track)
- *
- * def send_multipart(self, msg_parts, int flags=0, copy=True, track=False): # <<<<<<<<<<<<<<
- * """s.send_multipart(msg_parts, flags=0, copy=True, track=False)
- *
- */
- static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_12send_multipart(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
- static char __pyx_doc_3zmq_4core_6socket_6Socket_12send_multipart[] = "s.send_multipart(msg_parts, flags=0, copy=True, track=False)\n\n Send a sequence of messages as a multipart message.\n\n Parameters\n ----------\n msg_parts : iterable\n A sequence of messages to send as a multipart message. Each element\n can be any sendable object (Message, bytes, buffer-providers)\n flags : int, optional\n Only the NOBLOCK flagis supported, SNDMORE is handled\n automatically.\n copy : bool, optional\n Should the message(s) be sent in a copying or non-copying manner.\n track : bool, optional\n Should the message(s) be tracked for notification that ZMQ has\n finished with it (ignored if copy=True).\n \n Returns\n -------\n None : if copy or not track\n MessageTracker : if track and not copy\n a MessageTracker object, whose `pending` property will\n be True until the last send is completed.\n ";
- static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_12send_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_track = 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,&__pyx_n_s__track,0};
- __Pyx_RefNannySetupContext("send_multipart");
- if (unlikely(__pyx_kwds)) {
- Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
- PyObject* values[4] = {0,0,0,0};
- values[2] = __pyx_k_23;
- values[3] = __pyx_k_24;
- 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__msg_parts);
- 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__flags);
- if (value) { values[1] = value; kw_args--; }
- }
- case 2:
- if (kw_args > 0) {
- PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__copy);
- if (value) { values[2] = value; kw_args--; }
- }
- case 3:
- if (kw_args > 0) {
- PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__track);
- if (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), "send_multipart") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __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 = 552; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- } else {
- __pyx_v_flags = ((int)0);
- }
- __pyx_v_copy = values[2];
- __pyx_v_track = values[3];
- } else {
- __pyx_v_flags = ((int)0);
- __pyx_v_copy = __pyx_k_23;
- __pyx_v_track = __pyx_k_24;
- switch (PyTuple_GET_SIZE(__pyx_args)) {
- case 4: __pyx_v_track = PyTuple_GET_ITEM(__pyx_args, 3);
- 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 = 552; __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, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- __pyx_L3_error:;
- __Pyx_AddTraceback("zmq.core.socket.Socket.send_multipart");
- __Pyx_RefNannyFinishContext();
- return NULL;
- __pyx_L4_argument_unpacking_done:;
- __pyx_v_msg = Py_None; __Pyx_INCREF(Py_None);
- /* "zmq/core/socket.pyx":578
- * be True until the last send is completed.
- * """
- * for msg in msg_parts[:-1]: # <<<<<<<<<<<<<<
- * self.send(msg, SNDMORE|flags, copy=copy, track=track)
- * # Send the last part without the extra SNDMORE flag.
- */
- __pyx_t_2 = __Pyx_PySequence_GetSlice(__pyx_v_msg_parts, 0, -1); 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);
- 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 = 578; __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 = 578; __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;
- /* "zmq/core/socket.pyx":579
- * """
- * for msg in msg_parts[:-1]:
- * self.send(msg, SNDMORE|flags, copy=copy, track=track) # <<<<<<<<<<<<<<
- * # Send the last part without the extra SNDMORE flag.
- * return self.send(msg_parts[-1], flags, copy=copy, track=track)
- */
- __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__send); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __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 = 579; __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 = 579; __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 = 579; __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 = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__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 = 579; __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 = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__track), __pyx_v_track) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(((PyObject *)__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;
- /* "zmq/core/socket.pyx":581
- * self.send(msg, SNDMORE|flags, copy=copy, track=track)
- * # Send the last part without the extra SNDMORE flag.
- * return self.send(msg_parts[-1], flags, copy=copy, track=track) # <<<<<<<<<<<<<<
- *
- * def recv_multipart(self, int flags=0, copy=True, track=False):
- */
- __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 = 581; __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 = 581; __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 = 581; __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 = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__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 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __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 = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__track), __pyx_v_track) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
- __pyx_r = __pyx_t_4;
- __pyx_t_4 = 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_XDECREF(__pyx_t_6);
- __Pyx_AddTraceback("zmq.core.socket.Socket.send_multipart");
- __pyx_r = NULL;
- __pyx_L0:;
- __Pyx_DECREF(__pyx_v_msg);
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
- }
- /* "zmq/core/socket.pyx":583
- * return self.send(msg_parts[-1], flags, copy=copy, track=track)
- *
- * def recv_multipart(self, int flags=0, copy=True, track=False): # <<<<<<<<<<<<<<
- * """s.recv_multipart(flags=0, copy=True, track=False)
- *
- */
- static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_13recv_multipart(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
- static char __pyx_doc_3zmq_4core_6socket_6Socket_13recv_multipart[] = "s.recv_multipart(flags=0, copy=True, track=False)\n\n Receive a multipart message as a list of messages.\n\n Parameters\n ----------\n flags : int, optional\n Any supported flag: NOBLOCK. If NOBLOCK is set, this method\n will raise a ZMQError with EAGAIN if a message is not ready.\n If NOBLOCK is not set, then this method will block until a\n message arrives.\n copy : bool, optional\n Should the message(s) be received in a copying or non-copying manner?\n If False a Message object is returned for part, if True a string copy of\n message is returned for each message part.\n track : bool, optional\n Should the message(s) be tracked for notification that ZMQ has\n finished with it? (ignored if copy=True)\n \n Returns\n -------\n msg_parts : list\n A list of messages in the multipart message; either Messages or strs,\n depending on `copy`.\n ";
- static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_13recv_multipart(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
- int __pyx_v_flags;
- PyObject *__pyx_v_copy = 0;
- PyObject *__pyx_v_track = 0;
- PyObject *__pyx_v_parts;
- PyObject *__pyx_v_part;
- PyObject *__pyx_r = NULL;
- PyObject *__pyx_t_1 = NULL;
- PyObject *__pyx_t_2 = NULL;
- PyObject *__pyx_t_3 = NULL;
- PyObject *__pyx_t_4 = NULL;
- int __pyx_t_5;
- int __pyx_t_6;
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__flags,&__pyx_n_s__copy,&__pyx_n_s__track,0};
- __Pyx_RefNannySetupContext("recv_multipart");
- if (unlikely(__pyx_kwds)) {
- Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
- PyObject* values[3] = {0,0,0};
- values[1] = __pyx_k_25;
- values[2] = __pyx_k_26;
- 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:
- if (kw_args > 0) {
- PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags);
- if (value) { values[0] = value; kw_args--; }
- }
- case 1:
- if (kw_args > 0) {
- PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__copy);
- if (value) { values[1] = value; kw_args--; }
- }
- case 2:
- if (kw_args > 0) {
- PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__track);
- if (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), "recv_multipart") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __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 = 583; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- } else {
- __pyx_v_flags = ((int)0);
- }
- __pyx_v_copy = values[1];
- __pyx_v_track = values[2];
- } else {
- __pyx_v_flags = ((int)0);
- __pyx_v_copy = __pyx_k_25;
- __pyx_v_track = __pyx_k_26;
- switch (PyTuple_GET_SIZE(__pyx_args)) {
- case 3: __pyx_v_track = PyTuple_GET_ITEM(__pyx_args, 2);
- 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 = 583; __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, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- __pyx_L3_error:;
- __Pyx_AddTraceback("zmq.core.socket.Socket.recv_multipart");
- __Pyx_RefNannyFinishContext();
- return NULL;
- __pyx_L4_argument_unpacking_done:;
- __pyx_v_parts = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
- __pyx_v_part = Py_None; __Pyx_INCREF(Py_None);
- /* "zmq/core/socket.pyx":609
- * depending on `copy`.
- * """
- * parts = [] # <<<<<<<<<<<<<<
- * while True:
- * part = self.recv(flags, copy=copy, track=track)
- */
- __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_1));
- __Pyx_DECREF(((PyObject *)__pyx_v_parts));
- __pyx_v_parts = __pyx_t_1;
- __pyx_t_1 = 0;
- /* "zmq/core/socket.pyx":610
- * """
- * parts = []
- * while True: # <<<<<<<<<<<<<<
- * part = self.recv(flags, copy=copy, track=track)
- * parts.append(part)
- */
- while (1) {
- if (!1) break;
- /* "zmq/core/socket.pyx":611
- * parts = []
- * while True:
- * part = self.recv(flags, copy=copy, track=track) # <<<<<<<<<<<<<<
- * 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 = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyInt_FromLong(__pyx_v_flags); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __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 = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__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 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_2));
- if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__copy), __pyx_v_copy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__track), __pyx_v_track) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_v_part);
- __pyx_v_part = __pyx_t_4;
- __pyx_t_4 = 0;
- /* "zmq/core/socket.pyx":612
- * while True:
- * part = self.recv(flags, copy=copy, track=track)
- * parts.append(part) # <<<<<<<<<<<<<<
- * if self.rcvmore():
- * continue
- */
- if (unlikely(__pyx_v_parts == Py_None)) {
- PyErr_SetString(PyExc_AttributeError, "'NoneType' object has no attribute 'append'"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
- __pyx_t_5 = PyList_Append(__pyx_v_parts, __pyx_v_part); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "zmq/core/socket.pyx":613
- * part = self.recv(flags, copy=copy, track=track)
- * parts.append(part)
- * if self.rcvmore(): # <<<<<<<<<<<<<<
- * continue
- * else:
- */
- __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__rcvmore); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __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 = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (__pyx_t_6) {
- /* "zmq/core/socket.pyx":614
- * parts.append(part)
- * if self.rcvmore():
- * continue # <<<<<<<<<<<<<<
- * else:
- * break
- */
- goto __pyx_L6_continue;
- goto __pyx_L8;
- }
- /*else*/ {
- /* "zmq/core/socket.pyx":616
- * continue
- * else:
- * break # <<<<<<<<<<<<<<
- * return parts
- *
- */
- goto __pyx_L7_break;
- }
- __pyx_L8:;
- __pyx_L6_continue:;
- }
- __pyx_L7_break:;
- /* "zmq/core/socket.pyx":617
- * else:
- * break
- * return parts # <<<<<<<<<<<<<<
- *
- * def rcvmore(self):
- */
- __Pyx_XDECREF(__pyx_r);
- __Pyx_INCREF(((PyObject *)__pyx_v_parts));
- __pyx_r = ((PyObject *)__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_2);
- __Pyx_XDECREF(__pyx_t_3);
- __Pyx_XDECREF(__pyx_t_4);
- __Pyx_AddTraceback("zmq.core.socket.Socket.recv_multipart");
- __pyx_r = NULL;
- __pyx_L0:;
- __Pyx_DECREF(__pyx_v_parts);
- __Pyx_DECREF(__pyx_v_part);
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
- }
- /* "zmq/core/socket.pyx":619
- * return parts
- *
- * def rcvmore(self): # <<<<<<<<<<<<<<
- * """s.rcvmore()
- *
- */
- static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_14rcvmore(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
- static char __pyx_doc_3zmq_4core_6socket_6Socket_14rcvmore[] = "s.rcvmore()\n\n Are there more parts to a multipart message?\n \n Returns\n -------\n more : bool\n whether we are in the middle of a multipart message.\n ";
- static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_14rcvmore(PyObject *__pyx_v_self, CYTHON_UNUSED 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;
- int __pyx_t_4;
- __Pyx_RefNannySetupContext("rcvmore");
- __pyx_v_more = Py_None; __Pyx_INCREF(Py_None);
- /* "zmq/core/socket.pyx":629
- * whether we are in the middle of 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 = 629; __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 = 629; __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 = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__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, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_v_more);
- __pyx_v_more = __pyx_t_2;
- __pyx_t_2 = 0;
- /* "zmq/core/socket.pyx":630
- * """
- * more = self.getsockopt(RCVMORE)
- * return bool(more) # <<<<<<<<<<<<<<
- *
- * def send_unicode(self, u, int flags=0, copy=False, encoding='utf-8'):
- */
- __Pyx_XDECREF(__pyx_r);
- __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_more); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_2 = __Pyx_PyBool_FromLong((!(!__pyx_t_4))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __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_1);
- __Pyx_XDECREF(__pyx_t_2);
- __Pyx_XDECREF(__pyx_t_3);
- __Pyx_AddTraceback("zmq.core.socket.Socket.rcvmore");
- __pyx_r = NULL;
- __pyx_L0:;
- __Pyx_DECREF(__pyx_v_more);
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
- }
- /* "zmq/core/socket.pyx":632
- * return bool(more)
- *
- * def send_unicode(self, u, int flags=0, copy=False, encoding='utf-8'): # <<<<<<<<<<<<<<
- * """s.send_unicode(u, flags=0, copy=False, encoding='utf-8')
- *
- */
- static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_15send_unicode(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
- static char __pyx_doc_3zmq_4core_6socket_6Socket_15send_unicode[] = "s.send_unicode(u, flags=0, copy=False, encoding='utf-8')\n\n Send a Python unicode object as a message with an encoding.\n\n Parameters\n ----------\n u : Python unicode object\n The unicode string to send.\n flags : int, optional\n Any valid send flag.\n encoding : str [default: 'utf-8']\n The encoding to be used\n ";
- static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_15send_unicode(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
- PyObject *__pyx_v_u = 0;
- int __pyx_v_flags;
- PyObject *__pyx_v_copy = 0;
- PyObject *__pyx_v_encoding = 0;
- PyObject *__pyx_r = NULL;
- PyObject *__pyx_t_1 = NULL;
- PyObject *__pyx_t_2 = NULL;
- int __pyx_t_3;
- int __pyx_t_4;
- PyObject *__pyx_t_5 = NULL;
- PyObject *__pyx_t_6 = NULL;
- static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__u,&__pyx_n_s__flags,&__pyx_n_s__copy,&__pyx_n_s__encoding,0};
- __Pyx_RefNannySetupContext("send_unicode");
- if (unlikely(__pyx_kwds)) {
- Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
- PyObject* values[4] = {0,0,0,0};
- values[2] = __pyx_k_27;
- values[3] = ((PyObject *)__pyx_kp_s_6);
- 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__u);
- 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__flags);
- if (value) { values[1] = value; kw_args--; }
- }
- case 2:
- if (kw_args > 0) {
- PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__copy);
- if (value) { values[2] = value; kw_args--; }
- }
- case 3:
- if (kw_args > 0) {
- PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__encoding);
- if (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), "send_unicode") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- }
- __pyx_v_u = 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 = 632; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- } else {
- __pyx_v_flags = ((int)0);
- }
- __pyx_v_copy = values[2];
- __pyx_v_encoding = values[3];
- } else {
- __pyx_v_flags = ((int)0);
- __pyx_v_copy = __pyx_k_27;
- __pyx_v_encoding = ((PyObject *)__pyx_kp_s_6);
- switch (PyTuple_GET_SIZE(__pyx_args)) {
- case 4: __pyx_v_encoding = PyTuple_GET_ITEM(__pyx_args, 3);
- 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 = 632; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- case 1: __pyx_v_u = 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_unicode", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- __pyx_L3_error:;
- __Pyx_AddTraceback("zmq.core.socket.Socket.send_unicode");
- __Pyx_RefNannyFinishContext();
- return NULL;
- __pyx_L4_argument_unpacking_done:;
- /* "zmq/core/socket.pyx":646
- * The encoding to be used
- * """
- * if not isinstance(u, basestring): # <<<<<<<<<<<<<<
- * raise TypeError("unicode/str objects only")
- * return self.send(u.encode(encoding), flags=flags, copy=copy)
- */
- __pyx_t_1 = __pyx_v_u;
- __Pyx_INCREF(__pyx_t_1);
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__basestring); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyObject_IsInstance(__pyx_t_1, __pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_4 = (!__pyx_t_3);
- if (__pyx_t_4) {
- /* "zmq/core/socket.pyx":647
- * """
- * if not isinstance(u, basestring):
- * raise TypeError("unicode/str objects only") # <<<<<<<<<<<<<<
- * return self.send(u.encode(encoding), flags=flags, copy=copy)
- *
- */
- __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_29), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_Raise(__pyx_t_2, 0, 0);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L6;
- }
- __pyx_L6:;
- /* "zmq/core/socket.pyx":648
- * if not isinstance(u, basestring):
- * raise TypeError("unicode/str objects only")
- * return self.send(u.encode(encoding), flags=flags, copy=copy) # <<<<<<<<<<<<<<
- *
- * def recv_unicode(self, int flags=0, encoding='utf-8'):
- */
- __Pyx_XDECREF(__pyx_r);
- __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__send); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyObject_GetAttr(__pyx_v_u, __pyx_n_s__encode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_5));
- __Pyx_INCREF(__pyx_v_encoding);
- PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_encoding);
- __Pyx_GIVEREF(__pyx_v_encoding);
- __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
- __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_5));
- PyTuple_SET_ITEM(__pyx_t_5, 0, __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 = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_6));
- __pyx_t_1 = PyInt_FromLong(__pyx_v_flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__flags), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__copy), __pyx_v_copy) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_1 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 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_5);
- __Pyx_XDECREF(__pyx_t_6);
- __Pyx_AddTraceback("zmq.core.socket.Socket.send_unicode");
- __pyx_r = NULL;
- __pyx_L0:;
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
- }
- /* "zmq/core/socket.pyx":650
- * return self.send(u.encode(encoding), flags=flags, copy=copy)
- *
- * def recv_unicode(self, int flags=0, encoding='utf-8'): # <<<<<<<<<<<<<<
- * """s.recv_unicode(flags=0, encoding='utf-8')
- *
- */
- static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_16recv_unicode(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
- static char __pyx_doc_3zmq_4core_6socket_6Socket_16recv_unicode[] = "s.recv_unicode(flags=0, encoding='utf-8')\n\n Receive a unicode string, as sent by send_unicode.\n \n Parameters\n ----------\n flags : int\n Any valid recv flag.\n encoding : str [default: 'utf-8']\n The encoding to be used\n\n Returns\n -------\n s : unicode string\n The Python unicode string that arrives as message bytes.\n ";
- static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_16recv_unicode(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
- int __pyx_v_flags;
- PyObject *__pyx_v_encoding = 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__flags,&__pyx_n_s__encoding,0};
- __Pyx_RefNannySetupContext("recv_unicode");
- if (unlikely(__pyx_kwds)) {
- Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
- PyObject* values[2] = {0,0};
- values[1] = ((PyObject *)__pyx_kp_s_6);
- 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 > 0) {
- PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags);
- if (value) { values[0] = value; kw_args--; }
- }
- case 1:
- if (kw_args > 0) {
- PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__encoding);
- if (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_unicode") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __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 = 650; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- } else {
- __pyx_v_flags = ((int)0);
- }
- __pyx_v_encoding = values[1];
- } else {
- __pyx_v_flags = ((int)0);
- __pyx_v_encoding = ((PyObject *)__pyx_kp_s_6);
- switch (PyTuple_GET_SIZE(__pyx_args)) {
- case 2: __pyx_v_encoding = 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 = 650; __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_unicode", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- __pyx_L3_error:;
- __Pyx_AddTraceback("zmq.core.socket.Socket.recv_unicode");
- __Pyx_RefNannyFinishContext();
- return NULL;
- __pyx_L4_argument_unpacking_done:;
- __pyx_v_msg = Py_None; __Pyx_INCREF(Py_None);
- /* "zmq/core/socket.pyx":667
- * The Python unicode string that arrives as message bytes.
- * """
- * msg = self.recv(flags=flags, copy=False) # <<<<<<<<<<<<<<
- * return codecs.decode(msg.bytes, encoding)
- *
- */
- __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__recv); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_2));
- __pyx_t_3 = PyInt_FromLong(__pyx_v_flags); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__flags), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__copy), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_v_msg);
- __pyx_v_msg = __pyx_t_3;
- __pyx_t_3 = 0;
- /* "zmq/core/socket.pyx":668
- * """
- * msg = self.recv(flags=flags, copy=False)
- * return codecs.decode(msg.bytes, encoding) # <<<<<<<<<<<<<<
- *
- * def send_pyobj(self, obj, flags=0, protocol=-1):
- */
- __Pyx_XDECREF(__pyx_r);
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__codecs); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__decode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_GetAttr(__pyx_v_msg, __pyx_n_s__bytes); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __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 = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_1));
- PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
- __Pyx_GIVEREF(__pyx_t_3);
- __Pyx_INCREF(__pyx_v_encoding);
- PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_encoding);
- __Pyx_GIVEREF(__pyx_v_encoding);
- __pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 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.core.socket.Socket.recv_unicode");
- __pyx_r = NULL;
- __pyx_L0:;
- __Pyx_DECREF(__pyx_v_msg);
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
- }
- /* "zmq/core/socket.pyx":670
- * return codecs.decode(msg.bytes, encoding)
- *
- * def send_pyobj(self, obj, flags=0, protocol=-1): # <<<<<<<<<<<<<<
- * """s.send_pyobj(obj, flags=0, protocol=-1)
- *
- */
- static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_17send_pyobj(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
- static char __pyx_doc_3zmq_4core_6socket_6Socket_17send_pyobj[] = "s.send_pyobj(obj, flags=0, protocol=-1)\n\n Send a Python object as a message using pickle to serialize.\n\n Parameters\n ----------\n obj : Python object\n The Python object to send.\n flags : int\n Any valid send flag.\n protocol : int\n The pickle protocol number to use. Default of -1 will select\n the highest supported number. Use 0 for multiple platform\n support.\n ";
- static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_17send_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;
- int __pyx_t_4;
- struct __pyx_opt_args_3zmq_4core_6socket_6Socket_send __pyx_t_5;
- 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 > 0) {
- PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags);
- if (value) { values[1] = value; kw_args--; }
- }
- case 2:
- if (kw_args > 0) {
- PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__protocol);
- if (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 = 670; __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 = 670; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- __pyx_L3_error:;
- __Pyx_AddTraceback("zmq.core.socket.Socket.send_pyobj");
- __Pyx_RefNannyFinishContext();
- return NULL;
- __pyx_L4_argument_unpacking_done:;
- __pyx_v_msg = Py_None; __Pyx_INCREF(Py_None);
- /* "zmq/core/socket.pyx":686
- * 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 = 686; __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 = 686; __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 = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__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, ((PyObject *)__pyx_t_1), 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_2); __pyx_t_2 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_v_msg);
- __pyx_v_msg = __pyx_t_3;
- __pyx_t_3 = 0;
- /* "zmq/core/socket.pyx":687
- * """
- * msg = pickle.dumps(obj, protocol)
- * return self.send(msg, flags) # <<<<<<<<<<<<<<
- *
- * def recv_pyobj(self, flags=0):
- */
- __Pyx_XDECREF(__pyx_r);
- __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_v_flags); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_5.__pyx_n = 1;
- __pyx_t_5.flags = __pyx_t_4;
- __pyx_t_3 = ((struct __pyx_vtabstruct_3zmq_4core_6socket_Socket *)((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->__pyx_vtab)->send(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self), __pyx_v_msg, 0, &__pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __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.core.socket.Socket.send_pyobj");
- __pyx_r = NULL;
- __pyx_L0:;
- __Pyx_DECREF(__pyx_v_msg);
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
- }
- /* "zmq/core/socket.pyx":689
- * return self.send(msg, flags)
- *
- * def recv_pyobj(self, flags=0): # <<<<<<<<<<<<<<
- * """s.recv_pyobj(flags=0)
- *
- */
- static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_18recv_pyobj(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
- static char __pyx_doc_3zmq_4core_6socket_6Socket_18recv_pyobj[] = "s.recv_pyobj(flags=0)\n\n Receive a Python object as a message using pickle to serialize.\n\n Parameters\n ----------\n flags : int\n Any valid recv flag.\n\n Returns\n -------\n obj : Python object\n The Python object that arrives as a message.\n ";
- static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_18recv_pyobj(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
- PyObject *__pyx_v_flags = 0;
- PyObject *__pyx_v_s;
- PyObject *__pyx_r = NULL;
- int __pyx_t_1;
- PyObject *__pyx_t_2 = NULL;
- struct __pyx_opt_args_3zmq_4core_6socket_6Socket_recv __pyx_t_3;
- PyObject *__pyx_t_4 = NULL;
- PyObject *__pyx_t_5 = 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 > 0) {
- PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags);
- if (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 = 689; __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 = 689; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- __pyx_L3_error:;
- __Pyx_AddTraceback("zmq.core.socket.Socket.recv_pyobj");
- __Pyx_RefNannyFinishContext();
- return NULL;
- __pyx_L4_argument_unpacking_done:;
- __pyx_v_s = Py_None; __Pyx_INCREF(Py_None);
- /* "zmq/core/socket.pyx":704
- * The Python object that arrives as a message.
- * """
- * s = self.recv(flags) # <<<<<<<<<<<<<<
- * return pickle.loads(s)
- *
- */
- __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_flags); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_3.__pyx_n = 1;
- __pyx_t_3.flags = __pyx_t_1;
- __pyx_t_2 = ((struct __pyx_vtabstruct_3zmq_4core_6socket_Socket *)((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->__pyx_vtab)->recv(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self), 0, &__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_v_s);
- __pyx_v_s = __pyx_t_2;
- __pyx_t_2 = 0;
- /* "zmq/core/socket.pyx":705
- * """
- * s = self.recv(flags)
- * return pickle.loads(s) # <<<<<<<<<<<<<<
- *
- * def send_json(self, obj, flags=0):
- */
- __Pyx_XDECREF(__pyx_r);
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__pickle); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__loads); 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_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 = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_2));
- __Pyx_INCREF(__pyx_v_s);
- PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_s);
- __Pyx_GIVEREF(__pyx_v_s);
- __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_5);
- __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_4);
- __Pyx_XDECREF(__pyx_t_5);
- __Pyx_AddTraceback("zmq.core.socket.Socket.recv_pyobj");
- __pyx_r = NULL;
- __pyx_L0:;
- __Pyx_DECREF(__pyx_v_s);
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
- }
- /* "zmq/core/socket.pyx":707
- * return pickle.loads(s)
- *
- * def send_json(self, obj, flags=0): # <<<<<<<<<<<<<<
- * """s.send_json(obj, flags=0)
- *
- */
- static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_19send_json(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
- static char __pyx_doc_3zmq_4core_6socket_6Socket_19send_json[] = "s.send_json(obj, flags=0)\n\n Send a Python object as a message using json to serialize.\n\n Parameters\n ----------\n obj : Python object\n The Python object to send.\n flags : int\n Any valid send flag.\n ";
- static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_19send_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;
- PyObject *__pyx_t_2 = NULL;
- int __pyx_t_3;
- PyObject *__pyx_t_4 = NULL;
- int __pyx_t_5;
- struct __pyx_opt_args_3zmq_4core_6socket_6Socket_send __pyx_t_6;
- 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 > 0) {
- PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags);
- if (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 = 707; __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 = 707; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- __pyx_L3_error:;
- __Pyx_AddTraceback("zmq.core.socket.Socket.send_json");
- __Pyx_RefNannyFinishContext();
- return NULL;
- __pyx_L4_argument_unpacking_done:;
- __pyx_v_msg = Py_None; __Pyx_INCREF(Py_None);
- /* "zmq/core/socket.pyx":719
- * Any valid send flag.
- * """
- * if jsonapi.jsonmod is None: # <<<<<<<<<<<<<<
- * raise ImportError('jsonlib{1,2}, json or simplejson library is required.')
- * else:
- */
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__jsonapi); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__jsonmod); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_3 = (__pyx_t_2 == Py_None);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (__pyx_t_3) {
- /* "zmq/core/socket.pyx":720
- * """
- * if jsonapi.jsonmod is None:
- * raise ImportError('jsonlib{1,2}, json or simplejson library is required.') # <<<<<<<<<<<<<<
- * else:
- * msg = jsonapi.dumps(obj)
- */
- __pyx_t_2 = PyObject_Call(__pyx_builtin_ImportError, ((PyObject *)__pyx_k_tuple_31), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_Raise(__pyx_t_2, 0, 0);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L6;
- }
- /*else*/ {
- /* "zmq/core/socket.pyx":722
- * raise ImportError('jsonlib{1,2}, json or simplejson library is required.')
- * else:
- * msg = jsonapi.dumps(obj) # <<<<<<<<<<<<<<
- * return self.send(msg, flags)
- *
- */
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__jsonapi); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__dumps); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __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 = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_2));
- __Pyx_INCREF(__pyx_v_obj);
- PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_obj);
- __Pyx_GIVEREF(__pyx_v_obj);
- __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_v_msg);
- __pyx_v_msg = __pyx_t_4;
- __pyx_t_4 = 0;
- /* "zmq/core/socket.pyx":723
- * else:
- * msg = jsonapi.dumps(obj)
- * return self.send(msg, flags) # <<<<<<<<<<<<<<
- *
- * def recv_json(self, flags=0):
- */
- __Pyx_XDECREF(__pyx_r);
- __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_v_flags); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_6.__pyx_n = 1;
- __pyx_t_6.flags = __pyx_t_5;
- __pyx_t_4 = ((struct __pyx_vtabstruct_3zmq_4core_6socket_Socket *)((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->__pyx_vtab)->send(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self), __pyx_v_msg, 0, &__pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __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.core.socket.Socket.send_json");
- __pyx_r = NULL;
- __pyx_L0:;
- __Pyx_DECREF(__pyx_v_msg);
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
- }
- /* "zmq/core/socket.pyx":725
- * return self.send(msg, flags)
- *
- * def recv_json(self, flags=0): # <<<<<<<<<<<<<<
- * """s.recv_json(flags=0)
- *
- */
- static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_20recv_json(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
- static char __pyx_doc_3zmq_4core_6socket_6Socket_20recv_json[] = "s.recv_json(flags=0)\n\n Receive a Python object as a message using json to serialize.\n\n Parameters\n ----------\n flags : int\n Any valid recv flag.\n\n Returns\n -------\n obj : Python object\n The Python object that arrives as a message.\n ";
- static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_20recv_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;
- PyObject *__pyx_t_2 = NULL;
- int __pyx_t_3;
- int __pyx_t_4;
- struct __pyx_opt_args_3zmq_4core_6socket_6Socket_recv __pyx_t_5;
- PyObject *__pyx_t_6 = 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 > 0) {
- PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags);
- if (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 = 725; __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 = 725; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
- __pyx_L3_error:;
- __Pyx_AddTraceback("zmq.core.socket.Socket.recv_json");
- __Pyx_RefNannyFinishContext();
- return NULL;
- __pyx_L4_argument_unpacking_done:;
- __pyx_v_msg = Py_None; __Pyx_INCREF(Py_None);
- /* "zmq/core/socket.pyx":740
- * The Python object that arrives as a message.
- * """
- * if jsonapi.jsonmod is None: # <<<<<<<<<<<<<<
- * raise ImportError('jsonlib{1,2}, json or simplejson library is required.')
- * else:
- */
- __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__jsonapi); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__jsonmod); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_t_3 = (__pyx_t_2 == Py_None);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (__pyx_t_3) {
- /* "zmq/core/socket.pyx":741
- * """
- * if jsonapi.jsonmod is None:
- * raise ImportError('jsonlib{1,2}, json or simplejson library is required.') # <<<<<<<<<<<<<<
- * else:
- * msg = self.recv(flags)
- */
- __pyx_t_2 = PyObject_Call(__pyx_builtin_ImportError, ((PyObject *)__pyx_k_tuple_32), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_Raise(__pyx_t_2, 0, 0);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L6;
- }
- /*else*/ {
- /* "zmq/core/socket.pyx":743
- * raise ImportError('jsonlib{1,2}, json or simplejson library is required.')
- * else:
- * msg = self.recv(flags) # <<<<<<<<<<<<<<
- * return jsonapi.loads(msg)
- *
- */
- __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_v_flags); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_5.__pyx_n = 1;
- __pyx_t_5.flags = __pyx_t_4;
- __pyx_t_2 = ((struct __pyx_vtabstruct_3zmq_4core_6socket_Socket *)((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->__pyx_vtab)->recv(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self), 0, &__pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_v_msg);
- __pyx_v_msg = __pyx_t_2;
- __pyx_t_2 = 0;
- /* "zmq/core/socket.pyx":744
- * else:
- * msg = self.recv(flags)
- * return jsonapi.loads(msg) # <<<<<<<<<<<<<<
- *
- *
- */
- __Pyx_XDECREF(__pyx_r);
- __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__jsonapi); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__loads); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __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 = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_2));
- __Pyx_INCREF(__pyx_v_msg);
- PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_msg);
- __Pyx_GIVEREF(__pyx_v_msg);
- __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
- __pyx_r = __pyx_t_6;
- __pyx_t_6 = 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_6);
- __Pyx_AddTraceback("zmq.core.socket.Socket.recv_json");
- __pyx_r = NULL;
- __pyx_L0:;
- __Pyx_DECREF(__pyx_v_msg);
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
- }
- /* "zmq/core/socket.pxd":37
- *
- * cdef void *handle # The C handle for the underlying zmq object.
- * cdef public int socket_type # The 0MQ socket type - REQ,REP, etc. # <<<<<<<<<<<<<<
- * # Hold on to a reference to the context to make sure it is not garbage
- * # collected until the socket it done with it.
- */
- static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_11socket_type___get__(PyObject *__pyx_v_self); /*proto*/
- static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_11socket_type___get__(PyObject *__pyx_v_self) {
- PyObject *__pyx_r = NULL;
- PyObject *__pyx_t_1 = NULL;
- __Pyx_RefNannySetupContext("__get__");
- __Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->socket_type); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 37; __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.core.socket.Socket.socket_type.__get__");
- __pyx_r = NULL;
- __pyx_L0:;
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
- }
- static int __pyx_pf_3zmq_4core_6socket_6Socket_11socket_type_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
- static int __pyx_pf_3zmq_4core_6socket_6Socket_11socket_type_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
- int __pyx_r;
- int __pyx_t_1;
- __Pyx_RefNannySetupContext("__set__");
- __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- ((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->socket_type = __pyx_t_1;
- __pyx_r = 0;
- goto __pyx_L0;
- __pyx_L1_error:;
- __Pyx_AddTraceback("zmq.core.socket.Socket.socket_type.__set__");
- __pyx_r = -1;
- __pyx_L0:;
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
- }
- /* "zmq/core/socket.pxd":40
- * # 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 object context # The zmq Context object that owns this. # <<<<<<<<<<<<<<
- * cdef public object closed # bool property for a closed socket.
- *
- */
- static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_7context___get__(PyObject *__pyx_v_self); /*proto*/
- static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_7context___get__(PyObject *__pyx_v_self) {
- PyObject *__pyx_r = NULL;
- __Pyx_RefNannySetupContext("__get__");
- __Pyx_XDECREF(__pyx_r);
- __Pyx_INCREF(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->context);
- __pyx_r = ((struct __pyx_obj_3zmq_4core_6socket_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_4core_6socket_6Socket_7context_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
- static int __pyx_pf_3zmq_4core_6socket_6Socket_7context_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
- int __pyx_r;
- __Pyx_RefNannySetupContext("__set__");
- __Pyx_INCREF(__pyx_v_value);
- __Pyx_GIVEREF(__pyx_v_value);
- __Pyx_GOTREF(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->context);
- __Pyx_DECREF(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->context);
- ((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->context = __pyx_v_value;
- __pyx_r = 0;
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
- }
- static int __pyx_pf_3zmq_4core_6socket_6Socket_7context_2__del__(PyObject *__pyx_v_self); /*proto*/
- static int __pyx_pf_3zmq_4core_6socket_6Socket_7context_2__del__(PyObject *__pyx_v_self) {
- int __pyx_r;
- __Pyx_RefNannySetupContext("__del__");
- __Pyx_INCREF(Py_None);
- __Pyx_GIVEREF(Py_None);
- __Pyx_GOTREF(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->context);
- __Pyx_DECREF(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->context);
- ((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->context = Py_None;
- __pyx_r = 0;
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
- }
- /* "zmq/core/socket.pxd":41
- * # collected until the socket it done with it.
- * cdef public object context # The zmq Context object that owns this.
- * cdef public object closed # bool property for a closed socket. # <<<<<<<<<<<<<<
- *
- * # cpdef methods for direct-cython access:
- */
- static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_6closed___get__(PyObject *__pyx_v_self); /*proto*/
- static PyObject *__pyx_pf_3zmq_4core_6socket_6Socket_6closed___get__(PyObject *__pyx_v_self) {
- PyObject *__pyx_r = NULL;
- __Pyx_RefNannySetupContext("__get__");
- __Pyx_XDECREF(__pyx_r);
- __Pyx_INCREF(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->closed);
- __pyx_r = ((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->closed;
- 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_4core_6socket_6Socket_6closed_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
- static int __pyx_pf_3zmq_4core_6socket_6Socket_6closed_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
- int __pyx_r;
- __Pyx_RefNannySetupContext("__set__");
- __Pyx_INCREF(__pyx_v_value);
- __Pyx_GIVEREF(__pyx_v_value);
- __Pyx_GOTREF(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->closed);
- __Pyx_DECREF(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->closed);
- ((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->closed = __pyx_v_value;
- __pyx_r = 0;
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
- }
- static int __pyx_pf_3zmq_4core_6socket_6Socket_6closed_2__del__(PyObject *__pyx_v_self); /*proto*/
- static int __pyx_pf_3zmq_4core_6socket_6Socket_6closed_2__del__(PyObject *__pyx_v_self) {
- int __pyx_r;
- __Pyx_RefNannySetupContext("__del__");
- __Pyx_INCREF(Py_None);
- __Pyx_GIVEREF(Py_None);
- __Pyx_GOTREF(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->closed);
- __Pyx_DECREF(((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->closed);
- ((struct __pyx_obj_3zmq_4core_6socket_Socket *)__pyx_v_self)->closed = Py_None;
- __pyx_r = 0;
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
- }
- /* "buffers.pxd":74
- *
- *
- * cdef inline int newstyle_available(): # <<<<<<<<<<<<<<
- * return PY_MAJOR_VERSION >= 3 or (PY_MAJOR_VERSION >=2 and PY_MINOR_VERSION >= 6)
- *
- */
- static CYTHON_INLINE int __pyx_f_7buffers_newstyle_available(void) {
- int __pyx_r;
- int __pyx_t_1;
- int __pyx_t_2;
- int __pyx_t_3;
- int __pyx_t_4;
- __Pyx_RefNannySetupContext("newstyle_available");
- /* "buffers.pxd":75
- *
- * cdef inline int newstyle_available():
- * return PY_MAJOR_VERSION >= 3 or (PY_MAJOR_VERSION >=2 and PY_MINOR_VERSION >= 6) # <<<<<<<<<<<<<<
- *
- * cdef inline int memoryview_available():
- */
- __pyx_t_1 = (PY_MAJOR_VERSION >= 3);
- if (!__pyx_t_1) {
- __pyx_t_2 = (PY_MAJOR_VERSION >= 2);
- if (__pyx_t_2) {
- __pyx_t_3 = (PY_MINOR_VERSION >= 6);
- __pyx_t_4 = __pyx_t_3;
- } else {
- __pyx_t_4 = __pyx_t_2;
- }
- __pyx_t_2 = __pyx_t_4;
- } else {
- __pyx_t_2 = __pyx_t_1;
- }
- __pyx_r = __pyx_t_2;
- goto __pyx_L0;
- __pyx_r = 0;
- __pyx_L0:;
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
- }
- /* "buffers.pxd":77
- * return PY_MAJOR_VERSION >= 3 or (PY_MAJOR_VERSION >=2 and PY_MINOR_VERSION >= 6)
- *
- * cdef inline int memoryview_available(): # <<<<<<<<<<<<<<
- * return PY_MAJOR_VERSION >= 3 or (PY_MAJOR_VERSION >=2 and PY_MINOR_VERSION >= 7)
- *
- */
- static CYTHON_INLINE int __pyx_f_7buffers_memoryview_available(void) {
- int __pyx_r;
- int __pyx_t_1;
- int __pyx_t_2;
- int __pyx_t_3;
- int __pyx_t_4;
- __Pyx_RefNannySetupContext("memoryview_available");
- /* "buffers.pxd":78
- *
- * cdef inline int memoryview_available():
- * return PY_MAJOR_VERSION >= 3 or (PY_MAJOR_VERSION >=2 and PY_MINOR_VERSION >= 7) # <<<<<<<<<<<<<<
- *
- * cdef inline int oldstyle_available():
- */
- __pyx_t_1 = (PY_MAJOR_VERSION >= 3);
- if (!__pyx_t_1) {
- __pyx_t_2 = (PY_MAJOR_VERSION >= 2);
- if (__pyx_t_2) {
- __pyx_t_3 = (PY_MINOR_VERSION >= 7);
- __pyx_t_4 = __pyx_t_3;
- } else {
- __pyx_t_4 = __pyx_t_2;
- }
- __pyx_t_2 = __pyx_t_4;
- } else {
- __pyx_t_2 = __pyx_t_1;
- }
- __pyx_r = __pyx_t_2;
- goto __pyx_L0;
- __pyx_r = 0;
- __pyx_L0:;
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
- }
- /* "buffers.pxd":80
- * return PY_MAJOR_VERSION >= 3 or (PY_MAJOR_VERSION >=2 and PY_MINOR_VERSION >= 7)
- *
- * cdef inline int oldstyle_available(): # <<<<<<<<<<<<<<
- * return PY_MAJOR_VERSION < 3
- *
- */
- static CYTHON_INLINE int __pyx_f_7buffers_oldstyle_available(void) {
- int __pyx_r;
- __Pyx_RefNannySetupContext("oldstyle_available");
- /* "buffers.pxd":81
- *
- * cdef inline int oldstyle_available():
- * return PY_MAJOR_VERSION < 3 # <<<<<<<<<<<<<<
- *
- * cdef inline int check_buffer(object ob):
- */
- __pyx_r = (PY_MAJOR_VERSION < 3);
- goto __pyx_L0;
- __pyx_r = 0;
- __pyx_L0:;
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
- }
- /* "buffers.pxd":83
- * return PY_MAJOR_VERSION < 3
- *
- * cdef inline int check_buffer(object ob): # <<<<<<<<<<<<<<
- * """Version independent check for whether an object is a buffer.
- *
- */
- static CYTHON_INLINE int __pyx_f_7buffers_check_buffer(PyObject *__pyx_v_ob) {
- int __pyx_r;
- int __pyx_t_1;
- PyObject *__pyx_t_2 = NULL;
- long __pyx_t_3;
- __Pyx_RefNannySetupContext("check_buffer");
- /* "buffers.pxd":95
- * int : 0 if no buffer interface, 3 if newstyle buffer interface, 2 if oldstyle.
- * """
- * if newstyle_available(): # <<<<<<<<<<<<<<
- * if PyObject_CheckBuffer(ob):
- * return 3
- */
- __pyx_t_1 = __pyx_f_7buffers_newstyle_available();
- if (__pyx_t_1) {
- /* "buffers.pxd":96
- * """
- * if newstyle_available():
- * if PyObject_CheckBuffer(ob): # <<<<<<<<<<<<<<
- * return 3
- * if oldstyle_available():
- */
- __pyx_t_2 = __pyx_v_ob;
- __Pyx_INCREF(__pyx_t_2);
- __pyx_t_1 = PyObject_CheckBuffer(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (__pyx_t_1) {
- /* "buffers.pxd":97
- * if newstyle_available():
- * if PyObject_CheckBuffer(ob):
- * return 3 # <<<<<<<<<<<<<<
- * if oldstyle_available():
- * return PyObject_CheckReadBuffer(ob) and 2
- */
- __pyx_r = 3;
- goto __pyx_L0;
- goto __pyx_L4;
- }
- __pyx_L4:;
- goto __pyx_L3;
- }
- __pyx_L3:;
- /* "buffers.pxd":98
- * if PyObject_CheckBuffer(ob):
- * return 3
- * if oldstyle_available(): # <<<<<<<<<<<<<<
- * return PyObject_CheckReadBuffer(ob) and 2
- * return 0
- */
- __pyx_t_1 = __pyx_f_7buffers_oldstyle_available();
- if (__pyx_t_1) {
- /* "buffers.pxd":99
- * return 3
- * if oldstyle_available():
- * return PyObject_CheckReadBuffer(ob) and 2 # <<<<<<<<<<<<<<
- * return 0
- *
- */
- __pyx_t_2 = __pyx_v_ob;
- __Pyx_INCREF(__pyx_t_2);
- __pyx_t_1 = PyObject_CheckReadBuffer(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- if (__pyx_t_1) {
- __pyx_t_3 = 2;
- } else {
- __pyx_t_3 = __pyx_t_1;
- }
- __pyx_r = __pyx_t_3;
- goto __pyx_L0;
- goto __pyx_L5;
- }
- __pyx_L5:;
- /* "buffers.pxd":100
- * if oldstyle_available():
- * return PyObject_CheckReadBuffer(ob) and 2
- * return 0 # <<<<<<<<<<<<<<
- *
- *
- */
- __pyx_r = 0;
- goto __pyx_L0;
- __pyx_r = 0;
- __pyx_L0:;
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
- }
- /* "buffers.pxd":103
- *
- *
- * cdef inline object asbuffer(object ob, int writable, int format, # <<<<<<<<<<<<<<
- * void **base, Py_ssize_t *size,
- * Py_ssize_t *itemsize):
- */
- static CYTHON_INLINE PyObject *__pyx_f_7buffers_asbuffer(PyObject *__pyx_v_ob, int __pyx_v_writable, int __pyx_v_format, void **__pyx_v_base, Py_ssize_t *__pyx_v_size, Py_ssize_t *__pyx_v_itemsize) {
- void *__pyx_v_bptr;
- Py_ssize_t __pyx_v_blen;
- Py_ssize_t __pyx_v_bitemlen;
- PyObject *__pyx_v_bfmt = 0;
- Py_buffer __pyx_v_view;
- int __pyx_v_flags;
- int __pyx_v_mode;
- PyObject *__pyx_v_dtype;
- PyObject *__pyx_r = NULL;
- PyObject *__pyx_t_1 = NULL;
- int __pyx_t_2;
- PyObject *__pyx_t_3 = NULL;
- int __pyx_t_4;
- Py_ssize_t __pyx_t_5;
- PyObject *__pyx_t_6 = NULL;
- PyObject *__pyx_t_7 = NULL;
- PyObject *__pyx_t_8 = NULL;
- PyObject *__pyx_t_9 = NULL;
- PyObject *__pyx_t_10 = NULL;
- PyObject *__pyx_t_11 = NULL;
- __Pyx_RefNannySetupContext("asbuffer");
- __pyx_v_dtype = Py_None; __Pyx_INCREF(Py_None);
- /* "buffers.pxd":130
- * """
- *
- * cdef void *bptr = NULL # <<<<<<<<<<<<<<
- * cdef Py_ssize_t blen = 0, bitemlen = 0
- * cdef str bfmt = None
- */
- __pyx_v_bptr = NULL;
- /* "buffers.pxd":131
- *
- * cdef void *bptr = NULL
- * cdef Py_ssize_t blen = 0, bitemlen = 0 # <<<<<<<<<<<<<<
- * cdef str bfmt = None
- * cdef Py_buffer view
- */
- __pyx_v_blen = 0;
- __pyx_v_bitemlen = 0;
- /* "buffers.pxd":132
- * cdef void *bptr = NULL
- * cdef Py_ssize_t blen = 0, bitemlen = 0
- * cdef str bfmt = None # <<<<<<<<<<<<<<
- * cdef Py_buffer view
- * cdef int flags = PyBUF_SIMPLE
- */
- __Pyx_INCREF(Py_None);
- __pyx_v_bfmt = ((PyObject*)Py_None);
- /* "buffers.pxd":134
- * cdef str bfmt = None
- * cdef Py_buffer view
- * cdef int flags = PyBUF_SIMPLE # <<<<<<<<<<<<<<
- * cdef int mode = 0
- *
- */
- __pyx_v_flags = PyBUF_SIMPLE;
- /* "buffers.pxd":135
- * cdef Py_buffer view
- * cdef int flags = PyBUF_SIMPLE
- * cdef int mode = 0 # <<<<<<<<<<<<<<
- *
- * mode = check_buffer(ob)
- */
- __pyx_v_mode = 0;
- /* "buffers.pxd":137
- * cdef int mode = 0
- *
- * mode = check_buffer(ob) # <<<<<<<<<<<<<<
- * if mode == 0:
- * raise TypeError("%r does not provide a buffer interface."%ob)
- */
- __pyx_t_1 = __pyx_v_ob;
- __Pyx_INCREF(__pyx_t_1);
- __pyx_v_mode = __pyx_f_7buffers_check_buffer(__pyx_t_1);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "buffers.pxd":138
- *
- * mode = check_buffer(ob)
- * if mode == 0: # <<<<<<<<<<<<<<
- * raise TypeError("%r does not provide a buffer interface."%ob)
- *
- */
- __pyx_t_2 = (__pyx_v_mode == 0);
- if (__pyx_t_2) {
- /* "buffers.pxd":139
- * mode = check_buffer(ob)
- * if mode == 0:
- * raise TypeError("%r does not provide a buffer interface."%ob) # <<<<<<<<<<<<<<
- *
- * if mode == 3:
- */
- __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_33), __pyx_v_ob); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_1));
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_3));
- PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1));
- __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
- __pyx_t_1 = 0;
- __pyx_t_1 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
- __Pyx_Raise(__pyx_t_1, 0, 0);
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- {__pyx_filename = __pyx_f[2]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- goto __pyx_L3;
- }
- __pyx_L3:;
- /* "buffers.pxd":141
- * raise TypeError("%r does not provide a buffer interface."%ob)
- *
- * if mode == 3: # <<<<<<<<<<<<<<
- * flags = PyBUF_ANY_CONTIGUOUS
- * if writable:
- */
- __pyx_t_2 = (__pyx_v_mode == 3);
- if (__pyx_t_2) {
- /* "buffers.pxd":142
- *
- * if mode == 3:
- * flags = PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<<
- * if writable:
- * flags |= PyBUF_WRITABLE
- */
- __pyx_v_flags = PyBUF_ANY_CONTIGUOUS;
- /* "buffers.pxd":143
- * if mode == 3:
- * flags = PyBUF_ANY_CONTIGUOUS
- * if writable: # <<<<<<<<<<<<<<
- * flags |= PyBUF_WRITABLE
- * if format:
- */
- if (__pyx_v_writable) {
- /* "buffers.pxd":144
- * flags = PyBUF_ANY_CONTIGUOUS
- * if writable:
- * flags |= PyBUF_WRITABLE # <<<<<<<<<<<<<<
- * if format:
- * flags |= PyBUF_FORMAT
- */
- __pyx_v_flags = (__pyx_v_flags | PyBUF_WRITABLE);
- goto __pyx_L5;
- }
- __pyx_L5:;
- /* "buffers.pxd":145
- * if writable:
- * flags |= PyBUF_WRITABLE
- * if format: # <<<<<<<<<<<<<<
- * flags |= PyBUF_FORMAT
- * PyObject_GetBuffer(ob, &view, flags)
- */
- if (__pyx_v_format) {
- /* "buffers.pxd":146
- * flags |= PyBUF_WRITABLE
- * if format:
- * flags |= PyBUF_FORMAT # <<<<<<<<<<<<<<
- * PyObject_GetBuffer(ob, &view, flags)
- * bptr = view.buf
- */
- __pyx_v_flags = (__pyx_v_flags | PyBUF_FORMAT);
- goto __pyx_L6;
- }
- __pyx_L6:;
- /* "buffers.pxd":147
- * if format:
- * flags |= PyBUF_FORMAT
- * PyObject_GetBuffer(ob, &view, flags) # <<<<<<<<<<<<<<
- * bptr = view.buf
- * blen = view.len
- */
- __pyx_t_1 = __pyx_v_ob;
- __Pyx_INCREF(__pyx_t_1);
- __pyx_t_4 = PyObject_GetBuffer(__pyx_t_1, (&__pyx_v_view), __pyx_v_flags); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "buffers.pxd":148
- * flags |= PyBUF_FORMAT
- * PyObject_GetBuffer(ob, &view, flags)
- * bptr = view.buf # <<<<<<<<<<<<<<
- * blen = view.len
- * if format:
- */
- __pyx_v_bptr = __pyx_v_view.buf;
- /* "buffers.pxd":149
- * PyObject_GetBuffer(ob, &view, flags)
- * bptr = view.buf
- * blen = view.len # <<<<<<<<<<<<<<
- * if format:
- * if view.format != NULL:
- */
- __pyx_v_blen = __pyx_v_view.len;
- /* "buffers.pxd":150
- * bptr = view.buf
- * blen = view.len
- * if format: # <<<<<<<<<<<<<<
- * if view.format != NULL:
- * bfmt = view.format
- */
- if (__pyx_v_format) {
- /* "buffers.pxd":151
- * blen = view.len
- * if format:
- * if view.format != NULL: # <<<<<<<<<<<<<<
- * bfmt = view.format
- * bitemlen = view.itemsize
- */
- __pyx_t_2 = (__pyx_v_view.format != NULL);
- if (__pyx_t_2) {
- /* "buffers.pxd":152
- * if format:
- * if view.format != NULL:
- * bfmt = view.format # <<<<<<<<<<<<<<
- * bitemlen = view.itemsize
- * PyBuffer_Release(&view)
- */
- __pyx_t_1 = PyBytes_FromString(__pyx_v_view.format); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_1));
- if (!(likely(PyString_CheckExact(((PyObject *)__pyx_t_1)))||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(((PyObject *)__pyx_t_1))->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(((PyObject *)__pyx_v_bfmt));
- __pyx_v_bfmt = ((PyObject*)__pyx_t_1);
- __pyx_t_1 = 0;
- /* "buffers.pxd":153
- * if view.format != NULL:
- * bfmt = view.format
- * bitemlen = view.itemsize # <<<<<<<<<<<<<<
- * PyBuffer_Release(&view)
- * else: # oldstyle
- */
- __pyx_v_bitemlen = __pyx_v_view.itemsize;
- goto __pyx_L8;
- }
- __pyx_L8:;
- goto __pyx_L7;
- }
- __pyx_L7:;
- /* "buffers.pxd":154
- * bfmt = view.format
- * bitemlen = view.itemsize
- * PyBuffer_Release(&view) # <<<<<<<<<<<<<<
- * else: # oldstyle
- * if writable:
- */
- PyBuffer_Release((&__pyx_v_view));
- goto __pyx_L4;
- }
- /*else*/ {
- /* "buffers.pxd":156
- * PyBuffer_Release(&view)
- * else: # oldstyle
- * if writable: # <<<<<<<<<<<<<<
- * PyObject_AsWriteBuffer(ob, &bptr, &blen)
- * else:
- */
- if (__pyx_v_writable) {
- /* "buffers.pxd":157
- * else: # oldstyle
- * if writable:
- * PyObject_AsWriteBuffer(ob, &bptr, &blen) # <<<<<<<<<<<<<<
- * else:
- * PyObject_AsReadBuffer(ob, <const_void **>&bptr, &blen)
- */
- __pyx_t_1 = __pyx_v_ob;
- __Pyx_INCREF(__pyx_t_1);
- __pyx_t_4 = PyObject_AsWriteBuffer(__pyx_t_1, (&__pyx_v_bptr), (&__pyx_v_blen)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- goto __pyx_L9;
- }
- /*else*/ {
- /* "buffers.pxd":159
- * PyObject_AsWriteBuffer(ob, &bptr, &blen)
- * else:
- * PyObject_AsReadBuffer(ob, <const_void **>&bptr, &blen) # <<<<<<<<<<<<<<
- * if format:
- * try: # numpy.ndarray
- */
- __pyx_t_1 = __pyx_v_ob;
- __Pyx_INCREF(__pyx_t_1);
- __pyx_t_4 = PyObject_AsReadBuffer(__pyx_t_1, ((const void **)(&__pyx_v_bptr)), (&__pyx_v_blen)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- }
- __pyx_L9:;
- /* "buffers.pxd":160
- * else:
- * PyObject_AsReadBuffer(ob, <const_void **>&bptr, &blen)
- * if format: # <<<<<<<<<<<<<<
- * try: # numpy.ndarray
- * dtype = ob.dtype
- */
- if (__pyx_v_format) {
- /* "buffers.pxd":161
- * PyObject_AsReadBuffer(ob, <const_void **>&bptr, &blen)
- * if format:
- * try: # numpy.ndarray # <<<<<<<<<<<<<<
- * dtype = ob.dtype
- * bfmt = dtype.char
- */
- {
- 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:*/ {
- /* "buffers.pxd":162
- * if format:
- * try: # numpy.ndarray
- * dtype = ob.dtype # <<<<<<<<<<<<<<
- * bfmt = dtype.char
- * bitemlen = dtype.itemsize
- */
- __pyx_t_1 = PyObject_GetAttr(__pyx_v_ob, __pyx_n_s__dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_DECREF(__pyx_v_dtype);
- __pyx_v_dtype = __pyx_t_1;
- __pyx_t_1 = 0;
- /* "buffers.pxd":163
- * try: # numpy.ndarray
- * dtype = ob.dtype
- * bfmt = dtype.char # <<<<<<<<<<<<<<
- * bitemlen = dtype.itemsize
- * except AttributeError:
- */
- __pyx_t_1 = PyObject_GetAttr(__pyx_v_dtype, __pyx_n_s__char); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
- __Pyx_GOTREF(__pyx_t_1);
- if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
- __Pyx_DECREF(((PyObject *)__pyx_v_bfmt));
- __pyx_v_bfmt = ((PyObject*)__pyx_t_1);
- __pyx_t_1 = 0;
- /* "buffers.pxd":164
- * dtype = ob.dtype
- * bfmt = dtype.char
- * bitemlen = dtype.itemsize # <<<<<<<<<<<<<<
- * except AttributeError:
- * try: # array.array
- */
- __pyx_t_1 = PyObject_GetAttr(__pyx_v_dtype, __pyx_n_s__itemsize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L11_error;}
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __pyx_v_bitemlen = __pyx_t_5;
- }
- __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_L18_try_end;
- __pyx_L11_error:;
- __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "buffers.pxd":165
- * bfmt = dtype.char
- * bitemlen = dtype.itemsize
- * except AttributeError: # <<<<<<<<<<<<<<
- * try: # array.array
- * bfmt = ob.typecode
- */
- __pyx_t_4 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
- if (__pyx_t_4) {
- __Pyx_AddTraceback("buffers.asbuffer");
- if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L13_except_error;}
- __Pyx_GOTREF(__pyx_t_1);
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_GOTREF(__pyx_t_6);
- /* "buffers.pxd":166
- * bitemlen = dtype.itemsize
- * except AttributeError:
- * try: # array.array # <<<<<<<<<<<<<<
- * bfmt = ob.typecode
- * bitemlen = ob.itemsize
- */
- {
- 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:*/ {
- /* "buffers.pxd":167
- * except AttributeError:
- * try: # array.array
- * bfmt = ob.typecode # <<<<<<<<<<<<<<
- * bitemlen = ob.itemsize
- * except AttributeError:
- */
- __pyx_t_7 = PyObject_GetAttr(__pyx_v_ob, __pyx_n_s__typecode); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L21_error;}
- __Pyx_GOTREF(__pyx_t_7);
- if (!(likely(PyString_CheckExact(__pyx_t_7))||((__pyx_t_7) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_7)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L21_error;}
- __Pyx_DECREF(((PyObject *)__pyx_v_bfmt));
- __pyx_v_bfmt = ((PyObject*)__pyx_t_7);
- __pyx_t_7 = 0;
- /* "buffers.pxd":168
- * try: # array.array
- * bfmt = ob.typecode
- * bitemlen = ob.itemsize # <<<<<<<<<<<<<<
- * except AttributeError:
- * if isinstance(ob, bytes):
- */
- __pyx_t_7 = PyObject_GetAttr(__pyx_v_ob, __pyx_n_s__itemsize); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L21_error;}
- __Pyx_GOTREF(__pyx_t_7);
- __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_7); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L21_error;}
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- __pyx_v_bitemlen = __pyx_t_5;
- }
- __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_L28_try_end;
- __pyx_L21_error:;
- __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
- /* "buffers.pxd":169
- * bfmt = ob.typecode
- * bitemlen = ob.itemsize
- * except AttributeError: # <<<<<<<<<<<<<<
- * if isinstance(ob, bytes):
- * bfmt = "B"
- */
- __pyx_t_4 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
- if (__pyx_t_4) {
- __Pyx_AddTraceback("buffers.asbuffer");
- if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L23_except_error;}
- __Pyx_GOTREF(__pyx_t_7);
- __Pyx_GOTREF(__pyx_t_8);
- __Pyx_GOTREF(__pyx_t_9);
- /* "buffers.pxd":170
- * bitemlen = ob.itemsize
- * except AttributeError:
- * if isinstance(ob, bytes): # <<<<<<<<<<<<<<
- * bfmt = "B"
- * bitemlen = 1
- */
- __pyx_t_10 = __pyx_v_ob;
- __Pyx_INCREF(__pyx_t_10);
- __pyx_t_11 = ((PyObject *)((PyObject*)(&PyBytes_Type)));
- __Pyx_INCREF(__pyx_t_11);
- __pyx_t_2 = __Pyx_TypeCheck(__pyx_t_10, __pyx_t_11);
- __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
- __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
- if (__pyx_t_2) {
- /* "buffers.pxd":171
- * except AttributeError:
- * if isinstance(ob, bytes):
- * bfmt = "B" # <<<<<<<<<<<<<<
- * bitemlen = 1
- * else:
- */
- __Pyx_INCREF(((PyObject *)__pyx_n_s__B));
- __Pyx_DECREF(((PyObject *)__pyx_v_bfmt));
- __pyx_v_bfmt = __pyx_n_s__B;
- /* "buffers.pxd":172
- * if isinstance(ob, bytes):
- * bfmt = "B"
- * bitemlen = 1 # <<<<<<<<<<<<<<
- * else:
- * # nothing found
- */
- __pyx_v_bitemlen = 1;
- goto __pyx_L31;
- }
- /*else*/ {
- /* "buffers.pxd":175
- * else:
- * # nothing found
- * bfmt = None # <<<<<<<<<<<<<<
- * bitemlen = 0
- * if base: base[0] = <void *>bptr
- */
- __Pyx_INCREF(Py_None);
- __Pyx_DECREF(((PyObject *)__pyx_v_bfmt));
- __pyx_v_bfmt = ((PyObject*)Py_None);
- /* "buffers.pxd":176
- * # nothing found
- * bfmt = None
- * bitemlen = 0 # <<<<<<<<<<<<<<
- * if base: base[0] = <void *>bptr
- * if size: size[0] = <Py_ssize_t>blen
- */
- __pyx_v_bitemlen = 0;
- }
- __pyx_L31:;
- __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
- goto __pyx_L22_exception_handled;
- }
- __pyx_L23_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_L13_except_error;
- __pyx_L22_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_L28_try_end:;
- }
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- goto __pyx_L12_exception_handled;
- }
- __pyx_L13_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_L12_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_L18_try_end:;
- }
- goto __pyx_L10;
- }
- __pyx_L10:;
- }
- __pyx_L4:;
- /* "buffers.pxd":177
- * bfmt = None
- * bitemlen = 0
- * if base: base[0] = <void *>bptr # <<<<<<<<<<<<<<
- * if size: size[0] = <Py_ssize_t>blen
- * if itemsize: itemsize[0] = <Py_ssize_t>bitemlen
- */
- __pyx_t_2 = (__pyx_v_base != 0);
- if (__pyx_t_2) {
- (__pyx_v_base[0]) = ((void *)__pyx_v_bptr);
- goto __pyx_L32;
- }
- __pyx_L32:;
- /* "buffers.pxd":178
- * bitemlen = 0
- * if base: base[0] = <void *>bptr
- * if size: size[0] = <Py_ssize_t>blen # <<<<<<<<<<<<<<
- * if itemsize: itemsize[0] = <Py_ssize_t>bitemlen
- * return bfmt
- */
- __pyx_t_2 = (__pyx_v_size != 0);
- if (__pyx_t_2) {
- (__pyx_v_size[0]) = __pyx_v_blen;
- goto __pyx_L33;
- }
- __pyx_L33:;
- /* "buffers.pxd":179
- * if base: base[0] = <void *>bptr
- * if size: size[0] = <Py_ssize_t>blen
- * if itemsize: itemsize[0] = <Py_ssize_t>bitemlen # <<<<<<<<<<<<<<
- * return bfmt
- *
- */
- __pyx_t_2 = (__pyx_v_itemsize != 0);
- if (__pyx_t_2) {
- (__pyx_v_itemsize[0]) = __pyx_v_bitemlen;
- goto __pyx_L34;
- }
- __pyx_L34:;
- /* "buffers.pxd":180
- * if size: size[0] = <Py_ssize_t>blen
- * if itemsize: itemsize[0] = <Py_ssize_t>bitemlen
- * return bfmt # <<<<<<<<<<<<<<
- *
- *
- */
- __Pyx_XDECREF(__pyx_r);
- __Pyx_INCREF(((PyObject *)__pyx_v_bfmt));
- __pyx_r = ((PyObject *)__pyx_v_bfmt);
- 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_6);
- __Pyx_XDECREF(__pyx_t_7);
- __Pyx_XDECREF(__pyx_t_8);
- __Pyx_XDECREF(__pyx_t_9);
- __Pyx_XDECREF(__pyx_t_10);
- __Pyx_XDECREF(__pyx_t_11);
- __Pyx_AddTraceback("buffers.asbuffer");
- __pyx_r = 0;
- __pyx_L0:;
- __Pyx_XDECREF(__pyx_v_bfmt);
- __Pyx_DECREF(__pyx_v_dtype);
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
- }
- /* "buffers.pxd":183
- *
- *
- * cdef inline object asbuffer_r(object ob, void **base, Py_ssize_t *size): # <<<<<<<<<<<<<<
- * """Wrapper for standard calls to asbuffer with a readonly buffer."""
- * asbuffer(ob, 0, 0, base, size, NULL)
- */
- static CYTHON_INLINE PyObject *__pyx_f_7buffers_asbuffer_r(PyObject *__pyx_v_ob, void **__pyx_v_base, Py_ssize_t *__pyx_v_size) {
- PyObject *__pyx_r = NULL;
- PyObject *__pyx_t_1 = NULL;
- PyObject *__pyx_t_2 = NULL;
- __Pyx_RefNannySetupContext("asbuffer_r");
- /* "buffers.pxd":185
- * cdef inline object asbuffer_r(object ob, void **base, Py_ssize_t *size):
- * """Wrapper for standard calls to asbuffer with a readonly buffer."""
- * asbuffer(ob, 0, 0, base, size, NULL) # <<<<<<<<<<<<<<
- * return ob
- *
- */
- __pyx_t_1 = __pyx_v_ob;
- __Pyx_INCREF(__pyx_t_1);
- __pyx_t_2 = __pyx_f_7buffers_asbuffer(__pyx_t_1, 0, 0, __pyx_v_base, __pyx_v_size, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 185; __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;
- /* "buffers.pxd":186
- * """Wrapper for standard calls to asbuffer with a readonly buffer."""
- * asbuffer(ob, 0, 0, base, size, NULL)
- * return ob # <<<<<<<<<<<<<<
- *
- *
- */
- __Pyx_XDECREF(__pyx_r);
- __Pyx_INCREF(__pyx_v_ob);
- __pyx_r = __pyx_v_ob;
- 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("buffers.asbuffer_r");
- __pyx_r = 0;
- __pyx_L0:;
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
- }
- /* "buffers.pxd":189
- *
- *
- * cdef inline object asbuffer_w(object ob, void **base, Py_ssize_t *size): # <<<<<<<<<<<<<<
- * """Wrapper for standard calls to asbuffer with a writable buffer."""
- * asbuffer(ob, 1, 0, base, size, NULL)
- */
- static CYTHON_INLINE PyObject *__pyx_f_7buffers_asbuffer_w(PyObject *__pyx_v_ob, void **__pyx_v_base, Py_ssize_t *__pyx_v_size) {
- PyObject *__pyx_r = NULL;
- PyObject *__pyx_t_1 = NULL;
- PyObject *__pyx_t_2 = NULL;
- __Pyx_RefNannySetupContext("asbuffer_w");
- /* "buffers.pxd":191
- * cdef inline object asbuffer_w(object ob, void **base, Py_ssize_t *size):
- * """Wrapper for standard calls to asbuffer with a writable buffer."""
- * asbuffer(ob, 1, 0, base, size, NULL) # <<<<<<<<<<<<<<
- * return ob
- *
- */
- __pyx_t_1 = __pyx_v_ob;
- __Pyx_INCREF(__pyx_t_1);
- __pyx_t_2 = __pyx_f_7buffers_asbuffer(__pyx_t_1, 1, 0, __pyx_v_base, __pyx_v_size, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 191; __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;
- /* "buffers.pxd":192
- * """Wrapper for standard calls to asbuffer with a writable buffer."""
- * asbuffer(ob, 1, 0, base, size, NULL)
- * return ob # <<<<<<<<<<<<<<
- *
- * #------------------------------------------------------------------------------
- */
- __Pyx_XDECREF(__pyx_r);
- __Pyx_INCREF(__pyx_v_ob);
- __pyx_r = __pyx_v_ob;
- 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("buffers.asbuffer_w");
- __pyx_r = 0;
- __pyx_L0:;
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
- }
- /* "buffers.pxd":198
- * #------------------------------------------------------------------------------
- *
- * cdef inline object frombuffer_3(void *ptr, Py_ssize_t s, int readonly): # <<<<<<<<<<<<<<
- * """Python 3 version of frombuffer.
- *
- */
- static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer_3(void *__pyx_v_ptr, Py_ssize_t __pyx_v_s, int __pyx_v_readonly) {
- Py_buffer __pyx_v_pybuf;
- Py_ssize_t *__pyx_v_shape;
- PyObject *__pyx_v_astr = 0;
- PyObject *__pyx_r = NULL;
- Py_ssize_t __pyx_t_1[1];
- int __pyx_t_2;
- PyObject *__pyx_t_3 = NULL;
- __Pyx_RefNannySetupContext("frombuffer_3");
- /* "buffers.pxd":205
- * """
- * cdef Py_buffer pybuf
- * cdef Py_ssize_t *shape = [s] # <<<<<<<<<<<<<<
- * cdef str astr=""
- * if newstyle_available():
- */
- __pyx_t_1[0] = __pyx_v_s;
- __pyx_v_shape = __pyx_t_1;
- /* "buffers.pxd":206
- * cdef Py_buffer pybuf
- * cdef Py_ssize_t *shape = [s]
- * cdef str astr="" # <<<<<<<<<<<<<<
- * if newstyle_available():
- * PyBuffer_FillInfo(&pybuf, astr, ptr, s, readonly, PyBUF_SIMPLE)
- */
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_34));
- __pyx_v_astr = __pyx_kp_s_34;
- /* "buffers.pxd":207
- * cdef Py_ssize_t *shape = [s]
- * cdef str astr=""
- * if newstyle_available(): # <<<<<<<<<<<<<<
- * PyBuffer_FillInfo(&pybuf, astr, ptr, s, readonly, PyBUF_SIMPLE)
- * pybuf.format = "B"
- */
- __pyx_t_2 = __pyx_f_7buffers_newstyle_available();
- if (__pyx_t_2) {
- /* "buffers.pxd":208
- * cdef str astr=""
- * if newstyle_available():
- * PyBuffer_FillInfo(&pybuf, astr, ptr, s, readonly, PyBUF_SIMPLE) # <<<<<<<<<<<<<<
- * pybuf.format = "B"
- * pybuf.shape = shape
- */
- __pyx_t_2 = PyBuffer_FillInfo((&__pyx_v_pybuf), ((PyObject *)__pyx_v_astr), __pyx_v_ptr, __pyx_v_s, __pyx_v_readonly, PyBUF_SIMPLE); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /* "buffers.pxd":209
- * if newstyle_available():
- * PyBuffer_FillInfo(&pybuf, astr, ptr, s, readonly, PyBUF_SIMPLE)
- * pybuf.format = "B" # <<<<<<<<<<<<<<
- * pybuf.shape = shape
- * return PyMemoryView_FromBuffer(&pybuf)
- */
- __pyx_v_pybuf.format = __pyx_k__B;
- /* "buffers.pxd":210
- * PyBuffer_FillInfo(&pybuf, astr, ptr, s, readonly, PyBUF_SIMPLE)
- * pybuf.format = "B"
- * pybuf.shape = shape # <<<<<<<<<<<<<<
- * return PyMemoryView_FromBuffer(&pybuf)
- * else:
- */
- __pyx_v_pybuf.shape = __pyx_v_shape;
- /* "buffers.pxd":211
- * pybuf.format = "B"
- * pybuf.shape = shape
- * return PyMemoryView_FromBuffer(&pybuf) # <<<<<<<<<<<<<<
- * else:
- * raise NotImplementedError("New style buffers not available.")
- */
- __Pyx_XDECREF(__pyx_r);
- __pyx_t_3 = PyMemoryView_FromBuffer((&__pyx_v_pybuf)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_r = __pyx_t_3;
- __pyx_t_3 = 0;
- goto __pyx_L0;
- goto __pyx_L3;
- }
- /*else*/ {
- /* "buffers.pxd":213
- * return PyMemoryView_FromBuffer(&pybuf)
- * else:
- * raise NotImplementedError("New style buffers not available.") # <<<<<<<<<<<<<<
- *
- *
- */
- __pyx_t_3 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_k_tuple_36), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_Raise(__pyx_t_3, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- {__pyx_filename = __pyx_f[2]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
- __pyx_L3:;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
- __pyx_L1_error:;
- __Pyx_XDECREF(__pyx_t_3);
- __Pyx_AddTraceback("buffers.frombuffer_3");
- __pyx_r = 0;
- __pyx_L0:;
- __Pyx_XDECREF(__pyx_v_astr);
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
- }
- /* "buffers.pxd":216
- *
- *
- * cdef inline object frombuffer_2(void *ptr, Py_ssize_t s, int readonly): # <<<<<<<<<<<<<<
- * """Python 2 version of frombuffer.
- *
- */
- static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer_2(void *__pyx_v_ptr, Py_ssize_t __pyx_v_s, int __pyx_v_readonly) {
- PyObject *__pyx_r = NULL;
- int __pyx_t_1;
- PyObject *__pyx_t_2 = NULL;
- __Pyx_RefNannySetupContext("frombuffer_2");
- /* "buffers.pxd":222
- * """
- *
- * if oldstyle_available(): # <<<<<<<<<<<<<<
- * if readonly:
- * return PyBuffer_FromMemory(ptr, s)
- */
- __pyx_t_1 = __pyx_f_7buffers_oldstyle_available();
- if (__pyx_t_1) {
- /* "buffers.pxd":223
- *
- * if oldstyle_available():
- * if readonly: # <<<<<<<<<<<<<<
- * return PyBuffer_FromMemory(ptr, s)
- * else:
- */
- if (__pyx_v_readonly) {
- /* "buffers.pxd":224
- * if oldstyle_available():
- * if readonly:
- * return PyBuffer_FromMemory(ptr, s) # <<<<<<<<<<<<<<
- * else:
- * return PyBuffer_FromReadWriteMemory(ptr, s)
- */
- __Pyx_XDECREF(__pyx_r);
- __pyx_t_2 = PyBuffer_FromMemory(__pyx_v_ptr, __pyx_v_s); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 224; __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_L4;
- }
- /*else*/ {
- /* "buffers.pxd":226
- * return PyBuffer_FromMemory(ptr, s)
- * else:
- * return PyBuffer_FromReadWriteMemory(ptr, s) # <<<<<<<<<<<<<<
- * else:
- * raise NotImplementedError("Old style buffers not available.")
- */
- __Pyx_XDECREF(__pyx_r);
- __pyx_t_2 = PyBuffer_FromReadWriteMemory(__pyx_v_ptr, __pyx_v_s); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 226; __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_L4:;
- goto __pyx_L3;
- }
- /*else*/ {
- /* "buffers.pxd":228
- * return PyBuffer_FromReadWriteMemory(ptr, s)
- * else:
- * raise NotImplementedError("Old style buffers not available.") # <<<<<<<<<<<<<<
- *
- *
- */
- __pyx_t_2 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_k_tuple_38), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_Raise(__pyx_t_2, 0, 0);
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- {__pyx_filename = __pyx_f[2]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- }
- __pyx_L3:;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
- __pyx_L1_error:;
- __Pyx_XDECREF(__pyx_t_2);
- __Pyx_AddTraceback("buffers.frombuffer_2");
- __pyx_r = 0;
- __pyx_L0:;
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
- }
- /* "buffers.pxd":231
- *
- *
- * cdef inline object frombuffer(void *ptr, Py_ssize_t s, int readonly): # <<<<<<<<<<<<<<
- * """Create a Python Buffer/View of a C array.
- *
- */
- static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer(void *__pyx_v_ptr, Py_ssize_t __pyx_v_s, int __pyx_v_readonly) {
- PyObject *__pyx_r = NULL;
- int __pyx_t_1;
- PyObject *__pyx_t_2 = NULL;
- __Pyx_RefNannySetupContext("frombuffer");
- /* "buffers.pxd":248
- * """
- * # oldstyle first priority for now
- * if oldstyle_available(): # <<<<<<<<<<<<<<
- * return frombuffer_2(ptr, s, readonly)
- * else:
- */
- __pyx_t_1 = __pyx_f_7buffers_oldstyle_available();
- if (__pyx_t_1) {
- /* "buffers.pxd":249
- * # oldstyle first priority for now
- * if oldstyle_available():
- * return frombuffer_2(ptr, s, readonly) # <<<<<<<<<<<<<<
- * else:
- * return frombuffer_3(ptr, s, readonly)
- */
- __Pyx_XDECREF(__pyx_r);
- __pyx_t_2 = __pyx_f_7buffers_frombuffer_2(__pyx_v_ptr, __pyx_v_s, __pyx_v_readonly); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 249; __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_L3;
- }
- /*else*/ {
- /* "buffers.pxd":251
- * return frombuffer_2(ptr, s, readonly)
- * else:
- * return frombuffer_3(ptr, s, readonly) # <<<<<<<<<<<<<<
- *
- *
- */
- __Pyx_XDECREF(__pyx_r);
- __pyx_t_2 = __pyx_f_7buffers_frombuffer_3(__pyx_v_ptr, __pyx_v_s, __pyx_v_readonly); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 251; __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_L3:;
- __pyx_r = Py_None; __Pyx_INCREF(Py_None);
- goto __pyx_L0;
- __pyx_L1_error:;
- __Pyx_XDECREF(__pyx_t_2);
- __Pyx_AddTraceback("buffers.frombuffer");
- __pyx_r = 0;
- __pyx_L0:;
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
- }
- /* "buffers.pxd":254
- *
- *
- * cdef inline object frombuffer_r(void *ptr, Py_ssize_t s): # <<<<<<<<<<<<<<
- * """Wrapper for readonly view frombuffer."""
- * return frombuffer(ptr, s, 1)
- */
- static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer_r(void *__pyx_v_ptr, Py_ssize_t __pyx_v_s) {
- PyObject *__pyx_r = NULL;
- PyObject *__pyx_t_1 = NULL;
- __Pyx_RefNannySetupContext("frombuffer_r");
- /* "buffers.pxd":256
- * cdef inline object frombuffer_r(void *ptr, Py_ssize_t s):
- * """Wrapper for readonly view frombuffer."""
- * return frombuffer(ptr, s, 1) # <<<<<<<<<<<<<<
- *
- *
- */
- __Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __pyx_f_7buffers_frombuffer(__pyx_v_ptr, __pyx_v_s, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 256; __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("buffers.frombuffer_r");
- __pyx_r = 0;
- __pyx_L0:;
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
- }
- /* "buffers.pxd":259
- *
- *
- * cdef inline object frombuffer_w(void *ptr, Py_ssize_t s): # <<<<<<<<<<<<<<
- * """Wrapper for writable view frombuffer."""
- * return frombuffer(ptr, s, 0)
- */
- static CYTHON_INLINE PyObject *__pyx_f_7buffers_frombuffer_w(void *__pyx_v_ptr, Py_ssize_t __pyx_v_s) {
- PyObject *__pyx_r = NULL;
- PyObject *__pyx_t_1 = NULL;
- __Pyx_RefNannySetupContext("frombuffer_w");
- /* "buffers.pxd":261
- * cdef inline object frombuffer_w(void *ptr, Py_ssize_t s):
- * """Wrapper for writable view frombuffer."""
- * return frombuffer(ptr, s, 0) # <<<<<<<<<<<<<<
- *
- * #------------------------------------------------------------------------------
- */
- __Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __pyx_f_7buffers_frombuffer(__pyx_v_ptr, __pyx_v_s, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 261; __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("buffers.frombuffer_w");
- __pyx_r = 0;
- __pyx_L0:;
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
- }
- /* "buffers.pxd":268
- * #------------------------------------------------------------------------------
- *
- * cdef inline object viewfromobject(object obj, int readonly): # <<<<<<<<<<<<<<
- * """Construct a Python Buffer/View object from another Python object.
- *
- */
- static CYTHON_INLINE PyObject *__pyx_f_7buffers_viewfromobject(PyObject *__pyx_v_obj, int __pyx_v_readonly) {
- PyObject *__pyx_r = NULL;
- int __pyx_t_1;
- PyObject *__pyx_t_2 = NULL;
- PyObject *__pyx_t_3 = NULL;
- __Pyx_RefNannySetupContext("viewfromobject");
- /* "buffers.pxd":284
- * Buffer/View of the original object.
- * """
- * if not memoryview_available(): # <<<<<<<<<<<<<<
- * if readonly:
- * return PyBuffer_FromObject(obj, 0, Py_END_OF_BUFFER)
- */
- __pyx_t_1 = (!__pyx_f_7buffers_memoryview_available());
- if (__pyx_t_1) {
- /* "buffers.pxd":285
- * """
- * if not memoryview_available():
- * if readonly: # <<<<<<<<<<<<<<
- * return PyBuffer_FromObject(obj, 0, Py_END_OF_BUFFER)
- * else:
- */
- if (__pyx_v_readonly) {
- /* "buffers.pxd":286
- * if not memoryview_available():
- * if readonly:
- * return PyBuffer_FromObject(obj, 0, Py_END_OF_BUFFER) # <<<<<<<<<<<<<<
- * else:
- * return PyBuffer_FromReadWriteObject(obj, 0, Py_END_OF_BUFFER)
- */
- __Pyx_XDECREF(__pyx_r);
- __pyx_t_2 = __pyx_v_obj;
- __Pyx_INCREF(__pyx_t_2);
- __pyx_t_3 = PyBuffer_FromObject(__pyx_t_2, 0, Py_END_OF_BUFFER); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 286; __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;
- goto __pyx_L4;
- }
- /*else*/ {
- /* "buffers.pxd":288
- * return PyBuffer_FromObject(obj, 0, Py_END_OF_BUFFER)
- * else:
- * return PyBuffer_FromReadWriteObject(obj, 0, Py_END_OF_BUFFER) # <<<<<<<<<<<<<<
- * else:
- * return PyMemoryView_FromObject(obj)
- */
- __Pyx_XDECREF(__pyx_r);
- __pyx_t_3 = __pyx_v_obj;
- __Pyx_INCREF(__pyx_t_3);
- __pyx_t_2 = PyBuffer_FromReadWriteObject(__pyx_t_3, 0, Py_END_OF_BUFFER); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_r = __pyx_t_2;
- __pyx_t_2 = 0;
- goto __pyx_L0;
- }
- __pyx_L4:;
- goto __pyx_L3;
- }
- /*else*/ {
- /* "buffers.pxd":290
- * return PyBuffer_FromReadWriteObject(obj, 0, Py_END_OF_BUFFER)
- * else:
- * return PyMemoryView_FromObject(obj) # <<<<<<<<<<<<<<
- *
- *
- */
- __Pyx_XDECREF(__pyx_r);
- __pyx_t_2 = __pyx_v_obj;
- __Pyx_INCREF(__pyx_t_2);
- __pyx_t_3 = PyMemoryView_FromObject(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 290; __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_L3:;
- __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("buffers.viewfromobject");
- __pyx_r = 0;
- __pyx_L0:;
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
- }
- /* "buffers.pxd":293
- *
- *
- * cdef inline object viewfromobject_r(object obj): # <<<<<<<<<<<<<<
- * """Wrapper for readonly viewfromobject."""
- * return viewfromobject(obj, 1)
- */
- static CYTHON_INLINE PyObject *__pyx_f_7buffers_viewfromobject_r(PyObject *__pyx_v_obj) {
- PyObject *__pyx_r = NULL;
- PyObject *__pyx_t_1 = NULL;
- PyObject *__pyx_t_2 = NULL;
- __Pyx_RefNannySetupContext("viewfromobject_r");
- /* "buffers.pxd":295
- * cdef inline object viewfromobject_r(object obj):
- * """Wrapper for readonly viewfromobject."""
- * return viewfromobject(obj, 1) # <<<<<<<<<<<<<<
- *
- *
- */
- __Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __pyx_v_obj;
- __Pyx_INCREF(__pyx_t_1);
- __pyx_t_2 = __pyx_f_7buffers_viewfromobject(__pyx_t_1, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __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_AddTraceback("buffers.viewfromobject_r");
- __pyx_r = 0;
- __pyx_L0:;
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
- }
- /* "buffers.pxd":298
- *
- *
- * cdef inline object viewfromobject_w(object obj): # <<<<<<<<<<<<<<
- * """Wrapper for writable viewfromobject."""
- * return viewfromobject(obj, 0)
- */
- static CYTHON_INLINE PyObject *__pyx_f_7buffers_viewfromobject_w(PyObject *__pyx_v_obj) {
- PyObject *__pyx_r = NULL;
- PyObject *__pyx_t_1 = NULL;
- PyObject *__pyx_t_2 = NULL;
- __Pyx_RefNannySetupContext("viewfromobject_w");
- /* "buffers.pxd":300
- * cdef inline object viewfromobject_w(object obj):
- * """Wrapper for writable viewfromobject."""
- * return viewfromobject(obj, 0) # <<<<<<<<<<<<<<
- */
- __Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = __pyx_v_obj;
- __Pyx_INCREF(__pyx_t_1);
- __pyx_t_2 = __pyx_f_7buffers_viewfromobject(__pyx_t_1, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __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_AddTraceback("buffers.viewfromobject_w");
- __pyx_r = 0;
- __pyx_L0:;
- __Pyx_XGIVEREF(__pyx_r);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
- }
- static struct __pyx_vtabstruct_3zmq_4core_6socket_Socket __pyx_vtable_3zmq_4core_6socket_Socket;
- static PyObject *__pyx_tp_new_3zmq_4core_6socket_Socket(PyTypeObject *t, PyObject *a, PyObject *k) {
- struct __pyx_obj_3zmq_4core_6socket_Socket *p;
- PyObject *o = (*t->tp_alloc)(t, 0);
- if (!o) return 0;
- p = ((struct __pyx_obj_3zmq_4core_6socket_Socket *)o);
- p->__pyx_vtab = __pyx_vtabptr_3zmq_4core_6socket_Socket;
- p->context = Py_None; Py_INCREF(Py_None);
- p->closed = Py_None; Py_INCREF(Py_None);
- if (__pyx_pf_3zmq_4core_6socket_6Socket___cinit__(o, a, k) < 0) {
- Py_DECREF(o); o = 0;
- }
- return o;
- }
- static void __pyx_tp_dealloc_3zmq_4core_6socket_Socket(PyObject *o) {
- struct __pyx_obj_3zmq_4core_6socket_Socket *p = (struct __pyx_obj_3zmq_4core_6socket_Socket *)o;
- {
- PyObject *etype, *eval, *etb;
- PyErr_Fetch(&etype, &eval, &etb);
- ++Py_REFCNT(o);
- __pyx_pf_3zmq_4core_6socket_6Socket_1__dealloc__(o);
- if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
- --Py_REFCNT(o);
- PyErr_Restore(etype, eval, etb);
- }
- Py_XDECREF(p->context);
- Py_XDECREF(p->closed);
- (*Py_TYPE(o)->tp_free)(o);
- }
- static int __pyx_tp_traverse_3zmq_4core_6socket_Socket(PyObject *o, visitproc v, void *a) {
- int e;
- struct __pyx_obj_3zmq_4core_6socket_Socket *p = (struct __pyx_obj_3zmq_4core_6socket_Socket *)o;
- if (p->context) {
- e = (*v)(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_4core_6socket_Socket(PyObject *o) {
- struct __pyx_obj_3zmq_4core_6socket_Socket *p = (struct __pyx_obj_3zmq_4core_6socket_Socket *)o;
- PyObject* tmp;
- tmp = ((PyObject*)p->context);
- p->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_4core_6socket_6Socket_socket_type(PyObject *o, void *x) {
- return __pyx_pf_3zmq_4core_6socket_6Socket_11socket_type___get__(o);
- }
- static int __pyx_setprop_3zmq_4core_6socket_6Socket_socket_type(PyObject *o, PyObject *v, void *x) {
- if (v) {
- return __pyx_pf_3zmq_4core_6socket_6Socket_11socket_type_1__set__(o, v);
- }
- else {
- PyErr_SetString(PyExc_NotImplementedError, "__del__");
- return -1;
- }
- }
- static PyObject *__pyx_getprop_3zmq_4core_6socket_6Socket_context(PyObject *o, void *x) {
- return __pyx_pf_3zmq_4core_6socket_6Socket_7context___get__(o);
- }
- static int __pyx_setprop_3zmq_4core_6socket_6Socket_context(PyObject *o, PyObject *v, void *x) {
- if (v) {
- return __pyx_pf_3zmq_4core_6socket_6Socket_7context_1__set__(o, v);
- }
- else {
- return __pyx_pf_3zmq_4core_6socket_6Socket_7context_2__del__(o);
- }
- }
- static PyObject *__pyx_getprop_3zmq_4core_6socket_6Socket_closed(PyObject *o, void *x) {
- return __pyx_pf_3zmq_4core_6socket_6Socket_6closed___get__(o);
- }
- static int __pyx_setprop_3zmq_4core_6socket_6Socket_closed(PyObject *o, PyObject *v, void *x) {
- if (v) {
- return __pyx_pf_3zmq_4core_6socket_6Socket_6closed_1__set__(o, v);
- }
- else {
- return __pyx_pf_3zmq_4core_6socket_6Socket_6closed_2__del__(o);
- }
- }
- static PyMethodDef __pyx_methods_3zmq_4core_6socket_Socket[] = {
- {__Pyx_NAMESTR("close"), (PyCFunction)__pyx_pf_3zmq_4core_6socket_6Socket_2close, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_3zmq_4core_6socket_6Socket_2close)},
- {__Pyx_NAMESTR("setsockopt"), (PyCFunction)__pyx_pf_3zmq_4core_6socket_6Socket_3setsockopt, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4core_6socket_6Socket_3setsockopt)},
- {__Pyx_NAMESTR("getsockopt"), (PyCFunction)__pyx_pf_3zmq_4core_6socket_6Socket_4getsockopt, METH_O, __Pyx_DOCSTR(__pyx_doc_3zmq_4core_6socket_6Socket_4getsockopt)},
- {__Pyx_NAMESTR("setsockopt_unicode"), (PyCFunction)__pyx_pf_3zmq_4core_6socket_6Socket_5setsockopt_unicode, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4core_6socket_6Socket_5setsockopt_unicode)},
- {__Pyx_NAMESTR("getsockopt_unicode"), (PyCFunction)__pyx_pf_3zmq_4core_6socket_6Socket_6getsockopt_unicode, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4core_6socket_6Socket_6getsockopt_unicode)},
- {__Pyx_NAMESTR("bind"), (PyCFunction)__pyx_pf_3zmq_4core_6socket_6Socket_7bind, METH_O, __Pyx_DOCSTR(__pyx_doc_3zmq_4core_6socket_6Socket_7bind)},
- {__Pyx_NAMESTR("bind_to_random_port"), (PyCFunction)__pyx_pf_3zmq_4core_6socket_6Socket_8bind_to_random_port, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4core_6socket_6Socket_8bind_to_random_port)},
- {__Pyx_NAMESTR("connect"), (PyCFunction)__pyx_pf_3zmq_4core_6socket_6Socket_9connect, METH_O, __Pyx_DOCSTR(__pyx_doc_3zmq_4core_6socket_6Socket_9connect)},
- {__Pyx_NAMESTR("send"), (PyCFunction)__pyx_pf_3zmq_4core_6socket_6Socket_10send, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4core_6socket_6Socket_10send)},
- {__Pyx_NAMESTR("recv"), (PyCFunction)__pyx_pf_3zmq_4core_6socket_6Socket_11recv, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4core_6socket_6Socket_11recv)},
- {__Pyx_NAMESTR("send_multipart"), (PyCFunction)__pyx_pf_3zmq_4core_6socket_6Socket_12send_multipart, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4core_6socket_6Socket_12send_multipart)},
- {__Pyx_NAMESTR("recv_multipart"), (PyCFunction)__pyx_pf_3zmq_4core_6socket_6Socket_13recv_multipart, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4core_6socket_6Socket_13recv_multipart)},
- {__Pyx_NAMESTR("rcvmore"), (PyCFunction)__pyx_pf_3zmq_4core_6socket_6Socket_14rcvmore, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_3zmq_4core_6socket_6Socket_14rcvmore)},
- {__Pyx_NAMESTR("send_unicode"), (PyCFunction)__pyx_pf_3zmq_4core_6socket_6Socket_15send_unicode, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4core_6socket_6Socket_15send_unicode)},
- {__Pyx_NAMESTR("recv_unicode"), (PyCFunction)__pyx_pf_3zmq_4core_6socket_6Socket_16recv_unicode, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4core_6socket_6Socket_16recv_unicode)},
- {__Pyx_NAMESTR("send_pyobj"), (PyCFunction)__pyx_pf_3zmq_4core_6socket_6Socket_17send_pyobj, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4core_6socket_6Socket_17send_pyobj)},
- {__Pyx_NAMESTR("recv_pyobj"), (PyCFunction)__pyx_pf_3zmq_4core_6socket_6Socket_18recv_pyobj, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4core_6socket_6Socket_18recv_pyobj)},
- {__Pyx_NAMESTR("send_json"), (PyCFunction)__pyx_pf_3zmq_4core_6socket_6Socket_19send_json, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4core_6socket_6Socket_19send_json)},
- {__Pyx_NAMESTR("recv_json"), (PyCFunction)__pyx_pf_3zmq_4core_6socket_6Socket_20recv_json, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_3zmq_4core_6socket_6Socket_20recv_json)},
- {0, 0, 0, 0}
- };
- static struct PyGetSetDef __pyx_getsets_3zmq_4core_6socket_Socket[] = {
- {(char *)"socket_type", __pyx_getprop_3zmq_4core_6socket_6Socket_socket_type, __pyx_setprop_3zmq_4core_6socket_6Socket_socket_type, 0, 0},
- {(char *)"context", __pyx_getprop_3zmq_4core_6socket_6Socket_context, __pyx_setprop_3zmq_4core_6socket_6Socket_context, 0, 0},
- {(char *)"closed", __pyx_getprop_3zmq_4core_6socket_6Socket_closed, __pyx_setprop_3zmq_4core_6socket_6Socket_closed, 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, /*nb_long*/
- #else
- 0, /*reserved*/
- #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_VERSION_HEX >= 0x02050000
- 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
- };
- static PyTypeObject __pyx_type_3zmq_4core_6socket_Socket = {
- PyVarObject_HEAD_INIT(0, 0)
- __Pyx_NAMESTR("zmq.core.socket.Socket"), /*tp_name*/
- sizeof(struct __pyx_obj_3zmq_4core_6socket_Socket), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- __pyx_tp_dealloc_3zmq_4core_6socket_Socket, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
- #if PY_MAJOR_VERSION < 3
- 0, /*tp_compare*/
- #else
- 0, /*reserved*/
- #endif
- 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_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
- __Pyx_DOCSTR("Socket(context, socket_type)\n\n A 0MQ socket.\n\n These objects will generally be constructed via the socket() method of a Context object.\n \n 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, PULL, PUSH, XPUB, XSUB.\n \n See Also\n --------\n .Context.socket : method for creating a socket bound to a Context.\n "), /*tp_doc*/
- __pyx_tp_traverse_3zmq_4core_6socket_Socket, /*tp_traverse*/
- __pyx_tp_clear_3zmq_4core_6socket_Socket, /*tp_clear*/
- 0, /*tp_richcompare*/
- 0, /*tp_weaklistoffset*/
- 0, /*tp_iter*/
- 0, /*tp_iternext*/
- __pyx_methods_3zmq_4core_6socket_Socket, /*tp_methods*/
- 0, /*tp_members*/
- __pyx_getsets_3zmq_4core_6socket_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_4core_6socket_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 PyMethodDef __pyx_methods[] = {
- {0, 0, 0, 0}
- };
- char* __pyx_import_star_type_names[] = {
- "__pyx_opt_args_3zmq_4core_6socket__send_copy",
- "Socket",
- "__pyx_opt_args_3zmq_4core_6socket_6Socket_send",
- "const_void_ptr",
- "zmq_pollitem_t",
- "Message",
- "zmq_free_fn",
- "__pyx_opt_args_3zmq_4core_6socket__recv_message",
- "zmq_msg_t",
- "int64_t",
- "__pyx_opt_args_3zmq_4core_6socket_6Socket_recv",
- "__pyx_opt_args_3zmq_4core_6socket__recv_copy",
- "__pyx_opt_args_3zmq_4core_6socket__send_message",
- "Py_ssize_t",
- 0
- };
- static int __pyx_import_star_set(PyObject *o, PyObject* py_name, char *name) {
- char** type_name = __pyx_import_star_type_names;
- while (*type_name) {
- if (__Pyx_StrEq(name, *type_name)) {
- PyErr_Format(PyExc_TypeError, "Cannot overwrite C type %s", name);
- goto bad;
- }
- type_name++;
- }
- if (0);
- else {
- if (PyObject_SetAttr(__pyx_m, py_name, o) < 0) goto bad;
- }
- return 0;
- bad:
- return -1;
- }
- /* import_all_from is an unexposed function from ceval.c */
- static int
- __Pyx_import_all_from(PyObject *locals, PyObject *v)
- {
- PyObject *all = __Pyx_GetAttrString(v, "__all__");
- PyObject *dict, *name, *value;
- int skip_leading_underscores = 0;
- int pos, err;
- if (all == NULL) {
- if (!PyErr_ExceptionMatches(PyExc_AttributeError))
- return -1; /* Unexpected error */
- PyErr_Clear();
- dict = __Pyx_GetAttrString(v, "__dict__");
- if (dict == NULL) {
- if (!PyErr_ExceptionMatches(PyExc_AttributeError))
- return -1;
- PyErr_SetString(PyExc_ImportError,
- "from-import-* object has no __dict__ and no __all__");
- return -1;
- }
- all = PyMapping_Keys(dict);
- Py_DECREF(dict);
- if (all == NULL)
- return -1;
- skip_leading_underscores = 1;
- }
- for (pos = 0, err = 0; ; pos++) {
- name = PySequence_GetItem(all, pos);
- if (name == NULL) {
- if (!PyErr_ExceptionMatches(PyExc_IndexError))
- err = -1;
- else
- PyErr_Clear();
- break;
- }
- if (skip_leading_underscores &&
- #if PY_MAJOR_VERSION < 3
- PyString_Check(name) &&
- PyString_AS_STRING(name)[0] == '_')
- #else
- PyUnicode_Check(name) &&
- PyUnicode_AS_UNICODE(name)[0] == '_')
- #endif
- {
- Py_DECREF(name);
- continue;
- }
- value = PyObject_GetAttr(v, name);
- if (value == NULL)
- err = -1;
- else if (PyDict_CheckExact(locals))
- err = PyDict_SetItem(locals, name, value);
- else
- err = PyObject_SetItem(locals, name, value);
- Py_DECREF(name);
- Py_XDECREF(value);
- if (err != 0)
- break;
- }
- Py_DECREF(all);
- return err;
- }
- static int __pyx_import_star(PyObject* m) {
- int i;
- int ret = -1;
- char* s;
- PyObject *locals = 0;
- PyObject *list = 0;
- #if PY_MAJOR_VERSION >= 3
- PyObject *utf8_name = 0;
- #endif
- PyObject *name;
- PyObject *item;
- locals = PyDict_New(); if (!locals) goto bad;
- if (__Pyx_import_all_from(locals, m) < 0) goto bad;
- list = PyDict_Items(locals); if (!list) goto bad;
- for(i=0; i<PyList_GET_SIZE(list); i++) {
- name = PyTuple_GET_ITEM(PyList_GET_ITEM(list, i), 0);
- item = PyTuple_GET_ITEM(PyList_GET_ITEM(list, i), 1);
- #if PY_MAJOR_VERSION >= 3
- utf8_name = PyUnicode_AsUTF8String(name);
- if (!utf8_name) goto bad;
- s = PyBytes_AS_STRING(utf8_name);
- if (__pyx_import_star_set(item, name, s) < 0) goto bad;
- Py_DECREF(utf8_name); utf8_name = 0;
- #else
- s = PyString_AsString(name);
- if (!s) goto bad;
- if (__pyx_import_star_set(item, name, s) < 0) goto bad;
- #endif
- }
- ret = 0;
- bad:
- Py_XDECREF(locals);
- Py_XDECREF(list);
- #if PY_MAJOR_VERSION >= 3
- Py_XDECREF(utf8_name);
- #endif
- return ret;
- }
- #if PY_MAJOR_VERSION >= 3
- static struct PyModuleDef __pyx_moduledef = {
- PyModuleDef_HEAD_INIT,
- __Pyx_NAMESTR("socket"),
- __Pyx_DOCSTR(__pyx_k_39), /* 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_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_17, __pyx_k_17, sizeof(__pyx_k_17), 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_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 0, 1, 0},
- {&__pyx_kp_s_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 0, 1, 0},
- {&__pyx_kp_s_33, __pyx_k_33, sizeof(__pyx_k_33), 0, 0, 1, 0},
- {&__pyx_kp_s_34, __pyx_k_34, sizeof(__pyx_k_34), 0, 0, 1, 0},
- {&__pyx_kp_s_35, __pyx_k_35, sizeof(__pyx_k_35), 0, 0, 1, 0},
- {&__pyx_kp_s_37, __pyx_k_37, sizeof(__pyx_k_37), 0, 0, 1, 0},
- {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0},
- {&__pyx_n_s_40, __pyx_k_40, sizeof(__pyx_k_40), 0, 0, 1, 1},
- {&__pyx_n_s_41, __pyx_k_41, sizeof(__pyx_k_41), 0, 0, 1, 1},
- {&__pyx_n_s_42, __pyx_k_42, sizeof(__pyx_k_42), 0, 0, 1, 1},
- {&__pyx_n_s_43, __pyx_k_43, sizeof(__pyx_k_43), 0, 0, 1, 1},
- {&__pyx_n_s_44, __pyx_k_44, sizeof(__pyx_k_44), 0, 0, 1, 1},
- {&__pyx_n_s_45, __pyx_k_45, sizeof(__pyx_k_45), 0, 0, 1, 1},
- {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0},
- {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0},
- {&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0},
- {&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0},
- {&__pyx_n_s__AttributeError, __pyx_k__AttributeError, sizeof(__pyx_k__AttributeError), 0, 0, 1, 1},
- {&__pyx_n_s__B, __pyx_k__B, sizeof(__pyx_k__B), 0, 0, 1, 1},
- {&__pyx_n_s__EINVAL, __pyx_k__EINVAL, sizeof(__pyx_k__EINVAL), 0, 0, 1, 1},
- {&__pyx_n_s__ENOTSUP, __pyx_k__ENOTSUP, sizeof(__pyx_k__ENOTSUP), 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__NotImplementedError, __pyx_k__NotImplementedError, sizeof(__pyx_k__NotImplementedError), 0, 0, 1, 1},
- {&__pyx_n_s__RCVMORE, __pyx_k__RCVMORE, sizeof(__pyx_k__RCVMORE), 0, 0, 1, 1},
- {&__pyx_n_s__SNDMORE, __pyx_k__SNDMORE, sizeof(__pyx_k__SNDMORE), 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__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 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____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
- {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
- {&__pyx_n_s___handle, __pyx_k___handle, sizeof(__pyx_k___handle), 0, 0, 1, 1},
- {&__pyx_n_s__addr, __pyx_k__addr, sizeof(__pyx_k__addr), 0, 0, 1, 1},
- {&__pyx_n_s__append, __pyx_k__append, sizeof(__pyx_k__append), 0, 0, 1, 1},
- {&__pyx_n_s__basestring, __pyx_k__basestring, sizeof(__pyx_k__basestring), 0, 0, 1, 1},
- {&__pyx_n_s__bind, __pyx_k__bind, sizeof(__pyx_k__bind), 0, 0, 1, 1},
- {&__pyx_n_s__buf, __pyx_k__buf, sizeof(__pyx_k__buf), 0, 0, 1, 1},
- {&__pyx_n_s__buffer, __pyx_k__buffer, sizeof(__pyx_k__buffer), 0, 0, 1, 1},
- {&__pyx_n_s__bytes, __pyx_k__bytes, sizeof(__pyx_k__bytes), 0, 0, 1, 1},
- {&__pyx_n_s__bytes_sockopts, __pyx_k__bytes_sockopts, sizeof(__pyx_k__bytes_sockopts), 0, 0, 1, 1},
- {&__pyx_n_s__cPickle, __pyx_k__cPickle, sizeof(__pyx_k__cPickle), 0, 0, 1, 1},
- {&__pyx_n_s__char, __pyx_k__char, sizeof(__pyx_k__char), 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__codecs, __pyx_k__codecs, sizeof(__pyx_k__codecs), 0, 0, 1, 1},
- {&__pyx_n_s__constants, __pyx_k__constants, sizeof(__pyx_k__constants), 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__decode, __pyx_k__decode, sizeof(__pyx_k__decode), 0, 0, 1, 1},
- {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1},
- {&__pyx_n_s__dumps, __pyx_k__dumps, sizeof(__pyx_k__dumps), 0, 0, 1, 1},
- {&__pyx_n_s__encode, __pyx_k__encode, sizeof(__pyx_k__encode), 0, 0, 1, 1},
- {&__pyx_n_s__encoding, __pyx_k__encoding, sizeof(__pyx_k__encoding), 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__flags, __pyx_k__flags, sizeof(__pyx_k__flags), 0, 0, 1, 1},
- {&__pyx_n_s__format, __pyx_k__format, sizeof(__pyx_k__format), 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__int64_sockopts, __pyx_k__int64_sockopts, sizeof(__pyx_k__int64_sockopts), 0, 0, 1, 1},
- {&__pyx_n_s__int_sockopts, __pyx_k__int_sockopts, sizeof(__pyx_k__int_sockopts), 0, 0, 1, 1},
- {&__pyx_n_s__itemsize, __pyx_k__itemsize, sizeof(__pyx_k__itemsize), 0, 0, 1, 1},
- {&__pyx_n_s__jsonapi, __pyx_k__jsonapi, sizeof(__pyx_k__jsonapi), 0, 0, 1, 1},
- {&__pyx_n_s__jsonmod, __pyx_k__jsonmod, sizeof(__pyx_k__jsonmod), 0, 0, 1, 1},
- {&__pyx_n_s__len, __pyx_k__len, sizeof(__pyx_k__len), 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__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__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__pickle, __pyx_k__pickle, sizeof(__pyx_k__pickle), 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__send, __pyx_k__send, sizeof(__pyx_k__send), 0, 0, 1, 1},
- {&__pyx_n_s__setsockopt, __pyx_k__setsockopt, sizeof(__pyx_k__setsockopt), 0, 0, 1, 1},
- {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 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__struct, __pyx_k__struct, sizeof(__pyx_k__struct), 0, 0, 1, 1},
- {&__pyx_n_s__sys, __pyx_k__sys, sizeof(__pyx_k__sys), 0, 0, 1, 1},
- {&__pyx_n_s__time, __pyx_k__time, sizeof(__pyx_k__time), 0, 0, 1, 1},
- {&__pyx_n_s__track, __pyx_k__track, sizeof(__pyx_k__track), 0, 0, 1, 1},
- {&__pyx_n_s__tracker, __pyx_k__tracker, sizeof(__pyx_k__tracker), 0, 0, 1, 1},
- {&__pyx_n_s__typecode, __pyx_k__typecode, sizeof(__pyx_k__typecode), 0, 0, 1, 1},
- {&__pyx_n_s__u, __pyx_k__u, sizeof(__pyx_k__u), 0, 0, 1, 1},
- {&__pyx_n_s__unicode, __pyx_k__unicode, sizeof(__pyx_k__unicode), 0, 0, 1, 1},
- {&__pyx_n_s__xrange, __pyx_k__xrange, sizeof(__pyx_k__xrange), 0, 0, 1, 1},
- {&__pyx_n_s__zmq_msg, __pyx_k__zmq_msg, sizeof(__pyx_k__zmq_msg), 0, 0, 1, 1},
- {0, 0, 0, 0, 0, 0, 0}
- };
- static int __Pyx_InitCachedBuiltins(void) {
- __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #if PY_MAJOR_VERSION >= 3
- __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #else
- __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__xrange); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- #endif
- __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_builtin_ImportError = __Pyx_GetName(__pyx_b, __pyx_n_s__ImportError); if (!__pyx_builtin_ImportError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_builtin_AttributeError = __Pyx_GetName(__pyx_b, __pyx_n_s__AttributeError); if (!__pyx_builtin_AttributeError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_builtin_NotImplementedError = __Pyx_GetName(__pyx_b, __pyx_n_s__NotImplementedError); if (!__pyx_builtin_NotImplementedError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- return 0;
- __pyx_L1_error:;
- return -1;
- }
- static int __Pyx_InitCachedConstants(void) {
- __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants");
- /* "zmq/core/socket.pyx":229
- * _check_closed(self)
- * if isinstance(optval, unicode):
- * raise TypeError("unicode not allowed, use setsockopt_unicode") # <<<<<<<<<<<<<<
- *
- * if option in constants.bytes_sockopts:
- */
- __pyx_k_tuple_3 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_3));
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_2));
- PyTuple_SET_ITEM(__pyx_k_tuple_3, 0, ((PyObject *)__pyx_kp_s_2));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_3));
- /* "zmq/core/socket.pyx":337
- * """
- * if not isinstance(optval, unicode):
- * raise TypeError("unicode strings only") # <<<<<<<<<<<<<<
- * return self.setsockopt(option, optval.encode(encoding))
- *
- */
- __pyx_k_tuple_8 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_8));
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_7));
- PyTuple_SET_ITEM(__pyx_k_tuple_8, 0, ((PyObject *)__pyx_kp_s_7));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_7));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8));
- /* "zmq/core/socket.pyx":384
- * _check_closed(self)
- * if isinstance(addr, unicode):
- * addr = addr.encode('utf-8') # <<<<<<<<<<<<<<
- * if not isinstance(addr, bytes):
- * raise TypeError('expected str, got: %r' % addr)
- */
- __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_10));
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
- PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_kp_s_6));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10));
- /* "zmq/core/socket.pyx":426
- * else:
- * return port
- * raise ZMQBindError("Could not bind socket to random port.") # <<<<<<<<<<<<<<
- *
- * def connect(self, addr):
- */
- __pyx_k_tuple_13 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_13));
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_12));
- PyTuple_SET_ITEM(__pyx_k_tuple_13, 0, ((PyObject *)__pyx_kp_s_12));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_12));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13));
- /* "zmq/core/socket.pyx":445
- * _check_closed(self)
- * if isinstance(addr, unicode):
- * addr = addr.encode('utf-8') # <<<<<<<<<<<<<<
- * if not isinstance(addr, bytes):
- * raise TypeError('expected str, got: %r' % addr)
- */
- __pyx_k_tuple_14 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_14));
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_6));
- PyTuple_SET_ITEM(__pyx_k_tuple_14, 0, ((PyObject *)__pyx_kp_s_6));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14));
- /* "zmq/core/socket.pyx":497
- *
- * if isinstance(data, unicode):
- * raise TypeError("unicode not allowed, use send_unicode") # <<<<<<<<<<<<<<
- *
- * if copy:
- */
- __pyx_k_tuple_18 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_18));
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_17));
- PyTuple_SET_ITEM(__pyx_k_tuple_18, 0, ((PyObject *)__pyx_kp_s_17));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_17));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18));
- /* "zmq/core/socket.pyx":508
- * if isinstance(data, Message):
- * if track and not data.tracker:
- * raise ValueError('Not a tracked message') # <<<<<<<<<<<<<<
- * msg = data
- * else:
- */
- __pyx_k_tuple_20 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_20));
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_19));
- PyTuple_SET_ITEM(__pyx_k_tuple_20, 0, ((PyObject *)__pyx_kp_s_19));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_20));
- /* "zmq/core/socket.pyx":647
- * """
- * if not isinstance(u, basestring):
- * raise TypeError("unicode/str objects only") # <<<<<<<<<<<<<<
- * return self.send(u.encode(encoding), flags=flags, copy=copy)
- *
- */
- __pyx_k_tuple_29 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_29));
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_28));
- PyTuple_SET_ITEM(__pyx_k_tuple_29, 0, ((PyObject *)__pyx_kp_s_28));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_28));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_29));
- /* "zmq/core/socket.pyx":720
- * """
- * if jsonapi.jsonmod is None:
- * raise ImportError('jsonlib{1,2}, json or simplejson library is required.') # <<<<<<<<<<<<<<
- * else:
- * msg = jsonapi.dumps(obj)
- */
- __pyx_k_tuple_31 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_31));
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_30));
- PyTuple_SET_ITEM(__pyx_k_tuple_31, 0, ((PyObject *)__pyx_kp_s_30));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_30));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_31));
- /* "zmq/core/socket.pyx":741
- * """
- * if jsonapi.jsonmod is None:
- * raise ImportError('jsonlib{1,2}, json or simplejson library is required.') # <<<<<<<<<<<<<<
- * else:
- * msg = self.recv(flags)
- */
- __pyx_k_tuple_32 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_32));
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_30));
- PyTuple_SET_ITEM(__pyx_k_tuple_32, 0, ((PyObject *)__pyx_kp_s_30));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_30));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_32));
- /* "buffers.pxd":213
- * return PyMemoryView_FromBuffer(&pybuf)
- * else:
- * raise NotImplementedError("New style buffers not available.") # <<<<<<<<<<<<<<
- *
- *
- */
- __pyx_k_tuple_36 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_36)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_36));
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_35));
- PyTuple_SET_ITEM(__pyx_k_tuple_36, 0, ((PyObject *)__pyx_kp_s_35));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_35));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_36));
- /* "buffers.pxd":228
- * return PyBuffer_FromReadWriteMemory(ptr, s)
- * else:
- * raise NotImplementedError("Old style buffers not available.") # <<<<<<<<<<<<<<
- *
- *
- */
- __pyx_k_tuple_38 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_38)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_38));
- __Pyx_INCREF(((PyObject *)__pyx_kp_s_37));
- PyTuple_SET_ITEM(__pyx_k_tuple_38, 0, ((PyObject *)__pyx_kp_s_37));
- __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_37));
- __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_38));
- __Pyx_RefNannyFinishContext();
- return 0;
- __pyx_L1_error:;
- __Pyx_RefNannyFinishContext();
- 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_49152 = PyInt_FromLong(49152); if (unlikely(!__pyx_int_49152)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __pyx_int_65536 = PyInt_FromLong(65536); if (unlikely(!__pyx_int_65536)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- return 0;
- __pyx_L1_error:;
- return -1;
- }
- #if PY_MAJOR_VERSION < 3
- PyMODINIT_FUNC initsocket(void); /*proto*/
- PyMODINIT_FUNC initsocket(void)
- #else
- PyMODINIT_FUNC PyInit_socket(void); /*proto*/
- PyMODINIT_FUNC PyInit_socket(void)
- #endif
- {
- PyObject *__pyx_t_1 = NULL;
- PyObject *__pyx_t_2 = NULL;
- PyObject *__pyx_t_3 = NULL;
- PyObject *__pyx_t_4 = NULL;
- PyObject *__pyx_t_5 = 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_socket(void)", __LINE__, __FILE__);
- #endif
- __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;}
- __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;}
- #ifdef __pyx_binding_PyCFunctionType_USED
- if (__pyx_binding_PyCFunctionType_init() < 0) {__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("socket"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_39), 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__core__socket) {
- 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;}
- /*--- Constants init code ---*/
- if (unlikely(__Pyx_InitCachedConstants() < 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_4core_6socket_Socket = &__pyx_vtable_3zmq_4core_6socket_Socket;
- __pyx_vtable_3zmq_4core_6socket_Socket.send = (PyObject *(*)(struct __pyx_obj_3zmq_4core_6socket_Socket *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_3zmq_4core_6socket_6Socket_send *__pyx_optional_args))__pyx_f_3zmq_4core_6socket_6Socket_send;
- __pyx_vtable_3zmq_4core_6socket_Socket.recv = (PyObject *(*)(struct __pyx_obj_3zmq_4core_6socket_Socket *, int __pyx_skip_dispatch, struct __pyx_opt_args_3zmq_4core_6socket_6Socket_recv *__pyx_optional_args))__pyx_f_3zmq_4core_6socket_6Socket_recv;
- if (PyType_Ready(&__pyx_type_3zmq_4core_6socket_Socket) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetVtable(__pyx_type_3zmq_4core_6socket_Socket.tp_dict, __pyx_vtabptr_3zmq_4core_6socket_Socket) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetAttrString(__pyx_m, "Socket", (PyObject *)&__pyx_type_3zmq_4core_6socket_Socket) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_3zmq_4core_6socket_Socket = &__pyx_type_3zmq_4core_6socket_Socket;
- /*--- Type import code ---*/
- __pyx_ptype_3zmq_4core_7message_MessageTracker = __Pyx_ImportType("zmq.core.message", "MessageTracker", sizeof(struct __pyx_obj_3zmq_4core_7message_MessageTracker), 1); if (unlikely(!__pyx_ptype_3zmq_4core_7message_MessageTracker)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_3zmq_4core_7message_Message = __Pyx_ImportType("zmq.core.message", "Message", sizeof(struct __pyx_obj_3zmq_4core_7message_Message), 1); if (unlikely(!__pyx_ptype_3zmq_4core_7message_Message)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_vtabptr_3zmq_4core_7message_Message = (struct __pyx_vtabstruct_3zmq_4core_7message_Message*)__Pyx_GetVtable(__pyx_ptype_3zmq_4core_7message_Message->tp_dict); if (unlikely(!__pyx_vtabptr_3zmq_4core_7message_Message)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), 0); if (unlikely(!__pyx_ptype_7cpython_4bool_bool)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), 0); if (unlikely(!__pyx_ptype_7cpython_7complex_complex)) {__pyx_filename = __pyx_f[5]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- /*--- Function import code ---*/
- __pyx_t_1 = __Pyx_ImportModule("zmq.core.message"); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_ImportFunction(__pyx_t_1, "copy_zmq_msg_bytes", (void (**)(void))&__pyx_f_3zmq_4core_7message_copy_zmq_msg_bytes, "PyObject *(zmq_msg_t *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- Py_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /*--- Execution code ---*/
- /* "zmq/core/socket.pyx":47
- * #-----------------------------------------------------------------------------
- *
- * import copy as copy_mod # <<<<<<<<<<<<<<
- * import time
- * import sys
- */
- __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__copy), 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__copy_mod, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "zmq/core/socket.pyx":48
- *
- * import copy as copy_mod
- * import time # <<<<<<<<<<<<<<
- * import sys
- * import random
- */
- __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__time), 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__time, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "zmq/core/socket.pyx":49
- * import copy as copy_mod
- * import time
- * import sys # <<<<<<<<<<<<<<
- * import random
- * import struct
- */
- __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__sys), 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sys, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "zmq/core/socket.pyx":50
- * import time
- * import sys
- * import random # <<<<<<<<<<<<<<
- * import struct
- * import codecs
- */
- __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__random), 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__random, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "zmq/core/socket.pyx":51
- * import sys
- * import random
- * import struct # <<<<<<<<<<<<<<
- * import codecs
- *
- */
- __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__struct), 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__struct, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "zmq/core/socket.pyx":52
- * import random
- * import struct
- * import codecs # <<<<<<<<<<<<<<
- *
- * from zmq.utils import jsonapi
- */
- __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__codecs), 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__codecs, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "zmq/core/socket.pyx":54
- * import codecs
- *
- * from zmq.utils import jsonapi # <<<<<<<<<<<<<<
- *
- * try:
- */
- __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_2));
- __Pyx_INCREF(((PyObject *)__pyx_n_s__jsonapi));
- PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__jsonapi));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s__jsonapi));
- __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s_40), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__jsonapi); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__jsonapi, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "zmq/core/socket.pyx":56
- * from zmq.utils import jsonapi
- *
- * try: # <<<<<<<<<<<<<<
- * import cPickle
- * pickle = cPickle
- */
- {
- 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:*/ {
- /* "zmq/core/socket.pyx":57
- *
- * try:
- * import cPickle # <<<<<<<<<<<<<<
- * pickle = cPickle
- * except:
- */
- __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s__cPickle), 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
- __Pyx_GOTREF(__pyx_t_3);
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__cPickle, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "zmq/core/socket.pyx":58
- * try:
- * import cPickle
- * pickle = cPickle # <<<<<<<<<<<<<<
- * except:
- * cPickle = None
- */
- __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__cPickle); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
- __Pyx_GOTREF(__pyx_t_3);
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__pickle, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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_2); __pyx_t_2 = 0;
- __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "zmq/core/socket.pyx":59
- * import cPickle
- * pickle = cPickle
- * except: # <<<<<<<<<<<<<<
- * cPickle = None
- * import pickle
- */
- /*except:*/ {
- __Pyx_AddTraceback("zmq.core.socket");
- if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_GOTREF(__pyx_t_4);
- /* "zmq/core/socket.pyx":60
- * pickle = cPickle
- * except:
- * cPickle = None # <<<<<<<<<<<<<<
- * import pickle
- *
- */
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__cPickle, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;}
- /* "zmq/core/socket.pyx":61
- * except:
- * cPickle = None
- * import pickle # <<<<<<<<<<<<<<
- *
- * from zmq.core import constants
- */
- __pyx_t_5 = __Pyx_Import(((PyObject *)__pyx_n_s__pickle), 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;}
- __Pyx_GOTREF(__pyx_t_5);
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__pickle, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;}
- __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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:;
- }
- /* "zmq/core/socket.pyx":63
- * import pickle
- *
- * from zmq.core import constants # <<<<<<<<<<<<<<
- * from zmq.core.constants import *
- * from zmq.core.error import ZMQError, ZMQBindError
- */
- __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_4));
- __Pyx_INCREF(((PyObject *)__pyx_n_s__constants));
- PyList_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_n_s__constants));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s__constants));
- __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s_41), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
- __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__constants); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__constants, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "zmq/core/socket.pyx":64
- *
- * from zmq.core import constants
- * from zmq.core.constants import * # <<<<<<<<<<<<<<
- * from zmq.core.error import ZMQError, ZMQBindError
- * from zmq.utils.strtypes import bytes,unicode,basestring
- */
- __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_2));
- __Pyx_INCREF(((PyObject *)__pyx_n_s_43));
- PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s_43));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s_43));
- __pyx_t_4 = __Pyx_Import(((PyObject *)__pyx_n_s_42), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
- if (__pyx_import_star(__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "zmq/core/socket.pyx":65
- * from zmq.core import constants
- * from zmq.core.constants import *
- * from zmq.core.error import ZMQError, ZMQBindError # <<<<<<<<<<<<<<
- * from zmq.utils.strtypes import bytes,unicode,basestring
- *
- */
- __pyx_t_4 = PyList_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_4));
- __Pyx_INCREF(((PyObject *)__pyx_n_s__ZMQError));
- PyList_SET_ITEM(__pyx_t_4, 0, ((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, 1, ((PyObject *)__pyx_n_s__ZMQBindError));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ZMQBindError));
- __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s_44), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
- __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__ZMQError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ZMQError, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__ZMQBindError); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ZMQBindError, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- /* "zmq/core/socket.pyx":66
- * from zmq.core.constants import *
- * from zmq.core.error import ZMQError, ZMQBindError
- * from zmq.utils.strtypes import bytes,unicode,basestring # <<<<<<<<<<<<<<
- *
- * #-----------------------------------------------------------------------------
- */
- __pyx_t_2 = PyList_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_2));
- __Pyx_INCREF(((PyObject *)__pyx_n_s__bytes));
- PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__bytes));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bytes));
- __Pyx_INCREF(((PyObject *)__pyx_n_s__unicode));
- PyList_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__unicode));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s__unicode));
- __Pyx_INCREF(((PyObject *)__pyx_n_s__basestring));
- PyList_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_n_s__basestring));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s__basestring));
- __pyx_t_4 = __Pyx_Import(((PyObject *)__pyx_n_s_45), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__bytes); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__bytes, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__unicode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__unicode, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__basestring); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_2);
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s__basestring, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "zmq/core/socket.pyx":79
- * raise ZMQError(ENOTSUP)
- *
- * cdef inline Message _recv_message(void *handle, int flags=0, track=False): # <<<<<<<<<<<<<<
- * """Receive a message in a non-copying manner and return a Message."""
- * cdef int rc
- */
- __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_k_1 = __pyx_t_4;
- __Pyx_GIVEREF(__pyx_t_4);
- __pyx_t_4 = 0;
- /* "zmq/core/socket.pyx":457
- * #-------------------------------------------------------------------------
- *
- * cpdef object send(self, object data, int flags=0, copy=True, track=False): # <<<<<<<<<<<<<<
- * """s.send(data, flags=0, copy=True, track=False)
- *
- */
- __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_k_15 = __pyx_t_4;
- __Pyx_GIVEREF(__pyx_t_4);
- __pyx_t_4 = 0;
- __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_k_16 = __pyx_t_4;
- __Pyx_GIVEREF(__pyx_t_4);
- __pyx_t_4 = 0;
- /* "zmq/core/socket.pyx":514
- * return _send_message(self.handle, msg, flags)
- *
- * cpdef object recv(self, int flags=0, copy=True, track=False): # <<<<<<<<<<<<<<
- * """s.recv(flags=0, copy=True, track=False)
- *
- */
- __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_k_21 = __pyx_t_4;
- __Pyx_GIVEREF(__pyx_t_4);
- __pyx_t_4 = 0;
- __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_k_22 = __pyx_t_4;
- __Pyx_GIVEREF(__pyx_t_4);
- __pyx_t_4 = 0;
- /* "zmq/core/socket.pyx":552
- * return _recv_message(self.handle, flags, track)
- *
- * def send_multipart(self, msg_parts, int flags=0, copy=True, track=False): # <<<<<<<<<<<<<<
- * """s.send_multipart(msg_parts, flags=0, copy=True, track=False)
- *
- */
- __pyx_t_4 = __Pyx_PyBool_FromLong(1); 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_k_23 = __pyx_t_4;
- __Pyx_GIVEREF(__pyx_t_4);
- __pyx_t_4 = 0;
- __pyx_t_4 = __Pyx_PyBool_FromLong(0); 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_k_24 = __pyx_t_4;
- __Pyx_GIVEREF(__pyx_t_4);
- __pyx_t_4 = 0;
- /* "zmq/core/socket.pyx":583
- * return self.send(msg_parts[-1], flags, copy=copy, track=track)
- *
- * def recv_multipart(self, int flags=0, copy=True, track=False): # <<<<<<<<<<<<<<
- * """s.recv_multipart(flags=0, copy=True, track=False)
- *
- */
- __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_k_25 = __pyx_t_4;
- __Pyx_GIVEREF(__pyx_t_4);
- __pyx_t_4 = 0;
- __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_k_26 = __pyx_t_4;
- __Pyx_GIVEREF(__pyx_t_4);
- __pyx_t_4 = 0;
- /* "zmq/core/socket.pyx":632
- * return bool(more)
- *
- * def send_unicode(self, u, int flags=0, copy=False, encoding='utf-8'): # <<<<<<<<<<<<<<
- * """s.send_unicode(u, flags=0, copy=False, encoding='utf-8')
- *
- */
- __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_k_27 = __pyx_t_4;
- __Pyx_GIVEREF(__pyx_t_4);
- __pyx_t_4 = 0;
- /* "zmq/core/socket.pyx":747
- *
- *
- * __all__ = ['Socket'] # <<<<<<<<<<<<<<
- */
- __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_4));
- __Pyx_INCREF(((PyObject *)__pyx_n_s__Socket));
- PyList_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_n_s__Socket));
- __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Socket));
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s____all__, ((PyObject *)__pyx_t_4)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
- /* "zmq/core/socket.pyx":1
- * """0MQ Socket class.""" # <<<<<<<<<<<<<<
- *
- * #
- */
- __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(((PyObject *)__pyx_t_4));
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_4)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
- /* "cpython/type.pxd":2
- *
- * cdef extern from "Python.h": # <<<<<<<<<<<<<<
- * # The C structure of the objects used to describe built-in types.
- *
- */
- 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_XDECREF(__pyx_t_5);
- if (__pyx_m) {
- __Pyx_AddTraceback("init zmq.core.socket");
- Py_DECREF(__pyx_m); __pyx_m = 0;
- } else if (!PyErr_Occurred()) {
- PyErr_SetString(PyExc_ImportError, "init zmq.core.socket");
- }
- __pyx_L0:;
- __Pyx_RefNannyFinishContext();
- #if PY_MAJOR_VERSION < 3
- return;
- #else
- return __pyx_m;
- #endif
- }
- /* Runtime support code */
- 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 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;
- }
- #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 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 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 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 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 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 PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) {
- PyObject *py_import = 0;
- PyObject *empty_list = 0;
- PyObject *module = 0;
- PyObject *global_dict = 0;
- PyObject *empty_dict = 0;
- PyObject *list;
- py_import = __Pyx_GetAttrString(__pyx_b, "__import__");
- if (!py_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(py_import,
- name, global_dict, empty_dict, list, NULL);
- bad:
- Py_XDECREF(empty_list);
- Py_XDECREF(py_import);
- Py_XDECREF(empty_dict);
- return module;
- }
- 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 = (pyzmq_int64_t)0;
- const int is_unsigned = const_zero < neg_one;
- 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);
- } else {
- pyzmq_int64_t val;
- PyObject *v = __Pyx_PyNumber_Int(x);
- #if PY_VERSION_HEX < 0x03000000
- if (likely(v) && !PyLong_Check(v)) {
- PyObject *tmp = v;
- v = PyNumber_Long(tmp);
- Py_DECREF(tmp);
- }
- #endif
- if (likely(v)) {
- int one = 1; int is_little = (int)*(unsigned char *)&one;
- unsigned char *bytes = (unsigned char *)&val;
- int ret = _PyLong_AsByteArray((PyLongObject *)v,
- bytes, sizeof(val),
- is_little, !is_unsigned);
- Py_DECREF(v);
- if (likely(!ret))
- return val;
- }
- 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 = (pyzmq_int64_t)0;
- const int is_unsigned = const_zero < neg_one;
- if ((sizeof(pyzmq_int64_t) == sizeof(char)) ||
- (sizeof(pyzmq_int64_t) == sizeof(short))) {
- return PyInt_FromLong((long)val);
- } else if ((sizeof(pyzmq_int64_t) == sizeof(int)) ||
- (sizeof(pyzmq_int64_t) == sizeof(long))) {
- if (is_unsigned)
- return PyLong_FromUnsignedLong((unsigned long)val);
- else
- return PyInt_FromLong((long)val);
- } else if (sizeof(pyzmq_int64_t) == sizeof(PY_LONG_LONG)) {
- if (is_unsigned)
- return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val);
- else
- return PyLong_FromLongLong((PY_LONG_LONG)val);
- } else {
- int one = 1; int little = (int)*(unsigned char *)&one;
- unsigned char *bytes = (unsigned char *)&val;
- return _PyLong_FromByteArray(bytes, sizeof(pyzmq_int64_t),
- little, !is_unsigned);
- }
- }
- 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 int __Pyx_PyInt_AsLongDouble(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 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 CYTHON_INLINE int __Pyx_StrEq(const char *s1, const char *s2) {
- while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
- return *s1 == *s2;
- }
- static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
- #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
- PyObject *ob = PyCapsule_New(vtable, 0, 0);
- #else
- PyObject *ob = PyCObject_FromVoidPtr(vtable, 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;
- }
- #ifndef __PYX_HAVE_RT_ImportType
- #define __PYX_HAVE_RT_ImportType
- static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
- long size, int strict)
- {
- PyObject *py_module = 0;
- PyObject *result = 0;
- PyObject *py_name = 0;
- char warning[200];
- py_module = __Pyx_ImportModule(module_name);
- if (!py_module)
- goto bad;
- #if PY_MAJOR_VERSION < 3
- py_name = PyString_FromString(class_name);
- #else
- py_name = PyUnicode_FromString(class_name);
- #endif
- if (!py_name)
- goto bad;
- result = PyObject_GetAttr(py_module, py_name);
- Py_DECREF(py_name);
- py_name = 0;
- Py_DECREF(py_module);
- py_module = 0;
- if (!result)
- goto bad;
- if (!PyType_Check(result)) {
- PyErr_Format(PyExc_TypeError,
- "%s.%s is not a type object",
- module_name, class_name);
- goto bad;
- }
- if (!strict && ((PyTypeObject *)result)->tp_basicsize > size) {
- PyOS_snprintf(warning, sizeof(warning),
- "%s.%s size changed, may indicate binary incompatibility",
- module_name, class_name);
- #if PY_VERSION_HEX < 0x02050000
- PyErr_Warn(NULL, warning);
- #else
- PyErr_WarnEx(NULL, warning, 0);
- #endif
- }
- else if (((PyTypeObject *)result)->tp_basicsize != size) {
- PyErr_Format(PyExc_ValueError,
- "%s.%s has the wrong size, try recompiling",
- module_name, class_name);
- goto bad;
- }
- return (PyTypeObject *)result;
- bad:
- Py_XDECREF(py_module);
- Py_XDECREF(result);
- return 0;
- }
- #endif
- #ifndef __PYX_HAVE_RT_ImportModule
- #define __PYX_HAVE_RT_ImportModule
- static PyObject *__Pyx_ImportModule(const char *name) {
- PyObject *py_name = 0;
- PyObject *py_module = 0;
- #if PY_MAJOR_VERSION < 3
- py_name = PyString_FromString(name);
- #else
- py_name = PyUnicode_FromString(name);
- #endif
- if (!py_name)
- goto bad;
- py_module = PyImport_Import(py_name);
- Py_DECREF(py_name);
- return py_module;
- bad:
- Py_XDECREF(py_name);
- return 0;
- }
- #endif
- static void* __Pyx_GetVtable(PyObject *dict) {
- void* ptr;
- PyObject *ob = PyMapping_GetItemString(dict, (char *)"__pyx_vtable__");
- if (!ob)
- goto bad;
- #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
- ptr = PyCapsule_GetPointer(ob, 0);
- #else
- ptr = PyCObject_AsVoidPtr(ob);
- #endif
- if (!ptr && !PyErr_Occurred())
- PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type");
- Py_DECREF(ob);
- return ptr;
- bad:
- Py_XDECREF(ob);
- return NULL;
- }
- #ifndef __PYX_HAVE_RT_ImportFunction
- #define __PYX_HAVE_RT_ImportFunction
- static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) {
- PyObject *d = 0;
- PyObject *cobj = 0;
- union {
- void (*fp)(void);
- void *p;
- } tmp;
- d = PyObject_GetAttrString(module, (char *)"__pyx_capi__");
- if (!d)
- goto bad;
- cobj = PyDict_GetItemString(d, funcname);
- if (!cobj) {
- PyErr_Format(PyExc_ImportError,
- "%s does not export expected C function %s",
- PyModule_GetName(module), funcname);
- goto bad;
- }
- #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
- if (!PyCapsule_IsValid(cobj, sig)) {
- PyErr_Format(PyExc_TypeError,
- "C function %s.%s has wrong signature (expected %s, got %s)",
- PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj));
- goto bad;
- }
- tmp.p = PyCapsule_GetPointer(cobj, sig);
- #else
- {const char *desc, *s1, *s2;
- desc = (const char *)PyCObject_GetDesc(cobj);
- if (!desc)
- goto bad;
- s1 = desc; s2 = sig;
- while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
- if (*s1 != *s2) {
- PyErr_Format(PyExc_TypeError,
- "C function %s.%s has wrong signature (expected %s, got %s)",
- PyModule_GetName(module), funcname, sig, desc);
- goto bad;
- }
- tmp.p = PyCObject_AsVoidPtr(cobj);}
- #endif
- *f = tmp.fp;
- if (!(*f))
- goto bad;
- Py_DECREF(d);
- return 0;
- bad:
- Py_XDECREF(d);
- return -1;
- }
- #endif
- #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) {
- int is_true = x == Py_True;
- if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
- 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 */