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.

Title: fix[imaplib]: call Exception with string instance
Type: Stage: patch review
Components: Library (Lib) Versions: Python 3.11, Python 3.10, Python 3.9
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: iritkatriel, spaceone
Priority: normal Keywords: patch

Created on 2022-03-07 11:30 by spaceone, last changed 2022-04-11 14:59 by admin.

Pull Requests
URL Status Linked Edit
PR 31722 closed spaceone, 2022-03-07 11:30
PR 31823 open spaceone, 2022-03-11 15:46
Messages (7)
msg414657 - (view) Author: SpaceOne (spaceone) * Date: 2022-03-07 11:30
imaplib raises an Exception with a bytes instance once (in login()) - all other places str instances are raised.

Adjust the behavior of login() similar to authenticate() where self.error is called with a str instance.

Especially for Python3 with strict bytes mode (-bb) this is helpful and prevents:

    Traceback (most recent call last):
      in "<stdin>"
        self.login(email, password)
      File "/usr/lib/python3.7/", line 598, in login
        raise self.error(dat[-1])
    imaplib.error: <exception str() failed>
    During handling of the above exception, another exception occurred:
    Traceback (most recent call last):
      in "<stdin>"
    BytesWarning: str() on a bytes instance
msg414897 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2022-03-11 09:55
@spaceone  I'd suggest you create a new PR. Once many people are subscribed to a PR we don't like to reopen it and spam everyone.

It would also be necessary to add a unit test.
msg414903 - (view) Author: SpaceOne (spaceone) * Date: 2022-03-11 13:27

I added a unit test to the branch.

I can't create a new PR without creating a new branch. But that doesn't make much sense from a technical point. It only increases the number of existing merge requests.
Also all the people subscribed to the current MR will receive another email for the new merge request. So just clicking on "Reopen" on your side should be simple.
msg414905 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2022-03-11 13:44
The people subscribed to the closed pr will not receive an email about a new pr which is opened correctly. What makes you think they would?
msg414909 - (view) Author: SpaceOne (spaceone) * Date: 2022-03-11 14:43
they were automatically added by github via your `.github/CODEOWNERS` file with the `**/*imap*                     @python/email-team` match.

And they all will also be informed by another pull request.
msg414911 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2022-03-11 15:03
That happened because your PR was wrong - it contained many commits that touched many files, all of whose owners were modified. If you make the PR against the main branch, the diff will not have all those files a and they will not be notified.
msg414916 - (view) Author: SpaceOne (spaceone) * Date: 2022-03-11 15:48
alright, I am sorry.
I created another PR:
Date User Action Args
2022-04-11 14:59:57adminsetgithub: 91099
2022-03-11 15:48:11spaceonesetmessages: + msg414916
2022-03-11 15:46:47spaceonesetpull_requests: + pull_request29920
2022-03-11 15:03:27iritkatrielsetmessages: + msg414911
2022-03-11 14:43:01spaceonesetmessages: + msg414909
2022-03-11 13:44:14iritkatrielsetmessages: + msg414905
2022-03-11 13:27:03spaceonesetmessages: + msg414903
2022-03-11 09:55:20iritkatrielsetnosy: + iritkatriel
messages: + msg414897
2022-03-09 20:08:30iritkatrielsetversions: - Python 3.7, Python 3.8
2022-03-07 11:30:29spaceonesetkeywords: + patch
stage: patch review
pull_requests: + pull_request29837
2022-03-07 11:30:04spaceonecreate