Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork1.9k
Description
Bug Report
Describe the bug
Pyright reports an attribute access error for the method that was added to Python's enum module in version 3.13.
Error Message
Cannot access attribute "_add_value_alias_" for class "EOTFType*"Attribute "_add_value_alias_" is unknown (reportAttributeAccessIssue)
Code Sample
fromenumimportEnumfromtypingimportAnyclassEOTFType(str,Enum):RESERVED= ("RESERVED",0)SDR= ("SDR",1)PQ= ("PQ",2)HLG= ("HLG",3)def__new__(cls,value:str,*args:Any):self=str.__new__(cls,value)self._value_=valueforainargs:self._add_value_alias_(a)# Pyright error herereturnself
Expected behavior
Pyright should recognize_add_value_alias_
as a valid method on enum classes in Python 3.13.
Environment
- Pyright version: 1.1.403
- Python version: 3.13
- Platform: macOS
Additional context
According to thePython 3.13 enum documentation,_add_value_alias_
was added in version 3.13 as a method ofEnumType
to "add a new value as an alias to an existing member".
The method works correctly at runtime but Pyright's type stubs appear to be missing this new method. This affects code that uses this legitimate Python 3.13 enum feature.
Workaround
Currently using# type: ignore
comment to suppress the error, but proper type stub support would be preferred.