[Patches] [ python-Patches-1400181 ] unicode formats floats according to locale

SourceForge.net noreply at sourceforge.net
Mon Jan 9 12:43:03 CET 2006


Patches item #1400181, was opened at 2006-01-09 10:02
Message generated for change (Comment added) made by lemburg
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: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Neal Norwitz (nnorwitz)
Assigned to: Nobody/Anonymous (nobody)
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: M.-A. Lemburg (lemburg)
Date: 2006-01-09 12: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