mirror of
https://github.com/microsoft/debugpy.git
synced 2025-12-23 08:48:12 +00:00
In 3.12 findlinestarts seems to return None for line more often (#1721)
This commit is contained in:
parent
6a7f7c0f2d
commit
740fa9dd5a
3 changed files with 6 additions and 4 deletions
|
|
@ -83,7 +83,8 @@ else:
|
|||
# bodies of nested class and function definitions, as they have their
|
||||
# own objects.
|
||||
for _, lineno in dis.findlinestarts(code):
|
||||
yield lineno
|
||||
if lineno is not None:
|
||||
yield lineno
|
||||
|
||||
# For nested class and function definitions, their respective code objects
|
||||
# are constants referenced by this object.
|
||||
|
|
|
|||
|
|
@ -59,7 +59,8 @@ def _get_code_line_info(code_obj):
|
|||
last_line = None
|
||||
|
||||
for offset, line in dis.findlinestarts(code_obj):
|
||||
line_to_offset[line] = offset
|
||||
if line is not None and offset is not None:
|
||||
line_to_offset[line] = offset
|
||||
|
||||
if line_to_offset:
|
||||
first_line = min(line_to_offset)
|
||||
|
|
|
|||
|
|
@ -791,10 +791,10 @@ class PyDB(object):
|
|||
max_line = -1
|
||||
min_line = sys.maxsize
|
||||
for _, line in dis.findlinestarts(code_obj):
|
||||
if line > max_line:
|
||||
if line is not None and line > max_line:
|
||||
max_line = line
|
||||
|
||||
if line < min_line:
|
||||
if line is not None and line < min_line:
|
||||
min_line = line
|
||||
|
||||
try_except_infos = [x for x in try_except_infos if min_line <= x.try_line <= max_line]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue