From 47a799c75b8face117d1c170c08448dc41eacfd3 Mon Sep 17 00:00:00 2001 From: Christoph Anton Mitterer Date: Tue, 15 Aug 2023 04:45:01 +0200 Subject: [PATCH 1/2] gh-107959: clarify Unix-availability of `os.lchmod()` POSIX specifies that implementations are not required to support changing the file mode of symbolic links, but may do so. Consequently, `lchmod()` is not part of POSIX (but mentioned for implementations which do support the above). The current wording of the availability of `os.lchmod()` is rather vague and improved to clearly tell which POSIX/Unix/BSD-like support the function in general (those that support changing the file mode of symbolic links). Further, some examples of major implementations are added. Data for the BSDs taken from their online manpages. Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Signed-off-by: Christoph Anton Mitterer --- Doc/library/os.rst | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Doc/library/os.rst b/Doc/library/os.rst index 9735baa5bc0f3a..0c893b0dcf8e77 100644 --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -2121,7 +2121,11 @@ features: .. audit-event:: os.chmod path,mode,dir_fd os.lchmod - .. availability:: Unix. + .. availability:: Unix, not Linux, FreeBSD >= 1.3, NetBSD >= 1.3, not OpenBSD + + .. note:: + ``lchmod()`` is not part of POSIX, but Unix implementations may have it + if changing the mode of symbolic links is supported. .. versionchanged:: 3.6 Accepts a :term:`path-like object`. From 8d00b20cccfceb09aa5dfd2c00110288128b2e77 Mon Sep 17 00:00:00 2001 From: Christoph Anton Mitterer Date: Tue, 15 Aug 2023 17:32:40 +0200 Subject: [PATCH 2/2] make the note a normal paragraph --- Doc/library/os.rst | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Doc/library/os.rst b/Doc/library/os.rst index 0c893b0dcf8e77..025c9dbddb200a 100644 --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -2119,14 +2119,13 @@ features: for possible values of *mode*. As of Python 3.3, this is equivalent to ``os.chmod(path, mode, follow_symlinks=False)``. + ``lchmod()`` is not part of POSIX, but Unix implementations may have it if + changing the mode of symbolic links is supported. + .. audit-event:: os.chmod path,mode,dir_fd os.lchmod .. availability:: Unix, not Linux, FreeBSD >= 1.3, NetBSD >= 1.3, not OpenBSD - .. note:: - ``lchmod()`` is not part of POSIX, but Unix implementations may have it - if changing the mode of symbolic links is supported. - .. versionchanged:: 3.6 Accepts a :term:`path-like object`.