Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Missing attribute _add_value_alias_ for Enum #14408

Open
Labels
help wantedAn actionable problem of low to medium complexity where a PR would be very welcomestubs: incompleteAnnotations or sub-modules missing from an existing package or module
@tjdcs

Description

@tjdcs

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedAn actionable problem of low to medium complexity where a PR would be very welcomestubs: incompleteAnnotations or sub-modules missing from an existing package or module

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp