mirror of
https://github.com/python/cpython.git
synced 2025-11-03 03:22:27 +00:00
gh-103363: Add follow_symlinks argument to pathlib.Path.owner() and group() (#107962)
This commit is contained in:
parent
2ed20d3bd8
commit
a1551b48ee
5 changed files with 95 additions and 26 deletions
|
|
@ -1017,15 +1017,21 @@ call fails (for example because the path doesn't exist).
|
|||
future Python release, patterns with this ending will match both files
|
||||
and directories. Add a trailing slash to match only directories.
|
||||
|
||||
.. method:: Path.group()
|
||||
.. method:: Path.group(*, follow_symlinks=True)
|
||||
|
||||
Return the name of the group owning the file. :exc:`KeyError` is raised
|
||||
Return the name of the group owning the file. :exc:`KeyError` is raised
|
||||
if the file's gid isn't found in the system database.
|
||||
|
||||
This method normally follows symlinks; to get the group of the symlink, add
|
||||
the argument ``follow_symlinks=False``.
|
||||
|
||||
.. versionchanged:: 3.13
|
||||
Raises :exc:`UnsupportedOperation` if the :mod:`grp` module is not
|
||||
available. In previous versions, :exc:`NotImplementedError` was raised.
|
||||
|
||||
.. versionchanged:: 3.13
|
||||
The *follow_symlinks* parameter was added.
|
||||
|
||||
|
||||
.. method:: Path.is_dir(*, follow_symlinks=True)
|
||||
|
||||
|
|
@ -1291,15 +1297,21 @@ call fails (for example because the path doesn't exist).
|
|||
'#!/usr/bin/env python3\n'
|
||||
|
||||
|
||||
.. method:: Path.owner()
|
||||
.. method:: Path.owner(*, follow_symlinks=True)
|
||||
|
||||
Return the name of the user owning the file. :exc:`KeyError` is raised
|
||||
Return the name of the user owning the file. :exc:`KeyError` is raised
|
||||
if the file's uid isn't found in the system database.
|
||||
|
||||
This method normally follows symlinks; to get the owner of the symlink, add
|
||||
the argument ``follow_symlinks=False``.
|
||||
|
||||
.. versionchanged:: 3.13
|
||||
Raises :exc:`UnsupportedOperation` if the :mod:`pwd` module is not
|
||||
available. In previous versions, :exc:`NotImplementedError` was raised.
|
||||
|
||||
.. versionchanged:: 3.13
|
||||
The *follow_symlinks* parameter was added.
|
||||
|
||||
|
||||
.. method:: Path.read_bytes()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue