Skip to content

New semantic analyzer: Fix (de)serialization of broken named tuples#6421

Merged
ilevkivskyi merged 6 commits intopython:masterfrom
ilevkivskyi:new-fix-broken-nt
Feb 18, 2019
Merged

New semantic analyzer: Fix (de)serialization of broken named tuples#6421
ilevkivskyi merged 6 commits intopython:masterfrom
ilevkivskyi:new-fix-broken-nt

Conversation

@ilevkivskyi
Copy link
Copy Markdown
Member

@ilevkivskyi ilevkivskyi commented Feb 17, 2019

Fixes #6413

In my original PR I missed the fact that "broken" named tuples (those where variable name and named tuple name are different) are stored under both names (one to actually access it, and other for (de)serialization).

I also extend the semantic analyzer API, and clean-up/clarify the symbol adding logic a bit.

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

Left some requests for clarification, since this is some pretty tricky code.

Comment thread mypy/build.py
semantic analyzer will perform this patch for us when processing stale
SCCs.
"""
Analyzer = Union[SemanticAnalyzerPass2, NewSemanticAnalyzer] # noqa
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.

What's this change? Is is related to the rest of this PR?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is needed because otherwise incremental tests crash with the new analyzer (I added couple incremental tests) with something like 'BuildManager' doesn't have attribute 'semantic_analyzer'.

Comment thread mypy/newsemanal/semanal_namedtuple.py Outdated
Comment thread mypy/newsemanal/semanal_namedtuple.py Outdated
Comment thread mypy/newsemanal/semanal_shared.py Outdated
Comment thread mypy/newsemanal/semanal.py
Copy link
Copy Markdown
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 for the updates!

@ilevkivskyi ilevkivskyi merged commit 027b86d into python:master Feb 18, 2019
@ilevkivskyi ilevkivskyi deleted the new-fix-broken-nt branch February 18, 2019 13:57
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