diff Modules/_csv.c @ 73944:bf7329190ca6 2.7

Issue #13573: The csv.writer now uses the repr() for floats rather than str().
author Raymond Hettinger <python@rcn.com>
date Sun, 11 Dec 2011 22:31:09 -0800
parents 787b969d37f0
children ba1c48f8b571
line wrap: on
line diff
--- a/Modules/_csv.c	Sat Dec 10 12:31:42 2011 -0500
+++ b/Modules/_csv.c	Sun Dec 11 22:31:09 2011 -0800
@@ -1184,7 +1184,11 @@
         else {
             PyObject *str;
 
-            str = PyObject_Str(field);
+            if (PyFloat_Check(field)) {
+                str = PyObject_Repr(field);
+            } else {
+                str = PyObject_Str(field);
+            }
             Py_DECREF(field);
             if (str == NULL)
                 return NULL;