Two imaplib error messages format a user-supplied argument with %s:
IMAP4.select() — the "not writable" error for a read-only mailbox:
raise self.readonly('%s is not writable' % mailbox)
IMAP4.uid() — the unknown-command error:
raise self.error("Unknown IMAP4 UID command: %s" % command)
Both mailbox and command accept bytes (mailbox names are commonly bytes, e.g. as returned by list()). When the argument is bytes, formatting it with %s calls str(bytes), which raises BytesWarning under python -bb, masking the real error.
Linked PRs
Two
imapliberror messages format a user-supplied argument with%s:IMAP4.select()— the "not writable" error for a read-only mailbox:IMAP4.uid()— the unknown-command error:Both
mailboxandcommandacceptbytes(mailbox names are commonlybytes, e.g. as returned bylist()). When the argument isbytes, formatting it with%scallsstr(bytes), which raisesBytesWarningunderpython -bb, masking the real error.Linked PRs