Message375030
The workaround is to override _init(), which I agree is not desirable.
This is the relevant code in PurePath, which is the super class of PurePosixPath:
@classmethod
def _from_parsed_parts(cls, drv, root, parts, init=True):
self = object.__new__(cls)
self._drv = drv
self._root = root
self._parts = parts
if init:
self._init()
return self
...
def _init(self):
# Overridden in concrete Path
pass
To me, the clean way to get the desired behavior seems like it would be to have _init() call self.__init__().
def _init(self):
# Overridden in concrete Path
self.__init__()
This fixes p.parent, but GithubPath() ends up calling GithubPath.__init__() twice – the first time by PurePath.__new__() calling PurePath._init() and the second time by the GithubPath object creation. |
|
Date |
User |
Action |
Args |
2020-08-08 01:36:03 | Jeffrey.Kintscher | set | recipients:
+ Jeffrey.Kintscher, pitrou, conchylicultor |
2020-08-08 01:36:03 | Jeffrey.Kintscher | set | messageid: <1596850563.09.0.385831243835.issue41109@roundup.psfhosted.org> |
2020-08-08 01:36:03 | Jeffrey.Kintscher | link | issue41109 messages |
2020-08-08 01:36:02 | Jeffrey.Kintscher | create | |
|