Issue2824

classification
Title: `os.path.abspath()` doesn't add drive letter to absolute paths on Windows (regression)
Type: Severity: normal
Components: Versions:
Milestone:
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: pekka.klarck
Priority: Keywords:

Created on 2019-11-04.19:25:49 by pekka.klarck, last changed 2019-11-05.11:51:11 by pekka.klarck.

Messages
msg12752 (view) Author: Pekka Klärck (pekka.klarck) Date: 2019-11-04.19:25:49
E:\>c:\jython2.7.2b2\bin\jython.exe
Jython 2.7.2b2 (v2.7.2b2:b9b60766cabe, Nov 1 2019, 07:46:45)
[Java HotSpot(TM) Client VM (Oracle Corporation)] on java1.8.0_231
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.path.abspath(r'foo\bar')
'E:\\foo\\bar'
>>> os.path.abspath(r'\foo\bar')
'\\foo\\bar'
>>>

With CPython and with Jython 2.7.0 also the latter result has the drive letter.
msg12754 (view) Author: Pekka Klärck (pekka.klarck) Date: 2019-11-05.11:51:11
This bug affects also functions that use `os.path.abspath` internally such as `os.path.relpath`:

>>> os.path.relpath(r'\foo\bar', r'c:\temp')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\jython2.7.2b2\Lib\ntpath.py", line 511, in relpath
    raise ValueError("path is on drive %s, start on drive %s"
ValueError: path is on drive , start on drive c:


The above works fine with CPython and Jython 2.7.1 and the result is `..\foo\bar`.
History
Date User Action Args
2019-11-05 11:51:11pekka.klarcksetmessages: + msg12754
2019-11-04 19:25:49pekka.klarckcreate