bpo-39899: Make pathlib use os.path.expanduser() to expand home directories#18841
Conversation
|
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA). CLA MissingOur records indicate the following people have not signed the CLA: For legal reasons we need all the people listed to sign the CLA before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue. If you have recently signed the CLA, please wait at least one business day You can check yourself to see if the CLA has been received. Thanks again for the contribution, we look forward to reviewing it! |
0e82850 to
b9b9801
Compare
b9b9801 to
2a49892
Compare
|
I think this one is okay, but I need to spend a bit more time reading through it (it's pretty late here now and I'm too tired). |
|
Yep understood! If it helps, the rough process here is:
|
2a49892 to
d7074c2
Compare
|
Rebased to fix conflicts |
…e directories if the basename of the current user's home directory doesn't match their username. This makes `ntpath.expanduser()` match `pathlib.Path.expanduser()` in this regard, and is more in line with `posixpath.expanduser()`'s cautious approach. Also remove the near-duplicate implementation of `expanduser()` in pathlib, and by doing so fix a bug where KeyError could be raised when expanding another user's home directory.
os.path.expanduser(): don't guess other Windows users' home directories if the basename of the current user's home directory doesn't match their username.
This makes
ntpath.expanduser()matchpathlib.Path.expanduser()in this regard, and is more in line withposixpath.expanduser()'s cautious approach.Also remove the near-duplicate implementation of
expanduser()in pathlib, and by doing so fix a bug where KeyError could be raised when expanding another user's home directory on Windows.https://bugs.python.org/issue39899