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.
By clicking “Sign up for GitHub”, you agree to our
terms of service
and
privacy statement
. We’ll occasionally send you account related emails.
Already on GitHub?
Sign in
to your account
Bug report
Python enum fails equality test against itself after reloading using
importlib.reload
Suppose we have a module:
# mod_enum.py
import enum
class E(enum.Enum):
A = 'A'
In a Python shell:
>>> import importlib
>>> import mod_enum
>>> old_enum = mod_enum.E.A
>>> id(old_enum)
140661148711472
>>> importlib.reload(mod_enum)
<module 'mod_enum' from 'mod_enum.py'>
>>> new_enum = mod_enum.E.A
>>> id(new_enum)
140661156076320
>>> old_enum == new_enum
False
Your environment
CPython versions tested on: 3.8.10, 3.12.0
Operating system and architecture: Linux x86