[3.13] gh-122145: Handle an empty AST body when reporting tracebacks (GH-122161) (#124214)

gh-122145: Handle an empty AST body when reporting tracebacks (GH-122161)
(cherry picked from commit 5cd50cb6eb)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
This commit is contained in:
Miss Islington (bot) 2024-09-30 03:13:36 +02:00 committed by GitHub
parent 5dcce94e9d
commit 99dc0893c7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 40 additions and 0 deletions

View file

@ -698,6 +698,8 @@ class StackSummary(list):
with suppress(SyntaxError, ImportError):
import ast
tree = ast.parse('\n'.join(all_lines))
if not tree.body:
return False
statement = tree.body[0]
value = None
def _spawns_full_line(value):