From f43d16bcd094cdb4f245b34578b875135560f5f1 Mon Sep 17 00:00:00 2001 From: damijun <1919695306@qq.com> Date: Mon, 30 Nov 2026 23:38:35 +0800 Subject: [PATCH] gh-121509: Clarify that os.remove may raise PermissionError on Windows --- 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 fff27b48ae989c..a743019940da44 100644 --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -2851,9 +2851,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`.