Skip to content

mypyc internal error: should be unreachable on final NamedTuple #927

@narpfel

Description

@narpfel

Annotating a NamedTuple with @final leads to a RuntimeError when trying to import the compiled module.

t.py:

from typing import NamedTuple
from typing import final

@final
class T(NamedTuple):
    x: int
$ virtualenv venv
$ . venv/bin/activate
$ python -VV
Python 3.10.4 (main, Mar 23 2022, 23:05:40) [GCC 11.2.0]
$ pip install git+https://github.com/python/mypy
$ mypyc --version
mypy 0.960+dev.7fbf4deb845d6041700d1addc6eaa2097560f0f3 (compiled: no)
$ mypyc t.py
$ python -c "import t"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "t.py", line 4, in <module>
    @final
RuntimeError: mypyc internal error: should be unreachable

Metadata

Metadata

Assignees

Labels

bugcrashFailing compile-time asserts, unhandled exceptions, or generated C code that's blowing up.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions