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
10 changes: 5 additions & 5 deletions mypyc/irbuild/prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,11 @@ def load_type_map(mapper: Mapper, modules: list[MypyFile], deser_ctx: DeserMaps)
continue
mapper.type_to_ir[node.node] = ir
mapper.symbol_fullnames.add(node.node.fullname)
# Trait/builtin-base classes have an ir.ctor FuncDecl
# but no emitted CPyDef_<ctor>, so a cross-group direct
# call would hit an undefined symbol. Mirror the skip
# in prepare_init_method.
if not ir.is_trait and not ir.builtin_base:
# Non-extension, trait and builtin-base classes have no
# emitted CPyDef_<ctor>, so a cross-group direct call
# would hit an undefined symbol. Mirror the conditions
# under which prepare_init_method registers a ctor.
if ir.is_ext_class and not ir.is_trait and not ir.builtin_base:
mapper.func_to_decl[node.node] = ir.ctor

for module in modules:
Expand Down
21 changes: 21 additions & 0 deletions mypyc/test-data/run-multimodule.test
Original file line number Diff line number Diff line change
Expand Up @@ -1421,6 +1421,27 @@ import native
0
None

[case testIncrementalCompilationWithNonExtClass]
import other_a
[file other_a.py]
from other_b import C
[file other_a.py.2]
from other_b import C
c = C(5)
print(c.x)
[file other_b.py]
from mypy_extensions import mypyc_attr

@mypyc_attr(native_class=False)
class C:
def __init__(self, x: int) -> None:
self.x = x
[file driver.py]
import native
[out]
[out2]
5

[case testIncrementalCompilationWithNonClassTypeDef]
import other_a
[file other_a.py]
Expand Down
Loading