From 8ac119237a0100ca65211be7a0459bf84c983de1 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Sun, 30 Apr 2006 11:12:03 +0000 Subject: [PATCH] Bug #1473625: stop pickling in text mode make floats locale dependent. --- Modules/cPickle.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Modules/cPickle.c b/Modules/cPickle.c index dc987728f78a..e4f33c16272f 100644 --- a/Modules/cPickle.c +++ b/Modules/cPickle.c @@ -1141,7 +1141,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; -- 2.47.3