]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-42053: Remove misleading check in os.fwalk() (GH-27669)
authorSerhiy Storchaka <storchaka@gmail.com>
Sun, 8 Aug 2021 18:04:02 +0000 (21:04 +0300)
committerGitHub <noreply@github.com>
Sun, 8 Aug 2021 18:04:02 +0000 (21:04 +0300)
os.fwalk() does not support integer as the first argument,
and never supported.

Lib/os.py

index 8cc70a11e9bc898aa3f5e0c9380d0a05baed8794..ab7ef3c17798b9403b6ef67d24bb3e8ebd899ce5 100644 (file)
--- a/Lib/os.py
+++ b/Lib/os.py
@@ -461,8 +461,7 @@ if {open, stat} <= supports_dir_fd and {scandir, stat} <= supports_fd:
                 dirs.remove('CVS')  # don't visit CVS directories
         """
         sys.audit("os.fwalk", top, topdown, onerror, follow_symlinks, dir_fd)
-        if not isinstance(top, int) or not hasattr(top, '__index__'):
-            top = fspath(top)
+        top = fspath(top)
         # Note: To guard against symlink races, we use the standard
         # lstat()/open()/fstat() trick.
         if not follow_symlinks: