summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2007-12-11 00:54:34 (GMT)
committerChristian Heimes <christian@cheimes.de>2007-12-11 00:54:34 (GMT)
commitf15c66e1439b9eecf813ed737cd6210048b0c094 (patch)
tree647815bad1aa23f6a394b5c83accef2ae63f4f37
parent0c64fb435aab0ae8f8ce93634c156b2eedede184 (diff)
downloadcpython-f15c66e1439b9eecf813ed737cd6210048b0c094.zip
cpython-f15c66e1439b9eecf813ed737cd6210048b0c094.tar.gz
cpython-f15c66e1439b9eecf813ed737cd6210048b0c094.tar.bz2
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...
-rw-r--r--Lib/test/test_float.py3
-rw-r--r--Makefile.pre.in1
-rw-r--r--Objects/floatobject.c13
-rw-r--r--PCbuild/pythoncore.vcproj6
-rw-r--r--PCbuild8/pythoncore/pythoncore.vcproj4
-rw-r--r--PCbuild9/pythoncore.vcproj4
6 files changed, 21 insertions, 10 deletions
diff --git a/Lib/test/test_float.py b/Lib/test/test_float.py
index 327eeae..ed5109f 100644
--- a/Lib/test/test_float.py
+++ b/Lib/test/test_float.py
@@ -134,7 +134,8 @@ def test_main():
FormatFunctionsTestCase,
UnknownFormatTestCase,
IEEEFormatTestCase,
- ReprTestCase)
+ #ReprTestCase
+ )
if __name__ == '__main__':
test_main()
diff --git a/Makefile.pre.in b/Makefile.pre.in
index c2a061a..70e5b0e 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -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 \
diff --git a/Objects/floatobject.c b/Objects/floatobject.c
index e92dab9..a6a29e7 100644
--- a/Objects/floatobject.c
+++ b/Objects/floatobject.c
@@ -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
diff --git a/PCbuild/pythoncore.vcproj b/PCbuild/pythoncore.vcproj
index 930deca..bee30fd 100644
--- a/PCbuild/pythoncore.vcproj
+++ b/PCbuild/pythoncore.vcproj
@@ -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
diff --git a/PCbuild8/pythoncore/pythoncore.vcproj b/PCbuild8/pythoncore/pythoncore.vcproj
index f903c49..ec639b4 100644
--- a/PCbuild8/pythoncore/pythoncore.vcproj
+++ b/PCbuild8/pythoncore/pythoncore.vcproj
@@ -819,10 +819,10 @@
RelativePath="..\..\Objects\dictobject.c"
>
</File>
- <File
+ <!--File
RelativePath="..\..\Objects\doubledigits.c"
>
- </File>
+ </File-->
<File
RelativePath="..\..\Objects\enumobject.c"
>
diff --git a/PCbuild9/pythoncore.vcproj b/PCbuild9/pythoncore.vcproj
index ba41095..47cff8c 100644
--- a/PCbuild9/pythoncore.vcproj
+++ b/PCbuild9/pythoncore.vcproj
@@ -1370,10 +1370,10 @@
RelativePath="..\Objects\dictobject.c"
>
</File>
- <File
+ <!--File
RelativePath="..\Objects\doubledigits.c"
>
- </File>
+ </File-->
<File
RelativePath="..\Objects\enumobject.c"
>