[Python-checkins] r71196 - in python/branches/py3k-short-float-repr: Objects/floatobject.c Python/marshal.c

mark.dickinson python-checkins at python.org
Sat Apr 4 23:11:59 CEST 2009


Author: mark.dickinson
Date: Sat Apr  4 23:11:59 2009
New Revision: 71196

Log:
No need for the .0 in marshal.  Let's save some bytes!


Modified:
   python/branches/py3k-short-float-repr/Objects/floatobject.c
   python/branches/py3k-short-float-repr/Python/marshal.c

Modified: python/branches/py3k-short-float-repr/Objects/floatobject.c
==============================================================================
--- python/branches/py3k-short-float-repr/Objects/floatobject.c	(original)
+++ python/branches/py3k-short-float-repr/Objects/floatobject.c	Sat Apr  4 23:11:59 2009
@@ -1917,8 +1917,8 @@
 				if (PyFloat_CheckExact(p) &&
 				    Py_REFCNT(p) != 0) {
 					char *buf = PyOS_double_to_string(
-						PyFloat_AS_DOUBLE(p), 'g',
-						0, Py_DTSF_ADD_DOT_0);
+						PyFloat_AS_DOUBLE(p), 'r',
+						0, 0);
 					if (buf) {
 						/* XXX(twouters) cast
 						   refcount to long

Modified: python/branches/py3k-short-float-repr/Python/marshal.c
==============================================================================
--- python/branches/py3k-short-float-repr/Python/marshal.c	(original)
+++ python/branches/py3k-short-float-repr/Python/marshal.c	Sat Apr  4 23:11:59 2009
@@ -237,7 +237,7 @@
 		}
 		else {
 			char *buf = PyOS_double_to_string(PyFloat_AS_DOUBLE(v),
-				'r', 0, Py_DTSF_ADD_DOT_0);
+				'r', 0, 0);
 			if (!buf)
                             return;
 			n = strlen(buf);
@@ -269,7 +269,7 @@
 			char *buf;
 			w_byte(TYPE_COMPLEX, p);
 			buf = PyOS_double_to_string(PyComplex_RealAsDouble(v),
-				'r', 0, Py_DTSF_ADD_DOT_0);
+				'r', 0, 0);
 			if (!buf)
                             return;
 			n = strlen(buf);
@@ -277,7 +277,7 @@
 			w_string(buf, (int)n, p);
 			PyMem_Free(buf);
 			buf = PyOS_double_to_string(PyComplex_ImagAsDouble(v),
-				'r', 0, Py_DTSF_ADD_DOT_0);
+				'r', 0, 0);
 			if (!buf)
                             return;
 			n = strlen(buf);


More information about the Python-checkins mailing list