Mercurial > cpython-lru_cache-weakref
changeset 68220:b5281f5fade4
#11306: Treat EROFS like EACCES when making a 'file is read-only' decision
| author | R. David Murray <rdmurray@bitdance.com> |
|---|---|
| date | Thu, 03 Mar 2011 18:03:36 +0000 |
| parents | f2046dfca731 |
| children | 08804aea08f1 |
| files | Lib/mailbox.py Misc/NEWS |
| diffstat | 2 files changed, 7 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/Lib/mailbox.py Thu Mar 03 16:10:51 2011 +0000 +++ b/Lib/mailbox.py Thu Mar 03 18:03:36 2011 +0000 @@ -578,7 +578,7 @@ f = open(self._path, 'wb+') else: raise NoSuchMailboxError(self._path) - elif e.errno == errno.EACCES: + elif e.errno in (errno.EACCES, errno.EROFS): f = open(self._path, 'rb') else: raise @@ -2002,7 +2002,7 @@ try: fcntl.lockf(f, fcntl.LOCK_EX | fcntl.LOCK_NB) except IOError as e: - if e.errno in (errno.EAGAIN, errno.EACCES): + if e.errno in (errno.EAGAIN, errno.EACCES, errno.EROFS): raise ExternalClashError('lockf: lock unavailable: %s' % f.name) else: @@ -2012,7 +2012,7 @@ pre_lock = _create_temporary(f.name + '.lock') pre_lock.close() except IOError as e: - if e.errno == errno.EACCES: + if e.errno in (errno.EACCES, errno.EROFS): return # Without write access, just skip dotlocking. else: raise
--- a/Misc/NEWS Thu Mar 03 16:10:51 2011 +0000 +++ b/Misc/NEWS Thu Mar 03 18:03:36 2011 +0000 @@ -52,6 +52,10 @@ Library ------- +- Issue #11306: mailbox in certain cases adapts to an inability to open + certain files in read-write mode. Previously it detected this by + checking for EACCES, now it also checks for EROFS. + - Issue #11265: asyncore now correctly handles EPIPE, EBADF and EAGAIN errors on accept(), send() and recv().
