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

Use __truediv__ for python2 with __future__ import, refs #11740 #11787

Merged
merged 3 commits into from Feb 23, 2022
Merged

Use __truediv__ for python2 with __future__ import, refs #11740 #11787

merged 3 commits into from Feb 23, 2022

Conversation

sobolevn
Copy link
Member

Now __future__ imports do not leak in semanal.py.

Closes #11740
Refs #11741
Refs #11276
Refs #11700

mypy/semanal.py Outdated
@@ -219,7 +219,7 @@ class SemanticAnalyzer(NodeVisitor[None],
errors: Errors # Keeps track of generated errors
plugin: Plugin # Mypy plugin for special casing of library features
statement: Optional[Statement] = None # Statement/definition being analyzed
future_import_flags: Set[str]
future_import_flags: Dict[str, Set[str]] # Module name / future imports
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could these be stored in MypyFile instead, to avoid two dictionaries keyed with a module name (see modules above)?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done! 👍

@github-actions
Copy link
Contributor

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

Copy link
Collaborator

@JukkaL JukkaL left a comment

Choose a reason for hiding this comment

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

Thanks!

@JukkaL JukkaL merged commit 14de8c6 into python:master Feb 23, 2022
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.

Python 2 future import can leak between modules
2 participants