[issue11619] On Windows, don't encode filenames in the import machinery
report at bugs.python.org
Mon Mar 21 00:58:51 CET 2011
New submission from STINNER Victor <victor.stinner at haypocalc.com>:
With #3080, Python 3.3 does now manipulate module paths and names as Unicode in the import machinery. But in 3 remaining places, it does encode filenames (to the ANSI code page):
It should pass directly the PyObject* (instead of a char*) to _PyImport_GetDynLoadFunc(), but only on Windows (we may change the function name for Windows). _PyImport_GetDynLoadFunc() of dynload_win.c has to be patched to use the Unicode API (eg. LoadLibraryEx => LoadLibraryExW).
The problem is to implement open_exclusive() for Windows using Unicode. open_exclusive() uses open() on Windows, but open() expects the filename as a byte string. We may use _Py_fopen() (_wfopen), but this function doesn't have an option to open the file in exclusive mode (O_EXCL flag). GNU has an extension: "x" flag in the file mode, but Windows doesn't support it.
The file is passed to marshal functions like PyMarshal_WriteLongToFile(), and so the file have to be a FILE*.
=> covered by the issue #10785.
components: Interpreter Core, Unicode, Windows
nosy: amaury.forgeotdarc, haypo, pitrou
title: On Windows, don't encode filenames in the import machinery
versions: Python 3.3
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list