Merge pull request #8729 from asottile/revert-traceback-frame

Revert "Merge pull request #8227 from encukou/defensive-get_source"
This commit is contained in:
Anthony Sottile 2021-06-03 12:46:53 -07:00 committed by GitHub
commit bb9683deea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -725,11 +725,11 @@ class FormattedExcinfo:
) -> List[str]:
"""Return formatted and marked up source lines."""
lines = []
if source is not None and line_index < 0:
line_index += len(source.lines)
if source is None or line_index >= len(source.lines) or line_index < 0:
if source is None or line_index >= len(source.lines):
source = Source("???")
line_index = 0
if line_index < 0:
line_index += len(source)
space_prefix = " "
if short:
lines.append(space_prefix + source.lines[line_index].strip())