- 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???]
This commit is contained in:
Guido van Rossum 2004-07-14 00:45:59 +00:00
parent 80e1f06594
commit 4a2ccdf781

View file

@ -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)