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? ;-)
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to