summaryrefslogtreecommitdiff
path: root/Lib/fileinput.py
diff options
context:
space:
mode:
authorAndrew Svetlov <andrew.svetlov@gmail.com>2012-12-18 22:02:39 +0200
committerAndrew Svetlov <andrew.svetlov@gmail.com>2012-12-18 22:02:39 +0200
commit8a2430b27c2140ed1063a623fdeef7544a4738d4 (patch)
tree2b01834ce21fb3477a356bece0a5491f94eb619f /Lib/fileinput.py
parentbb8b07e988944592019eaa56716bf41c2b19a0e0 (diff)
downloadcpython-8a2430b27c2140ed1063a623fdeef7544a4738d4.tar.gz
Issue #16706: get rid of os.error
Diffstat (limited to 'Lib/fileinput.py')
-rw-r--r--Lib/fileinput.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/fileinput.py b/Lib/fileinput.py
index dbbbb2192e..5be0318c41 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)