[New-bugs-announce] [issue17174] Posix os.path.join should raise TypeError when passed unusable type

Thomas Scrace report at bugs.python.org
Sat Feb 9 22:12:37 CET 2013


New submission from Thomas Scrace:

Currently os.path.join will raise an AttributeError if passed an argument that does not have an endswith() method.

A try/except around the offending line would let us raise a more helpful TypeError:

    except AttributeError as e:
        bad = e.args[0].split()[0]
        raise TypeError("object of type {} is not valid as a path"
        "component".format(type(bad)))

----------
components: Library (Lib)
messages: 181762
nosy: terry.reedy, thomas.scrace
priority: normal
severity: normal
status: open
title: Posix os.path.join should raise TypeError when passed unusable type
type: enhancement
versions: Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17174>
_______________________________________


More information about the New-bugs-announce mailing list