Skip to content

Commit ada0063

Browse files
committed
Fix Set iand operation bug
1 parent 242e511 commit ada0063

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

vm/src/builtins/set.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,11 @@ impl PySet {
658658
}
659659

660660
#[pymethod(magic)]
661-
fn iand(zelf: PyRef<Self>, set: AnySet, vm: &VirtualMachine) -> PyResult<PyRef<Self>> {
661+
fn iand(zelf: PyRef<Self>, set: PyObjectRef, vm: &VirtualMachine) -> PyResult<PyRef<Self>> {
662+
if zelf.get_id() == set.get_id() {
663+
return Ok(zelf);
664+
}
665+
let set = set.try_into_value::<AnySet>(vm)?;
662666
zelf.inner
663667
.intersection_update(std::iter::once(set.into_iterable(vm)?), vm)?;
664668
Ok(zelf)

0 commit comments

Comments
 (0)