This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author neologix
Recipients Arfrever, Claudiu.Popa, antoine.pietri, fletom, neologix, pitrou, rominf, serhiy.storchaka, vajrasky, vstinner
Date 2014-07-23.19:44:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1406144660.04.0.277855484448.issue19776@psf.upfronthosting.co.za>
In-reply-to
Content
> 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.
History
Date User Action Args
2014-07-23 19:44:20neologixsetrecipients: + neologix, pitrou, vstinner, Arfrever, Claudiu.Popa, serhiy.storchaka, vajrasky, antoine.pietri, fletom, rominf
2014-07-23 19:44:20neologixsetmessageid: <1406144660.04.0.277855484448.issue19776@psf.upfronthosting.co.za>
2014-07-23 19:44:20neologixlinkissue19776 messages
2014-07-23 19:44:19neologixcreate