[Python-Dev] Removal of Win32 ANSI API

Hirokazu Yamamoto ocean-city at m2.ccsnet.ne.jp
Fri Nov 26 17:33:50 CET 2010


On 2010/11/14 9:06, Victor Stinner wrote:
> Yes, but how do you check if the input argument is a bytes or a str object
> with your PyArg_Parse converter? You should use "O" format and manually
> convert it to unicode, and then convert the result back to bytes (if the input
> was bytes). It don't think that it makes the code shorter.
>
> The code is currently working. The question is if we have to drop the ANSI API
> now, later or never. It looks like the decision moves to "later" (deprecate in
> 3.2, remove in 3.3). I still think that drop now doesn't really hurt.
>
> Victor

Humble thoughts...
Is it possible a conversion from bytes (ANSI) to unicode fails on
windows? If not, is it allowed to convert to unicode with
PyUnicode_FSDecoder if function doesn't return str? For example, 
os.stat() takes str as arguments but doesn't return str.

# I noticed win_readlink() in Modules/posixmodule.c already unicode
# only. Maybe not so much problem? ;-)


More information about the Python-Dev mailing list