Kristján Valur Jónsson added the comment: These are very unusual semantics. The convention in the python api is that functions are refernece-invariant when there are errors. i.e. if a function fails or not does not change the caller's reference passing assumptions.
For example, Py_BuildValue("N", myobject); takes care to always steal the reference of myobject, even when Py_BuildValue fails. Thi tehe case of _PyBytes_Resize(), the caller owns the (single) reference to the operand, and owns the reference to it (or a new one) on success. It is highly unusual that the case of failure causes it to no longer own this reference. Python 3 should have taken the opportunity to remove remove this unusual inheritance from _PyString_Resize() ---------- nosy: +kristjan.jonsson _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue20434> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com