#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.
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 @@
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."""