Skip to content

Instantly share code, notes, and snippets.

@Bogdanp
Created October 15, 2020 11:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Bogdanp/f5628a4eef0eed5ce8f904ca52c024e0 to your computer and use it in GitHub Desktop.
Save Bogdanp/f5628a4eef0eed5ce8f904ca52c024e0 to your computer and use it in GitHub Desktop.
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