[issue32794] PyNumber_Float counterpart that doesn't accept strings

Serhiy Storchaka report at bugs.python.org
Thu Feb 8 04:31:44 EST 2018


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

Maybe use PyNumber_Check() to distinguish these two cases?

    if (PyNumber_Check(obj))
        return PyNumber_Float(obj);
    PyErr_SetString(PyExc_TypeError, "not a number");
    return NULL;

----------
nosy: +serhiy.storchaka

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32794>
_______________________________________


More information about the Python-bugs-list mailing list