Skip to content

Commit 1c5b9c9

Browse files
committed
Correct union hash
RustPython#3851
1 parent ddc801e commit 1c5b9c9

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

vm/src/builtins/union.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::{
66
convert::ToPyObject,
77
function::PyComparisonValue,
88
protocol::PyMappingMethods,
9-
types::{AsMapping, Comparable, GetAttr, Hashable, Iterable, PyComparisonOp},
9+
types::{AsMapping, Comparable, GetAttr, Hashable, PyComparisonOp},
1010
AsObject, Context, Py, PyObject, PyObjectRef, PyPayload, PyRef, PyResult, TryFromObject,
1111
VirtualMachine,
1212
};
@@ -264,8 +264,7 @@ impl Comparable for PyUnion {
264264
impl Hashable for PyUnion {
265265
#[inline]
266266
fn hash(zelf: &crate::Py<Self>, vm: &VirtualMachine) -> PyResult<hash::PyHash> {
267-
let it = PyTuple::iter(zelf.args.clone(), vm);
268-
let set = PyFrozenSet::from_iter(vm, it)?;
267+
let set = PyFrozenSet::from_iter(vm, zelf.args.into_iter().cloned())?;
269268
PyFrozenSet::hash(&set.into_ref(vm), vm)
270269
}
271270
}

0 commit comments

Comments
 (0)