[issue10914] Python sub-interpreter test
STINNER Victor
report at bugs.python.org
Tue Apr 26 01:27:36 CEST 2011
STINNER Victor <victor.stinner at 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 <report at bugs.python.org>
<http://bugs.python.org/issue10914>
_______________________________________
More information about the Python-bugs-list
mailing list