- Bug #981530: Fix UnboundLocalError in shutil.rmtree(). This affects
the documented behavior: the function passed to the onerror()
handler can now also be os.listdir.
[I could've sworn I checked this in, but apparently I didn't, or it
got lost???]
diff --git a/Lib/shutil.py b/Lib/shutil.py
index 10b7a27..fde8c90 100644
--- a/Lib/shutil.py
+++ b/Lib/shutil.py
@@ -128,6 +128,7 @@
cmdtuples = []
arg = path
try:
+ func = os.listdir # Make sure it isn't unset
_build_cmdtuple(path, cmdtuples)
for func, arg in cmdtuples:
func(arg)