changeset: 101510:29f163db229e branch: 3.5 parent: 101507:da0c848b9bae user: Steve Dower date: Thu May 26 12:18:12 2016 -0700 files: Lib/ssl.py Misc/NEWS description: Issue #27114: Fix SSLContext._load_windows_store_certs fails with PermissionError diff -r da0c848b9bae -r 29f163db229e Lib/ssl.py --- a/Lib/ssl.py Thu May 26 09:56:19 2016 -0700 +++ b/Lib/ssl.py Thu May 26 12:18:12 2016 -0700 @@ -145,6 +145,7 @@ from socket import SOL_SOCKET, SO_TYPE import base64 # for DER-to-PEM translation import errno +import warnings socket_error = OSError # keep that public name in module namespace @@ -405,11 +406,14 @@ def _load_windows_store_certs(self, storename, purpose): certs = bytearray() - for cert, encoding, trust in enum_certificates(storename): - # CA certs are never PKCS#7 encoded - if encoding == "x509_asn": - if trust is True or purpose.oid in trust: - certs.extend(cert) + try: + for cert, encoding, trust in enum_certificates(storename): + # CA certs are never PKCS#7 encoded + if encoding == "x509_asn": + if trust is True or purpose.oid in trust: + certs.extend(cert) + except PermissionError: + warnings.warn("unable to enumerate Windows certificate store") if certs: self.load_verify_locations(cadata=certs) return certs diff -r da0c848b9bae -r 29f163db229e Misc/NEWS --- a/Misc/NEWS Thu May 26 09:56:19 2016 -0700 +++ b/Misc/NEWS Thu May 26 12:18:12 2016 -0700 @@ -126,6 +126,9 @@ Library ------- +- Issue #27114: Fix SSLContext._load_windows_store_certs fails with + PermissionError + - Issue #18383: Avoid creating duplicate filters when using filterwarnings and simplefilter. Based on patch by Alex Shkop.