[ python-Bugs-1277098 ] imaplib Imap.select() uses comparison to 'None' for boolean

SourceForge.net noreply at sourceforge.net
Wed Aug 31 07:52:53 CEST 2005


Bugs item #1277098, was opened at 2005-08-31 15:52
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1277098&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Stephen Thorne (jerub)
Assigned to: Nobody/Anonymous (nobody)
Summary: imaplib Imap.select() uses comparison to 'None' for boolean

Initial Comment:
The imap class's method for selecting a mailbox in read
only mode is subtly broken. Calling i.select('INBOX',
readonly=0) will cause the imap library to open the
mailbox in EXAMINE mode, not SELECT.

     def select(self, mailbox='INBOX', readonly=None):
         if readonly is not None:
             name = 'EXAMINE'
         else:
             name = 'SELECT'

So passing what seems to be a boolean option into the
function causes unexpected circumstances in client code.

Recommend that the comparison be changed to 'if readonly:'.

I have verified this code exists in python2.3 and in
python cvs head.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1277098&group_id=5470


More information about the Python-bugs-list mailing list