]> granicus.if.org Git - python/commitdiff
The new float repr causes too much trouble and pain. I'm disabling the feature until...
authorChristian Heimes <christian@cheimes.de>
Tue, 11 Dec 2007 00:54:34 +0000 (00:54 +0000)
committerChristian Heimes <christian@cheimes.de>
Tue, 11 Dec 2007 00:54:34 +0000 (00:54 +0000)
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...

Lib/test/test_float.py
Makefile.pre.in
Objects/floatobject.c
PCbuild/pythoncore.vcproj
PCbuild8/pythoncore/pythoncore.vcproj
PCbuild9/pythoncore.vcproj

index 327eeaef72a2d97f08783e0f1000d3e512747bd3..ed5109fb12504ea9528d9565540272a540a42652 100644 (file)
@@ -134,7 +134,8 @@ def test_main():
         FormatFunctionsTestCase,
         UnknownFormatTestCase,
         IEEEFormatTestCase,
-        ReprTestCase)
+        #ReprTestCase
+        )
 
 if __name__ == '__main__':
     test_main()
index c2a061ae11a6146abeca75691deb12b101cd72ef..70e5b0e9629c2636a0ae4aeb19732d0213bafa49 100644 (file)
@@ -299,7 +299,6 @@ OBJECT_OBJS=        \
                Objects/genobject.o \
                Objects/fileobject.o \
                Objects/floatobject.o \
-               Objects/doubledigits.o \
                Objects/frameobject.o \
                Objects/funcobject.o \
                Objects/intobject.o \
index e92dab9da29f3379d572d343d2fe747061e7bc66..a6a29e7f93bc7cae202a8eaa1ed9d316ae7c7716 100644 (file)
@@ -306,6 +306,7 @@ PyFloat_AsStringEx(char *buf, PyFloatObject *v, int precision)
        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_float_repr(char *buf, PyFloatObject *v)
        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 @@ float_print(PyFloatObject *v, FILE *fp, int flags)
 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 @@ _PyFloat_Init(void)
 
        double_format = detected_double_format;
        float_format = detected_float_format;
-       
+
+#ifdef Py_BROKEN_REPR  
        /* Initialize floating point repr */
        _PyFloat_DigitsInit();
+#endif
 }
 
 void
index 930deca5b9ada545d9e3b6fde25a8211f2331b8c..bee30fdfee1475f75a0ff981108a83027f720dcd 100644 (file)
                <File
                        RelativePath="..\Objects\dictobject.c">
                </File>
-               <File
+               <!--File
                        RelativePath="..\Objects\doubledigits.c">
-               </File>
-        <File
+               </File-->
+               <File
                        RelativePath="..\PC\dl_nt.c">
                </File>
                <File
index f903c49ac3ef37e936655f88b0cf318c47b02e2a..ec639b46d24cd42f8f6879946134c0d38ad01463 100644 (file)
                                RelativePath="..\..\Objects\dictobject.c"\r
                                >\r
                        </File>\r
-                       <File\r
+                       <!--File\r
                                RelativePath="..\..\Objects\doubledigits.c"\r
                                >\r
-                       </File>\r
+                       </File-->\r
                        <File\r
                                RelativePath="..\..\Objects\enumobject.c"\r
                                >\r
index ba41095d494a0ee6bc15ba04eff3f1442b069439..47cff8cd80b2e60495350c3692e98e0a662ba50b 100644 (file)
                                RelativePath="..\Objects\dictobject.c"
                                >
                        </File>
-                       <File
+                       <!--File
                                RelativePath="..\Objects\doubledigits.c"
                                >
-                       </File>
+                       </File-->
                        <File
                                RelativePath="..\Objects\enumobject.c"
                                >