You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
imaplib fails when server sends extra blank line after literal value #88574
Note: 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:
assignee=Noneclosed_at=Nonecreated_at=<Date2021-06-13.05:34:08.636>labels= ['type-bug', 'library', '3.9', '3.10']
title='imaplib fails when server sends extra blank line after literal value'updated_at=<Date2022-01-19.19:33:36.808>user='https://github.com/jrlevine'
Some IMAP servers return an extra blank line after a counted literal value, which makes imaplib crash.
MacOS mail and T'bird handle the blank line OK so it seems to be a somewhat common bug.
#152751 skips the spurious blank line unconditionally, but that also swallows the legitimately empty trailer of a response that ends with a literal (e.g. a LIST/LSUB mailbox name sent as a literal), corrupting the next line.
PR #153317 makes the skip conditional â only while the response is still open â and handles the blank between responses too.
Activity
jrlevine commentedon Jun 13, 2021
Some IMAP servers return an extra blank line after a counted literal value, which makes imaplib crash.
MacOS mail and T'bird handle the blank line OK so it seems to be a somewhat common bug.
iritkatriel commentedon Jan 15, 2022
How does it fail? Can you provide a reproducer and add a unit test to the PR?
10 remaining items
gh-88574: Skip a spurious blank line after a literal in imaplib (GH-1âĶ
[3.13] gh-88574: Skip a spurious blank line after a literal in imaplib (
[3.14] gh-88574: Skip a spurious blank line after a literal in imaplib (
[3.15] gh-88574: Skip a spurious blank line after a literal in imaplib (
serhiy-storchaka commentedon Jul 2, 2026
Fixed in #152751: imaplib now skips a spurious blank line sent after a literal, so servers that emit one no longer cause a crash.
pythongh-88574: Skip spurious blank lines between responses in imaplib
pythongh-88574: Do not swallow the line after a terminating literal iâĶ
serhiy-storchaka commentedon Jul 8, 2026
#152751 skips the spurious blank line unconditionally, but that also swallows the legitimately empty trailer of a response that ends with a literal (e.g. a
LIST/LSUBmailbox name sent as a literal), corrupting the next line.PR #153317 makes the skip conditional â only while the response is still open â and handles the blank between responses too.
gh-88574: Do not swallow the line after a terminating literal in imapâĶ
[3.14] gh-88574: Do not swallow the line after a terminating literal âĶ
[3.15] gh-88574: Do not swallow the line after a terminating literal âĶ
[3.13] gh-88574: Do not swallow the line after a terminating literal âĶ