This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients Rosuav, barry, petri.lehtinen, r.david.murray, serhiy.storchaka, terry.reedy
Date 2014-02-22.21:01:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
You have opened the door on a slight mess. The mailbox module provides a set + dict interface to on-disk mailbax files in various formats. The hg annotate and revision history commands indicate that most of 3.4 mailbox is unchanged since the trunk version was merged into py3k on 2006-5-27 in rev38453. However, on 2007-2-11 Guido changed .iterxxx to .xxx throughout the stdlib in rev40809.

The bug you note is a side-effect of this patch. It overall left mailbax in a somewhat inconsistent state as it did *not* update the mailbox dict API by removing the mailbox.iterkeys/values/items methods and replacing the .keys/values/items methods. As a result, the mailbox methods that space efficiently iterated thru self.iterkeys now iterate through self.keys == list(self.iterkeys). Example:
    def clear(self):
        """Delete all messages."""
        for key in self.keys():  # was self.iterkeys()

To fix this, I think we should either
1) revert the rev40809 changes to mailbox, including in the line you point to, or
2) complete the rev40809 changes by updating to a Py3 interface, and make the change you suggest.

1) is much easier, but the API looks odd to a py3-only programmer.
After writing this message, I see that Serhiy wrote a patch to do this.

2) is an api change that perhaps should have happened in 3.0. Deprecation is awkward since people should not change from, for instance, self.iterkeys to self.key, until the api change in made.
Date User Action Args
2014-02-22 21:01:05terry.reedysetrecipients: + terry.reedy, barry, r.david.murray, petri.lehtinen, Rosuav, serhiy.storchaka
2014-02-22 21:01:05terry.reedysetmessageid: <>
2014-02-22 21:01:05terry.reedylinkissue20729 messages
2014-02-22 21:01:04terry.reedycreate