Kaydet (Commit) 66d16baf authored tarafından Just van Rossum's avatar Just van Rossum

- squashed bare except in rmtree()

- improved readability of rmtree; removed silly apply()
üst 502b9e1f
......@@ -127,17 +127,17 @@ def rmtree(path, ignore_errors=0, onerror=None):
"""
cmdtuples = []
_build_cmdtuple(path, cmdtuples)
for cmd in cmdtuples:
for func, arg in cmdtuples:
try:
apply(cmd[0], (cmd[1],))
except:
func(arg)
except OSError:
exc = sys.exc_info()
if ignore_errors:
pass
elif onerror is not None:
onerror(cmd[0], cmd[1], exc)
onerror(func, arg, exc)
else:
raise exc[0], (exc[1][0], exc[1][1] + ' removing '+cmd[1])
raise exc[0], (exc[1][0], exc[1][1] + ' removing '+arg)
# Helper for rmtree()
def _build_cmdtuple(path, cmdtuples):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment