STINNER Victor <victor.stin...@haypocalc.com> added the comment:

> This issue should be fixed by r85435 ... 
> I will watch for the OSX buildbots.

I don't know if it fixes the issue, but it introduces a regression. r85442 
reverts it.

---

Revert r85435 (and r85440): decode command line arguments from utf-8

Python exits with a fatal error if the command line contains an undecodable 
argument. PyUnicode_FromString() fails at the first undecodable byte because it 
calls the error handler, but error handlers are not ready before Python 
initialization.

---

The problem is to get a function to decode a bytes string from utf-8 in main() 
(before Python initialization). Possibilities:
 - Use PyUnicode_DecodeUTF8Stateful() and tell it to not call the error handler 
but exit immediatly (return NULL). Eg. check a flag (function argument or 
global variable?) to check if we should call the error handler or not
 - Use _Py_char2wchar() and set temporary the locale to an utf-8 locale. The 
problem is to get an utf-8 locale. Is there an utf-8 locale which is always 
available?
 - Another solution?

I prefer the _Py_char2wchar() solution because I'm sure that it works before 
Python initialization.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue4388>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to