[issue20534] Enum tests fail with pickle protocol 4
Serhiy Storchaka
report at bugs.python.org
Sat Feb 8 14:31:20 CET 2014
Serhiy Storchaka added the comment:
I don't know if this was discussed, but as far as enums will be used for platform depending constants (as ENOENT or AF_UNIX), I think that enums should be pickled by name, not by value. Here is the __reduce_ex__ implementation:
def __reduce_ex__(self, proto):
if proto < 4:
return getattr, (self.__class__, self._name_)
return self.__class__.__qualname__ + '.' + self._name_
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20534>
_______________________________________
More information about the Python-bugs-list
mailing list