← Back to team overview

ffc team mailing list archive

Re: [Ufl] [Bug 769811] [NEW] JIT cache problem with id(form)

 

If you want to play around with weakref to understand it, try this snippet:

import weakref

class A:
def __init__(s, n):
s.n = n
def __del__(s):
print "d", s.n

a = A("orig")
b = A("prep")
c = A("formdata")
a.fd = c
b.fd = c
c.a = weakref.ref(a)
c.b = weakref.ref(b)
print "C"
del c
print "A"
del a
print "B"
del b
print "DONE"


A possible tool for breaking the cycle:
> http://docs.python.org/library/weakref.html
>
> Martin
>

References