Skip to content

Commit

Permalink
Fix refcounting issue when casting from JSON (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cito committed Jan 8, 2021
1 parent c6be423 commit 9facbfc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pginternal.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,8 @@ cast_sized_text(char *s, Py_ssize_t size, int encoding, int type)
/* this type should only be passed when jsondecode is set */
obj = get_decoded_string(s, size, encoding);
if (obj && jsondecode) { /* was able to decode */
tmp_obj = Py_BuildValue("(O)", obj);
obj = PyObject_CallObject(jsondecode, tmp_obj);
tmp_obj = obj;
obj = PyObject_CallFunction(jsondecode, "(O)", obj);
Py_DECREF(tmp_obj);
}
break;
Expand Down

0 comments on commit 9facbfc

Please sign in to comment.