PYTHON-4572 - Fix type errors caused by new PyOpenSSL type hints (#1743)

This commit is contained in:
Noah Stapp 2024-07-23 13:41:51 -07:00 committed by GitHub
parent 993171cd3d
commit 0f5349e2e0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -292,7 +292,7 @@ class SSLContext:
# Password callback MUST be set first or it will be ignored.
if password:
def _pwcb(_max_length: int, _prompt_twice: bool, _user_data: bytes) -> bytes:
def _pwcb(_max_length: int, _prompt_twice: bool, _user_data: Optional[bytes]) -> bytes:
# XXX:We could check the password length against what OpenSSL
# tells us is the max, but we can't raise an exception, so...
# warn?
@ -332,6 +332,7 @@ class SSLContext:
def _load_wincerts(self, store: str) -> None:
"""Attempt to load CA certs from Windows trust store."""
cert_store = self._ctx.get_cert_store()
assert cert_store is not None
oid = _stdlibssl.Purpose.SERVER_AUTH.oid
for cert, encoding, trust in _stdlibssl.enum_certificates(store): # type: ignore