[New-bugs-announce] [issue23780] Surprising behaviour when passing list to os.path.join.
Florian Bruhin
report at bugs.python.org
Thu Mar 26 09:02:03 CET 2015
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 <report at bugs.python.org>
<http://bugs.python.org/issue23780>
_______________________________________
More information about the New-bugs-announce
mailing list