From cb41db4fdc30c0094bb7d275489352d394b82e36 Mon Sep 17 00:00:00 2001 From: WenXuan Xu <73049206+damijun@users.noreply.github.com> Date: Tue, 1 Dec 2026 00:55:58 +0800 Subject: [PATCH] gh-121509: Clarify that os.remove may raise PermissionError on Windows (GH-162875) (cherry picked from commit 9d6fa5d99598f9bfd72cc48cdb163a9839e7dc10) Co-authored-by: WenXuan Xu <73049206+damijun@users.noreply.github.com> --- Doc/library/os.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Doc/library/os.rst b/Doc/library/os.rst index 38aefb9b999d22..803ac8bd697a48 100644 --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -2793,9 +2793,10 @@ features: This function can support :ref:`paths relative to directory descriptors `. - On Windows, attempting to remove a file that is in use causes an exception to - be raised; on Unix, the directory entry is removed but the storage allocated - to the file is not made available until the original file is no longer in use. + On Windows, attempting to remove a file that is in use may raise + :exc:`PermissionError`; on Unix, the directory entry is removed but the + storage allocated to the file is not made available until the original file + is no longer in use. This function is semantically identical to :func:`unlink`.