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 gildea
Recipients gildea
Date 2022-02-12.22:21:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1644704510.06.0.116254271482.issue46734@roundup.psfhosted.org>
In-reply-to
Content
A message's flags are stored in its filename by Maildir, so the flags
are available without reading the message file itself.  The structured
message file name makes it efficient to scan a large mailbox to select
only messages that are, for example, not Trashed.

The mailbox.Maildir interface does not expose these flags, however.  The
only way to access the flags through the mailbox library is to create a
mailbox.MaildirMessage object, which has a get_flags() method.  But
creating a MaildirMessage requires opening the message file, which is slow.

I propose adding a parallel get_flags(key) method to mailbox.Maildir,
so that the flags are available without having to create a
MaildirMessage object.

In iterating through a mailbox with thousands of messages, I find that
this proposed Maildir.get_flags() method is 50 times faster than
MaildirMessage.get_flags().
History
Date User Action Args
2022-02-12 22:21:50gildeasetrecipients: + gildea
2022-02-12 22:21:50gildeasetmessageid: <1644704510.06.0.116254271482.issue46734@roundup.psfhosted.org>
2022-02-12 22:21:50gildealinkissue46734 messages
2022-02-12 22:21:49gildeacreate