Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

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

Enum does not equal to itself after importlib.reload #96858

Closed
ak1r4 opened this issue Sep 16, 2022 · 1 comment
Closed

Enum does not equal to itself after importlib.reload #96858

ak1r4 opened this issue Sep 16, 2022 · 1 comment
Labels
type-bug An unexpected behavior, bug, or error

Comments

@ak1r4
Copy link

ak1r4 commented Sep 16, 2022

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
@ak1r4 ak1r4 added the type-bug An unexpected behavior, bug, or error label Sep 16, 2022
@ak1r4
Copy link
Author

ak1r4 commented Sep 16, 2022

related #74730

@ak1r4 ak1r4 closed this as not planned Won't fix, can't repro, duplicate, stale Sep 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant