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

Serhiy Storchaka report at bugs.python.org
Thu Apr 8 03:15:22 EDT 2021


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

AFAIK you can set arbitrary path as user home directory. So home directories of different users can even not be on the same disk, and the last component of the path can be different from the user name.

os.path.expanduser() has many flaws, and it just "guess" the home directory for other users. It is difficult to fix os.path.expanduser() due to backward compatibility, but we should do better in pathlib from start.

----------

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


More information about the Python-bugs-list mailing list