summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2013-01-02 18:21:32 (GMT)
committerBenjamin Peterson <benjamin@python.org>2013-01-02 18:21:32 (GMT)
commita708adfcf663e871dd3acdbea358f9bc047ec64b (patch)
tree82e9ee819d9c1a5d6a763489356085584322d210 /Objects
parent140794d6e79c60642c3ff2634a233e55cd3faeea (diff)
downloadcpython-a708adfcf663e871dd3acdbea358f9bc047ec64b.zip
cpython-a708adfcf663e871dd3acdbea358f9bc047ec64b.tar.gz
cpython-a708adfcf663e871dd3acdbea358f9bc047ec64b.tar.bz2
call PyErr_Clear() when ignoring error from PyNumber_Int (closes #15516)
Patch from Tom Tromey.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/stringobject.c5
1 files changed, 4 insertions, 1 deletions
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 @@ 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)) {