diff options
author | Christian Heimes <christian@python.org> | 2019-09-09 16:06:55 (GMT) |
---|---|---|
committer | Steve Dower <steve.dower@python.org> | 2019-09-09 16:06:55 (GMT) |
commit | 915cd3f0696cb8a7206754a8fc34d4cd865a1b4a (patch) | |
tree | d5dd29a1c76f1ac11ac6a20dc47ccb7faf680200 /Lib/test/test_ssl.py | |
parent | 09090d04ef8d2f4c94157b852d3d530a51e13d22 (diff) | |
download | cpython-915cd3f0696cb8a7206754a8fc34d4cd865a1b4a.zip cpython-915cd3f0696cb8a7206754a8fc34d4cd865a1b4a.tar.gz cpython-915cd3f0696cb8a7206754a8fc34d4cd865a1b4a.tar.bz2 |
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>
Diffstat (limited to 'Lib/test/test_ssl.py')
-rw-r--r-- | Lib/test/test_ssl.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index 6ad0b61..b719283 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -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" |