[Cython] Temp allocation bug

Dag Sverre Seljebotn dagss at student.matnat.uio.no
Sat Jan 17 23:20:26 CET 2009


Robert wrote:
> Is this going to be a general problem with any inside a
> NewTempExprNode (plain) ExprNode? That could be bad. On that note, is
> there any reason that temp freeing is done as a separate step now
> instead of as part of the disposal code? (Someone more familiar with
> the new code probably has a trivial answer to this.)

Some code is generated like this:

/*allocate node*/
if (something) {
  block A
  /* deallocate node */
} else {
  block B
  /* deallocate node */
}

If temp releasing is tied up with disposal, the temp can be reallocated
and reused in block B, leading to disaster. Also it would be released
twice. Etc.

If the C control flow matched the node tree, this wouldn't be a problem,
but it doesn't.

Pyrex didn't have this problem, but that meant that deallocation (i.e.
decrefs) is done later than necesarry.

Dag Sverre



More information about the Cython-dev mailing list