summaryrefslogtreecommitdiff
path: root/Lib/shutil.py
diff options
context:
space:
mode:
authorHynek Schlawack <hs@ox.cx>2012-06-25 13:27:31 +0200
committerHynek Schlawack <hs@ox.cx>2012-06-25 13:27:31 +0200
commit95d68831f10abe9a47efba00dfea393413c31099 (patch)
treefaba9647ab60ed720ecfb54b49e334e277993e2d /Lib/shutil.py
parent44af4e9675d163b4f13370bca65c142fb41a698d (diff)
downloadcpython-95d68831f10abe9a47efba00dfea393413c31099.tar.gz
#4489 Make fd based rmtree work on bytes
Diffstat (limited to 'Lib/shutil.py')
-rw-r--r--Lib/shutil.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/shutil.py b/Lib/shutil.py
index 2c00f4a025..3cafd01d23 100644
--- a/Lib/shutil.py
+++ b/Lib/shutil.py
@@ -426,6 +426,9 @@ def rmtree(path, ignore_errors=False, onerror=None):
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: