Greg Ewing wrote:
> Dag Sverre Seljebotn wrote:
>
>> I don't know Pyrex that well, and weren't around at the time of the
>> fork.
>> I assume it is Cython-only then.
>
> Maybe you could provide a bit more context still? I'm just
> wondering why you can't generate the disposal code after
> the whole if-statement, rather than duplicating it in each
> branch.

I think it's there because it was simple to put it there at the time when
the special case was split off the general case. It may or may not be fine
to move it after the if-else branches. The problem is that in the case
that the disposal involves a DECREF of a temporary Python object, the
object will be held until after the complete if-else has been handled,
which may be long depending on the code. If it gets in the way, it's safe
to do that, but it's not memory efficient.

I don't remember the exact code that's being discussed here (and can't
check at the moment), but if it's known to be short, it's best to just
move the disposal and be done.

Stefan

_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to