Author: Amaury Forgeot d'Arc <[email protected]>
Branch: stdlib-2.7.3
Changeset: r55635:cc74abe554c9
Date: 2012-06-12 23:07 +0200
http://bitbucket.org/pypy/pypy/changeset/cc74abe554c9/

Log:    CPython issue13573: The csv.writer now uses the repr() for floats
        rather than str(). This allows floats to round-trip without loss of
        precision.

diff --git a/lib_pypy/_csv.py b/lib_pypy/_csv.py
--- a/lib_pypy/_csv.py
+++ b/lib_pypy/_csv.py
@@ -504,9 +504,12 @@
                 quoted = True
 
             if field is None:
-                self._join_append("", quoted, rowlen == 1)
+                value = ""
+            elif isinstance(field, float):
+                value = repr(field)
             else:
-                self._join_append(str(field), quoted, rowlen == 1)
+                value = str(field)
+            self._join_append(value, quoted, rowlen == 1)
 
         # add line terminator
         self.rec.append(dialect.lineterminator)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to