summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2006-04-30 11:13:56 (GMT)
committerGeorg Brandl <georg@python.org>2006-04-30 11:13:56 (GMT)
commitde9b624fb943295263f8140d9d2eda393348b8ec (patch)
tree5d2af20626e9afd98486b718235fa1f9b466812e /Modules
parent44a118af5043ed6919bd1d0bcfc603f496ae4d7c (diff)
downloadcpython-de9b624fb943295263f8140d9d2eda393348b8ec.zip
cpython-de9b624fb943295263f8140d9d2eda393348b8ec.tar.gz
cpython-de9b624fb943295263f8140d9d2eda393348b8ec.tar.bz2
Bug #1473625: stop cPickle making float dumps locale dependent in protocol 0.
On the way, add a decorator to test_support to facilitate running single test functions in different locales with automatic cleanup.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/cPickle.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/cPickle.c b/Modules/cPickle.c
index 18df599..9948ba7 100644
--- a/Modules/cPickle.c
+++ b/Modules/cPickle.c
@@ -1151,7 +1151,9 @@ save_float(Picklerobject *self, PyObject *args)
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;