I\'m trying to pickle a class instance containing two lists of another instances. The instances in the two lists have attributes that refer instances of each other. Here are
There are some kinds of data the older pickle protocol cannot handle. To solve your problem, use pickle.HIGHEST_PROTOCOL
>>> p = pickle.dumps(g)
File "/usr/lib/python2.6/pickle.py", line 244, in memoize
assert id(obj) not in self.memo
AssertionError:
>>> p = pickle.dumps(g, pickle.HIGHEST_PROTOCOL)
>>> # No problem!