This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author sivel
Recipients christian.heimes, sivel, vstinner
Date 2019-05-09.15:48:32
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1557416912.64.0.674817399159.issue36866@roundup.psfhosted.org>
In-reply-to
Content
The behavior of how SSL certificate validation is handled was changed in https://bugs.python.org/issue31399

This introduced a new exception, ssl.SSLCertVerificationError, which is raised for any certificate validation error, instead of the previous exception ssl.CertificateError.

The primary difference here comes into play in urllib.request:

https://github.com/python/cpython/blob/da0847048aa7f934573fa449cea8643def056aa5/Lib/urllib/request.py#L1314-L1318

Previously ssl.CertificateError was not derived from OSError, it instead was derived from ValueError.

As such, as of Python3.7, ssl.SSLCertVerificationError is caught by the exception handling referenced above, as it is derived from OSError, and raised as a URLError, causing exception handling issues.  You must now introspect e.reason to determine if the exception was caused due to certificate verification or any other URLError, instead of simply catching separate exception types.
History
Date User Action Args
2019-05-09 15:48:32sivelsetrecipients: + sivel, vstinner, christian.heimes
2019-05-09 15:48:32sivelsetmessageid: <1557416912.64.0.674817399159.issue36866@roundup.psfhosted.org>
2019-05-09 15:48:32sivellinkissue36866 messages
2019-05-09 15:48:32sivelcreate