[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 <https://bugs.python.org/issue34

[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 <https://bugs.python.org/issue34311> ___ ___ 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 <https://bugs.python.org/issue34311> ___ ___ Py

[issue33731] string formatting that produces floats with preset precision while respecting locale

2018-08-01 Thread James Emerton
James Emerton added the comment: @rhettinger See #34311 about formatting Decimals using locale.format(). I'd like to see the problem fixed in one place or the other. Also, this is seems relatively straightforward to implement as it's really just a combination of the fixed precision 'f

[issue33731] string formatting that produces floats with preset precision while respecting locale

2018-08-01 Thread James Emerton
James Emerton added the comment: So far, I've implemented this for Decimal -- ___ Python tracker <https://bugs.python.org/issue33731> ___ ___ Python-bugs-list m

[issue33731] string formatting that produces floats with preset precision while respecting locale

2018-08-01 Thread James Emerton
Change by James Emerton : -- nosy: +jemerton ___ Python tracker <https://bugs.python.org/issue33731> ___ ___ Python-bugs-list mailing list Unsubscribe:

[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 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

[issue1677872] Efficient reverse line iterator

2014-04-15 Thread James Emerton
James Emerton added the comment: Attached is an implementation of BufferedReader.readprevline(), as suggested by Antoine. At this point, it seems to be working but I would like to improve the tests when a single result spans multiple chunks. I would particularly like to ensure correct