mirror of
				https://github.com/msgpack/msgpack-python.git
				synced 2025-10-31 01:20:53 +00:00 
			
		
		
		
	Optimize to parsing data that has a number of same short raw field.
This commit is contained in:
		
							parent
							
								
									8ca2c441c9
								
							
						
					
					
						commit
						dee7b20924
					
				
					 3 changed files with 158 additions and 111 deletions
				
			
		|  | @ -1,4 +1,4 @@ | |||
| /* Generated by Cython 0.11.1 on Wed Jun 17 13:44:30 2009 */ | ||||
| /* Generated by Cython 0.11.2 on Mon Jun 22 02:56:08 2009 */ | ||||
| 
 | ||||
| #define PY_SSIZE_T_CLEAN | ||||
| #include "Python.h" | ||||
|  | @ -103,6 +103,9 @@ | |||
|   #ifndef __cdecl | ||||
|     #define __cdecl | ||||
|   #endif | ||||
|   #ifndef __fastcall | ||||
|     #define __fastcall | ||||
|   #endif | ||||
| #else | ||||
|   #define _USE_MATH_DEFINES | ||||
| #endif | ||||
|  | @ -133,6 +136,7 @@ | |||
| #include "string.h" | ||||
| #include "pack.h" | ||||
| #include "unpack.h" | ||||
| #define __PYX_USE_C99_COMPLEX defined(_Complex_I) | ||||
| 
 | ||||
| 
 | ||||
| #ifdef __GNUC__ | ||||
|  | @ -224,6 +228,7 @@ static const char * __pyx_cfilenm= __FILE__; | |||
| static const char *__pyx_filename; | ||||
| static const char **__pyx_f; | ||||
| 
 | ||||
| 
 | ||||
| #ifdef CYTHON_REFNANNY | ||||
| typedef struct { | ||||
|   void (*INCREF)(void*, PyObject*, int); | ||||
|  | @ -320,7 +325,7 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ | |||
| 
 | ||||
| /* Type declarations */ | ||||
| 
 | ||||
| /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":39
 | ||||
| /* "/home/inada-n/work/msgpack/python/msgpack.pyx":39
 | ||||
|  * cdef int BUFF_SIZE=2*1024 | ||||
|  *  | ||||
|  * cdef class Packer:             # <<<<<<<<<<<<<< | ||||
|  | @ -338,7 +343,7 @@ struct __pyx_obj_7msgpack_Packer { | |||
|   PyObject *strm; | ||||
| }; | ||||
| 
 | ||||
| /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":200
 | ||||
| /* "/home/inada-n/work/msgpack/python/msgpack.pyx":200
 | ||||
|  *     return unpacks(packed) | ||||
|  *  | ||||
|  * cdef class Unpacker:             # <<<<<<<<<<<<<< | ||||
|  | @ -351,7 +356,7 @@ struct __pyx_obj_7msgpack_Unpacker { | |||
| }; | ||||
| 
 | ||||
| 
 | ||||
| /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":39
 | ||||
| /* "/home/inada-n/work/msgpack/python/msgpack.pyx":39
 | ||||
|  * cdef int BUFF_SIZE=2*1024 | ||||
|  *  | ||||
|  * cdef class Packer:             # <<<<<<<<<<<<<< | ||||
|  | @ -370,10 +375,12 @@ 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*/ | ||||
| 
 | ||||
| const char *__pyx_modulename = "msgpack"; | ||||
| #define __Pyx_MODULE_NAME "msgpack" | ||||
| int __pyx_module_is_main_msgpack = 0; | ||||
| 
 | ||||
| /* Implementation of msgpack */ | ||||
| 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__"; | ||||
|  | @ -431,7 +438,7 @@ 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/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):             # <<<<<<<<<<<<<< | ||||
|  | @ -493,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/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:             # <<<<<<<<<<<<<< | ||||
|  | @ -503,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/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             # <<<<<<<<<<<<<< | ||||
|  | @ -515,7 +522,7 @@ static int __pyx_pf_7msgpack_6Packer___init__(PyObject *__pyx_v_self, PyObject * | |||
|   } | ||||
|   __pyx_L6:; | ||||
| 
 | ||||
|   /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":55
 | ||||
|   /* "/home/inada-n/work/msgpack/python/msgpack.pyx":55
 | ||||
|  *             size = BUFF_SIZE | ||||
|  *  | ||||
|  *         self.strm = strm             # <<<<<<<<<<<<<< | ||||
|  | @ -528,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/msgpack-py/python/msgpack.pyx":56
 | ||||
|   /* "/home/inada-n/work/msgpack/python/msgpack.pyx":56
 | ||||
|  *  | ||||
|  *         self.strm = strm | ||||
|  *         self.buff = <char*> malloc(size)             # <<<<<<<<<<<<<< | ||||
|  | @ -537,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/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             # <<<<<<<<<<<<<< | ||||
|  | @ -546,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/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             # <<<<<<<<<<<<<< | ||||
|  | @ -555,7 +562,7 @@ 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/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)             # <<<<<<<<<<<<<< | ||||
|  | @ -569,7 +576,7 @@ static int __pyx_pf_7msgpack_6Packer___init__(PyObject *__pyx_v_self, PyObject * | |||
|   return __pyx_r; | ||||
| } | ||||
| 
 | ||||
| /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":62
 | ||||
| /* "/home/inada-n/work/msgpack/python/msgpack.pyx":62
 | ||||
|  *         msgpack_packer_init(&self.pk, <void*>self, <msgpack_packer_write>_packer_write) | ||||
|  *  | ||||
|  *     def __del__(self):             # <<<<<<<<<<<<<< | ||||
|  | @ -582,7 +589,7 @@ static PyObject *__pyx_pf_7msgpack_6Packer___del__(PyObject *__pyx_v_self, PyObj | |||
|   PyObject *__pyx_r = NULL; | ||||
|   __Pyx_SetupRefcountContext("__del__"); | ||||
| 
 | ||||
|   /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":63
 | ||||
|   /* "/home/inada-n/work/msgpack/python/msgpack.pyx":63
 | ||||
|  *  | ||||
|  *     def __del__(self): | ||||
|  *         free(self.buff);             # <<<<<<<<<<<<<< | ||||
|  | @ -597,7 +604,7 @@ static PyObject *__pyx_pf_7msgpack_6Packer___del__(PyObject *__pyx_v_self, PyObj | |||
|   return __pyx_r; | ||||
| } | ||||
| 
 | ||||
| /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":65
 | ||||
| /* "/home/inada-n/work/msgpack/python/msgpack.pyx":65
 | ||||
|  *         free(self.buff); | ||||
|  *  | ||||
|  *     def flush(self):             # <<<<<<<<<<<<<< | ||||
|  | @ -615,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/msgpack-py/python/msgpack.pyx":67
 | ||||
|   /* "/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:             # <<<<<<<<<<<<<< | ||||
|  | @ -625,7 +632,7 @@ 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/msgpack-py/python/msgpack.pyx":68
 | ||||
|     /* "/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))             # <<<<<<<<<<<<<< | ||||
|  | @ -647,7 +654,7 @@ static PyObject *__pyx_pf_7msgpack_6Packer_flush(PyObject *__pyx_v_self, PyObjec | |||
|     __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; | ||||
|     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; | ||||
| 
 | ||||
|     /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":69
 | ||||
|     /* "/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             # <<<<<<<<<<<<<< | ||||
|  | @ -659,7 +666,7 @@ static PyObject *__pyx_pf_7msgpack_6Packer_flush(PyObject *__pyx_v_self, PyObjec | |||
|   } | ||||
|   __pyx_L5:; | ||||
| 
 | ||||
|   /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":70
 | ||||
|   /* "/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'):             # <<<<<<<<<<<<<< | ||||
|  | @ -669,7 +676,7 @@ static PyObject *__pyx_pf_7msgpack_6Packer_flush(PyObject *__pyx_v_self, PyObjec | |||
|   __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/msgpack-py/python/msgpack.pyx":71
 | ||||
|     /* "/home/inada-n/work/msgpack/python/msgpack.pyx":71
 | ||||
|  *             self.length = 0 | ||||
|  *         if hasattr(self.strm, 'flush'): | ||||
|  *             self.strm.flush()             # <<<<<<<<<<<<<< | ||||
|  | @ -700,7 +707,7 @@ static PyObject *__pyx_pf_7msgpack_6Packer_flush(PyObject *__pyx_v_self, PyObjec | |||
|   return __pyx_r; | ||||
| } | ||||
| 
 | ||||
| /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":73
 | ||||
| /* "/home/inada-n/work/msgpack/python/msgpack.pyx":73
 | ||||
|  *             self.strm.flush() | ||||
|  *  | ||||
|  *     def pack_list(self, len):             # <<<<<<<<<<<<<< | ||||
|  | @ -715,7 +722,7 @@ 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/msgpack-py/python/msgpack.pyx":86
 | ||||
|   /* "/home/inada-n/work/msgpack/python/msgpack.pyx":86
 | ||||
|  *             packer.pack(['foo', 'bar']) | ||||
|  *         """ | ||||
|  *         msgpack_pack_array(&self.pk, len)             # <<<<<<<<<<<<<< | ||||
|  | @ -736,7 +743,7 @@ static PyObject *__pyx_pf_7msgpack_6Packer_pack_list(PyObject *__pyx_v_self, PyO | |||
|   return __pyx_r; | ||||
| } | ||||
| 
 | ||||
| /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":88
 | ||||
| /* "/home/inada-n/work/msgpack/python/msgpack.pyx":88
 | ||||
|  *         msgpack_pack_array(&self.pk, len) | ||||
|  *  | ||||
|  *     def pack_dict(self, len):             # <<<<<<<<<<<<<< | ||||
|  | @ -751,7 +758,7 @@ 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/msgpack-py/python/msgpack.pyx":101
 | ||||
|   /* "/home/inada-n/work/msgpack/python/msgpack.pyx":101
 | ||||
|  *             packer.pack({'foo', 'bar'}) | ||||
|  *         """ | ||||
|  *         msgpack_pack_map(&self.pk, len)             # <<<<<<<<<<<<<< | ||||
|  | @ -772,7 +779,7 @@ static PyObject *__pyx_pf_7msgpack_6Packer_pack_dict(PyObject *__pyx_v_self, PyO | |||
|   return __pyx_r; | ||||
| } | ||||
| 
 | ||||
| /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":103
 | ||||
| /* "/home/inada-n/work/msgpack/python/msgpack.pyx":103
 | ||||
|  *         msgpack_pack_map(&self.pk, len) | ||||
|  *  | ||||
|  *     cdef __pack(self, object o):             # <<<<<<<<<<<<<< | ||||
|  | @ -806,7 +813,7 @@ static  PyObject *__pyx_f_7msgpack_6Packer___pack(struct __pyx_obj_7msgpack_Pack | |||
|   __pyx_v_k = Py_None; __Pyx_INCREF(Py_None); | ||||
|   __pyx_v_v = Py_None; __Pyx_INCREF(Py_None); | ||||
| 
 | ||||
|   /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":108
 | ||||
|   /* "/home/inada-n/work/msgpack/python/msgpack.pyx":108
 | ||||
|  *         cdef char* rawval | ||||
|  *  | ||||
|  *         if o is None:             # <<<<<<<<<<<<<< | ||||
|  | @ -816,7 +823,7 @@ static  PyObject *__pyx_f_7msgpack_6Packer___pack(struct __pyx_obj_7msgpack_Pack | |||
|   __pyx_t_1 = (__pyx_v_o == Py_None); | ||||
|   if (__pyx_t_1) { | ||||
| 
 | ||||
|     /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":109
 | ||||
|     /* "/home/inada-n/work/msgpack/python/msgpack.pyx":109
 | ||||
|  *  | ||||
|  *         if o is None: | ||||
|  *             msgpack_pack_nil(&self.pk)             # <<<<<<<<<<<<<< | ||||
|  | @ -827,7 +834,7 @@ static  PyObject *__pyx_f_7msgpack_6Packer___pack(struct __pyx_obj_7msgpack_Pack | |||
|     goto __pyx_L3; | ||||
|   } | ||||
| 
 | ||||
|   /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":110
 | ||||
|   /* "/home/inada-n/work/msgpack/python/msgpack.pyx":110
 | ||||
|  *         if o is None: | ||||
|  *             msgpack_pack_nil(&self.pk) | ||||
|  *         elif o is True:             # <<<<<<<<<<<<<< | ||||
|  | @ -840,7 +847,7 @@ static  PyObject *__pyx_f_7msgpack_6Packer___pack(struct __pyx_obj_7msgpack_Pack | |||
|   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | ||||
|   if (__pyx_t_1) { | ||||
| 
 | ||||
|     /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":111
 | ||||
|     /* "/home/inada-n/work/msgpack/python/msgpack.pyx":111
 | ||||
|  *             msgpack_pack_nil(&self.pk) | ||||
|  *         elif o is True: | ||||
|  *             msgpack_pack_true(&self.pk)             # <<<<<<<<<<<<<< | ||||
|  | @ -851,7 +858,7 @@ static  PyObject *__pyx_f_7msgpack_6Packer___pack(struct __pyx_obj_7msgpack_Pack | |||
|     goto __pyx_L3; | ||||
|   } | ||||
| 
 | ||||
|   /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":112
 | ||||
|   /* "/home/inada-n/work/msgpack/python/msgpack.pyx":112
 | ||||
|  *         elif o is True: | ||||
|  *             msgpack_pack_true(&self.pk) | ||||
|  *         elif o is False:             # <<<<<<<<<<<<<< | ||||
|  | @ -864,7 +871,7 @@ static  PyObject *__pyx_f_7msgpack_6Packer___pack(struct __pyx_obj_7msgpack_Pack | |||
|   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; | ||||
|   if (__pyx_t_1) { | ||||
| 
 | ||||
|     /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":113
 | ||||
|     /* "/home/inada-n/work/msgpack/python/msgpack.pyx":113
 | ||||
|  *             msgpack_pack_true(&self.pk) | ||||
|  *         elif o is False: | ||||
|  *             msgpack_pack_false(&self.pk)             # <<<<<<<<<<<<<< | ||||
|  | @ -875,7 +882,7 @@ static  PyObject *__pyx_f_7msgpack_6Packer___pack(struct __pyx_obj_7msgpack_Pack | |||
|     goto __pyx_L3; | ||||
|   } | ||||
| 
 | ||||
|   /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":114
 | ||||
|   /* "/home/inada-n/work/msgpack/python/msgpack.pyx":114
 | ||||
|  *         elif o is False: | ||||
|  *             msgpack_pack_false(&self.pk) | ||||
|  *         elif isinstance(o, long):             # <<<<<<<<<<<<<< | ||||
|  | @ -885,7 +892,7 @@ static  PyObject *__pyx_f_7msgpack_6Packer___pack(struct __pyx_obj_7msgpack_Pack | |||
|   __pyx_t_1 = PyObject_TypeCheck(__pyx_v_o, ((PyTypeObject *)((PyObject*)&PyLong_Type)));  | ||||
|   if (__pyx_t_1) { | ||||
| 
 | ||||
|     /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":115
 | ||||
|     /* "/home/inada-n/work/msgpack/python/msgpack.pyx":115
 | ||||
|  *             msgpack_pack_false(&self.pk) | ||||
|  *         elif isinstance(o, long): | ||||
|  *             intval = o             # <<<<<<<<<<<<<< | ||||
|  | @ -895,7 +902,7 @@ static  PyObject *__pyx_f_7msgpack_6Packer___pack(struct __pyx_obj_7msgpack_Pack | |||
|     __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/msgpack-py/python/msgpack.pyx":116
 | ||||
|     /* "/home/inada-n/work/msgpack/python/msgpack.pyx":116
 | ||||
|  *         elif isinstance(o, long): | ||||
|  *             intval = o | ||||
|  *             msgpack_pack_long_long(&self.pk, intval)             # <<<<<<<<<<<<<< | ||||
|  | @ -906,7 +913,7 @@ static  PyObject *__pyx_f_7msgpack_6Packer___pack(struct __pyx_obj_7msgpack_Pack | |||
|     goto __pyx_L3; | ||||
|   } | ||||
| 
 | ||||
|   /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":117
 | ||||
|   /* "/home/inada-n/work/msgpack/python/msgpack.pyx":117
 | ||||
|  *             intval = o | ||||
|  *             msgpack_pack_long_long(&self.pk, intval) | ||||
|  *         elif isinstance(o, int):             # <<<<<<<<<<<<<< | ||||
|  | @ -916,7 +923,7 @@ static  PyObject *__pyx_f_7msgpack_6Packer___pack(struct __pyx_obj_7msgpack_Pack | |||
|   __pyx_t_1 = PyObject_TypeCheck(__pyx_v_o, ((PyTypeObject *)((PyObject*)&PyInt_Type)));  | ||||
|   if (__pyx_t_1) { | ||||
| 
 | ||||
|     /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":118
 | ||||
|     /* "/home/inada-n/work/msgpack/python/msgpack.pyx":118
 | ||||
|  *             msgpack_pack_long_long(&self.pk, intval) | ||||
|  *         elif isinstance(o, int): | ||||
|  *             intval = o             # <<<<<<<<<<<<<< | ||||
|  | @ -926,7 +933,7 @@ static  PyObject *__pyx_f_7msgpack_6Packer___pack(struct __pyx_obj_7msgpack_Pack | |||
|     __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/msgpack-py/python/msgpack.pyx":119
 | ||||
|     /* "/home/inada-n/work/msgpack/python/msgpack.pyx":119
 | ||||
|  *         elif isinstance(o, int): | ||||
|  *             intval = o | ||||
|  *             msgpack_pack_long_long(&self.pk, intval)             # <<<<<<<<<<<<<< | ||||
|  | @ -937,7 +944,7 @@ static  PyObject *__pyx_f_7msgpack_6Packer___pack(struct __pyx_obj_7msgpack_Pack | |||
|     goto __pyx_L3; | ||||
|   } | ||||
| 
 | ||||
|   /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":120
 | ||||
|   /* "/home/inada-n/work/msgpack/python/msgpack.pyx":120
 | ||||
|  *             intval = o | ||||
|  *             msgpack_pack_long_long(&self.pk, intval) | ||||
|  *         elif isinstance(o, float):             # <<<<<<<<<<<<<< | ||||
|  | @ -947,7 +954,7 @@ static  PyObject *__pyx_f_7msgpack_6Packer___pack(struct __pyx_obj_7msgpack_Pack | |||
|   __pyx_t_1 = PyObject_TypeCheck(__pyx_v_o, ((PyTypeObject *)((PyObject*)&PyFloat_Type)));  | ||||
|   if (__pyx_t_1) { | ||||
| 
 | ||||
|     /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":121
 | ||||
|     /* "/home/inada-n/work/msgpack/python/msgpack.pyx":121
 | ||||
|  *             msgpack_pack_long_long(&self.pk, intval) | ||||
|  *         elif isinstance(o, float): | ||||
|  *             fval = o             # <<<<<<<<<<<<<< | ||||
|  | @ -957,7 +964,7 @@ static  PyObject *__pyx_f_7msgpack_6Packer___pack(struct __pyx_obj_7msgpack_Pack | |||
|     __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_o); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} | ||||
|     __pyx_v_fval = __pyx_t_4; | ||||
| 
 | ||||
|     /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":122
 | ||||
|     /* "/home/inada-n/work/msgpack/python/msgpack.pyx":122
 | ||||
|  *         elif isinstance(o, float): | ||||
|  *             fval = o | ||||
|  *             msgpack_pack_double(&self.pk, fval)             # <<<<<<<<<<<<<< | ||||
|  | @ -968,7 +975,7 @@ static  PyObject *__pyx_f_7msgpack_6Packer___pack(struct __pyx_obj_7msgpack_Pack | |||
|     goto __pyx_L3; | ||||
|   } | ||||
| 
 | ||||
|   /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":123
 | ||||
|   /* "/home/inada-n/work/msgpack/python/msgpack.pyx":123
 | ||||
|  *             fval = o | ||||
|  *             msgpack_pack_double(&self.pk, fval) | ||||
|  *         elif isinstance(o, str):             # <<<<<<<<<<<<<< | ||||
|  | @ -978,7 +985,7 @@ static  PyObject *__pyx_f_7msgpack_6Packer___pack(struct __pyx_obj_7msgpack_Pack | |||
|   __pyx_t_1 = PyObject_TypeCheck(__pyx_v_o, ((PyTypeObject *)((PyObject*)&PyString_Type)));  | ||||
|   if (__pyx_t_1) { | ||||
| 
 | ||||
|     /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":124
 | ||||
|     /* "/home/inada-n/work/msgpack/python/msgpack.pyx":124
 | ||||
|  *             msgpack_pack_double(&self.pk, fval) | ||||
|  *         elif isinstance(o, str): | ||||
|  *             rawval = o             # <<<<<<<<<<<<<< | ||||
|  | @ -988,7 +995,7 @@ static  PyObject *__pyx_f_7msgpack_6Packer___pack(struct __pyx_obj_7msgpack_Pack | |||
|     __pyx_t_5 = __Pyx_PyBytes_AsString(__pyx_v_o); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} | ||||
|     __pyx_v_rawval = __pyx_t_5; | ||||
| 
 | ||||
|     /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":125
 | ||||
|     /* "/home/inada-n/work/msgpack/python/msgpack.pyx":125
 | ||||
|  *         elif isinstance(o, str): | ||||
|  *             rawval = o | ||||
|  *             msgpack_pack_raw(&self.pk, len(o))             # <<<<<<<<<<<<<< | ||||
|  | @ -998,7 +1005,7 @@ static  PyObject *__pyx_f_7msgpack_6Packer___pack(struct __pyx_obj_7msgpack_Pack | |||
|     __pyx_t_6 = PyObject_Length(__pyx_v_o); if (unlikely(__pyx_t_6 == -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_6); | ||||
| 
 | ||||
|     /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":126
 | ||||
|     /* "/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))             # <<<<<<<<<<<<<< | ||||
|  | @ -1010,7 +1017,7 @@ static  PyObject *__pyx_f_7msgpack_6Packer___pack(struct __pyx_obj_7msgpack_Pack | |||
|     goto __pyx_L3; | ||||
|   } | ||||
| 
 | ||||
|   /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":127
 | ||||
|   /* "/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):             # <<<<<<<<<<<<<< | ||||
|  | @ -1020,7 +1027,7 @@ static  PyObject *__pyx_f_7msgpack_6Packer___pack(struct __pyx_obj_7msgpack_Pack | |||
|   __pyx_t_1 = PyObject_TypeCheck(__pyx_v_o, ((PyTypeObject *)((PyObject*)&PyUnicode_Type)));  | ||||
|   if (__pyx_t_1) { | ||||
| 
 | ||||
|     /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":128
 | ||||
|     /* "/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')             # <<<<<<<<<<<<<< | ||||
|  | @ -1042,7 +1049,7 @@ static  PyObject *__pyx_f_7msgpack_6Packer___pack(struct __pyx_obj_7msgpack_Pack | |||
|     __pyx_v_o = __pyx_t_8; | ||||
|     __pyx_t_8 = 0; | ||||
| 
 | ||||
|     /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":129
 | ||||
|     /* "/home/inada-n/work/msgpack/python/msgpack.pyx":129
 | ||||
|  *         elif isinstance(o, unicode): | ||||
|  *             o = o.encode('utf-8') | ||||
|  *             rawval = o             # <<<<<<<<<<<<<< | ||||
|  | @ -1052,7 +1059,7 @@ static  PyObject *__pyx_f_7msgpack_6Packer___pack(struct __pyx_obj_7msgpack_Pack | |||
|     __pyx_t_5 = __Pyx_PyBytes_AsString(__pyx_v_o); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} | ||||
|     __pyx_v_rawval = __pyx_t_5; | ||||
| 
 | ||||
|     /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":130
 | ||||
|     /* "/home/inada-n/work/msgpack/python/msgpack.pyx":130
 | ||||
|  *             o = o.encode('utf-8') | ||||
|  *             rawval = o | ||||
|  *             msgpack_pack_raw(&self.pk, len(o))             # <<<<<<<<<<<<<< | ||||
|  | @ -1062,7 +1069,7 @@ static  PyObject *__pyx_f_7msgpack_6Packer___pack(struct __pyx_obj_7msgpack_Pack | |||
|     __pyx_t_6 = PyObject_Length(__pyx_v_o); if (unlikely(__pyx_t_6 == -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_6); | ||||
| 
 | ||||
|     /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":131
 | ||||
|     /* "/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))             # <<<<<<<<<<<<<< | ||||
|  | @ -1074,7 +1081,7 @@ static  PyObject *__pyx_f_7msgpack_6Packer___pack(struct __pyx_obj_7msgpack_Pack | |||
|     goto __pyx_L3; | ||||
|   } | ||||
| 
 | ||||
|   /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":132
 | ||||
|   /* "/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):             # <<<<<<<<<<<<<< | ||||
|  | @ -1084,7 +1091,7 @@ static  PyObject *__pyx_f_7msgpack_6Packer___pack(struct __pyx_obj_7msgpack_Pack | |||
|   __pyx_t_1 = PyObject_TypeCheck(__pyx_v_o, ((PyTypeObject *)((PyObject*)&PyDict_Type)));  | ||||
|   if (__pyx_t_1) { | ||||
| 
 | ||||
|     /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":133
 | ||||
|     /* "/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))             # <<<<<<<<<<<<<< | ||||
|  | @ -1094,7 +1101,7 @@ static  PyObject *__pyx_f_7msgpack_6Packer___pack(struct __pyx_obj_7msgpack_Pack | |||
|     __pyx_t_6 = PyObject_Length(__pyx_v_o); if (unlikely(__pyx_t_6 == -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_6); | ||||
| 
 | ||||
|     /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":134
 | ||||
|     /* "/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():             # <<<<<<<<<<<<<< | ||||
|  | @ -1157,7 +1164,7 @@ static  PyObject *__pyx_f_7msgpack_6Packer___pack(struct __pyx_obj_7msgpack_Pack | |||
|         __pyx_3 = 0; | ||||
|       } | ||||
| 
 | ||||
|       /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":135
 | ||||
|       /* "/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)             # <<<<<<<<<<<<<< | ||||
|  | @ -1177,7 +1184,7 @@ static  PyObject *__pyx_f_7msgpack_6Packer___pack(struct __pyx_obj_7msgpack_Pack | |||
|       __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; | ||||
|       __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; | ||||
| 
 | ||||
|       /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":136
 | ||||
|       /* "/home/inada-n/work/msgpack/python/msgpack.pyx":136
 | ||||
|  *             for k,v in o.iteritems(): | ||||
|  *                 self.pack(k) | ||||
|  *                 self.pack(v)             # <<<<<<<<<<<<<< | ||||
|  | @ -1201,7 +1208,7 @@ static  PyObject *__pyx_f_7msgpack_6Packer___pack(struct __pyx_obj_7msgpack_Pack | |||
|     goto __pyx_L3; | ||||
|   } | ||||
| 
 | ||||
|   /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":137
 | ||||
|   /* "/home/inada-n/work/msgpack/python/msgpack.pyx":137
 | ||||
|  *                 self.pack(k) | ||||
|  *                 self.pack(v) | ||||
|  *         elif isinstance(o, tuple) or isinstance(o, list):             # <<<<<<<<<<<<<< | ||||
|  | @ -1217,7 +1224,7 @@ static  PyObject *__pyx_f_7msgpack_6Packer___pack(struct __pyx_obj_7msgpack_Pack | |||
|   } | ||||
|   if (__pyx_t_11) { | ||||
| 
 | ||||
|     /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":138
 | ||||
|     /* "/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))             # <<<<<<<<<<<<<< | ||||
|  | @ -1227,7 +1234,7 @@ static  PyObject *__pyx_f_7msgpack_6Packer___pack(struct __pyx_obj_7msgpack_Pack | |||
|     __pyx_t_6 = PyObject_Length(__pyx_v_o); if (unlikely(__pyx_t_6 == -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_6); | ||||
| 
 | ||||
|     /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":139
 | ||||
|     /* "/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:             # <<<<<<<<<<<<<< | ||||
|  | @ -1259,7 +1266,7 @@ static  PyObject *__pyx_f_7msgpack_6Packer___pack(struct __pyx_obj_7msgpack_Pack | |||
|       __pyx_v_v = __pyx_t_7; | ||||
|       __pyx_t_7 = 0; | ||||
| 
 | ||||
|       /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":140
 | ||||
|       /* "/home/inada-n/work/msgpack/python/msgpack.pyx":140
 | ||||
|  *             msgpack_pack_array(&self.pk, len(o)) | ||||
|  *             for v in o: | ||||
|  *                 self.pack(v)             # <<<<<<<<<<<<<< | ||||
|  | @ -1284,7 +1291,7 @@ static  PyObject *__pyx_f_7msgpack_6Packer___pack(struct __pyx_obj_7msgpack_Pack | |||
|   } | ||||
|   /*else*/ { | ||||
| 
 | ||||
|     /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":143
 | ||||
|     /* "/home/inada-n/work/msgpack/python/msgpack.pyx":143
 | ||||
|  *         else: | ||||
|  *             # TODO: Serialize with defalt() like simplejson. | ||||
|  *             raise TypeError, "can't serialize %r" % (o,)             # <<<<<<<<<<<<<< | ||||
|  | @ -1326,7 +1333,7 @@ static  PyObject *__pyx_f_7msgpack_6Packer___pack(struct __pyx_obj_7msgpack_Pack | |||
|   return __pyx_r; | ||||
| } | ||||
| 
 | ||||
| /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":145
 | ||||
| /* "/home/inada-n/work/msgpack/python/msgpack.pyx":145
 | ||||
|  *             raise TypeError, "can't serialize %r" % (o,) | ||||
|  *  | ||||
|  *     def pack(self, obj, flush=True):             # <<<<<<<<<<<<<< | ||||
|  | @ -1387,7 +1394,7 @@ static PyObject *__pyx_pf_7msgpack_6Packer_pack(PyObject *__pyx_v_self, PyObject | |||
|   return NULL; | ||||
|   __pyx_L4_argument_unpacking_done:; | ||||
| 
 | ||||
|   /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":146
 | ||||
|   /* "/home/inada-n/work/msgpack/python/msgpack.pyx":146
 | ||||
|  *  | ||||
|  *     def pack(self, obj, flush=True): | ||||
|  *         self.__pack(obj)             # <<<<<<<<<<<<<< | ||||
|  | @ -1398,7 +1405,7 @@ static PyObject *__pyx_pf_7msgpack_6Packer_pack(PyObject *__pyx_v_self, PyObject | |||
|   __Pyx_GOTREF(__pyx_t_1); | ||||
|   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | ||||
| 
 | ||||
|   /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":147
 | ||||
|   /* "/home/inada-n/work/msgpack/python/msgpack.pyx":147
 | ||||
|  *     def pack(self, obj, flush=True): | ||||
|  *         self.__pack(obj) | ||||
|  *         if flush:             # <<<<<<<<<<<<<< | ||||
|  | @ -1408,7 +1415,7 @@ static PyObject *__pyx_pf_7msgpack_6Packer_pack(PyObject *__pyx_v_self, PyObject | |||
|   __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/msgpack-py/python/msgpack.pyx":148
 | ||||
|     /* "/home/inada-n/work/msgpack/python/msgpack.pyx":148
 | ||||
|  *         self.__pack(obj) | ||||
|  *         if flush: | ||||
|  *             self.flush()             # <<<<<<<<<<<<<< | ||||
|  | @ -1438,7 +1445,7 @@ static PyObject *__pyx_pf_7msgpack_6Packer_pack(PyObject *__pyx_v_self, PyObject | |||
|   return __pyx_r; | ||||
| } | ||||
| 
 | ||||
| /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":150
 | ||||
| /* "/home/inada-n/work/msgpack/python/msgpack.pyx":150
 | ||||
|  *             self.flush() | ||||
|  *  | ||||
|  * cdef int _packer_write(Packer packer, const_char_ptr b, unsigned int l):             # <<<<<<<<<<<<<< | ||||
|  | @ -1454,7 +1461,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/msgpack-py/python/msgpack.pyx":151
 | ||||
|   /* "/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:             # <<<<<<<<<<<<<< | ||||
|  | @ -1464,7 +1471,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/msgpack-py/python/msgpack.pyx":152
 | ||||
|     /* "/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:             # <<<<<<<<<<<<<< | ||||
|  | @ -1474,7 +1481,7 @@ 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/msgpack-py/python/msgpack.pyx":153
 | ||||
|       /* "/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))             # <<<<<<<<<<<<<< | ||||
|  | @ -1499,7 +1506,7 @@ static  int __pyx_f_7msgpack__packer_write(struct __pyx_obj_7msgpack_Packer *__p | |||
|     } | ||||
|     __pyx_L4:; | ||||
| 
 | ||||
|     /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":154
 | ||||
|     /* "/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:             # <<<<<<<<<<<<<< | ||||
|  | @ -1509,7 +1516,7 @@ 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/msgpack-py/python/msgpack.pyx":155
 | ||||
|       /* "/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))             # <<<<<<<<<<<<<< | ||||
|  | @ -1531,7 +1538,7 @@ static  int __pyx_f_7msgpack__packer_write(struct __pyx_obj_7msgpack_Packer *__p | |||
|       __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; | ||||
|       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; | ||||
| 
 | ||||
|       /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":156
 | ||||
|       /* "/home/inada-n/work/msgpack/python/msgpack.pyx":156
 | ||||
|  *         if l > 64: | ||||
|  *             packer.strm.write(PyString_FromStringAndSize(b, l)) | ||||
|  *             packer.length = 0             # <<<<<<<<<<<<<< | ||||
|  | @ -1543,7 +1550,7 @@ static  int __pyx_f_7msgpack__packer_write(struct __pyx_obj_7msgpack_Packer *__p | |||
|     } | ||||
|     /*else*/ { | ||||
| 
 | ||||
|       /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":158
 | ||||
|       /* "/home/inada-n/work/msgpack/python/msgpack.pyx":158
 | ||||
|  *             packer.length = 0 | ||||
|  *         else: | ||||
|  *             memcpy(packer.buff, b, l)             # <<<<<<<<<<<<<< | ||||
|  | @ -1552,7 +1559,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/msgpack-py/python/msgpack.pyx":159
 | ||||
|       /* "/home/inada-n/work/msgpack/python/msgpack.pyx":159
 | ||||
|  *         else: | ||||
|  *             memcpy(packer.buff, b, l) | ||||
|  *             packer.length = l             # <<<<<<<<<<<<<< | ||||
|  | @ -1566,7 +1573,7 @@ static  int __pyx_f_7msgpack__packer_write(struct __pyx_obj_7msgpack_Packer *__p | |||
|   } | ||||
|   /*else*/ { | ||||
| 
 | ||||
|     /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":161
 | ||||
|     /* "/home/inada-n/work/msgpack/python/msgpack.pyx":161
 | ||||
|  *             packer.length = l | ||||
|  *     else: | ||||
|  *         memcpy(packer.buff + packer.length, b, l)             # <<<<<<<<<<<<<< | ||||
|  | @ -1575,7 +1582,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/msgpack-py/python/msgpack.pyx":162
 | ||||
|     /* "/home/inada-n/work/msgpack/python/msgpack.pyx":162
 | ||||
|  *     else: | ||||
|  *         memcpy(packer.buff + packer.length, b, l) | ||||
|  *         packer.length += l             # <<<<<<<<<<<<<< | ||||
|  | @ -1586,7 +1593,7 @@ static  int __pyx_f_7msgpack__packer_write(struct __pyx_obj_7msgpack_Packer *__p | |||
|   } | ||||
|   __pyx_L3:; | ||||
| 
 | ||||
|   /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":163
 | ||||
|   /* "/home/inada-n/work/msgpack/python/msgpack.pyx":163
 | ||||
|  *         memcpy(packer.buff + packer.length, b, l) | ||||
|  *         packer.length += l | ||||
|  *     return 0             # <<<<<<<<<<<<<< | ||||
|  | @ -1609,7 +1616,7 @@ static  int __pyx_f_7msgpack__packer_write(struct __pyx_obj_7msgpack_Packer *__p | |||
|   return __pyx_r; | ||||
| } | ||||
| 
 | ||||
| /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":165
 | ||||
| /* "/home/inada-n/work/msgpack/python/msgpack.pyx":165
 | ||||
|  *     return 0 | ||||
|  *  | ||||
|  * def pack(object o, object stream):             # <<<<<<<<<<<<<< | ||||
|  | @ -1670,7 +1677,7 @@ static PyObject *__pyx_pf_7msgpack_pack(PyObject *__pyx_self, PyObject *__pyx_ar | |||
|   __pyx_L4_argument_unpacking_done:; | ||||
|   __pyx_v_packer = Py_None; __Pyx_INCREF(Py_None); | ||||
| 
 | ||||
|   /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":166
 | ||||
|   /* "/home/inada-n/work/msgpack/python/msgpack.pyx":166
 | ||||
|  *  | ||||
|  * def pack(object o, object stream): | ||||
|  *     packer = Packer(stream)             # <<<<<<<<<<<<<< | ||||
|  | @ -1689,7 +1696,7 @@ static PyObject *__pyx_pf_7msgpack_pack(PyObject *__pyx_self, PyObject *__pyx_ar | |||
|   __pyx_v_packer = __pyx_t_2; | ||||
|   __pyx_t_2 = 0; | ||||
| 
 | ||||
|   /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":167
 | ||||
|   /* "/home/inada-n/work/msgpack/python/msgpack.pyx":167
 | ||||
|  * def pack(object o, object stream): | ||||
|  *     packer = Packer(stream) | ||||
|  *     packer.pack(o)             # <<<<<<<<<<<<<< | ||||
|  | @ -1709,7 +1716,7 @@ static PyObject *__pyx_pf_7msgpack_pack(PyObject *__pyx_self, PyObject *__pyx_ar | |||
|   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; | ||||
|   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; | ||||
| 
 | ||||
|   /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":168
 | ||||
|   /* "/home/inada-n/work/msgpack/python/msgpack.pyx":168
 | ||||
|  *     packer = Packer(stream) | ||||
|  *     packer.pack(o) | ||||
|  *     packer.flush()             # <<<<<<<<<<<<<< | ||||
|  | @ -1738,7 +1745,7 @@ static PyObject *__pyx_pf_7msgpack_pack(PyObject *__pyx_self, PyObject *__pyx_ar | |||
|   return __pyx_r; | ||||
| } | ||||
| 
 | ||||
| /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":170
 | ||||
| /* "/home/inada-n/work/msgpack/python/msgpack.pyx":170
 | ||||
|  *     packer.flush() | ||||
|  *  | ||||
|  * def packs(object o):             # <<<<<<<<<<<<<< | ||||
|  | @ -1760,7 +1767,7 @@ 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/msgpack-py/python/msgpack.pyx":171
 | ||||
|   /* "/home/inada-n/work/msgpack/python/msgpack.pyx":171
 | ||||
|  *  | ||||
|  * def packs(object o): | ||||
|  *     buf = StringIO()             # <<<<<<<<<<<<<< | ||||
|  | @ -1776,7 +1783,7 @@ static PyObject *__pyx_pf_7msgpack_packs(PyObject *__pyx_self, PyObject *__pyx_v | |||
|   __pyx_v_buf = __pyx_t_1; | ||||
|   __pyx_t_1 = 0; | ||||
| 
 | ||||
|   /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":172
 | ||||
|   /* "/home/inada-n/work/msgpack/python/msgpack.pyx":172
 | ||||
|  * def packs(object o): | ||||
|  *     buf = StringIO() | ||||
|  *     packer = Packer(buf)             # <<<<<<<<<<<<<< | ||||
|  | @ -1795,7 +1802,7 @@ static PyObject *__pyx_pf_7msgpack_packs(PyObject *__pyx_self, PyObject *__pyx_v | |||
|   __pyx_v_packer = __pyx_t_2; | ||||
|   __pyx_t_2 = 0; | ||||
| 
 | ||||
|   /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":173
 | ||||
|   /* "/home/inada-n/work/msgpack/python/msgpack.pyx":173
 | ||||
|  *     buf = StringIO() | ||||
|  *     packer = Packer(buf) | ||||
|  *     packer.pack(o)             # <<<<<<<<<<<<<< | ||||
|  | @ -1815,7 +1822,7 @@ static PyObject *__pyx_pf_7msgpack_packs(PyObject *__pyx_self, PyObject *__pyx_v | |||
|   __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; | ||||
|   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; | ||||
| 
 | ||||
|   /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":174
 | ||||
|   /* "/home/inada-n/work/msgpack/python/msgpack.pyx":174
 | ||||
|  *     packer = Packer(buf) | ||||
|  *     packer.pack(o) | ||||
|  *     packer.flush()             # <<<<<<<<<<<<<< | ||||
|  | @ -1829,7 +1836,7 @@ static PyObject *__pyx_pf_7msgpack_packs(PyObject *__pyx_self, PyObject *__pyx_v | |||
|   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; | ||||
|   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | ||||
| 
 | ||||
|   /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":175
 | ||||
|   /* "/home/inada-n/work/msgpack/python/msgpack.pyx":175
 | ||||
|  *     packer.pack(o) | ||||
|  *     packer.flush() | ||||
|  *     return buf.getvalue()             # <<<<<<<<<<<<<< | ||||
|  | @ -1863,7 +1870,7 @@ static PyObject *__pyx_pf_7msgpack_packs(PyObject *__pyx_self, PyObject *__pyx_v | |||
|   return __pyx_r; | ||||
| } | ||||
| 
 | ||||
| /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":186
 | ||||
| /* "/home/inada-n/work/msgpack/python/msgpack.pyx":186
 | ||||
|  *  | ||||
|  *  | ||||
|  * def unpacks(object packed_bytes):             # <<<<<<<<<<<<<< | ||||
|  | @ -1884,7 +1891,7 @@ static PyObject *__pyx_pf_7msgpack_unpacks(PyObject *__pyx_self, PyObject *__pyx | |||
|   __Pyx_SetupRefcountContext("unpacks"); | ||||
|   __pyx_self = __pyx_self; | ||||
| 
 | ||||
|   /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":188
 | ||||
|   /* "/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             # <<<<<<<<<<<<<< | ||||
|  | @ -1894,7 +1901,7 @@ static PyObject *__pyx_pf_7msgpack_unpacks(PyObject *__pyx_self, PyObject *__pyx | |||
|   __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/msgpack-py/python/msgpack.pyx":190
 | ||||
|   /* "/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             # <<<<<<<<<<<<<< | ||||
|  | @ -1903,7 +1910,7 @@ static PyObject *__pyx_pf_7msgpack_unpacks(PyObject *__pyx_self, PyObject *__pyx | |||
|  */ | ||||
|   __pyx_v_off = 0; | ||||
| 
 | ||||
|   /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":191
 | ||||
|   /* "/home/inada-n/work/msgpack/python/msgpack.pyx":191
 | ||||
|  *     cdef template_context ctx | ||||
|  *     cdef size_t off = 0 | ||||
|  *     template_init(&ctx)             # <<<<<<<<<<<<<< | ||||
|  | @ -1912,7 +1919,7 @@ static PyObject *__pyx_pf_7msgpack_unpacks(PyObject *__pyx_self, PyObject *__pyx | |||
|  */ | ||||
|   template_init((&__pyx_v_ctx)); | ||||
| 
 | ||||
|   /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":192
 | ||||
|   /* "/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)             # <<<<<<<<<<<<<< | ||||
|  | @ -1922,7 +1929,7 @@ static PyObject *__pyx_pf_7msgpack_unpacks(PyObject *__pyx_self, PyObject *__pyx | |||
|   __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/msgpack-py/python/msgpack.pyx":193
 | ||||
|   /* "/home/inada-n/work/msgpack/python/msgpack.pyx":193
 | ||||
|  *     template_init(&ctx) | ||||
|  *     template_execute(&ctx, p, len(packed_bytes), &off) | ||||
|  *     return template_data(&ctx)             # <<<<<<<<<<<<<< | ||||
|  | @ -1948,7 +1955,7 @@ static PyObject *__pyx_pf_7msgpack_unpacks(PyObject *__pyx_self, PyObject *__pyx | |||
|   return __pyx_r; | ||||
| } | ||||
| 
 | ||||
| /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":195
 | ||||
| /* "/home/inada-n/work/msgpack/python/msgpack.pyx":195
 | ||||
|  *     return template_data(&ctx) | ||||
|  *  | ||||
|  * def unpack(object stream):             # <<<<<<<<<<<<<< | ||||
|  | @ -1968,7 +1975,7 @@ 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/msgpack-py/python/msgpack.pyx":197
 | ||||
|   /* "/home/inada-n/work/msgpack/python/msgpack.pyx":197
 | ||||
|  * def unpack(object stream): | ||||
|  *     """unpack from stream.""" | ||||
|  *     packed = stream.read()             # <<<<<<<<<<<<<< | ||||
|  | @ -1984,7 +1991,7 @@ static PyObject *__pyx_pf_7msgpack_unpack(PyObject *__pyx_self, PyObject *__pyx_ | |||
|   __pyx_v_packed = __pyx_t_2; | ||||
|   __pyx_t_2 = 0; | ||||
| 
 | ||||
|   /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":198
 | ||||
|   /* "/home/inada-n/work/msgpack/python/msgpack.pyx":198
 | ||||
|  *     """unpack from stream.""" | ||||
|  *     packed = stream.read() | ||||
|  *     return unpacks(packed)             # <<<<<<<<<<<<<< | ||||
|  | @ -2090,7 +2097,11 @@ static PyNumberMethods __pyx_tp_as_number_Packer = { | |||
|   0, /*nb_coerce*/ | ||||
|   #endif | ||||
|   0, /*nb_int*/ | ||||
|   #if PY_MAJOR_VERSION >= 3 | ||||
|   0, /*reserved*/ | ||||
|   #else | ||||
|   0, /*nb_long*/ | ||||
|   #endif | ||||
|   0, /*nb_float*/ | ||||
|   #if PY_MAJOR_VERSION < 3 | ||||
|   0, /*nb_oct*/ | ||||
|  | @ -2246,7 +2257,11 @@ static PyNumberMethods __pyx_tp_as_number_Unpacker = { | |||
|   0, /*nb_coerce*/ | ||||
|   #endif | ||||
|   0, /*nb_int*/ | ||||
|   #if PY_MAJOR_VERSION >= 3 | ||||
|   0, /*reserved*/ | ||||
|   #else | ||||
|   0, /*nb_long*/ | ||||
|   #endif | ||||
|   0, /*nb_float*/ | ||||
|   #if PY_MAJOR_VERSION < 3 | ||||
|   0, /*nb_oct*/ | ||||
|  | @ -2389,6 +2404,7 @@ static struct PyModuleDef __pyx_moduledef = { | |||
| #endif | ||||
| 
 | ||||
| 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}, | ||||
|  | @ -2480,6 +2496,9 @@ PyMODINIT_FUNC PyInit_msgpack(void) | |||
|   __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;}; | ||||
|   if (__pyx_module_is_main_msgpack) { | ||||
|     if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_kp___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;} | ||||
|   __pyx_skip_dispatch = 0; | ||||
|  | @ -2503,7 +2522,7 @@ PyMODINIT_FUNC PyInit_msgpack(void) | |||
|   /*--- Function import code ---*/ | ||||
|   /*--- Execution code ---*/ | ||||
| 
 | ||||
|   /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":3
 | ||||
|   /* "/home/inada-n/work/msgpack/python/msgpack.pyx":3
 | ||||
|  * # coding: utf-8 | ||||
|  *  | ||||
|  * from cStringIO import StringIO             # <<<<<<<<<<<<<< | ||||
|  | @ -2524,7 +2543,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/msgpack-py/python/msgpack.pyx":37
 | ||||
|   /* "/home/inada-n/work/msgpack/python/msgpack.pyx":37
 | ||||
|  *  | ||||
|  *  | ||||
|  * cdef int BUFF_SIZE=2*1024             # <<<<<<<<<<<<<< | ||||
|  | @ -2533,7 +2552,7 @@ PyMODINIT_FUNC PyInit_msgpack(void) | |||
|  */ | ||||
|   __pyx_v_7msgpack_BUFF_SIZE = 2048; | ||||
| 
 | ||||
|   /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":145
 | ||||
|   /* "/home/inada-n/work/msgpack/python/msgpack.pyx":145
 | ||||
|  *             raise TypeError, "can't serialize %r" % (o,) | ||||
|  *  | ||||
|  *     def pack(self, obj, flush=True):             # <<<<<<<<<<<<<< | ||||
|  | @ -2546,7 +2565,7 @@ PyMODINIT_FUNC PyInit_msgpack(void) | |||
|   __pyx_t_1 = 0; | ||||
|   __Pyx_GIVEREF(__pyx_k_1); | ||||
| 
 | ||||
|   /* "/home/inada-n/work/msgpack/msgpack-py/python/msgpack.pyx":202
 | ||||
|   /* "/home/inada-n/work/msgpack/python/msgpack.pyx":202
 | ||||
|  * cdef class Unpacker: | ||||
|  *     """Do nothing. This function is for symmetric to Packer""" | ||||
|  *     unpack = staticmethod(unpacks)             # <<<<<<<<<<<<<< | ||||
|  | @ -3349,14 +3368,14 @@ static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { | |||
|     return Py_INCREF(x), x; | ||||
|   m = Py_TYPE(x)->tp_as_number; | ||||
| #if PY_VERSION_HEX < 0x03000000 | ||||
|   if (m && m->nb_long) { | ||||
|     name = "long"; | ||||
|     res = PyNumber_Long(x); | ||||
|   } | ||||
|   else if (m && m->nb_int) { | ||||
|   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"; | ||||
							
								
								
									
										2
									
								
								setup.py
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								setup.py
									
										
									
									
									
								
							|  | @ -2,7 +2,7 @@ from distutils.core import setup, Extension | |||
| 
 | ||||
| version = '0.0.1' | ||||
| 
 | ||||
| msgpack_mod = Extension('msgpack', sources=['msgpack.c'], extra_compile_args=["-O3"]) | ||||
| msgpack_mod = Extension('msgpack', sources=['msgpack.cpp']) | ||||
| 
 | ||||
| desc = 'MessagePack serializer/desirializer.' | ||||
| long_desc = desc + """ | ||||
|  |  | |||
							
								
								
									
										36
									
								
								unpack.h
									
										
									
									
									
								
							
							
						
						
									
										36
									
								
								unpack.h
									
										
									
									
									
								
							|  | @ -16,12 +16,28 @@ | |||
|  *    limitations under the License. | ||||
|  */ | ||||
| 
 | ||||
| #include <map> | ||||
| #include <string> | ||||
| 
 | ||||
| #define MSGPACK_MAX_STACK_SIZE  (1024) | ||||
| #include "msgpack/unpack_define.h" | ||||
| 
 | ||||
| typedef struct { | ||||
|     struct {unsigned int size, last} array_stack[MSGPACK_MAX_STACK_SIZE]; | ||||
| using namespace std; | ||||
| 
 | ||||
| typedef  struct unpack_user { | ||||
|     struct array_stack_type{unsigned int size, last;}; | ||||
|     array_stack_type array_stack[MSGPACK_MAX_STACK_SIZE]; | ||||
|     int array_current; | ||||
| 
 | ||||
|     map<string, PyObject*> str_cache; | ||||
| 
 | ||||
|     ~unpack_user() { | ||||
|         map<string, PyObject*>::iterator it, itend; | ||||
|         itend = str_cache.end(); | ||||
|         for (it = str_cache.begin(); it != itend; ++it) { | ||||
|             Py_DECREF(it->second); | ||||
|         } | ||||
|     } | ||||
| } unpack_user; | ||||
| 
 | ||||
| 
 | ||||
|  | @ -141,9 +157,21 @@ static inline int template_callback_map_item(unpack_user* u, msgpack_unpack_obje | |||
| 
 | ||||
| static inline int template_callback_raw(unpack_user* u, const char* b, const char* p, unsigned int l, msgpack_unpack_object* o) | ||||
| { | ||||
|     if (l < 16) { | ||||
|         string s(p, l); | ||||
|         map<string,PyObject*>::iterator it = u->str_cache.find(s); | ||||
|         if (it != u->str_cache.end()) { | ||||
|             *o = it->second; | ||||
|             Py_INCREF(*o); | ||||
|         } | ||||
|         else { | ||||
|             *o = PyString_FromStringAndSize(p, l); | ||||
|             Py_INCREF(*o); | ||||
|             u->str_cache[s] = *o; | ||||
|         } | ||||
|     } | ||||
|     else { | ||||
|         *o = PyString_FromStringAndSize(p, l); | ||||
|     if (l < 16) { // without foundation
 | ||||
|         PyString_InternInPlace(o); | ||||
|     } | ||||
|     return 0; | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Naoki INADA
						Naoki INADA