[issue39899] `pathlib.Path.expanduser()` does not call `os.path.expanduser()`

Barney Gale report at bugs.python.org
Sun Mar 8 05:47:00 EDT 2020


Barney Gale <barney.gale at gmail.com> added the comment:

I see no reason for the duplication, and I can point to one concrete bug affecting your re-implementation of `expanduser` that doesn't affect the original, i.e. that a `KeyError` is raised on Windows when `"USERNAME"` is not present in `os.environ`, whereas all similar cases raise `RuntimeError`. These sorts of issues sneak in when you duplicate code - better to stick with the battle-hardened version rather than an inherently risky rewrite.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39899>
_______________________________________


More information about the Python-bugs-list mailing list