mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
[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:
parent
5dcce94e9d
commit
99dc0893c7
3 changed files with 40 additions and 0 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue