[Pythonmac-SIG] How badly is _locale broken?

Bob Ippolito bob at redivi.com
Wed Dec 29 11:48:35 CET 2004


On Dec 29, 2004, at 5:32 AM, Ronald Oussoren wrote:

> On 29-dec-04, at 11:23, Bob Ippolito wrote:
>
>> On Dec 29, 2004, at 4:50 AM, Ronald Oussoren wrote:
>>
>>> On 28-dec-04, at 23:11, Brett C. wrote:
>>>
>>>> I am planning to attempt to fix the _locale module (which 'locale' 
>>>> itself imports and uses) for OS X.  As of this exact moment I am 
>>>> planning just fixing localeconv (thanks to CFNumberFormatter and 
>>>> setlocale still at least storing the supposed locale, even if it 
>>>> does ignore it), but I realized other stuff might be broken.
>>>>
>>>> Since I never personally use the module, does anyone know the 
>>>> extent of the breakage?  Obviously I would rather just have to fix 
>>>> localeconv and keep my life simple, but if it is more extensive I 
>>>> can see what I can do.
>>>
>>> Not linking with the CoreServices and Foundation frameworks would do 
>>> the trick. That might cause problems elsewhere though :-(.
>>
>> I think someone said this is fixed on 10.4, so you can just wait a 
>> while and it'll probably fix itself using the generic unix code.
>>
>> Yes, not linking to CoreFoundation will cause problems, because 
>> *something* will inevitably link to CF.  For example, the py2app 
>> bootstrap will link to CF.  A bunch of the extension modules in 
>> MacPython also independently link to CF-using frameworks.
>
> I know that. But not linking with CoreServices should fix _locale for 
> python scripts that don't use mac-specific features.

Well, my patch to remove all non-libSystem dependencies from the Python 
core was accepted for Python 2.4, so we are already at this point.  
However, the mac toolbox functions can lazily import CF-using modules.  
I think the core probably uses some of these functions.  Last I 
remember, the locale module itself linked to CF (directly or 
indirectly) so it could guess what the current locale should be :)

> The correct fix would probably use CFLocale to implement the _locale 
> module on OSX.

Yes, that would be a good fix.

Alternatively, we could just punt on the issue and say "you need to use 
10.X in order to have a working locale module", where 10.X is the 
version that Apple fixes CF.  X is obviously greater than 3, but I 
don't think it will be much greater.  It's been broken for this long, 
and Brett C. said he doesn't use the locale module, so it may be too 
much effort for too little reward.

-bob



More information about the Pythonmac-SIG mailing list