Bug description:
This was found by Codex. Consider the following:
import enum
import _testinternalcapi
class ColorMeta(enum.EnumType):
pass
class Color(enum.IntEnum, metaclass=ColorMeta):
RED = 1
red = Color.RED
class Descriptor(enum.IntEnum):
RED = 1
def __get__(self, obj, owner):
return "descr"
def get_enum_member():
return Color.RED
for _ in range(_testinternalcapi.SPECIALIZATION_THRESHOLD):
assert get_enum_member() == 1
red.__class__ = Descriptor
for _ in range(_testinternalcapi.SPECIALIZATION_THRESHOLD):
assert get_enum_member() == "descr"
This passes without specializing interpreter, but fails with. @kumaraditya303
CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Linked PRs
Bug description:
This was found by Codex. Consider the following:
This passes without specializing interpreter, but fails with. @kumaraditya303
CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Linked PRs
LOAD_ATTR_CLASS_WITH_METACLASS_CHECKon reassining__class__#149269