[New-bugs-announce] [issue17556] os.path.join() converts None to '' by default

Muhammad Hallaj Subery report at bugs.python.org
Wed Mar 27 08:05:17 CET 2013


New submission from Muhammad Hallaj Subery:

I think the default behavior of os.path.join() when None is passed as the first argument should be to translate it to '' by default.

>>> import os
>>> os.path.join(None, 'somewhere')
'somewhere'

vs the current

>>> import os
>>> os.path.join(None, 'somewhere')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/posixpath.py", line 68, in join
    elif path == '' or path.endswith('/'):
AttributeError: 'NoneType' object has no attribute 'endswith'

----------
components: Library (Lib)
messages: 185316
nosy: hallaj
priority: normal
severity: normal
status: open
title: os.path.join() converts None to '' by default
type: enhancement
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5

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


More information about the New-bugs-announce mailing list