diff options
author | Andrew Svetlov <andrew.svetlov@gmail.com> | 2012-12-18 20:02:39 (GMT) |
---|---|---|
committer | Andrew Svetlov <andrew.svetlov@gmail.com> | 2012-12-18 20:02:39 (GMT) |
commit | ad28c7f9dad791567afa0624acfb3ba430851965 (patch) | |
tree | 02095e5f567d6be1de31ffd858d21233b51675dd /Lib/shutil.py | |
parent | a19195984922ce89e7695c93b3bb45c3e0e6d732 (diff) | |
download | cpython-ad28c7f9dad791567afa0624acfb3ba430851965.zip cpython-ad28c7f9dad791567afa0624acfb3ba430851965.tar.gz cpython-ad28c7f9dad791567afa0624acfb3ba430851965.tar.bz2 |
Issue #16706: get rid of os.error
Diffstat (limited to 'Lib/shutil.py')
-rw-r--r-- | Lib/shutil.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/shutil.py b/Lib/shutil.py index 1eb4733..9a79f85 100644 --- a/Lib/shutil.py +++ b/Lib/shutil.py @@ -356,24 +356,24 @@ def _rmtree_unsafe(path, onerror): names = [] try: names = os.listdir(path) - except os.error: + except OSError: onerror(os.listdir, path, sys.exc_info()) for name in names: fullname = os.path.join(path, name) try: mode = os.lstat(fullname).st_mode - except os.error: + except OSError: mode = 0 if stat.S_ISDIR(mode): _rmtree_unsafe(fullname, onerror) else: try: os.unlink(fullname) - except os.error: + except OSError: onerror(os.unlink, fullname, sys.exc_info()) try: os.rmdir(path) - except os.error: + except OSError: onerror(os.rmdir, path, sys.exc_info()) # Version using fd-based APIs to protect against races @@ -464,7 +464,7 @@ def rmtree(path, ignore_errors=False, onerror=None): _rmtree_safe_fd(fd, path, onerror) try: os.rmdir(path) - except os.error: + except OSError: onerror(os.rmdir, path, sys.exc_info()) else: try: |