[issue34311] locale.format() and locale.format_string() cast Decimals to float

2021-04-12 Thread Stéphane Wirtel
Stéphane Wirtel added the comment: I have merged the PR, thank you to Cédric for the PR, and thank you to Steve for his review. -- resolution: -> fixed stage: commit review -> resolved status: open -> closed ___ Python tracker

[issue34311] locale.format() and locale.format_string() cast Decimals to float

2021-04-12 Thread Stéphane Wirtel
Stéphane Wirtel added the comment: New changeset e126547c070fbc080562abb08e16a2c93a8a805d by Cédric Krier in branch 'master': bpo-34311: Add locale.localize (GH-15275) https://github.com/python/cpython/commit/e126547c070fbc080562abb08e16a2c93a8a805d -- nosy: +matrixise

[issue34311] locale.format() and locale.format_string() cast Decimals to float

2021-04-12 Thread Stéphane Wirtel
Change by Stéphane Wirtel : -- versions: +Python 3.10 -Python 3.8 ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue34311] locale.format() and locale.format_string() cast Decimals to float

2020-01-11 Thread Steve Holden
Steve Holden added the comment: Verified. Methododology: 1. Copied test_localise.py from the PR into a master checkout. 2. Added a null locale.localize. 3. Verified that all new tests failed. .. code-block:: Ran 64 tests in 0.023s FAILED (errors=4, skipped=4) (base) blockhead:cpython

[issue34311] locale.format() and locale.format_string() cast Decimals to float

2020-01-10 Thread Cédric Krier
Cédric Krier added the comment: For me, the name was natural as it is the reverse operation of the existing delocalize method. -- ___ Python tracker ___

[issue34311] locale.format() and locale.format_string() cast Decimals to float

2020-01-09 Thread Inada Naoki
Inada Naoki added the comment: Does the name "locale.localize" have some origin? I feel the name doesn't represent well about it is for formatting numeric based on LC_NUMERIC. -- nosy: +inada.naoki ___ Python tracker

[issue34311] locale.format() and locale.format_string() cast Decimals to float

2019-08-14 Thread Cédric Krier
Cédric Krier added the comment: I think we can solve this issue like I solved issue13918 by providing a locale.localize() method which does the formatting as locale.format_string does but using the already formatted string. I created PR-15275 which implements it and also use the new format

[issue34311] locale.format() and locale.format_string() cast Decimals to float

2019-08-14 Thread Cédric Krier
Change by Cédric Krier : -- pull_requests: +14997 pull_request: https://github.com/python/cpython/pull/15275 ___ Python tracker ___

[issue34311] locale.format() and locale.format_string() cast Decimals to float

2018-08-04 Thread James Emerton
James Emerton added the comment: It looks like a bot got a bit excited when I mentioned this issue in the PR for bpo-33731. I unlinked the PR but this issue still got flagged for review. -- ___ Python tracker

[issue34311] locale.format() and locale.format_string() cast Decimals to float

2018-08-04 Thread James Emerton
Change by James Emerton : -- pull_requests: -8166 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue34311] locale.format() and locale.format_string() cast Decimals to float

2018-08-04 Thread James Emerton
Change by James Emerton : -- keywords: +patch pull_requests: +8166 stage: -> patch review ___ Python tracker ___ ___

[issue34311] locale.format() and locale.format_string() cast Decimals to float

2018-08-01 Thread James Emerton
James Emerton added the comment: Certainly adding another letter to the format spec would solve my issue and would in fact be somewhat preferable to using local.format directly. I think this could be fixed in the locale module by transforming the format spec and using new-style formatting,

[issue34311] locale.format() and locale.format_string() cast Decimals to float

2018-08-01 Thread Eric V. Smith
Eric V. Smith added the comment: Would my suggestion in #33731 of adding another letter in the format spec for float and decimal.Decimal solve your problem? I guess if you're using monetary=True you'd need two additional letters: like 'f' but locale aware, and like 'f' but locale aware and

[issue34311] locale.format() and locale.format_string() cast Decimals to float

2018-08-01 Thread Eric V. Smith
Change by Eric V. Smith : -- nosy: +eric.smith ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue34311] locale.format() and locale.format_string() cast Decimals to float

2018-08-01 Thread James Emerton
New submission from James Emerton : We use locale.format('%.2f', x, True) to convert Decimal values to strings for display. Unfortunately, the locale module is using %-formatting to generate the initial string before applying locale specific formatting. As a result, any value which cannot be