mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 18:59:04 +08:00
Update cmp of PyUnion
This commit is contained in:
1 parent
a443a0b34c
commit
5480f4c671
1 file changed
+7
-2
@@ -271,9 +271,14 @@ impl Comparable for PyUnion {
|
||||
) -> PyResult<PyComparisonValue> {
|
||||
op.eq_only(|| {
|
||||
let other = class_or_notimplemented!(Self, other);
|
||||
let a = PyFrozenSet::from_iter(vm, zelf.args.into_iter().cloned())?;
|
||||
let b = PyFrozenSet::from_iter(vm, other.args.into_iter().cloned())?;
|
||||
Ok(PyComparisonValue::Implemented(
|
||||
zelf.args()
|
||||
.rich_compare_bool(other.args().as_ref(), PyComparisonOp::Eq, vm)?,
|
||||
a.into_pyobject(vm).as_object().rich_compare_bool(
|
||||
b.into_pyobject(vm).as_object(),
|
||||
PyComparisonOp::Eq,
|
||||
vm,
|
||||
)?,
|
||||
))
|
||||
})
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user