/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
Large files files are truncated, but you can click here to view the full file
- /* 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)…
Large files files are truncated, but you can click here to view the full file