This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: os.path.join() does not raise TypeError
Type: enhancement Stage: test needed
Components: Library (Lib) Versions: Python 2.7
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: georg.brandl, pfortin, rhettinger
Priority: normal Keywords:

Created on 2004-09-18 23:40 by pfortin, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg60568 - (view) Author: Pierre Fortin (pfortin) Date: 2004-09-18 23:40
Within os and os.path, os.path.join() appears to be the
only function which fails to indicate a TypeError.

This was found inadvertently with:

def foo(*args):
    ...
    return os.path.join(args)   # note the missing "*"

Calling the function with:

foo('a','b')

returns:     ('a','b')

Other os & os.path functions return TypeError in this
situation.
msg60569 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2004-09-30 01:02
Logged In: YES 
user_id=80475

I'm -0 on changing this.  The code is already complex and
spread across multiple files.  It's absence of type checking
allows sting lookalikes to be used.  If there were a change,
it should probably refactor the function to use ''.join
instead of += logic.  That would detect the problem and
improve the algorithm at the same time.
msg85541 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2009-04-05 18:17
+1 for duck typing.
History
Date User Action Args
2022-04-11 14:56:07adminsetgithub: 40928
2009-04-05 18:17:24georg.brandlsetstatus: open -> closed

nosy: + georg.brandl
messages: + msg85541

resolution: rejected
2009-02-14 14:43:07ajaksu2setstage: test needed
type: enhancement
components: + Library (Lib), - None
versions: + Python 2.7
2004-09-18 23:40:54pfortincreate