Fix double INCREF-ing when unpacking.

This commit is contained in:
Naoki INADA 2009-06-08 12:46:02 +09:00
parent 1840ef70ae
commit 560bd901f8
2 changed files with 13 additions and 11 deletions

View File

@ -1,4 +1,4 @@
/* Generated by Cython 0.11.2 on Mon Jun 8 01:28:30 2009 */
/* Generated by Cython 0.11.2 on Mon Jun 8 12:41:02 2009 */
#define PY_SSIZE_T_CLEAN
#include "Python.h"
@ -1724,7 +1724,7 @@ static PyObject *__pyx_pf_7msgpack_unpacks(PyObject *__pyx_self, PyObject *__pyx
PyObject *__pyx_r = NULL;
const char* __pyx_t_1;
Py_ssize_t __pyx_t_2;
PyObject *__pyx_t_3;
PyObject *__pyx_t_3 = NULL;
__Pyx_SetupRefcountContext("unpacks");
__pyx_self = __pyx_self;
@ -1752,7 +1752,7 @@ static PyObject *__pyx_pf_7msgpack_unpacks(PyObject *__pyx_self, PyObject *__pyx
* cdef size_t off = 0
* template_init(&ctx) # <<<<<<<<<<<<<<
* template_execute(&ctx, p, len(packed_bytes), &off)
* return <object> template_data(&ctx)
* return template_data(&ctx)
*/
template_init((&__pyx_v_ctx));
@ -1760,7 +1760,7 @@ static PyObject *__pyx_pf_7msgpack_unpacks(PyObject *__pyx_self, PyObject *__pyx
* cdef size_t off = 0
* template_init(&ctx)
* template_execute(&ctx, p, len(packed_bytes), &off) # <<<<<<<<<<<<<<
* return <object> template_data(&ctx)
* 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;}
@ -1769,19 +1769,21 @@ static PyObject *__pyx_pf_7msgpack_unpacks(PyObject *__pyx_self, PyObject *__pyx
/* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":186
* template_init(&ctx)
* template_execute(&ctx, p, len(packed_bytes), &off)
* return <object> template_data(&ctx) # <<<<<<<<<<<<<<
* return template_data(&ctx) # <<<<<<<<<<<<<<
*
* def unpack(object stream):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_3 = template_data((&__pyx_v_ctx));
__Pyx_INCREF(((PyObject *)__pyx_t_3));
__pyx_r = ((PyObject *)__pyx_t_3);
__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_GOTREF(__pyx_t_3);
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("msgpack.unpacks");
__pyx_r = NULL;
__pyx_L0:;
@ -1791,7 +1793,7 @@ static PyObject *__pyx_pf_7msgpack_unpacks(PyObject *__pyx_self, PyObject *__pyx
}
/* "/home/inada-n/work/msgpack.py/python/msgpack.pyx":188
* return <object> template_data(&ctx)
* return template_data(&ctx)
*
* def unpack(object stream): # <<<<<<<<<<<<<<
* """unpack from stream."""

View File

@ -173,7 +173,7 @@ cdef extern from "unpack.h":
int template_execute(template_context* ctx, const_char_ptr data,
size_t len, size_t* off)
void template_init(template_context* ctx)
PyObject* template_data(template_context* ctx)
object template_data(template_context* ctx)
def unpacks(object packed_bytes):
@ -183,7 +183,7 @@ def unpacks(object packed_bytes):
cdef size_t off = 0
template_init(&ctx)
template_execute(&ctx, p, len(packed_bytes), &off)
return <object> template_data(&ctx)
return template_data(&ctx)
def unpack(object stream):
"""unpack from stream."""