Haoyu Bai, 20.05.2010 18:54: > def foo(): > x=0 # INCREF(0), 0 get traced by refnanny > def bar(): > # DECREF(x) refnanny complains since x is not got tracked yet > # INCREF(1) > x=1 > # refnanny complains since there is no giveref for 1 > bar() > # refnanny complains since 0 is not giveref-ed and 1 got giveref-ed > instead > > Since the rule is that closure variables are owned by scope object and > not managed by refnanny. So my idea to fix this is to wrap every > assignment to closure object by a pair of GOTREF and GIVEREF. So when > you do x=1, these will happen: > > GOTREF(x) > DECREF(x) > INCREF(1) > x=1 > GIVEREF(x)
Yes, that's how it's supposed to work. Stefan _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
