From ed53fdd918ad67ef0d1689ddec0b389f3d8268d6 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Wed, 29 Dec 2010 11:40:52 +0100 Subject: [PATCH] fix annotation writing after changing source position comments --- Cython/Compiler/Annotate.py | 2 +- Cython/Compiler/Scanning.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Cython/Compiler/Annotate.py b/Cython/Compiler/Annotate.py index fe38378b..cfdcfaed 100644 --- a/Cython/Compiler/Annotate.py +++ b/Cython/Compiler/Annotate.py @@ -44,7 +44,7 @@ class AnnotationCCodeWriter(CCodeWriter): if pos is not None: CCodeWriter.mark_pos(self, pos) if self.last_pos: - pos_code = self.code.setdefault(self.last_pos[0].get_description(),{}) + pos_code = self.code.setdefault(self.last_pos[0].filename,{}) code = pos_code.get(self.last_pos[1], "") pos_code[self.last_pos[1]] = code + self.annotation_buffer.getvalue() self.annotation_buffer = StringIO() diff --git a/Cython/Compiler/Scanning.py b/Cython/Compiler/Scanning.py index c2d1a9f6..cc51ba15 100644 --- a/Cython/Compiler/Scanning.py +++ b/Cython/Compiler/Scanning.py @@ -200,6 +200,8 @@ class StringSourceDescriptor(SourceDescriptor): Instances of this class can be used instead of a filenames if the code originates from a string object. """ + filename = None + def __init__(self, name, code): self.name = name #self.set_file_type_from_name(name) -- 2.26.2