[issue23590] Potential leak in PyFloat_AsDouble. Refcount error.

Patrick Miller report at bugs.python.org
Thu Mar 5 16:45:07 CET 2015


Patrick Miller added the comment:

Shout out to amaury for a much simpler recreator :-)

Checked to see if the int conversion suffered the same problem... it does not as it is structured somewhat differently.  Note that it DOES do the proper DECREF (missing in PyFloat_AsDouble).


    result = nb->nb_int(integral);
    if (!result || PyLong_CheckExact(result))
        return (PyLongObject *)result;
    if (!PyLong_Check(result)) {
        PyErr_Format(PyExc_TypeError,
                     "__int__ returned non-int (type %.200s)",
                     result->ob_type->tp_name);
        Py_DECREF(result);
        return NULL;
    }

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23590>
_______________________________________


More information about the Python-bugs-list mailing list