summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorNaoki INADA <inada-n@gear>2009-06-08 12:46:02 +0900
committerNaoki INADA <inada-n@gear>2009-06-08 12:46:02 +0900
commit560bd901f83c9024ed88b738b80e14de337847c5 (patch)
treeccefabc3f6ab9197998cbedb92c6f8a27c2db0b3 /python
parent1840ef70aef0cfc9b6594ca7f24f6497eec7d13f (diff)
downloadmsgpack-python-560bd901f83c9024ed88b738b80e14de337847c5.tar.gz
Fix double INCREF-ing when unpacking.
Diffstat (limited to 'python')
-rw-r--r--python/msgpack.c20
-rw-r--r--python/msgpack.pyx4
2 files changed, 13 insertions, 11 deletions
diff --git a/python/msgpack.c b/python/msgpack.c
index 50ec6fc..e044f18 100644
--- a/python/msgpack.c
+++ b/python/msgpack.c
@@ -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."""
diff --git a/python/msgpack.pyx b/python/msgpack.pyx
index c454c5d..8b2006a 100644
--- a/python/msgpack.pyx
+++ b/python/msgpack.pyx
@@ -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."""