cpython: a06654ca0134 (original) (raw)
Mercurial > cpython
changeset 100906:a06654ca0134 2.7
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. [#13410]
Serhiy Storchaka storchaka@gmail.com | |
---|---|
date | Sun, 10 Apr 2016 15:26:52 +0300 |
parents | 4dc347c5c8a8 |
children | 9cf8572abe58 |
files | Lib/test/test_format.py Misc/NEWS Objects/unicodeobject.c |
diffstat | 3 files changed, 8 insertions(+), 1 deletions(-)[+] [-] Lib/test/test_format.py 1 Misc/NEWS 3 Objects/unicodeobject.c 5 |
line wrap: on
line diff
--- a/Lib/test/test_format.py +++ b/Lib/test/test_format.py @@ -243,6 +243,7 @@ class FormatTest(unittest.TestCase): fst = IntFails() testformat("%x", fst, '0')
testformat(u"%x", fst, '0')[](#l1.7)
# Test exception for unknown format characters if verbose:
--- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ What's New in Python 2.7.12? Core and Builtins ----------------- +- Issue #13410: Fixed a bug in PyUnicode_Format where it failed to properly
- Issue #26494: Fixed crash on iterating exhausting iterators. Affected classes are generic sequence iterators, iterators of bytearray, list, tuple, set, frozenset, dict, OrderedDict and corresponding views.
--- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -8632,7 +8632,10 @@ PyObject *PyUnicode_Format(PyObject *for } else { iobj = PyNumber_Int(v);
if (iobj==NULL) iobj = PyNumber_Long(v);[](#l3.7)
if (iobj==NULL) {[](#l3.8)
PyErr_Clear();[](#l3.9)
iobj = PyNumber_Long(v);[](#l3.10)
}[](#l3.11) }[](#l3.12) if (iobj!=NULL) {[](#l3.13) if (PyInt_Check(iobj)) {[](#l3.14)