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/mailbox.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/mailbox.py')
-rw-r--r-- | Lib/mailbox.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Lib/mailbox.py b/Lib/mailbox.py index 01f3551..6d320ed 100644 --- a/Lib/mailbox.py +++ b/Lib/mailbox.py @@ -585,7 +585,7 @@ class _singlefileMailbox(Mailbox): Mailbox.__init__(self, path, factory, create) try: f = open(self._path, 'rb+') - except IOError as e: + except OSError as e: if e.errno == errno.ENOENT: if create: f = open(self._path, 'wb+') @@ -988,7 +988,7 @@ class MH(Mailbox): path = os.path.join(self._path, str(key)) try: f = open(path, 'rb+') - except IOError as e: + except OSError as e: if e.errno == errno.ENOENT: raise KeyError('No message with key: %s' % key) else: @@ -1002,7 +1002,7 @@ class MH(Mailbox): path = os.path.join(self._path, str(key)) try: f = open(path, 'rb+') - except IOError as e: + except OSError as e: if e.errno == errno.ENOENT: raise KeyError('No message with key: %s' % key) else: @@ -1028,7 +1028,7 @@ class MH(Mailbox): f = open(os.path.join(self._path, str(key)), 'rb+') else: f = open(os.path.join(self._path, str(key)), 'rb') - except IOError as e: + except OSError as e: if e.errno == errno.ENOENT: raise KeyError('No message with key: %s' % key) else: @@ -1055,7 +1055,7 @@ class MH(Mailbox): f = open(os.path.join(self._path, str(key)), 'rb+') else: f = open(os.path.join(self._path, str(key)), 'rb') - except IOError as e: + except OSError as e: if e.errno == errno.ENOENT: raise KeyError('No message with key: %s' % key) else: @@ -1075,7 +1075,7 @@ class MH(Mailbox): """Return a file-like representation or raise a KeyError.""" try: f = open(os.path.join(self._path, str(key)), 'rb') - except IOError as e: + except OSError as e: if e.errno == errno.ENOENT: raise KeyError('No message with key: %s' % key) else: @@ -2068,7 +2068,7 @@ def _lock_file(f, dotlock=True): if fcntl: try: fcntl.lockf(f, fcntl.LOCK_EX | fcntl.LOCK_NB) - except IOError as e: + except OSError as e: if e.errno in (errno.EAGAIN, errno.EACCES, errno.EROFS): raise ExternalClashError('lockf: lock unavailable: %s' % f.name) @@ -2078,7 +2078,7 @@ def _lock_file(f, dotlock=True): try: pre_lock = _create_temporary(f.name + '.lock') pre_lock.close() - except IOError as e: + except OSError as e: if e.errno in (errno.EACCES, errno.EROFS): return # Without write access, just skip dotlocking. else: |