• Jason Madden's avatar
    Use a Python __reduce__ method to make pickles match C. · 0718a45e
    Jason Madden authored
    On it's own, this breaks on protocols >= 2 (including Python 3 by
    default) because the pickled object's class is required to match the
    reduce output. One fix would be to change the pickle format to use a
    custom constructor function, but then we'd have different pickle formats
    in C and Python.
    
    Rather than do that, we instead create a __class__ property for the
    python implementation. This bypasses the protocol limitations. The
    __class__ property wasn't assignable in the C implementation, so the
    compatibility risk should be very small.
    
    All the special pickle machinery is only defined in Python if needed.
    0718a45e
setup.py 5.32 KB