aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/Twisted/py3/twisted/internet/_sslverify.py
diff options
context:
space:
mode:
authorrobot-piglet <robot-piglet@yandex-team.com>2024-08-25 12:54:32 +0300
committerrobot-piglet <robot-piglet@yandex-team.com>2024-08-25 13:03:33 +0300
commit4a64a813e1d34e732f35d8a65147974f76395a6f (patch)
treea8da0dede5213f85e45b95047cfbdcf5427cf0b7 /contrib/python/Twisted/py3/twisted/internet/_sslverify.py
parente9bbee265681b79a9ef9795bdc84cf6996f9cfec (diff)
downloadydb-4a64a813e1d34e732f35d8a65147974f76395a6f.tar.gz
Intermediate changes
Diffstat (limited to 'contrib/python/Twisted/py3/twisted/internet/_sslverify.py')
-rw-r--r--contrib/python/Twisted/py3/twisted/internet/_sslverify.py23
1 files changed, 13 insertions, 10 deletions
diff --git a/contrib/python/Twisted/py3/twisted/internet/_sslverify.py b/contrib/python/Twisted/py3/twisted/internet/_sslverify.py
index abb6bddf7c..2095fe69ec 100644
--- a/contrib/python/Twisted/py3/twisted/internet/_sslverify.py
+++ b/contrib/python/Twisted/py3/twisted/internet/_sslverify.py
@@ -28,13 +28,16 @@ from twisted.internet.interfaces import (
IOpenSSLClientConnectionCreator,
IOpenSSLContextFactory,
)
-from twisted.python import log, util
+from twisted.logger import Logger
from twisted.python.compat import nativeString
from twisted.python.deprecate import _mutuallyExclusiveArguments, deprecated
from twisted.python.failure import Failure
from twisted.python.randbytes import secureRandom
+from twisted.python.util import nameToLabel
from ._idna import _idnaBytes
+_log = Logger()
+
class TLSVersion(Names):
"""
@@ -344,7 +347,7 @@ class DistinguishedName(Dict[str, bytes]):
return set(mapping.values())
for k in sorted(uniqueValues(_x509names)):
- label = util.nameToLabel(k)
+ label = nameToLabel(k)
lablen = max(len(label), lablen)
v = getattr(self, k, None)
if v is not None:
@@ -431,8 +434,8 @@ class Certificate(CertBase):
def __repr__(self) -> str:
return "<{} Subject={} Issuer={}>".format(
self.__class__.__name__,
- self.getSubject().commonName,
- self.getIssuer().commonName,
+ self.getSubject().get("commonName", ""),
+ self.getIssuer().get("commonName", ""),
)
def __eq__(self, other: object) -> bool:
@@ -1057,13 +1060,13 @@ def _tolerateErrors(wrapped):
@rtype: L{callable}
"""
- def infoCallback(connection, where, ret):
- try:
- return wrapped(connection, where, ret)
- except BaseException:
- f = Failure()
- log.err(f, "Error during info_callback")
+ def infoCallback(connection: SSL.Connection, where: int, ret: int) -> object:
+ result = None
+ with _log.failuresHandled("Error during info_callback") as op:
+ result = wrapped(connection, where, ret)
+ if (f := op.failure) is not None:
connection.get_app_data().failVerification(f)
+ return result
return infoCallback