unparser: Ignore type errors for Python-2-only constructs

This commit is contained in:
Todd Gamblin 2023-02-23 00:28:59 -08:00
parent af3a165a20
commit 7238ab94f5
No known key found for this signature in database
GPG Key ID: C16729F1AACF66C6

View File

@ -413,6 +413,7 @@ def visit_Try(self, node):
self.dispatch(node.finalbody)
def visit_TryExcept(self, node):
# this construct only exists in Python < 3.3
self.fill("try")
with self.block():
self.dispatch(node.body)
@ -425,7 +426,8 @@ def visit_TryExcept(self, node):
self.dispatch(node.orelse)
def visit_TryFinally(self, node):
if len(node.body) == 1 and isinstance(node.body[0], ast.TryExcept):
# this construct only exists in Python < 3.3
if len(node.body) == 1 and isinstance(node.body[0], ast.TryExcept): # type: ignore
# try-except-finally
self.dispatch(node.body)
else: