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/fileinput.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/fileinput.py')
-rw-r--r-- | Lib/fileinput.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/fileinput.py b/Lib/fileinput.py index dbbbb21..5be0318 100644 --- a/Lib/fileinput.py +++ b/Lib/fileinput.py @@ -324,8 +324,10 @@ class FileInput: if self._inplace: self._backupfilename = ( self._filename + (self._backup or ".bak")) - try: os.unlink(self._backupfilename) - except os.error: pass + try: + os.unlink(self._backupfilename) + except OSError: + pass # The next few lines may raise IOError os.rename(self._filename, self._backupfilename) self._file = open(self._backupfilename, self._mode) |