diff --git a/param/parameterized.py b/param/parameterized.py index dd8ecdd1..83260056 100644 --- a/param/parameterized.py +++ b/param/parameterized.py @@ -2056,6 +2056,8 @@ def _changed(cls, event): Predicate that determines whether a Event object has actually changed such that old != new. """ + if event.old is event.new: + return False return not Comparator.is_equal(event.old, event.new) def _instantiate_param(self_, param_obj, dict_=None, key=None, deepcopy=True): diff --git a/tests/testwatch.py b/tests/testwatch.py index e0708a97..e79b955c 100644 --- a/tests/testwatch.py +++ b/tests/testwatch.py @@ -183,7 +183,7 @@ def accumulator(change): obj.a = 1 self.assertEqual(self.accumulator, 1) - def test_triggered_when_unchanged_complex_type(self): + def test_untriggered_when_unchanged_complex_type(self): def accumulator(change): self.accumulator += 1 @@ -193,7 +193,7 @@ def accumulator(change): obj.a = subobj self.assertEqual(self.accumulator, 1) obj.a = subobj - self.assertEqual(self.accumulator, 2) + self.assertEqual(self.accumulator, 1) def test_triggered_when_unchanged_if_not_onlychanged(self): accumulator = Accumulator()