Skip to content

Use SupportsWrite instead of IO - #5069

Merged
JelleZijlstra merged 8 commits into
python:masterfrom
srittau:stream-handler
Mar 23, 2021
Merged

JelleZijlstra merged 8 commits into
python:masterfrom
srittau:stream-handler

Conversation

@srittau

@srittau srittau commented Feb 24, 2021

Copy link
Copy Markdown
Collaborator

Depends on #5068.

@github-actions

Copy link
Copy Markdown
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

pip (https://github.com/pypa/pip.git)
- src/pip/_internal/utils/logging.py:169: error: Incompatible types in assignment (expression has type "AnsiToWin32", variable has type "IO[str]")

sphinx (https://github.com/sphinx-doc/sphinx.git)
+ sphinx/util/logging.py:575: error: unused 'type: ignore' comment
+ sphinx/util/logging.py:581: error: unused 'type: ignore' comment
+ sphinx/util/logging.py:589: error: unused 'type: ignore' comment


zulip (https://github.com/zulip/zulip.git)
+ zerver/lib/test_console_output.py:69: error: unused 'type: ignore' comment

pytest (https://github.com/pytest-dev/pytest.git)
+ src/_pytest/logging.py:629: error: "SupportsWrite[str]" has no attribute "close"  [attr-defined]

@srittau

srittau commented Feb 24, 2021

Copy link
Copy Markdown
Collaborator Author

It seems this PR fixes a bunch of issues. The new failure in pytest points to a real unsafe use (even if this is most likely not a problem in practice).

@JelleZijlstra JelleZijlstra left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, I fixed the merge conflict. I'll merge once CI is green (unless I get distracted).

@github-actions

Copy link
Copy Markdown
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

sphinx (https://github.com/sphinx-doc/sphinx.git)
+ sphinx/util/logging.py:575: error: unused 'type: ignore' comment
+ sphinx/util/logging.py:581: error: unused 'type: ignore' comment
+ sphinx/util/logging.py:589: error: unused 'type: ignore' comment

pip (https://github.com/pypa/pip.git)
- src/pip/_internal/utils/logging.py:169: error: Incompatible types in assignment (expression has type "AnsiToWin32", variable has type "IO[str]")


zulip (https://github.com/zulip/zulip.git)
+ zerver/lib/test_console_output.py:69: error: unused 'type: ignore' comment

pytest (https://github.com/pytest-dev/pytest.git)
+ src/_pytest/logging.py:629: error: "SupportsWrite[str]" has no attribute "close"  [attr-defined]

@JelleZijlstra
JelleZijlstra merged commit 5f52e38 into python:master Mar 23, 2021
@srittau
srittau deleted the stream-handler branch March 23, 2021 07:46
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.

2 participants