Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents d0f6e0a + b6ee3d6 commit 31a78c3Copy full SHA for 31a78c3
1 file changed
Lib/mailbox.py
@@ -740,8 +740,11 @@ def _append_message(self, message):
740
"""Append message to mailbox and return (start, stop) offsets."""
741
self._file.seek(0, 2)
742
before = self._file.tell()
743
- if len(self._toc) == 0:
744
- # This is the first message
+ if len(self._toc) == 0 and not self._pending:
+ # This is the first message, and the _pre_mailbox_hook
745
+ # hasn't yet been called. If self._pending is True,
746
+ # messages have been removed, so _pre_mailbox_hook must
747
+ # have been called already.
748
self._pre_mailbox_hook(self._file)
749
try:
750
self._pre_message_hook(self._file)
0 commit comments