Skip to content

Commit 9fe54f7

Browse files
committed
add a longer comment to the catch clause
1 parent c5bb6fb commit 9fe54f7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

vmprof/show.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,11 @@ def show_func(self, filename, start_lineno, func_name, timings, stream=None, str
235235
try:
236236
sublines = inspect.getblock(all_lines[start_lineno-1:])
237237
except tokenize.TokenError:
238-
# inspect.getblock fails on multi line dictionary comprehensions
238+
# the problem stems from getblock not being able to tokenize such an example:
239+
# >>> inspect.getblock(['i:i**i','}']) => TokenError
240+
# e.g. it fails on multi line dictionary comprehensions
241+
# the current approach is best effort, but cuts of some lines at the top.
242+
# see issue #118 for details
239243
sublines = all_lines[start_lineno-1:max(linenos)]
240244
else:
241245
stream.write("\n")

0 commit comments

Comments
 (0)