aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/src/Lib/traceback.py
diff options
context:
space:
mode:
authorshadchin <shadchin@yandex-team.com>2023-10-03 23:32:21 +0300
committershadchin <shadchin@yandex-team.com>2023-10-03 23:48:51 +0300
commit01ffd024041ac933854c367fb8d1b5682d19883f (patch)
treeb70aa497ba132a133ccece49f7763427dcd0743f /contrib/tools/python3/src/Lib/traceback.py
parenta33fdb9a34581fd124e92535153b1f1fdeca6aaf (diff)
downloadydb-01ffd024041ac933854c367fb8d1b5682d19883f.tar.gz
Update Python 3 to 3.11.6
Diffstat (limited to 'contrib/tools/python3/src/Lib/traceback.py')
-rw-r--r--contrib/tools/python3/src/Lib/traceback.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/contrib/tools/python3/src/Lib/traceback.py b/contrib/tools/python3/src/Lib/traceback.py
index 09950a8b55..d3edd3a63e 100644
--- a/contrib/tools/python3/src/Lib/traceback.py
+++ b/contrib/tools/python3/src/Lib/traceback.py
@@ -603,11 +603,21 @@ def _extract_caret_anchors_from_line_segment(segment):
and not operator_str[operator_offset + 1].isspace()
):
right_anchor += 1
+
+ while left_anchor < len(segment) and ((ch := segment[left_anchor]).isspace() or ch in ")#"):
+ left_anchor += 1
+ right_anchor += 1
return _Anchors(normalize(left_anchor), normalize(right_anchor))
case ast.Subscript():
- subscript_start = normalize(expr.value.end_col_offset)
- subscript_end = normalize(expr.slice.end_col_offset + 1)
- return _Anchors(subscript_start, subscript_end)
+ left_anchor = normalize(expr.value.end_col_offset)
+ right_anchor = normalize(expr.slice.end_col_offset + 1)
+ while left_anchor < len(segment) and ((ch := segment[left_anchor]).isspace() or ch != "["):
+ left_anchor += 1
+ while right_anchor < len(segment) and ((ch := segment[right_anchor]).isspace() or ch != "]"):
+ right_anchor += 1
+ if right_anchor < len(segment):
+ right_anchor += 1
+ return _Anchors(left_anchor, right_anchor)
return None