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

> The problem is the test on the "python initialization":
> PyUnicode_EncodeFSDefault / PyUnicode_DecodeFSDefaultAndSize
> check the global Py_FileSystemDefaultEncoding variable (use
> C functions if it is NULL).

The problem is a little bit more complex. interp->codecs_initialized is set to 
1 by _PyCodecRegistry_Init(), but the filesystem codec is not loaded yet. We 
need another variable: interp->fscodec_initialized.

fscodec_subinterpreter.patch fixes this issue.

Note: the patch replaces also PyErr_Print() by PyErr_PrintEx(0) to avoid a 
crash on error, if PyErr_PrintEx(0) is called before the sys module is 
initialized. For example, if 
PyModule_GetDict(_PyImport_FindBuiltin("builtins")) is NULL. Anyway, it's 
useless to set sys attributes on error, because sys is destroyed just after 
printing the error.

----------
Added file: http://bugs.python.org/file21778/fscodec_subinterpreter.patch

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

Reply via email to