Skip to content

Commit

Permalink
fix: except-handler-type
Browse files Browse the repository at this point in the history
  • Loading branch information
15r10nk committed Oct 20, 2023
1 parent bbaa330 commit f08b0ee
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
12 changes: 7 additions & 5 deletions pysource_minimize/_minimize.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ class CoverageRequired(Exception):
pass


def coverage_required():
if TESTING:
raise CoverageRequired()


def equal_ast(lhs, rhs):
if type(lhs) != type(rhs):
return False
Expand All @@ -59,11 +64,6 @@ def equal_ast(lhs, rhs):
assert False, f"unexpected type {type(lhs)}"


def coverage_required():
if TESTING:
raise CoverageRequired()


def arguments(
node: Union[ast.FunctionDef, ast.AsyncFunctionDef, ast.Lambda]
) -> List[ast.arg]:
Expand Down Expand Up @@ -743,6 +743,8 @@ def minimize_except_handler(handler):

if not handler.name and not try_star:
self.minimize_optional(handler.type)
elif handler.type is not None:
self.minimize(handler.type)

if handler.name:
self.try_attr(handler, "name", None)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
try:
pass
except* lambda name_4, /, name_1=name_0, *name_5: name_4:
pass
except* (name_2 for name_4 in name_4 if name_3):
pass

0 comments on commit f08b0ee

Please sign in to comment.