#!/usr/bin/env python """ Example of bug https://bugs.python.org/issue28603 Under Python2, this prints the traceback from the UnhashableException and continues, eventually printing "Hello world". Under Python3, this exits silently for no discernable reason. """ import sys import traceback sys.stderr = None class UnhashableException(Exception): def __eq__(self, other): return NotImplemented def print_exception(exc_info): print(''.join(traceback.format_exception(*exc_info))) def test(): try: raise UnhashableException() except UnhashableException: print_exception(sys.exc_info()) if __name__ == '__main__': print("Hello world!") try: test() except Exception: print_exception(sys.exc_info()) print("Goodbye!")