Skip to content

Commit

Permalink
add a longer comment to the catch clause
Browse files Browse the repository at this point in the history
  • Loading branch information
planrich committed Feb 23, 2017
1 parent c5bb6fb commit 9fe54f7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion vmprof/show.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,11 @@ def show_func(self, filename, start_lineno, func_name, timings, stream=None, str
try:
sublines = inspect.getblock(all_lines[start_lineno-1:])
except tokenize.TokenError:
# inspect.getblock fails on multi line dictionary comprehensions
# the problem stems from getblock not being able to tokenize such an example:
# >>> inspect.getblock(['i:i**i','}']) => TokenError
# e.g. it fails on multi line dictionary comprehensions
# the current approach is best effort, but cuts of some lines at the top.
# see issue #118 for details
sublines = all_lines[start_lineno-1:max(linenos)]
else:
stream.write("\n")
Expand Down

0 comments on commit 9fe54f7

Please sign in to comment.