Skip to content

Instantly share code, notes, and snippets.

@Bogdanp
Created Oct 15, 2020
Embed
What would you like to do?
class Message:
def __init__(self):
self._exception = None
def __del__(self):
print("running after object number %d was allocated" % i)
def f():
raise RuntimeError("test")
def g():
m = Message()
d = {"a": m} # putting something else on the stack with a reference to m
try:
f()
except Exception as e:
m._exception = e
i = 0
g()
os = []
for i in range(1000):
os.append({"a%d" % i: i})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment