Remove restriction on precision when formatting floats. This is the

first step towards removing the %f -> %g switch (see issues 7117,
5859).
This commit is contained in:
Mark Dickinson 2009-11-23 18:46:41 +00:00
parent 5c456e6f45
commit 18cfada1ea
4 changed files with 47 additions and 122 deletions

View file

@ -1090,14 +1090,7 @@ class MixinStrUnicodeUserStringTest:
value = 0.01
for x in xrange(60):
value = value * 3.141592655 / 3.0 * 10.0
# The formatfloat() code in stringobject.c and
# unicodeobject.c uses a 120 byte buffer and switches from
# 'f' formatting to 'g' at precision 50, so we expect
# OverflowErrors for the ranges x < 50 and prec >= 67.
if x < 50 and prec >= 67:
self.checkraises(OverflowError, format, "__mod__", value)
else:
self.checkcall(format, "__mod__", value)
self.checkcall(format, "__mod__", value)
def test_inplace_rewrites(self):
# Check that strings don't copy and modify cached single-character strings