Brendan Dolan-Gavitt added the comment:
The _factory object didn't open the file, so why should it close it?
It's also worth noting that things one would naturally consider using as
factories (like email.message_from_file) don't close the fd when they're done.
I will
New submission from Brendan Dolan-Gavitt :
The default constructor for Maildir is rfc822.Message. This means that when
iterating over a Maildir mailbox instantiated with default settings, the
Mailbox class will return self._factory(self.get_file(key)), leaking the file
descriptor returned by