From 857932975997b82788488a7a20e4976e384f9a23 Mon Sep 17 00:00:00 2001 From: David Stuebe Date: Thu, 19 Apr 2012 23:18:12 -0700 Subject: [PATCH 1/2] Updated version number so we can force install from ooici fork. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index f34e341d..b4b1771d 100755 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # coding: utf-8 -version = (0, 1, 12) +version = (0, 1, 13) import os import sys From d048518680282fabd6681c0dadeff0f3c914ef77 Mon Sep 17 00:00:00 2001 From: David Stuebe Date: Fri, 20 Apr 2012 14:29:13 -0700 Subject: [PATCH 2/2] Added compiled msgpack file so we dont need cython --- msgpack/_msgpack.c | 6734 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 6734 insertions(+) create mode 100644 msgpack/_msgpack.c diff --git a/msgpack/_msgpack.c b/msgpack/_msgpack.c new file mode 100644 index 00000000..166d600f --- /dev/null +++ b/msgpack/_msgpack.c @@ -0,0 +1,6734 @@ +/* Generated by Cython 0.15.1 on Fri Apr 20 14:28:27 2012 */ + +#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 /* 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) __Pyx_PyInt_AsInt(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_VERSION_HEX < 0x03020000 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t PyInt_AsLong +#else + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t +#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 + +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) +#define _USE_MATH_DEFINES +#endif +#include +#define __PYX_HAVE__msgpack___msgpack +#define __PYX_HAVE_API__msgpack___msgpack +#include "stdio.h" +#include "pythread.h" +#include "stdlib.h" +#include "string.h" +#include "pack.h" +#include "unpack.h" +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#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_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) +#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[] = { + "_msgpack.pyx", + "bool.pxd", + "complex.pxd", +}; + +/*--- Type declarations ---*/ +struct __pyx_obj_7msgpack_8_msgpack_Unpacker; +struct __pyx_obj_7msgpack_8_msgpack_Packer; +struct __pyx_opt_args_7msgpack_8_msgpack_6Packer__pack; + +/* "msgpack/_msgpack.pyx":85 + * free(self.pk.buf); + * + * cdef int _pack(self, object o, int nest_limit=DEFAULT_RECURSE_LIMIT) except -1: # <<<<<<<<<<<<<< + * cdef long long llval + * cdef unsigned long long ullval + */ +struct __pyx_opt_args_7msgpack_8_msgpack_6Packer__pack { + int __pyx_n; + int nest_limit; +}; + +/* "msgpack/_msgpack.pyx":253 + * object_hook=object_hook, list_hook=list_hook, encoding=encoding, unicode_errors=unicode_errors) + * + * cdef class Unpacker(object): # <<<<<<<<<<<<<< + * """ + * Streaming unpacker. + */ +struct __pyx_obj_7msgpack_8_msgpack_Unpacker { + PyObject_HEAD + struct __pyx_vtabstruct_7msgpack_8_msgpack_Unpacker *__pyx_vtab; + template_context ctx; + char *buf; + size_t buf_size; + size_t buf_head; + size_t buf_tail; + PyObject *file_like; + PyObject *file_like_read; + Py_ssize_t read_size; + int use_list; + PyObject *object_hook; + PyObject *_bencoding; + PyObject *_berrors; + char *encoding; + char *unicode_errors; +}; + + +/* "msgpack/_msgpack.pyx":38 + * cdef int DEFAULT_RECURSE_LIMIT=511 + * + * cdef class Packer(object): # <<<<<<<<<<<<<< + * """MessagePack Packer + * + */ +struct __pyx_obj_7msgpack_8_msgpack_Packer { + PyObject_HEAD + struct __pyx_vtabstruct_7msgpack_8_msgpack_Packer *__pyx_vtab; + struct msgpack_packer pk; + PyObject *_default; + PyObject *_bencoding; + PyObject *_berrors; + char *encoding; + char *unicode_errors; +}; + + + +/* "msgpack/_msgpack.pyx":253 + * object_hook=object_hook, list_hook=list_hook, encoding=encoding, unicode_errors=unicode_errors) + * + * cdef class Unpacker(object): # <<<<<<<<<<<<<< + * """ + * Streaming unpacker. + */ + +struct __pyx_vtabstruct_7msgpack_8_msgpack_Unpacker { + PyObject *(*append_buffer)(struct __pyx_obj_7msgpack_8_msgpack_Unpacker *, void *, Py_ssize_t); + PyObject *(*fill_buffer)(struct __pyx_obj_7msgpack_8_msgpack_Unpacker *); + PyObject *(*unpack)(struct __pyx_obj_7msgpack_8_msgpack_Unpacker *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_7msgpack_8_msgpack_Unpacker *__pyx_vtabptr_7msgpack_8_msgpack_Unpacker; + + +/* "msgpack/_msgpack.pyx":38 + * cdef int DEFAULT_RECURSE_LIMIT=511 + * + * cdef class Packer(object): # <<<<<<<<<<<<<< + * """MessagePack Packer + * + */ + +struct __pyx_vtabstruct_7msgpack_8_msgpack_Packer { + int (*_pack)(struct __pyx_obj_7msgpack_8_msgpack_Packer *, PyObject *, struct __pyx_opt_args_7msgpack_8_msgpack_6Packer__pack *__pyx_optional_args); + PyObject *(*pack)(struct __pyx_obj_7msgpack_8_msgpack_Packer *, PyObject *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_7msgpack_8_msgpack_Packer *__pyx_vtabptr_7msgpack_8_msgpack_Packer; + +#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); /*proto*/ + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; + #define __Pyx_RefNannySetupContext(name) __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_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) +#else + #define __Pyx_RefNannyDeclarations + #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_XINCREF(r) Py_XINCREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) +#endif /* CYTHON_REFNANNY */ + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ + +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ + +static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, + const char* function_name, int kw_allowed); /*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, PyObject *cause); /*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 PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ + +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 int __Pyx_check_binary_version(void); + +static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ + +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ + +static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ + +static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, + int __pyx_lineno, const char *__pyx_filename); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + +/* 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.pystate' */ + +/* 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 'libc.stdlib' */ + +/* Module declarations from 'libc.string' */ + +/* Module declarations from 'msgpack._msgpack' */ +static PyTypeObject *__pyx_ptype_7msgpack_8_msgpack_Packer = 0; +static PyTypeObject *__pyx_ptype_7msgpack_8_msgpack_Unpacker = 0; +static int __pyx_v_7msgpack_8_msgpack_DEFAULT_RECURSE_LIMIT; +#define __Pyx_MODULE_NAME "msgpack._msgpack" +int __pyx_module_is_main_msgpack___msgpack = 0; + +/* Implementation of 'msgpack._msgpack' */ +static PyObject *__pyx_builtin_MemoryError; +static PyObject *__pyx_builtin_TypeError; +static PyObject *__pyx_builtin_ValueError; +static PyObject *__pyx_builtin_AssertionError; +static PyObject *__pyx_builtin_StopIteration; +static char __pyx_k_1[] = "Unable to allocate internal buffer."; +static char __pyx_k_3[] = "utf-8"; +static char __pyx_k_4[] = "default must be a callable."; +static char __pyx_k_9[] = "Too deep."; +static char __pyx_k_11[] = "Can't encode unicode string: no encoding is specified"; +static char __pyx_k_13[] = "can't serialize %r"; +static char __pyx_k_16[] = "object_hook must be a callable."; +static char __pyx_k_18[] = "list_hook must be a callable."; +static char __pyx_k_20[] = "`file_like.read` must be a callable."; +static char __pyx_k_27[] = "unpacker.feed() is not be able to use with`file_like`."; +static char __pyx_k_29[] = "Unable to enlarge internal buffer."; +static char __pyx_k_31[] = "No more unpack data."; +static char __pyx_k_33[] = "Unpack failed: error = %d"; +static char __pyx_k_34[] = "msgpack._msgpack"; +static char __pyx_k__o[] = "o"; +static char __pyx_k__gc[] = "gc"; +static char __pyx_k__pack[] = "pack"; +static char __pyx_k__read[] = "read"; +static char __pyx_k__ascii[] = "ascii"; +static char __pyx_k__packb[] = "packb"; +static char __pyx_k__write[] = "write"; +static char __pyx_k__enable[] = "enable"; +static char __pyx_k__encode[] = "encode"; +static char __pyx_k__packed[] = "packed"; +static char __pyx_k__stream[] = "stream"; +static char __pyx_k__strict[] = "strict"; +static char __pyx_k__unpack[] = "unpack"; +static char __pyx_k__default[] = "default"; +static char __pyx_k__disable[] = "disable"; +static char __pyx_k__unpackb[] = "unpackb"; +static char __pyx_k____main__[] = "__main__"; +static char __pyx_k____test__[] = "__test__"; +static char __pyx_k__encoding[] = "encoding"; +static char __pyx_k__use_list[] = "use_list"; +static char __pyx_k__TypeError[] = "TypeError"; +static char __pyx_k__file_like[] = "file_like"; +static char __pyx_k__list_hook[] = "list_hook"; +static char __pyx_k__read_size[] = "read_size"; +static char __pyx_k__ValueError[] = "ValueError"; +static char __pyx_k___gc_enable[] = "_gc_enable"; +static char __pyx_k__MemoryError[] = "MemoryError"; +static char __pyx_k___gc_disable[] = "_gc_disable"; +static char __pyx_k__object_hook[] = "object_hook"; +static char __pyx_k__StopIteration[] = "StopIteration"; +static char __pyx_k__AssertionError[] = "AssertionError"; +static char __pyx_k__unicode_errors[] = "unicode_errors"; +static PyObject *__pyx_kp_s_1; +static PyObject *__pyx_kp_s_11; +static PyObject *__pyx_kp_s_13; +static PyObject *__pyx_kp_s_16; +static PyObject *__pyx_kp_s_18; +static PyObject *__pyx_kp_s_20; +static PyObject *__pyx_kp_s_27; +static PyObject *__pyx_kp_s_29; +static PyObject *__pyx_kp_s_3; +static PyObject *__pyx_kp_s_31; +static PyObject *__pyx_kp_s_33; +static PyObject *__pyx_n_s_34; +static PyObject *__pyx_kp_s_4; +static PyObject *__pyx_kp_s_9; +static PyObject *__pyx_n_s__AssertionError; +static PyObject *__pyx_n_s__MemoryError; +static PyObject *__pyx_n_s__StopIteration; +static PyObject *__pyx_n_s__TypeError; +static PyObject *__pyx_n_s__ValueError; +static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____test__; +static PyObject *__pyx_n_s___gc_disable; +static PyObject *__pyx_n_s___gc_enable; +static PyObject *__pyx_n_s__ascii; +static PyObject *__pyx_n_s__default; +static PyObject *__pyx_n_s__disable; +static PyObject *__pyx_n_s__enable; +static PyObject *__pyx_n_s__encode; +static PyObject *__pyx_n_s__encoding; +static PyObject *__pyx_n_s__file_like; +static PyObject *__pyx_n_s__gc; +static PyObject *__pyx_n_s__list_hook; +static PyObject *__pyx_n_s__o; +static PyObject *__pyx_n_s__object_hook; +static PyObject *__pyx_n_s__pack; +static PyObject *__pyx_n_s__packb; +static PyObject *__pyx_n_s__packed; +static PyObject *__pyx_n_s__read; +static PyObject *__pyx_n_s__read_size; +static PyObject *__pyx_n_s__stream; +static PyObject *__pyx_n_s__strict; +static PyObject *__pyx_n_s__unicode_errors; +static PyObject *__pyx_n_s__unpack; +static PyObject *__pyx_n_s__unpackb; +static PyObject *__pyx_n_s__use_list; +static PyObject *__pyx_n_s__write; +static PyObject *__pyx_int_0; +static int __pyx_k_8; +static PyObject *__pyx_k_tuple_2; +static PyObject *__pyx_k_tuple_5; +static PyObject *__pyx_k_tuple_6; +static PyObject *__pyx_k_tuple_7; +static PyObject *__pyx_k_tuple_10; +static PyObject *__pyx_k_tuple_12; +static PyObject *__pyx_k_tuple_14; +static PyObject *__pyx_k_tuple_15; +static PyObject *__pyx_k_tuple_17; +static PyObject *__pyx_k_tuple_19; +static PyObject *__pyx_k_tuple_21; +static PyObject *__pyx_k_tuple_22; +static PyObject *__pyx_k_tuple_23; +static PyObject *__pyx_k_tuple_24; +static PyObject *__pyx_k_tuple_25; +static PyObject *__pyx_k_tuple_26; +static PyObject *__pyx_k_tuple_28; +static PyObject *__pyx_k_tuple_30; +static PyObject *__pyx_k_tuple_32; + +/* "msgpack/_msgpack.pyx":54 + * cdef char *unicode_errors + * + * def __cinit__(self): # <<<<<<<<<<<<<< + * cdef int buf_size = 1024*1024 + * self.pk.buf = malloc(buf_size); + */ + +static int __pyx_pf_7msgpack_8_msgpack_6Packer___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_7msgpack_8_msgpack_6Packer___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_v_buf_size; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__"); + if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1; + + /* "msgpack/_msgpack.pyx":55 + * + * def __cinit__(self): + * cdef int buf_size = 1024*1024 # <<<<<<<<<<<<<< + * self.pk.buf = malloc(buf_size); + * if self.pk.buf == NULL: + */ + __pyx_v_buf_size = 1048576; + + /* "msgpack/_msgpack.pyx":56 + * def __cinit__(self): + * cdef int buf_size = 1024*1024 + * self.pk.buf = malloc(buf_size); # <<<<<<<<<<<<<< + * if self.pk.buf == NULL: + * raise MemoryError("Unable to allocate internal buffer.") + */ + ((struct __pyx_obj_7msgpack_8_msgpack_Packer *)__pyx_v_self)->pk.buf = ((char *)malloc(__pyx_v_buf_size)); + + /* "msgpack/_msgpack.pyx":57 + * cdef int buf_size = 1024*1024 + * self.pk.buf = malloc(buf_size); + * if self.pk.buf == NULL: # <<<<<<<<<<<<<< + * raise MemoryError("Unable to allocate internal buffer.") + * self.pk.buf_size = buf_size + */ + __pyx_t_1 = (((struct __pyx_obj_7msgpack_8_msgpack_Packer *)__pyx_v_self)->pk.buf == NULL); + if (__pyx_t_1) { + + /* "msgpack/_msgpack.pyx":58 + * self.pk.buf = malloc(buf_size); + * if self.pk.buf == NULL: + * raise MemoryError("Unable to allocate internal buffer.") # <<<<<<<<<<<<<< + * self.pk.buf_size = buf_size + * self.pk.length = 0 + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "msgpack/_msgpack.pyx":59 + * if self.pk.buf == NULL: + * raise MemoryError("Unable to allocate internal buffer.") + * self.pk.buf_size = buf_size # <<<<<<<<<<<<<< + * self.pk.length = 0 + * + */ + ((struct __pyx_obj_7msgpack_8_msgpack_Packer *)__pyx_v_self)->pk.buf_size = __pyx_v_buf_size; + + /* "msgpack/_msgpack.pyx":60 + * raise MemoryError("Unable to allocate internal buffer.") + * self.pk.buf_size = buf_size + * self.pk.length = 0 # <<<<<<<<<<<<<< + * + * def __init__(self, default=None, encoding='utf-8', unicode_errors='strict'): + */ + ((struct __pyx_obj_7msgpack_8_msgpack_Packer *)__pyx_v_self)->pk.length = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("msgpack._msgpack.Packer.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "msgpack/_msgpack.pyx":62 + * self.pk.length = 0 + * + * def __init__(self, default=None, encoding='utf-8', unicode_errors='strict'): # <<<<<<<<<<<<<< + * if default is not None: + * if not PyCallable_Check(default): + */ + +static int __pyx_pf_7msgpack_8_msgpack_6Packer_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_7msgpack_8_msgpack_6Packer_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_default = 0; + PyObject *__pyx_v_encoding = 0; + PyObject *__pyx_v_unicode_errors = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + char *__pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__default,&__pyx_n_s__encoding,&__pyx_n_s__unicode_errors,0}; + __Pyx_RefNannySetupContext("__init__"); + { + PyObject* values[3] = {0,0,0}; + values[0] = ((PyObject *)Py_None); + values[1] = ((PyObject *)__pyx_kp_s_3); + values[2] = ((PyObject *)__pyx_n_s__strict); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + 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; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__default); + 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--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__unicode_errors); + 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), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + 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; + } + } + __pyx_v_default = values[0]; + __pyx_v_encoding = values[1]; + __pyx_v_unicode_errors = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("msgpack._msgpack.Packer.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + + /* "msgpack/_msgpack.pyx":63 + * + * def __init__(self, default=None, encoding='utf-8', unicode_errors='strict'): + * if default is not None: # <<<<<<<<<<<<<< + * if not PyCallable_Check(default): + * raise TypeError("default must be a callable.") + */ + __pyx_t_1 = (__pyx_v_default != Py_None); + if (__pyx_t_1) { + + /* "msgpack/_msgpack.pyx":64 + * def __init__(self, default=None, encoding='utf-8', unicode_errors='strict'): + * if default is not None: + * if not PyCallable_Check(default): # <<<<<<<<<<<<<< + * raise TypeError("default must be a callable.") + * self._default = default + */ + __pyx_t_1 = (!PyCallable_Check(__pyx_v_default)); + if (__pyx_t_1) { + + /* "msgpack/_msgpack.pyx":65 + * if default is not None: + * if not PyCallable_Check(default): + * raise TypeError("default must be a callable.") # <<<<<<<<<<<<<< + * self._default = default + * if encoding is None: + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_5), NULL); 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_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; + goto __pyx_L6; + } + __pyx_L6:; + + /* "msgpack/_msgpack.pyx":66 + * if not PyCallable_Check(default): + * raise TypeError("default must be a callable.") + * self._default = default # <<<<<<<<<<<<<< + * if encoding is None: + * self.encoding = NULL + */ + __Pyx_INCREF(__pyx_v_default); + __Pyx_GIVEREF(__pyx_v_default); + __Pyx_GOTREF(((struct __pyx_obj_7msgpack_8_msgpack_Packer *)__pyx_v_self)->_default); + __Pyx_DECREF(((struct __pyx_obj_7msgpack_8_msgpack_Packer *)__pyx_v_self)->_default); + ((struct __pyx_obj_7msgpack_8_msgpack_Packer *)__pyx_v_self)->_default = __pyx_v_default; + + /* "msgpack/_msgpack.pyx":67 + * raise TypeError("default must be a callable.") + * self._default = default + * if encoding is None: # <<<<<<<<<<<<<< + * self.encoding = NULL + * self.unicode_errors = NULL + */ + __pyx_t_1 = (__pyx_v_encoding == Py_None); + if (__pyx_t_1) { + + /* "msgpack/_msgpack.pyx":68 + * self._default = default + * if encoding is None: + * self.encoding = NULL # <<<<<<<<<<<<<< + * self.unicode_errors = NULL + * else: + */ + ((struct __pyx_obj_7msgpack_8_msgpack_Packer *)__pyx_v_self)->encoding = NULL; + + /* "msgpack/_msgpack.pyx":69 + * if encoding is None: + * self.encoding = NULL + * self.unicode_errors = NULL # <<<<<<<<<<<<<< + * else: + * if isinstance(encoding, unicode): + */ + ((struct __pyx_obj_7msgpack_8_msgpack_Packer *)__pyx_v_self)->unicode_errors = NULL; + goto __pyx_L8; + } + /*else*/ { + + /* "msgpack/_msgpack.pyx":71 + * self.unicode_errors = NULL + * else: + * if isinstance(encoding, unicode): # <<<<<<<<<<<<<< + * self._bencoding = encoding.encode('ascii') + * else: + */ + __pyx_t_2 = ((PyObject *)((PyObject*)(&PyUnicode_Type))); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_encoding, __pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_1) { + + /* "msgpack/_msgpack.pyx":72 + * else: + * if isinstance(encoding, unicode): + * self._bencoding = encoding.encode('ascii') # <<<<<<<<<<<<<< + * else: + * self._bencoding = encoding + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_encoding, __pyx_n_s__encode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GOTREF(((struct __pyx_obj_7msgpack_8_msgpack_Packer *)__pyx_v_self)->_bencoding); + __Pyx_DECREF(((struct __pyx_obj_7msgpack_8_msgpack_Packer *)__pyx_v_self)->_bencoding); + ((struct __pyx_obj_7msgpack_8_msgpack_Packer *)__pyx_v_self)->_bencoding = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L9; + } + /*else*/ { + + /* "msgpack/_msgpack.pyx":74 + * self._bencoding = encoding.encode('ascii') + * else: + * self._bencoding = encoding # <<<<<<<<<<<<<< + * self.encoding = PyBytes_AsString(self._bencoding) + * if isinstance(unicode_errors, unicode): + */ + __Pyx_INCREF(__pyx_v_encoding); + __Pyx_GIVEREF(__pyx_v_encoding); + __Pyx_GOTREF(((struct __pyx_obj_7msgpack_8_msgpack_Packer *)__pyx_v_self)->_bencoding); + __Pyx_DECREF(((struct __pyx_obj_7msgpack_8_msgpack_Packer *)__pyx_v_self)->_bencoding); + ((struct __pyx_obj_7msgpack_8_msgpack_Packer *)__pyx_v_self)->_bencoding = __pyx_v_encoding; + } + __pyx_L9:; + + /* "msgpack/_msgpack.pyx":75 + * else: + * self._bencoding = encoding + * self.encoding = PyBytes_AsString(self._bencoding) # <<<<<<<<<<<<<< + * if isinstance(unicode_errors, unicode): + * self._berrors = unicode_errors.encode('ascii') + */ + __pyx_t_3 = ((struct __pyx_obj_7msgpack_8_msgpack_Packer *)__pyx_v_self)->_bencoding; + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = PyBytes_AsString(__pyx_t_3); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + ((struct __pyx_obj_7msgpack_8_msgpack_Packer *)__pyx_v_self)->encoding = __pyx_t_4; + + /* "msgpack/_msgpack.pyx":76 + * self._bencoding = encoding + * self.encoding = PyBytes_AsString(self._bencoding) + * if isinstance(unicode_errors, unicode): # <<<<<<<<<<<<<< + * self._berrors = unicode_errors.encode('ascii') + * else: + */ + __pyx_t_3 = ((PyObject *)((PyObject*)(&PyUnicode_Type))); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_unicode_errors, __pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_1) { + + /* "msgpack/_msgpack.pyx":77 + * self.encoding = PyBytes_AsString(self._bencoding) + * if isinstance(unicode_errors, unicode): + * self._berrors = unicode_errors.encode('ascii') # <<<<<<<<<<<<<< + * else: + * self._berrors = unicode_errors + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_unicode_errors, __pyx_n_s__encode); 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_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_7), NULL); 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_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(((struct __pyx_obj_7msgpack_8_msgpack_Packer *)__pyx_v_self)->_berrors); + __Pyx_DECREF(((struct __pyx_obj_7msgpack_8_msgpack_Packer *)__pyx_v_self)->_berrors); + ((struct __pyx_obj_7msgpack_8_msgpack_Packer *)__pyx_v_self)->_berrors = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L10; + } + /*else*/ { + + /* "msgpack/_msgpack.pyx":79 + * self._berrors = unicode_errors.encode('ascii') + * else: + * self._berrors = unicode_errors # <<<<<<<<<<<<<< + * self.unicode_errors = PyBytes_AsString(self._berrors) + * + */ + __Pyx_INCREF(__pyx_v_unicode_errors); + __Pyx_GIVEREF(__pyx_v_unicode_errors); + __Pyx_GOTREF(((struct __pyx_obj_7msgpack_8_msgpack_Packer *)__pyx_v_self)->_berrors); + __Pyx_DECREF(((struct __pyx_obj_7msgpack_8_msgpack_Packer *)__pyx_v_self)->_berrors); + ((struct __pyx_obj_7msgpack_8_msgpack_Packer *)__pyx_v_self)->_berrors = __pyx_v_unicode_errors; + } + __pyx_L10:; + + /* "msgpack/_msgpack.pyx":80 + * else: + * self._berrors = unicode_errors + * self.unicode_errors = PyBytes_AsString(self._berrors) # <<<<<<<<<<<<<< + * + * def __dealloc__(self): + */ + __pyx_t_2 = ((struct __pyx_obj_7msgpack_8_msgpack_Packer *)__pyx_v_self)->_berrors; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_4 = PyBytes_AsString(__pyx_t_2); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + ((struct __pyx_obj_7msgpack_8_msgpack_Packer *)__pyx_v_self)->unicode_errors = __pyx_t_4; + } + __pyx_L8:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("msgpack._msgpack.Packer.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "msgpack/_msgpack.pyx":82 + * self.unicode_errors = PyBytes_AsString(self._berrors) + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * free(self.pk.buf); + * + */ + +static void __pyx_pf_7msgpack_8_msgpack_6Packer_2__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pf_7msgpack_8_msgpack_6Packer_2__dealloc__(PyObject *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__"); + + /* "msgpack/_msgpack.pyx":83 + * + * def __dealloc__(self): + * free(self.pk.buf); # <<<<<<<<<<<<<< + * + * cdef int _pack(self, object o, int nest_limit=DEFAULT_RECURSE_LIMIT) except -1: + */ + free(((struct __pyx_obj_7msgpack_8_msgpack_Packer *)__pyx_v_self)->pk.buf); + + __Pyx_RefNannyFinishContext(); +} + +/* "msgpack/_msgpack.pyx":85 + * free(self.pk.buf); + * + * cdef int _pack(self, object o, int nest_limit=DEFAULT_RECURSE_LIMIT) except -1: # <<<<<<<<<<<<<< + * cdef long long llval + * cdef unsigned long long ullval + */ + +static int __pyx_f_7msgpack_8_msgpack_6Packer__pack(struct __pyx_obj_7msgpack_8_msgpack_Packer *__pyx_v_self, PyObject *__pyx_v_o, struct __pyx_opt_args_7msgpack_8_msgpack_6Packer__pack *__pyx_optional_args) { + int __pyx_v_nest_limit = __pyx_k_8; + PY_LONG_LONG __pyx_v_llval; + unsigned PY_LONG_LONG __pyx_v_ullval; + long __pyx_v_longval; + double __pyx_v_fval; + char *__pyx_v_rawval; + int __pyx_v_ret; + PyObject *__pyx_v_d = 0; + PyObject *__pyx_v_k = NULL; + PyObject *__pyx_v_v = NULL; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + unsigned PY_LONG_LONG __pyx_t_3; + PY_LONG_LONG __pyx_t_4; + long __pyx_t_5; + double __pyx_t_6; + char *__pyx_t_7; + Py_ssize_t __pyx_t_8; + Py_ssize_t __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + int __pyx_t_12; + struct __pyx_opt_args_7msgpack_8_msgpack_6Packer__pack __pyx_t_13; + int __pyx_t_14; + int __pyx_t_15; + PyObject *(*__pyx_t_16)(PyObject *); + PyObject *__pyx_t_17 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_pack"); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_nest_limit = __pyx_optional_args->nest_limit; + } + } + __Pyx_INCREF(__pyx_v_o); + + /* "msgpack/_msgpack.pyx":94 + * cdef dict d + * + * if nest_limit < 0: # <<<<<<<<<<<<<< + * raise ValueError("Too deep.") + * + */ + __pyx_t_1 = (__pyx_v_nest_limit < 0); + if (__pyx_t_1) { + + /* "msgpack/_msgpack.pyx":95 + * + * if nest_limit < 0: + * raise ValueError("Too deep.") # <<<<<<<<<<<<<< + * + * if o is None: + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "msgpack/_msgpack.pyx":97 + * raise ValueError("Too deep.") + * + * if o is None: # <<<<<<<<<<<<<< + * ret = msgpack_pack_nil(&self.pk) + * elif isinstance(o, bool): + */ + __pyx_t_1 = (__pyx_v_o == Py_None); + if (__pyx_t_1) { + + /* "msgpack/_msgpack.pyx":98 + * + * if o is None: + * ret = msgpack_pack_nil(&self.pk) # <<<<<<<<<<<<<< + * elif isinstance(o, bool): + * if o: + */ + __pyx_v_ret = msgpack_pack_nil((&__pyx_v_self->pk)); + goto __pyx_L4; + } + + /* "msgpack/_msgpack.pyx":99 + * if o is None: + * ret = msgpack_pack_nil(&self.pk) + * elif isinstance(o, bool): # <<<<<<<<<<<<<< + * if o: + * ret = msgpack_pack_true(&self.pk) + */ + __pyx_t_2 = ((PyObject *)((PyObject*)__pyx_ptype_7cpython_4bool_bool)); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_1) { + + /* "msgpack/_msgpack.pyx":100 + * ret = msgpack_pack_nil(&self.pk) + * elif isinstance(o, bool): + * if o: # <<<<<<<<<<<<<< + * ret = msgpack_pack_true(&self.pk) + * else: + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_o); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + + /* "msgpack/_msgpack.pyx":101 + * elif isinstance(o, bool): + * if o: + * ret = msgpack_pack_true(&self.pk) # <<<<<<<<<<<<<< + * else: + * ret = msgpack_pack_false(&self.pk) + */ + __pyx_v_ret = msgpack_pack_true((&__pyx_v_self->pk)); + goto __pyx_L5; + } + /*else*/ { + + /* "msgpack/_msgpack.pyx":103 + * ret = msgpack_pack_true(&self.pk) + * else: + * ret = msgpack_pack_false(&self.pk) # <<<<<<<<<<<<<< + * elif PyLong_Check(o): + * if o > 0: + */ + __pyx_v_ret = msgpack_pack_false((&__pyx_v_self->pk)); + } + __pyx_L5:; + goto __pyx_L4; + } + + /* "msgpack/_msgpack.pyx":104 + * else: + * ret = msgpack_pack_false(&self.pk) + * elif PyLong_Check(o): # <<<<<<<<<<<<<< + * if o > 0: + * ullval = o + */ + __pyx_t_1 = PyLong_Check(__pyx_v_o); + if (__pyx_t_1) { + + /* "msgpack/_msgpack.pyx":105 + * ret = msgpack_pack_false(&self.pk) + * elif PyLong_Check(o): + * if o > 0: # <<<<<<<<<<<<<< + * ullval = o + * ret = msgpack_pack_unsigned_long_long(&self.pk, ullval) + */ + __pyx_t_2 = PyObject_RichCompare(__pyx_v_o, __pyx_int_0, Py_GT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_1) { + + /* "msgpack/_msgpack.pyx":106 + * elif PyLong_Check(o): + * if o > 0: + * ullval = o # <<<<<<<<<<<<<< + * ret = msgpack_pack_unsigned_long_long(&self.pk, ullval) + * else: + */ + __pyx_t_3 = __Pyx_PyInt_AsUnsignedLongLong(__pyx_v_o); if (unlikely((__pyx_t_3 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_ullval = __pyx_t_3; + + /* "msgpack/_msgpack.pyx":107 + * if o > 0: + * ullval = o + * ret = msgpack_pack_unsigned_long_long(&self.pk, ullval) # <<<<<<<<<<<<<< + * else: + * llval = o + */ + __pyx_v_ret = msgpack_pack_unsigned_long_long((&__pyx_v_self->pk), __pyx_v_ullval); + goto __pyx_L6; + } + /*else*/ { + + /* "msgpack/_msgpack.pyx":109 + * ret = msgpack_pack_unsigned_long_long(&self.pk, ullval) + * else: + * llval = o # <<<<<<<<<<<<<< + * ret = msgpack_pack_long_long(&self.pk, llval) + * elif PyInt_Check(o): + */ + __pyx_t_4 = __Pyx_PyInt_AsLongLong(__pyx_v_o); if (unlikely((__pyx_t_4 == (PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_llval = __pyx_t_4; + + /* "msgpack/_msgpack.pyx":110 + * else: + * llval = o + * ret = msgpack_pack_long_long(&self.pk, llval) # <<<<<<<<<<<<<< + * elif PyInt_Check(o): + * longval = o + */ + __pyx_v_ret = msgpack_pack_long_long((&__pyx_v_self->pk), __pyx_v_llval); + } + __pyx_L6:; + goto __pyx_L4; + } + + /* "msgpack/_msgpack.pyx":111 + * llval = o + * ret = msgpack_pack_long_long(&self.pk, llval) + * elif PyInt_Check(o): # <<<<<<<<<<<<<< + * longval = o + * ret = msgpack_pack_long(&self.pk, longval) + */ + __pyx_t_1 = PyInt_Check(__pyx_v_o); + if (__pyx_t_1) { + + /* "msgpack/_msgpack.pyx":112 + * ret = msgpack_pack_long_long(&self.pk, llval) + * elif PyInt_Check(o): + * longval = o # <<<<<<<<<<<<<< + * ret = msgpack_pack_long(&self.pk, longval) + * elif PyFloat_Check(o): + */ + __pyx_t_5 = __Pyx_PyInt_AsLong(__pyx_v_o); if (unlikely((__pyx_t_5 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_longval = __pyx_t_5; + + /* "msgpack/_msgpack.pyx":113 + * elif PyInt_Check(o): + * longval = o + * ret = msgpack_pack_long(&self.pk, longval) # <<<<<<<<<<<<<< + * elif PyFloat_Check(o): + * fval = o + */ + __pyx_v_ret = msgpack_pack_long((&__pyx_v_self->pk), __pyx_v_longval); + goto __pyx_L4; + } + + /* "msgpack/_msgpack.pyx":114 + * longval = o + * ret = msgpack_pack_long(&self.pk, longval) + * elif PyFloat_Check(o): # <<<<<<<<<<<<<< + * fval = o + * ret = msgpack_pack_double(&self.pk, fval) + */ + __pyx_t_1 = PyFloat_Check(__pyx_v_o); + if (__pyx_t_1) { + + /* "msgpack/_msgpack.pyx":115 + * ret = msgpack_pack_long(&self.pk, longval) + * elif PyFloat_Check(o): + * fval = o # <<<<<<<<<<<<<< + * ret = msgpack_pack_double(&self.pk, fval) + * elif PyBytes_Check(o): + */ + __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_v_o); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_fval = __pyx_t_6; + + /* "msgpack/_msgpack.pyx":116 + * elif PyFloat_Check(o): + * fval = o + * ret = msgpack_pack_double(&self.pk, fval) # <<<<<<<<<<<<<< + * elif PyBytes_Check(o): + * rawval = o + */ + __pyx_v_ret = msgpack_pack_double((&__pyx_v_self->pk), __pyx_v_fval); + goto __pyx_L4; + } + + /* "msgpack/_msgpack.pyx":117 + * fval = o + * ret = msgpack_pack_double(&self.pk, fval) + * elif PyBytes_Check(o): # <<<<<<<<<<<<<< + * rawval = o + * ret = msgpack_pack_raw(&self.pk, len(o)) + */ + __pyx_t_1 = PyBytes_Check(__pyx_v_o); + if (__pyx_t_1) { + + /* "msgpack/_msgpack.pyx":118 + * ret = msgpack_pack_double(&self.pk, fval) + * elif PyBytes_Check(o): + * rawval = o # <<<<<<<<<<<<<< + * ret = msgpack_pack_raw(&self.pk, len(o)) + * if ret == 0: + */ + __pyx_t_7 = PyBytes_AsString(__pyx_v_o); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_rawval = __pyx_t_7; + + /* "msgpack/_msgpack.pyx":119 + * elif PyBytes_Check(o): + * rawval = o + * ret = msgpack_pack_raw(&self.pk, len(o)) # <<<<<<<<<<<<<< + * if ret == 0: + * ret = msgpack_pack_raw_body(&self.pk, rawval, len(o)) + */ + __pyx_t_8 = PyObject_Length(__pyx_v_o); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_ret = msgpack_pack_raw((&__pyx_v_self->pk), __pyx_t_8); + + /* "msgpack/_msgpack.pyx":120 + * rawval = o + * ret = msgpack_pack_raw(&self.pk, len(o)) + * if ret == 0: # <<<<<<<<<<<<<< + * ret = msgpack_pack_raw_body(&self.pk, rawval, len(o)) + * elif PyUnicode_Check(o): + */ + __pyx_t_1 = (__pyx_v_ret == 0); + if (__pyx_t_1) { + + /* "msgpack/_msgpack.pyx":121 + * ret = msgpack_pack_raw(&self.pk, len(o)) + * if ret == 0: + * ret = msgpack_pack_raw_body(&self.pk, rawval, len(o)) # <<<<<<<<<<<<<< + * elif PyUnicode_Check(o): + * if not self.encoding: + */ + __pyx_t_8 = PyObject_Length(__pyx_v_o); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_ret = msgpack_pack_raw_body((&__pyx_v_self->pk), __pyx_v_rawval, __pyx_t_8); + goto __pyx_L7; + } + __pyx_L7:; + goto __pyx_L4; + } + + /* "msgpack/_msgpack.pyx":122 + * if ret == 0: + * ret = msgpack_pack_raw_body(&self.pk, rawval, len(o)) + * elif PyUnicode_Check(o): # <<<<<<<<<<<<<< + * if not self.encoding: + * raise TypeError("Can't encode unicode string: no encoding is specified") + */ + __pyx_t_1 = PyUnicode_Check(__pyx_v_o); + if (__pyx_t_1) { + + /* "msgpack/_msgpack.pyx":123 + * ret = msgpack_pack_raw_body(&self.pk, rawval, len(o)) + * elif PyUnicode_Check(o): + * if not self.encoding: # <<<<<<<<<<<<<< + * raise TypeError("Can't encode unicode string: no encoding is specified") + * o = PyUnicode_AsEncodedString(o, self.encoding, self.unicode_errors) + */ + __pyx_t_1 = (!(__pyx_v_self->encoding != 0)); + if (__pyx_t_1) { + + /* "msgpack/_msgpack.pyx":124 + * elif PyUnicode_Check(o): + * if not self.encoding: + * raise TypeError("Can't encode unicode string: no encoding is specified") # <<<<<<<<<<<<<< + * o = PyUnicode_AsEncodedString(o, self.encoding, self.unicode_errors) + * rawval = o + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; + } + __pyx_L8:; + + /* "msgpack/_msgpack.pyx":125 + * if not self.encoding: + * raise TypeError("Can't encode unicode string: no encoding is specified") + * o = PyUnicode_AsEncodedString(o, self.encoding, self.unicode_errors) # <<<<<<<<<<<<<< + * rawval = o + * ret = msgpack_pack_raw(&self.pk, len(o)) + */ + __pyx_t_2 = PyUnicode_AsEncodedString(__pyx_v_o, __pyx_v_self->encoding, __pyx_v_self->unicode_errors); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_o); + __pyx_v_o = __pyx_t_2; + __pyx_t_2 = 0; + + /* "msgpack/_msgpack.pyx":126 + * raise TypeError("Can't encode unicode string: no encoding is specified") + * o = PyUnicode_AsEncodedString(o, self.encoding, self.unicode_errors) + * rawval = o # <<<<<<<<<<<<<< + * ret = msgpack_pack_raw(&self.pk, len(o)) + * if ret == 0: + */ + __pyx_t_7 = PyBytes_AsString(__pyx_v_o); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_rawval = __pyx_t_7; + + /* "msgpack/_msgpack.pyx":127 + * o = PyUnicode_AsEncodedString(o, self.encoding, self.unicode_errors) + * rawval = o + * ret = msgpack_pack_raw(&self.pk, len(o)) # <<<<<<<<<<<<<< + * if ret == 0: + * ret = msgpack_pack_raw_body(&self.pk, rawval, len(o)) + */ + __pyx_t_8 = PyObject_Length(__pyx_v_o); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_ret = msgpack_pack_raw((&__pyx_v_self->pk), __pyx_t_8); + + /* "msgpack/_msgpack.pyx":128 + * rawval = o + * ret = msgpack_pack_raw(&self.pk, len(o)) + * if ret == 0: # <<<<<<<<<<<<<< + * ret = msgpack_pack_raw_body(&self.pk, rawval, len(o)) + * elif PyDict_Check(o): + */ + __pyx_t_1 = (__pyx_v_ret == 0); + if (__pyx_t_1) { + + /* "msgpack/_msgpack.pyx":129 + * ret = msgpack_pack_raw(&self.pk, len(o)) + * if ret == 0: + * ret = msgpack_pack_raw_body(&self.pk, rawval, len(o)) # <<<<<<<<<<<<<< + * elif PyDict_Check(o): + * d = o + */ + __pyx_t_8 = PyObject_Length(__pyx_v_o); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_ret = msgpack_pack_raw_body((&__pyx_v_self->pk), __pyx_v_rawval, __pyx_t_8); + goto __pyx_L9; + } + __pyx_L9:; + goto __pyx_L4; + } + + /* "msgpack/_msgpack.pyx":130 + * if ret == 0: + * ret = msgpack_pack_raw_body(&self.pk, rawval, len(o)) + * elif PyDict_Check(o): # <<<<<<<<<<<<<< + * d = o + * ret = msgpack_pack_map(&self.pk, len(d)) + */ + __pyx_t_1 = PyDict_Check(__pyx_v_o); + if (__pyx_t_1) { + + /* "msgpack/_msgpack.pyx":131 + * ret = msgpack_pack_raw_body(&self.pk, rawval, len(o)) + * elif PyDict_Check(o): + * d = o # <<<<<<<<<<<<<< + * ret = msgpack_pack_map(&self.pk, len(d)) + * if ret == 0: + */ + if (!(likely(PyDict_CheckExact(__pyx_v_o))||((__pyx_v_o) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected dict, got %.200s", Py_TYPE(__pyx_v_o)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_v_o); + __pyx_v_d = ((PyObject*)__pyx_v_o); + + /* "msgpack/_msgpack.pyx":132 + * elif PyDict_Check(o): + * d = o + * ret = msgpack_pack_map(&self.pk, len(d)) # <<<<<<<<<<<<<< + * if ret == 0: + * for k,v in d.iteritems(): + */ + if (unlikely(((PyObject *)__pyx_v_d) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_8 = PyDict_Size(((PyObject *)__pyx_v_d)); + __pyx_v_ret = msgpack_pack_map((&__pyx_v_self->pk), __pyx_t_8); + + /* "msgpack/_msgpack.pyx":133 + * d = o + * ret = msgpack_pack_map(&self.pk, len(d)) + * if ret == 0: # <<<<<<<<<<<<<< + * for k,v in d.iteritems(): + * ret = self._pack(k, nest_limit-1) + */ + __pyx_t_1 = (__pyx_v_ret == 0); + if (__pyx_t_1) { + + /* "msgpack/_msgpack.pyx":134 + * ret = msgpack_pack_map(&self.pk, len(d)) + * if ret == 0: + * for k,v in d.iteritems(): # <<<<<<<<<<<<<< + * ret = self._pack(k, nest_limit-1) + * if ret != 0: break + */ + __Pyx_INCREF(((PyObject *)__pyx_v_d)); + __Pyx_XDECREF(__pyx_t_2); + __pyx_t_2 = ((PyObject *)__pyx_v_d); + __pyx_t_8 = 0; + __pyx_t_9 = PyDict_Size(__pyx_t_2); + while (1) { + if (unlikely(__pyx_t_9 != PyDict_Size(__pyx_t_2))) { + PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + if (!PyDict_Next(__pyx_t_2, (&__pyx_t_8), (&__pyx_t_10), (&__pyx_t_11))) break; + __Pyx_INCREF(((PyObject *)__pyx_t_10)); + __Pyx_XDECREF(__pyx_v_k); + __pyx_v_k = __pyx_t_10; + __Pyx_INCREF(((PyObject *)__pyx_t_11)); + __Pyx_XDECREF(__pyx_v_v); + __pyx_v_v = __pyx_t_11; + + /* "msgpack/_msgpack.pyx":135 + * if ret == 0: + * for k,v in d.iteritems(): + * ret = self._pack(k, nest_limit-1) # <<<<<<<<<<<<<< + * if ret != 0: break + * ret = self._pack(v, nest_limit-1) + */ + __pyx_t_13.__pyx_n = 1; + __pyx_t_13.nest_limit = (__pyx_v_nest_limit - 1); + __pyx_t_12 = ((struct __pyx_vtabstruct_7msgpack_8_msgpack_Packer *)__pyx_v_self->__pyx_vtab)->_pack(__pyx_v_self, __pyx_v_k, &__pyx_t_13); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_ret = __pyx_t_12; + + /* "msgpack/_msgpack.pyx":136 + * for k,v in d.iteritems(): + * ret = self._pack(k, nest_limit-1) + * if ret != 0: break # <<<<<<<<<<<<<< + * ret = self._pack(v, nest_limit-1) + * if ret != 0: break + */ + __pyx_t_1 = (__pyx_v_ret != 0); + if (__pyx_t_1) { + goto __pyx_L12_break; + goto __pyx_L13; + } + __pyx_L13:; + + /* "msgpack/_msgpack.pyx":137 + * ret = self._pack(k, nest_limit-1) + * if ret != 0: break + * ret = self._pack(v, nest_limit-1) # <<<<<<<<<<<<<< + * if ret != 0: break + * elif PyTuple_Check(o) or PyList_Check(o): + */ + __pyx_t_13.__pyx_n = 1; + __pyx_t_13.nest_limit = (__pyx_v_nest_limit - 1); + __pyx_t_12 = ((struct __pyx_vtabstruct_7msgpack_8_msgpack_Packer *)__pyx_v_self->__pyx_vtab)->_pack(__pyx_v_self, __pyx_v_v, &__pyx_t_13); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_ret = __pyx_t_12; + + /* "msgpack/_msgpack.pyx":138 + * if ret != 0: break + * ret = self._pack(v, nest_limit-1) + * if ret != 0: break # <<<<<<<<<<<<<< + * elif PyTuple_Check(o) or PyList_Check(o): + * ret = msgpack_pack_array(&self.pk, len(o)) + */ + __pyx_t_1 = (__pyx_v_ret != 0); + if (__pyx_t_1) { + goto __pyx_L12_break; + goto __pyx_L14; + } + __pyx_L14:; + } + __pyx_L12_break:; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L10; + } + __pyx_L10:; + goto __pyx_L4; + } + + /* "msgpack/_msgpack.pyx":139 + * ret = self._pack(v, nest_limit-1) + * if ret != 0: break + * elif PyTuple_Check(o) or PyList_Check(o): # <<<<<<<<<<<<<< + * ret = msgpack_pack_array(&self.pk, len(o)) + * if ret == 0: + */ + __pyx_t_1 = PyTuple_Check(__pyx_v_o); + if (!__pyx_t_1) { + __pyx_t_14 = PyList_Check(__pyx_v_o); + __pyx_t_15 = __pyx_t_14; + } else { + __pyx_t_15 = __pyx_t_1; + } + if (__pyx_t_15) { + + /* "msgpack/_msgpack.pyx":140 + * if ret != 0: break + * elif PyTuple_Check(o) or PyList_Check(o): + * ret = msgpack_pack_array(&self.pk, len(o)) # <<<<<<<<<<<<<< + * if ret == 0: + * for v in o: + */ + __pyx_t_9 = PyObject_Length(__pyx_v_o); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_ret = msgpack_pack_array((&__pyx_v_self->pk), __pyx_t_9); + + /* "msgpack/_msgpack.pyx":141 + * elif PyTuple_Check(o) or PyList_Check(o): + * ret = msgpack_pack_array(&self.pk, len(o)) + * if ret == 0: # <<<<<<<<<<<<<< + * for v in o: + * ret = self._pack(v, nest_limit-1) + */ + __pyx_t_15 = (__pyx_v_ret == 0); + if (__pyx_t_15) { + + /* "msgpack/_msgpack.pyx":142 + * ret = msgpack_pack_array(&self.pk, len(o)) + * if ret == 0: + * for v in o: # <<<<<<<<<<<<<< + * ret = self._pack(v, nest_limit-1) + * if ret != 0: break + */ + if (PyList_CheckExact(__pyx_v_o) || PyTuple_CheckExact(__pyx_v_o)) { + __pyx_t_2 = __pyx_v_o; __Pyx_INCREF(__pyx_t_2); __pyx_t_9 = 0; + __pyx_t_16 = NULL; + } else { + __pyx_t_9 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_o); 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_16 = Py_TYPE(__pyx_t_2)->tp_iternext; + } + for (;;) { + if (PyList_CheckExact(__pyx_t_2)) { + if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_2)) break; + __pyx_t_17 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_9); __Pyx_INCREF(__pyx_t_17); __pyx_t_9++; + } else if (PyTuple_CheckExact(__pyx_t_2)) { + if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + __pyx_t_17 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_9); __Pyx_INCREF(__pyx_t_17); __pyx_t_9++; + } else { + __pyx_t_17 = __pyx_t_16(__pyx_t_2); + if (unlikely(!__pyx_t_17)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_17); + } + __Pyx_XDECREF(__pyx_v_v); + __pyx_v_v = __pyx_t_17; + __pyx_t_17 = 0; + + /* "msgpack/_msgpack.pyx":143 + * if ret == 0: + * for v in o: + * ret = self._pack(v, nest_limit-1) # <<<<<<<<<<<<<< + * if ret != 0: break + * elif self._default: + */ + __pyx_t_13.__pyx_n = 1; + __pyx_t_13.nest_limit = (__pyx_v_nest_limit - 1); + __pyx_t_12 = ((struct __pyx_vtabstruct_7msgpack_8_msgpack_Packer *)__pyx_v_self->__pyx_vtab)->_pack(__pyx_v_self, __pyx_v_v, &__pyx_t_13); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_ret = __pyx_t_12; + + /* "msgpack/_msgpack.pyx":144 + * for v in o: + * ret = self._pack(v, nest_limit-1) + * if ret != 0: break # <<<<<<<<<<<<<< + * elif self._default: + * o = self._default(o) + */ + __pyx_t_15 = (__pyx_v_ret != 0); + if (__pyx_t_15) { + goto __pyx_L17_break; + goto __pyx_L18; + } + __pyx_L18:; + } + __pyx_L17_break:; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L15; + } + __pyx_L15:; + goto __pyx_L4; + } + + /* "msgpack/_msgpack.pyx":145 + * ret = self._pack(v, nest_limit-1) + * if ret != 0: break + * elif self._default: # <<<<<<<<<<<<<< + * o = self._default(o) + * ret = self._pack(o, nest_limit-1) + */ + __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_v_self->_default); if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_15) { + + /* "msgpack/_msgpack.pyx":146 + * if ret != 0: break + * elif self._default: + * o = self._default(o) # <<<<<<<<<<<<<< + * ret = self._pack(o, nest_limit-1) + * else: + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_o); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_o); + __Pyx_GIVEREF(__pyx_v_o); + __pyx_t_17 = PyObject_Call(__pyx_v_self->_default, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_17); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_o); + __pyx_v_o = __pyx_t_17; + __pyx_t_17 = 0; + + /* "msgpack/_msgpack.pyx":147 + * elif self._default: + * o = self._default(o) + * ret = self._pack(o, nest_limit-1) # <<<<<<<<<<<<<< + * else: + * raise TypeError("can't serialize %r" % (o,)) + */ + __pyx_t_13.__pyx_n = 1; + __pyx_t_13.nest_limit = (__pyx_v_nest_limit - 1); + __pyx_t_12 = ((struct __pyx_vtabstruct_7msgpack_8_msgpack_Packer *)__pyx_v_self->__pyx_vtab)->_pack(__pyx_v_self, __pyx_v_o, &__pyx_t_13); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_ret = __pyx_t_12; + goto __pyx_L4; + } + /*else*/ { + + /* "msgpack/_msgpack.pyx":149 + * ret = self._pack(o, nest_limit-1) + * else: + * raise TypeError("can't serialize %r" % (o,)) # <<<<<<<<<<<<<< + * return ret + * + */ + __pyx_t_17 = PyTuple_New(1); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_17)); + __Pyx_INCREF(__pyx_v_o); + PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_v_o); + __Pyx_GIVEREF(__pyx_v_o); + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_13), ((PyObject *)__pyx_t_17)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(((PyObject *)__pyx_t_17)); __pyx_t_17 = 0; + __pyx_t_17 = PyTuple_New(1); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_17)); + PyTuple_SET_ITEM(__pyx_t_17, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_17), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_17)); __pyx_t_17 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L4:; + + /* "msgpack/_msgpack.pyx":150 + * else: + * raise TypeError("can't serialize %r" % (o,)) + * return ret # <<<<<<<<<<<<<< + * + * cpdef pack(self, object obj): + */ + __pyx_r = __pyx_v_ret; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_17); + __Pyx_AddTraceback("msgpack._msgpack.Packer._pack", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_d); + __Pyx_XDECREF(__pyx_v_k); + __Pyx_XDECREF(__pyx_v_v); + __Pyx_XDECREF(__pyx_v_o); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "msgpack/_msgpack.pyx":152 + * return ret + * + * cpdef pack(self, object obj): # <<<<<<<<<<<<<< + * cdef int ret + * ret = self._pack(obj, DEFAULT_RECURSE_LIMIT) + */ + +static PyObject *__pyx_pf_7msgpack_8_msgpack_6Packer_3pack(PyObject *__pyx_v_self, PyObject *__pyx_v_obj); /*proto*/ +static PyObject *__pyx_f_7msgpack_8_msgpack_6Packer_pack(struct __pyx_obj_7msgpack_8_msgpack_Packer *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_skip_dispatch) { + int __pyx_v_ret; + PyObject *__pyx_v_buf = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + struct __pyx_opt_args_7msgpack_8_msgpack_6Packer__pack __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("pack"); + /* 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__pack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __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_7msgpack_8_msgpack_6Packer_3pack)) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __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_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "msgpack/_msgpack.pyx":154 + * cpdef pack(self, object obj): + * cdef int ret + * ret = self._pack(obj, DEFAULT_RECURSE_LIMIT) # <<<<<<<<<<<<<< + * if ret: + * raise TypeError + */ + __pyx_t_5.__pyx_n = 1; + __pyx_t_5.nest_limit = __pyx_v_7msgpack_8_msgpack_DEFAULT_RECURSE_LIMIT; + __pyx_t_4 = ((struct __pyx_vtabstruct_7msgpack_8_msgpack_Packer *)__pyx_v_self->__pyx_vtab)->_pack(__pyx_v_self, __pyx_v_obj, &__pyx_t_5); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_ret = __pyx_t_4; + + /* "msgpack/_msgpack.pyx":155 + * cdef int ret + * ret = self._pack(obj, DEFAULT_RECURSE_LIMIT) + * if ret: # <<<<<<<<<<<<<< + * raise TypeError + * buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length) + */ + if (__pyx_v_ret) { + + /* "msgpack/_msgpack.pyx":156 + * ret = self._pack(obj, DEFAULT_RECURSE_LIMIT) + * if ret: + * raise TypeError # <<<<<<<<<<<<<< + * buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length) + * self.pk.length = 0 + */ + __Pyx_Raise(__pyx_builtin_TypeError, 0, 0, 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; + } + __pyx_L3:; + + /* "msgpack/_msgpack.pyx":157 + * if ret: + * raise TypeError + * buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length) # <<<<<<<<<<<<<< + * self.pk.length = 0 + * return buf + */ + __pyx_t_1 = ((PyObject *)PyBytes_FromStringAndSize(__pyx_v_self->pk.buf, __pyx_v_self->pk.length)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_buf = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "msgpack/_msgpack.pyx":158 + * raise TypeError + * buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length) + * self.pk.length = 0 # <<<<<<<<<<<<<< + * return buf + * + */ + __pyx_v_self->pk.length = 0; + + /* "msgpack/_msgpack.pyx":159 + * buf = PyBytes_FromStringAndSize(self.pk.buf, self.pk.length) + * self.pk.length = 0 + * return buf # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_buf)); + __pyx_r = ((PyObject *)__pyx_v_buf); + 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("msgpack._msgpack.Packer.pack", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_buf); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "msgpack/_msgpack.pyx":152 + * return ret + * + * cpdef pack(self, object obj): # <<<<<<<<<<<<<< + * cdef int ret + * ret = self._pack(obj, DEFAULT_RECURSE_LIMIT) + */ + +static PyObject *__pyx_pf_7msgpack_8_msgpack_6Packer_3pack(PyObject *__pyx_v_self, PyObject *__pyx_v_obj); /*proto*/ +static char __pyx_doc_7msgpack_8_msgpack_6Packer_3pack[] = "Packer.pack(self, obj)"; +static PyObject *__pyx_pf_7msgpack_8_msgpack_6Packer_3pack(PyObject *__pyx_v_self, PyObject *__pyx_v_obj) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("pack"); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_7msgpack_8_msgpack_Packer *)((struct __pyx_obj_7msgpack_8_msgpack_Packer *)__pyx_v_self)->__pyx_vtab)->pack(((struct __pyx_obj_7msgpack_8_msgpack_Packer *)__pyx_v_self), __pyx_v_obj, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __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("msgpack._msgpack.Packer.pack", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "msgpack/_msgpack.pyx":162 + * + * + * def pack(object o, object stream, default=None, encoding='utf-8', unicode_errors='strict'): # <<<<<<<<<<<<<< + * """ + * pack an object `o` and write it to stream).""" + */ + +static PyObject *__pyx_pf_7msgpack_8_msgpack_pack(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_7msgpack_8_msgpack_pack[] = "pack(o, stream, default=None, encoding='utf-8', unicode_errors='strict')\n\n pack an object `o` and write it to stream)."; +static PyMethodDef __pyx_mdef_7msgpack_8_msgpack_pack = {__Pyx_NAMESTR("pack"), (PyCFunction)__pyx_pf_7msgpack_8_msgpack_pack, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7msgpack_8_msgpack_pack)}; +static PyObject *__pyx_pf_7msgpack_8_msgpack_pack(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_o = 0; + PyObject *__pyx_v_stream = 0; + PyObject *__pyx_v_default = 0; + PyObject *__pyx_v_encoding = 0; + PyObject *__pyx_v_unicode_errors = 0; + PyObject *__pyx_v_packer = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__o,&__pyx_n_s__stream,&__pyx_n_s__default,&__pyx_n_s__encoding,&__pyx_n_s__unicode_errors,0}; + __Pyx_RefNannySetupContext("pack"); + __pyx_self = __pyx_self; + { + PyObject* values[5] = {0,0,0,0,0}; + values[2] = ((PyObject *)Py_None); + values[3] = ((PyObject *)__pyx_kp_s_3); + values[4] = ((PyObject *)__pyx_n_s__strict); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + 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; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__o); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stream); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("pack", 0, 2, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__default); + 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--; } + } + case 4: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__unicode_errors); + if (value) { values[4] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "pack") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + 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); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_o = values[0]; + __pyx_v_stream = values[1]; + __pyx_v_default = values[2]; + __pyx_v_encoding = values[3]; + __pyx_v_unicode_errors = values[4]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("pack", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("msgpack._msgpack.pack", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "msgpack/_msgpack.pyx":165 + * """ + * pack an object `o` and write it to stream).""" + * packer = Packer(default=default, encoding=encoding, unicode_errors=unicode_errors) # <<<<<<<<<<<<<< + * stream.write(packer.pack(o)) + * + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__default), __pyx_v_default) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__encoding), __pyx_v_encoding) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__unicode_errors), __pyx_v_unicode_errors) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_7msgpack_8_msgpack_Packer)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_v_packer = __pyx_t_2; + __pyx_t_2 = 0; + + /* "msgpack/_msgpack.pyx":166 + * pack an object `o` and write it to stream).""" + * packer = Packer(default=default, encoding=encoding, unicode_errors=unicode_errors) + * stream.write(packer.pack(o)) # <<<<<<<<<<<<<< + * + * def packb(object o, default=None, encoding='utf-8', unicode_errors='strict'): + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_stream, __pyx_n_s__write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_packer, __pyx_n_s__pack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_v_o); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o); + __Pyx_GIVEREF(__pyx_v_o); + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __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_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __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_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("msgpack._msgpack.pack", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_packer); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "msgpack/_msgpack.pyx":168 + * stream.write(packer.pack(o)) + * + * def packb(object o, default=None, encoding='utf-8', unicode_errors='strict'): # <<<<<<<<<<<<<< + * """ + * pack o and return packed bytes.""" + */ + +static PyObject *__pyx_pf_7msgpack_8_msgpack_1packb(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_7msgpack_8_msgpack_1packb[] = "packb(o, default=None, encoding='utf-8', unicode_errors='strict')\n\n pack o and return packed bytes."; +static PyMethodDef __pyx_mdef_7msgpack_8_msgpack_1packb = {__Pyx_NAMESTR("packb"), (PyCFunction)__pyx_pf_7msgpack_8_msgpack_1packb, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7msgpack_8_msgpack_1packb)}; +static PyObject *__pyx_pf_7msgpack_8_msgpack_1packb(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_o = 0; + PyObject *__pyx_v_default = 0; + PyObject *__pyx_v_encoding = 0; + PyObject *__pyx_v_unicode_errors = 0; + PyObject *__pyx_v_packer = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__o,&__pyx_n_s__default,&__pyx_n_s__encoding,&__pyx_n_s__unicode_errors,0}; + __Pyx_RefNannySetupContext("packb"); + __pyx_self = __pyx_self; + { + PyObject* values[4] = {0,0,0,0}; + values[1] = ((PyObject *)Py_None); + values[2] = ((PyObject *)__pyx_kp_s_3); + values[3] = ((PyObject *)__pyx_n_s__strict); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + 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; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__o); + 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__default); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__encoding); + if (value) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__unicode_errors); + 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), "packb") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + 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); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_o = values[0]; + __pyx_v_default = values[1]; + __pyx_v_encoding = values[2]; + __pyx_v_unicode_errors = values[3]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("packb", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("msgpack._msgpack.packb", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "msgpack/_msgpack.pyx":171 + * """ + * pack o and return packed bytes.""" + * packer = Packer(default=default, encoding=encoding, unicode_errors=unicode_errors) # <<<<<<<<<<<<<< + * return packer.pack(o) + * + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__default), __pyx_v_default) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__encoding), __pyx_v_encoding) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__unicode_errors), __pyx_v_unicode_errors) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyEval_CallObjectWithKeywords(((PyObject *)((PyObject*)__pyx_ptype_7msgpack_8_msgpack_Packer)), ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_v_packer = __pyx_t_2; + __pyx_t_2 = 0; + + /* "msgpack/_msgpack.pyx":172 + * pack o and return packed bytes.""" + * packer = Packer(default=default, encoding=encoding, unicode_errors=unicode_errors) + * return packer.pack(o) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_packer, __pyx_n_s__pack); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_o); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_o); + __Pyx_GIVEREF(__pyx_v_o); + __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 = 172; __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("msgpack._msgpack.packb", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_packer); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "msgpack/_msgpack.pyx":196 + * + * + * def unpackb(object packed, object object_hook=None, object list_hook=None, bint use_list=0, encoding=None, unicode_errors="strict"): # <<<<<<<<<<<<<< + * """ + * Unpack packed_bytes to object. Returns an unpacked object.""" + */ + +static PyObject *__pyx_pf_7msgpack_8_msgpack_2unpackb(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_7msgpack_8_msgpack_2unpackb[] = "unpackb(packed, object_hook=None, list_hook=None, int use_list=0, encoding=None, unicode_errors='strict')\n\n Unpack packed_bytes to object. Returns an unpacked object."; +static PyMethodDef __pyx_mdef_7msgpack_8_msgpack_2unpackb = {__Pyx_NAMESTR("unpackb"), (PyCFunction)__pyx_pf_7msgpack_8_msgpack_2unpackb, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7msgpack_8_msgpack_2unpackb)}; +static PyObject *__pyx_pf_7msgpack_8_msgpack_2unpackb(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_packed = 0; + PyObject *__pyx_v_object_hook = 0; + PyObject *__pyx_v_list_hook = 0; + int __pyx_v_use_list; + PyObject *__pyx_v_encoding = 0; + PyObject *__pyx_v_unicode_errors = 0; + template_context __pyx_v_ctx; + size_t __pyx_v_off; + int __pyx_v_ret; + char *__pyx_v_buf; + Py_ssize_t __pyx_v_buf_len; + void *__pyx_v_enc; + void *__pyx_v_err; + PyObject *__pyx_v_bencoding = NULL; + PyObject *__pyx_v_berrors = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + char *__pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__packed,&__pyx_n_s__object_hook,&__pyx_n_s__list_hook,&__pyx_n_s__use_list,&__pyx_n_s__encoding,&__pyx_n_s__unicode_errors,0}; + __Pyx_RefNannySetupContext("unpackb"); + __pyx_self = __pyx_self; + { + PyObject* values[6] = {0,0,0,0,0,0}; + values[1] = ((PyObject *)Py_None); + values[2] = ((PyObject *)Py_None); + values[4] = ((PyObject *)Py_None); + values[5] = ((PyObject *)__pyx_n_s__strict); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + 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; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__packed); + 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__object_hook); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__list_hook); + if (value) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__use_list); + if (value) { values[3] = value; kw_args--; } + } + case 4: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__encoding); + if (value) { values[4] = value; kw_args--; } + } + case 5: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__unicode_errors); + if (value) { values[5] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "unpackb") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + 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); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_packed = values[0]; + __pyx_v_object_hook = values[1]; + __pyx_v_list_hook = values[2]; + if (values[3]) { + __pyx_v_use_list = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_use_list == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_use_list = ((int)0); + } + __pyx_v_encoding = values[4]; + __pyx_v_unicode_errors = values[5]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("unpackb", 0, 1, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("msgpack._msgpack.unpackb", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "msgpack/_msgpack.pyx":200 + * Unpack packed_bytes to object. Returns an unpacked object.""" + * cdef template_context ctx + * cdef size_t off = 0 # <<<<<<<<<<<<<< + * cdef int ret + * + */ + __pyx_v_off = 0; + + /* "msgpack/_msgpack.pyx":205 + * cdef char* buf + * cdef Py_ssize_t buf_len + * PyObject_AsReadBuffer(packed, &buf, &buf_len) # <<<<<<<<<<<<<< + * + * if encoding is None: + */ + __pyx_t_1 = PyObject_AsReadBuffer(__pyx_v_packed, ((const void* *)(&__pyx_v_buf)), (&__pyx_v_buf_len)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "msgpack/_msgpack.pyx":207 + * PyObject_AsReadBuffer(packed, &buf, &buf_len) + * + * if encoding is None: # <<<<<<<<<<<<<< + * enc = NULL + * err = NULL + */ + __pyx_t_2 = (__pyx_v_encoding == Py_None); + if (__pyx_t_2) { + + /* "msgpack/_msgpack.pyx":208 + * + * if encoding is None: + * enc = NULL # <<<<<<<<<<<<<< + * err = NULL + * else: + */ + __pyx_v_enc = NULL; + + /* "msgpack/_msgpack.pyx":209 + * if encoding is None: + * enc = NULL + * err = NULL # <<<<<<<<<<<<<< + * else: + * if isinstance(encoding, unicode): + */ + __pyx_v_err = NULL; + goto __pyx_L6; + } + /*else*/ { + + /* "msgpack/_msgpack.pyx":211 + * err = NULL + * else: + * if isinstance(encoding, unicode): # <<<<<<<<<<<<<< + * bencoding = encoding.encode('ascii') + * else: + */ + __pyx_t_3 = ((PyObject *)((PyObject*)(&PyUnicode_Type))); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_encoding, __pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_2) { + + /* "msgpack/_msgpack.pyx":212 + * else: + * if isinstance(encoding, unicode): + * bencoding = encoding.encode('ascii') # <<<<<<<<<<<<<< + * else: + * bencoding = encoding + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_encoding, __pyx_n_s__encode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_bencoding = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L7; + } + /*else*/ { + + /* "msgpack/_msgpack.pyx":214 + * bencoding = encoding.encode('ascii') + * else: + * bencoding = encoding # <<<<<<<<<<<<<< + * if isinstance(unicode_errors, unicode): + * berrors = unicode_errors.encode('ascii') + */ + __Pyx_INCREF(__pyx_v_encoding); + __pyx_v_bencoding = __pyx_v_encoding; + } + __pyx_L7:; + + /* "msgpack/_msgpack.pyx":215 + * else: + * bencoding = encoding + * if isinstance(unicode_errors, unicode): # <<<<<<<<<<<<<< + * berrors = unicode_errors.encode('ascii') + * else: + */ + __pyx_t_4 = ((PyObject *)((PyObject*)(&PyUnicode_Type))); + __Pyx_INCREF(__pyx_t_4); + __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_unicode_errors, __pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_2) { + + /* "msgpack/_msgpack.pyx":216 + * bencoding = encoding + * if isinstance(unicode_errors, unicode): + * berrors = unicode_errors.encode('ascii') # <<<<<<<<<<<<<< + * else: + * berrors = unicode_errors + */ + __pyx_t_4 = PyObject_GetAttr(__pyx_v_unicode_errors, __pyx_n_s__encode); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_15), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_berrors = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L8; + } + /*else*/ { + + /* "msgpack/_msgpack.pyx":218 + * berrors = unicode_errors.encode('ascii') + * else: + * berrors = unicode_errors # <<<<<<<<<<<<<< + * enc = PyBytes_AsString(bencoding) + * err = PyBytes_AsString(berrors) + */ + __Pyx_INCREF(__pyx_v_unicode_errors); + __pyx_v_berrors = __pyx_v_unicode_errors; + } + __pyx_L8:; + + /* "msgpack/_msgpack.pyx":219 + * else: + * berrors = unicode_errors + * enc = PyBytes_AsString(bencoding) # <<<<<<<<<<<<<< + * err = PyBytes_AsString(berrors) + * + */ + __pyx_t_5 = PyBytes_AsString(__pyx_v_bencoding); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_enc = __pyx_t_5; + + /* "msgpack/_msgpack.pyx":220 + * berrors = unicode_errors + * enc = PyBytes_AsString(bencoding) + * err = PyBytes_AsString(berrors) # <<<<<<<<<<<<<< + * + * template_init(&ctx) + */ + __pyx_t_5 = PyBytes_AsString(__pyx_v_berrors); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_err = __pyx_t_5; + } + __pyx_L6:; + + /* "msgpack/_msgpack.pyx":222 + * err = PyBytes_AsString(berrors) + * + * template_init(&ctx) # <<<<<<<<<<<<<< + * ctx.user.use_list = use_list + * ctx.user.object_hook = ctx.user.list_hook = NULL + */ + template_init((&__pyx_v_ctx)); + + /* "msgpack/_msgpack.pyx":223 + * + * template_init(&ctx) + * ctx.user.use_list = use_list # <<<<<<<<<<<<<< + * ctx.user.object_hook = ctx.user.list_hook = NULL + * ctx.user.encoding = enc + */ + __pyx_v_ctx.user.use_list = __pyx_v_use_list; + + /* "msgpack/_msgpack.pyx":224 + * template_init(&ctx) + * ctx.user.use_list = use_list + * ctx.user.object_hook = ctx.user.list_hook = NULL # <<<<<<<<<<<<<< + * ctx.user.encoding = enc + * ctx.user.unicode_errors = err + */ + __pyx_v_ctx.user.object_hook = NULL; + __pyx_v_ctx.user.list_hook = NULL; + + /* "msgpack/_msgpack.pyx":225 + * ctx.user.use_list = use_list + * ctx.user.object_hook = ctx.user.list_hook = NULL + * ctx.user.encoding = enc # <<<<<<<<<<<<<< + * ctx.user.unicode_errors = err + * if object_hook is not None: + */ + __pyx_v_ctx.user.encoding = __pyx_v_enc; + + /* "msgpack/_msgpack.pyx":226 + * ctx.user.object_hook = ctx.user.list_hook = NULL + * ctx.user.encoding = enc + * ctx.user.unicode_errors = err # <<<<<<<<<<<<<< + * if object_hook is not None: + * if not PyCallable_Check(object_hook): + */ + __pyx_v_ctx.user.unicode_errors = __pyx_v_err; + + /* "msgpack/_msgpack.pyx":227 + * ctx.user.encoding = enc + * ctx.user.unicode_errors = err + * if object_hook is not None: # <<<<<<<<<<<<<< + * if not PyCallable_Check(object_hook): + * raise TypeError("object_hook must be a callable.") + */ + __pyx_t_2 = (__pyx_v_object_hook != Py_None); + if (__pyx_t_2) { + + /* "msgpack/_msgpack.pyx":228 + * ctx.user.unicode_errors = err + * if object_hook is not None: + * if not PyCallable_Check(object_hook): # <<<<<<<<<<<<<< + * raise TypeError("object_hook must be a callable.") + * ctx.user.object_hook = object_hook + */ + __pyx_t_2 = (!PyCallable_Check(__pyx_v_object_hook)); + if (__pyx_t_2) { + + /* "msgpack/_msgpack.pyx":229 + * if object_hook is not None: + * if not PyCallable_Check(object_hook): + * raise TypeError("object_hook must be a callable.") # <<<<<<<<<<<<<< + * ctx.user.object_hook = object_hook + * if list_hook is not None: + */ + __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_17), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L10; + } + __pyx_L10:; + + /* "msgpack/_msgpack.pyx":230 + * if not PyCallable_Check(object_hook): + * raise TypeError("object_hook must be a callable.") + * ctx.user.object_hook = object_hook # <<<<<<<<<<<<<< + * if list_hook is not None: + * if not PyCallable_Check(list_hook): + */ + __pyx_v_ctx.user.object_hook = ((PyObject *)__pyx_v_object_hook); + goto __pyx_L9; + } + __pyx_L9:; + + /* "msgpack/_msgpack.pyx":231 + * raise TypeError("object_hook must be a callable.") + * ctx.user.object_hook = object_hook + * if list_hook is not None: # <<<<<<<<<<<<<< + * if not PyCallable_Check(list_hook): + * raise TypeError("list_hook must be a callable.") + */ + __pyx_t_2 = (__pyx_v_list_hook != Py_None); + if (__pyx_t_2) { + + /* "msgpack/_msgpack.pyx":232 + * ctx.user.object_hook = object_hook + * if list_hook is not None: + * if not PyCallable_Check(list_hook): # <<<<<<<<<<<<<< + * raise TypeError("list_hook must be a callable.") + * ctx.user.list_hook = list_hook + */ + __pyx_t_2 = (!PyCallable_Check(__pyx_v_list_hook)); + if (__pyx_t_2) { + + /* "msgpack/_msgpack.pyx":233 + * if list_hook is not None: + * if not PyCallable_Check(list_hook): + * raise TypeError("list_hook must be a callable.") # <<<<<<<<<<<<<< + * ctx.user.list_hook = list_hook + * _gc_disable() + */ + __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_19), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; + } + __pyx_L12:; + + /* "msgpack/_msgpack.pyx":234 + * if not PyCallable_Check(list_hook): + * raise TypeError("list_hook must be a callable.") + * ctx.user.list_hook = list_hook # <<<<<<<<<<<<<< + * _gc_disable() + * try: + */ + __pyx_v_ctx.user.list_hook = ((PyObject *)__pyx_v_list_hook); + goto __pyx_L11; + } + __pyx_L11:; + + /* "msgpack/_msgpack.pyx":235 + * raise TypeError("list_hook must be a callable.") + * ctx.user.list_hook = list_hook + * _gc_disable() # <<<<<<<<<<<<<< + * try: + * ret = template_execute(&ctx, buf, buf_len, &off) + */ + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s___gc_disable); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "msgpack/_msgpack.pyx":236 + * ctx.user.list_hook = list_hook + * _gc_disable() + * try: # <<<<<<<<<<<<<< + * ret = template_execute(&ctx, buf, buf_len, &off) + * finally: + */ + /*try:*/ { + + /* "msgpack/_msgpack.pyx":237 + * _gc_disable() + * try: + * ret = template_execute(&ctx, buf, buf_len, &off) # <<<<<<<<<<<<<< + * finally: + * _gc_enable() + */ + __pyx_t_1 = template_execute((&__pyx_v_ctx), __pyx_v_buf, __pyx_v_buf_len, (&__pyx_v_off)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L14;} + __pyx_v_ret = __pyx_t_1; + } + + /* "msgpack/_msgpack.pyx":239 + * ret = template_execute(&ctx, buf, buf_len, &off) + * finally: + * _gc_enable() # <<<<<<<<<<<<<< + * if ret == 1: + * return template_data(&ctx) + */ + /*finally:*/ { + int __pyx_why; + PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb; + int __pyx_exc_lineno; + __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0; + __pyx_why = 0; goto __pyx_L15; + __pyx_L14: { + __pyx_why = 4; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb); + __pyx_exc_lineno = __pyx_lineno; + goto __pyx_L15; + } + __pyx_L15:; + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s___gc_enable); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L16_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L16_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L17; + __pyx_L16_error:; + if (__pyx_why == 4) { + Py_XDECREF(__pyx_exc_type); + Py_XDECREF(__pyx_exc_value); + Py_XDECREF(__pyx_exc_tb); + } + goto __pyx_L1_error; + __pyx_L17:; + switch (__pyx_why) { + case 4: { + __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb); + __pyx_lineno = __pyx_exc_lineno; + __pyx_exc_type = 0; + __pyx_exc_value = 0; + __pyx_exc_tb = 0; + goto __pyx_L1_error; + } + } + } + + /* "msgpack/_msgpack.pyx":240 + * finally: + * _gc_enable() + * if ret == 1: # <<<<<<<<<<<<<< + * return template_data(&ctx) + * else: + */ + __pyx_t_2 = (__pyx_v_ret == 1); + if (__pyx_t_2) { + + /* "msgpack/_msgpack.pyx":241 + * _gc_enable() + * if ret == 1: + * return template_data(&ctx) # <<<<<<<<<<<<<< + * else: + * return None + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = template_data((&__pyx_v_ctx)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __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_L18; + } + /*else*/ { + + /* "msgpack/_msgpack.pyx":243 + * return template_data(&ctx) + * else: + * return None # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + } + __pyx_L18:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("msgpack._msgpack.unpackb", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_bencoding); + __Pyx_XDECREF(__pyx_v_berrors); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "msgpack/_msgpack.pyx":246 + * + * + * def unpack(object stream, object object_hook=None, object list_hook=None, bint use_list=0, encoding=None, unicode_errors="strict"): # <<<<<<<<<<<<<< + * """ + * unpack an object from stream. + */ + +static PyObject *__pyx_pf_7msgpack_8_msgpack_3unpack(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_7msgpack_8_msgpack_3unpack[] = "unpack(stream, object_hook=None, list_hook=None, int use_list=0, encoding=None, unicode_errors='strict')\n\n unpack an object from stream.\n "; +static PyMethodDef __pyx_mdef_7msgpack_8_msgpack_3unpack = {__Pyx_NAMESTR("unpack"), (PyCFunction)__pyx_pf_7msgpack_8_msgpack_3unpack, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7msgpack_8_msgpack_3unpack)}; +static PyObject *__pyx_pf_7msgpack_8_msgpack_3unpack(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_stream = 0; + PyObject *__pyx_v_object_hook = 0; + PyObject *__pyx_v_list_hook = 0; + int __pyx_v_use_list; + PyObject *__pyx_v_encoding = 0; + PyObject *__pyx_v_unicode_errors = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__stream,&__pyx_n_s__object_hook,&__pyx_n_s__list_hook,&__pyx_n_s__use_list,&__pyx_n_s__encoding,&__pyx_n_s__unicode_errors,0}; + __Pyx_RefNannySetupContext("unpack"); + __pyx_self = __pyx_self; + { + PyObject* values[6] = {0,0,0,0,0,0}; + values[1] = ((PyObject *)Py_None); + values[2] = ((PyObject *)Py_None); + values[4] = ((PyObject *)Py_None); + values[5] = ((PyObject *)__pyx_n_s__strict); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + 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; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stream); + 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__object_hook); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__list_hook); + if (value) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__use_list); + if (value) { values[3] = value; kw_args--; } + } + case 4: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__encoding); + if (value) { values[4] = value; kw_args--; } + } + case 5: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__unicode_errors); + if (value) { values[5] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "unpack") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + 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); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_stream = values[0]; + __pyx_v_object_hook = values[1]; + __pyx_v_list_hook = values[2]; + if (values[3]) { + __pyx_v_use_list = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_use_list == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_use_list = ((int)0); + } + __pyx_v_encoding = values[4]; + __pyx_v_unicode_errors = values[5]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("unpack", 0, 1, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("msgpack._msgpack.unpack", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "msgpack/_msgpack.pyx":250 + * unpack an object from stream. + * """ + * return unpackb(stream.read(), use_list=use_list, # <<<<<<<<<<<<<< + * object_hook=object_hook, list_hook=list_hook, encoding=encoding, unicode_errors=unicode_errors) + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__unpackb); 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 = PyObject_GetAttr(__pyx_v_stream, __pyx_n_s__read); 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_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_use_list); 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); + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__use_list), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "msgpack/_msgpack.pyx":251 + * """ + * return unpackb(stream.read(), use_list=use_list, + * object_hook=object_hook, list_hook=list_hook, encoding=encoding, unicode_errors=unicode_errors) # <<<<<<<<<<<<<< + * + * cdef class Unpacker(object): + */ + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__object_hook), __pyx_v_object_hook) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__list_hook), __pyx_v_list_hook) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__encoding), __pyx_v_encoding) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__unicode_errors), __pyx_v_unicode_errors) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3)); 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_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__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_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("msgpack._msgpack.unpack", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "msgpack/_msgpack.pyx":297 + * cdef char *unicode_errors + * + * def __cinit__(self): # <<<<<<<<<<<<<< + * self.buf = NULL + * + */ + +static int __pyx_pf_7msgpack_8_msgpack_8Unpacker___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_7msgpack_8_msgpack_8Unpacker___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__"); + if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1; + + /* "msgpack/_msgpack.pyx":298 + * + * def __cinit__(self): + * self.buf = NULL # <<<<<<<<<<<<<< + * + * def __dealloc__(self): + */ + ((struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)__pyx_v_self)->buf = NULL; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "msgpack/_msgpack.pyx":300 + * self.buf = NULL + * + * def __dealloc__(self): # <<<<<<<<<<<<<< + * free(self.buf) + * self.buf = NULL + */ + +static void __pyx_pf_7msgpack_8_msgpack_8Unpacker_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pf_7msgpack_8_msgpack_8Unpacker_1__dealloc__(PyObject *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__"); + + /* "msgpack/_msgpack.pyx":301 + * + * def __dealloc__(self): + * free(self.buf) # <<<<<<<<<<<<<< + * self.buf = NULL + * + */ + free(((struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)__pyx_v_self)->buf); + + /* "msgpack/_msgpack.pyx":302 + * def __dealloc__(self): + * free(self.buf) + * self.buf = NULL # <<<<<<<<<<<<<< + * + * def __init__(self, file_like=None, Py_ssize_t read_size=1024*1024, bint use_list=0, + */ + ((struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)__pyx_v_self)->buf = NULL; + + __Pyx_RefNannyFinishContext(); +} + +/* "msgpack/_msgpack.pyx":304 + * self.buf = NULL + * + * def __init__(self, file_like=None, Py_ssize_t read_size=1024*1024, bint use_list=0, # <<<<<<<<<<<<<< + * object object_hook=None, object list_hook=None, + * encoding=None, unicode_errors='strict'): + */ + +static int __pyx_pf_7msgpack_8_msgpack_8Unpacker_2__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pf_7msgpack_8_msgpack_8Unpacker_2__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_file_like = 0; + Py_ssize_t __pyx_v_read_size; + int __pyx_v_use_list; + PyObject *__pyx_v_object_hook = 0; + PyObject *__pyx_v_list_hook = 0; + PyObject *__pyx_v_encoding = 0; + PyObject *__pyx_v_unicode_errors = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + char *__pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__file_like,&__pyx_n_s__read_size,&__pyx_n_s__use_list,&__pyx_n_s__object_hook,&__pyx_n_s__list_hook,&__pyx_n_s__encoding,&__pyx_n_s__unicode_errors,0}; + __Pyx_RefNannySetupContext("__init__"); + { + PyObject* values[7] = {0,0,0,0,0,0,0}; + values[0] = ((PyObject *)Py_None); + + /* "msgpack/_msgpack.pyx":305 + * + * def __init__(self, file_like=None, Py_ssize_t read_size=1024*1024, bint use_list=0, + * object object_hook=None, object list_hook=None, # <<<<<<<<<<<<<< + * encoding=None, unicode_errors='strict'): + * self.use_list = use_list + */ + values[3] = ((PyObject *)Py_None); + values[4] = ((PyObject *)Py_None); + + /* "msgpack/_msgpack.pyx":306 + * def __init__(self, file_like=None, Py_ssize_t read_size=1024*1024, bint use_list=0, + * object object_hook=None, object list_hook=None, + * encoding=None, unicode_errors='strict'): # <<<<<<<<<<<<<< + * self.use_list = use_list + * self.file_like = file_like + */ + values[5] = ((PyObject *)Py_None); + values[6] = ((PyObject *)__pyx_n_s__strict); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + 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; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__file_like); + if (value) { values[0] = value; kw_args--; } + } + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__read_size); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__use_list); + if (value) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__object_hook); + if (value) { values[3] = value; kw_args--; } + } + case 4: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__list_hook); + if (value) { values[4] = value; kw_args--; } + } + case 5: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__encoding); + if (value) { values[5] = value; kw_args--; } + } + case 6: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__unicode_errors); + if (value) { values[6] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + 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; + } + } + __pyx_v_file_like = values[0]; + if (values[1]) { + __pyx_v_read_size = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_read_size == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_read_size = ((Py_ssize_t)1048576); + } + if (values[2]) { + __pyx_v_use_list = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_use_list == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_use_list = ((int)0); + } + __pyx_v_object_hook = values[3]; + __pyx_v_list_hook = values[4]; + __pyx_v_encoding = values[5]; + __pyx_v_unicode_errors = values[6]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("msgpack._msgpack.Unpacker.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + + /* "msgpack/_msgpack.pyx":307 + * object object_hook=None, object list_hook=None, + * encoding=None, unicode_errors='strict'): + * self.use_list = use_list # <<<<<<<<<<<<<< + * self.file_like = file_like + * if file_like: + */ + ((struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)__pyx_v_self)->use_list = __pyx_v_use_list; + + /* "msgpack/_msgpack.pyx":308 + * encoding=None, unicode_errors='strict'): + * self.use_list = use_list + * self.file_like = file_like # <<<<<<<<<<<<<< + * if file_like: + * self.file_like_read = file_like.read + */ + __Pyx_INCREF(__pyx_v_file_like); + __Pyx_GIVEREF(__pyx_v_file_like); + __Pyx_GOTREF(((struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)__pyx_v_self)->file_like); + __Pyx_DECREF(((struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)__pyx_v_self)->file_like); + ((struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)__pyx_v_self)->file_like = __pyx_v_file_like; + + /* "msgpack/_msgpack.pyx":309 + * self.use_list = use_list + * self.file_like = file_like + * if file_like: # <<<<<<<<<<<<<< + * self.file_like_read = file_like.read + * if not PyCallable_Check(self.file_like_read): + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_file_like); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + + /* "msgpack/_msgpack.pyx":310 + * self.file_like = file_like + * if file_like: + * self.file_like_read = file_like.read # <<<<<<<<<<<<<< + * if not PyCallable_Check(self.file_like_read): + * raise ValueError("`file_like.read` must be a callable.") + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_file_like, __pyx_n_s__read); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(((struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)__pyx_v_self)->file_like_read); + __Pyx_DECREF(((struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)__pyx_v_self)->file_like_read); + ((struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)__pyx_v_self)->file_like_read = __pyx_t_2; + __pyx_t_2 = 0; + + /* "msgpack/_msgpack.pyx":311 + * if file_like: + * self.file_like_read = file_like.read + * if not PyCallable_Check(self.file_like_read): # <<<<<<<<<<<<<< + * raise ValueError("`file_like.read` must be a callable.") + * self.read_size = read_size + */ + __pyx_t_2 = ((struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)__pyx_v_self)->file_like_read; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_1 = (!PyCallable_Check(__pyx_t_2)); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_1) { + + /* "msgpack/_msgpack.pyx":312 + * self.file_like_read = file_like.read + * if not PyCallable_Check(self.file_like_read): + * raise ValueError("`file_like.read` must be a callable.") # <<<<<<<<<<<<<< + * self.read_size = read_size + * self.buf = malloc(read_size) + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_21), NULL); 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_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; + goto __pyx_L6; + } + __pyx_L6:; + + /* "msgpack/_msgpack.pyx":313 + * if not PyCallable_Check(self.file_like_read): + * raise ValueError("`file_like.read` must be a callable.") + * self.read_size = read_size # <<<<<<<<<<<<<< + * self.buf = malloc(read_size) + * if self.buf == NULL: + */ + ((struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)__pyx_v_self)->read_size = __pyx_v_read_size; + + /* "msgpack/_msgpack.pyx":314 + * raise ValueError("`file_like.read` must be a callable.") + * self.read_size = read_size + * self.buf = malloc(read_size) # <<<<<<<<<<<<<< + * if self.buf == NULL: + * raise MemoryError("Unable to allocate internal buffer.") + */ + ((struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)__pyx_v_self)->buf = ((char *)malloc(__pyx_v_read_size)); + + /* "msgpack/_msgpack.pyx":315 + * self.read_size = read_size + * self.buf = malloc(read_size) + * if self.buf == NULL: # <<<<<<<<<<<<<< + * raise MemoryError("Unable to allocate internal buffer.") + * self.buf_size = read_size + */ + __pyx_t_1 = (((struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)__pyx_v_self)->buf == NULL); + if (__pyx_t_1) { + + /* "msgpack/_msgpack.pyx":316 + * self.buf = malloc(read_size) + * if self.buf == NULL: + * raise MemoryError("Unable to allocate internal buffer.") # <<<<<<<<<<<<<< + * self.buf_size = read_size + * self.buf_head = 0 + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_22), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; + } + __pyx_L8:; + + /* "msgpack/_msgpack.pyx":317 + * if self.buf == NULL: + * raise MemoryError("Unable to allocate internal buffer.") + * self.buf_size = read_size # <<<<<<<<<<<<<< + * self.buf_head = 0 + * self.buf_tail = 0 + */ + ((struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)__pyx_v_self)->buf_size = __pyx_v_read_size; + + /* "msgpack/_msgpack.pyx":318 + * raise MemoryError("Unable to allocate internal buffer.") + * self.buf_size = read_size + * self.buf_head = 0 # <<<<<<<<<<<<<< + * self.buf_tail = 0 + * template_init(&self.ctx) + */ + ((struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)__pyx_v_self)->buf_head = 0; + + /* "msgpack/_msgpack.pyx":319 + * self.buf_size = read_size + * self.buf_head = 0 + * self.buf_tail = 0 # <<<<<<<<<<<<<< + * template_init(&self.ctx) + * self.ctx.user.use_list = use_list + */ + ((struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)__pyx_v_self)->buf_tail = 0; + + /* "msgpack/_msgpack.pyx":320 + * self.buf_head = 0 + * self.buf_tail = 0 + * template_init(&self.ctx) # <<<<<<<<<<<<<< + * self.ctx.user.use_list = use_list + * self.ctx.user.object_hook = self.ctx.user.list_hook = NULL + */ + template_init((&((struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)__pyx_v_self)->ctx)); + + /* "msgpack/_msgpack.pyx":321 + * self.buf_tail = 0 + * template_init(&self.ctx) + * self.ctx.user.use_list = use_list # <<<<<<<<<<<<<< + * self.ctx.user.object_hook = self.ctx.user.list_hook = NULL + * if object_hook is not None: + */ + ((struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)__pyx_v_self)->ctx.user.use_list = __pyx_v_use_list; + + /* "msgpack/_msgpack.pyx":322 + * template_init(&self.ctx) + * self.ctx.user.use_list = use_list + * self.ctx.user.object_hook = self.ctx.user.list_hook = NULL # <<<<<<<<<<<<<< + * if object_hook is not None: + * if not PyCallable_Check(object_hook): + */ + ((struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)__pyx_v_self)->ctx.user.object_hook = ((PyObject *)NULL); + ((struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)__pyx_v_self)->ctx.user.list_hook = ((PyObject *)NULL); + + /* "msgpack/_msgpack.pyx":323 + * self.ctx.user.use_list = use_list + * self.ctx.user.object_hook = self.ctx.user.list_hook = NULL + * if object_hook is not None: # <<<<<<<<<<<<<< + * if not PyCallable_Check(object_hook): + * raise TypeError("object_hook must be a callable.") + */ + __pyx_t_1 = (__pyx_v_object_hook != Py_None); + if (__pyx_t_1) { + + /* "msgpack/_msgpack.pyx":324 + * self.ctx.user.object_hook = self.ctx.user.list_hook = NULL + * if object_hook is not None: + * if not PyCallable_Check(object_hook): # <<<<<<<<<<<<<< + * raise TypeError("object_hook must be a callable.") + * self.ctx.user.object_hook = object_hook + */ + __pyx_t_1 = (!PyCallable_Check(__pyx_v_object_hook)); + if (__pyx_t_1) { + + /* "msgpack/_msgpack.pyx":325 + * if object_hook is not None: + * if not PyCallable_Check(object_hook): + * raise TypeError("object_hook must be a callable.") # <<<<<<<<<<<<<< + * self.ctx.user.object_hook = object_hook + * if list_hook is not None: + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_23), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L10; + } + __pyx_L10:; + + /* "msgpack/_msgpack.pyx":326 + * if not PyCallable_Check(object_hook): + * raise TypeError("object_hook must be a callable.") + * self.ctx.user.object_hook = object_hook # <<<<<<<<<<<<<< + * if list_hook is not None: + * if not PyCallable_Check(list_hook): + */ + ((struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)__pyx_v_self)->ctx.user.object_hook = ((PyObject *)__pyx_v_object_hook); + goto __pyx_L9; + } + __pyx_L9:; + + /* "msgpack/_msgpack.pyx":327 + * raise TypeError("object_hook must be a callable.") + * self.ctx.user.object_hook = object_hook + * if list_hook is not None: # <<<<<<<<<<<<<< + * if not PyCallable_Check(list_hook): + * raise TypeError("list_hook must be a callable.") + */ + __pyx_t_1 = (__pyx_v_list_hook != Py_None); + if (__pyx_t_1) { + + /* "msgpack/_msgpack.pyx":328 + * self.ctx.user.object_hook = object_hook + * if list_hook is not None: + * if not PyCallable_Check(list_hook): # <<<<<<<<<<<<<< + * raise TypeError("list_hook must be a callable.") + * self.ctx.user.list_hook = list_hook + */ + __pyx_t_1 = (!PyCallable_Check(__pyx_v_list_hook)); + if (__pyx_t_1) { + + /* "msgpack/_msgpack.pyx":329 + * if list_hook is not None: + * if not PyCallable_Check(list_hook): + * raise TypeError("list_hook must be a callable.") # <<<<<<<<<<<<<< + * self.ctx.user.list_hook = list_hook + * if encoding is None: + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_k_tuple_24), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; + } + __pyx_L12:; + + /* "msgpack/_msgpack.pyx":330 + * if not PyCallable_Check(list_hook): + * raise TypeError("list_hook must be a callable.") + * self.ctx.user.list_hook = list_hook # <<<<<<<<<<<<<< + * if encoding is None: + * self.ctx.user.encoding = NULL + */ + ((struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)__pyx_v_self)->ctx.user.list_hook = ((PyObject *)__pyx_v_list_hook); + goto __pyx_L11; + } + __pyx_L11:; + + /* "msgpack/_msgpack.pyx":331 + * raise TypeError("list_hook must be a callable.") + * self.ctx.user.list_hook = list_hook + * if encoding is None: # <<<<<<<<<<<<<< + * self.ctx.user.encoding = NULL + * self.ctx.user.unicode_errors = NULL + */ + __pyx_t_1 = (__pyx_v_encoding == Py_None); + if (__pyx_t_1) { + + /* "msgpack/_msgpack.pyx":332 + * self.ctx.user.list_hook = list_hook + * if encoding is None: + * self.ctx.user.encoding = NULL # <<<<<<<<<<<<<< + * self.ctx.user.unicode_errors = NULL + * else: + */ + ((struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)__pyx_v_self)->ctx.user.encoding = NULL; + + /* "msgpack/_msgpack.pyx":333 + * if encoding is None: + * self.ctx.user.encoding = NULL + * self.ctx.user.unicode_errors = NULL # <<<<<<<<<<<<<< + * else: + * if isinstance(encoding, unicode): + */ + ((struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)__pyx_v_self)->ctx.user.unicode_errors = NULL; + goto __pyx_L13; + } + /*else*/ { + + /* "msgpack/_msgpack.pyx":335 + * self.ctx.user.unicode_errors = NULL + * else: + * if isinstance(encoding, unicode): # <<<<<<<<<<<<<< + * self._bencoding = encoding.encode('ascii') + * else: + */ + __pyx_t_2 = ((PyObject *)((PyObject*)(&PyUnicode_Type))); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_encoding, __pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_1) { + + /* "msgpack/_msgpack.pyx":336 + * else: + * if isinstance(encoding, unicode): + * self._bencoding = encoding.encode('ascii') # <<<<<<<<<<<<<< + * else: + * self._bencoding = encoding + */ + __pyx_t_2 = PyObject_GetAttr(__pyx_v_encoding, __pyx_n_s__encode); 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_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_25), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GOTREF(((struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)__pyx_v_self)->_bencoding); + __Pyx_DECREF(((struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)__pyx_v_self)->_bencoding); + ((struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)__pyx_v_self)->_bencoding = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L14; + } + /*else*/ { + + /* "msgpack/_msgpack.pyx":338 + * self._bencoding = encoding.encode('ascii') + * else: + * self._bencoding = encoding # <<<<<<<<<<<<<< + * self.ctx.user.encoding = PyBytes_AsString(self._bencoding) + * if isinstance(unicode_errors, unicode): + */ + __Pyx_INCREF(__pyx_v_encoding); + __Pyx_GIVEREF(__pyx_v_encoding); + __Pyx_GOTREF(((struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)__pyx_v_self)->_bencoding); + __Pyx_DECREF(((struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)__pyx_v_self)->_bencoding); + ((struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)__pyx_v_self)->_bencoding = __pyx_v_encoding; + } + __pyx_L14:; + + /* "msgpack/_msgpack.pyx":339 + * else: + * self._bencoding = encoding + * self.ctx.user.encoding = PyBytes_AsString(self._bencoding) # <<<<<<<<<<<<<< + * if isinstance(unicode_errors, unicode): + * self._berrors = unicode_errors.encode('ascii') + */ + __pyx_t_3 = ((struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)__pyx_v_self)->_bencoding; + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = PyBytes_AsString(__pyx_t_3); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + ((struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)__pyx_v_self)->ctx.user.encoding = __pyx_t_4; + + /* "msgpack/_msgpack.pyx":340 + * self._bencoding = encoding + * self.ctx.user.encoding = PyBytes_AsString(self._bencoding) + * if isinstance(unicode_errors, unicode): # <<<<<<<<<<<<<< + * self._berrors = unicode_errors.encode('ascii') + * else: + */ + __pyx_t_3 = ((PyObject *)((PyObject*)(&PyUnicode_Type))); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_unicode_errors, __pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_1) { + + /* "msgpack/_msgpack.pyx":341 + * self.ctx.user.encoding = PyBytes_AsString(self._bencoding) + * if isinstance(unicode_errors, unicode): + * self._berrors = unicode_errors.encode('ascii') # <<<<<<<<<<<<<< + * else: + * self._berrors = unicode_errors + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_unicode_errors, __pyx_n_s__encode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_26), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(((struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)__pyx_v_self)->_berrors); + __Pyx_DECREF(((struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)__pyx_v_self)->_berrors); + ((struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)__pyx_v_self)->_berrors = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L15; + } + /*else*/ { + + /* "msgpack/_msgpack.pyx":343 + * self._berrors = unicode_errors.encode('ascii') + * else: + * self._berrors = unicode_errors # <<<<<<<<<<<<<< + * self.ctx.user.unicode_errors = PyBytes_AsString(self._berrors) + * + */ + __Pyx_INCREF(__pyx_v_unicode_errors); + __Pyx_GIVEREF(__pyx_v_unicode_errors); + __Pyx_GOTREF(((struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)__pyx_v_self)->_berrors); + __Pyx_DECREF(((struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)__pyx_v_self)->_berrors); + ((struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)__pyx_v_self)->_berrors = __pyx_v_unicode_errors; + } + __pyx_L15:; + + /* "msgpack/_msgpack.pyx":344 + * else: + * self._berrors = unicode_errors + * self.ctx.user.unicode_errors = PyBytes_AsString(self._berrors) # <<<<<<<<<<<<<< + * + * def feed(self, object next_bytes): + */ + __pyx_t_2 = ((struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)__pyx_v_self)->_berrors; + __Pyx_INCREF(__pyx_t_2); + __pyx_t_4 = PyBytes_AsString(__pyx_t_2); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + ((struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)__pyx_v_self)->ctx.user.unicode_errors = __pyx_t_4; + } + __pyx_L13:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("msgpack._msgpack.Unpacker.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "msgpack/_msgpack.pyx":346 + * self.ctx.user.unicode_errors = PyBytes_AsString(self._berrors) + * + * def feed(self, object next_bytes): # <<<<<<<<<<<<<< + * cdef char* buf + * cdef Py_ssize_t buf_len + */ + +static PyObject *__pyx_pf_7msgpack_8_msgpack_8Unpacker_3feed(PyObject *__pyx_v_self, PyObject *__pyx_v_next_bytes); /*proto*/ +static char __pyx_doc_7msgpack_8_msgpack_8Unpacker_3feed[] = "Unpacker.feed(self, next_bytes)"; +static PyObject *__pyx_pf_7msgpack_8_msgpack_8Unpacker_3feed(PyObject *__pyx_v_self, PyObject *__pyx_v_next_bytes) { + char *__pyx_v_buf; + Py_ssize_t __pyx_v_buf_len; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("feed"); + + /* "msgpack/_msgpack.pyx":349 + * cdef char* buf + * cdef Py_ssize_t buf_len + * if self.file_like is not None: # <<<<<<<<<<<<<< + * raise AssertionError( + * "unpacker.feed() is not be able to use with`file_like`.") + */ + __pyx_t_1 = (((struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)__pyx_v_self)->file_like != Py_None); + if (__pyx_t_1) { + + /* "msgpack/_msgpack.pyx":350 + * cdef Py_ssize_t buf_len + * if self.file_like is not None: + * raise AssertionError( # <<<<<<<<<<<<<< + * "unpacker.feed() is not be able to use with`file_like`.") + * PyObject_AsReadBuffer(next_bytes, &buf, &buf_len) + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_AssertionError, ((PyObject *)__pyx_k_tuple_28), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "msgpack/_msgpack.pyx":352 + * raise AssertionError( + * "unpacker.feed() is not be able to use with`file_like`.") + * PyObject_AsReadBuffer(next_bytes, &buf, &buf_len) # <<<<<<<<<<<<<< + * self.append_buffer(buf, buf_len) + * + */ + __pyx_t_3 = PyObject_AsReadBuffer(__pyx_v_next_bytes, ((const void* *)(&__pyx_v_buf)), (&__pyx_v_buf_len)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "msgpack/_msgpack.pyx":353 + * "unpacker.feed() is not be able to use with`file_like`.") + * PyObject_AsReadBuffer(next_bytes, &buf, &buf_len) + * self.append_buffer(buf, buf_len) # <<<<<<<<<<<<<< + * + * cdef append_buffer(self, void* _buf, Py_ssize_t _buf_len): + */ + __pyx_t_2 = ((struct __pyx_vtabstruct_7msgpack_8_msgpack_Unpacker *)((struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)__pyx_v_self)->__pyx_vtab)->append_buffer(((struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)__pyx_v_self), __pyx_v_buf, __pyx_v_buf_len); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("msgpack._msgpack.Unpacker.feed", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "msgpack/_msgpack.pyx":355 + * self.append_buffer(buf, buf_len) + * + * cdef append_buffer(self, void* _buf, Py_ssize_t _buf_len): # <<<<<<<<<<<<<< + * cdef: + * char* buf = self.buf + */ + +static PyObject *__pyx_f_7msgpack_8_msgpack_8Unpacker_append_buffer(struct __pyx_obj_7msgpack_8_msgpack_Unpacker *__pyx_v_self, void *__pyx_v__buf, Py_ssize_t __pyx_v__buf_len) { + char *__pyx_v_buf; + size_t __pyx_v_head; + size_t __pyx_v_tail; + size_t __pyx_v_buf_size; + size_t __pyx_v_new_size; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("append_buffer"); + + /* "msgpack/_msgpack.pyx":357 + * cdef append_buffer(self, void* _buf, Py_ssize_t _buf_len): + * cdef: + * char* buf = self.buf # <<<<<<<<<<<<<< + * size_t head = self.buf_head + * size_t tail = self.buf_tail + */ + __pyx_v_buf = __pyx_v_self->buf; + + /* "msgpack/_msgpack.pyx":358 + * cdef: + * char* buf = self.buf + * size_t head = self.buf_head # <<<<<<<<<<<<<< + * size_t tail = self.buf_tail + * size_t buf_size = self.buf_size + */ + __pyx_v_head = __pyx_v_self->buf_head; + + /* "msgpack/_msgpack.pyx":359 + * char* buf = self.buf + * size_t head = self.buf_head + * size_t tail = self.buf_tail # <<<<<<<<<<<<<< + * size_t buf_size = self.buf_size + * size_t new_size + */ + __pyx_v_tail = __pyx_v_self->buf_tail; + + /* "msgpack/_msgpack.pyx":360 + * size_t head = self.buf_head + * size_t tail = self.buf_tail + * size_t buf_size = self.buf_size # <<<<<<<<<<<<<< + * size_t new_size + * + */ + __pyx_v_buf_size = __pyx_v_self->buf_size; + + /* "msgpack/_msgpack.pyx":363 + * size_t new_size + * + * if tail + _buf_len > buf_size: # <<<<<<<<<<<<<< + * if ((tail - head) + _buf_len)*2 < buf_size: + * # move to front. + */ + __pyx_t_1 = ((__pyx_v_tail + __pyx_v__buf_len) > __pyx_v_buf_size); + if (__pyx_t_1) { + + /* "msgpack/_msgpack.pyx":364 + * + * if tail + _buf_len > buf_size: + * if ((tail - head) + _buf_len)*2 < buf_size: # <<<<<<<<<<<<<< + * # move to front. + * memmove(buf, buf + head, tail - head) + */ + __pyx_t_1 = ((((__pyx_v_tail - __pyx_v_head) + __pyx_v__buf_len) * 2) < __pyx_v_buf_size); + if (__pyx_t_1) { + + /* "msgpack/_msgpack.pyx":366 + * if ((tail - head) + _buf_len)*2 < buf_size: + * # move to front. + * memmove(buf, buf + head, tail - head) # <<<<<<<<<<<<<< + * tail -= head + * head = 0 + */ + memmove(__pyx_v_buf, (__pyx_v_buf + __pyx_v_head), (__pyx_v_tail - __pyx_v_head)); + + /* "msgpack/_msgpack.pyx":367 + * # move to front. + * memmove(buf, buf + head, tail - head) + * tail -= head # <<<<<<<<<<<<<< + * head = 0 + * else: + */ + __pyx_v_tail = (__pyx_v_tail - __pyx_v_head); + + /* "msgpack/_msgpack.pyx":368 + * memmove(buf, buf + head, tail - head) + * tail -= head + * head = 0 # <<<<<<<<<<<<<< + * else: + * # expand buffer. + */ + __pyx_v_head = 0; + goto __pyx_L4; + } + /*else*/ { + + /* "msgpack/_msgpack.pyx":371 + * else: + * # expand buffer. + * new_size = tail + _buf_len # <<<<<<<<<<<<<< + * if new_size < buf_size*2: + * new_size = buf_size*2 + */ + __pyx_v_new_size = (__pyx_v_tail + __pyx_v__buf_len); + + /* "msgpack/_msgpack.pyx":372 + * # expand buffer. + * new_size = tail + _buf_len + * if new_size < buf_size*2: # <<<<<<<<<<<<<< + * new_size = buf_size*2 + * buf = realloc(buf, new_size) + */ + __pyx_t_1 = (__pyx_v_new_size < (__pyx_v_buf_size * 2)); + if (__pyx_t_1) { + + /* "msgpack/_msgpack.pyx":373 + * new_size = tail + _buf_len + * if new_size < buf_size*2: + * new_size = buf_size*2 # <<<<<<<<<<<<<< + * buf = realloc(buf, new_size) + * if buf == NULL: + */ + __pyx_v_new_size = (__pyx_v_buf_size * 2); + goto __pyx_L5; + } + __pyx_L5:; + + /* "msgpack/_msgpack.pyx":374 + * if new_size < buf_size*2: + * new_size = buf_size*2 + * buf = realloc(buf, new_size) # <<<<<<<<<<<<<< + * if buf == NULL: + * # self.buf still holds old buffer and will be freed during + */ + __pyx_v_buf = ((char *)realloc(__pyx_v_buf, __pyx_v_new_size)); + + /* "msgpack/_msgpack.pyx":375 + * new_size = buf_size*2 + * buf = realloc(buf, new_size) + * if buf == NULL: # <<<<<<<<<<<<<< + * # self.buf still holds old buffer and will be freed during + * # obj destruction + */ + __pyx_t_1 = (__pyx_v_buf == NULL); + if (__pyx_t_1) { + + /* "msgpack/_msgpack.pyx":378 + * # self.buf still holds old buffer and will be freed during + * # obj destruction + * raise MemoryError("Unable to enlarge internal buffer.") # <<<<<<<<<<<<<< + * buf_size = new_size + * + */ + __pyx_t_2 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_30), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "msgpack/_msgpack.pyx":379 + * # obj destruction + * raise MemoryError("Unable to enlarge internal buffer.") + * buf_size = new_size # <<<<<<<<<<<<<< + * + * memcpy(buf + tail, (_buf), _buf_len) + */ + __pyx_v_buf_size = __pyx_v_new_size; + } + __pyx_L4:; + goto __pyx_L3; + } + __pyx_L3:; + + /* "msgpack/_msgpack.pyx":381 + * buf_size = new_size + * + * memcpy(buf + tail, (_buf), _buf_len) # <<<<<<<<<<<<<< + * self.buf = buf + * self.buf_head = head + */ + memcpy((__pyx_v_buf + __pyx_v_tail), ((char *)__pyx_v__buf), __pyx_v__buf_len); + + /* "msgpack/_msgpack.pyx":382 + * + * memcpy(buf + tail, (_buf), _buf_len) + * self.buf = buf # <<<<<<<<<<<<<< + * self.buf_head = head + * self.buf_size = buf_size + */ + __pyx_v_self->buf = __pyx_v_buf; + + /* "msgpack/_msgpack.pyx":383 + * memcpy(buf + tail, (_buf), _buf_len) + * self.buf = buf + * self.buf_head = head # <<<<<<<<<<<<<< + * self.buf_size = buf_size + * self.buf_tail = tail + _buf_len + */ + __pyx_v_self->buf_head = __pyx_v_head; + + /* "msgpack/_msgpack.pyx":384 + * self.buf = buf + * self.buf_head = head + * self.buf_size = buf_size # <<<<<<<<<<<<<< + * self.buf_tail = tail + _buf_len + * + */ + __pyx_v_self->buf_size = __pyx_v_buf_size; + + /* "msgpack/_msgpack.pyx":385 + * self.buf_head = head + * self.buf_size = buf_size + * self.buf_tail = tail + _buf_len # <<<<<<<<<<<<<< + * + * # prepare self.buf from file_like + */ + __pyx_v_self->buf_tail = (__pyx_v_tail + __pyx_v__buf_len); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("msgpack._msgpack.Unpacker.append_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "msgpack/_msgpack.pyx":388 + * + * # prepare self.buf from file_like + * cdef fill_buffer(self): # <<<<<<<<<<<<<< + * if self.file_like is not None: + * next_bytes = self.file_like_read(self.read_size) + */ + +static PyObject *__pyx_f_7msgpack_8_msgpack_8Unpacker_fill_buffer(struct __pyx_obj_7msgpack_8_msgpack_Unpacker *__pyx_v_self) { + PyObject *__pyx_v_next_bytes = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + char *__pyx_t_4; + Py_ssize_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("fill_buffer"); + + /* "msgpack/_msgpack.pyx":389 + * # prepare self.buf from file_like + * cdef fill_buffer(self): + * if self.file_like is not None: # <<<<<<<<<<<<<< + * next_bytes = self.file_like_read(self.read_size) + * if next_bytes: + */ + __pyx_t_1 = (__pyx_v_self->file_like != Py_None); + if (__pyx_t_1) { + + /* "msgpack/_msgpack.pyx":390 + * cdef fill_buffer(self): + * if self.file_like is not None: + * next_bytes = self.file_like_read(self.read_size) # <<<<<<<<<<<<<< + * if next_bytes: + * self.append_buffer(PyBytes_AsString(next_bytes), + */ + __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->read_size); 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_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __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_v_self->file_like_read, ((PyObject *)__pyx_t_3), 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(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_v_next_bytes = __pyx_t_2; + __pyx_t_2 = 0; + + /* "msgpack/_msgpack.pyx":391 + * if self.file_like is not None: + * next_bytes = self.file_like_read(self.read_size) + * if next_bytes: # <<<<<<<<<<<<<< + * self.append_buffer(PyBytes_AsString(next_bytes), + * PyBytes_Size(next_bytes)) + */ + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_next_bytes); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_1) { + + /* "msgpack/_msgpack.pyx":392 + * next_bytes = self.file_like_read(self.read_size) + * if next_bytes: + * self.append_buffer(PyBytes_AsString(next_bytes), # <<<<<<<<<<<<<< + * PyBytes_Size(next_bytes)) + * else: + */ + __pyx_t_4 = PyBytes_AsString(__pyx_v_next_bytes); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "msgpack/_msgpack.pyx":393 + * if next_bytes: + * self.append_buffer(PyBytes_AsString(next_bytes), + * PyBytes_Size(next_bytes)) # <<<<<<<<<<<<<< + * else: + * self.file_like = None + */ + __pyx_t_5 = PyBytes_Size(__pyx_v_next_bytes); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = ((struct __pyx_vtabstruct_7msgpack_8_msgpack_Unpacker *)__pyx_v_self->__pyx_vtab)->append_buffer(__pyx_v_self, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L4; + } + /*else*/ { + + /* "msgpack/_msgpack.pyx":395 + * PyBytes_Size(next_bytes)) + * else: + * self.file_like = None # <<<<<<<<<<<<<< + * + * cpdef unpack(self): + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_self->file_like); + __Pyx_DECREF(__pyx_v_self->file_like); + __pyx_v_self->file_like = Py_None; + } + __pyx_L4:; + 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_AddTraceback("msgpack._msgpack.Unpacker.fill_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_next_bytes); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "msgpack/_msgpack.pyx":397 + * self.file_like = None + * + * cpdef unpack(self): # <<<<<<<<<<<<<< + * """unpack one object""" + * cdef int ret + */ + +static PyObject *__pyx_pf_7msgpack_8_msgpack_8Unpacker_4unpack(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_f_7msgpack_8_msgpack_8Unpacker_unpack(struct __pyx_obj_7msgpack_8_msgpack_Unpacker *__pyx_v_self, int __pyx_skip_dispatch) { + int __pyx_v_ret; + PyObject *__pyx_v_o = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("unpack"); + /* 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__unpack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __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_7msgpack_8_msgpack_8Unpacker_4unpack)) { + __Pyx_XDECREF(__pyx_r); + __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 = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __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; + } + + /* "msgpack/_msgpack.pyx":400 + * """unpack one object""" + * cdef int ret + * while 1: # <<<<<<<<<<<<<< + * _gc_disable() + * ret = template_execute(&self.ctx, self.buf, self.buf_tail, &self.buf_head) + */ + while (1) { + if (!1) break; + + /* "msgpack/_msgpack.pyx":401 + * cdef int ret + * while 1: + * _gc_disable() # <<<<<<<<<<<<<< + * ret = template_execute(&self.ctx, self.buf, self.buf_tail, &self.buf_head) + * _gc_enable() + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___gc_disable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __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 = 401; __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; + + /* "msgpack/_msgpack.pyx":402 + * while 1: + * _gc_disable() + * ret = template_execute(&self.ctx, self.buf, self.buf_tail, &self.buf_head) # <<<<<<<<<<<<<< + * _gc_enable() + * if ret == 1: + */ + __pyx_t_3 = template_execute((&__pyx_v_self->ctx), __pyx_v_self->buf, __pyx_v_self->buf_tail, (&__pyx_v_self->buf_head)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_ret = __pyx_t_3; + + /* "msgpack/_msgpack.pyx":403 + * _gc_disable() + * ret = template_execute(&self.ctx, self.buf, self.buf_tail, &self.buf_head) + * _gc_enable() # <<<<<<<<<<<<<< + * if ret == 1: + * o = template_data(&self.ctx) + */ + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s___gc_enable); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __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 = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "msgpack/_msgpack.pyx":408 + * template_init(&self.ctx) + * return o + * elif ret == 0: # <<<<<<<<<<<<<< + * if self.file_like is not None: + * self.fill_buffer() + */ + switch (__pyx_v_ret) { + + /* "msgpack/_msgpack.pyx":404 + * ret = template_execute(&self.ctx, self.buf, self.buf_tail, &self.buf_head) + * _gc_enable() + * if ret == 1: # <<<<<<<<<<<<<< + * o = template_data(&self.ctx) + * template_init(&self.ctx) + */ + case 1: + + /* "msgpack/_msgpack.pyx":405 + * _gc_enable() + * if ret == 1: + * o = template_data(&self.ctx) # <<<<<<<<<<<<<< + * template_init(&self.ctx) + * return o + */ + __pyx_t_1 = template_data((&__pyx_v_self->ctx)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_o = __pyx_t_1; + __pyx_t_1 = 0; + + /* "msgpack/_msgpack.pyx":406 + * if ret == 1: + * o = template_data(&self.ctx) + * template_init(&self.ctx) # <<<<<<<<<<<<<< + * return o + * elif ret == 0: + */ + template_init((&__pyx_v_self->ctx)); + + /* "msgpack/_msgpack.pyx":407 + * o = template_data(&self.ctx) + * template_init(&self.ctx) + * return o # <<<<<<<<<<<<<< + * elif ret == 0: + * if self.file_like is not None: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_o); + __pyx_r = __pyx_v_o; + goto __pyx_L0; + break; + + /* "msgpack/_msgpack.pyx":408 + * template_init(&self.ctx) + * return o + * elif ret == 0: # <<<<<<<<<<<<<< + * if self.file_like is not None: + * self.fill_buffer() + */ + case 0: + + /* "msgpack/_msgpack.pyx":409 + * return o + * elif ret == 0: + * if self.file_like is not None: # <<<<<<<<<<<<<< + * self.fill_buffer() + * continue + */ + __pyx_t_4 = (__pyx_v_self->file_like != Py_None); + if (__pyx_t_4) { + + /* "msgpack/_msgpack.pyx":410 + * elif ret == 0: + * if self.file_like is not None: + * self.fill_buffer() # <<<<<<<<<<<<<< + * continue + * raise StopIteration("No more unpack data.") + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_7msgpack_8_msgpack_Unpacker *)__pyx_v_self->__pyx_vtab)->fill_buffer(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "msgpack/_msgpack.pyx":411 + * if self.file_like is not None: + * self.fill_buffer() + * continue # <<<<<<<<<<<<<< + * raise StopIteration("No more unpack data.") + * else: + */ + goto __pyx_L3_continue; + goto __pyx_L5; + } + __pyx_L5:; + + /* "msgpack/_msgpack.pyx":412 + * self.fill_buffer() + * continue + * raise StopIteration("No more unpack data.") # <<<<<<<<<<<<<< + * else: + * raise ValueError("Unpack failed: error = %d" % (ret,)) + */ + __pyx_t_1 = PyObject_Call(__pyx_builtin_StopIteration, ((PyObject *)__pyx_k_tuple_32), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + default: + + /* "msgpack/_msgpack.pyx":414 + * raise StopIteration("No more unpack data.") + * else: + * raise ValueError("Unpack failed: error = %d" % (ret,)) # <<<<<<<<<<<<<< + * + * def __iter__(self): + */ + __pyx_t_1 = PyInt_FromLong(__pyx_v_ret); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_33), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(((PyObject *)__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 = 414; __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_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __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, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __pyx_L3_continue:; + } + + __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("msgpack._msgpack.Unpacker.unpack", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_o); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "msgpack/_msgpack.pyx":397 + * self.file_like = None + * + * cpdef unpack(self): # <<<<<<<<<<<<<< + * """unpack one object""" + * cdef int ret + */ + +static PyObject *__pyx_pf_7msgpack_8_msgpack_8Unpacker_4unpack(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static char __pyx_doc_7msgpack_8_msgpack_8Unpacker_4unpack[] = "Unpacker.unpack(self)\nunpack one object"; +static PyObject *__pyx_pf_7msgpack_8_msgpack_8Unpacker_4unpack(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("unpack"); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_7msgpack_8_msgpack_Unpacker *)((struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)__pyx_v_self)->__pyx_vtab)->unpack(((struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)__pyx_v_self), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __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("msgpack._msgpack.Unpacker.unpack", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "msgpack/_msgpack.pyx":416 + * raise ValueError("Unpack failed: error = %d" % (ret,)) + * + * def __iter__(self): # <<<<<<<<<<<<<< + * return self + * + */ + +static PyObject *__pyx_pf_7msgpack_8_msgpack_8Unpacker_5__iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_7msgpack_8_msgpack_8Unpacker_5__iter__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__iter__"); + + /* "msgpack/_msgpack.pyx":417 + * + * def __iter__(self): + * return self # <<<<<<<<<<<<<< + * + * def __next__(self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_self); + __pyx_r = __pyx_v_self; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "msgpack/_msgpack.pyx":419 + * return self + * + * def __next__(self): # <<<<<<<<<<<<<< + * return self.unpack() + * + */ + +static PyObject *__pyx_pf_7msgpack_8_msgpack_8Unpacker_6__next__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pf_7msgpack_8_msgpack_8Unpacker_6__next__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__next__"); + + /* "msgpack/_msgpack.pyx":420 + * + * def __next__(self): + * return self.unpack() # <<<<<<<<<<<<<< + * + * # for debug. + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_7msgpack_8_msgpack_Unpacker *)((struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)__pyx_v_self)->__pyx_vtab)->unpack(((struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)__pyx_v_self), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __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("msgpack._msgpack.Unpacker.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static struct __pyx_vtabstruct_7msgpack_8_msgpack_Packer __pyx_vtable_7msgpack_8_msgpack_Packer; + +static PyObject *__pyx_tp_new_7msgpack_8_msgpack_Packer(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_7msgpack_8_msgpack_Packer *p; + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + p = ((struct __pyx_obj_7msgpack_8_msgpack_Packer *)o); + p->__pyx_vtab = __pyx_vtabptr_7msgpack_8_msgpack_Packer; + p->_default = Py_None; Py_INCREF(Py_None); + p->_bencoding = Py_None; Py_INCREF(Py_None); + p->_berrors = Py_None; Py_INCREF(Py_None); + if (__pyx_pf_7msgpack_8_msgpack_6Packer___cinit__(o, __pyx_empty_tuple, NULL) < 0) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_7msgpack_8_msgpack_Packer(PyObject *o) { + struct __pyx_obj_7msgpack_8_msgpack_Packer *p = (struct __pyx_obj_7msgpack_8_msgpack_Packer *)o; + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_pf_7msgpack_8_msgpack_6Packer_2__dealloc__(o); + if (PyErr_Occurred()) PyErr_WriteUnraisable(o); + --Py_REFCNT(o); + PyErr_Restore(etype, eval, etb); + } + Py_XDECREF(p->_default); + Py_XDECREF(p->_bencoding); + Py_XDECREF(p->_berrors); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_7msgpack_8_msgpack_Packer(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_7msgpack_8_msgpack_Packer *p = (struct __pyx_obj_7msgpack_8_msgpack_Packer *)o; + if (p->_default) { + e = (*v)(p->_default, a); if (e) return e; + } + if (p->_bencoding) { + e = (*v)(p->_bencoding, a); if (e) return e; + } + if (p->_berrors) { + e = (*v)(p->_berrors, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_7msgpack_8_msgpack_Packer(PyObject *o) { + struct __pyx_obj_7msgpack_8_msgpack_Packer *p = (struct __pyx_obj_7msgpack_8_msgpack_Packer *)o; + PyObject* tmp; + tmp = ((PyObject*)p->_default); + p->_default = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_bencoding); + p->_bencoding = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_berrors); + p->_berrors = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_7msgpack_8_msgpack_Packer[] = { + {__Pyx_NAMESTR("pack"), (PyCFunction)__pyx_pf_7msgpack_8_msgpack_6Packer_3pack, METH_O, __Pyx_DOCSTR(__pyx_doc_7msgpack_8_msgpack_6Packer_3pack)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_Packer = { + 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_Packer = { + 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_Packer = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_Packer = { + #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_7msgpack_8_msgpack_Packer = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("msgpack._msgpack.Packer"), /*tp_name*/ + sizeof(struct __pyx_obj_7msgpack_8_msgpack_Packer), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_7msgpack_8_msgpack_Packer, /*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_Packer, /*tp_as_number*/ + &__pyx_tp_as_sequence_Packer, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_Packer, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_Packer, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + __Pyx_DOCSTR("Packer(default=None, encoding='utf-8', unicode_errors='strict')\nMessagePack Packer\n\n usage:\n\n packer = Packer()\n astream.write(packer.pack(a))\n astream.write(packer.pack(b))\n "), /*tp_doc*/ + __pyx_tp_traverse_7msgpack_8_msgpack_Packer, /*tp_traverse*/ + __pyx_tp_clear_7msgpack_8_msgpack_Packer, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_7msgpack_8_msgpack_Packer, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pf_7msgpack_8_msgpack_6Packer_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_7msgpack_8_msgpack_Packer, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_7msgpack_8_msgpack_Unpacker __pyx_vtable_7msgpack_8_msgpack_Unpacker; + +static PyObject *__pyx_tp_new_7msgpack_8_msgpack_Unpacker(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_7msgpack_8_msgpack_Unpacker *p; + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + p = ((struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)o); + p->__pyx_vtab = __pyx_vtabptr_7msgpack_8_msgpack_Unpacker; + p->file_like = Py_None; Py_INCREF(Py_None); + p->file_like_read = Py_None; Py_INCREF(Py_None); + p->object_hook = Py_None; Py_INCREF(Py_None); + p->_bencoding = Py_None; Py_INCREF(Py_None); + p->_berrors = Py_None; Py_INCREF(Py_None); + if (__pyx_pf_7msgpack_8_msgpack_8Unpacker___cinit__(o, __pyx_empty_tuple, NULL) < 0) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_7msgpack_8_msgpack_Unpacker(PyObject *o) { + struct __pyx_obj_7msgpack_8_msgpack_Unpacker *p = (struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)o; + { + PyObject *etype, *eval, *etb; + PyErr_Fetch(&etype, &eval, &etb); + ++Py_REFCNT(o); + __pyx_pf_7msgpack_8_msgpack_8Unpacker_1__dealloc__(o); + if (PyErr_Occurred()) PyErr_WriteUnraisable(o); + --Py_REFCNT(o); + PyErr_Restore(etype, eval, etb); + } + Py_XDECREF(p->file_like); + Py_XDECREF(p->file_like_read); + Py_XDECREF(p->object_hook); + Py_XDECREF(p->_bencoding); + Py_XDECREF(p->_berrors); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_7msgpack_8_msgpack_Unpacker(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_7msgpack_8_msgpack_Unpacker *p = (struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)o; + if (p->file_like) { + e = (*v)(p->file_like, a); if (e) return e; + } + if (p->file_like_read) { + e = (*v)(p->file_like_read, a); if (e) return e; + } + if (p->object_hook) { + e = (*v)(p->object_hook, a); if (e) return e; + } + if (p->_bencoding) { + e = (*v)(p->_bencoding, a); if (e) return e; + } + if (p->_berrors) { + e = (*v)(p->_berrors, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_7msgpack_8_msgpack_Unpacker(PyObject *o) { + struct __pyx_obj_7msgpack_8_msgpack_Unpacker *p = (struct __pyx_obj_7msgpack_8_msgpack_Unpacker *)o; + PyObject* tmp; + tmp = ((PyObject*)p->file_like); + p->file_like = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->file_like_read); + p->file_like_read = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->object_hook); + p->object_hook = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_bencoding); + p->_bencoding = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->_berrors); + p->_berrors = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_7msgpack_8_msgpack_Unpacker[] = { + {__Pyx_NAMESTR("feed"), (PyCFunction)__pyx_pf_7msgpack_8_msgpack_8Unpacker_3feed, METH_O, __Pyx_DOCSTR(__pyx_doc_7msgpack_8_msgpack_8Unpacker_3feed)}, + {__Pyx_NAMESTR("unpack"), (PyCFunction)__pyx_pf_7msgpack_8_msgpack_8Unpacker_4unpack, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_7msgpack_8_msgpack_8Unpacker_4unpack)}, + {__Pyx_NAMESTR("__next__"), (PyCFunction)__pyx_pf_7msgpack_8_msgpack_8Unpacker_6__next__, METH_NOARGS|METH_COEXIST, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_Unpacker = { + 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_Unpacker = { + 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_Unpacker = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_Unpacker = { + #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_7msgpack_8_msgpack_Unpacker = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("msgpack._msgpack.Unpacker"), /*tp_name*/ + sizeof(struct __pyx_obj_7msgpack_8_msgpack_Unpacker), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_7msgpack_8_msgpack_Unpacker, /*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_Unpacker, /*tp_as_number*/ + &__pyx_tp_as_sequence_Unpacker, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_Unpacker, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_Unpacker, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + __Pyx_DOCSTR("Unpacker(file_like=None, Py_ssize_t read_size=1048576, int use_list=0, object_hook=None, list_hook=None, encoding=None, unicode_errors='strict')\n\n Streaming unpacker.\n read_size is used like file_like.read(read_size)\n\n `file_like` is a file-like object having `.read(n)` method.\n When `Unpacker` initialized with `file_like`, unpacker reads serialized data\n from it and `.feed()` method is not usable.\n\n `read_size` is used as `file_like.read(read_size)`. (default: 1M)\n\n If `use_list` is true, msgpack list is deserialized to Python list.\n Otherwise, it is deserialized to Python tuple. (default: False)\n\n `object_hook` is same to simplejson. If it is not None, it should be callable\n and Unpacker calls it when deserializing key-value.\n\n `encoding` is encoding used for decoding msgpack bytes. If it is None (default),\n msgpack bytes is deserialized to Python bytes.\n\n `unicode_errors` is used for decoding bytes.\n\n example::\n\n unpacker = Unpacker()\n while 1:\n buf = astream.read()\n unpacker.feed(buf)\n for o in unpacker:\n do_something(o)\n "), /*tp_doc*/ + __pyx_tp_traverse_7msgpack_8_msgpack_Unpacker, /*tp_traverse*/ + __pyx_tp_clear_7msgpack_8_msgpack_Unpacker, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + __pyx_pf_7msgpack_8_msgpack_8Unpacker_5__iter__, /*tp_iter*/ + __pyx_pf_7msgpack_8_msgpack_8Unpacker_6__next__, /*tp_iternext*/ + __pyx_methods_7msgpack_8_msgpack_Unpacker, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pf_7msgpack_8_msgpack_8Unpacker_2__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_7msgpack_8_msgpack_Unpacker, /*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} +}; + +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef __pyx_moduledef = { + PyModuleDef_HEAD_INIT, + __Pyx_NAMESTR("_msgpack"), + 0, /* m_doc */ + -1, /* m_size */ + __pyx_methods /* m_methods */, + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, + {&__pyx_kp_s_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 1, 0}, + {&__pyx_kp_s_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 0, 1, 0}, + {&__pyx_kp_s_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 0, 1, 0}, + {&__pyx_kp_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 0}, + {&__pyx_kp_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 0}, + {&__pyx_kp_s_27, __pyx_k_27, sizeof(__pyx_k_27), 0, 0, 1, 0}, + {&__pyx_kp_s_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 0, 1, 0}, + {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0}, + {&__pyx_kp_s_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 0, 1, 0}, + {&__pyx_kp_s_33, __pyx_k_33, sizeof(__pyx_k_33), 0, 0, 1, 0}, + {&__pyx_n_s_34, __pyx_k_34, sizeof(__pyx_k_34), 0, 0, 1, 1}, + {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0}, + {&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0}, + {&__pyx_n_s__AssertionError, __pyx_k__AssertionError, sizeof(__pyx_k__AssertionError), 0, 0, 1, 1}, + {&__pyx_n_s__MemoryError, __pyx_k__MemoryError, sizeof(__pyx_k__MemoryError), 0, 0, 1, 1}, + {&__pyx_n_s__StopIteration, __pyx_k__StopIteration, sizeof(__pyx_k__StopIteration), 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____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___gc_disable, __pyx_k___gc_disable, sizeof(__pyx_k___gc_disable), 0, 0, 1, 1}, + {&__pyx_n_s___gc_enable, __pyx_k___gc_enable, sizeof(__pyx_k___gc_enable), 0, 0, 1, 1}, + {&__pyx_n_s__ascii, __pyx_k__ascii, sizeof(__pyx_k__ascii), 0, 0, 1, 1}, + {&__pyx_n_s__default, __pyx_k__default, sizeof(__pyx_k__default), 0, 0, 1, 1}, + {&__pyx_n_s__disable, __pyx_k__disable, sizeof(__pyx_k__disable), 0, 0, 1, 1}, + {&__pyx_n_s__enable, __pyx_k__enable, sizeof(__pyx_k__enable), 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__file_like, __pyx_k__file_like, sizeof(__pyx_k__file_like), 0, 0, 1, 1}, + {&__pyx_n_s__gc, __pyx_k__gc, sizeof(__pyx_k__gc), 0, 0, 1, 1}, + {&__pyx_n_s__list_hook, __pyx_k__list_hook, sizeof(__pyx_k__list_hook), 0, 0, 1, 1}, + {&__pyx_n_s__o, __pyx_k__o, sizeof(__pyx_k__o), 0, 0, 1, 1}, + {&__pyx_n_s__object_hook, __pyx_k__object_hook, sizeof(__pyx_k__object_hook), 0, 0, 1, 1}, + {&__pyx_n_s__pack, __pyx_k__pack, sizeof(__pyx_k__pack), 0, 0, 1, 1}, + {&__pyx_n_s__packb, __pyx_k__packb, sizeof(__pyx_k__packb), 0, 0, 1, 1}, + {&__pyx_n_s__packed, __pyx_k__packed, sizeof(__pyx_k__packed), 0, 0, 1, 1}, + {&__pyx_n_s__read, __pyx_k__read, sizeof(__pyx_k__read), 0, 0, 1, 1}, + {&__pyx_n_s__read_size, __pyx_k__read_size, sizeof(__pyx_k__read_size), 0, 0, 1, 1}, + {&__pyx_n_s__stream, __pyx_k__stream, sizeof(__pyx_k__stream), 0, 0, 1, 1}, + {&__pyx_n_s__strict, __pyx_k__strict, sizeof(__pyx_k__strict), 0, 0, 1, 1}, + {&__pyx_n_s__unicode_errors, __pyx_k__unicode_errors, sizeof(__pyx_k__unicode_errors), 0, 0, 1, 1}, + {&__pyx_n_s__unpack, __pyx_k__unpack, sizeof(__pyx_k__unpack), 0, 0, 1, 1}, + {&__pyx_n_s__unpackb, __pyx_k__unpackb, sizeof(__pyx_k__unpackb), 0, 0, 1, 1}, + {&__pyx_n_s__use_list, __pyx_k__use_list, sizeof(__pyx_k__use_list), 0, 0, 1, 1}, + {&__pyx_n_s__write, __pyx_k__write, sizeof(__pyx_k__write), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin_MemoryError = __Pyx_GetName(__pyx_b, __pyx_n_s__MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_AssertionError = __Pyx_GetName(__pyx_b, __pyx_n_s__AssertionError); if (!__pyx_builtin_AssertionError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_StopIteration = __Pyx_GetName(__pyx_b, __pyx_n_s__StopIteration); if (!__pyx_builtin_StopIteration) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + return 0; + __pyx_L1_error:; + return -1; +} + +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); + + /* "msgpack/_msgpack.pyx":58 + * self.pk.buf = malloc(buf_size); + * if self.pk.buf == NULL: + * raise MemoryError("Unable to allocate internal buffer.") # <<<<<<<<<<<<<< + * self.pk.buf_size = buf_size + * self.pk.length = 0 + */ + __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_2)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); + PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_kp_s_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); + + /* "msgpack/_msgpack.pyx":65 + * if default is not None: + * if not PyCallable_Check(default): + * raise TypeError("default must be a callable.") # <<<<<<<<<<<<<< + * self._default = default + * if encoding is None: + */ + __pyx_k_tuple_5 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_5)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_4)); + PyTuple_SET_ITEM(__pyx_k_tuple_5, 0, ((PyObject *)__pyx_kp_s_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5)); + + /* "msgpack/_msgpack.pyx":72 + * else: + * if isinstance(encoding, unicode): + * self._bencoding = encoding.encode('ascii') # <<<<<<<<<<<<<< + * else: + * self._bencoding = encoding + */ + __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_6)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ascii)); + PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_n_s__ascii)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ascii)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6)); + + /* "msgpack/_msgpack.pyx":77 + * self.encoding = PyBytes_AsString(self._bencoding) + * if isinstance(unicode_errors, unicode): + * self._berrors = unicode_errors.encode('ascii') # <<<<<<<<<<<<<< + * else: + * self._berrors = unicode_errors + */ + __pyx_k_tuple_7 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_7)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ascii)); + PyTuple_SET_ITEM(__pyx_k_tuple_7, 0, ((PyObject *)__pyx_n_s__ascii)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ascii)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_7)); + + /* "msgpack/_msgpack.pyx":95 + * + * if nest_limit < 0: + * raise ValueError("Too deep.") # <<<<<<<<<<<<<< + * + * if o is None: + */ + __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_10)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_9)); + PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_kp_s_9)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10)); + + /* "msgpack/_msgpack.pyx":124 + * elif PyUnicode_Check(o): + * if not self.encoding: + * raise TypeError("Can't encode unicode string: no encoding is specified") # <<<<<<<<<<<<<< + * o = PyUnicode_AsEncodedString(o, self.encoding, self.unicode_errors) + * rawval = o + */ + __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_12)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_11)); + PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_s_11)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_11)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12)); + + /* "msgpack/_msgpack.pyx":212 + * else: + * if isinstance(encoding, unicode): + * bencoding = encoding.encode('ascii') # <<<<<<<<<<<<<< + * else: + * bencoding = encoding + */ + __pyx_k_tuple_14 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_14)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ascii)); + PyTuple_SET_ITEM(__pyx_k_tuple_14, 0, ((PyObject *)__pyx_n_s__ascii)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ascii)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14)); + + /* "msgpack/_msgpack.pyx":216 + * bencoding = encoding + * if isinstance(unicode_errors, unicode): + * berrors = unicode_errors.encode('ascii') # <<<<<<<<<<<<<< + * else: + * berrors = unicode_errors + */ + __pyx_k_tuple_15 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_15)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ascii)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 0, ((PyObject *)__pyx_n_s__ascii)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ascii)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15)); + + /* "msgpack/_msgpack.pyx":229 + * if object_hook is not None: + * if not PyCallable_Check(object_hook): + * raise TypeError("object_hook must be a callable.") # <<<<<<<<<<<<<< + * ctx.user.object_hook = object_hook + * if list_hook is not None: + */ + __pyx_k_tuple_17 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_17)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_16)); + PyTuple_SET_ITEM(__pyx_k_tuple_17, 0, ((PyObject *)__pyx_kp_s_16)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_16)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17)); + + /* "msgpack/_msgpack.pyx":233 + * if list_hook is not None: + * if not PyCallable_Check(list_hook): + * raise TypeError("list_hook must be a callable.") # <<<<<<<<<<<<<< + * ctx.user.list_hook = list_hook + * _gc_disable() + */ + __pyx_k_tuple_19 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_19)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_18)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 0, ((PyObject *)__pyx_kp_s_18)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_18)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_19)); + + /* "msgpack/_msgpack.pyx":312 + * self.file_like_read = file_like.read + * if not PyCallable_Check(self.file_like_read): + * raise ValueError("`file_like.read` must be a callable.") # <<<<<<<<<<<<<< + * self.read_size = read_size + * self.buf = malloc(read_size) + */ + __pyx_k_tuple_21 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_21)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_20)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 0, ((PyObject *)__pyx_kp_s_20)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_20)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_21)); + + /* "msgpack/_msgpack.pyx":316 + * self.buf = malloc(read_size) + * if self.buf == NULL: + * raise MemoryError("Unable to allocate internal buffer.") # <<<<<<<<<<<<<< + * self.buf_size = read_size + * self.buf_head = 0 + */ + __pyx_k_tuple_22 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_22)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); + PyTuple_SET_ITEM(__pyx_k_tuple_22, 0, ((PyObject *)__pyx_kp_s_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_22)); + + /* "msgpack/_msgpack.pyx":325 + * if object_hook is not None: + * if not PyCallable_Check(object_hook): + * raise TypeError("object_hook must be a callable.") # <<<<<<<<<<<<<< + * self.ctx.user.object_hook = object_hook + * if list_hook is not None: + */ + __pyx_k_tuple_23 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_23)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_16)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 0, ((PyObject *)__pyx_kp_s_16)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_16)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_23)); + + /* "msgpack/_msgpack.pyx":329 + * if list_hook is not None: + * if not PyCallable_Check(list_hook): + * raise TypeError("list_hook must be a callable.") # <<<<<<<<<<<<<< + * self.ctx.user.list_hook = list_hook + * if encoding is None: + */ + __pyx_k_tuple_24 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_24)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_18)); + PyTuple_SET_ITEM(__pyx_k_tuple_24, 0, ((PyObject *)__pyx_kp_s_18)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_18)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_24)); + + /* "msgpack/_msgpack.pyx":336 + * else: + * if isinstance(encoding, unicode): + * self._bencoding = encoding.encode('ascii') # <<<<<<<<<<<<<< + * else: + * self._bencoding = encoding + */ + __pyx_k_tuple_25 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_25)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ascii)); + PyTuple_SET_ITEM(__pyx_k_tuple_25, 0, ((PyObject *)__pyx_n_s__ascii)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ascii)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_25)); + + /* "msgpack/_msgpack.pyx":341 + * self.ctx.user.encoding = PyBytes_AsString(self._bencoding) + * if isinstance(unicode_errors, unicode): + * self._berrors = unicode_errors.encode('ascii') # <<<<<<<<<<<<<< + * else: + * self._berrors = unicode_errors + */ + __pyx_k_tuple_26 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_26)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ascii)); + PyTuple_SET_ITEM(__pyx_k_tuple_26, 0, ((PyObject *)__pyx_n_s__ascii)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ascii)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_26)); + + /* "msgpack/_msgpack.pyx":350 + * cdef Py_ssize_t buf_len + * if self.file_like is not None: + * raise AssertionError( # <<<<<<<<<<<<<< + * "unpacker.feed() is not be able to use with`file_like`.") + * PyObject_AsReadBuffer(next_bytes, &buf, &buf_len) + */ + __pyx_k_tuple_28 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_28)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_27)); + PyTuple_SET_ITEM(__pyx_k_tuple_28, 0, ((PyObject *)__pyx_kp_s_27)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_27)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_28)); + + /* "msgpack/_msgpack.pyx":378 + * # self.buf still holds old buffer and will be freed during + * # obj destruction + * raise MemoryError("Unable to enlarge internal buffer.") # <<<<<<<<<<<<<< + * buf_size = new_size + * + */ + __pyx_k_tuple_30 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_30)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_29)); + PyTuple_SET_ITEM(__pyx_k_tuple_30, 0, ((PyObject *)__pyx_kp_s_29)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_29)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_30)); + + /* "msgpack/_msgpack.pyx":412 + * self.fill_buffer() + * continue + * raise StopIteration("No more unpack data.") # <<<<<<<<<<<<<< + * else: + * raise ValueError("Unpack failed: error = %d" % (ret,)) + */ + __pyx_k_tuple_32 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_32)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_31)); + PyTuple_SET_ITEM(__pyx_k_tuple_32, 0, ((PyObject *)__pyx_kp_s_31)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_31)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_32)); + __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;}; + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC init_msgpack(void); /*proto*/ +PyMODINIT_FUNC init_msgpack(void) +#else +PyMODINIT_FUNC PyInit__msgpack(void); /*proto*/ +PyMODINIT_FUNC PyInit__msgpack(void) +#endif +{ + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannyDeclarations + #if CYTHON_REFNANNY + __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"); + } + #endif + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__msgpack(void)"); + if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __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("_msgpack"), __pyx_methods, 0, 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_msgpack___msgpack) { + 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 ---*/ + /*--- Variable export code ---*/ + /*--- Function export code ---*/ + /*--- Type init code ---*/ + __pyx_vtabptr_7msgpack_8_msgpack_Packer = &__pyx_vtable_7msgpack_8_msgpack_Packer; + __pyx_vtable_7msgpack_8_msgpack_Packer._pack = (int (*)(struct __pyx_obj_7msgpack_8_msgpack_Packer *, PyObject *, struct __pyx_opt_args_7msgpack_8_msgpack_6Packer__pack *__pyx_optional_args))__pyx_f_7msgpack_8_msgpack_6Packer__pack; + __pyx_vtable_7msgpack_8_msgpack_Packer.pack = (PyObject *(*)(struct __pyx_obj_7msgpack_8_msgpack_Packer *, PyObject *, int __pyx_skip_dispatch))__pyx_f_7msgpack_8_msgpack_6Packer_pack; + if (PyType_Ready(&__pyx_type_7msgpack_8_msgpack_Packer) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7msgpack_8_msgpack_Packer.tp_dict, __pyx_vtabptr_7msgpack_8_msgpack_Packer) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "Packer", (PyObject *)&__pyx_type_7msgpack_8_msgpack_Packer) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7msgpack_8_msgpack_Packer = &__pyx_type_7msgpack_8_msgpack_Packer; + __pyx_vtabptr_7msgpack_8_msgpack_Unpacker = &__pyx_vtable_7msgpack_8_msgpack_Unpacker; + __pyx_vtable_7msgpack_8_msgpack_Unpacker.append_buffer = (PyObject *(*)(struct __pyx_obj_7msgpack_8_msgpack_Unpacker *, void *, Py_ssize_t))__pyx_f_7msgpack_8_msgpack_8Unpacker_append_buffer; + __pyx_vtable_7msgpack_8_msgpack_Unpacker.fill_buffer = (PyObject *(*)(struct __pyx_obj_7msgpack_8_msgpack_Unpacker *))__pyx_f_7msgpack_8_msgpack_8Unpacker_fill_buffer; + __pyx_vtable_7msgpack_8_msgpack_Unpacker.unpack = (PyObject *(*)(struct __pyx_obj_7msgpack_8_msgpack_Unpacker *, int __pyx_skip_dispatch))__pyx_f_7msgpack_8_msgpack_8Unpacker_unpack; + if (PyType_Ready(&__pyx_type_7msgpack_8_msgpack_Unpacker) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7msgpack_8_msgpack_Unpacker.tp_dict, __pyx_vtabptr_7msgpack_8_msgpack_Unpacker) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "Unpacker", (PyObject *)&__pyx_type_7msgpack_8_msgpack_Unpacker) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7msgpack_8_msgpack_Unpacker = &__pyx_type_7msgpack_8_msgpack_Unpacker; + /*--- Type import code ---*/ + __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[1]; __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[2]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Variable import code ---*/ + /*--- Function import code ---*/ + /*--- Execution code ---*/ + + /* "msgpack/_msgpack.pyx":13 + * from libc.stdlib cimport * + * from libc.string cimport * + * import gc # <<<<<<<<<<<<<< + * _gc_disable = gc.disable + * _gc_enable = gc.enable + */ + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__gc), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__gc, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "msgpack/_msgpack.pyx":14 + * from libc.string cimport * + * import gc + * _gc_disable = gc.disable # <<<<<<<<<<<<<< + * _gc_enable = gc.enable + * + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__gc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__disable); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_s___gc_disable, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "msgpack/_msgpack.pyx":15 + * import gc + * _gc_disable = gc.disable + * _gc_enable = gc.enable # <<<<<<<<<<<<<< + * + * cdef extern from "pack.h": + */ + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__gc); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__enable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_s___gc_enable, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "msgpack/_msgpack.pyx":36 + * int msgpack_pack_raw_body(msgpack_packer* pk, char* body, size_t l) + * + * cdef int DEFAULT_RECURSE_LIMIT=511 # <<<<<<<<<<<<<< + * + * cdef class Packer(object): + */ + __pyx_v_7msgpack_8_msgpack_DEFAULT_RECURSE_LIMIT = 511; + + /* "msgpack/_msgpack.pyx":85 + * free(self.pk.buf); + * + * cdef int _pack(self, object o, int nest_limit=DEFAULT_RECURSE_LIMIT) except -1: # <<<<<<<<<<<<<< + * cdef long long llval + * cdef unsigned long long ullval + */ + __pyx_k_8 = __pyx_v_7msgpack_8_msgpack_DEFAULT_RECURSE_LIMIT; + + /* "msgpack/_msgpack.pyx":162 + * + * + * def pack(object o, object stream, default=None, encoding='utf-8', unicode_errors='strict'): # <<<<<<<<<<<<<< + * """ + * pack an object `o` and write it to stream).""" + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7msgpack_8_msgpack_pack, NULL, __pyx_n_s_34); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__pack, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "msgpack/_msgpack.pyx":168 + * stream.write(packer.pack(o)) + * + * def packb(object o, default=None, encoding='utf-8', unicode_errors='strict'): # <<<<<<<<<<<<<< + * """ + * pack o and return packed bytes.""" + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7msgpack_8_msgpack_1packb, NULL, __pyx_n_s_34); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__packb, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "msgpack/_msgpack.pyx":196 + * + * + * def unpackb(object packed, object object_hook=None, object list_hook=None, bint use_list=0, encoding=None, unicode_errors="strict"): # <<<<<<<<<<<<<< + * """ + * Unpack packed_bytes to object. Returns an unpacked object.""" + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7msgpack_8_msgpack_2unpackb, NULL, __pyx_n_s_34); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__unpackb, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "msgpack/_msgpack.pyx":246 + * + * + * def unpack(object stream, object object_hook=None, object list_hook=None, bint use_list=0, encoding=None, unicode_errors="strict"): # <<<<<<<<<<<<<< + * """ + * unpack an object from stream. + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7msgpack_8_msgpack_3unpack, NULL, __pyx_n_s_34); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__unpack, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "msgpack/_msgpack.pyx":1 + * # coding: utf-8 # <<<<<<<<<<<<<< + * #cython: embedsignature=True + * + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + if (__pyx_m) { + __Pyx_AddTraceback("init msgpack._msgpack", __pyx_clineno, __pyx_lineno, __pyx_filename); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init msgpack._msgpack"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} + +/* Runtime support code */ + +#if CYTHON_REFNANNY +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; +} +#endif /* CYTHON_REFNANNY */ + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { + PyObject *result; + result = PyObject_GetAttr(dict, name); + if (!result) { + if (dict != __pyx_b) { + PyErr_Clear(); + result = PyObject_GetAttr(__pyx_b, name); + } + if (!result) { + PyErr_SetObject(PyExc_NameError, name); + } + } + return result; +} + +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 *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"; + } + PyErr_Format(PyExc_TypeError, + "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +static CYTHON_INLINE int __Pyx_CheckKeywordStrings( + PyObject *kwdict, + const char* function_name, + int kw_allowed) +{ + PyObject* key = 0; + Py_ssize_t pos = 0; + while (PyDict_Next(kwdict, &pos, &key, 0)) { + #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; + } + if ((!kw_allowed) && unlikely(key)) + goto invalid_keyword; + return 1; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + return 0; +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 + return 0; +} + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +} + +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +} + + +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + /* cause is unused */ + 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 , */ + 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, PyObject *cause) { + 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; + } + + if (cause) { + PyObject *fixed_cause; + if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } + else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } + else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + if (!value) { + value = PyObject_CallObject(type, NULL); + } + PyException_SetCause(value, fixed_cause); + } + + 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_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 PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { + 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; + #if PY_VERSION_HEX >= 0x02050000 + { + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + } + #else + if (level>0) { + PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); + goto bad; + } + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, NULL); + #endif +bad: + Py_XDECREF(empty_list); + Py_XDECREF(py_import); + Py_XDECREF(empty_dict); + return module; +} + +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 (unsigned long)PyLong_AsUnsignedLong(x); + } else { + return (unsigned long)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 (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (unsigned PY_LONG_LONG)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 (long)PyLong_AsUnsignedLong(x); + } else { + return (long)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 (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (PY_LONG_LONG)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 (signed long)PyLong_AsUnsignedLong(x); + } else { + return (signed long)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 (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (signed PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + signed PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsSignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static int __Pyx_check_binary_version(void) { + char ctversion[4], rtversion[4]; + PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); + if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compiletime version %s of module '%.100s' " + "does not match runtime version %s", + ctversion, __Pyx_MODULE_NAME, rtversion); + #if PY_VERSION_HEX < 0x02050000 + return PyErr_Warn(NULL, message); + #else + return PyErr_WarnEx(NULL, message, 1); + #endif + } + return 0; +} + +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, + size_t 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 > (Py_ssize_t)size) { + PyOS_snprintf(warning, sizeof(warning), + "%s.%s size changed, may indicate binary incompatibility", + module_name, class_name); + #if PY_VERSION_HEX < 0x02050000 + if (PyErr_Warn(NULL, warning) < 0) goto bad; + #else + if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; + #endif + } + else if (((PyTypeObject *)result)->tp_basicsize != (Py_ssize_t)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 NULL; +} +#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 + +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" + +static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, + int __pyx_lineno, const char *__pyx_filename) { + 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 */