summaryrefslogtreecommitdiff
path: root/msgpack
diff options
context:
space:
mode:
authorINADA Naoki <inada-n@klab.com>2013-10-21 00:29:05 +0900
committerINADA Naoki <inada-n@klab.com>2013-10-21 00:29:05 +0900
commit37c2ad63af8a6e5cb6944f80d931fedbc6b49e7d (patch)
treeeb64d69860be6da6d1cb64c0c24a7347fbb5c4d1 /msgpack
parentcb789596787592f4ec6bf7dcc0c646e8976b3f16 (diff)
downloadmsgpack-python-37c2ad63af8a6e5cb6944f80d931fedbc6b49e7d.tar.gz
Add tests and bugfix.
Diffstat (limited to 'msgpack')
-rw-r--r--msgpack/pack_template.h3
-rw-r--r--msgpack/unpack.h4
2 files changed, 4 insertions, 3 deletions
diff --git a/msgpack/pack_template.h b/msgpack/pack_template.h
index 8b91619..2879bbd 100644
--- a/msgpack/pack_template.h
+++ b/msgpack/pack_template.h
@@ -705,7 +705,8 @@ static inline int msgpack_pack_bin(msgpack_packer *x, size_t l)
static inline int msgpack_pack_raw_body(msgpack_packer* x, const void* b, size_t l)
{
- msgpack_pack_append_buffer(x, (const unsigned char*)b, l);
+ if (l > 0) msgpack_pack_append_buffer(x, (const unsigned char*)b, l);
+ return 0;
}
/*
diff --git a/msgpack/unpack.h b/msgpack/unpack.h
index c733b24..aced40b 100644
--- a/msgpack/unpack.h
+++ b/msgpack/unpack.h
@@ -157,7 +157,7 @@ static inline int unpack_callback_array_item(unpack_user* u, unsigned int curren
static inline int unpack_callback_array_end(unpack_user* u, msgpack_unpack_object* c)
{
if (u->list_hook) {
- PyObject *new_c = PyObject_CallFunction(u->list_hook, "(O)", *c);
+ PyObject *new_c = PyObject_CallFunctionObjArgs(u->list_hook, *c, NULL);
if (!new_c)
return -1;
Py_DECREF(*c);
@@ -203,7 +203,7 @@ static inline int unpack_callback_map_item(unpack_user* u, unsigned int current,
static inline int unpack_callback_map_end(unpack_user* u, msgpack_unpack_object* c)
{
if (u->object_hook) {
- PyObject *new_c = PyObject_CallFunction(u->object_hook, "(O)", *c);
+ PyObject *new_c = PyObject_CallFunctionObjArgs(u->object_hook, *c, NULL);
if (!new_c)
return -1;