Bugs item #1473625, was opened at 2006-04-20 17:25 Message generated for change (Comment added) made by ivilata You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1473625&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Library Group: Python 2.5 Status: Open Resolution: None Priority: 5 Submitted By: Ivan Vilata i Balaguer (ivilata) Assigned to: Nobody/Anonymous (nobody) Summary: cPickle produces locale-dependent dumps Initial Comment: Dumping a float with cPickle produces a result which is locale-dependent. This causes problems when trying to load the dump under a different locale (the regular pickle module is not affected by this bug). IMHO, the dump should be locale-independent to ensure portability. See the attached file for a sample session log showing the behaviour of both pickle and cPickle under C and ca_ES.UTF-8 locales (Catalan uses a comma to separate the integer and decimal part). ---------------------------------------------------------------------- >Comment By: Ivan Vilata i Balaguer (ivilata) Date: 2006-04-21 11:42 Message: Logged In: YES user_id=1064183 The problem seems to be in save_float() in the cPickle.c module. It uses PyOS_snprintf() to dump floats, but it is locale-dependent. Fortunately, the PyOS_ascii_formatd() function can be used. The attached patch seems to fix the problem, and pickling tests run OK. It would be nice to see this patch applied to 2.4 also. (BTW, I meant PEP 331 in the previous comment, not 311, sorry.) ---------------------------------------------------------------------- Comment By: Martin v. Löwis (loewis) Date: 2006-04-20 23:54 Message: Logged In: YES user_id=21627 Right, cPickle should use C locale floating point numbers, using the PEP 331 API. Would you like to investigate a patch? ---------------------------------------------------------------------- Comment By: Ivan Vilata i Balaguer (ivilata) Date: 2006-04-20 17:28 Message: Logged In: YES user_id=1064183 As a side note, does this have anything to do with PEP 311? http://www.python.org/dev/peps/pep-0331/ ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1473625&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com