[Python-checkins] r71250 - 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 18:53:03 CEST 2009


Author: mark.dickinson
Date: Sun Apr  5 18:53:02 2009
New Revision: 71250

Log:
Revert previous 'fix', which caused float('.') to return 0.0.


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 18:53:02 2009
@@ -26,6 +26,7 @@
         self.assertRaises(ValueError, float, "--3.14")
         self.assertRaises(ValueError, float, ".nan")
         self.assertRaises(ValueError, float, "+.inf")
+        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 18:53:02 2009
@@ -1418,7 +1418,7 @@
 _Py_dg_strtod
 	(CONST char *s00, char **se)
 {
-	int bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, dp, e, e1;
+	int bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, e, e1;
 	int esign, i, j, k, nd, nd0, nf, nz, nz0, sign;
 	CONST char *s, *s0, *s1;
 	double aadj, aadj1;
@@ -1428,7 +1428,7 @@
 	BCinfo bc;
 	Bigint *bb, *bb1, *bd, *bd0, *bs, *delta;
 
-	sign = nz0 = nz = dp = bc.dplen = bc.uflchk = 0;
+	sign = nz0 = nz = bc.dplen = bc.uflchk = 0;
 	dval(&rv) = 0.;
 	for(s = s00;;s++) switch(*s) {
 		case '-':
@@ -1467,7 +1467,6 @@
 	nd0 = nd;
 	bc.dp0 = bc.dp1 = s - s0;
 	if (c == '.') {
-		dp = 1;
 		c = *++s;
 		bc.dp1 = s - s0;
 		bc.dplen = bc.dp1 - bc.dp0;
@@ -1539,7 +1538,7 @@
 			s = s00;
 		}
 	if (!nd) {
-		if (!nz && !nz0 && !dp) {
+		if (!nz && !nz0) {
 #ifdef INFNAN_CHECK
 			/* Check for Nan and Infinity */
 			switch(c) {


More information about the Python-checkins mailing list