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

Fix lambda function analysis #70

Merged

Conversation

tristanlatr
Copy link
Contributor

@tristanlatr tristanlatr commented Aug 7, 2023

Fixes #67.
This also fixes a bug in the Lambda.args.defaults handling.

@@ -1025,11 +1025,19 @@ def visit_UnaryOp(self, node):
def visit_Lambda(self, node, step=DeclarationStep):
if step is DeclarationStep:
dnode = self.chains.setdefault(node, Def(node))
for default in node.args.defaults:

Choose a reason for hiding this comment

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

While reading this I realize that we also don't visit argument annotations for lambda in case of future_annotations.

What do you think of aggregating the behavior of lambda and functiondef analysis in a helper function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Lambda functions don't have annotations.

What do you think of aggregating the behavior of lambda and functiondef analysis in a helper function?

I think it's not worth it.

Choose a reason for hiding this comment

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

Well it would have avoided this patch ;-)

@serge-sans-paille serge-sans-paille merged commit 8f30c16 into serge-sans-paille:master Aug 19, 2023
8 checks passed
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.

Regression in Lambda functions
2 participants