You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
&= and -= operator between Set types do not work correctly. #3992
I'm trying to fix @unittest.expectedFailuretest_inplace_on_self in file test_set.py.
def test_inplace_on_self(self):
t = self.s.copy()
t |= t
self.assertEqual(t, self.s)
t &= t
self.assertEqual(t, self.s). -> FAIL
t -= t
self.assertEqual(t, self.thetype()). -> FAIL
t = self.s.copy()
t ^= t
self.assertEqual(t, self.thetype())
I found the two operator fail. &= and -= is not work correctly.
[ &= ]
RustPython
>>>>> s = set({'a', 'b', 'c'})
>>>>> s &= s
>>>>> s
set()
CPython
>>> s = set({'a', 'b', 'c'})
>>> s &= s
>>> s
{'b', 'c', 'a'}
[ -= ]
RustPython
>>>>> s = set({'a', 'b', 'c'})
>>>>> s -= s
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
RuntimeError: set changed size during iteration
Activity
tgsong827 commentedon Aug 2, 2022
This may be related with #3881 #3912.
Can I try it after #3912 is merged?
arihant2math commentedon Apr 22, 2025
&=now works,-=still fails