[issue20534] Enum tests fail with pickle protocol 4

Ethan Furman report at bugs.python.org
Sat Feb 8 14:00:47 CET 2014


Ethan Furman added the comment:

The only thing I hate more than being wrong is being wrong because Python isn't acting the way I think it should.  :/

So, __qualname__ is not set properly when using the function API (although it has nothing to do with manually setting __module__ (I removed it, tested, no difference)).

And, if a subclass defines __reduce__, but an ancestor class defines __reduce_ex__, the ancestor class wins -- this seems to completely defeat the purpose of subclassing.

I'll add a 'qualname' parameter (mirroring the 'module' parameter) to the function API, and I'll use __reduce_ex__.

A little experimenting shows that if the base class implements any of __reduce__, __reduce_ex__, __getnewargs__, or __getnewargs_ex__ that pickling will work, so modified that portion of Enum as well.

----------
nosy: +eli.bendersky
resolution: fixed -> 
Added file: http://bugs.python.org/file33993/issue20534.stoneleaf.03.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20534>
_______________________________________


More information about the Python-bugs-list mailing list