This is the patch for ticket #203.
I came out with this, but i did not understand the need for
freeze_endpoints.I still haven't supplied the complete patch with all the
tests.This is for confirming whether i'm in the right direction.
diff -r e2365a6d00b8 Cython/Compiler/Nodes.py
--- a/Cython/Compiler/Nodes.py Tue Mar 17 07:32:51 2009 +0100
+++ b/Cython/Compiler/Nodes.py Wed Mar 18 00:20:19 2009 +0530
@@ -3971,11 +3971,13 @@
code.putln("if (%s%s %s %s) {" % (
self.bound1.result(), offset, self.relation2,
self.bound2.result()
))
+ temp_for_loop_bound =
code.funcstate.allocate_temp(PyrexTypes.c_char_ptr_type, manage_ref=False)
+ code.putln("%s = %s;" % (temp_for_loop_bound,
self.bound2.result()))
code.putln(
"for (%s = %s%s; %s %s %s; %s%s) {" % (
loopvar_name,
self.bound1.result(), offset,
- loopvar_name, self.relation2, self.bound2.result(),
+ loopvar_name, self.relation2, temp_for_loop_bound,
loopvar_name, incop))
if self.py_loopvar_node:
self.py_loopvar_node.generate_evaluation_code(code)
@@ -3989,6 +3991,7 @@
code.putln("} /* end if */")
else:
code.putln("}")
+ code.funcstate.release_temp(temp_for_loop_bound)
break_label = code.break_label
code.set_loop_labels(old_loop_labels)
if self.else_clause:
--
Regards,
Prajwal S.
"There is little difference in people,but this little difference makes a big
difference.The little difference is attitude,the big difference is whether
its positive or negative. "
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev