Skip to content

Instantly share code, notes, and snippets.

@Sentient07
Created March 11, 2016 14:17
Show Gist options
  • Save Sentient07/1d89790afd6e67c68bb3 to your computer and use it in GitHub Desktop.
Save Sentient07/1d89790afd6e67c68bb3 to your computer and use it in GitHub Desktop.
An example where serialization throws maximum recursion depth exceeded RuntimeError
class Node():
pass
nodes = []
for i in range( 100 ):
n = Node()
nodes.append( n )
for n in nodes:
n.connections = set( nodes )
n.connections.remove( n )
print len(nodes)
#Change the next two lines with dill, cloudpickle and pickle
import dill
try:
dill.dump( n, open( 'file', 'wb' ) )
except RuntimeError as e:
print e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment