Commit 114fe16b authored by Robert Bradshaw's avatar Robert Bradshaw

Don't generate pickling for types that already have a __getstate__ method.

parent b0a99d41
......@@ -1622,6 +1622,8 @@ if VALUE is not None:
checksum = '0x%s' % hashlib.md5(' '.join(all_members_names).encode('utf-8')).hexdigest()[:7]
unpickle_func_name = '__pyx_unpickle_%s' % node.class_name
# TODO(robertwb): Move the state into the third argument
# so it can be pickled *after* self is memoized.
unpickle_func = TreeFragment(u"""
def %(unpickle_func_name)s(__pyx_type, long __pyx_checksum, __pyx_state, %(args)s):
if __pyx_checksum != %(checksum)s:
......
......@@ -69,6 +69,8 @@ static int __Pyx_setup_reduce(PyObject* type_obj) {
PyObject *reduce_ex = NULL;
PyObject *reduce_cython = NULL;
if (PyObject_HasAttrString(type_obj, "__getstate__")) goto GOOD;
if (object_reduce_ex == NULL) {
__Pyx_setup_reduce_GET_ATTR_OR_BAD(builtin_object, __pyx_b, "object");
__Pyx_setup_reduce_GET_ATTR_OR_BAD(object_reduce, builtin_object, "__reduce__");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment