[issue42052] pathlib.Path should not call str() internally to allow inheritance

2020-10-16 Thread conchylicultor
conchylicultor added the comment: Closing this as I realize that even if this was solved, it would still not fully resolve the issue. Basically I want to control how __fspath__ and __str__ behave externally (for users), but internal fspath and str should always call `super()` -- sta

[issue42052] pathlib.Path should not call str() internally to allow inheritance

2020-10-16 Thread conchylicultor
New submission from conchylicultor : I'm writing a subclass of `pathlib.Path` with custom `__fspath__`. To prevent bad usages (users should use `os.fspath(path)` instead of `str(path)` to access the underlying path), I would like to overwrite `str`: ``` class MyPath(pathlib.PosixPath): de