Skip to content

Conversation

JukkaL
Copy link
Collaborator

@JukkaL JukkaL commented Feb 25, 2022

Use renaming to allow two with statements to define the same variable
using incompatible types. The implementation is pretty simple-minded
and doesn't work in cases where there is even a hint of potential
ambiguity about which variant of a variable a reference targets, typically
due to functions.

This could be generalized to for statements in the future.

Fixes #12246.

@github-actions
Copy link
Contributor

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

bandersnatch (https://github.com/pypa/bandersnatch)
+ src/bandersnatch/tests/test_utils.py:74: error: Unused "type: ignore" comment
+ src/bandersnatch/tests/test_utils.py:88: error: Unused "type: ignore" comment
+ src/bandersnatch/tests/plugins/test_storage_plugins.py:686: error: Unused "type: ignore" comment
+ src/bandersnatch/tests/plugins/test_storage_plugins.py:696: error: Unused "type: ignore" comment

zulip (https://github.com/zulip/zulip)
- tools/setup/generate_integration_bots_avatars.py:54: error: Incompatible types in assignment (expression has type "BufferedWriter", variable has type "BufferedReader")  [assignment]

pip (https://github.com/pypa/pip)
- src/pip/_internal/req/req_uninstall.py:623: error: Incompatible types in assignment (expression has type "BufferedWriter", variable has type "BufferedReader")
- src/pip/_internal/operations/install/wheel.py:107: error: Incompatible types in assignment (expression has type "BufferedWriter", variable has type "BufferedReader")

pyinstrument (https://github.com/joerick/pyinstrument)
- pyinstrument/renderers/html.py:79: error: Incompatible types in assignment (expression has type "StreamReaderWriter", variable has type "StreamWriter")

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.

Readable and writable binary files cause false positives
2 participants