mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
bpo-35941: Fix performance regression in new code (GH-12610)
Accumulate certificates in a set instead of doing a costly list contain operation. A Windows cert store can easily contain over hundred certificates. The old code would result in way over 5,000 comparison operations Signed-off-by: Christian Heimes <christian@python.org>
This commit is contained in:
parent
09090d04ef
commit
915cd3f069
2 changed files with 29 additions and 30 deletions
|
@ -835,8 +835,8 @@ class BasicSocketTests(unittest.TestCase):
|
|||
cert, enc, trust = element
|
||||
self.assertIsInstance(cert, bytes)
|
||||
self.assertIn(enc, {"x509_asn", "pkcs_7_asn"})
|
||||
self.assertIsInstance(trust, (set, bool))
|
||||
if isinstance(trust, set):
|
||||
self.assertIsInstance(trust, (frozenset, set, bool))
|
||||
if isinstance(trust, (frozenset, set)):
|
||||
trust_oids.update(trust)
|
||||
|
||||
serverAuth = "1.3.6.1.5.5.7.3.1"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue