Serhiy Storchaka <storchaka+cpyt...@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 <rep...@bugs.python.org> <https://bugs.python.org/issue32794> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com