Serhiy Storchaka added the comment: Error message for ntpath is improved in 3.5.
>>> import ntpath >>> ntpath.join([1, 2, 3]) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/serhiy/py/cpython/Lib/ntpath.py", line 111, in join genericpath._check_arg_types('join', path, *paths) File "/home/serhiy/py/cpython/Lib/genericpath.py", line 143, in _check_arg_types (funcname, s.__class__.__name__)) from None TypeError: join() argument must be str or bytes, not 'list' I'm not sure that the case of single argument in posixpath.join needs a fix. First, any argument checks have a cost. Second, currently os.path works with string-like objects if they implement enough string methods. But David's proposition looks enough harmless (but this line should be added inside the try block). Do you want to add tests David? If apply it to posixpath, it should by applied to ntpath too, because currently ntpath.join doesn't raise an exceptions for empty list. > (aside: the isinstance check in _get_sep looks like a bug report waiting to > happen...it will do the wrong thing if passed a bytearray or memoryview...) It is documented that os.path only works with strings and bytes objects. It also can work with str-like objects if lucky. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue23780> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com