From 6b0538c65b659a0bcb78db621eaf315a065ed437 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 c19a165ec49641b..b75baac276fac81 100644 --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -2740,9 +2740,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`.