[issue44342] enum with inherited type won't pickle

Ethan Furman report at bugs.python.org
Thu Jun 10 17:55:43 EDT 2021


Ethan Furman <ethan at stoneleaf.us> added the comment:

Looking into this I think the root of the problem is the way `reduce` is handled -- currently, Enum's `__reduce_ex__` works by returning the class, and the value to use to lookup the member.  Because that lookup can fail with complex enums, EnumType will sabotage `reduce` if it can't find support in the new enum class.

However, if `__reduce_ex__` working by returning

    `getattr, (self.__class, self._name_)`

then we should be fine, as that should never fail.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44342>
_______________________________________


More information about the Python-bugs-list mailing list