[issue21322] Pathlib .owner() and .group() methods fail on broken links

Antoine Pitrou report at bugs.python.org
Tue Apr 22 11:33:44 CEST 2014


Antoine Pitrou added the comment:

> - It can make programs crash *unexpectedly*

A broken link is an error, so it's normal to have an exception raised
here. An exception can always be caught if you were expecting the error.

> - Pathlib should provide a complete and uniform API for dealing with
> all types of files. If not, users would need to use Pathlib for some
> kind of files and go to os and os.path for others, then why the reason
> to use Pathlib?

I sympathize with this. But you can already use Path.lstat() and inspect
the st_uid and st_gid fields if you are really interested in the link's
owner and group (rather than the target's).

The fact that most Path methods dereference symlinks reflects the
semantics of other common filesystem calls (such as those in the os
module, or the underlying functions of the POSIX API).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21322>
_______________________________________


More information about the Python-bugs-list mailing list