*** Lib/mailbox.py 2007-01-17 15:54:27.000000000 -0500 --- mailbox-unified.py 2007-01-17 15:55:44.000000000 -0500 *************** *** 559,562 **** --- 559,569 ---- _lock_file(self._file) self._locked = True + if self._pending: + warnings.warn("mailbox .lock() method called with pending changes; " + "should have been locked before making changes", + stacklevel=2) + else: + # Force re-read of toc to ensure we're up-to-date. + self._toc = None def unlock(self):