Skip to content

Conversation

@spaceone
Copy link

@spaceone spaceone commented Mar 11, 2022

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/imaplib.py", 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>"
        str(exc)
    BytesWarning: str() on a bytes instance

https://bugs.python.org/issue46943

@bedevere-bot

This comment was marked as outdated.

@arhadthedev arhadthedev changed the title bpo-46943: fix[imaplib]: call Exception with string instance gh-91099: fix[imaplib]: call Exception with string instance Feb 26, 2023
@arhadthedev arhadthedev added stdlib Standard Library Python modules in the Lib/ directory topic-email labels Feb 26, 2023
@arhadthedev
Copy link
Member

@spaceone Could you sign the new CLA by clicking not signed button in the cpython-cla-bot's message, please?

@spaceone
Copy link
Author

@spaceone Could you sign the new CLA by clicking not signed button in the cpython-cla-bot's message, please?

I tried but get a white screen with Internal Server Error. Will retry later in the evening with another browser.

@arhadthedev
Copy link
Member

arhadthedev commented Feb 26, 2023

No worries, your click was accepted. The displayed error is a known although yet untracked problem.

@arhadthedev
Copy link
Member

@python/email-team

@python python deleted a comment Apr 7, 2025
@python-cla-bot
Copy link

python-cla-bot bot commented Apr 18, 2025

All commit authors signed the Contributor License Agreement.

CLA signed

Adjust the behavior 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/imaplib.py", 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>"
    str(exc)
BytesWarning: str() on a bytes instance
@spaceone spaceone force-pushed the imaplib-fix-exception-call-with-str branch from 300787f to 4b7fa1c Compare April 18, 2025 09:56
@spaceone
Copy link
Author

rebased :-)
+ 300787ffd7b...4b7fa1c8e42 imaplib-fix-exception-call-with-str -> imaplib-fix-exception-call-with-str (forced update)

@spaceone spaceone force-pushed the imaplib-fix-exception-call-with-str branch from 4b7fa1c to 0a9dc07 Compare April 18, 2025 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review stdlib Standard Library Python modules in the Lib/ directory topic-email

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants