You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
comparison-overlap triggers for string enum members when the member name isn't the same as the comparison value #19576
Hi @bzoracler, for me, this is a true positive, because you are comparing an enum value and a string. IMO, the right thing to do is to compare A.a.value == "b", no ? 🤔
@florianvazelle No, as mentioned in the issue title, this is about string enums. String enums (including enum.StrEnum) don't need to access .value to perform str operations or be treated as a str, as explicitly stated in the Python docs:
StrEnum is the same as Enum, but its members are also strings and can be used in most of the same places that a string can be used.
Activity
Merge remote-tracking branch 'upstream/master' into bugfix/pythongh-1…
Merge remote-tracking branch 'upstream/master' into bugfix/pythongh-1…
Merge branch 'master' into bugfix/pythongh-19576-enum-comparison-overlap
Merge branch 'master' into bugfix/pythongh-19576-enum-comparison-overlap
florianvazelle commentedon Oct 14, 2025
Hi @bzoracler, for me, this is a true positive, because you are comparing an enum value and a string. IMO, the right thing to do is to compare
A.a.value == "b", no ? 🤔bzoracler commentedon Oct 14, 2025
@florianvazelle No, as mentioned in the issue title, this is about string enums. String enums (including
enum.StrEnum) don't need to access.valueto performstroperations or be treated as astr, as explicitly stated in the Python docs:You can try it yourself:
florianvazelle commentedon Oct 14, 2025
Ok, thank you for clarifying that 🙏
Merge branch 'master' into bugfix/pythongh-19576-enum-comparison-overlap