diff --git a/Lib/test/test_copy.py b/Lib/test/test_copy.py index e672427324..87fe6044ac 100644 --- a/Lib/test/test_copy.py +++ b/Lib/test/test_copy.py @@ -370,7 +370,6 @@ class TestCopy(unittest.TestCase): self.assertIsNot(x, y) self.assertIsNot(x[0], y[0]) - @unittest.skip("TODO: RUSTPYTHON, segmentation fault") def test_deepcopy_reflexive_list(self): x = [] x.append(x) @@ -398,7 +397,6 @@ class TestCopy(unittest.TestCase): y = copy.deepcopy(x) self.assertIs(x, y) - @unittest.skip("TODO: RUSTPYTHON, segmentation fault") def test_deepcopy_reflexive_tuple(self): x = ([],) x[0].append(x) @@ -416,7 +414,6 @@ class TestCopy(unittest.TestCase): self.assertIsNot(x, y) self.assertIsNot(x["foo"], y["foo"]) - @unittest.skip("TODO: RUSTPYTHON, segmentation fault") def test_deepcopy_reflexive_dict(self): x = {} x['foo'] = x diff --git a/vm/src/vm.rs b/vm/src/vm.rs index 1d77ab2572..f2f22552ed 100644 --- a/vm/src/vm.rs +++ b/vm/src/vm.rs @@ -1876,8 +1876,6 @@ impl VirtualMachine { op: PyComparisonOp, ) -> PyResult> { let swapped = op.swapped(); - // TODO: _Py_EnterRecursiveCall(tstate, " in comparison") - let call_cmp = |obj: &PyObjectRef, other, op| { let cmp = obj .class() @@ -1896,17 +1894,19 @@ impl VirtualMachine { !v_class.is(&w_class) && w_class.issubclass(&v_class) }; if is_strict_subclass { - let res = call_cmp(w, v, swapped)?; + let res = self.with_recursion("in comparison", || call_cmp(w, v, swapped))?; checked_reverse_op = true; if let PyArithmeticValue::Implemented(x) = res { return Ok(x); } } - if let PyArithmeticValue::Implemented(x) = call_cmp(v, w, op)? { + if let PyArithmeticValue::Implemented(x) = + self.with_recursion("in comparison", || call_cmp(v, w, op))? + { return Ok(x); } if !checked_reverse_op { - let res = call_cmp(w, v, swapped)?; + let res = self.with_recursion("in comparison", || call_cmp(w, v, swapped))?; if let PyArithmeticValue::Implemented(x) = res { return Ok(x); } @@ -1916,7 +1916,6 @@ impl VirtualMachine { PyComparisonOp::Ne => Ok(Either::B(!v.is(&w))), _ => Err(self.new_unsupported_binop_error(v, w, op.operator_token())), } - // TODO: _Py_LeaveRecursiveCall(tstate); } pub fn bool_cmp(&self, a: &PyObjectRef, b: &PyObjectRef, op: PyComparisonOp) -> PyResult {