File tree Expand file tree Collapse file tree 4 files changed +10
-5
lines changed Expand file tree Collapse file tree 4 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ Version 4.13.2 is a bug fix release.
8
8
9
9
- Fixed a bug where ``AsyncMongoClient `` would block the event loop while creating new connections,
10
10
potentially significantly increasing latency for ongoing operations.
11
+ - Fixed a bug that resulted in confusing error messages after hostname verification errors when using PyOpenSSL.
11
12
12
13
Issues Resolved
13
14
...............
Original file line number Diff line number Diff line change @@ -420,9 +420,9 @@ def wrap_socket(
420
420
pyopenssl .verify_ip_address (ssl_conn , server_hostname )
421
421
else :
422
422
pyopenssl .verify_hostname (ssl_conn , server_hostname )
423
- except ( # type:ignore[misc]
424
- service_identity .SICertificateError ,
425
- service_identity .SIVerificationError ,
423
+ except (
424
+ service_identity .CertificateError ,
425
+ service_identity .VerificationError ,
426
426
) as exc :
427
427
raise _CertificateError (str (exc )) from None
428
428
return ssl_conn
Original file line number Diff line number Diff line change @@ -323,7 +323,7 @@ async def test_cert_ssl_validation_hostname_matching(self):
323
323
324
324
response = await self .client .admin .command (HelloCompat .LEGACY_CMD )
325
325
326
- with self .assertRaises (ConnectionFailure ):
326
+ with self .assertRaises (ConnectionFailure ) as cm :
327
327
await connected (
328
328
self .simple_client (
329
329
"server" ,
@@ -335,6 +335,8 @@ async def test_cert_ssl_validation_hostname_matching(self):
335
335
** self .credentials , # type: ignore[arg-type]
336
336
)
337
337
)
338
+ # PYTHON-5414 Check for "module service_identity has no attribute SICertificateError"
339
+ self .assertNotIn ("has no attribute" , str (cm .exception ))
338
340
339
341
await connected (
340
342
self .simple_client (
Original file line number Diff line number Diff line change @@ -323,7 +323,7 @@ def test_cert_ssl_validation_hostname_matching(self):
323
323
324
324
response = self .client .admin .command (HelloCompat .LEGACY_CMD )
325
325
326
- with self .assertRaises (ConnectionFailure ):
326
+ with self .assertRaises (ConnectionFailure ) as cm :
327
327
connected (
328
328
self .simple_client (
329
329
"server" ,
@@ -335,6 +335,8 @@ def test_cert_ssl_validation_hostname_matching(self):
335
335
** self .credentials , # type: ignore[arg-type]
336
336
)
337
337
)
338
+ # PYTHON-5414 Check for "module service_identity has no attribute SICertificateError"
339
+ self .assertNotIn ("has no attribute" , str (cm .exception ))
338
340
339
341
connected (
340
342
self .simple_client (
You can’t perform that action at this time.
0 commit comments