commit | a708adfcf663e871dd3acdbea358f9bc047ec64b | [log] [tgz] |
---|---|---|
author | Benjamin Peterson <benjamin@python.org> | Wed Jan 02 12:21:32 2013 -0600 |
committer | Benjamin Peterson <benjamin@python.org> | Wed Jan 02 12:21:32 2013 -0600 |
tree | 82e9ee819d9c1a5d6a763489356085584322d210 | |
parent | 140794d6e79c60642c3ff2634a233e55cd3faeea [diff] [blame] |
call PyErr_Clear() when ignoring error from PyNumber_Int (closes #15516) Patch from Tom Tromey.
diff --git a/Objects/stringobject.c b/Objects/stringobject.c index 152ea21..dcab35e 100644 --- a/Objects/stringobject.c +++ b/Objects/stringobject.c
@@ -4489,7 +4489,10 @@ } 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)) {