summaryrefslogtreecommitdiffstats
path: root/Lib/mailbox.py
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>2010-02-22 18:42:07 (GMT)
committerAndrew M. Kuchling <amk@amk.ca>2010-02-22 18:42:07 (GMT)
commitb72b0eb357e9237e9de95dadda18fda433f88aac (patch)
tree03d29eaa1a8677b69ce8d67e0b9548846c621e97 /Lib/mailbox.py
parent72aae73d47ed9b41867d0264fe74e03d884cabf9 (diff)
downloadcpython-b72b0eb357e9237e9de95dadda18fda433f88aac.zip
cpython-b72b0eb357e9237e9de95dadda18fda433f88aac.tar.gz
cpython-b72b0eb357e9237e9de95dadda18fda433f88aac.tar.bz2
#7627: MH.remove() would fail if the MH mailbox was locked;
it would call _unlock_file() and pass it a closed file object. Noted by Rob Austein.
Diffstat (limited to 'Lib/mailbox.py')
-rwxr-xr-xLib/mailbox.py12
1 files changed, 2 insertions, 10 deletions
diff --git a/Lib/mailbox.py b/Lib/mailbox.py
index 4da5569..2b7b14e 100755
--- a/Lib/mailbox.py
+++ b/Lib/mailbox.py
@@ -892,17 +892,9 @@ class MH(Mailbox):
raise KeyError('No message with key: %s' % key)
else:
raise
- try:
- if self._locked:
- _lock_file(f)
- try:
- f.close()
- os.remove(os.path.join(self._path, str(key)))
- finally:
- if self._locked:
- _unlock_file(f)
- finally:
+ else:
f.close()
+ os.remove(path)
def __setitem__(self, key, message):
"""Replace the keyed message; raise KeyError if it doesn't exist."""