homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: floating point literals don't work in non-US locale in 2.5
Type: behavior Stage:
Components: Interpreter Core Versions: Python 2.6
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: nnorwitz Nosy List: brett.cannon, christian.heimes, effbot, georg.brandl, georg.brandl, hyeshik.chang, ivilata, nnorwitz
Priority: normal Keywords:

Created on 2005年12月28日 11:01 by effbot, last changed 2022年04月11日 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
astfloatparsing2.diff.txt hyeshik.chang, 2005年12月29日 08:22 revised patch that includes a test code
Messages (15)
msg27169 - (view) Author: Fredrik Lundh (effbot) * (Python committer) Date: 2005年12月28日 11:01
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
msg27170 - (view) Author: Fredrik Lundh (effbot) * (Python committer) Date: 2005年12月28日 11:02
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
>>>
msg27171 - (view) Author: Hyeshik Chang (hyeshik.chang) * (Python committer) Date: 2005年12月28日 13:41
Logged In: YES 
user_id=55188
This looks like a bug introduced by AST import;
r39757 is okay but r39762 has such an error.
msg27172 - (view) Author: Hyeshik Chang (hyeshik.chang) * (Python committer) Date: 2005年12月28日 14:04
Logged In: YES 
user_id=55188
Okay. Here's a fix.
msg27173 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2005年12月28日 18:16
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.
msg27174 - (view) Author: Fredrik Lundh (effbot) * (Python committer) Date: 2005年12月28日 19:00
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).
msg27175 - (view) Author: Hyeshik Chang (hyeshik.chang) * (Python committer) Date: 2005年12月29日 08:22
Logged In: YES 
user_id=55188
The new patch tests it along with other locale-dependent 
tests on test__locale. How about this?
msg27176 - (view) Author: Fredrik Lundh (effbot) * (Python committer) Date: 2005年12月29日 18:52
Logged In: YES 
user_id=38376
Looks good to me. I'll check this in shortly.
msg27177 - (view) Author: Fredrik Lundh (effbot) * (Python committer) Date: 2005年12月29日 20:37
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.
msg27178 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2006年01月19日 07:12
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.
msg27179 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2006年02月20日 08:11
Logged In: YES 
user_id=1188172
Neal, you checked in a workaround in test__locale for eu_ES.
Can this be closed then?
msg27180 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2006年03月20日 08:02
Logged In: YES 
user_id=33168
Keeping open as a reminder to fix the regression tests
running on the PSF box every 12 hours. Need to have a run
in a different locale.
msg27181 - (view) Author: Ivan Vilata i Balaguer (ivilata) Date: 2006年03月31日 14:22
Logged In: YES 
user_id=1064183
I have tried this under r43476, with ca_ES.UTF-8 locale, and
it seems to work right::
 Python 2.5a0 (trunk:43476, Mar 31 2006, 15:46:07) 
 [GCC 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9)]
on linux2
 Type "help", "copyright", "credits" or "license" for more
information.
 >>> import locale
 >>> 3.141592
 3.1415920000000002
 >>> locale.setlocale(locale.LC_ALL, '')
 'ca_ES.UTF-8'
 >>> 3.141592
 3.1415920000000002
 >>> 
msg59786 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2008年01月12日 04:39
Do we have a test for the problem which verifies the behavior or can I
close the bug?
msg70074 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008年07月20日 11:19
It seems it has been fixed.
History
Date User Action Args
2022年04月11日 14:56:14adminsetgithub: 42737
2008年07月20日 11:19:34georg.brandlsetstatus: pending -> closed
nosy: + georg.brandl
messages: + msg70074
2008年01月12日 04:39:03christian.heimessetstatus: open -> pending
nosy: + christian.heimes
type: behavior
messages: + msg59786
versions: + Python 2.6, - Python 2.5
2005年12月28日 11:01:05effbotcreate

AltStyle によって変換されたページ (->オリジナル) /