Skip to content
Snippets Groups Projects
Commit 75d4e2cd authored by Joseph Weston's avatar Joseph Weston
Browse files

Merge branch 'fix/pickling' into 'stable'

fix pickling on Cython 0.26

See merge request !175
parents c6ef1826 9ed2793e
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -719,15 +719,22 @@ cdef class CGraph_malloc(CGraph):
init_args = (twoway, edge_nr_translation, num_nodes,
num_pp_edges, num_pn_edges, num_np_edges)
return (init_args, self._heads_idxs, self._heads, self._tails_idxs,
self._tails, self._edge_ids, self._edge_ids_by_edge_nr)
return init_args, (self._heads_idxs, self._heads, self._tails_idxs,
self._tails, self._edge_ids,
self._edge_ids_by_edge_nr)
def __setstate__(self, state):
self.__init__(*state[0])
init_args, arrays = state
self.__init__(*init_args)
array_attributes = (self._heads_idxs, self._heads, self._tails_idxs,
self._tails, self._edge_ids,
self._edge_ids_by_edge_nr)
for attribute, value in zip(array_attributes, state[1:]):
for attribute, value in zip(array_attributes, arrays):
if attribute is None:
continue
attribute[:] = value
# We are required to implement this as of Cython 0.26
def __reduce__(self):
state = init_args, _ = self.__getstate__()
return (CGraph_malloc, init_args, state, None, None)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment