Mypyc: Crash when using property deleter
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
Crash Report
Mypyc fails to compile a class that has a property with a deleter, crashing with an internal error instead of giving proper mypy error messages. (Mypy check passes.)
Traceback
$ mypyc compile.py
Traceback (most recent call last):
compile.py:2: KeyError: <mypy.nodes.FuncDef object at 0x0000021161F65B40>
To Reproduce
In a file, create a class, and create a property with getter and deleter, and optionally a setter.
class C:
@property
def x(self) -> int:
return 0
@x.deleter
def x(self) -> None:
pass
Run mypyc filename.py
Your Environment
- Mypy version used: 1.11.2 (compiled)
- Mypyc command-line flags: None
- Mypyc configuration options from
mypy.ini(and other config files): None - Python version used: 3.12.4
- Operating system and version: Windows 11
Related: #13231 (open)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the crash with the supplied property getter/deleter example by running mypyc filename.py. Start at the mypyc compilation path handling properties and inspect the failing function lookup shown by the KeyError. Done means the example no longer crashes and instead produces proper mypy error messages.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100