set
intersection_update
, difference_update
, symmetric_difference_update
should check self is equal to given arg
#3881
Labels
A-design
About RustPython's own implementation
compat
A discrepancy between RustPython and CPython
good first issue
Good for newcomers
Feature
They are also relevant to inplace operations(
iand
,isub
,ixor
).CPython checks whether given argument and selfobject are equal and then returns.
intersection_update
: If self == arg, returns self.copy()difference_update
: If self == arg, returns self.clear(); Ok(())symmetric_difference_update
: If self == arg, returns self.clear(); Ok(())At the current implementation, they get a parameter as
SetIterable
which is converted fromPyObjectRef
before entering each method.For checking
self == arg
, we should convert it after checking.Python Documentation
Relevant Test Case
test_set.py
test_inplace_on_self
The text was updated successfully, but these errors were encountered: