[Cython] catched a reference leak problem in try/except block (temp allocation?)
Stefan Behnel
stefan_ml at behnel.de
Tue Dec 30 12:21:57 CET 2008
Hi Lisandro,
Lisandro Dalcin wrote:
> def gettok(tokens):
> try:
> return tokens.pop(0)
> except IndexError:
> return None
>
> I've distilled the problem to this: when the call "tokens.pop(0)"
> actually raises IndexError, then the temporary 1-tuple with item "0"
> (zero) that Cython build in order to make the method call is never
> DECREF'ed; then you leak two references (the 1-tuple plus the integer
> "0").
Thanks for catching this. New style temps were not cleaned up during
exception handling. Should be fixed now.
Stefan
More information about the Cython-dev
mailing list