Skip to content
Open
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
44 changes: 44 additions & 0 deletions mypyc/test-data/run-multimodule.test
Original file line number Diff line number Diff line change
Expand Up @@ -1734,3 +1734,47 @@ class Base:
from native import make_child
assert make_child(7) == "child(7)"
assert make_child(-1) == "child(-1)"

[case testIncrementalBuiltinBaseClassConstruction]
# Regression: builtin_base classes (Exception subclasses) were unconditionally
# added to func_to_decl in load_type_map, causing cross-group call sites to
# emit CPyDef instead of CPyType for the constructor.
from other_errors import MyError
from other_util import process

def run(value: str) -> None:
if not value:
raise MyError("empty")

def compute(x: str) -> str:
result = process(x)
if not result:
raise MyError("no result")
return result

[file other_errors.py]
class MyError(Exception):
pass

[file other_util.py]
def process(x: str) -> str:
return x

[file other_util.py.2]
def process(x: str, flag: bool = False) -> str:
return x.strip()

[file driver.py]
from native import run, compute
try:
run("")
except Exception as e:
print(str(e))
print(compute("hello"))

[out]
empty
hello
[out2]
empty
hello
Loading