Message223770
> There is a question. What should pathlib's expanduser() do in case
> when user directory can't be determined (or user does not exist)?
> Perhaps unlike to os.path.expanduser() it should raise an exception
> (as in many other pathlib's methods).
Let's see what POSIX says:
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_01
"""
If the system does not recognize the login name, the results are undefined.
"""
Helpful, isn't it ;-)
Behaving like os.path.expanduser() would have the advantage of consistency (which is in turn consistent with Unix shells), OTOH, it seems wrong to just return the unexpanded form: for example, if someone calls expanduser('~apache') and there's apache user, returning '~apache' could be dangerous if there was an '~apache' folder in the CWD.
So I think it would be better to raise an exception. |
|
Date |
User |
Action |
Args |
2014-07-23 19:44:20 | neologix | set | recipients:
+ neologix, pitrou, vstinner, Arfrever, Claudiu.Popa, serhiy.storchaka, vajrasky, antoine.pietri, fletom, rominf |
2014-07-23 19:44:20 | neologix | set | messageid: <1406144660.04.0.277855484448.issue19776@psf.upfronthosting.co.za> |
2014-07-23 19:44:20 | neologix | link | issue19776 messages |
2014-07-23 19:44:19 | neologix | create | |
|