This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: nl_langinfo(RADIXCHAR) wrong
Type: Stage:
Components: Extension Modules Versions: Python 2.3
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: loewis Nosy List: jepler, loewis
Priority: normal Keywords: patch

Created on 2003-08-31 14:12 by jepler, last changed 2022-04-10 16:10 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
nl_langinfo.RADIX.patch jepler, 2003-08-31 14:12 patch for described problem
test__locale.py jepler, 2003-08-31 14:16 possible test for this bug
Messages (4)
msg44543 - (view) Author: Jeff Epler (jepler) Date: 2003-08-31 14:12
See
http://google.com/groups?as_umsgid=m3d6empnsq.fsf%40mira.informatik.hu-berlin.de

The following code prints RADIXCHAR from the C locale, not from the chosen locale (fr_FR and many other european locales should give ','

from locale import setlocale, LC_NUMERIC, nl_langinfo, RADIXCHAR
setlocale(LC_NUMERIC, "fr_FR")
print nl_langinfo(RADIXCHAR)

The patch assumes that the value nl_langinfo() should give for RADIXCHAR and THOUSEP are the same as localeconv()['decimal_point'] and ['thousands_sep'].  It assumes that if RADIXCHAR is defined then THOUSEP is (just as above code does), 

How can I write a test for this?  Presumably many platforms (Windows?) won't provide a complete set of locales.  
msg44544 - (view) Author: Jeff Epler (jepler) Date: 2003-08-31 14:15
Logged In: YES 
user_id=2772

Here's one approach to testing: I created a list of all the locales that my system supports which have a differing RADIXCHAR.  The test is intended to try all of them, skip if none are found, and fail if any are found but nl_langinfo() disagrees with localeconv()
msg44545 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2003-08-31 15:13
Logged In: YES 
user_id=21627

On non-Posix systems (like Windows), nl_langinfo is not
available in the first place, so no need to worry about that.

I think the patch is fine.
msg44546 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2003-09-04 18:27
Logged In: YES 
user_id=21627

Thanks for the patch. Committed as

test__locale.py 1.1
_localemodule.c 2.42
NEWS 1.831.4.30
_localemodule.c 2.40.4.2
History
Date User Action Args
2022-04-10 16:10:55adminsetgithub: 39156
2003-08-31 14:12:36jeplercreate