From 3db197c4b12970fedfaba780b3e7d7b9eb76691d Mon Sep 17 00:00:00 2001 From: Aviv Palivoda Date: Sat, 22 Feb 2020 12:59:48 +0200 Subject: [PATCH] Fix set intersection_update --- Lib/test/test_set.py | 1 - vm/src/obj/objset.rs | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_set.py b/Lib/test/test_set.py index 3e51977f1..78e0283a8 100644 --- a/Lib/test/test_set.py +++ b/Lib/test/test_set.py @@ -512,7 +512,6 @@ class TestSet(TestJointOps, unittest.TestCase): for c in (self.word + self.otherword): self.assertIn(c, self.s) - @unittest.skip("TODO: RUSTPYTHON") def test_intersection_update(self): retval = self.s.intersection_update(self.otherword) self.assertEqual(retval, None) diff --git a/vm/src/obj/objset.rs b/vm/src/obj/objset.rs index b68c459b7..e4d72a5f4 100644 --- a/vm/src/obj/objset.rs +++ b/vm/src/obj/objset.rs @@ -298,7 +298,7 @@ impl PySetInner { others: Args, vm: &VirtualMachine, ) -> PyResult<()> { - let temp_inner = self.copy(); + let mut temp_inner = self.copy(); self.clear(); for iterable in others { for item in iterable.iter(vm)? { @@ -307,6 +307,7 @@ impl PySetInner { self.add(&obj, vm)?; } } + temp_inner = self.copy() } Ok(()) }