KEMBAR78
Do pass 1 semanatic analysis on the FuncDef of decorated functions by msullivan · Pull Request #5654 · python/mypy · GitHub
Skip to content

Conversation

@msullivan
Copy link
Collaborator

This populates fullname properly, fixing a crash where a decorated
function is used as a type annotation in an import cycle,
as well as fixing an obscure bug in sys.platform checks inside
decorated functions.

Fixes #5652.

This populates fullname properly, fixing a crash where a decorated
function is used as a type annotation in an import cycle,
as well as fixing an obscure bug in sys.platform checks inside
decorated functions.

Fixes #5652.
Copy link
Member

@ilevkivskyi ilevkivskyi 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 quick fix! Only one suggestion.

self.analyze_lvalue(lval, explicit_type=s.type is not None)

def visit_func_def(self, func: FuncDef) -> None:
def visit_func_def(self, func: FuncDef, decorated: bool = False) -> None:
Copy link
Member

Choose a reason for hiding this comment

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

I would document the argument and the need for it, because it is not obvious.

@msullivan msullivan merged commit 1bc1047 into master Sep 21, 2018
@msullivan msullivan deleted the semanal1-decorator branch September 21, 2018 00:52
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.

Crash when using decorated function as type annotation in import cycle

2 participants