[Python-checkins] r54596 - python/branches/amk-mailbox/Lib/mailbox.py
andrew.kuchling
python-checkins at python.org
Wed Mar 28 15:52:43 CEST 2007
Author: andrew.kuchling
Date: Wed Mar 28 15:52:41 2007
New Revision: 54596
Modified:
python/branches/amk-mailbox/Lib/mailbox.py
Log:
Warn if lock() is called when the mailbox has pending changes
Modified: python/branches/amk-mailbox/Lib/mailbox.py
==============================================================================
--- python/branches/amk-mailbox/Lib/mailbox.py (original)
+++ python/branches/amk-mailbox/Lib/mailbox.py Wed Mar 28 15:52:41 2007
@@ -20,6 +20,7 @@
import email.generator
import rfc822
import StringIO
+import warnings
try:
if sys.platform == 'os2emx':
# OS/2 EMX fcntl() not adequate
@@ -556,6 +557,10 @@
if not self._locked:
_lock_file(self._file)
self._locked = True
+ if self._pending:
+ warnings.warn("lock() method called with pending changes; "
+ "should have been locked before making changes",
+ stacklevel=2)
def unlock(self):
"""Unlock the mailbox if it is locked."""
More information about the Python-checkins
mailing list