Skip to content

Conversation

@ilevkivskyi
Copy link
Member

See first test case for the scenario where this causes issues (the second test case is already handled elsewhere and just added for completeness). This is an old issue, but it is important to fix it now because recent changes to PEP 484 about re-export force people to use function aliases.

@ilevkivskyi ilevkivskyi requested a review from JukkaL January 6, 2021 13:02
# a trivial copy, or do something completely different? See
# testGenericFunctionAliasExpand for an example where this is important.
if original.kind != GDEF:
target = self.visit_var(target)
Copy link
Collaborator

Choose a reason for hiding this comment

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

If you remove visit_mypy_file from the class (I think that it's unused), this will be completely reasonable, since this will be reference to something outside the AST node we are transforming.

Copy link
Member Author

Choose a reason for hiding this comment

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

OK.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe also update the docstring that this can only be used to transform functions or classes, not top-level statements and such.

@ilevkivskyi ilevkivskyi merged commit 28f92ac into python:master Jan 6, 2021
@ilevkivskyi ilevkivskyi deleted the fix-gen-func-alias branch January 6, 2021 16:19
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