Author mark.dickinson
Recipients mark.dickinson, ronaldoussoren
Date 2009-07-01.10:51:53
SpamBayes Score 2.14788e-09
Marked as misclassified No
Message-id <1246445517.38.0.373229118664.issue6393@psf.upfronthosting.co.za>
In-reply-to
Content
There was a report[1] on c.l.p. that python3 from the OS X Python 3.1 
dmg download at www.python.org/download/releases/3.1/ crashes on 
startup.  I can reproduce this with the python.org download (using the 
OS X Terminal) only with a bad locale setting:

newton:~ dickinsm$ LANG=utf-8 python3
Fatal Python error: Py_Initialize: can't initialize sys standard streams
LookupError: unknown encoding: 
Abort trap (core dumped)

The core dump isn't useful:  just lots of 'No symbol table info 
available.'

This is on OS X 10.5.7/Intel.

I can't reproduce it with either the py3k branch or the release31-maint 
branch, built from scratch.

I suspect that this has to do with the behaviour of nl_langinfo(CODESET) 
on OS X: namely, after doing (in C) setlocale(LC_CTYPE, ""), the result 
of nl_langinfo(CODESET) appears to be "UTF-8" for well-defined utf-8 
locales (e.g., 'en_US.UTF-8'), "US-ASCII" for meaningless locales (e.g., 
'invalid'), but one just gets "" for locales like 'utf-8' or 'en_US'.
This in turn affects Python's locale.getpreferredencoding function. 
See also issue 2173, which may be related.

Ronald, any ideas?

[1] http://mail.python.org/pipermail/python-list/2009-June/718255.html
History
Date User Action Args
2009-07-01 10:51:57mark.dickinsonsetrecipients: + mark.dickinson, ronaldoussoren
2009-07-01 10:51:57mark.dickinsonsetmessageid: <1246445517.38.0.373229118664.issue6393@psf.upfronthosting.co.za>
2009-07-01 10:51:55mark.dickinsonlinkissue6393 messages
2009-07-01 10:51:53mark.dickinsoncreate