Hoyt Koepke | 18 Aug 10:12
Favicon

[Cython] Another annotator bug

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

Traceback (most recent call last):
  File "/home/hoytak/sysroot/bin/cython", line 8, in <module>
    main(command_line = 1)
  File "/home/hoytak/sysroot/lib/python2.5/site-packages/Cython/Compiler/Main.py",
line 698, in main
    result = compile(sources, options)
  File "/home/hoytak/sysroot/lib/python2.5/site-packages/Cython/Compiler/Main.py",
line 675, in compile
    return compile_multiple(source, options)
  File "/home/hoytak/sysroot/lib/python2.5/site-packages/Cython/Compiler/Main.py",
line 645, in compile_multiple
    result = run_pipeline(source, options)
  File "/home/hoytak/sysroot/lib/python2.5/site-packages/Cython/Compiler/Main.py",
line 507, in run_pipeline
    err, enddata = context.run_pipeline(pipeline, source)
  File "/home/hoytak/sysroot/lib/python2.5/site-packages/Cython/Compiler/Main.py",
line 169, in run_pipeline
    data = phase(data)
  File "/home/hoytak/sysroot/lib/python2.5/site-packages/Cython/Compiler/Main.py",
(Continue reading)

Dag Sverre Seljebotn | 18 Aug 15:47

Re: [Cython] Another annotator bug

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
(Continue reading)

Dag Sverre Seljebotn | 18 Aug 15:50

Re: [Cython] Another annotator bug

Dag Sverre Seljebotn wrote:
> 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!

Attaching a patch properly doing the above.

--

-- 
Dag Sverre
(Continue reading)

Robert Bradshaw | 19 Aug 03:41

Re: [Cython] Another annotator bug

Yes, this looks correct. Thanks.

On Aug 18, 2008, at 6:50 AM, Dag Sverre Seljebotn wrote:

> Dag Sverre Seljebotn wrote:
>> 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  
(Continue reading)

Hoyt Koepke | 18 Aug 18:43
Favicon

Re: [Cython] Another annotator bug

> 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.

Yes, after looking at things a bit more, I agree.  It also fixes my problem.

--Hoyt

--

-- 
+++++++++++++++++++++++++++++++++++
Hoyt Koepke
UBC Department of Computer Science
http://www.cs.ubc.ca/~hoytak/
hoytak@...
+++++++++++++++++++++++++++++++++++

Gmane