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 serhiy.storchaka
Recipients barry, cheryl.sabella, ncoghlan, r.david.murray, sblondon, serhiy.storchaka
Date 2018-03-23.18:52:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1521831161.37.0.467229070634.issue32234@psf.upfronthosting.co.za>
In-reply-to
Content
Is closing a mailbox in __exit__ the most desirable operation?

In the last example on https://docs.python.org/3/library/mailbox.html#examples inbox is locked and unlocked multiple times. The with statement couldn't be used here.

On https://pymotw.com/3/mailbox/ some examples use the idiom

    mbox = ...
    mbox.lock()
    try:
        ...
    finally:
        mbox.unlock()

and others use the idiom

    mbox = ...
    mbox.lock()
    try:
        ...
    finally:
        mbox.flush()
        mbox.close()
History
Date User Action Args
2018-03-23 18:52:41serhiy.storchakasetrecipients: + serhiy.storchaka, barry, ncoghlan, r.david.murray, cheryl.sabella, sblondon
2018-03-23 18:52:41serhiy.storchakasetmessageid: <1521831161.37.0.467229070634.issue32234@psf.upfronthosting.co.za>
2018-03-23 18:52:41serhiy.storchakalinkissue32234 messages
2018-03-23 18:52:41serhiy.storchakacreate