This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: os.path.normpath change between 3.11.0a2 and 3.11.0a3+
Type: Stage: resolved
Components: Library (Lib) Versions: Python 3.11
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: christian.heimes, hugovk, neonene, steve.dower
Priority: release blocker Keywords: patch

Created on 2021-12-30 19:38 by hugovk, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 30362 merged neonene, 2022-01-03 17:37
Messages (8)
msg409384 - (view) Author: Hugo van Kemenade (hugovk) * (Python triager) Date: 2021-12-30 19:38
The behaviour of os.path.normpath appears to have changed between Python 3.10/Python 3.11.0a2 and 3.11.0a3+.

I don't see anything mentioned in https://docs.python.org/3.11/whatsnew/3.11.html

Is this intentional?


Old behaviour:

Python 3.10.1 (v3.10.1:2cd268a3a9, Dec  6 2021, 14:28:59) [Clang 13.0.0 (clang-1300.0.29.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from os.path import normpath
>>> normpath('handbook/../../Tests/image.png')
'../Tests/image.png'
>>>


Python 3.11.0a2 (main, Dec 30 2021, 21:22:15) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from os.path import normpath
>>> normpath('handbook/../../Tests/image.png')
'../Tests/image.png'
>>>


New behaviour:

Python 3.11.0a3+ (heads/main:af6b406, Dec  9 2021, 15:34:48) [Clang 13.0.0 (clang-1300.0.29.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from os.path import normpath
>>> normpath('handbook/../../Tests/image.png')
'Tests/image.png'
>>>


Python 3.11.0a3+ (heads/main:8d7644f, Dec 30 2021, 21:32:51) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from os.path import normpath
>>> normpath('handbook/../../Tests/image.png')
'Tests/image.png'
>>>

(Found in https://github.com/sphinx-doc/sphinx/issues/10030.)
msg409386 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2021-12-30 20:03
The issue could be related to 99fcf1505218464c489d419d4500f126b6d6dc28 / bpo-45582.
msg409390 - (view) Author: Hugo van Kemenade (hugovk) * (Python triager) Date: 2021-12-30 21:42
git bisect between v3.11.0a2 and v3.11.0a3 points to the same commit, 99fcf1505218464c489d419d4500f126b6d6dc28.
msg409419 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2021-12-31 13:36
Yep, it's a bug and should be fixed.

I'm still not back coding yet, but I'll get to it once I am if nobody else gets there first. This is going to affect getpath.py in the native implementation, so it ought to be fixed there (and we need tests for this case, since it's apparently a gap).
msg409506 - (view) Author: Hugo van Kemenade (hugovk) * (Python triager) Date: 2022-01-02 17:05
Here's a branch with a passing ntpath.normpath test and a failing posixpath.normpath test:

https://github.com/hugovk/cpython/tree/issue-46208-tests

https://github.com/hugovk/cpython/commit/d7e8da179adce51a8f63d2dbd062a272dda826bc
msg409646 - (view) Author: neonene (neonene) * Date: 2022-01-04 03:55
>Here's a branch with a passing ntpath.normpath test and a failing posixpath.normpath test:

I took the test cases for my PR, thanks.
On Windows machine, ntpath fails and posixpath passes. It seems that the passing one is tested with pure python code.
msg409893 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2022-01-06 18:10
I'm happy with PR 30362 now - any other comments before we merge?
msg409901 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2022-01-06 19:13
New changeset 9c5fa9c97c5c5336e60e4ae7a2e6e3f67acedfc7 by neonene in branch 'main':
bpo-46208: Fix normalization of relative paths in _Py_normpath()/os.path.normpath (GH-30362)
https://github.com/python/cpython/commit/9c5fa9c97c5c5336e60e4ae7a2e6e3f67acedfc7
History
Date User Action Args
2022-04-11 14:59:54adminsetgithub: 90366
2022-01-06 19:13:47steve.dowersetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2022-01-06 19:13:28steve.dowersetmessages: + msg409901
2022-01-06 18:10:06steve.dowersetmessages: + msg409893
2022-01-04 03:55:29neonenesetmessages: + msg409646
2022-01-03 17:37:16neonenesetkeywords: + patch
nosy: + neonene

pull_requests: + pull_request28576
stage: patch review
2022-01-02 17:05:33hugovksetmessages: + msg409506
2021-12-31 13:36:22steve.dowersetpriority: normal -> release blocker

messages: + msg409419
2021-12-30 21:42:14hugovksetmessages: + msg409390
2021-12-30 20:03:35christian.heimessetnosy: + christian.heimes, steve.dower
messages: + msg409386
2021-12-30 19:38:30hugovkcreate