mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
bpo-43908: Mark ssl, hash, and hmac types as immutable (GH-25792)
Signed-off-by: Christian Heimes <christian@python.org>
This commit is contained in:
parent
fd0bc7e7f4
commit
91554e4c5c
13 changed files with 49 additions and 18 deletions
|
@ -926,6 +926,15 @@ class HashLibTestCase(unittest.TestCase):
|
|||
):
|
||||
HASHXOF()
|
||||
|
||||
def test_readonly_types(self):
|
||||
for algorithm, constructors in self.constructors_to_test.items():
|
||||
# all other types have DISALLOW_INSTANTIATION
|
||||
for constructor in constructors:
|
||||
hash_type = type(constructor())
|
||||
with self.subTest(hash_type=hash_type):
|
||||
with self.assertRaisesRegex(TypeError, "immutable type"):
|
||||
hash_type.value = False
|
||||
|
||||
|
||||
class KDFTests(unittest.TestCase):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue