summaryrefslogtreecommitdiff
path: root/msgpack/unpack.h
diff options
context:
space:
mode:
Diffstat (limited to 'msgpack/unpack.h')
-rw-r--r--msgpack/unpack.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/msgpack/unpack.h b/msgpack/unpack.h
index 3c09747..c733b24 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 = PyEval_CallFunction(u->list_hook, "(O)", *c);
+ PyObject *new_c = PyObject_CallFunction(u->list_hook, "(O)", *c);
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 = PyEval_CallFunction(u->object_hook, "(O)", *c);
+ PyObject *new_c = PyObject_CallFunction(u->object_hook, "(O)", *c);
if (!new_c)
return -1;
@@ -246,7 +246,11 @@ static inline int unpack_callback_ext(unpack_user* u, const char* base, const ch
return -1;
}
// length also includes the typecode, so the actual data is lenght-1
- py = PyEval_CallFunction(u->ext_hook, "(is#)", typecode, pos, lenght-1);
+#if PY_MAJOR_VERSION == 2
+ py = PyObject_CallFunction(u->ext_hook, "(is#)", typecode, pos, lenght-1);
+#else
+ py = PyObject_CallFunction(u->ext_hook, "(iy#)", typecode, pos, lenght-1);
+#endif
if (!py)
return -1;
*o = py;