-
-
Save Bogdanp/f5628a4eef0eed5ce8f904ca52c024e0 to your computer and use it in GitHub Desktop.
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 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