[Python-checkins] r71264 - in python/branches/py3k-short-float-repr: Lib/test/test_float.py Python/dtoa.c
mark.dickinson
python-checkins at python.org
Sun Apr 5 21:44:44 CEST 2009
Author: mark.dickinson
Date: Sun Apr 5 21:44:44 2009
New Revision: 71264
Log:
Second attempted fix for float('.nan'), float('.inf').
Modified:
python/branches/py3k-short-float-repr/Lib/test/test_float.py
python/branches/py3k-short-float-repr/Python/dtoa.c
Modified: python/branches/py3k-short-float-repr/Lib/test/test_float.py
==============================================================================
--- python/branches/py3k-short-float-repr/Lib/test/test_float.py (original)
+++ python/branches/py3k-short-float-repr/Lib/test/test_float.py Sun Apr 5 21:44:44 2009
@@ -27,6 +27,7 @@
self.assertRaises(ValueError, float, ".nan")
self.assertRaises(ValueError, float, "+.inf")
self.assertRaises(ValueError, float, ".")
+ self.assertRaises(ValueError, float, "-.")
self.assertEqual(float(b" \u0663.\u0661\u0664 ".decode('raw-unicode-escape')), 3.14)
@support.run_with_locale('LC_NUMERIC', 'fr_FR', 'de_DE')
Modified: python/branches/py3k-short-float-repr/Python/dtoa.c
==============================================================================
--- python/branches/py3k-short-float-repr/Python/dtoa.c (original)
+++ python/branches/py3k-short-float-repr/Python/dtoa.c Sun Apr 5 21:44:44 2009
@@ -1500,6 +1500,10 @@
}
}
dig_done:
+ if (!nd && !nz && !nz0 && (s != s0)) {
+ /* no digits, just a '.'. Fail. */
+ goto ret0;
+ }
e = 0;
if (c == 'e' || c == 'E') {
if (!nd && !nz && !nz0) {
More information about the Python-checkins
mailing list