cpython: 102df748572d (original) (raw)

Mercurial > cpython

changeset 80015:102df748572d 3.2

Issue #14700: Fix buggy overflow checks for large precision and width in new-style and old-style formatting. [#14700]

Mark Dickinson mdickinson@enthought.com
date Sun, 28 Oct 2012 10🔞03 +0000
parents 652286ee23f8
children 79ea0c84152a cde4b66699fe
files Lib/test/test_unicode.py Misc/NEWS Objects/stringlib/formatter.h Objects/stringlib/string_format.h Objects/unicodeobject.c
diffstat 5 files changed, 45 insertions(+), 20 deletions(-)[+] [-] Lib/test/test_unicode.py 27 Misc/NEWS 3 Objects/stringlib/formatter.h 16 Objects/stringlib/string_format.h 15 Objects/unicodeobject.c 4

line wrap: on

line diff

--- a/Lib/test/test_unicode.py +++ b/Lib/test/test_unicode.py @@ -906,6 +906,21 @@ class UnicodeTest(string_tests.CommonTes self.assertRaises(ValueError, '{}'.format_map, 'a') self.assertRaises(ValueError, '{a} {}'.format_map, {"a" : 2, "b" : 1})

+

+

+ def test_format_auto_numbering(self): class C: def init(self, x=100): @@ -990,6 +1005,18 @@ class UnicodeTest(string_tests.CommonTes self.assertEqual('%f' % INF, 'inf') self.assertEqual('%F' % INF, 'INF')

+

+ def test_startswith_endswith_errors(self): for meth in ('foo'.startswith, 'foo'.endswith): with self.assertRaises(TypeError) as cm:

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ What's New in Python 3.2.4 Core and Builtins ----------------- +- Issue #14700: Fix buggy overflow checks when handling large precisions and

--- a/Objects/stringlib/formatter.h +++ b/Objects/stringlib/formatter.h @@ -73,7 +73,7 @@ static int get_integer(STRINGLIB_CHAR **ptr, STRINGLIB_CHAR *end, Py_ssize_t *result) {

+

--- a/Objects/stringlib/string_format.h +++ b/Objects/stringlib/string_format.h @@ -197,7 +197,6 @@ get_integer(const SubString *str) { Py_ssize_t accumulator = 0; Py_ssize_t digitval;

+

--- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -9648,7 +9648,7 @@ PyObject *PyUnicode_Format(PyObject *for c = *fmt++; if (c < '0' || c > '9') break;

@@ -9683,7 +9683,7 @@ PyObject *PyUnicode_Format(PyObject *for c = *fmt++; if (c < '0' || c > '9') break;