classification
Title: string format with 'n' failling with french locales
Type: behavior Stage: patch review
Components: Extension Modules Versions: Python 3.8, Python 3.7, Python 3.6
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: David Vasseur, eric.smith, licht-t
Priority: normal Keywords: patch

Created on 2018-05-12 11:30 by David Vasseur, last changed 2018-05-18 17:23 by terry.reedy.

Pull Requests
URL Status Linked Edit
PR 6861 open licht-t, 2018-05-15 15:10
Messages (4)
msg316426 - (view) Author: David Vasseur (David Vasseur) Date: 2018-05-12 11:30
Python 3.6.5 (default, Apr 14 2018, 13:17:30) 
[GCC 7.3.1 20180406] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print('{:n}'.format(int(12)))
12 <-- ok --

>>> import locale
>>> locale.setlocale(locale.LC_ALL, '')
'fr_FR.UTF-8'
>>> print('{:n}'.format(int(12)))
(empty) <-- error --
'{:n}'.format(int(12))
'Àæ' <-- error --

please note that with >999 numbers, it's working fine:
>>> print('{:n}'.format(int(1000)))
1 000 <-- ok --
msg316442 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2018-05-13 01:56
After locale.setlocale(locale.LC_ALL, ''), what does local.localeconv() return?
msg316456 - (view) Author: David Vasseur (David Vasseur) Date: 2018-05-13 09:19
>>> locale.localeconv()
{'int_curr_symbol': 'EUR ', 'currency_symbol': '€', 'mon_decimal_point': ',', 'mon_thousands_sep': '\u202f', 'mon_grouping': [3, 0], 'positive_sign': '', 'negative_sign': '-', 'int_frac_digits': 2, 'frac_digits': 2, 'p_cs_precedes': 0, 'p_sep_by_space': 1, 'n_cs_precedes': 0, 'n_sep_by_space': 1, 'p_sign_posn': 1, 'n_sign_posn': 1, 'decimal_point': ',', 'thousands_sep': '\u202f', 'grouping': [3, 0]}
msg316548 - (view) Author: Licht Takeuchi (licht-t) * Date: 2018-05-14 18:46
I am working on this and have found why this is happening.
I'll make PR in few days.
History
Date User Action Args
2018-05-18 17:23:26terry.reedysetversions: + Python 3.7, Python 3.8
2018-05-15 15:10:09licht-tsetkeywords: + patch
stage: patch review
pull_requests: + pull_request6535
2018-05-14 18:46:42licht-tsetnosy: + licht-t
messages: + msg316548
2018-05-13 09:19:40David Vasseursetmessages: + msg316456
2018-05-13 01:56:12eric.smithsetnosy: + eric.smith
messages: + msg316442
2018-05-12 11:30:06David Vasseurcreate