[Patches] [ python-Patches-1400181 ] unicode formats floats according to locale
SourceForge.net
noreply at sourceforge.net
Tue Jan 10 07:06:49 CET 2006
Patches item #1400181, was opened at 2006-01-09 01:02
Message generated for change (Comment added) made by nnorwitz
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1400181&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: Core (C code)
>Group: Python 2.4
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Neal Norwitz (nnorwitz)
>Assigned to: Neal Norwitz (nnorwitz)
Summary: unicode formats floats according to locale
Initial Comment:
import locale
locale.setlocale(locale.LC_NUMERIC, 'de_DE')
u'%.1f' % 1.0
assert '1.0' == u'%.1f' % 1.0
Fails with HEAD and 2.4 because the locale is used and
1,0 is generated rather than 1.0.
I tried to come up with a test case, but it always
passes when run with the test suite. I could only
reproduce in the interpreter. Both the fix and test
are attached. The test has some debugging to try and
figure out the problem.
----------------------------------------------------------------------
>Comment By: Neal Norwitz (nnorwitz)
Date: 2006-01-09 22:06
Message:
Logged In: YES
user_id=33168
Committed revision 41996.
Committed revision 41997. (2.4)
----------------------------------------------------------------------
Comment By: Michael Hudson (mwh)
Date: 2006-01-09 11:33
Message:
Logged In: YES
user_id=6656
One thing that can interfere with the shell but not in a test script is readline...
----------------------------------------------------------------------
Comment By: Georg Brandl (birkenfeld)
Date: 2006-01-09 11:17
Message:
Logged In: YES
user_id=1188172
Confirmed here too. Your test fails with unpatched HEAD when
run from regrtest (I have de_DE locale in the environment).
----------------------------------------------------------------------
Comment By: Gustavo J. A. M. Carneiro (gustavo)
Date: 2006-01-09 05:08
Message:
Logged In: YES
user_id=908
I can confirm the patch compiles and fixes the problem.
I also can't reproduce the problem except from the python
shell. Weird.
----------------------------------------------------------------------
Comment By: M.-A. Lemburg (lemburg)
Date: 2006-01-09 03:43
Message:
Logged In: YES
user_id=38388
The patch looks good.
What's strange is that if you run the snippet in Python 2.3
you don't get the assertion error (at least I don't).
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1400181&group_id=5470
More information about the Patches
mailing list