Consider
def createB():
class B(object):
def __init__(self):
super(B, self).__init__()
return B
Now dill.dumps(createB()) fails with an infinite loop of
T2: <class '__main__.B'>
D2: <dict object at 0x10ef5e050>
F1: <function __init__ at 0x10f075aa0>
D1: <dict object at 0x10e7ac050>
# D1
Ce: <cell at 0x10f013e88: type object at 0x7ff6a1d7cdb0>
T2: <class '__main__.B'>
...