Issue 1400181: unicode formats floats according to locale (original) (raw)

This issue has been migrated to GitHub: https://github.com/python/cpython/issues/42777

classification

Title: unicode formats floats according to locale
Type: Stage:
Components: Interpreter Core Versions: Python 2.4

process

Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: nnorwitz Nosy List: georg.brandl, gustavo, lemburg, mwh, nnorwitz
Priority: normal Keywords: patch

Created on 2006-01-09 09:02 by nnorwitz, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
uformat.patch nnorwitz,2006-01-09 09:02 v1
Messages (7)
msg49279 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2006-01-09 09:02
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.
msg49280 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2006-01-09 11:43
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).
msg49281 - (view) Author: Gustavo J. A. M. Carneiro (gustavo) * Date: 2006-01-09 13:08
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.
msg49282 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2006-01-09 19:17
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).
msg49283 - (view) Author: Michael Hudson (mwh) (Python committer) Date: 2006-01-09 19:33
Logged In: YES user_id=6656 One thing that can interfere with the shell but not in a test script is readline...
msg49284 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2006-01-10 06:06
Logged In: YES user_id=33168 Committed revision 41996. Committed revision 41997. (2.4)
msg49285 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2006-01-10 06:08
Logged In: YES user_id=33168 mwh, good point. I need to keep that in mind. mal, that's an interesting note about 2.3. Same for me, it works. I guess unicode formatting changed between 2.3 and 2.4.
History
Date User Action Args
2022-04-11 14:56:14 admin set github: 42777
2006-01-09 09:02:40 nnorwitz create