Skip to content

Commit c07c965

Browse files
NoahStappblink1073
authored andcommitted
PYTHON-4572 - Fix type errors caused by new PyOpenSSL type hints (mongodb#1743)
(cherry picked from commit 0f5349e)
1 parent 87a710b commit c07c965

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pymongo/pyopenssl_context.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ def load_cert_chain(
291291
# Password callback MUST be set first or it will be ignored.
292292
if password:
293293

294-
def _pwcb(_max_length: int, _prompt_twice: bool, _user_data: bytes) -> bytes:
294+
def _pwcb(_max_length: int, _prompt_twice: bool, _user_data: Optional[bytes]) -> bytes:
295295
# XXX:We could check the password length against what OpenSSL
296296
# tells us is the max, but we can't raise an exception, so...
297297
# warn?
@@ -331,6 +331,7 @@ def _load_certifi(self) -> None:
331331
def _load_wincerts(self, store: str) -> None:
332332
"""Attempt to load CA certs from Windows trust store."""
333333
cert_store = self._ctx.get_cert_store()
334+
assert cert_store is not None
334335
oid = _stdlibssl.Purpose.SERVER_AUTH.oid
335336

336337
for cert, encoding, trust in _stdlibssl.enum_certificates(store): # type: ignore

0 commit comments

Comments
 (0)