Tryton - Issues



Title Formatting Decimal with digits >=16
Priority bug Status testing
Superseder Nosy List ced
Type behavior Components tryton
Assigned To ced Keywords backport, review
Reviews 282011002
View: 282011002

Created on 2019-08-14.16:03:18 by ced, last changed by ced.

review282011002 updated at
msg51288 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2019-08-14.16:07:36
Here is review282011002 but I prefer to wait until the method is included in Python.
msg51287 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2019-08-14.16:03:18
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')))

This was reported on
And I made a proposal to add a new method locale.localize() in the stdlib.

I propose to monkey patch locale to include this method and to use it.
Date User Action Args
2019-08-14 16:13:42cedsetnosy: - reviewbot
keyword: + backport
2019-08-14 16:13:30reviewbotsetnosy: + reviewbot
messages: + msg51289
2019-08-14 16:07:36cedsetstatus: in-progress -> testing
reviews: 282011002
messages: + msg51288
keyword: + review
2019-08-14 16:03:18cedcreate

Showing 10 items. Show all history (warning: this could be VERY long)