summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorR. David Murray <rdmurray@bitdance.com>2011-03-03 18:17:40 (GMT)
committerR. David Murray <rdmurray@bitdance.com>2011-03-03 18:17:40 (GMT)
commit1a337906824e41f7ea7ce49bc62c23f5e835862e (patch)
tree280361f317a4a600414c95632e54a3bb7f392a00
parentd65224f33960959a42f526c3b78caa065d006b55 (diff)
downloadcpython-1a337906824e41f7ea7ce49bc62c23f5e835862e.zip
cpython-1a337906824e41f7ea7ce49bc62c23f5e835862e.tar.gz
cpython-1a337906824e41f7ea7ce49bc62c23f5e835862e.tar.bz2
Merged revisions 88730 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r88730 | r.david.murray | 2011-03-03 13:03:36 -0500 (Thu, 03 Mar 2011) | 2 lines #11306: Treat EROFS like EACCES when making a 'file is read-only' decision ........
-rw-r--r--Lib/mailbox.py6
-rw-r--r--Misc/NEWS4
2 files changed, 7 insertions, 3 deletions
diff --git a/Lib/mailbox.py b/Lib/mailbox.py
index 728ce2a..b74eeb5 100644
--- a/Lib/mailbox.py
+++ b/Lib/mailbox.py
@@ -554,7 +554,7 @@ class _singlefileMailbox(Mailbox):
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
@@ -1905,7 +1905,7 @@ def _lock_file(f, dotlock=True):
try:
fcntl.lockf(f, fcntl.LOCK_EX | fcntl.LOCK_NB)
except IOError, 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:
@@ -1915,7 +1915,7 @@ def _lock_file(f, dotlock=True):
pre_lock = _create_temporary(f.name + '.lock')
pre_lock.close()
except IOError, e:
- if e.errno == errno.EACCES:
+ if e.errno in (errno.EACCES, errno.EROFS):
return # Without write access, just skip dotlocking.
else:
raise
diff --git a/Misc/NEWS b/Misc/NEWS
index 5155f03..bed3edc 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -37,6 +37,10 @@ Core and Builtins
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().