New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't crash on unexpected PY2 except syntax #4011

merged 5 commits into from Sep 26, 2017
Jump to file or symbol
Failed to load files and symbols.
+7 −6
Diff settings


Just for now

@@ -586,15 +586,16 @@ def try_handler(self,
orelse: List[ast27.stmt],
finalbody: List[ast27.stmt],
lineno: int) -> TryStmt:
def produce_name(item: ast27.ExceptHandler) -> Optional[NameExpr]:
vs = [] # type: List[Optional[NameExpr]]
for item in handlers:
if is None:
return None
elif isinstance(, ast27.Name):
return NameExpr(
raise RuntimeError("'{}' has non-Name name.".format(ast27.dump(item)))
vs = [produce_name(h) for h in handlers]"Sorry, `except <expr>, <anything but a name>` is not supported",
item.lineno, item.col_offset)
types = [self.visit(h.type) for h in handlers]
handlers_ = [self.as_required_block(h.body, h.lineno) for h in handlers]
ProTip! Use n and p to navigate between commits in a pull request.