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/lib2to3 | |
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/lib2to3')
-rw-r--r-- | Lib/lib2to3/main.py | 4 | ||||
-rw-r--r-- | Lib/lib2to3/refactor.py | 4 | ||||
-rwxr-xr-x | Lib/lib2to3/tests/pytree_idempotency.py | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/Lib/lib2to3/main.py b/Lib/lib2to3/main.py index f9cc18b..93bae90 100644 --- a/Lib/lib2to3/main.py +++ b/Lib/lib2to3/main.py @@ -90,11 +90,11 @@ class StdoutRefactoringTool(refactor.MultiprocessRefactoringTool): if os.path.lexists(backup): try: os.remove(backup) - except os.error as err: + except OSError as err: self.log_message("Can't remove backup %s", backup) try: os.rename(filename, backup) - except os.error as err: + except OSError as err: self.log_message("Can't rename %s to %s", filename, backup) # Actually write the new file write = super(StdoutRefactoringTool, self).write_file diff --git a/Lib/lib2to3/refactor.py b/Lib/lib2to3/refactor.py index 201e193..87f686e 100644 --- a/Lib/lib2to3/refactor.py +++ b/Lib/lib2to3/refactor.py @@ -534,12 +534,12 @@ class RefactoringTool(object): """ try: f = _open_with_encoding(filename, "w", encoding=encoding) - except os.error as err: + except OSError as err: self.log_error("Can't create %s: %s", filename, err) return try: f.write(_to_system_newlines(new_text)) - except os.error as err: + except OSError as err: self.log_error("Can't write %s: %s", filename, err) finally: f.close() diff --git a/Lib/lib2to3/tests/pytree_idempotency.py b/Lib/lib2to3/tests/pytree_idempotency.py index a02bbfe..731c403 100755 --- a/Lib/lib2to3/tests/pytree_idempotency.py +++ b/Lib/lib2to3/tests/pytree_idempotency.py @@ -53,7 +53,7 @@ def main(): for dir in sys.path: try: names = os.listdir(dir) - except os.error: + except OSError: continue print("Scanning", dir, "...", file=sys.stderr) for name in names: |