From: Guido van Rossum Date: Wed, 14 Jul 2004 00:45:59 +0000 (+0000) Subject: - Bug #981530: Fix UnboundLocalError in shutil.rmtree(). This affects X-Git-Tag: v2.4a2~279 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4a2ccdf781b1648f34f303ee3d411d63c306e17e;p=thirdparty%2FPython%2Fcpython.git - 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 10b7a277674a..fde8c90fe9fb 100644 --- a/Lib/shutil.py +++ b/Lib/shutil.py @@ -128,6 +128,7 @@ def rmtree(path, ignore_errors=False, onerror=None): cmdtuples = [] arg = path try: + func = os.listdir # Make sure it isn't unset _build_cmdtuple(path, cmdtuples) for func, arg in cmdtuples: func(arg)