[issue2173] Python fails silently on bad locale
Mark Dickinson
report at bugs.python.org
Mon Dec 8 17:23:54 CET 2008
Mark Dickinson <dickinsm at gmail.com> added the comment:
I think I've traced the 'no output' problem back to the device_encoding
function in Modules/posixmodule.c. The problem occurs when this function
is called to try to get the encoding for stdout.
On my machine, if I do:
LC_CTYPE="UTF-8" ./python.exe
then the nl_langinfo call in device_encoding returns an empty string. If
I do
LC_CTYPE="bogus" ./python.exe
then it returns "US-ASCII"
and if I do
LC_CTYPE="en_US.UTF-8" ./python.exe
then it returns "UTF-8".
In the first case (where the encoding is set to ""), any subsequent
attempts to send anything to stdout result in a LookupError with the
message "unknown encoding". But of course, since this exception message
is itself sent to stdout (or possibly stderr?) the same problem occurs
again and we just don't see any output.
I don't yet know why this causes the module build to fail, or why exit()
doesn't work.
I think we should try to get this fixed before 3.0.1. Any help would be
welcomed.
----------
priority: normal -> critical
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue2173>
_______________________________________
More information about the Python-bugs-list
mailing list