[issue26168] Py_BuildValue may leak 'N' arguments on PyTuple_New failure

2016-01-29 Thread squidevil
squidevil added the comment: Martin Panter: You're right. The DECREF on v when itemfailed will decref the N object and prevent the leak. My original analysis was wrong on that count. You're right, do_mklist and do_mkdict (in 2.7.11 at least) have similar problems, bailing after li

[issue26168] Py_BuildValue may leak 'N' arguments on PyTuple_New failure

2016-01-29 Thread squidevil
squidevil added the comment: It looks like this patch is against the "default" cpython (3.x) branch. The 2.7 branch is missing the if(itemfailed) code in do_mktuple whose else clause was modified by the patch. It looks like some of this needs to be backpor

[issue26168] Py_BuildValue may leak 'N' arguments on PyTuple_New failure

2016-01-20 Thread squidevil
New submission from squidevil: Expected behavior: Calling Py_BuildValue with a 'N' argument should take ownership of the N object, and on failure (returns NULL), call Py_DECREF() on any N argument. The documentation explicitly says that this is the intended usage: "