Skip to content

Add tests for new semantic analyzer on older Python#6640

Merged
ilevkivskyi merged 4 commits into
python:masterfrom
ilevkivskyi:more-new-analyzer-tests
Apr 6, 2019
Merged

Add tests for new semantic analyzer on older Python#6640
ilevkivskyi merged 4 commits into
python:masterfrom
ilevkivskyi:more-new-analyzer-tests

Conversation

@ilevkivskyi
Copy link
Copy Markdown
Member

Hopefully, some tests will fail

@ilevkivskyi
Copy link
Copy Markdown
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+.

@ilevkivskyi
Copy link
Copy Markdown
Member Author

Unless there are some objections, I will merge this soon (this blocks some things internally).

@ilevkivskyi ilevkivskyi merged commit ffb3ce9 into python:master Apr 6, 2019
@ilevkivskyi ilevkivskyi deleted the more-new-analyzer-tests branch April 6, 2019 20:43
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:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.)

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