diff Objects/stringobject.c @ 81240:80cfd4caa726 2.7

call PyErr_Clear() when ignoring error from PyNumber_Int (closes #15516) Patch from Tom Tromey.
author Benjamin Peterson <benjamin@python.org>
date Wed, 02 Jan 2013 12:21:32 -0600
parents 21fb1767e185
children ded5386604fd
line wrap: on
line diff
--- a/Objects/stringobject.c	Wed Jan 02 09:37:33 2013 -0600
+++ b/Objects/stringobject.c	Wed Jan 02 12:21:32 2013 -0600
@@ -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)) {