Kevin Keating added the comment:

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()

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue22587>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to