import pickle
class ThingHolder:
__slots__ = ['thing']
def __init__(self, thing):
print(self, thing)
self.thing = thing
th = ThingHolder(None)
th.thing = th
th2 = pickle.loads(pickle.dumps(th, pickle.HIGHEST_PROTOCOL))
print()
print(th2, th2.thing)
aW1wb3J0IHBpY2tsZQoKY2xhc3MgVGhpbmdIb2xkZXI6CiAgICBfX3Nsb3RzX18gPSBbJ3RoaW5nJ10KICAgIGRlZiBfX2luaXRfXyhzZWxmLCB0aGluZyk6CiAgICAgICAgcHJpbnQoc2VsZiwgdGhpbmcpCiAgICAgICAgc2VsZi50aGluZyA9IHRoaW5nCgp0aCA9IFRoaW5nSG9sZGVyKE5vbmUpCnRoLnRoaW5nID0gdGgKCnRoMiA9IHBpY2tsZS5sb2FkcyhwaWNrbGUuZHVtcHModGgsIHBpY2tsZS5ISUdIRVNUX1BST1RPQ09MKSkKCnByaW50KCkKcHJpbnQodGgyLCB0aDIudGhpbmcp