summaryrefslogtreecommitdiffstats
path: root/Lib/ast.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/ast.py')
-rw-r--r--Lib/ast.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/ast.py b/Lib/ast.py
index 61fbe03..0d3b19d 100644
--- a/Lib/ast.py
+++ b/Lib/ast.py
@@ -332,6 +332,8 @@ def get_source_segment(source, node, *, padded=False):
be padded with spaces to match its original position.
"""
try:
+ if node.end_lineno is None or node.end_col_offset is None:
+ return None
lineno = node.lineno - 1
end_lineno = node.end_lineno - 1
col_offset = node.col_offset