[Python-Dev] Dealing with test__locale failure on OS X before a3

Brett C. bac at OCF.Berkeley.EDU
Fri Aug 27 05:33:54 CEST 2004


Bob Ippolito wrote:

> 
> Well there are two ways to fix it:
> 
> 1) Call __setonlyClocaleconv() if it's there via weak linking or whatnot 
> around any setlocale or the like.  This will at least affect OS X 10.3, 
> I'm not sure about 10.2, and the rumor says it's fixed "now" in 10.4.
> 
> 2) Write a whole new module that uses Apple API for localization.
> 
> Obviously 2 is the "best" solution, but requires the most time.  1 is 
> easy-ish and will work reliably on all the machines that need it 
> (assuming the rumor is correct) unless Apple does something totally 
> strange and changes the behavior of a previous-release OS for reasons 
> other than security flaws :)
> 

OK, starting to sound like detecting __setonlyClocaleconv() in 
configure.in and using that info to deal with it is winning with other 
people, at least as an initial solution.  Everyone else agree with this?

I just checked and it looks like calling the function with a non-zero 
argument will force the locale back to "C" even if you just set it to a 
specific locale; so the function seems to force the locale to "C" and 
lock it down.  So it will most likely need to be called right before the 
first setlocale call made by Python (I think it is in PyInitialize() ) 
and then not call it again.

-Brett


More information about the Python-Dev mailing list