[Python-checkins] r45820 - python/branches/release24-maint/Modules/cPickle.c

georg.brandl python-checkins at python.org
Sun Apr 30 13:12:04 CEST 2006


Author: georg.brandl
Date: Sun Apr 30 13:12:03 2006
New Revision: 45820

Modified:
   python/branches/release24-maint/Modules/cPickle.c
Log:
Bug #1473625: stop pickling in text mode make floats locale dependent.



Modified: python/branches/release24-maint/Modules/cPickle.c
==============================================================================
--- python/branches/release24-maint/Modules/cPickle.c	(original)
+++ python/branches/release24-maint/Modules/cPickle.c	Sun Apr 30 13:12:03 2006
@@ -1141,7 +1141,9 @@
 	else {
 		char c_str[250];
 		c_str[0] = FLOAT;
-		PyOS_snprintf(c_str + 1, sizeof(c_str) - 1, "%.17g\n", x);
+		PyOS_ascii_formatd(c_str + 1, sizeof(c_str) - 2, "%.17g", x);
+		/* Extend the formatted string with a newline character */
+		strcat(c_str, "\n");
 
 		if (self->write_func(self, c_str, strlen(c_str)) < 0)
 			return -1;


More information about the Python-checkins mailing list