From 5ab9692935de114731bf34b1fc917e6d4a7fd3f2 Mon Sep 17 00:00:00 2001 From: wlkjyy Date: Sat, 28 Feb 2026 08:24:08 +0800 Subject: [PATCH] gh-61745: Clarify os.listdir behavior for empty path --- Doc/library/os.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Doc/library/os.rst b/Doc/library/os.rst index 7418f3a8bacb0f..2691aa6710e594 100644 --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -2380,6 +2380,8 @@ features: entries ``'.'`` and ``'..'`` even if they are present in the directory. If a file is removed from or added to the directory during the call of this function, whether a name for that file be included is unspecified. + *path* must refer to an existing directory. Passing ``''`` raises + :exc:`FileNotFoundError`; use ``'.'`` to list the current directory. *path* may be a :term:`path-like object`. If *path* is of type ``bytes`` (directly or indirectly through the :class:`PathLike` interface),