Skip to content

Include None in tqdm write-error wrapper return type - #16943

Open
Lushiyao5 wants to merge 1 commit into
python:mainfrom
Lushiyao5:fix-tqdm-disable-on-write-result
Open

Lushiyao5 wants to merge 1 commit into
python:mainfrom
Lushiyao5:fix-tqdm-disable-on-write-result

Conversation

@Lushiyao5

Copy link
Copy Markdown
Contributor

DisableOnWriteError.disable_on_exception returns the wrapped function's result on success. When it suppresses a closed-stream ValueError or an OSError with errno 5, the wrapper returns None. Include that possibility while retaining the wrapped parameter list.

A local StringIO check returned 3 from an open stream and None after closing it, with the progress bar disabled via miniters. Mypy inferred only int before the patch and accepts the int | None assertion with the updated stub.

This patch was prepared with assistance from OpenAI Codex.

@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

This branch has not been deployed

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

Labels

None yet

1 participant