New submission from Florian Bruhin:
I just accidentally passed a list (instead of unpacking it) to os.path.join. I
was surprised when it just returned the list unmodified:
>>> os.path.join([1, 2, 3])
[1, 2, 3]
Looking at the source, it simply returns the first argument (path = a; ...;
return path) when the '*p' part is empty.
I think a "genericpath._check_arg_types('join', a)" or similiar should be added
at the top, or it should ensure the "*p" part is not empty (as the docstring
says "two or more pathname components").
----------
components: Library (Lib)
messages: 239314
nosy: The Compiler, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Surprising behaviour when passing list to os.path.join.
type: behavior
versions: Python 3.4
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue23780>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com