File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -145,6 +145,7 @@ def _import_symbols(prefix):
145
145
from socket import SOL_SOCKET , SO_TYPE
146
146
import base64 # for DER-to-PEM translation
147
147
import errno
148
+ import warnings
148
149
149
150
150
151
socket_error = OSError # keep that public name in module namespace
@@ -405,11 +406,14 @@ def set_alpn_protocols(self, alpn_protocols):
405
406
406
407
def _load_windows_store_certs (self , storename , purpose ):
407
408
certs = bytearray ()
408
- for cert , encoding , trust in enum_certificates (storename ):
409
- # CA certs are never PKCS#7 encoded
410
- if encoding == "x509_asn" :
411
- if trust is True or purpose .oid in trust :
412
- certs .extend (cert )
409
+ try :
410
+ for cert , encoding , trust in enum_certificates (storename ):
411
+ # CA certs are never PKCS#7 encoded
412
+ if encoding == "x509_asn" :
413
+ if trust is True or purpose .oid in trust :
414
+ certs .extend (cert )
415
+ except PermissionError :
416
+ warnings .warn ("unable to enumerate Windows certificate store" )
413
417
if certs :
414
418
self .load_verify_locations (cadata = certs )
415
419
return certs
Original file line number Diff line number Diff line change @@ -126,6 +126,9 @@ Core and Builtins
126
126
Library
127
127
-------
128
128
129
+ - Issue #27114: Fix SSLContext._load_windows_store_certs fails with
130
+ PermissionError
131
+
129
132
- Issue #18383: Avoid creating duplicate filters when using filterwarnings
130
133
and simplefilter. Based on patch by Alex Shkop.
131
134
You can’t perform that action at this time.
0 commit comments