[Python-Dev] Is Py_WIN_WIDE_FILENAMES still alive?

ocean ocean at m2.ccsnet.ne.jp
Mon Apr 28 08:32:59 CEST 2008

> I believe the macro should be removed, as Python currently assumes Unicode
> APIs are available in a number of places.

My +1 for removal. Even 2.5 cannot be compiled without this macro, probably
no one is using this.

> This consistent with the versions
> of Windows Python currently supports.  It is possible that patches would
> accepted which enable Python to be built without this functionality - in
> which case the next-best behavior would probably be to convert Unicode to
> MBCS encoded strings and call the *A versions of the API.  Looking at the
> history for posixmodule.c etc will offer some clues as to how this could
> best be done.

One problem with removal, PyArg_ParseTuple doesn't have option to convert
to unicode (like "et" exists for unicode -> 8bit char buffer), so it's
harder to
report argument error.

>>> os.rename(4, 2)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: rename() argument 1 must be string, not int

/* After removal of *A win32 APIs */

if (PyArg_ParseTuple("OO:rename", &o1, &o2)) {
    convert_to_unicode(&o1); /* if these methods failed, should we report
same error above
    convert_to_unicode(&o2);  * by ourselves? */

More information about the Python-Dev mailing list