call PyErr_Clear() when ignoring error from PyNumber_Int (closes #15516)

Patch from Tom Tromey.
This commit is contained in:
Benjamin Peterson 2013-01-02 12:21:32 -06:00
parent 140794d6e7
commit a708adfcf6
3 changed files with 17 additions and 1 deletions

View file

@ -4489,7 +4489,10 @@ PyString_Format(PyObject *format, PyObject *args)
}
else {
iobj = PyNumber_Int(v);
if (iobj==NULL) iobj = PyNumber_Long(v);
if (iobj==NULL) {
PyErr_Clear();
iobj = PyNumber_Long(v);
}
}
if (iobj!=NULL) {
if (PyInt_Check(iobj)) {