summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES2
-rw-r--r--pygments/lexers/python.py3
-rw-r--r--tests/examplefiles/pycon_test.pycon5
3 files changed, 9 insertions, 1 deletions
diff --git a/CHANGES b/CHANGES
index 4dfd45a0..652b98fc 100644
--- a/CHANGES
+++ b/CHANGES
@@ -137,6 +137,8 @@ Version 2.0
- Elixir lexer: update to 0.15 language version (PR#392).
+- Fix swallowing incomplete tracebacks in Python console lexer (#874).
+
Version 1.6
-----------
diff --git a/pygments/lexers/python.py b/pygments/lexers/python.py
index 6cd0a6c8..411f7bc7 100644
--- a/pygments/lexers/python.py
+++ b/pygments/lexers/python.py
@@ -384,6 +384,9 @@ class PythonConsoleLexer(Lexer):
for item in do_insertions(insertions,
pylexer.get_tokens_unprocessed(curcode)):
yield item
+ if curtb:
+ for i, t, v in tblexer.get_tokens_unprocessed(curtb):
+ yield tbindex+i, t, v
class PythonTracebackLexer(RegexLexer):
diff --git a/tests/examplefiles/pycon_test.pycon b/tests/examplefiles/pycon_test.pycon
index ff702864..9c4fc3d3 100644
--- a/tests/examplefiles/pycon_test.pycon
+++ b/tests/examplefiles/pycon_test.pycon
@@ -9,6 +9,9 @@ KeyboardInterrupt
>>> 1/0
Traceback (most recent call last):
-...
+ ...
ZeroDivisionError
+>>> 1/0 # this used to swallow the traceback
+Traceback (most recent call last):
+ ...