Hoyt Koepke wrote:
> Hello,
> 
> In continuing to play around with the annotation function, I've found
> another bug (and I think I have it patched as well).  For me, it shows
> up when there is an error in my code.  It doesn't seem to matter what
> that error is, as I've fixed several and still get the same backtrace.
>  This is in r1071
> 
> After running cython -a transforms.pyx, it prints out an error message
> and then raises
> 
> The problem is that self.last_pos is not always assigned in the
> constructor of AnnotationCCodeWriter, which seems to be the case on my
> code.  I've attached a patch which fixes it for me
> (patch-last_pos.diff).  In looking at the code, it seems that

I believe the right thing to do here is to copy last_pos in create_from 
(see below), but I'm not commiting as I'd like Robert to confirm (as 
there's going to be a release today). The cleanup of self.annotator is 
correct.

Thanks!


--- a/Cython/Compiler/Annotate.py       Mon Aug 18 07:49:35 2008 +0200
+++ b/Cython/Compiler/Annotate.py       Mon Aug 18 15:45:02 2008 +0200
@@ -29,6 +29,7 @@ class AnnotationCCodeWriter(CCodeWriter)
              self.annotation_buffer = create_from.annotation_buffer
              self.annotations = create_from.annotations
              self.code = create_from.code
+            self.last_pos = create_from.last_pos

      def create_new(self, create_from, buffer, copy_formatting):
          return AnnotationCCodeWriter(create_from, buffer, copy_formatting)


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

Reply via email to