-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
bugmypy got something wrongmypy got something wrong
Description
Likely a duplicate of the same issue encountered in #17321, but posting because that issue was closed.
Bug Report
Mypyc seems to encounter an error when handling Literal[<anything>]
To Reproduce
base_io.py
from __future__ import annotations
from enum import Enum
from typing import Literal, TypeAlias
class StructFormat(str, Enum):
"""All possible write/read struct types.
.. seealso:
:module:`struct` module documentation.
"""
BOOL = "?"
CHAR = "c"
BYTE = "b"
UBYTE = "B"
SHORT = "h"
USHORT = "H"
INT = "i"
UINT = "I"
LONG = "l"
ULONG = "L"
FLOAT = "f"
DOUBLE = "d"
HALFFLOAT = "e"
LONGLONG = "q"
ULONGLONG = "Q"
INT_FORMATS_TYPE: TypeAlias = Literal[
StructFormat.BYTE,
StructFormat.UBYTE,
StructFormat.SHORT,
StructFormat.USHORT,
StructFormat.INT,
StructFormat.UINT,
StructFormat.LONG,
StructFormat.ULONG,
StructFormat.LONGLONG,
StructFormat.ULONGLONG,
]
FLOAT_FORMATS_TYPE: TypeAlias = Literal[
StructFormat.FLOAT,
StructFormat.DOUBLE,
StructFormat.HALFFLOAT,
]
mypyc base_io.py
Expected Behavior
No issues
Actual Behavior
Traceback (most recent call last):
base_io.py:32: KeyError: <mypy.nodes.MemberExpr object at 0x7038e01022a0>
Your Environment
- Mypy version used:
mypy 1.11.2 (compiled: yes)
- Mypy command-line flags: None
- Mypy configuration options from
mypy.ini
(and other config files): None - Python version used:
Python 3.12.3 (main, Sep 11 2024, 14:17:37) [GCC 13.2.0] on linux
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrong