summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorJust van Rossum <just@letterror.com>2003-01-05 19:44:11 (GMT)
committerJust van Rossum <just@letterror.com>2003-01-05 19:44:11 (GMT)
commit66d16baf71ce821c657dc37bd970f6285efeda8e (patch)
tree377cc59092468664dc67e219419978111bc34251 /Lib
parent502b9e1fbbcb64bb53e9faef3d894b62eb2f6452 (diff)
downloadcpython-66d16baf71ce821c657dc37bd970f6285efeda8e.zip
cpython-66d16baf71ce821c657dc37bd970f6285efeda8e.tar.gz
cpython-66d16baf71ce821c657dc37bd970f6285efeda8e.tar.bz2
- squashed bare except in rmtree()
- improved readability of rmtree; removed silly apply()
Diffstat (limited to 'Lib')
-rw-r--r--Lib/shutil.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/shutil.py b/Lib/shutil.py
index 6aa2e3d..ad5c99d 100644
--- a/Lib/shutil.py
+++ b/Lib/shutil.py
@@ -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):