Skip to content

Fix crash on match statement with value restricted TypeVar #13728

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

Merged
merged 4 commits into from
Sep 26, 2022

Conversation

hauntsaninja
Copy link
Collaborator

@hauntsaninja hauntsaninja commented Sep 24, 2022

Fixes #13727, fixes #12448, fixes #13213

@github-actions

This comment has been minimized.

guards=self.optional_expressions(o.guards),
bodies=self.blocks(o.bodies),
)

Copy link
Member

Choose a reason for hiding this comment

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

I wonder why the next method does not do self.expr(node.expr).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, I was wondering about that too. I guess I should probably not be lazy and write out all the boilerplate for patterns...

@github-actions

This comment has been minimized.

1 similar comment
@github-actions
Copy link
Contributor

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

@hauntsaninja hauntsaninja changed the title Fix crash on match statement Fix crash on match statement with value restricted TypeVar Sep 25, 2022
Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

Sadly, I cannot come up with any ideas on how to catch this early.
Since NodeVisitor does not have abstract methods.

🤔

@hauntsaninja hauntsaninja merged commit f56a071 into python:master Sep 26, 2022
@hauntsaninja hauntsaninja deleted the fix-match branch September 26, 2022 16:35
dosisod added a commit to dosisod/refurb that referenced this pull request Sep 27, 2022
Sadly, python/mypy#13728 was not merged into the 0.981
release, meaning we still have the weird None check when using the `extract_binary_oper`
function. I could just use the master branch instead of the pypi release of
mypy, but those don't have wheels built for it, meaning it would (probably) be
a lot harder to install for the end user.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants