Issue 1030499: os.path.join() does not raise TypeError (original) (raw)

Issue1030499

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:07 admin set github: 40928
2009-04-05 18:17:24 georg.brandl set status: open -> closednosy: + georg.brandlmessages: + resolution: rejected
2009-02-14 14:43:07 ajaksu2 set stage: test neededtype: enhancementcomponents: + Library (Lib), - Noneversions: + Python 2.7
2004-09-18 23:40:54 pfortin create