| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Tested the PR on a system with glibc 2.26.90 where the test was failing, and it successfully passed. |
Sorry, something went wrong.
|
Ping myself. |
Sorry, something went wrong.
|
I rebased my changed, fixed a bug in error handler (restore the LC_CTYPE if RESULT fails), and added documentation. |
Sorry, something went wrong.
|
I completed my change to also fix str.format(): # Bug in Python 3.6
vstinner@apu$ env -i python3 -c 'import locale; locale.setlocale(locale.LC_ALL, "fr_FR"); locale.setlocale(locale.LC_NUMERIC, "es_MX.utf8"); print(ascii(f"{1000:n}"))'
'1\xe2\x80\x89000'
# Fixed in master
vstinner@apu$ env -i ./python -c 'import locale; locale.setlocale(locale.LC_ALL, "fr_FR"); locale.setlocale(locale.LC_NUMERIC, "es_MX.utf8"); print(ascii(f"{1000:n}"))'
'1\u2009000'
|
Sorry, something went wrong.
|
I completed my change to also fix decimal.Decimal. |
Sorry, something went wrong.
|
@vstinner Cool, but could you make the decimal part a separate PR? |
Sorry, something went wrong.
Would you mind to elaborate? Why should it be fixed in a different PR? |
Sorry, something went wrong.
|
On Wed, Jan 10, 2018 at 09:13:57AM -0800, Victor Stinner wrote:
Would you mind to elaborate? Why should it be fixed in a different PR?
Because we both thought that this issue was not very important a couple
of years ago and I want to look at it and run my own tests.
|
Sorry, something went wrong.
Well, something changed in the meanwhile, the glibc: https://bugs.python.org/issue31900#msg305227 Anyway, I reverted changes on the decimal module. |
Sorry, something went wrong.
* Add _Py_GetLocaleconvNumeric() function: decode decimal_point and thousands_sep fields of localeconv() from the LC_NUMERIC encoding, rather than decoding from the LC_CTYPE encoding. * Modify locale.localeconv() and "n" formatter of str.format() (for int, float and complex to use _Py_GetLocaleconvNumeric() internally.
Sorry, something went wrong.
|
Ah, moreover I avoided the setlocale() if LC_NUMERIC = LC_CTYPE. |
Sorry, something went wrong.
The setlocale() is only done in a rare use case (LC_NUMERIC and LC_CTYPE have a different encoding), it's safe to call localeconv() in all other cases.
) * Add _Py_GetLocaleconvNumeric() function: decode decimal_point and thousands_sep fields of localeconv() from the LC_NUMERIC encoding, rather than decoding from the LC_CTYPE encoding. * Modify locale.localeconv() and "n" formatter of str.format() (for int, float and complex to use _Py_GetLocaleconvNumeric() internally. (cherry picked from commit cb064fc)
| Back | FazBrowse Home | New Git URL |
Decode localeconv() numeric fields like thousands_sep from the
LC_NUMERIC encoding, rather than decoding from the LC_CTYPE encoding.
https://bugs.python.org/issue31900