From 860de835c1b4a27282c685258bee6d16834695d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wiktor=20Niesiob=C4=99dzki?= Date: Thu, 20 Dec 2018 00:32:26 +0100 Subject: [PATCH] Use ENDMARKER for python 3.4 --- mypy/stubutil.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mypy/stubutil.py b/mypy/stubutil.py index 992540c71087..08f6029d7d2b 100644 --- a/mypy/stubutil.py +++ b/mypy/stubutil.py @@ -210,7 +210,9 @@ def infer_sig_from_docstring(docstr: str, name: str) -> Optional[List[TypedFunct accumulator = "" state.append(State.RETURN_VALUE) - elif token.type == tokenize.NEWLINE and state[-1] in (State.INIT, State.RETURN_VALUE): + # ENDMAKER is necessary for python 3.4 and 3.5 + elif token.type in (tokenize.NEWLINE, tokenize.ENDMARKER) and state[-1] in ( + State.INIT, State.RETURN_VALUE): if state[-1] == State.RETURN_VALUE: ret_type = accumulator accumulator = ""