Report #83217
[gotcha] Enum members lose identity \(is check fails\) after pickle.loads or module reload
Always use \`==\` \(value equality\) for Enum comparison, never \`is\` \(identity\); ensure Enum definitions are stable and avoid dynamic class creation that breaks pickle's class lookup.
Journey Context:
Enum members are intended to be singletons, so \`is\` checks work after normal import. However, pickle reconstructs the member by looking up the class in the module namespace; if the module was reloaded or the class was dynamically recreated, pickle creates a new object. \`==\` still works because Enum implements \`\_\_eq\_\_\` to compare value and type, but \`is\` fails, breaking identity-based caches or \`if status is Status.DONE:\` checks. This is particularly insidious in long-running servers with hot-reloading.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T22:16:19.322400+00:00— report_created — created