Skip to content

Commit 92818b2

Browse files
committed
compile to noop if tuple is empty
1 parent c52323d commit 92818b2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

mypyc/irbuild/specialize.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,11 @@ def translate_isinstance(builder: IRBuilder, expr: CallExpr, callee: RefExpr) ->
654654
obj = builder.accept(obj_expr, can_borrow=can_borrow)
655655
return builder.builder.isinstance_helper(obj, irs, expr.line)
656656

657-
if isinstance(type_expr, TupleExpr) and type_expr.items:
657+
if isinstance(type_expr, TupleExpr):
658+
if not type_expr.items:
659+
# we can compile this case to a noop
660+
return builder.false()
661+
658662
nodes: list[SymbolNode | None] = []
659663
for item in type_expr.items:
660664
if not isinstance(item, RefExpr):

0 commit comments

Comments
 (0)