Skip to content

gh-159583: Fix IndexError in imaplib IDLE iteration on a tagged response - #159586

Open
MrGreyfun wants to merge 1 commit into
python:mainfrom
MrGreyfun:fix-imaplib-idle-indexerror
Open

MrGreyfun wants to merge 1 commit into
python:mainfrom
MrGreyfun:fix-imaplib-idle-indexerror

Conversation

@MrGreyfun

@MrGreyfun MrGreyfun commented Oct 16, 2026 •

Copy link
Copy Markdown

Continue reading in Idler._pop() until an IDLE response is queued or the original timeout expires.

An earlier pipelined command's tagged response can arrive during IDLE. _get_response() records it in tagged_commands without queuing an IDLE response, so _pop() previously raised IndexError when it popped the empty queue. It now measures each read against the original deadline, so receiving a tagged response does not extend duration or burst() timeouts.

Tests: PCbuild/amd64/python_d.exe -m test test.test_imaplib (267 tests run, 3 skipped).

Fixes #159583.

@MrGreyfun
MrGreyfun requested a review from a team as a code owner October 16, 2026 21:47
@python-cla-bot

python-cla-bot Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

imaplib.Idler raises IndexError when another command's tagged response arrives during IDLE

1 participant