mirror of
https://github.com/python/cpython.git
synced 2025-11-01 02:38:53 +00:00
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:
parent
b7eb563a2a
commit
b698d8e7e9
5 changed files with 97 additions and 52 deletions
|
|
@ -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)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue