Skip to content

Commit 17ae881

Browse files
committed
Update for new Python traceback locations
Since python/cpython#27037, they can include tildes in addition to the carets.
1 parent c28a7f1 commit 17ae881

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

pygments/lexers/python.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ class PythonTracebackLexer(RegexLexer):
739739
# Either `PEP 657 <https://www.python.org/dev/peps/pep-0657/>`
740740
# error locations in Python 3.11+, or single-caret markers
741741
# for syntax errors before that.
742-
(r'^( {4,})(\^+)(\n)',
742+
(r'^( {4,})([~^]+)(\n)',
743743
bygroups(Text, Punctuation.Marker, Text),
744744
'#pop'),
745745
default('#pop'),

tests/examplefiles/pytb/error_locations.pytb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ Traceback (most recent call last):
1313
^^^^^^^^^^^^^^^
1414
File "/home/tb.py", line 11, in in_tracebacks
1515
return 1/0
16-
^^^
16+
~^~
1717
ZeroDivisionError: division by zero

tests/examplefiles/pytb/error_locations.pytb.output

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)