mypy
bfe5024c - [mypyc] Fix crash on multiple nested decorated functions with same name (#20666)

Commit
136 days ago
[mypyc] Fix crash on multiple nested decorated functions with same name (#20666) This happens when a nested function has different definitions in different condition branches. mypyc currently crashes in this case when calling `get_func_target` in `transform_decorator` https://github.com/python/mypy/blob/master/mypyc/irbuild/function.py#L118. The `FuncDef` objects for the definitions after the first one will have the `original_def` attribute set. This makes `get_func_target` lookup this original def but it doesn't find it when the original def is a decorator because registers are only created for `FuncDef`s. Extracting a `FuncDef` from the original decorator and looking it up instead fixes the crash.
Author
Parents
Loading