Title: os.path.realpath preserves the trailing backslash on Windows in python 3.6.7 and python 3.7.1
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.6
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: wouyang, xtreak
Priority: normal Keywords:

Created on 2018-11-10 00:15 by wouyang, last changed 2018-11-10 01:38 by eryksun. This issue is now closed.

Messages (2)
msg329574 - (view) Author: wenjun.o (wouyang) Date: 2018-11-10 00:15
The statement "os.path.realpath('C:\\Users\\')" returns different results between 3.6.6 and 3.6.7 (and between 3.7.0 and 3.7.1) on Windows.
With python 3.6.6 and 3.7.0 I got 'C:\\Users'.
With python 3.6.7 and 3.7.1 I got 'C:\\Users\\'.
Note the extra trailing backslash with python 3.6.7 and 3.7.1.

On Linux the behavior is consistent where the trailing slash in the input will be remove from the output: os.path.realpath('/home/') --> '/home'.

I think we should keep the behavior of removing trailing backslash on Windows.

msg329581 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2018-11-10 01:06
realpath aliases to abspath in Windows as I can see from the code and I think this is a regression fixed with
Date User Action Args
2018-11-10 01:38:54eryksunsetstatus: open -> closed
resolution: fixed
stage: resolved
2018-11-10 01:06:54xtreaksetnosy: + xtreak
messages: + msg329581
2018-11-10 00:15:57wouyangcreate