-
Notifications
You must be signed in to change notification settings - Fork 790
PythonConsoleLexer is unable to parse full paths to excecptions #1187
Copy link
Copy link
Closed
Labels
S-majorseverity: majorseverity: majorT-bugtype: a bugtype: a bugX-importedimported from Bitbucketimported from Bitbucket
Description
(Original issue 1483 created by rouge8 on 2018-11-13T04:20:53.322396+00:00)
Also seen in sphinx-doc/sphinx#2830
from pygments import highlight
from pygments.lexers import PythonConsoleLexer
from pygments.formatters import HtmlFormatter
pycon3 = PythonConsoleLexer(python3=True, stripnl=False)
pycon3.add_filter('raiseonerror')
formatter = HtmlFormatter()
source = """
>>> foo()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/saffy/Desktop/yarely-cookiecut/yarely/doctestsphinxtest.py", line 34, in foo
raise b
yarely.doctestsphinxtest.FooError
"""
highlight(source, pycon3, formatter) # => raises pygments.filters.ErrorToken
Traceback (most recent call last):
File "test.py", line 19, in <module>
highlight(source, pycon3, formatter) # => raises pygments.filters.ErrorToken
File "/Users/tkomiya/work/tmp/lib/python2.7/site-packages/pygments/__init__.py", line 87, in highlight
return format(lex(code, lexer), formatter, outfile)
File "/Users/tkomiya/work/tmp/lib/python2.7/site-packages/pygments/__init__.py", line 66, in format
formatter.format(tokens, realoutfile)
File "/Users/tkomiya/work/tmp/lib/python2.7/site-packages/pygments/formatter.py", line 95, in format
return self.format_unencoded(tokensource, outfile)
File "/Users/tkomiya/work/tmp/lib/python2.7/site-packages/pygments/formatters/html.py", line 850, in format_unencoded
for t, piece in source:
File "/Users/tkomiya/work/tmp/lib/python2.7/site-packages/pygments/formatters/html.py", line 690, in _wrap_div
for tup in inner:
File "/Users/tkomiya/work/tmp/lib/python2.7/site-packages/pygments/formatters/html.py", line 708, in _wrap_pre
for tup in inner:
File "/Users/tkomiya/work/tmp/lib/python2.7/site-packages/pygments/formatters/html.py", line 727, in _format_lines
for ttype, value in tokensource:
File "/Users/tkomiya/work/tmp/lib/python2.7/site-packages/pygments/filter.py", line 20, in _apply
for token in filter_.filter(lexer, stream):
File "/Users/tkomiya/work/tmp/lib/python2.7/site-packages/pygments/filters/__init__.py", line 196, in filter
raise self.exception(value)
pygments.filters.ErrorToken: y
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
S-majorseverity: majorseverity: majorT-bugtype: a bugtype: a bugX-importedimported from Bitbucketimported from Bitbucket