Message375053
On Windows:
Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:37:02) [MSC v.1924 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import ntpath
>>> ntpath.relpath('foo ', 'foo')
'.'
On macOS:
Python 3.8.5 (v3.8.5:580fbb018f, Jul 20 2020, 12:11:27)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ntpath
>>> ntpath.relpath('foo ', 'foo')
'..\\foo '
I stumbled into this issue when troubleshooting an [issue in a Setuptools PR](https://github.com/pypa/setuptools/pull/2305#issuecomment-670946965).
I suspect the Windows version is using some API that strips whitespace from the filename before performing a relative path. However, when using relpath to detect characters after a common path, stripping the whitespace can cause problems.
I wouldn't expect Windows to be performing normalization of paths in relpath, but it seems it does. If this behavior is by design and has a good reason, that behavior should be mirrored in the non-Windows implementation. |
|
Date |
User |
Action |
Args |
2020-08-08 17:34:38 | jaraco | set | recipients:
+ jaraco, paul.moore, tim.golden, zach.ware, steve.dower |
2020-08-08 17:34:37 | jaraco | set | messageid: <1596908077.96.0.398710638995.issue41509@roundup.psfhosted.org> |
2020-08-08 17:34:37 | jaraco | link | issue41509 messages |
2020-08-08 17:34:37 | jaraco | create | |
|