-
Notifications
You must be signed in to change notification settings - Fork 25.7k
Closed
Labels
good first issueoncall: jitAdd this issue/PR to JIT oncall triage queueAdd this issue/PR to JIT oncall triage queuetriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module
Description
Repro:
@torch.jit.script
class Timebase:
def __init__(
self,
numerator, # type: int
denominator, # type: int
):
# type: (...) -> None
self.numerator = numerator # type: int
self.denominator = denominator # type: int
Produces the error:
RuntimeError: Return type line '# type: (...) -> ...' not found on multiline type annotation
(See PEP 484 https://www.python.org/dev/peps/pep-0484/#suggested-syntax-for-python-2-7-and-straddling-code)
Even though we have clearly put the return type comment in the function. This is due to a bug in the type comment parser, which expects the return type line to be the last element of the list (see here).
Fix is simple, just search for the return type line instead of assuming it's the last one.
cc @suo
Metadata
Metadata
Assignees
Labels
good first issueoncall: jitAdd this issue/PR to JIT oncall triage queueAdd this issue/PR to JIT oncall triage queuetriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module