Skip to content
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

Fix 'WriteToConn' object has no attribute 'flush' #16801

Merged
merged 2 commits into from
Jan 30, 2024

Conversation

meshy
Copy link
Contributor

@meshy meshy commented Jan 19, 2024

WriteToConn replaces stdout and stderr to capture output, but causes issues because it doesn't implement the TextIO API (as expected of sys.stdout and sys.stderr).

By stubbing the rest of the TextIO API we prevent issues with other code which uses more of the API than we had previously accounted for.

Fixes #16678

This default isn't used anywhere in the codebase.

This comment has been minimized.

@meshy meshy marked this pull request as ready for review January 19, 2024 22:55
mypy/dmypy_util.py Outdated Show resolved Hide resolved
This class replaced stdout and stderr to capture output, but caused
issues because it didn't implement the full API of sys.stdout and
sys.stderr.

By fully stubbing the TextIO API we prevent issues with other code
which uses more of the API than we had previously accounted for.

Fixes python#16678
Copy link
Contributor

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

@hauntsaninja hauntsaninja merged commit 06b01c8 into python:master Jan 30, 2024
18 checks passed
@hauntsaninja
Copy link
Collaborator

Thanks for the fix!

@meshy meshy deleted the fix-WriteToConn-type branch January 30, 2024 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MyPy daemon version 1.7.0+ crashes if colorama is installed and reporting (cubertura) is used.
2 participants