Issue #13410: Fixed a bug in PyUnicode_Format where it failed to properly
ignore errors from a __int__() method.
Patch based on the patch for issue #15516.
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 454451e..d06ce2c 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -8632,7 +8632,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)) {