bpo-43950: support long lines in traceback.py (GH-27336)

This commit is contained in:
Batuhan Taskaya 2021-07-24 20:50:39 +03:00 committed by GitHub
parent ef8b8535cb
commit 4f5980a4f5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 1 deletions

View file

@ -462,7 +462,11 @@ class StackSummary(list):
row.append(' {}\n'.format(frame.line.strip()))
stripped_characters = len(frame._original_line) - len(frame.line.lstrip())
if frame.end_lineno == frame.lineno and frame.end_colno != 0:
if (
frame.end_lineno == frame.lineno
and frame.colno is not None
and frame.end_colno is not None
):
colno = _byte_offset_to_character_offset(frame._original_line, frame.colno)
end_colno = _byte_offset_to_character_offset(frame._original_line, frame.end_colno)