From f6f110e115717c794d5273c60631020b19eba700 Mon Sep 17 00:00:00 2001 From: Stefan Behnel <stefan_ml@behnel.de> Date: Sun, 22 Feb 2015 10:39:01 +0100 Subject: [PATCH] coverage: read Cython source files with correct encoding --- Cython/Coverage.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Cython/Coverage.py b/Cython/Coverage.py index 48497f133..98a67d624 100644 --- a/Cython/Coverage.py +++ b/Cython/Coverage.py @@ -10,7 +10,7 @@ from collections import defaultdict from coverage.plugin import CoveragePlugin, FileTracer, FileReporter # requires coverage.py 4.0+ -from .Utils import find_root_package_dir, is_package_dir +from .Utils import find_root_package_dir, is_package_dir, open_source_file from . import __version__ @@ -238,7 +238,7 @@ class CythonModuleReporter(FileReporter): def source(self): if os.path.exists(self.filename): - with open(self.filename) as f: + with open_source_file(self.filename) as f: return f.read() else: return '\n'.join( @@ -247,7 +247,7 @@ class CythonModuleReporter(FileReporter): def source_token_lines(self): if os.path.exists(self.filename): - with open(self.filename) as f: + with open_source_file(self.filename) as f: for line in f: yield [('txt', line.rstrip('\n'))] else: -- 2.30.9