Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Lib/test/test_dictviews.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,6 @@ def test_copy(self):
self.assertRaises(TypeError, copy.copy, d.values())
self.assertRaises(TypeError, copy.copy, d.items())

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_compare_error(self):
class Exc(Exception):
pass
Expand Down
7 changes: 7 additions & 0 deletions crates/vm/src/protocol/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,13 @@ impl PyObject {
op_id: PyComparisonOp,
vm: &VirtualMachine,
) -> PyResult<bool> {
if self.is(other) {
if op_id == PyComparisonOp::Eq {
return Ok(true);
} else if op_id == PyComparisonOp::Ne {
return Ok(false);
}
}
match self._cmp(other, op_id, vm)? {
Either::A(obj) => obj.try_to_bool(vm),
Either::B(other) => Ok(other),
Expand Down
Loading
Loading