Issue 1277098: imaplib Imap.select() uses comparison to 'None' for boolean (original) (raw)

Created on 2005-08-31 05:52 by jerub, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (4)
msg26160 - (view) Author: Stephen Thorne (jerub) * Date: 2005-08-31 05:52
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.
msg26161 - (view) Author: Stephen Thorne (jerub) * Date: 2005-08-31 05:54
Logged In: YES user_id=100823 assigned to pierslauder as per abaxter's request.
msg26162 - (view) Author: Piers Lauder (pierslauder) * (Python triager) Date: 2005-08-31 10:32
Logged In: YES user_id=196212 The manual suggests that "set"ing the 'readonly' flag will disable modifications, and I agree the suggested change would produce the expected behaviour - will check in a fix...
msg26163 - (view) Author: Piers Lauder (pierslauder) * (Python triager) Date: 2005-08-31 10:48
Logged In: YES user_id=196212 Suggested change checked in.
History
Date User Action Args
2022-04-11 14:56:12 admin set github: 42326
2005-08-31 05:52:53 jerub create