]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Bug #1473625: stop pickling in text mode make floats locale dependent.
authorGeorg Brandl <georg@python.org>
Sun, 30 Apr 2006 11:12:03 +0000 (11:12 +0000)
committerGeorg Brandl <georg@python.org>
Sun, 30 Apr 2006 11:12:03 +0000 (11:12 +0000)
Modules/cPickle.c

index dc987728f78a2f619be6ff44ec5d8b56a9ac5966..e4f33c16272f6fb74ae8b5aaad413900cdba4e09 100644 (file)
@@ -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;