File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 8484import tokenize
8585import traceback
8686import linecache
87+ import _colorize
8788
8889from contextlib import contextmanager
8990from rlcompleter import Completer
@@ -2347,7 +2348,7 @@ def main():
23472348 print ("The program exited via sys.exit(). Exit status:" , end = ' ' )
23482349 print (e )
23492350 except BaseException as e :
2350- traceback .print_exc ( )
2351+ traceback .print_exception ( e , colorize = _colorize . can_colorize () )
23512352 print ("Uncaught exception. Entering post mortem debugging" )
23522353 print ("Running 'cont' or 'step' will restart the program" )
23532354 pdb .interaction (None , e )
Original file line number Diff line number Diff line change 1515from contextlib import ExitStack , redirect_stdout
1616from io import StringIO
1717from test import support
18- from test .support import os_helper
18+ from test .support import force_not_colorized , os_helper
1919from test .support .import_helper import import_module
2020from test .support .pty_helper import run_pty , FakeInput
2121from unittest .mock import patch
@@ -2919,6 +2919,7 @@ def start_pdb():
29192919 self .assertNotIn (b'Error' , stdout ,
29202920 "Got an error running test script under PDB" )
29212921
2922+ @force_not_colorized
29222923 def test_issue16180 (self ):
29232924 # A syntax error in the debuggee.
29242925 script = "def f: pass\n "
@@ -2932,6 +2933,7 @@ def test_issue16180(self):
29322933 'Fail to handle a syntax error in the debuggee.'
29332934 .format (expected , stderr ))
29342935
2936+ @force_not_colorized
29352937 def test_issue84583 (self ):
29362938 # A syntax error from ast.literal_eval should not make pdb exit.
29372939 script = "import ast; ast.literal_eval('')\n "
Original file line number Diff line number Diff line change 1+ Print colorized exception just like built-in traceback in :mod: `pdb `
You can’t perform that action at this time.
0 commit comments