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.
This commit is contained in:
Georg Brandl 2006-04-30 11:13:56 +00:00
parent 44a118af50
commit de9b624fb9
6 changed files with 67 additions and 53 deletions

View file

@ -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;