Commit f456378f authored by Kevin Modzelewski's avatar Kevin Modzelewski

Try to make weakref4 more robust

parent 087316e2
......@@ -7,14 +7,13 @@ def doStuff():
wr = weakref.ref(meth)
return wr
def fact(n):
if n <= 1:
return n
return n * fact(n-1)
def recurse(f, n):
if n:
return recurse(f, n-1)
return f()
w = doStuff()
print fact(10) # try to clear some memory
w = recurse(doStuff, 100)
# Try creating a large object to make sure we can handle them:
def f():
......@@ -24,7 +23,7 @@ def f():
return weakref.ref(C)
r = f()
r = recurse(f, 100)
import gc
gc.collect()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment