[New-bugs-announce] [issue6393] OS X: python3 from python-3.1.dmg crashes at startup

Mark Dickinson report at bugs.python.org
Wed Jul 1 12:51:57 CEST 2009

New submission from Mark Dickinson <dickinsm at gmail.com>:

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 

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

assignee: ronaldoussoren
components: Interpreter Core, Macintosh
messages: 89972
nosy: marketdickinson, ronaldoussoren
severity: normal
status: open
title: OS X: python3 from python-3.1.dmg crashes at startup
type: crash
versions: Python 3.1

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list