diff options
author | Andrew Svetlov <andrew.svetlov@gmail.com> | 2012-12-25 14:47:37 (GMT) |
---|---|---|
committer | Andrew Svetlov <andrew.svetlov@gmail.com> | 2012-12-25 14:47:37 (GMT) |
commit | f7a17b48d748e1835bcf9df86fb7fb318bb020f8 (patch) | |
tree | 403d91c57f72d6e538ce09a8037bd658bc619760 /Lib/dbm/__init__.py | |
parent | 16bdd4120d8452e8e04b124bcdd116608c5166b0 (diff) | |
download | cpython-f7a17b48d748e1835bcf9df86fb7fb318bb020f8.zip cpython-f7a17b48d748e1835bcf9df86fb7fb318bb020f8.tar.gz cpython-f7a17b48d748e1835bcf9df86fb7fb318bb020f8.tar.bz2 |
Replace IOError with OSError (#16715)
Diffstat (limited to 'Lib/dbm/__init__.py')
-rw-r--r-- | Lib/dbm/__init__.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/dbm/__init__.py b/Lib/dbm/__init__.py index 3bff170..0609e49 100644 --- a/Lib/dbm/__init__.py +++ b/Lib/dbm/__init__.py @@ -42,7 +42,7 @@ _names = ['dbm.gnu', 'dbm.ndbm', 'dbm.dumb'] _defaultmod = None _modules = {} -error = (error, IOError) +error = (error, OSError) def open(file, flag='r', mode=0o666): @@ -109,7 +109,7 @@ def whichdb(filename): f = io.open(filename + ".dir", "rb") f.close() return "dbm.ndbm" - except IOError: + except OSError: # some dbm emulations based on Berkeley DB generate a .db file # some do not, but they should be caught by the bsd checks try: @@ -122,7 +122,7 @@ def whichdb(filename): d = ndbm.open(filename) d.close() return "dbm.ndbm" - except IOError: + except OSError: pass # Check for dumbdbm next -- this has a .dir and a .dat file @@ -139,13 +139,13 @@ def whichdb(filename): return "dbm.dumb" finally: f.close() - except (OSError, IOError): + except OSError: pass # See if the file exists, return None if not try: f = io.open(filename, "rb") - except IOError: + except OSError: return None # Read the start of the file -- the magic number |