Serhiy Storchaka added the comment:

Here is alternative patch which doesn't use os.path.expanduser() and 
reimplement it's logic. Differences:

* expanduser() is part of concrete path API. This method access environment.
* RuntimeError is raised when user home can't be determined.
* Currently ntpath.expanduser() uses heuristic to expand path with specified 
username. This works with default homedirs but can return wrong result when 
homedirs was moved to different locations. WindowsPath.expanduser() also uses 
heuristic, but more robust. Of course it would be better to get other users 
homedirs from Windows API, and perhaps we should defer this issue until 
implementing pwd or like on Windows.
* Expanded tests.

Interesting, common idiom to escape tilda in relative path (adding "./" prefix) 
doesn't work with pathlib, because "." components are ignored.

----------
Added file: http://bugs.python.org/file36106/pathlib_expanduser.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue19776>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to