From: Georg Brandl Date: Sun, 30 Apr 2006 11:12:03 +0000 (+0000) Subject: Bug #1473625: stop pickling in text mode make floats locale dependent. X-Git-Tag: v2.4.4c1~236 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8ac119237a0100ca65211be7a0459bf84c983de1;p=thirdparty%2FPython%2Fcpython.git Bug #1473625: stop pickling in text mode make floats locale dependent. --- 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;