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.17:52:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1412877168.66.0.458770406493.issue22587@psf.upfronthosting.co.za>
In-reply-to
Content
I just realized that even the behavior of ntpath.abspath() is inconsistent across platforms.  On Windows, ntpath.abspath(None) returns the current working directory.  On other OSs, ntpath.abspath(None) raises a TypeError.  There are two different abspath definitions in ntpath, one that uses the native Windows method (used on Windows) and one that doesn't (used everywhere else).  The two methods behave differently if the input value isn't a string.  I've tested this on OS X using Python 2.7.8 and 3.4.1:

Python 2.7.8 |Anaconda 2.1.0 (x86_64)| (default, Aug 21 2014, 15:21:46) 
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://binstar.org
>>> import ntpath
>>> ntpath.abspath(None)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/young/anaconda/envs/py278/lib/python2.7/ntpath.py", line 473, in abspath
    if not isabs(path):
  File "/Users/young/anaconda/envs/py278/lib/python2.7/ntpath.py", line 57, in isabs
    s = splitdrive(s)[1]
  File "/Users/young/anaconda/envs/py278/lib/python2.7/ntpath.py", line 114, in splitdrive
    if len(p) > 1:
TypeError: object of type 'NoneType' has no len()


Python 3.4.1 |Anaconda 2.1.0 (x86_64)| (default, Sep 10 2014, 17:24:09) 
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ntpath
>>> ntpath.abspath(None)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/young/anaconda/envs/py34/lib/python3.4/ntpath.py", line 533, in abspath
if not isabs(path):
File "/Users/young/anaconda/envs/py34/lib/python3.4/ntpath.py", line 99, in isabs
s = splitdrive(s)[1]
File "/Users/young/anaconda/envs/py34/lib/python3.4/ntpath.py", line 159, in splitdrive
if len(p) > 1:
TypeError: object of type 'NoneType' has no len()
History
Date User Action Args
2014-10-09 17:52:48KevKeatingsetrecipients: + KevKeating
2014-10-09 17:52:48KevKeatingsetmessageid: <1412877168.66.0.458770406493.issue22587@psf.upfronthosting.co.za>
2014-10-09 17:52:48KevKeatinglinkissue22587 messages
2014-10-09 17:52:48KevKeatingcreate