Skip to content

GH-76846, GH-85281: Call __new__() and __init__() on pathlib subclasses #102789

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Apr 3, 2023
Next Next commit
Call cls.__new__() from PurePath._from_parsed_parts()
  • Loading branch information
barneygale committed Mar 17, 2023
commit 3aee8a699ea2eaadd96155c742768b153c9d5909
4 changes: 3 additions & 1 deletion Lib/pathlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,9 @@ def _from_parts(cls, args):

@classmethod
def _from_parsed_parts(cls, drv, root, parts):
self = object.__new__(cls)
path = cls._format_parsed_parts(drv, root, parts)
self = cls(path)
self._str = path
self._drv = drv
self._root = root
self._parts = parts
Expand Down