Report #57825
[gotcha] Using \`is\` to compare Enum members fails after reconstruction or unpickling
Always use \`==\` for Enum comparisons; reserve \`is\` only for checking against module-level constants like \`Color.RED is color\_instance\` when the instance is guaranteed to be the same object.
Journey Context:
Enum members are singletons within a process, but reconstructing an Enum via \`MyEnum\(value\)\` or unpickling creates a new object instance. \`==\` checks value equality \(works across instances\), while \`is\` checks object identity \(fails for reconstructed objects\). This silently breaks identity checks during caching, serialization, or when comparing user input against enum constants.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T03:32:53.708062+00:00— report_created — created