Skip to content

Commit f8cd750

Browse files
authored
Merge pull request #39 from cknd/fix_type_error
Fix crash on very long code scopes due to wrongly typed default arg
2 parents fcaa76e + 56ca19c commit f8cd750

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

stackprinter/source_inspection.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
OP = 'OP'
1212

1313

14-
def annotate(source_lines, line_offset=0, lineno=0, max_line=1e4):
14+
def annotate(source_lines, line_offset=0, lineno=0, max_line=2**15):
1515
"""
1616
Find out where in a piece of code which variables live.
1717
@@ -58,6 +58,10 @@ def annotate(source_lines, line_offset=0, lineno=0, max_line=1e4):
5858
if not source_lines:
5959
return {}, {}, {}, [], lineno
6060

61+
assert isinstance(line_offset, int)
62+
assert isinstance(lineno, int)
63+
assert isinstance(max_line, int)
64+
6165
source_lines, lineno_corrections = join_broken_lines(source_lines)
6266
lineno += lineno_corrections[lineno - line_offset]
6367

0 commit comments

Comments
 (0)