From 95d68831f10abe9a47efba00dfea393413c31099 Mon Sep 17 00:00:00 2001 From: Hynek Schlawack Date: Mon, 25 Jun 2012 13:27:31 +0200 Subject: #4489 Make fd based rmtree work on bytes --- Lib/shutil.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Lib/shutil.py') 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: -- cgit v1.2.1