#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: