[1.6.x] Tested exc_type instead of exc_value in __exit__.

exc_value might be None even though there's an exception, at least on
Python 2.6. Thanks Thomas Chaumeny for the report.

Fixed #21034.