Created
March 11, 2016 14:17
-
-
Save Sentient07/1d89790afd6e67c68bb3 to your computer and use it in GitHub Desktop.
An example where serialization throws maximum recursion depth exceeded RuntimeError
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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