Print exception instead of "KeyboardInterrupt"

Whenever a KeyboardInterrupt exception occurs in the shell, we should
print the actual exception instead of the string "KeyboardInterrupt".
This is needed to support exceptions inherited from KeyboardInterrupt.
Fix test_get_exception_only() for Python 3
Merge pull request #7069 from jdemeyer/print_keyboardinterrupt

Print exception instead of "KeyboardInterrupt"