mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-03-21 06:11:18 +01:00
Remove unnecessary refcount manipulation.
This commit is contained in:
parent
6fa609be3f
commit
d8e3575a46
@ -202,12 +202,8 @@ def unpackb(bytes packed_bytes, object object_hook=None):
|
|||||||
if object_hook is not None:
|
if object_hook is not None:
|
||||||
if not PyCallable_Check(object_hook):
|
if not PyCallable_Check(object_hook):
|
||||||
raise TypeError("object_hook must be a callable.")
|
raise TypeError("object_hook must be a callable.")
|
||||||
Py_INCREF(object_hook)
|
|
||||||
ctx.user.object_hook = <PyObject*>object_hook
|
ctx.user.object_hook = <PyObject*>object_hook
|
||||||
ret = template_execute(&ctx, p, len(packed_bytes), &off)
|
ret = template_execute(&ctx, p, len(packed_bytes), &off)
|
||||||
if object_hook is not None:
|
|
||||||
pass
|
|
||||||
#Py_DECREF(object_hook)
|
|
||||||
if ret == 1:
|
if ret == 1:
|
||||||
return template_data(&ctx)
|
return template_data(&ctx)
|
||||||
else:
|
else:
|
||||||
|
@ -178,7 +178,6 @@ int template_callback_map_end(unpack_user* u, msgpack_unpack_object* c)
|
|||||||
{
|
{
|
||||||
if (u->object_hook) {
|
if (u->object_hook) {
|
||||||
PyObject *arglist = Py_BuildValue("(O)", *c);
|
PyObject *arglist = Py_BuildValue("(O)", *c);
|
||||||
Py_INCREF(*c);
|
|
||||||
*c = PyEval_CallObject(u->object_hook, arglist);
|
*c = PyEval_CallObject(u->object_hook, arglist);
|
||||||
Py_DECREF(arglist);
|
Py_DECREF(arglist);
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user