bpo-46943: fix[imaplib]: call Exception with string instance#31722
Closed
spaceone wants to merge 1 commit intopython:mainfrom
Closed
bpo-46943: fix[imaplib]: call Exception with string instance#31722spaceone wants to merge 1 commit intopython:mainfrom
spaceone wants to merge 1 commit intopython:mainfrom
Conversation
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
56a9251 to
e1820d7
Compare
Member
|
Judging from the commits pulled in, this PR branch was likely branched off of 3.10 or branch thereof. Please redo starting with 3.11 (main). Check the commit and diff list before hitting the green make-PR button. Also, is bpo not working to make a proper issue? |
pmhahn
pushed a commit
to univention/univention-corporate-server
that referenced
this pull request
Mar 7, 2022
Traceback (most recent call last):
File "29_mail_related_modifications_of_user_objects", line 29, in check_login_lookup
imap.log_in(mail, password)
File "/usr/share/ucs-test/40_mail/essential/mailclient.py", line 54, in log_in
self.login(usermail, 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):
File "29_mail_related_modifications_of_user_objects", line 274, in <module>
main()
File "29_mail_related_modifications_of_user_objects", line 93, in main
check_login_lookup(host, usermail, password, False)
File "29_mail_related_modifications_of_user_objects", line 37, in check_login_lookup
if any([msg in str(ex) for msg in auth_errors]):
File "29_mail_related_modifications_of_user_objects", line 37, in <listcomp>
if any([msg in str(ex) for msg in auth_errors]):
BytesWarning: str() on a bytes instance
→ python/cpython#31722
Traceback (most recent call last):
File "11mount-home", line 65, in <module>
print(stdout, ret)
BytesWarning: str() on a bytes instance
Traceback (most recent call last):
File "00check_forward_secrecy", line 88, in <module>
check_pfs_cipher()
File "00check_forward_secrecy", line 45, in check_pfs_cipher
openssl_out = run_openssl().decode('UTF-8')
File "00check_forward_secrecy", line 73, in run_openssl
print("Openssl client STDOUT:\n", stdout)
BytesWarning: str() on a bytes instance
Traceback (most recent call last):
File "47domain_user_lockout", line 185, in <module>
check_error_present_in_output(stdout, stderr)
File "47domain_user_lockout", line 147, in check_error_present_in_output
if 'NT_STATUS_ACCOUNT_LOCKED_OUT' not in (stdout + stderr).decode('UTF-8'):
AttributeError: 'str' object has no attribute 'decode'
Author
|
@terryjreedy The branch was already rebased onto main before you closed the MR. Can you reopen it again? |
pmhahn
pushed a commit
to univention/univention-corporate-server
that referenced
this pull request
Mar 7, 2022
Traceback (most recent call last):
File "29_mail_related_modifications_of_user_objects", line 29, in check_login_lookup
imap.log_in(mail, password)
File "/usr/share/ucs-test/40_mail/essential/mailclient.py", line 54, in log_in
self.login(usermail, 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):
File "29_mail_related_modifications_of_user_objects", line 274, in <module>
main()
File "29_mail_related_modifications_of_user_objects", line 93, in main
check_login_lookup(host, usermail, password, False)
File "29_mail_related_modifications_of_user_objects", line 37, in check_login_lookup
if any([msg in str(ex) for msg in auth_errors]):
File "29_mail_related_modifications_of_user_objects", line 37, in <listcomp>
if any([msg in str(ex) for msg in auth_errors]):
BytesWarning: str() on a bytes instance
→ python/cpython#31722
Traceback (most recent call last):
File "11mount-home", line 65, in <module>
print(stdout, ret)
BytesWarning: str() on a bytes instance
Traceback (most recent call last):
File "00check_forward_secrecy", line 88, in <module>
check_pfs_cipher()
File "00check_forward_secrecy", line 45, in check_pfs_cipher
openssl_out = run_openssl().decode('UTF-8')
File "00check_forward_secrecy", line 73, in run_openssl
print("Openssl client STDOUT:\n", stdout)
BytesWarning: str() on a bytes instance
Traceback (most recent call last):
File "47domain_user_lockout", line 185, in <module>
check_error_present_in_output(stdout, stderr)
File "47domain_user_lockout", line 147, in check_error_present_in_output
if 'NT_STATUS_ACCOUNT_LOCKED_OUT' not in (stdout + stderr).decode('UTF-8'):
AttributeError: 'str' object has no attribute 'decode'
Author
|
Created upstream bug repport: https://bugs.python.org/issue46943 |
Author
|
replaced by #31823 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adjust the behavior of
loginsimilar toauthenticate()whereself.erroris called with astrinstance.Especially for Python3 with strict bytes mode (-bb) this is helpful and prevents:
https://bugs.python.org/issue46943