[New-bugs-announce] [issue35205] os.path.realpath preserves the trailing backslash on Windows in python 3.6.7 and python 3.7.1

wenjun.o report at bugs.python.org
Fri Nov 9 19:15:57 EST 2018


New submission from wenjun.o <wouyang at outlook.com>:

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.

Thanks.

----------
components: Library (Lib)
messages: 329574
nosy: wouyang
priority: normal
severity: normal
status: open
title: os.path.realpath preserves the trailing backslash on Windows in python 3.6.7 and python 3.7.1
type: behavior
versions: Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35205>
_______________________________________


More information about the New-bugs-announce mailing list