[ python-Bugs-1391872 ] floating point literals don't work in non-US locale in 2.5
SourceForge.net
noreply at sourceforge.net
Thu Jan 19 08:12:33 CET 2006
Bugs item #1391872, was opened at 2005-12-28 03:01
Message generated for change (Comment added) made by bcannon
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1391872&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 Interpreter Core
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Submitted By: Fredrik Lundh (effbot)
Assigned to: Neal Norwitz (nnorwitz)
Summary: floating point literals don't work in non-US locale in 2.5
Initial Comment:
According to reports on comp.lang.python, the current
SVN trunk fails to handle floating point literals if
the locale is changed:
>>> import locale
>>> locale.setlocale(locale.LC_ALL, '')
'German_Germany.1252'
>>> 3.141592
3.0
This works just fine in 2.4.2.
See the later portions of the thread "build
curiosities of svn head (on WinXP)" for more details:
http://groups.google.com/group/comp.lang.python/browse_
frm/thread/226584dd47047bb6/e609cb1a0d47e98f
----------------------------------------------------------------------
>Comment By: Brett Cannon (bcannon)
Date: 2006-01-18 23:12
Message:
Logged In: YES
user_id=357491
This still fails on OS X 10.4.4:
AssertionError: using eval('3.14') failed for eu_ES
This is using rev. 42094.
----------------------------------------------------------------------
Comment By: Fredrik Lundh (effbot)
Date: 2005-12-29 12:37
Message:
Logged In: YES
user_id=38376
Verified and fixed in SVN. Assinging to Neal, in case
he wants to add an extra locale test pass to his build
robot.
----------------------------------------------------------------------
Comment By: Fredrik Lundh (effbot)
Date: 2005-12-29 10:52
Message:
Logged In: YES
user_id=38376
Looks good to me. I'll check this in shortly.
----------------------------------------------------------------------
Comment By: Hye-Shik Chang (perky)
Date: 2005-12-29 00:22
Message:
Logged In: YES
user_id=55188
The new patch tests it along with other locale-dependent
tests on test__locale. How about this?
----------------------------------------------------------------------
Comment By: Fredrik Lundh (effbot)
Date: 2005-12-28 11:00
Message:
Logged In: YES
user_id=38376
I'm not sure you can make too many assumptions about
the locale in the test suite, but I'm pretty sure that
it would be a good idea to let your "build robot" run
the test suite twice; once with the standard C locale,
and once with a non-US locale (e.g. sv_SE.utf8 which
does include some odd characters, different date and
money formats, and a decimal comma).
----------------------------------------------------------------------
Comment By: Neal Norwitz (nnorwitz)
Date: 2005-12-28 10:16
Message:
Logged In: YES
user_id=33168
Wow, I thought for sure I broke it with my recent patch to remove support for
hex floats. But it looks like just an AST problem (which I can be blamed for
too :-). The patch looks fine, but could you add tests so this doesn't happen
again. Thanks!
I'll be back in a week and try to fix it then if no one gets back to it.
----------------------------------------------------------------------
Comment By: Hye-Shik Chang (perky)
Date: 2005-12-28 06:04
Message:
Logged In: YES
user_id=55188
Okay. Here's a fix.
----------------------------------------------------------------------
Comment By: Hye-Shik Chang (perky)
Date: 2005-12-28 05:41
Message:
Logged In: YES
user_id=55188
This looks like a bug introduced by AST import;
r39757 is okay but r39762 has such an error.
----------------------------------------------------------------------
Comment By: Fredrik Lundh (effbot)
Date: 2005-12-28 03:02
Message:
Logged In: YES
user_id=38376
I just confirmed this on Unix:
$ export LANG=sv_SE.utf8
$ ./python
Python 2.5a0 (41806M, Dec 25 2005, 12:12:29)
[GCC 2.96 20000731 (Red Hat Linux 7.2 2.96-112.7.2)] on
linux2
Type "help", "copyright", "credits" or "license" for more
information.
>>> 3.14
3.1400000000000001
>>> import locale
>>> locale.setlocale(locale.LC_ALL, "")
'sv_SE.utf8'
>>> 3.14
3.0
>>>
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1391872&group_id=5470
More information about the Python-bugs-list
mailing list