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
4 changes: 1 addition & 3 deletions mypyc/codegen/emitclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -608,9 +608,7 @@ def generate_vtable(
method = entry.shadow_method if shadow and entry.shadow_method else entry.method
emitter.emit_line(
"(CPyVTableItem){}{}{},".format(
emitter.get_group_prefix(entry.method.decl),
NATIVE_PREFIX,
method.cname(emitter.names),
emitter.get_group_prefix(method.decl), NATIVE_PREFIX, method.cname(emitter.names)
)
)

Expand Down
29 changes: 29 additions & 0 deletions mypyc/test-data/run-multimodule.test
Original file line number Diff line number Diff line change
Expand Up @@ -2019,3 +2019,32 @@ class Child(Parent):
[file driver.py]
from native import test
test()

[case testCompiledSubclassOfCompiledBaseThatAllowsInterpretedSubclasses]
from mypy_extensions import mypyc_attr

from other import CompiledBase

class CompiledSubclass(CompiledBase):
def value(self) -> int:
return 1

@mypyc_attr(allow_interpreted_subclasses=True)
class CompiledSubclassThatAllowsInterpreted(CompiledBase):
def value(self) -> int:
return 2

def test_compiled_subclasses_of_compiled_base_that_allows_interpreted_subclasses() -> None:
c1 = CompiledSubclass()
assert c1.value() == 1

c2 = CompiledSubclassThatAllowsInterpreted()
assert c2.value() == 2

[file other.py]
from mypy_extensions import mypyc_attr

@mypyc_attr(allow_interpreted_subclasses=True)
class CompiledBase:
def value(self) -> int:
raise NotImplementedError
Loading