]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
GH-76846, GH-85281: Call `__new__()` and `__init__()` on pathlib subclasses (GH-102789)
authorBarney Gale <barney.gale@gmail.com>
Mon, 3 Apr 2023 18:57:11 +0000 (19:57 +0100)
committerGitHub <noreply@github.com>
Mon, 3 Apr 2023 18:57:11 +0000 (19:57 +0100)
commit11c302055a2aab5373c2829d1a8610a64e72ab24
tree1d6066d3aa18e16fea55587d69cb3257ee9521a1
parent2a721258a199e9bcdcee2069719ad9c8f8c0d030
GH-76846, GH-85281: Call `__new__()` and `__init__()` on pathlib subclasses (GH-102789)

Fix an issue where `__new__()` and `__init__()` were not called on subclasses of `pathlib.PurePath` and `Path` in some circumstances.

Paths are now normalized on-demand. This speeds up path construction, `p.joinpath(q)`, and `p / q`.

Co-authored-by: Steve Dower <steve.dower@microsoft.com>
Lib/pathlib.py
Lib/test/test_pathlib.py
Misc/NEWS.d/next/Library/2023-03-17-19-14-26.gh-issue-76846.KEamjK.rst [new file with mode: 0644]