Created on 2019-08-14.16:03:18 by ced, last changed 20 months ago by roundup-bot.
New changeset 8f12d76dbe98 by Cédric Krier in branch '5.4': Use locale.localize() and new format to format Decimal https://hg.tryton.org/tryton/rev/8f12d76dbe98 New changeset b848cfab6725 by Cédric Krier in branch '5.2': Use locale.localize() and new format to format Decimal https://hg.tryton.org/tryton/rev/b848cfab6725 New changeset 230d7bc47b71 by Cédric Krier in branch '5.0': Use locale.localize() and new format to format Decimal https://hg.tryton.org/tryton/rev/230d7bc47b71
New changeset faacf8578e9a by Cédric Krier in branch 'default': Use locale.localize() and new format to format Decimal https://hg.tryton.org/tryton-env/rev/faacf8578e9a
New changeset bfb8b9a6d64d by Cédric Krier in branch 'default': Use locale.localize() and new format to format Decimal https://hg.tryton.org/tryton/rev/bfb8b9a6d64d
I'm quite tired to wait for inclusion in Python. I think we can take the risk to apply the review before inclusion. At worst, it is never applied so there will be no collision. Otherwise it is applied with a different implementation (not likely) but then we could issue a bugfix patch if needed.
Here is review282011002 but I prefer to wait until the method is included in Python.
We use locale.format() to format the Decimal (and float) with the formatter '%.*f'. The problem is that internally Python convert the Decimal into float and than format it. So we have a loose of precision which can have bad result. E.g: >>> locale.format('%.*f', (16, Decimal('1.15'))) '1.1499999999999999' This was reported on https://bugs.python.org/issue34311 And I made a proposal https://github.com/python/cpython/pull/15275 to add a new method locale.localize() in the stdlib. I propose to monkey patch locale to include this method and to use it.
keyword: - backport
|2020-01-20 11:26:59||roundup-bot||set||messages: + msg54923|
|2020-01-20 11:26:52||roundup-bot||set||status: testing -> resolved|
nosy: + roundup-bot
messages: + msg54922
messages: + msg54851
|2020-01-13 23:43:22||ced||set||messages: + msg54835|
keyword: + backport
messages: + msg51289
|2019-08-14 16:07:36||ced||set||status: in-progress -> testing|
messages: + msg51288
keyword: + review
Showing 10 items. Show all history (warning: this could be VERY long)