Skip to content
Prev Previous commit
Next Next commit
reorder condition for line annotation
A blank line will not appear in ``lnotab`` as returned by
``_find_executable_linenos``. Alternately, ``lnotab`` might be set to an
empty dict. Either way, the check for whether a line is blank can be
done after checking for whether the ``lineno`` is in ``lnotab``.
  • Loading branch information
selik committed Nov 1, 2017
commit 05b0e73963526247cba5b79be7497d655452cabb
4 changes: 2 additions & 2 deletions Lib/trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,14 +324,14 @@ def write_results_file(self, path, lines, lnotab, lines_hit, encoding=None):
outfile.write("%5d: " % lines_hit[lineno])
n_hits += 1
n_lines += 1
elif rx_blank.match(line):
outfile.write(" ")
elif lineno in lnotab and not PRAGMA_NOCOVER in line:
# lines preceded by no marks weren't hit
# Highlight them if so indicated, unless the line contains
# #pragma: NO COVER
outfile.write(">>>>>> ")
n_lines += 1
elif rx_blank.match(line):
outfile.write(" ")
else:
outfile.write(" ")
outfile.write(line.expandtabs(8))
Expand Down