Catch KeyboardInterrupt separately and propagate it, instead of

reporting a "crash".

Use sys.exc_info() instead of sys.exc_type and sys.exc_value.
This commit is contained in:
Guido van Rossum 1997-10-20 23:46:54 +00:00
parent 1510565cb5
commit 4e8ef5fcd3
1 changed files with 4 additions and 1 deletions

View File

@ -138,11 +138,14 @@ def runtest(test, generate, verbose):
sys.stdout = save_stdout sys.stdout = save_stdout
except ImportError, msg: except ImportError, msg:
return -1 return -1
except KeyboardInterrupt, v:
raise KeyboardInterrupt, v, sys.exc_info()[2]
except test_support.TestFailed, msg: except test_support.TestFailed, msg:
print "test", test, "failed --", msg print "test", test, "failed --", msg
return 0 return 0
except: except:
print "test", test, "crashed --", sys.exc_type, ":", sys.exc_value type, value = sys.exc_info()[:2]
print "test", test, "crashed --", type, ":", value
if verbose: if verbose:
traceback.print_exc(file=sys.stdout) traceback.print_exc(file=sys.stdout)
return 0 return 0