PyUnicode_EncodeFS() raises an exception if _Py_wchar2char() fails

* Add error_pos optional argument to _Py_wchar2char()
 * PyUnicode_EncodeFS() raises a UnicodeEncodeError or MemoryError if
   _Py_wchar2char() fails
This commit is contained in:
Victor Stinner 2010-11-08 22:43:46 +00:00
parent 0cfba09b09
commit 2f02a51135
4 changed files with 37 additions and 11 deletions

View file

@ -646,7 +646,7 @@ Py_Main(int argc, wchar_t **argv)
if (fp == NULL) {
char *cfilename_buffer;
const char *cfilename;
cfilename_buffer = _Py_wchar2char(filename);
cfilename_buffer = _Py_wchar2char(filename, NULL);
if (cfilename_buffer != NULL)
cfilename = cfilename_buffer;
else