Make HASH/HASHXOF types immutable (#7131)

This commit is contained in:
Lee Dogeon
2026-02-14 20:37:47 +09:00
committed by GitHub
parent e3edba398e
commit 2a2086014c
2 changed files with 2 additions and 4 deletions

View File

@@ -992,8 +992,6 @@ class HashLibTestCase(unittest.TestCase):
support.check_disallow_instantiation(self, HASH)
support.check_disallow_instantiation(self, HASHXOF)
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_readonly_types(self):
for algorithm, constructors in self.constructors_to_test.items():
# all other types have DISALLOW_INSTANTIATION

View File

@@ -110,7 +110,7 @@ pub mod _hashlib {
}
}
#[pyclass(with(Representable))]
#[pyclass(with(Representable), flags(IMMUTABLETYPE))]
impl PyHasher {
fn new(name: &str, d: HashWrapper) -> Self {
Self {
@@ -183,7 +183,7 @@ pub mod _hashlib {
}
}
#[pyclass]
#[pyclass(flags(IMMUTABLETYPE))]
impl PyHasherXof {
fn new(name: &str, d: HashXofWrapper) -> Self {
Self {