Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
f00cd893
Commit
f00cd893
authored
Mar 02, 2019
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '0.29.x'
parents
a5d9314c
86904478
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
2 deletions
+14
-2
Cython/Coverage.py
Cython/Coverage.py
+14
-2
No files found.
Cython/Coverage.py
View file @
f00cd893
...
@@ -191,6 +191,7 @@ class Plugin(CoveragePlugin):
...
@@ -191,6 +191,7 @@ class Plugin(CoveragePlugin):
match_source_path_line
=
re
.
compile
(
r' */[*] +"(.*)":([0-9]+)$'
).
match
match_source_path_line
=
re
.
compile
(
r' */[*] +"(.*)":([0-9]+)$'
).
match
match_current_code_line
=
re
.
compile
(
r' *[*] (.*) # <<<<<<+$'
).
match
match_current_code_line
=
re
.
compile
(
r' *[*] (.*) # <<<<<<+$'
).
match
match_comment_end
=
re
.
compile
(
r' *[*]/$'
).
match
match_comment_end
=
re
.
compile
(
r' *[*]/$'
).
match
match_trace_line
=
re
.
compile
(
r' *__Pyx_TraceLine\
(([
0-9]+),'
).
match
not_executable
=
re
.
compile
(
not_executable
=
re
.
compile
(
r'\
s*c(?:
type)?def\
s+
'
r'\
s*c(?:
type)?def\
s+
'
r'
(
?
:(
?
:
public
|
external
)
\
s
+
)
?
'
r'
(
?
:(
?
:
public
|
external
)
\
s
+
)
?
'
...
@@ -199,15 +200,20 @@ class Plugin(CoveragePlugin):
...
@@ -199,15 +200,20 @@ class Plugin(CoveragePlugin):
).match
).match
code_lines = defaultdict(dict)
code_lines = defaultdict(dict)
filenames = set()
executable_lines = defaultdict(set)
current_filename = None
with open(c_file) as lines:
with open(c_file) as lines:
lines = iter(lines)
lines = iter(lines)
for line in lines:
for line in lines:
match = match_source_path_line(line)
match = match_source_path_line(line)
if not match:
if not match:
if '
__Pyx_TraceLine
(
' in line and current_filename is not None:
trace_line = match_trace_line(line)
if trace_line:
executable_lines[current_filename].add(int(trace_line.group(1)))
continue
continue
filename, lineno = match.groups()
filename, lineno = match.groups()
filenames.add(filename)
current_filename = filename
lineno = int(lineno)
lineno = int(lineno)
for comment_line in lines:
for comment_line in lines:
match = match_current_code_line(comment_line)
match = match_current_code_line(comment_line)
...
@@ -221,6 +227,12 @@ class Plugin(CoveragePlugin):
...
@@ -221,6 +227,12 @@ class Plugin(CoveragePlugin):
# unexpected comment format - false positive?
# unexpected comment format - false positive?
break
break
# Remove lines that generated code but are not traceable.
for filename, lines in code_lines.items():
dead_lines = set(lines).difference(executable_lines.get(filename, ()))
for lineno in dead_lines:
del lines[lineno]
self._parsed_c_files[c_file] = code_lines
self._parsed_c_files[c_file] = code_lines
if self._c_files_map is None:
if self._c_files_map is None:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment