-
-
Notifications
You must be signed in to change notification settings - Fork 29.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[EASY] imaplib noop Debug: bytes vs Unicode bug in debug mode #70730
Comments
With the imaplib.Debug=3 (or greater) imaplib.noop() will crash if there are any untagged responses present. The _dump_ur() function has not been converted to expect bytes in the lambda variable x[1]. An abbreviate example of the 'dict' parameter would be: {'READ-WRITE': [b''], 'FETCH': [b'1 (FLAGS (\\Recent NonJunk))']} This _dump_ur() function needs converting to Python 3.x, say, change the map/lambda line to: A sample crash inducing session produced by the attached file (using another email client to produce untagged responses for NOOP): 20:01.23 imaplib version 2.58
20:01.23 new IMAP4 connection, tag=b'LMHB'
20:01.48 CAPABILITIES: ('IMAP4REV1', 'LITERAL+', 'SASL-IR', 'LOGIN-REFERRALS', 'ID', 'ENABLE', 'IDLE', 'NAMESPACE', 'AUTH=PLAIN', 'AUTH=LOGIN')
Traceback (most recent call last):
File "E:/temp/imap-idle/imaplib-noop.py", line 18, in <module>
connection.noop() # Crashes here.
File "C:\Python35\lib\imaplib.py", line 656, in noop
self._dump_ur(self.untagged_responses)
File "C:\Python35\lib\imaplib.py", line 1210, in _dump_ur
self._mesg('untagged responses dump:%s%s' % (t, t.join(l)))
File "C:\Python35\lib\imaplib.py", line 1209, in <lambda>
l = map(lambda x:'%s: "%s"' % (x[0], x[1][0] and '" "'.join(x[1]) or ''), l)
TypeError: sequence item 0: expected str instance, bytes found |
I've attached a patch file of the proposed change which seems correct |
Fixes syntax & line length issues in previous patch |
That is a show-stopper, and the patch works fine. |
That sounds reasonable, if the debug output doesn't pollute the test run output. |
Removing 3.5 as it is in security fix mode. Also, the PR just contains the test case that would trigger the condition and not the actual code. |
Hey ankostis, Please let us know if you've time to complete the PR. Thank you :) |
Dear Sanyam, My apologies, it's been almost a year that i don't need the fix for this Best, On Fri, 9 Aug 2019 at 21:35, Sanyam Khurana <report@bugs.python.org> wrote:
|
added in commit 2b99cec in my PR. But i don't have much time to track if Best, |
Merged, thanks for the fix. |
imaplib.noop()
failing when debug > 3 #1503Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: