Skip to content

Commit 809b3e0

Browse files
authored
Make HASH/HASHXOF types immutable (RustPython#7131)
1 parent 91fa862 commit 809b3e0

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

Lib/test/test_hashlib.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -992,8 +992,6 @@ def test_hash_disallow_instantiation(self):
992992
support.check_disallow_instantiation(self, HASH)
993993
support.check_disallow_instantiation(self, HASHXOF)
994994

995-
# TODO: RUSTPYTHON
996-
@unittest.expectedFailure
997995
def test_readonly_types(self):
998996
for algorithm, constructors in self.constructors_to_test.items():
999997
# all other types have DISALLOW_INSTANTIATION

crates/stdlib/src/hashlib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ pub mod _hashlib {
110110
}
111111
}
112112

113-
#[pyclass(with(Representable))]
113+
#[pyclass(with(Representable), flags(IMMUTABLETYPE))]
114114
impl PyHasher {
115115
fn new(name: &str, d: HashWrapper) -> Self {
116116
Self {
@@ -183,7 +183,7 @@ pub mod _hashlib {
183183
}
184184
}
185185

186-
#[pyclass]
186+
#[pyclass(flags(IMMUTABLETYPE))]
187187
impl PyHasherXof {
188188
fn new(name: &str, d: HashXofWrapper) -> Self {
189189
Self {

0 commit comments

Comments
 (0)