summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib')
-rw-r--r--Lib/os.py5
-rw-r--r--Lib/test/test_os.py5
2 files changed, 5 insertions, 5 deletions
diff --git a/Lib/os.py b/Lib/os.py
index b5ad1b5..4a40cfe 100644
--- a/Lib/os.py
+++ b/Lib/os.py
@@ -157,6 +157,7 @@ if _exists("_have_functions"):
_add("HAVE_RENAMEAT", "rename")
_add("HAVE_SYMLINKAT", "symlink")
_add("HAVE_UNLINKAT", "unlink")
+ _add("HAVE_UNLINKAT", "rmdir")
_add("HAVE_UTIMENSAT", "utime")
supports_dir_fd = _set
@@ -214,10 +215,6 @@ if _exists("_have_functions"):
_add("MS_WINDOWS", "stat")
supports_follow_symlinks = _set
- _set = set()
- _add("HAVE_UNLINKAT", "unlink")
- supports_remove_directory = _set
-
del _set
del _have_functions
del _globals
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
index cc1120f..654dd23 100644
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -785,7 +785,10 @@ class FwalkTests(WalkTests):
os.unlink(name, dir_fd=rootfd)
for name in dirs:
st = os.stat(name, dir_fd=rootfd, follow_symlinks=False)
- os.unlink(name, dir_fd=rootfd, rmdir=stat.S_ISDIR(st.st_mode))
+ if stat.S_ISDIR(st.st_mode):
+ os.rmdir(name, dir_fd=rootfd)
+ else:
+ os.unlink(name, dir_fd=rootfd)
os.rmdir(support.TESTFN)