bpo-45249: Fix caret location when end_offset is set to 0 (GH-28855)

This commit is contained in:
Pablo Galindo Salgado 2021-10-16 18:27:43 +01:00 committed by GitHub
parent 5afa0a4112
commit fe0d9e22a5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 1 deletions

View file

@ -781,7 +781,7 @@ class TracebackException:
if self.offset is not None:
offset = self.offset
end_offset = self.end_offset if self.end_offset is not None else offset
end_offset = self.end_offset if self.end_offset not in {None, 0} else offset
if offset == end_offset or end_offset == -1:
end_offset = offset + 1