Hi,
to fix ticket 124, I tried migrating the for-in loop to new-style temps.
The problem I ran into is that the current support for temp (de-)allocation
in NewTempExprNode during code generation is not enough to get this to
work. Some temps are used longer, some are used shorter than the current
automatic granularity at a node boundary.
Example:
for a,b in some_list:
pass
needs a temp for retrieving the next item, unpacks it into two target
temps, frees the item temp and then assigns them to a and b. The problem is
that we a) pass temps across multiple nodes here, and b) currently generate
separate code paths for the tuple unpacking, so that the item temp disposal
code is also generated twice. That prevents the rhs from just releasing the
temp on a call to generate_disposal_code().
I think it would be best to keep temp allocation in the code where it needs
to happen, but to make the deallocation explicit and callable from outside.
This means that all nodes would need to call a "free_temps()" method on
their subexpressions when they are done generating code for them.
Any objections or better ideas?
Stefan
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev