Issue #15154: Add "dir_fd" parameter to os.rmdir, remove "rmdir"

parameter from os.remove / os.unlink.
Patch written by Georg Brandl.  (I'm really looking forward to George
getting commit privileges so I don't have to keep doing checkins on his
behalf.)
This commit is contained in:
Larry Hastings 2012-06-23 16:55:07 -07:00
parent b7eb563a2a
commit b698d8e7e9
5 changed files with 97 additions and 52 deletions

View file

@ -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)