[Patches] [ python-Patches-798145 ] nl_langinfo(RADIXCHAR) wrong

SourceForge.net noreply at sourceforge.net
Thu Sep 4 12:27:02 EDT 2003


Patches item #798145, was opened at 2003-08-31 16:12
Message generated for change (Comment added) made by loewis
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=798145&group_id=5470

Category: Modules
Group: Python 2.3
>Status: Closed
>Resolution: Accepted
Priority: 5
Submitted By: Jeff Epler (jepler)
Assigned to: Martin v. Löwis (loewis)
Summary: nl_langinfo(RADIXCHAR) wrong

Initial Comment:
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.  

----------------------------------------------------------------------

>Comment By: Martin v. Löwis (loewis)
Date: 2003-09-04 20:27

Message:
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



----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2003-08-31 17:13

Message:
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.

----------------------------------------------------------------------

Comment By: Jeff Epler (jepler)
Date: 2003-08-31 16:15

Message:
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()

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=798145&group_id=5470



More information about the Patches mailing list