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.

Author KevKeating
Recipients KevKeating
Date 2014-10-09.16:56:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1412873773.97.0.374832942416.issue22587@psf.upfronthosting.co.za>
In-reply-to
Content
On Windows, os.path.abspath() treats None as if it were an empty string, so os.path.abspath(None) returns the current working directory.  On Linux, os.path.abspath(None) raises an AttributeError.  With macpath, abspath(None) raises a TypeError.  I've seen this behavior with Python 2.7.3, 2.7.8, 3.2.5, and 3.4.2.

Python 3.4.2 (v3.4.2:ab2c023a9432, Oct  6 2014, 22:15:05) [MSC v.1600 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import ntpath, posixpath, macpath
>>> ntpath.abspath(None)
'C:\\Users\\Keating\\Documents'
>>> posixpath.abspath(None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\programs\Python34\lib\posixpath.py", line 357, in abspath
    if not isabs(path):
  File "C:\programs\Python34\lib\posixpath.py", line 63, in isabs
    return s.startswith(sep)
AttributeError: 'NoneType' object has no attribute 'startswith'
>>> macpath.abspath(None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\programs\Python34\lib\macpath.py", line 177, in abspath
    if not isabs(path):
  File "C:\programs\Python34\lib\macpath.py", line 49, in isabs
    return colon in s and s[:1] != colon
TypeError: argument of type 'NoneType' is not iterable

This case seems very closely related to http://bugs.python.org/issue9018, which noted a platform inconsistency in os.path.normcase.
History
Date User Action Args
2014-10-09 16:56:14KevKeatingsetrecipients: + KevKeating
2014-10-09 16:56:13KevKeatingsetmessageid: <1412873773.97.0.374832942416.issue22587@psf.upfronthosting.co.za>
2014-10-09 16:56:13KevKeatinglinkissue22587 messages
2014-10-09 16:56:13KevKeatingcreate