-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Description
The EnumMeta class in enum.pyi was recently modified to include a __setattr__ and __delattr__ method. These were flagged as a bug in pyright's unit tests because an attempt to set or delete an attribute on an enum class results in a runtime error.
from enum import Enum
class Color(Enum):
red = "red"
# This should generate an error because reassignment of enum
# values is not allowed.
# Note: A change to typeshed's enum.pyi breaks this test.
Color.red = "new" # Runtime exceptionThe above code is no longer flagged as an error by pyright although it generates a runtime exception.
@AlexWaygood, I think you submitted the PR for this change. Was the addition of __setattr__ and __delattr__ intentional?
AlexWaygood
Metadata
Metadata
Assignees
Labels
No labels