Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion mypyc/irbuild/callable_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class for the nested function.
# Define the actual callable class ClassIR, and set its
# environment to point at the previously defined environment
# class.
callable_class_ir = ClassIR(name, builder.module_name, is_generated=True)
callable_class_ir = ClassIR(name, builder.module_name, is_generated=True, is_final_class=True)

# The functools @wraps decorator attempts to call setattr on
# nested functions, so we create a dict for these nested
Expand Down
5 changes: 4 additions & 1 deletion mypyc/irbuild/env_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ class is generated, the function environment has not yet been
containing a nested function.
"""
env_class = ClassIR(
f"{builder.fn_info.namespaced_name()}_env", builder.module_name, is_generated=True
f"{builder.fn_info.namespaced_name()}_env",
builder.module_name,
is_generated=True,
is_final_class=True,
)
env_class.attributes[SELF_NAME] = RInstance(env_class)
if builder.fn_info.is_nested:
Expand Down
2 changes: 1 addition & 1 deletion mypyc/irbuild/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def instantiate_generator_class(builder: IRBuilder) -> Value:
def setup_generator_class(builder: IRBuilder) -> ClassIR:
name = f"{builder.fn_info.namespaced_name()}_gen"

generator_class_ir = ClassIR(name, builder.module_name, is_generated=True)
generator_class_ir = ClassIR(name, builder.module_name, is_generated=True, is_final_class=True)
if builder.fn_info.can_merge_generator_and_env_classes():
builder.fn_info.env_class = generator_class_ir
else:
Expand Down