[Python-checkins] r59464 - in python/trunk: Lib/test/test_float.py Makefile.pre.in Objects/floatobject.c PCbuild/pythoncore.vcproj PCbuild8/pythoncore/pythoncore.vcproj PCbuild9/pythoncore.vcproj

christian.heimes python-checkins at python.org
Tue Dec 11 01:54:35 CET 2007


Author: christian.heimes
Date: Tue Dec 11 01:54:34 2007
New Revision: 59464

Modified:
   python/trunk/Lib/test/test_float.py
   python/trunk/Makefile.pre.in
   python/trunk/Objects/floatobject.c
   python/trunk/PCbuild/pythoncore.vcproj
   python/trunk/PCbuild8/pythoncore/pythoncore.vcproj
   python/trunk/PCbuild9/pythoncore.vcproj
Log:
The new float repr causes too much trouble and pain. I'm disabling the feature until we have sorted out the issues on all machines. 64bit machines seem to have issues and Guido has reported even worse.
Guido: It's pretty bad actually -- repr(1e5) comes out as '1.0'... Ditto for
repr(1eN) for most N... Both in 2.6 and in 3.0...

Modified: python/trunk/Lib/test/test_float.py
==============================================================================
--- python/trunk/Lib/test/test_float.py	(original)
+++ python/trunk/Lib/test/test_float.py	Tue Dec 11 01:54:34 2007
@@ -134,7 +134,8 @@
         FormatFunctionsTestCase,
         UnknownFormatTestCase,
         IEEEFormatTestCase,
-        ReprTestCase)
+        #ReprTestCase
+        )
 
 if __name__ == '__main__':
     test_main()

Modified: python/trunk/Makefile.pre.in
==============================================================================
--- python/trunk/Makefile.pre.in	(original)
+++ python/trunk/Makefile.pre.in	Tue Dec 11 01:54:34 2007
@@ -299,7 +299,6 @@
 		Objects/genobject.o \
 		Objects/fileobject.o \
 		Objects/floatobject.o \
-		Objects/doubledigits.o \
 		Objects/frameobject.o \
 		Objects/funcobject.o \
 		Objects/intobject.o \

Modified: python/trunk/Objects/floatobject.c
==============================================================================
--- python/trunk/Objects/floatobject.c	(original)
+++ python/trunk/Objects/floatobject.c	Tue Dec 11 01:54:34 2007
@@ -306,6 +306,7 @@
 	format_float(buf, 100, v, precision);
 }
 
+#ifdef Py_BROKEN_REPR
 /* The following function is based on Tcl_PrintDouble,
  * from tclUtil.c.
  */
@@ -407,6 +408,8 @@
 	format_double_repr(buf, PyFloat_AS_DOUBLE(v));
 }
 
+#endif /* Py_BROKEN_REPR */
+
 /* Macro and helper that convert PyObject obj to a C double and store
    the value in dbl; this replaces the functionality of the coercion
    slot function.  If conversion to double raises an exception, obj is
@@ -491,8 +494,14 @@
 static PyObject *
 float_repr(PyFloatObject *v)
 {
+#ifdef Py_BROKEN_REPR
 	char buf[30];
 	format_float_repr(buf, v);
+#else
+	char buf[100];
+	format_float(buf, sizeof(buf), v, PREC_REPR);
+#endif
+
 	return PyString_FromString(buf);
 }
 
@@ -1391,9 +1400,11 @@
 
 	double_format = detected_double_format;
 	float_format = detected_float_format;
-	
+
+#ifdef Py_BROKEN_REPR	
 	/* Initialize floating point repr */
 	_PyFloat_DigitsInit();
+#endif
 }
 
 void

Modified: python/trunk/PCbuild/pythoncore.vcproj
==============================================================================
--- python/trunk/PCbuild/pythoncore.vcproj	(original)
+++ python/trunk/PCbuild/pythoncore.vcproj	Tue Dec 11 01:54:34 2007
@@ -484,10 +484,10 @@
 		<File
 			RelativePath="..\Objects\dictobject.c">
 		</File>
-		<File
+		<!--File
 			RelativePath="..\Objects\doubledigits.c">
-		</File>
-        <File
+		</File-->
+		<File
 			RelativePath="..\PC\dl_nt.c">
 		</File>
 		<File

Modified: python/trunk/PCbuild8/pythoncore/pythoncore.vcproj
==============================================================================
--- python/trunk/PCbuild8/pythoncore/pythoncore.vcproj	(original)
+++ python/trunk/PCbuild8/pythoncore/pythoncore.vcproj	Tue Dec 11 01:54:34 2007
@@ -819,10 +819,10 @@
 				RelativePath="..\..\Objects\dictobject.c"
 				>
 			</File>
-			<File
+			<!--File
 				RelativePath="..\..\Objects\doubledigits.c"
 				>
-			</File>
+			</File-->
 			<File
 				RelativePath="..\..\Objects\enumobject.c"
 				>

Modified: python/trunk/PCbuild9/pythoncore.vcproj
==============================================================================
--- python/trunk/PCbuild9/pythoncore.vcproj	(original)
+++ python/trunk/PCbuild9/pythoncore.vcproj	Tue Dec 11 01:54:34 2007
@@ -1370,10 +1370,10 @@
 				RelativePath="..\Objects\dictobject.c"
 				>
 			</File>
-			<File
+			<!--File
 				RelativePath="..\Objects\doubledigits.c"
 				>
-			</File>
+			</File-->
 			<File
 				RelativePath="..\Objects\enumobject.c"
 				>


More information about the Python-checkins mailing list