-
-
Notifications
You must be signed in to change notification settings - Fork 34.7k
enum.global_enum: cls_name undefined in global_str #93100
Copy link
Copy link
Closed
Labels
3.11only security fixesonly security fixes3.12only security fixesonly security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Metadata
Metadata
Assignees
Labels
3.11only security fixesonly security fixes3.12only security fixesonly security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Fields
Give feedbackNo fields configured for issues without a type.
Bug report
In acf7403 (#30582), @ethanfurman implemented a
global_enumdecorator, replacing the__str__of an enum withenum.global_str:cpython/Lib/enum.py
Lines 1638 to 1645 in 760ec89
(This was later reverted in 42a64c0 and reintroduced in 83d544b, but I believe the code to be the same).
If the
._name_attribute isNone, this usescls_name, but that's not defined anywhere in that function!Here is a (somewhat contrived) example:
this fails with:
(Found by running
flake8overLib/out of curiosity, see #93010 (comment))Your environment