mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 10:44:36 +08:00
Avoid set changed size during iteration (#5860)
This commit is contained in:
1 parent
8cac4335b4
commit
8589b55203
2 files changed
+3
-4
No files matched your search
Vendored
-2
@@ -582,8 +582,6 @@ class TestSet(TestJointOps, unittest.TestCase):
|
||||
else:
|
||||
self.assertNotIn(c, self.s)
|
||||
|
||||
# TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure
|
||||
def test_inplace_on_self(self):
|
||||
t = self.s.copy()
|
||||
t |= t
|
||||
|
||||
@@ -426,8 +426,9 @@ impl PySetInner {
|
||||
vm: &VirtualMachine,
|
||||
) -> PyResult<()> {
|
||||
for iterable in others {
|
||||
for item in iterable.iter(vm)? {
|
||||
self.content.delete_if_exists(vm, &*item?)?;
|
||||
let items = iterable.iter(vm)?.collect::<Result<Vec<_>, _>>()?;
|
||||
for item in items {
|
||||
self.content.delete_if_exists(vm, &*item)?;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
|
||||
Reference in new issue
Block a user