-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
Description
Crash Report
First time trying to compile my Python project with Mypyc; it seems to hang itself up on a specific match statement. Although there are a couple more in the code, it only complains about this one as far as I can tell. Replacing it with an semantically equivalent if-else gives me type warnings and errors instead (the expected result considering that these seem all valid).
Traceback
❯ uv run --with mypy[mypyc] mypyc -p nyl --show-traceback
Traceback (most recent call last):
File "mypyc/irbuild/builder.py", line 272, in accept
File "mypy/nodes.py", line 1648, in accept
File "mypyc/irbuild/visitor.py", line 252, in visit_match_stmt
File "mypyc/irbuild/statement.py", line 1022, in transform_match_stmt
File "mypy/nodes.py", line 1648, in accept
File "mypyc/irbuild/match.py", line 92, in visit_match_stmt
File "mypy/patterns.py", line 150, in accept
File "mypyc/irbuild/match.py", line 164, in visit_class_pattern
src/nyl/generator/components.py:81: AssertionError:
To Reproduce
- Clone https://github.com/helsing-ai/nyl and check out
0.8.1(that is HEAD today) - Run
uv run --with mypy[mypyc]==1.13.0 mypyc -p nyl
The specific piece of code that it seems to hiccup on is this:
match component:
case HelmComponent(path):
chart = HelmChart(
metadata=instance.metadata,
spec=HelmChartSpec(
chart=ChartRef(path=str(path.resolve())),
values={"metadata": resource["metadata"], **instance.spec},
),
)
return self.helm_generator.generate(chart)
case _:
raise RuntimeError(f"unexpected component type: {component}")There are a couple more match statements in the code which it doesn't seem to complain about after changing this to use if-else instead. I'm not exactly sure where best to start to reduce it to a smaller example.
Your Environment
- Mypy version used: 1.13.0
- Mypy command-line flags: -p nyl
- Mypy configuration options from
mypy.ini(and other config files):explicit_package_bases = true namespace_packages = true show_column_numbers = true strict = true mypy_path = ["src"] - Python version used: 3.11.9
- Operating system and version: WSL2 Ubuntu 22.04.5 LTS