Fix Python 3 issue in tests (non-existent sys.exc_clear()).