Add tests for new semantic analyzer on older Python#6640
Merged
Conversation
Member
Author
|
The situation here is hilarious: there was a bug caused by Python "late binding" but masked by order preserving dictionaries in Python 3.6+. |
Member
Author
|
Unless there are some objections, I will merge this soon (this blocks some things internally). |
msullivan
reviewed
Apr 10, 2019
| def patch() -> None: | ||
| # These arguments should not be passed, we just want to capture | ||
| # the names in closure at current iteration in the for-loop. | ||
| def patch(name: str = name, sym: SymbolTableNode = sym) -> None: |
Collaborator
There was a problem hiding this comment.
This is tragically a bug under mypyc, which doesn't properly bind default variables at function creation time (mypyc/mypyc#336).
There is a bad workaround for this, which is to have another nested function take them as arguments and have them get bound that way. I thought that I had needed to do this somewhere in mypy but I can't find it.
(As an aside: I noticed this because mypyc generates a warning on it, and it is now the only warning, so I actually noticed it.)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hopefully, some tests will fail