diff options
author | Stefan Behnel <stefan_ml@behnel.de> | 2015-02-22 09:21:18 +0100 |
---|---|---|
committer | Stefan Behnel <stefan_ml@behnel.de> | 2015-02-22 09:21:18 +0100 |
commit | 182ab7eafb205356ba3e13318ea88f997d9c2271 (patch) | |
tree | 3418b471aca820a246fb9badf966f0f503a9e014 /Cython/Coverage.py | |
parent | 983b6c13b9e88860ad727396e9ff95c24e35bdb4 (diff) | |
download | cython-182ab7eafb205356ba3e13318ea88f997d9c2271.tar.gz |
coverage: prefer real source file for line annotation if we find it
Diffstat (limited to 'Cython/Coverage.py')
-rw-r--r-- | Cython/Coverage.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Cython/Coverage.py b/Cython/Coverage.py index ed24cb221..0db3ad7ec 100644 --- a/Cython/Coverage.py +++ b/Cython/Coverage.py @@ -259,5 +259,10 @@ class CythonModuleReporter(FileReporter): return '\n'.join(self._iter_source_lines()) def source_token_lines(self): - for line in self._iter_source_lines(): - yield [('txt', line)] + if os.path.exists(self.filename): + with open(self.filename) as f: + for line in f: + yield [('txt', line)] + else: + for line in self._iter_source_lines(): + yield [('txt', line)] |