summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--msgpack.c653
-rw-r--r--msgpack.pyx9
2 files changed, 437 insertions, 225 deletions
diff --git a/msgpack.c b/msgpack.c
index e044f18..821f65b 100644
--- a/msgpack.c
+++ b/msgpack.c
@@ -1,4 +1,4 @@
-/* Generated by Cython 0.11.2 on Mon Jun 8 12:41:02 2009 */
+/* Generated by Cython 0.11.2 on Tue Jun 9 13:10:11 2009 */
#define PY_SSIZE_T_CLEAN
#include "Python.h"
@@ -317,13 +317,15 @@ static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);
static void __Pyx_WriteUnraisable(const char *name); /*proto*/
+static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
+
static void __Pyx_AddTraceback(const char *funcname); /*proto*/
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
/* Type declarations */
-/* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":39
+/* "/home/inada-n/work/msgpack/python/msgpack.pyx":39
* cdef int BUFF_SIZE=2*1024
*
* cdef class Packer: # <<<<<<<<<<<<<<
@@ -333,6 +335,7 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
struct __pyx_obj_7msgpack_Packer {
PyObject_HEAD
+ struct __pyx_vtabstruct_7msgpack_Packer *__pyx_vtab;
char *buff;
unsigned int length;
unsigned int allocated;
@@ -340,7 +343,7 @@ struct __pyx_obj_7msgpack_Packer {
PyObject *strm;
};
-/* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":193
+/* "/home/inada-n/work/msgpack/python/msgpack.pyx":200
* return unpacks(packed)
*
* cdef class Unpacker: # <<<<<<<<<<<<<<
@@ -351,11 +354,26 @@ struct __pyx_obj_7msgpack_Packer {
struct __pyx_obj_7msgpack_Unpacker {
PyObject_HEAD
};
+
+
+/* "/home/inada-n/work/msgpack/python/msgpack.pyx":39
+ * cdef int BUFF_SIZE=2*1024
+ *
+ * cdef class Packer: # <<<<<<<<<<<<<<
+ * """Packer that pack data into strm.
+ *
+ */
+
+struct __pyx_vtabstruct_7msgpack_Packer {
+ PyObject *(*__pack)(struct __pyx_obj_7msgpack_Packer *, PyObject *);
+};
+static struct __pyx_vtabstruct_7msgpack_Packer *__pyx_vtabptr_7msgpack_Packer;
/* Module declarations from msgpack */
static PyTypeObject *__pyx_ptype_7msgpack_Packer = 0;
static PyTypeObject *__pyx_ptype_7msgpack_Unpacker = 0;
static int __pyx_v_7msgpack_BUFF_SIZE;
+static PyObject *__pyx_k_1 = 0;
static int __pyx_f_7msgpack__packer_write(struct __pyx_obj_7msgpack_Packer *, const char*, unsigned int); /*proto*/
#define __Pyx_MODULE_NAME "msgpack"
int __pyx_module_is_main_msgpack = 0;
@@ -365,6 +383,8 @@ static char __pyx_k___main__[] = "__main__";
static PyObject *__pyx_kp___main__;
static char __pyx_k___init__[] = "__init__";
static PyObject *__pyx_kp___init__;
+static char __pyx_k___del__[] = "__del__";
+static PyObject *__pyx_kp___del__;
static char __pyx_k_flush[] = "flush";
static PyObject *__pyx_kp_flush;
static char __pyx_k_pack_list[] = "pack_list";
@@ -381,6 +401,8 @@ static char __pyx_k_size[] = "size";
static PyObject *__pyx_kp_size;
static char __pyx_k_len[] = "len";
static PyObject *__pyx_kp_len;
+static char __pyx_k_obj[] = "obj";
+static PyObject *__pyx_kp_obj;
static char __pyx_k_o[] = "o";
static PyObject *__pyx_kp_o;
static char __pyx_k_stream[] = "stream";
@@ -397,8 +419,8 @@ static char __pyx_k_unpacks[] = "unpacks";
static PyObject *__pyx_kp_unpacks;
static char __pyx_k_write[] = "write";
static PyObject *__pyx_kp_write;
-static char __pyx_k_1[] = "flush";
-static PyObject *__pyx_kp_1;
+static char __pyx_k_2[] = "flush";
+static PyObject *__pyx_kp_2;
static char __pyx_k_encode[] = "encode";
static PyObject *__pyx_kp_encode;
static char __pyx_k_iteritems[] = "iteritems";
@@ -411,12 +433,12 @@ static char __pyx_k_read[] = "read";
static PyObject *__pyx_kp_read;
static PyObject *__pyx_builtin_staticmethod;
static PyObject *__pyx_builtin_TypeError;
-static PyObject *__pyx_kp_2;
static PyObject *__pyx_kp_3;
-static char __pyx_k_2[] = "utf-8";
-static char __pyx_k_3[] = "can't serialize %r";
+static PyObject *__pyx_kp_4;
+static char __pyx_k_3[] = "utf-8";
+static char __pyx_k_4[] = "can't serialize %r";
-/* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":51
+/* "/home/inada-n/work/msgpack/python/msgpack.pyx":51
* cdef object strm
*
* def __init__(self, strm, int size=0): # <<<<<<<<<<<<<<
@@ -478,7 +500,7 @@ static int __pyx_pf_7msgpack_6Packer___init__(PyObject *__pyx_v_self, PyObject *
return -1;
__pyx_L4_argument_unpacking_done:;
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":52
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":52
*
* def __init__(self, strm, int size=0):
* if size <= 0: # <<<<<<<<<<<<<<
@@ -488,7 +510,7 @@ static int __pyx_pf_7msgpack_6Packer___init__(PyObject *__pyx_v_self, PyObject *
__pyx_t_1 = (__pyx_v_size <= 0);
if (__pyx_t_1) {
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":53
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":53
* def __init__(self, strm, int size=0):
* if size <= 0:
* size = BUFF_SIZE # <<<<<<<<<<<<<<
@@ -500,7 +522,7 @@ static int __pyx_pf_7msgpack_6Packer___init__(PyObject *__pyx_v_self, PyObject *
}
__pyx_L6:;
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":55
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":55
* size = BUFF_SIZE
*
* self.strm = strm # <<<<<<<<<<<<<<
@@ -513,7 +535,7 @@ static int __pyx_pf_7msgpack_6Packer___init__(PyObject *__pyx_v_self, PyObject *
__Pyx_DECREF(((struct __pyx_obj_7msgpack_Packer *)__pyx_v_self)->strm);
((struct __pyx_obj_7msgpack_Packer *)__pyx_v_self)->strm = __pyx_v_strm;
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":56
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":56
*
* self.strm = strm
* self.buff = <char*> malloc(size) # <<<<<<<<<<<<<<
@@ -522,7 +544,7 @@ static int __pyx_pf_7msgpack_6Packer___init__(PyObject *__pyx_v_self, PyObject *
*/
((struct __pyx_obj_7msgpack_Packer *)__pyx_v_self)->buff = ((char *)malloc(__pyx_v_size));
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":57
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":57
* self.strm = strm
* self.buff = <char*> malloc(size)
* self.allocated = size # <<<<<<<<<<<<<<
@@ -531,7 +553,7 @@ static int __pyx_pf_7msgpack_6Packer___init__(PyObject *__pyx_v_self, PyObject *
*/
((struct __pyx_obj_7msgpack_Packer *)__pyx_v_self)->allocated = __pyx_v_size;
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":58
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":58
* self.buff = <char*> malloc(size)
* self.allocated = size
* self.length = 0 # <<<<<<<<<<<<<<
@@ -540,12 +562,12 @@ static int __pyx_pf_7msgpack_6Packer___init__(PyObject *__pyx_v_self, PyObject *
*/
((struct __pyx_obj_7msgpack_Packer *)__pyx_v_self)->length = 0;
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":60
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":60
* self.length = 0
*
* msgpack_packer_init(&self.pk, <void*>self, <msgpack_packer_write>_packer_write) # <<<<<<<<<<<<<<
*
- *
+ * def __del__(self):
*/
msgpack_packer_init((&((struct __pyx_obj_7msgpack_Packer *)__pyx_v_self)->pk), ((void *)__pyx_v_self), ((int (*)(void *, const char*, unsigned int))__pyx_f_7msgpack__packer_write));
@@ -554,8 +576,36 @@ static int __pyx_pf_7msgpack_6Packer___init__(PyObject *__pyx_v_self, PyObject *
return __pyx_r;
}
-/* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":63
+/* "/home/inada-n/work/msgpack/python/msgpack.pyx":62
+ * msgpack_packer_init(&self.pk, <void*>self, <msgpack_packer_write>_packer_write)
+ *
+ * def __del__(self): # <<<<<<<<<<<<<<
+ * free(self.buff);
+ *
+ */
+
+static PyObject *__pyx_pf_7msgpack_6Packer___del__(PyObject *__pyx_v_self, PyObject *unused); /*proto*/
+static PyObject *__pyx_pf_7msgpack_6Packer___del__(PyObject *__pyx_v_self, PyObject *unused) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_SetupRefcountContext("__del__");
+
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":63
*
+ * def __del__(self):
+ * free(self.buff); # <<<<<<<<<<<<<<
+ *
+ * def flush(self):
+ */
+ free(((struct __pyx_obj_7msgpack_Packer *)__pyx_v_self)->buff);
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_FinishRefcountContext();
+ return __pyx_r;
+}
+
+/* "/home/inada-n/work/msgpack/python/msgpack.pyx":65
+ * free(self.buff);
*
* def flush(self): # <<<<<<<<<<<<<<
* """Flash local buffer and output stream if it has 'flush()' method."""
@@ -572,7 +622,7 @@ static PyObject *__pyx_pf_7msgpack_6Packer_flush(PyObject *__pyx_v_self, PyObjec
PyObject *__pyx_t_4 = NULL;
__Pyx_SetupRefcountContext("flush");
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":65
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":67
* def flush(self):
* """Flash local buffer and output stream if it has 'flush()' method."""
* if self.length > 0: # <<<<<<<<<<<<<<
@@ -582,29 +632,29 @@ static PyObject *__pyx_pf_7msgpack_6Packer_flush(PyObject *__pyx_v_self, PyObjec
__pyx_t_1 = (((struct __pyx_obj_7msgpack_Packer *)__pyx_v_self)->length > 0);
if (__pyx_t_1) {
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":66
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":68
* """Flash local buffer and output stream if it has 'flush()' method."""
* if self.length > 0:
* self.strm.write(PyString_FromStringAndSize(self.buff, self.length)) # <<<<<<<<<<<<<<
* self.length = 0
* if hasattr(self.strm, 'flush'):
*/
- __pyx_t_2 = PyObject_GetAttr(((struct __pyx_obj_7msgpack_Packer *)__pyx_v_self)->strm, __pyx_kp_write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_GetAttr(((struct __pyx_obj_7msgpack_Packer *)__pyx_v_self)->strm, __pyx_kp_write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyString_FromStringAndSize(((struct __pyx_obj_7msgpack_Packer *)__pyx_v_self)->buff, ((struct __pyx_obj_7msgpack_Packer *)__pyx_v_self)->length); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyString_FromStringAndSize(((struct __pyx_obj_7msgpack_Packer *)__pyx_v_self)->buff, ((struct __pyx_obj_7msgpack_Packer *)__pyx_v_self)->length); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_4));
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
__pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":67
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":69
* if self.length > 0:
* self.strm.write(PyString_FromStringAndSize(self.buff, self.length))
* self.length = 0 # <<<<<<<<<<<<<<
@@ -616,26 +666,26 @@ static PyObject *__pyx_pf_7msgpack_6Packer_flush(PyObject *__pyx_v_self, PyObjec
}
__pyx_L5:;
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":68
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":70
* self.strm.write(PyString_FromStringAndSize(self.buff, self.length))
* self.length = 0
* if hasattr(self.strm, 'flush'): # <<<<<<<<<<<<<<
* self.strm.flush()
*
*/
- __pyx_t_1 = PyObject_HasAttr(((struct __pyx_obj_7msgpack_Packer *)__pyx_v_self)->strm, __pyx_kp_1); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_HasAttr(((struct __pyx_obj_7msgpack_Packer *)__pyx_v_self)->strm, __pyx_kp_2); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_1) {
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":69
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":71
* self.length = 0
* if hasattr(self.strm, 'flush'):
* self.strm.flush() # <<<<<<<<<<<<<<
*
* def pack_list(self, len):
*/
- __pyx_t_3 = PyObject_GetAttr(((struct __pyx_obj_7msgpack_Packer *)__pyx_v_self)->strm, __pyx_kp_flush); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetAttr(((struct __pyx_obj_7msgpack_Packer *)__pyx_v_self)->strm, __pyx_kp_flush); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __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 = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __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 = 71; __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;
@@ -657,7 +707,7 @@ static PyObject *__pyx_pf_7msgpack_6Packer_flush(PyObject *__pyx_v_self, PyObjec
return __pyx_r;
}
-/* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":71
+/* "/home/inada-n/work/msgpack/python/msgpack.pyx":73
* self.strm.flush()
*
* def pack_list(self, len): # <<<<<<<<<<<<<<
@@ -672,14 +722,14 @@ static PyObject *__pyx_pf_7msgpack_6Packer_pack_list(PyObject *__pyx_v_self, PyO
size_t __pyx_t_1;
__Pyx_SetupRefcountContext("pack_list");
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":84
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":86
* packer.pack(['foo', 'bar'])
* """
* msgpack_pack_array(&self.pk, len) # <<<<<<<<<<<<<<
*
* def pack_dict(self, len):
*/
- __pyx_t_1 = __Pyx_PyInt_AsSize_t(__pyx_v_len); if (unlikely((__pyx_t_1 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyInt_AsSize_t(__pyx_v_len); if (unlikely((__pyx_t_1 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
msgpack_pack_array((&((struct __pyx_obj_7msgpack_Packer *)__pyx_v_self)->pk), __pyx_t_1);
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -693,7 +743,7 @@ static PyObject *__pyx_pf_7msgpack_6Packer_pack_list(PyObject *__pyx_v_self, PyO
return __pyx_r;
}
-/* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":86
+/* "/home/inada-n/work/msgpack/python/msgpack.pyx":88
* msgpack_pack_array(&self.pk, len)
*
* def pack_dict(self, len): # <<<<<<<<<<<<<<
@@ -708,14 +758,14 @@ static PyObject *__pyx_pf_7msgpack_6Packer_pack_dict(PyObject *__pyx_v_self, PyO
size_t __pyx_t_1;
__Pyx_SetupRefcountContext("pack_dict");
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":99
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":101
* packer.pack({'foo', 'bar'})
* """
* msgpack_pack_map(&self.pk, len) # <<<<<<<<<<<<<<
*
- * def pack(self, object o):
+ * cdef __pack(self, object o):
*/
- __pyx_t_1 = __Pyx_PyInt_AsSize_t(__pyx_v_len); if (unlikely((__pyx_t_1 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyInt_AsSize_t(__pyx_v_len); if (unlikely((__pyx_t_1 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
msgpack_pack_map((&((struct __pyx_obj_7msgpack_Packer *)__pyx_v_self)->pk), __pyx_t_1);
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
@@ -729,16 +779,15 @@ static PyObject *__pyx_pf_7msgpack_6Packer_pack_dict(PyObject *__pyx_v_self, PyO
return __pyx_r;
}
-/* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":101
+/* "/home/inada-n/work/msgpack/python/msgpack.pyx":103
* msgpack_pack_map(&self.pk, len)
*
- * def pack(self, object o): # <<<<<<<<<<<<<<
+ * cdef __pack(self, object o): # <<<<<<<<<<<<<<
* cdef long long intval
* cdef double fval
*/
-static PyObject *__pyx_pf_7msgpack_6Packer_pack(PyObject *__pyx_v_self, PyObject *__pyx_v_o); /*proto*/
-static PyObject *__pyx_pf_7msgpack_6Packer_pack(PyObject *__pyx_v_self, PyObject *__pyx_v_o) {
+static PyObject *__pyx_f_7msgpack_6Packer___pack(struct __pyx_obj_7msgpack_Packer *__pyx_v_self, PyObject *__pyx_v_o) {
PY_LONG_LONG __pyx_v_intval;
double __pyx_v_fval;
char *__pyx_v_rawval;
@@ -758,12 +807,12 @@ static PyObject *__pyx_pf_7msgpack_6Packer_pack(PyObject *__pyx_v_self, PyObject
PyObject *__pyx_t_8 = NULL;
int __pyx_t_9;
int __pyx_t_10;
- __Pyx_SetupRefcountContext("pack");
+ __Pyx_SetupRefcountContext("__pack");
__Pyx_INCREF(__pyx_v_o);
__pyx_v_k = Py_None; __Pyx_INCREF(Py_None);
__pyx_v_v = Py_None; __Pyx_INCREF(Py_None);
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":106
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":108
* cdef char* rawval
*
* if o is None: # <<<<<<<<<<<<<<
@@ -773,66 +822,66 @@ static PyObject *__pyx_pf_7msgpack_6Packer_pack(PyObject *__pyx_v_self, PyObject
__pyx_t_1 = (__pyx_v_o == Py_None);
if (__pyx_t_1) {
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":107
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":109
*
* if o is None:
* msgpack_pack_nil(&self.pk) # <<<<<<<<<<<<<<
* elif o is True:
* msgpack_pack_true(&self.pk)
*/
- msgpack_pack_nil((&((struct __pyx_obj_7msgpack_Packer *)__pyx_v_self)->pk));
- goto __pyx_L5;
+ msgpack_pack_nil((&__pyx_v_self->pk));
+ goto __pyx_L3;
}
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":108
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":110
* if o is None:
* msgpack_pack_nil(&self.pk)
* elif o is True: # <<<<<<<<<<<<<<
* msgpack_pack_true(&self.pk)
* elif o is False:
*/
- __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_1 = (__pyx_v_o == __pyx_t_2);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_1) {
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":109
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":111
* msgpack_pack_nil(&self.pk)
* elif o is True:
* msgpack_pack_true(&self.pk) # <<<<<<<<<<<<<<
* elif o is False:
* msgpack_pack_false(&self.pk)
*/
- msgpack_pack_true((&((struct __pyx_obj_7msgpack_Packer *)__pyx_v_self)->pk));
- goto __pyx_L5;
+ msgpack_pack_true((&__pyx_v_self->pk));
+ goto __pyx_L3;
}
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":110
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":112
* elif o is True:
* msgpack_pack_true(&self.pk)
* elif o is False: # <<<<<<<<<<<<<<
* msgpack_pack_false(&self.pk)
* elif isinstance(o, long):
*/
- __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_1 = (__pyx_v_o == __pyx_t_2);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
if (__pyx_t_1) {
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":111
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":113
* msgpack_pack_true(&self.pk)
* elif o is False:
* msgpack_pack_false(&self.pk) # <<<<<<<<<<<<<<
* elif isinstance(o, long):
* intval = o
*/
- msgpack_pack_false((&((struct __pyx_obj_7msgpack_Packer *)__pyx_v_self)->pk));
- goto __pyx_L5;
+ msgpack_pack_false((&__pyx_v_self->pk));
+ goto __pyx_L3;
}
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":112
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":114
* elif o is False:
* msgpack_pack_false(&self.pk)
* elif isinstance(o, long): # <<<<<<<<<<<<<<
@@ -842,28 +891,28 @@ static PyObject *__pyx_pf_7msgpack_6Packer_pack(PyObject *__pyx_v_self, PyObject
__pyx_t_1 = PyObject_TypeCheck(__pyx_v_o, ((PyTypeObject *)((PyObject*)&PyLong_Type)));
if (__pyx_t_1) {
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":113
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":115
* msgpack_pack_false(&self.pk)
* elif isinstance(o, long):
* intval = o # <<<<<<<<<<<<<<
* msgpack_pack_long_long(&self.pk, intval)
* elif isinstance(o, int):
*/
- __pyx_t_3 = __Pyx_PyInt_AsLongLong(__pyx_v_o); if (unlikely((__pyx_t_3 == (PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyInt_AsLongLong(__pyx_v_o); if (unlikely((__pyx_t_3 == (PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_intval = __pyx_t_3;
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":114
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":116
* elif isinstance(o, long):
* intval = o
* msgpack_pack_long_long(&self.pk, intval) # <<<<<<<<<<<<<<
* elif isinstance(o, int):
* intval = o
*/
- msgpack_pack_long_long((&((struct __pyx_obj_7msgpack_Packer *)__pyx_v_self)->pk), __pyx_v_intval);
- goto __pyx_L5;
+ msgpack_pack_long_long((&__pyx_v_self->pk), __pyx_v_intval);
+ goto __pyx_L3;
}
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":115
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":117
* intval = o
* msgpack_pack_long_long(&self.pk, intval)
* elif isinstance(o, int): # <<<<<<<<<<<<<<
@@ -873,28 +922,28 @@ static PyObject *__pyx_pf_7msgpack_6Packer_pack(PyObject *__pyx_v_self, PyObject
__pyx_t_1 = PyObject_TypeCheck(__pyx_v_o, ((PyTypeObject *)((PyObject*)&PyInt_Type)));
if (__pyx_t_1) {
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":116
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":118
* msgpack_pack_long_long(&self.pk, intval)
* elif isinstance(o, int):
* intval = o # <<<<<<<<<<<<<<
* msgpack_pack_long_long(&self.pk, intval)
* elif isinstance(o, float):
*/
- __pyx_t_3 = __Pyx_PyInt_AsLongLong(__pyx_v_o); if (unlikely((__pyx_t_3 == (PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = __Pyx_PyInt_AsLongLong(__pyx_v_o); if (unlikely((__pyx_t_3 == (PY_LONG_LONG)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_intval = __pyx_t_3;
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":117
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":119
* elif isinstance(o, int):
* intval = o
* msgpack_pack_long_long(&self.pk, intval) # <<<<<<<<<<<<<<
* elif isinstance(o, float):
* fval = 9
*/
- msgpack_pack_long_long((&((struct __pyx_obj_7msgpack_Packer *)__pyx_v_self)->pk), __pyx_v_intval);
- goto __pyx_L5;
+ msgpack_pack_long_long((&__pyx_v_self->pk), __pyx_v_intval);
+ goto __pyx_L3;
}
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":118
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":120
* intval = o
* msgpack_pack_long_long(&self.pk, intval)
* elif isinstance(o, float): # <<<<<<<<<<<<<<
@@ -904,7 +953,7 @@ static PyObject *__pyx_pf_7msgpack_6Packer_pack(PyObject *__pyx_v_self, PyObject
__pyx_t_1 = PyObject_TypeCheck(__pyx_v_o, ((PyTypeObject *)((PyObject*)&PyFloat_Type)));
if (__pyx_t_1) {
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":119
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":121
* msgpack_pack_long_long(&self.pk, intval)
* elif isinstance(o, float):
* fval = 9 # <<<<<<<<<<<<<<
@@ -913,18 +962,18 @@ static PyObject *__pyx_pf_7msgpack_6Packer_pack(PyObject *__pyx_v_self, PyObject
*/
__pyx_v_fval = 9;
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":120
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":122
* elif isinstance(o, float):
* fval = 9
* msgpack_pack_double(&self.pk, fval) # <<<<<<<<<<<<<<
* elif isinstance(o, str):
* rawval = o
*/
- msgpack_pack_double((&((struct __pyx_obj_7msgpack_Packer *)__pyx_v_self)->pk), __pyx_v_fval);
- goto __pyx_L5;
+ msgpack_pack_double((&__pyx_v_self->pk), __pyx_v_fval);
+ goto __pyx_L3;
}
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":121
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":123
* fval = 9
* msgpack_pack_double(&self.pk, fval)
* elif isinstance(o, str): # <<<<<<<<<<<<<<
@@ -934,39 +983,39 @@ static PyObject *__pyx_pf_7msgpack_6Packer_pack(PyObject *__pyx_v_self, PyObject
__pyx_t_1 = PyObject_TypeCheck(__pyx_v_o, ((PyTypeObject *)((PyObject*)&PyString_Type)));
if (__pyx_t_1) {
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":122
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":124
* msgpack_pack_double(&self.pk, fval)
* elif isinstance(o, str):
* rawval = o # <<<<<<<<<<<<<<
* msgpack_pack_raw(&self.pk, len(o))
* msgpack_pack_raw_body(&self.pk, rawval, len(o))
*/
- __pyx_t_4 = __Pyx_PyBytes_AsString(__pyx_v_o); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyBytes_AsString(__pyx_v_o); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_rawval = __pyx_t_4;
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":123
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":125
* elif isinstance(o, str):
* rawval = o
* msgpack_pack_raw(&self.pk, len(o)) # <<<<<<<<<<<<<<
* msgpack_pack_raw_body(&self.pk, rawval, len(o))
* elif isinstance(o, unicode):
*/
- __pyx_t_5 = PyObject_Length(__pyx_v_o); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- msgpack_pack_raw((&((struct __pyx_obj_7msgpack_Packer *)__pyx_v_self)->pk), __pyx_t_5);
+ __pyx_t_5 = PyObject_Length(__pyx_v_o); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ msgpack_pack_raw((&__pyx_v_self->pk), __pyx_t_5);
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":124
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":126
* rawval = o
* msgpack_pack_raw(&self.pk, len(o))
* msgpack_pack_raw_body(&self.pk, rawval, len(o)) # <<<<<<<<<<<<<<
* elif isinstance(o, unicode):
* o = o.encode('utf-8')
*/
- __pyx_t_5 = PyObject_Length(__pyx_v_o); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- msgpack_pack_raw_body((&((struct __pyx_obj_7msgpack_Packer *)__pyx_v_self)->pk), __pyx_v_rawval, __pyx_t_5);
- goto __pyx_L5;
+ __pyx_t_5 = PyObject_Length(__pyx_v_o); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ msgpack_pack_raw_body((&__pyx_v_self->pk), __pyx_v_rawval, __pyx_t_5);
+ goto __pyx_L3;
}
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":125
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":127
* msgpack_pack_raw(&self.pk, len(o))
* msgpack_pack_raw_body(&self.pk, rawval, len(o))
* elif isinstance(o, unicode): # <<<<<<<<<<<<<<
@@ -976,21 +1025,21 @@ static PyObject *__pyx_pf_7msgpack_6Packer_pack(PyObject *__pyx_v_self, PyObject
__pyx_t_1 = PyObject_TypeCheck(__pyx_v_o, ((PyTypeObject *)((PyObject*)&PyUnicode_Type)));
if (__pyx_t_1) {
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":126
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":128
* msgpack_pack_raw_body(&self.pk, rawval, len(o))
* elif isinstance(o, unicode):
* o = o.encode('utf-8') # <<<<<<<<<<<<<<
* rawval = o
* msgpack_pack_raw(&self.pk, len(o))
*/
- __pyx_t_2 = PyObject_GetAttr(__pyx_v_o, __pyx_kp_encode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_GetAttr(__pyx_v_o, __pyx_kp_encode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_6));
- __Pyx_INCREF(__pyx_kp_2);
- PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_kp_2);
- __Pyx_GIVEREF(__pyx_kp_2);
- __pyx_t_7 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_INCREF(__pyx_kp_3);
+ PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_kp_3);
+ __Pyx_GIVEREF(__pyx_kp_3);
+ __pyx_t_7 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
@@ -998,39 +1047,39 @@ static PyObject *__pyx_pf_7msgpack_6Packer_pack(PyObject *__pyx_v_self, PyObject
__pyx_v_o = __pyx_t_7;
__pyx_t_7 = 0;
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":127
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":129
* elif isinstance(o, unicode):
* o = o.encode('utf-8')
* rawval = o # <<<<<<<<<<<<<<
* msgpack_pack_raw(&self.pk, len(o))
* msgpack_pack_raw_body(&self.pk, rawval, len(o))
*/
- __pyx_t_4 = __Pyx_PyBytes_AsString(__pyx_v_o); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyBytes_AsString(__pyx_v_o); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_rawval = __pyx_t_4;
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":128
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":130
* o = o.encode('utf-8')
* rawval = o
* msgpack_pack_raw(&self.pk, len(o)) # <<<<<<<<<<<<<<
* msgpack_pack_raw_body(&self.pk, rawval, len(o))
* elif isinstance(o, dict):
*/
- __pyx_t_5 = PyObject_Length(__pyx_v_o); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- msgpack_pack_raw((&((struct __pyx_obj_7msgpack_Packer *)__pyx_v_self)->pk), __pyx_t_5);
+ __pyx_t_5 = PyObject_Length(__pyx_v_o); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ msgpack_pack_raw((&__pyx_v_self->pk), __pyx_t_5);
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":129
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":131
* rawval = o
* msgpack_pack_raw(&self.pk, len(o))
* msgpack_pack_raw_body(&self.pk, rawval, len(o)) # <<<<<<<<<<<<<<
* elif isinstance(o, dict):
* msgpack_pack_map(&self.pk, len(o))
*/
- __pyx_t_5 = PyObject_Length(__pyx_v_o); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- msgpack_pack_raw_body((&((struct __pyx_obj_7msgpack_Packer *)__pyx_v_self)->pk), __pyx_v_rawval, __pyx_t_5);
- goto __pyx_L5;
+ __pyx_t_5 = PyObject_Length(__pyx_v_o); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ msgpack_pack_raw_body((&__pyx_v_self->pk), __pyx_v_rawval, __pyx_t_5);
+ goto __pyx_L3;
}
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":130
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":132
* msgpack_pack_raw(&self.pk, len(o))
* msgpack_pack_raw_body(&self.pk, rawval, len(o))
* elif isinstance(o, dict): # <<<<<<<<<<<<<<
@@ -1040,32 +1089,32 @@ static PyObject *__pyx_pf_7msgpack_6Packer_pack(PyObject *__pyx_v_self, PyObject
__pyx_t_1 = PyObject_TypeCheck(__pyx_v_o, ((PyTypeObject *)((PyObject*)&PyDict_Type)));
if (__pyx_t_1) {
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":131
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":133
* msgpack_pack_raw_body(&self.pk, rawval, len(o))
* elif isinstance(o, dict):
* msgpack_pack_map(&self.pk, len(o)) # <<<<<<<<<<<<<<
* for k,v in o.iteritems():
* self.pack(k)
*/
- __pyx_t_5 = PyObject_Length(__pyx_v_o); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- msgpack_pack_map((&((struct __pyx_obj_7msgpack_Packer *)__pyx_v_self)->pk), __pyx_t_5);
+ __pyx_t_5 = PyObject_Length(__pyx_v_o); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ msgpack_pack_map((&__pyx_v_self->pk), __pyx_t_5);
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":132
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":134
* elif isinstance(o, dict):
* msgpack_pack_map(&self.pk, len(o))
* for k,v in o.iteritems(): # <<<<<<<<<<<<<<
* self.pack(k)
* self.pack(v)
*/
- __pyx_t_7 = PyObject_GetAttr(__pyx_v_o, __pyx_kp_iteritems); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PyObject_GetAttr(__pyx_v_o, __pyx_kp_iteritems); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
- __pyx_t_6 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
if (PyList_CheckExact(__pyx_t_6) || PyTuple_CheckExact(__pyx_t_6)) {
__pyx_t_5 = 0; __pyx_t_7 = __pyx_t_6; __Pyx_INCREF(__pyx_t_7);
} else {
- __pyx_t_5 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
}
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
@@ -1079,7 +1128,7 @@ static PyObject *__pyx_pf_7msgpack_6Packer_pack(PyObject *__pyx_v_self, PyObject
} else {
__pyx_t_6 = PyIter_Next(__pyx_t_7);
if (!__pyx_t_6) {
- if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
break;
}
__Pyx_GOTREF(__pyx_t_6);
@@ -1096,14 +1145,14 @@ static PyObject *__pyx_pf_7msgpack_6Packer_pack(PyObject *__pyx_v_self, PyObject
__pyx_v_v = __pyx_3;
__pyx_3 = 0;
} else {
- __pyx_1 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_1 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_1);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_2);
- __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_3);
- if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_1); __pyx_1 = 0;
__Pyx_DECREF(__pyx_v_k);
__pyx_v_k = __pyx_2;
@@ -1113,51 +1162,51 @@ static PyObject *__pyx_pf_7msgpack_6Packer_pack(PyObject *__pyx_v_self, PyObject
__pyx_3 = 0;
}
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":133
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":135
* msgpack_pack_map(&self.pk, len(o))
* for k,v in o.iteritems():
* self.pack(k) # <<<<<<<<<<<<<<
* self.pack(v)
* elif isinstance(o, tuple) or isinstance(o, list):
*/
- __pyx_t_6 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_pack); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_kp_pack); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
__Pyx_INCREF(__pyx_v_k);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_k);
__Pyx_GIVEREF(__pyx_v_k);
- __pyx_t_8 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":134
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":136
* for k,v in o.iteritems():
* self.pack(k)
* self.pack(v) # <<<<<<<<<<<<<<
* elif isinstance(o, tuple) or isinstance(o, list):
* msgpack_pack_array(&self.pk, len(o))
*/
- __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_pack); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_kp_pack); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
__Pyx_INCREF(__pyx_v_v);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_v);
__Pyx_GIVEREF(__pyx_v_v);
- __pyx_t_6 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
}
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- goto __pyx_L5;
+ goto __pyx_L3;
}
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":135
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":137
* self.pack(k)
* self.pack(v)
* elif isinstance(o, tuple) or isinstance(o, list): # <<<<<<<<<<<<<<
@@ -1173,17 +1222,17 @@ static PyObject *__pyx_pf_7msgpack_6Packer_pack(PyObject *__pyx_v_self, PyObject
}
if (__pyx_t_10) {
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":136
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":138
* self.pack(v)
* elif isinstance(o, tuple) or isinstance(o, list):
* msgpack_pack_array(&self.pk, len(o)) # <<<<<<<<<<<<<<
* for v in o:
* self.pack(v)
*/
- __pyx_t_5 = PyObject_Length(__pyx_v_o); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- msgpack_pack_array((&((struct __pyx_obj_7msgpack_Packer *)__pyx_v_self)->pk), __pyx_t_5);
+ __pyx_t_5 = PyObject_Length(__pyx_v_o); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ msgpack_pack_array((&__pyx_v_self->pk), __pyx_t_5);
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":137
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":139
* elif isinstance(o, tuple) or isinstance(o, list):
* msgpack_pack_array(&self.pk, len(o))
* for v in o: # <<<<<<<<<<<<<<
@@ -1193,7 +1242,7 @@ static PyObject *__pyx_pf_7msgpack_6Packer_pack(PyObject *__pyx_v_self, PyObject
if (PyList_CheckExact(__pyx_v_o) || PyTuple_CheckExact(__pyx_v_o)) {
__pyx_t_5 = 0; __pyx_t_7 = __pyx_v_o; __Pyx_INCREF(__pyx_t_7);
} else {
- __pyx_t_5 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
}
for (;;) {
@@ -1206,7 +1255,7 @@ static PyObject *__pyx_pf_7msgpack_6Packer_pack(PyObject *__pyx_v_self, PyObject
} else {
__pyx_t_6 = PyIter_Next(__pyx_t_7);
if (!__pyx_t_6) {
- if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
break;
}
__Pyx_GOTREF(__pyx_t_6);
@@ -1215,51 +1264,51 @@ static PyObject *__pyx_pf_7msgpack_6Packer_pack(PyObject *__pyx_v_self, PyObject
__pyx_v_v = __pyx_t_6;
__pyx_t_6 = 0;
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":138
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":140
* msgpack_pack_array(&self.pk, len(o))
* for v in o:
* self.pack(v) # <<<<<<<<<<<<<<
* else:
* # TODO: Serialize with defalt() like simplejson.
*/
- __pyx_t_6 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_pack); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_kp_pack); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
__Pyx_INCREF(__pyx_v_v);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_v);
__Pyx_GIVEREF(__pyx_v_v);
- __pyx_t_8 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
}
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
- goto __pyx_L5;
+ goto __pyx_L3;
}
/*else*/ {
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":141
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":143
* else:
* # TODO: Serialize with defalt() like simplejson.
* raise TypeError, "can't serialize %r" % (o,) # <<<<<<<<<<<<<<
*
- * cdef int _packer_write(Packer packer, const_char_ptr b, unsigned int l):
+ * def pack(self, obj, flush=True):
*/
- __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_7));
__Pyx_INCREF(__pyx_v_o);
PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_o);
__Pyx_GIVEREF(__pyx_v_o);
- __pyx_t_8 = PyNumber_Remainder(__pyx_kp_3, ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_8 = PyNumber_Remainder(__pyx_kp_4, ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
__Pyx_Raise(__pyx_builtin_TypeError, __pyx_t_8, 0);
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_L5:;
+ __pyx_L3:;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
@@ -1271,8 +1320,8 @@ static PyObject *__pyx_pf_7msgpack_6Packer_pack(PyObject *__pyx_v_self, PyObject
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_XDECREF(__pyx_t_8);
- __Pyx_AddTraceback("msgpack.Packer.pack");
- __pyx_r = NULL;
+ __Pyx_AddTraceback("msgpack.Packer.__pack");
+ __pyx_r = 0;
__pyx_L0:;
__Pyx_DECREF(__pyx_v_k);
__Pyx_DECREF(__pyx_v_v);
@@ -1282,9 +1331,121 @@ static PyObject *__pyx_pf_7msgpack_6Packer_pack(PyObject *__pyx_v_self, PyObject
return __pyx_r;
}
-/* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":143
+/* "/home/inada-n/work/msgpack/python/msgpack.pyx":145
* raise TypeError, "can't serialize %r" % (o,)
*
+ * def pack(self, obj, flush=True): # <<<<<<<<<<<<<<
+ * self.__pack(obj)
+ * if flush:
+ */
+
+static PyObject *__pyx_pf_7msgpack_6Packer_pack(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_pf_7msgpack_6Packer_pack(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_obj = 0;
+ PyObject *__pyx_v_flush = 0;
+ PyObject *__pyx_r = NULL;
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_t_2;
+ PyObject *__pyx_t_3 = NULL;
+ static PyObject **__pyx_pyargnames[] = {&__pyx_kp_obj,&__pyx_kp_flush,0};
+ __Pyx_SetupRefcountContext("pack");
+ if (unlikely(__pyx_kwds)) {
+ Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
+ PyObject* values[2] = {0,0};
+ values[1] = __pyx_k_1;
+ switch (PyTuple_GET_SIZE(__pyx_args)) {
+ case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+ case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ switch (PyTuple_GET_SIZE(__pyx_args)) {
+ case 0:
+ values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_obj);
+ if (likely(values[0])) kw_args--;
+ else goto __pyx_L5_argtuple_error;
+ case 1:
+ if (kw_args > 1) {
+ PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_flush);
+ if (unlikely(value)) { values[1] = value; kw_args--; }
+ }
+ }
+ if (unlikely(kw_args > 0)) {
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "pack") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ }
+ __pyx_v_obj = values[0];
+ __pyx_v_flush = values[1];
+ } else {
+ __pyx_v_flush = __pyx_k_1;
+ switch (PyTuple_GET_SIZE(__pyx_args)) {
+ case 2: __pyx_v_flush = PyTuple_GET_ITEM(__pyx_args, 1);
+ case 1: __pyx_v_obj = PyTuple_GET_ITEM(__pyx_args, 0);
+ break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ }
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L5_argtuple_error:;
+ __Pyx_RaiseArgtupleInvalid("pack", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __pyx_L3_error:;
+ __Pyx_AddTraceback("msgpack.Packer.pack");
+ return NULL;
+ __pyx_L4_argument_unpacking_done:;
+
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":146
+ *
+ * def pack(self, obj, flush=True):
+ * self.__pack(obj) # <<<<<<<<<<<<<<
+ * if flush:
+ * self.flush()
+ */
+ __pyx_t_1 = ((struct __pyx_vtabstruct_7msgpack_Packer *)((struct __pyx_obj_7msgpack_Packer *)__pyx_v_self)->__pyx_vtab)->__pack(((struct __pyx_obj_7msgpack_Packer *)__pyx_v_self), __pyx_v_obj); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":147
+ * def pack(self, obj, flush=True):
+ * self.__pack(obj)
+ * if flush: # <<<<<<<<<<<<<<
+ * self.flush()
+ *
+ */
+ __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_flush); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__pyx_t_2) {
+
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":148
+ * self.__pack(obj)
+ * if flush:
+ * self.flush() # <<<<<<<<<<<<<<
+ *
+ * cdef int _packer_write(Packer packer, const_char_ptr b, unsigned int l):
+ */
+ __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_kp_flush); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ goto __pyx_L6;
+ }
+ __pyx_L6:;
+
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_AddTraceback("msgpack.Packer.pack");
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_FinishRefcountContext();
+ return __pyx_r;
+}
+
+/* "/home/inada-n/work/msgpack/python/msgpack.pyx":150
+ * self.flush()
+ *
* cdef int _packer_write(Packer packer, const_char_ptr b, unsigned int l): # <<<<<<<<<<<<<<
* if packer.length + l > packer.allocated:
* if packer.length > 0:
@@ -1298,7 +1459,7 @@ static int __pyx_f_7msgpack__packer_write(struct __pyx_obj_7msgpack_Packer *__p
PyObject *__pyx_t_4 = NULL;
__Pyx_SetupRefcountContext("_packer_write");
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":144
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":151
*
* cdef int _packer_write(Packer packer, const_char_ptr b, unsigned int l):
* if packer.length + l > packer.allocated: # <<<<<<<<<<<<<<
@@ -1308,7 +1469,7 @@ static int __pyx_f_7msgpack__packer_write(struct __pyx_obj_7msgpack_Packer *__p
__pyx_t_1 = ((__pyx_v_packer->length + __pyx_v_l) > __pyx_v_packer->allocated);
if (__pyx_t_1) {
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":145
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":152
* cdef int _packer_write(Packer packer, const_char_ptr b, unsigned int l):
* if packer.length + l > packer.allocated:
* if packer.length > 0: # <<<<<<<<<<<<<<
@@ -1318,23 +1479,23 @@ static int __pyx_f_7msgpack__packer_write(struct __pyx_obj_7msgpack_Packer *__p
__pyx_t_1 = (__pyx_v_packer->length > 0);
if (__pyx_t_1) {
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":146
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":153
* if packer.length + l > packer.allocated:
* if packer.length > 0:
* packer.strm.write(PyString_FromStringAndSize(packer.buff, packer.length)) # <<<<<<<<<<<<<<
* if l > 64:
* packer.strm.write(PyString_FromStringAndSize(b, l))
*/
- __pyx_t_2 = PyObject_GetAttr(__pyx_v_packer->strm, __pyx_kp_write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_GetAttr(__pyx_v_packer->strm, __pyx_kp_write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
- __pyx_t_3 = PyString_FromStringAndSize(__pyx_v_packer->buff, __pyx_v_packer->length); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyString_FromStringAndSize(__pyx_v_packer->buff, __pyx_v_packer->length); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_4));
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
__pyx_t_3 = 0;
- __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
@@ -1343,7 +1504,7 @@ static int __pyx_f_7msgpack__packer_write(struct __pyx_obj_7msgpack_Packer *__p
}
__pyx_L4:;
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":147
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":154
* if packer.length > 0:
* packer.strm.write(PyString_FromStringAndSize(packer.buff, packer.length))
* if l > 64: # <<<<<<<<<<<<<<
@@ -1353,29 +1514,29 @@ static int __pyx_f_7msgpack__packer_write(struct __pyx_obj_7msgpack_Packer *__p
__pyx_t_1 = (__pyx_v_l > 64);
if (__pyx_t_1) {
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":148
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":155
* packer.strm.write(PyString_FromStringAndSize(packer.buff, packer.length))
* if l > 64:
* packer.strm.write(PyString_FromStringAndSize(b, l)) # <<<<<<<<<<<<<<
* packer.length = 0
* else:
*/
- __pyx_t_3 = PyObject_GetAttr(__pyx_v_packer->strm, __pyx_kp_write); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetAttr(__pyx_v_packer->strm, __pyx_kp_write); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyString_FromStringAndSize(__pyx_v_b, __pyx_v_l); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyString_FromStringAndSize(__pyx_v_b, __pyx_v_l); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
__pyx_t_4 = 0;
- __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":149
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":156
* if l > 64:
* packer.strm.write(PyString_FromStringAndSize(b, l))
* packer.length = 0 # <<<<<<<<<<<<<<
@@ -1387,7 +1548,7 @@ static int __pyx_f_7msgpack__packer_write(struct __pyx_obj_7msgpack_Packer *__p
}
/*else*/ {
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":151
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":158
* packer.length = 0
* else:
* memcpy(packer.buff, b, l) # <<<<<<<<<<<<<<
@@ -1396,7 +1557,7 @@ static int __pyx_f_7msgpack__packer_write(struct __pyx_obj_7msgpack_Packer *__p
*/
memcpy(__pyx_v_packer->buff, __pyx_v_b, __pyx_v_l);
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":152
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":159
* else:
* memcpy(packer.buff, b, l)
* packer.length = l # <<<<<<<<<<<<<<
@@ -1410,7 +1571,7 @@ static int __pyx_f_7msgpack__packer_write(struct __pyx_obj_7msgpack_Packer *__p
}
/*else*/ {
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":154
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":161
* packer.length = l
* else:
* memcpy(packer.buff + packer.length, b, l) # <<<<<<<<<<<<<<
@@ -1419,7 +1580,7 @@ static int __pyx_f_7msgpack__packer_write(struct __pyx_obj_7msgpack_Packer *__p
*/
memcpy((__pyx_v_packer->buff + __pyx_v_packer->length), __pyx_v_b, __pyx_v_l);
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":155
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":162
* else:
* memcpy(packer.buff + packer.length, b, l)
* packer.length += l # <<<<<<<<<<<<<<
@@ -1430,7 +1591,7 @@ static int __pyx_f_7msgpack__packer_write(struct __pyx_obj_7msgpack_Packer *__p
}
__pyx_L3:;
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":156
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":163
* memcpy(packer.buff + packer.length, b, l)
* packer.length += l
* return 0 # <<<<<<<<<<<<<<
@@ -1453,7 +1614,7 @@ static int __pyx_f_7msgpack__packer_write(struct __pyx_obj_7msgpack_Packer *__p
return __pyx_r;
}
-/* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":158
+/* "/home/inada-n/work/msgpack/python/msgpack.pyx":165
* return 0
*
* def pack(object o, object stream): # <<<<<<<<<<<<<<
@@ -1491,11 +1652,11 @@ static PyObject *__pyx_pf_7msgpack_pack(PyObject *__pyx_self, PyObject *__pyx_ar
values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_stream);
if (likely(values[1])) kw_args--;
else {
- __Pyx_RaiseArgtupleInvalid("pack", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("pack", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "pack") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "pack") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
__pyx_v_o = values[0];
__pyx_v_stream = values[1];
@@ -1507,62 +1668,62 @@ static PyObject *__pyx_pf_7msgpack_pack(PyObject *__pyx_self, PyObject *__pyx_ar
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
- __Pyx_RaiseArgtupleInvalid("pack", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+ __Pyx_RaiseArgtupleInvalid("pack", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("msgpack.pack");
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_v_packer = Py_None; __Pyx_INCREF(Py_None);
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":159
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":166
*
* def pack(object o, object stream):
* packer = Packer(stream) # <<<<<<<<<<<<<<
* packer.pack(o)
* packer.flush()
*/
- __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
__Pyx_INCREF(__pyx_v_stream);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_stream);
__Pyx_GIVEREF(__pyx_v_stream);
- __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7msgpack_Packer)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7msgpack_Packer)), ((PyObject *)__pyx_t_1), NULL); 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_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_v_packer);
__pyx_v_packer = __pyx_t_2;
__pyx_t_2 = 0;
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":160
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":167
* def pack(object o, object stream):
* packer = Packer(stream)
* packer.pack(o) # <<<<<<<<<<<<<<
* packer.flush()
*
*/
- __pyx_t_2 = PyObject_GetAttr(__pyx_v_packer, __pyx_kp_pack); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_GetAttr(__pyx_v_packer, __pyx_kp_pack); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __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 = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __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 = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __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 = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":161
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":168
* packer = Packer(stream)
* packer.pack(o)
* packer.flush() # <<<<<<<<<<<<<<
*
* def packs(object o):
*/
- __pyx_t_3 = PyObject_GetAttr(__pyx_v_packer, __pyx_kp_flush); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetAttr(__pyx_v_packer, __pyx_kp_flush); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); 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);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
@@ -1582,7 +1743,7 @@ static PyObject *__pyx_pf_7msgpack_pack(PyObject *__pyx_self, PyObject *__pyx_ar
return __pyx_r;
}
-/* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":163
+/* "/home/inada-n/work/msgpack/python/msgpack.pyx":170
* packer.flush()
*
* def packs(object o): # <<<<<<<<<<<<<<
@@ -1604,76 +1765,76 @@ static PyObject *__pyx_pf_7msgpack_packs(PyObject *__pyx_self, PyObject *__pyx_v
__pyx_v_buf = Py_None; __Pyx_INCREF(Py_None);
__pyx_v_packer = Py_None; __Pyx_INCREF(Py_None);
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":164
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":171
*
* def packs(object o):
* buf = StringIO() # <<<<<<<<<<<<<<
* packer = Packer(buf)
* packer.pack(o)
*/
- __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_StringIO); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_StringIO); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_1);
- __pyx_t_1 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_1); __pyx_1 = 0;
__Pyx_DECREF(__pyx_v_buf);
__pyx_v_buf = __pyx_t_1;
__pyx_t_1 = 0;
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":165
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":172
* def packs(object o):
* buf = StringIO()
* packer = Packer(buf) # <<<<<<<<<<<<<<
* packer.pack(o)
* packer.flush()
*/
- __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __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_buf);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_buf);
__Pyx_GIVEREF(__pyx_v_buf);
- __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7msgpack_Packer)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7msgpack_Packer)), ((PyObject *)__pyx_t_1), NULL); 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_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_v_packer);
__pyx_v_packer = __pyx_t_2;
__pyx_t_2 = 0;
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":166
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":173
* buf = StringIO()
* packer = Packer(buf)
* packer.pack(o) # <<<<<<<<<<<<<<
* packer.flush()
* return buf.getvalue()
*/
- __pyx_t_2 = PyObject_GetAttr(__pyx_v_packer, __pyx_kp_pack); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_GetAttr(__pyx_v_packer, __pyx_kp_pack); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __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 = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __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 = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __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 = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":167
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":174
* packer = Packer(buf)
* packer.pack(o)
* packer.flush() # <<<<<<<<<<<<<<
* return buf.getvalue()
*
*/
- __pyx_t_3 = PyObject_GetAttr(__pyx_v_packer, __pyx_kp_flush); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_GetAttr(__pyx_v_packer, __pyx_kp_flush); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":168
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":175
* packer.pack(o)
* packer.flush()
* return buf.getvalue() # <<<<<<<<<<<<<<
@@ -1681,9 +1842,9 @@ static PyObject *__pyx_pf_7msgpack_packs(PyObject *__pyx_self, PyObject *__pyx_v
* cdef extern from "unpack.h":
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyObject_GetAttr(__pyx_v_buf, __pyx_kp_getvalue); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_GetAttr(__pyx_v_buf, __pyx_kp_getvalue); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
- __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_r = __pyx_t_3;
@@ -1707,7 +1868,7 @@ static PyObject *__pyx_pf_7msgpack_packs(PyObject *__pyx_self, PyObject *__pyx_v
return __pyx_r;
}
-/* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":179
+/* "/home/inada-n/work/msgpack/python/msgpack.pyx":186
*
*
* def unpacks(object packed_bytes): # <<<<<<<<<<<<<<
@@ -1728,17 +1889,17 @@ static PyObject *__pyx_pf_7msgpack_unpacks(PyObject *__pyx_self, PyObject *__pyx
__Pyx_SetupRefcountContext("unpacks");
__pyx_self = __pyx_self;
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":181
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":188
* def unpacks(object packed_bytes):
* """Unpack packed_bytes to object. Returns unpacked object."""
* cdef const_char_ptr p = packed_bytes # <<<<<<<<<<<<<<
* cdef template_context ctx
* cdef size_t off = 0
*/
- __pyx_t_1 = __Pyx_PyBytes_AsString(__pyx_v_packed_bytes); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = __Pyx_PyBytes_AsString(__pyx_v_packed_bytes); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_p = __pyx_t_1;
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":183
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":190
* cdef const_char_ptr p = packed_bytes
* cdef template_context ctx
* cdef size_t off = 0 # <<<<<<<<<<<<<<
@@ -1747,7 +1908,7 @@ static PyObject *__pyx_pf_7msgpack_unpacks(PyObject *__pyx_self, PyObject *__pyx
*/
__pyx_v_off = 0;
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":184
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":191
* cdef template_context ctx
* cdef size_t off = 0
* template_init(&ctx) # <<<<<<<<<<<<<<
@@ -1756,17 +1917,17 @@ static PyObject *__pyx_pf_7msgpack_unpacks(PyObject *__pyx_self, PyObject *__pyx
*/
template_init((&__pyx_v_ctx));
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":185
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":192
* cdef size_t off = 0
* template_init(&ctx)
* template_execute(&ctx, p, len(packed_bytes), &off) # <<<<<<<<<<<<<<
* return template_data(&ctx)
*
*/
- __pyx_t_2 = PyObject_Length(__pyx_v_packed_bytes); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Length(__pyx_v_packed_bytes); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
template_execute((&__pyx_v_ctx), __pyx_v_p, __pyx_t_2, (&__pyx_v_off));
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":186
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":193
* template_init(&ctx)
* template_execute(&ctx, p, len(packed_bytes), &off)
* return template_data(&ctx) # <<<<<<<<<<<<<<
@@ -1774,7 +1935,7 @@ static PyObject *__pyx_pf_7msgpack_unpacks(PyObject *__pyx_self, PyObject *__pyx
* def unpack(object stream):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_3 = template_data((&__pyx_v_ctx)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = template_data((&__pyx_v_ctx)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
@@ -1792,7 +1953,7 @@ static PyObject *__pyx_pf_7msgpack_unpacks(PyObject *__pyx_self, PyObject *__pyx
return __pyx_r;
}
-/* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":188
+/* "/home/inada-n/work/msgpack/python/msgpack.pyx":195
* return template_data(&ctx)
*
* def unpack(object stream): # <<<<<<<<<<<<<<
@@ -1812,23 +1973,23 @@ static PyObject *__pyx_pf_7msgpack_unpack(PyObject *__pyx_self, PyObject *__pyx_
__pyx_self = __pyx_self;
__pyx_v_packed = Py_None; __Pyx_INCREF(Py_None);
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":190
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":197
* def unpack(object stream):
* """unpack from stream."""
* packed = stream.read() # <<<<<<<<<<<<<<
* return unpacks(packed)
*
*/
- __pyx_t_1 = PyObject_GetAttr(__pyx_v_stream, __pyx_kp_read); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_GetAttr(__pyx_v_stream, __pyx_kp_read); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __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 = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __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 = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_v_packed);
__pyx_v_packed = __pyx_t_2;
__pyx_t_2 = 0;
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":191
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":198
* """unpack from stream."""
* packed = stream.read()
* return unpacks(packed) # <<<<<<<<<<<<<<
@@ -1836,14 +1997,14 @@ static PyObject *__pyx_pf_7msgpack_unpack(PyObject *__pyx_self, PyObject *__pyx_
* cdef class Unpacker:
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_unpacks); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_unpacks); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_1);
- __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
__Pyx_INCREF(__pyx_v_packed);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_packed);
__Pyx_GIVEREF(__pyx_v_packed);
- __pyx_t_1 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_1); __pyx_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
@@ -1865,12 +2026,14 @@ static PyObject *__pyx_pf_7msgpack_unpack(PyObject *__pyx_self, PyObject *__pyx_
__Pyx_FinishRefcountContext();
return __pyx_r;
}
+static struct __pyx_vtabstruct_7msgpack_Packer __pyx_vtable_7msgpack_Packer;
static PyObject *__pyx_tp_new_7msgpack_Packer(PyTypeObject *t, PyObject *a, PyObject *k) {
struct __pyx_obj_7msgpack_Packer *p;
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
p = ((struct __pyx_obj_7msgpack_Packer *)o);
+ p->__pyx_vtab = __pyx_vtabptr_7msgpack_Packer;
p->strm = Py_None; Py_INCREF(Py_None);
return o;
}
@@ -1900,10 +2063,11 @@ static int __pyx_tp_clear_7msgpack_Packer(PyObject *o) {
}
static struct PyMethodDef __pyx_methods_7msgpack_Packer[] = {
+ {__Pyx_NAMESTR("__del__"), (PyCFunction)__pyx_pf_7msgpack_6Packer___del__, METH_NOARGS, __Pyx_DOCSTR(0)},
{__Pyx_NAMESTR("flush"), (PyCFunction)__pyx_pf_7msgpack_6Packer_flush, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_7msgpack_6Packer_flush)},
{__Pyx_NAMESTR("pack_list"), (PyCFunction)__pyx_pf_7msgpack_6Packer_pack_list, METH_O, __Pyx_DOCSTR(__pyx_doc_7msgpack_6Packer_pack_list)},
{__Pyx_NAMESTR("pack_dict"), (PyCFunction)__pyx_pf_7msgpack_6Packer_pack_dict, METH_O, __Pyx_DOCSTR(__pyx_doc_7msgpack_6Packer_pack_dict)},
- {__Pyx_NAMESTR("pack"), (PyCFunction)__pyx_pf_7msgpack_6Packer_pack, METH_O, __Pyx_DOCSTR(0)},
+ {__Pyx_NAMESTR("pack"), (PyCFunction)__pyx_pf_7msgpack_6Packer_pack, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
{0, 0, 0, 0}
};
@@ -2240,6 +2404,7 @@ static struct PyModuleDef __pyx_moduledef = {
static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_kp___main__, __pyx_k___main__, sizeof(__pyx_k___main__), 1, 1, 1},
{&__pyx_kp___init__, __pyx_k___init__, sizeof(__pyx_k___init__), 1, 1, 1},
+ {&__pyx_kp___del__, __pyx_k___del__, sizeof(__pyx_k___del__), 1, 1, 1},
{&__pyx_kp_flush, __pyx_k_flush, sizeof(__pyx_k_flush), 1, 1, 1},
{&__pyx_kp_pack_list, __pyx_k_pack_list, sizeof(__pyx_k_pack_list), 1, 1, 1},
{&__pyx_kp_pack_dict, __pyx_k_pack_dict, sizeof(__pyx_k_pack_dict), 1, 1, 1},
@@ -2248,6 +2413,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_kp_strm, __pyx_k_strm, sizeof(__pyx_k_strm), 1, 1, 1},
{&__pyx_kp_size, __pyx_k_size, sizeof(__pyx_k_size), 1, 1, 1},
{&__pyx_kp_len, __pyx_k_len, sizeof(__pyx_k_len), 1, 1, 1},
+ {&__pyx_kp_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 1, 1, 1},
{&__pyx_kp_o, __pyx_k_o, sizeof(__pyx_k_o), 1, 1, 1},
{&__pyx_kp_stream, __pyx_k_stream, sizeof(__pyx_k_stream), 1, 1, 1},
{&__pyx_kp_packed_bytes, __pyx_k_packed_bytes, sizeof(__pyx_k_packed_bytes), 1, 1, 1},
@@ -2256,19 +2422,19 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_kp_staticmethod, __pyx_k_staticmethod, sizeof(__pyx_k_staticmethod), 1, 1, 1},
{&__pyx_kp_unpacks, __pyx_k_unpacks, sizeof(__pyx_k_unpacks), 1, 1, 1},
{&__pyx_kp_write, __pyx_k_write, sizeof(__pyx_k_write), 1, 1, 1},
- {&__pyx_kp_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 1, 0},
+ {&__pyx_kp_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 1, 0},
{&__pyx_kp_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 1, 1, 1},
{&__pyx_kp_iteritems, __pyx_k_iteritems, sizeof(__pyx_k_iteritems), 1, 1, 1},
{&__pyx_kp_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 1, 1, 1},
{&__pyx_kp_getvalue, __pyx_k_getvalue, sizeof(__pyx_k_getvalue), 1, 1, 1},
{&__pyx_kp_read, __pyx_k_read, sizeof(__pyx_k_read), 1, 1, 1},
- {&__pyx_kp_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 0},
{&__pyx_kp_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 0},
+ {&__pyx_kp_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 0},
{0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
- __pyx_builtin_staticmethod = __Pyx_GetName(__pyx_b, __pyx_kp_staticmethod); if (!__pyx_builtin_staticmethod) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_kp_TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_staticmethod = __Pyx_GetName(__pyx_b, __pyx_kp_staticmethod); if (!__pyx_builtin_staticmethod) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_kp_TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
return 0;
__pyx_L1_error:;
return -1;
@@ -2337,17 +2503,24 @@ PyMODINIT_FUNC PyInit_msgpack(void)
/*--- Global init code ---*/
/*--- Function export code ---*/
/*--- Type init code ---*/
+ __pyx_vtabptr_7msgpack_Packer = &__pyx_vtable_7msgpack_Packer;
+ #if PY_MAJOR_VERSION >= 3
+ __pyx_vtable_7msgpack_Packer.__pack = (PyObject *(*)(struct __pyx_obj_7msgpack_Packer *, PyObject *))__pyx_f_7msgpack_6Packer___pack;
+ #else
+ *(void(**)(void))&__pyx_vtable_7msgpack_Packer.__pack = (void(*)(void))__pyx_f_7msgpack_6Packer___pack;
+ #endif
if (PyType_Ready(&__pyx_type_7msgpack_Packer) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_SetVtable(__pyx_type_7msgpack_Packer.tp_dict, __pyx_vtabptr_7msgpack_Packer) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__Pyx_SetAttrString(__pyx_m, "Packer", (PyObject *)&__pyx_type_7msgpack_Packer) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_7msgpack_Packer = &__pyx_type_7msgpack_Packer;
- if (PyType_Ready(&__pyx_type_7msgpack_Unpacker) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- if (__Pyx_SetAttrString(__pyx_m, "Unpacker", (PyObject *)&__pyx_type_7msgpack_Unpacker) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyType_Ready(&__pyx_type_7msgpack_Unpacker) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (__Pyx_SetAttrString(__pyx_m, "Unpacker", (PyObject *)&__pyx_type_7msgpack_Unpacker) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_ptype_7msgpack_Unpacker = &__pyx_type_7msgpack_Unpacker;
/*--- Type import code ---*/
/*--- Function import code ---*/
/*--- Execution code ---*/
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":3
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":3
* # coding: utf-8
*
* from cStringIO import StringIO # <<<<<<<<<<<<<<
@@ -2368,7 +2541,7 @@ PyMODINIT_FUNC PyInit_msgpack(void)
__Pyx_DECREF(__pyx_2); __pyx_2 = 0;
__Pyx_DECREF(__pyx_1); __pyx_1 = 0;
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":37
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":37
*
*
* cdef int BUFF_SIZE=2*1024 # <<<<<<<<<<<<<<
@@ -2377,22 +2550,35 @@ PyMODINIT_FUNC PyInit_msgpack(void)
*/
__pyx_v_7msgpack_BUFF_SIZE = 2048;
- /* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":195
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":145
+ * raise TypeError, "can't serialize %r" % (o,)
+ *
+ * def pack(self, obj, flush=True): # <<<<<<<<<<<<<<
+ * self.__pack(obj)
+ * if flush:
+ */
+ __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_k_1 = __pyx_t_1;
+ __pyx_t_1 = 0;
+ __Pyx_GIVEREF(__pyx_k_1);
+
+ /* "/home/inada-n/work/msgpack/python/msgpack.pyx":202
* cdef class Unpacker:
* """Do nothing. This function is for symmetric to Packer"""
* unpack = staticmethod(unpacks) # <<<<<<<<<<<<<<
*/
- __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_unpacks); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_unpacks); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_1);
- __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_1);
__Pyx_GIVEREF(__pyx_1);
__pyx_1 = 0;
- __pyx_t_2 = PyObject_Call(__pyx_builtin_staticmethod, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_2 = PyObject_Call(__pyx_builtin_staticmethod, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
- if (PyDict_SetItem((PyObject *)__pyx_ptype_7msgpack_Unpacker->tp_dict, __pyx_kp_unpack, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ if (PyDict_SetItem((PyObject *)__pyx_ptype_7msgpack_Unpacker->tp_dict, __pyx_kp_unpack, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
PyType_Modified(__pyx_ptype_7msgpack_Unpacker);
goto __pyx_L0;
@@ -3037,6 +3223,25 @@ static void __Pyx_WriteUnraisable(const char *name) {
}
}
+static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
+ PyObject *pycobj = 0;
+ int result;
+
+ pycobj = PyCObject_FromVoidPtr(vtable, 0);
+ if (!pycobj)
+ goto bad;
+ if (PyDict_SetItemString(dict, "__pyx_vtable__", pycobj) < 0)
+ goto bad;
+ result = 0;
+ goto done;
+
+bad:
+ result = -1;
+done:
+ Py_XDECREF(pycobj);
+ return result;
+}
+
#include "compile.h"
#include "frameobject.h"
#include "traceback.h"
diff --git a/msgpack.pyx b/msgpack.pyx
index 8b2006a..f24f403 100644
--- a/msgpack.pyx
+++ b/msgpack.pyx
@@ -59,6 +59,8 @@ cdef class Packer:
msgpack_packer_init(&self.pk, <void*>self, <msgpack_packer_write>_packer_write)
+ def __del__(self):
+ free(self.buff);
def flush(self):
"""Flash local buffer and output stream if it has 'flush()' method."""
@@ -98,7 +100,7 @@ cdef class Packer:
"""
msgpack_pack_map(&self.pk, len)
- def pack(self, object o):
+ cdef __pack(self, object o):
cdef long long intval
cdef double fval
cdef char* rawval
@@ -140,6 +142,11 @@ cdef class Packer:
# TODO: Serialize with defalt() like simplejson.
raise TypeError, "can't serialize %r" % (o,)
+ def pack(self, obj, flush=True):
+ self.__pack(obj)
+ if flush:
+ self.flush()
+
cdef int _packer_write(Packer packer, const_char_ptr b, unsigned int l):
if packer.length + l > packer.allocated:
if packer.length > 0: