Christoph Reiter added the comment:

Raising in case no valid path is passed seems fine to me. There are other cases 
where it fails:

python3 -c "import os; os.path.exists('\ud83d')"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.5/genericpath.py", line 19, in exists
    os.stat(path)
UnicodeEncodeError: 'utf-8' codec can't encode character '\ud83d' in position 
0: surrogates not allowed


LANG=C python3 -c "import os; os.path.exists('\xff')"       ~
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.5/genericpath.py", line 19, in exists
    os.stat(path)
UnicodeEncodeError: 'ascii' codec can't encode character '\xff' in position 0: 
ordinal not in range(128)

----------
nosy: +lazka

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29042>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to