Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix generator class detection
  • Loading branch information
JukkaL committed Jul 4, 2025
commit bcf9bbc575252dfa87c5be18feab883193df64e2
6 changes: 3 additions & 3 deletions mypyc/irbuild/statement.py
Original file line number Diff line number Diff line change
Expand Up @@ -932,8 +932,9 @@ def emit_yield_from_or_await(
to_yield_reg = Register(object_rprimitive)
received_reg = Register(object_rprimitive)

if isinstance(val, (Call, MethodCall)) and isinstance(val.type, RInstance) and val.type.class_ir.is_generated:
# XXX is_generator not is_generated !!!!!!! FIXME FIXME
helper_method = "__mypyc_generator_helper__"
if isinstance(val, (Call, MethodCall)) and isinstance(val.type, RInstance) and val.type.class_ir.has_method(helper_method):
# This is a generated generator class, and we can use a fast path.
iter_val = val
else:
get_op = coro_op if is_await else iter_op
Expand All @@ -946,7 +947,6 @@ def emit_yield_from_or_await(

stop_block, main_block, done_block = BasicBlock(), BasicBlock(), BasicBlock()

helper_method = "__mypyc_generator_helper__"
if isinstance(iter_reg.type, RInstance) and iter_reg.type.class_ir.has_method(helper_method):
obj = builder.read(iter_reg)
nn = builder.none_object()
Expand Down