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

Adds in_checked_function() to semanal similar to the one in checker #11156

Merged
merged 2 commits into from
Sep 22, 2021
Merged

Adds in_checked_function() to semanal similar to the one in checker #11156

merged 2 commits into from
Sep 22, 2021

Conversation

sobolevn
Copy link
Member

Refs #11155

@@ -3506,6 +3506,9 @@ def visit_lambda_expr(self, e: LambdaExpr) -> Type:
# Type check everything in the body except for the final return
# statement (it can contain tuple unpacking before return).
with self.chk.scope.push_function(e):
# Lambdas can have more than one element in body,
Copy link
Member Author

Choose a reason for hiding this comment

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

I've added this comment because it took me quite some time to understand how lambda can possibly have more than one body item.

Copy link
Member

Choose a reason for hiding this comment

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

So can this happen only in Python 2?

Copy link
Member Author

Choose a reason for hiding this comment

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

There might be other cases, I am not sure. I've mentioned a single example I found.

mypy/checkexpr.py Outdated Show resolved Hide resolved
@JukkaL JukkaL merged commit b7d8724 into python:master Sep 22, 2021
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.

3 participants