Commit 949c71ee authored by Stefan Behnel's avatar Stefan Behnel

Merge branch '0.23.x'

parents 659cda6f 067c6cca
...@@ -40,6 +40,8 @@ Other changes ...@@ -40,6 +40,8 @@ Other changes
Bugs fixed Bugs fixed
---------- ----------
* Coverage plugin was adapted to coverage.py 4.0 beta 2.
* C++ destructor calls could fail when '&' operator is overwritten. * C++ destructor calls could fail when '&' operator is overwritten.
* Incorrect handling of large integers in compile-time evaluated DEF * Incorrect handling of large integers in compile-time evaluated DEF
......
...@@ -205,7 +205,7 @@ class Plugin(CoveragePlugin): ...@@ -205,7 +205,7 @@ class Plugin(CoveragePlugin):
if self._c_files_map is None: if self._c_files_map is None:
self._c_files_map = {} self._c_files_map = {}
for filename, code in code_lines.iteritems(): for filename, code in code_lines.items():
abs_path = _find_dep_file_path(c_file, filename) abs_path = _find_dep_file_path(c_file, filename)
self._c_files_map[abs_path] = (c_file, filename, code) self._c_files_map[abs_path] = (c_file, filename, code)
...@@ -262,12 +262,15 @@ class CythonModuleReporter(FileReporter): ...@@ -262,12 +262,15 @@ class CythonModuleReporter(FileReporter):
self.c_file = c_file self.c_file = c_file
self._code = code self._code = code
def statements(self): def lines(self):
return self._code.viewkeys() """
Return set of line numbers that are possibly executable.
"""
return set(self._code)
def _iter_source_tokens(self): def _iter_source_tokens(self):
current_line = 1 current_line = 1
for line_no, code_line in sorted(self._code.iteritems()): for line_no, code_line in sorted(self._code.items()):
while line_no > current_line: while line_no > current_line:
yield [] yield []
current_line += 1 current_line += 1
...@@ -275,6 +278,9 @@ class CythonModuleReporter(FileReporter): ...@@ -275,6 +278,9 @@ class CythonModuleReporter(FileReporter):
current_line += 1 current_line += 1
def source(self): def source(self):
"""
Return the source code of the file as a string.
"""
if os.path.exists(self.filename): if os.path.exists(self.filename):
with open_source_file(self.filename) as f: with open_source_file(self.filename) as f:
return f.read() return f.read()
...@@ -284,6 +290,9 @@ class CythonModuleReporter(FileReporter): ...@@ -284,6 +290,9 @@ class CythonModuleReporter(FileReporter):
for tokens in self._iter_source_tokens()) for tokens in self._iter_source_tokens())
def source_token_lines(self): def source_token_lines(self):
"""
Iterate over the source code tokens.
"""
if os.path.exists(self.filename): if os.path.exists(self.filename):
with open_source_file(self.filename) as f: with open_source_file(self.filename) as f:
for line in f: for line in f:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment