commit | 3b52778c74f0290e6103a6381ff9189f6b8c5e51 | [log] [tgz] |
---|---|---|
author | Hynek Schlawack <hs@ox.cx> | Mon Jun 25 13:27:31 2012 +0200 |
committer | Hynek Schlawack <hs@ox.cx> | Mon Jun 25 13:27:31 2012 +0200 |
tree | f00f37e9fc9d60359b20262a0ad557e7517030a7 | |
parent | 77892dc1e3b8d145b1ce22ae6129e80ee07f027f [diff] [blame] |
#4489 Make fd based rmtree work on bytes
diff --git a/Lib/shutil.py b/Lib/shutil.py index 2c00f4a..3cafd01 100644 --- a/Lib/shutil.py +++ b/Lib/shutil.py
@@ -426,6 +426,9 @@ def onerror(*args): raise if _use_fd_functions: + # While the unsafe rmtree works fine on bytes, the fd based does not. + if isinstance(path, bytes): + path = os.fsdecode(path) # Note: To guard against symlink races, we use the standard # lstat()/open()/fstat() trick. try: