diff --git a/IPython/core/component.py b/IPython/core/component.py index 730af7e..752f227 100644 --- a/IPython/core/component.py +++ b/IPython/core/component.py @@ -234,10 +234,18 @@ class Component(HasTraitlets): self.root = self # This is the default, it is set when parent is set self.parent = parent if config is not None: - self.config = deepcopy(config) + self.config = config + # We used to deepcopy, but for now we are trying to just save + # by reference. This *could* have side effects as all components + # will share config. + # self.config = deepcopy(config) else: if self.parent is not None: - self.config = deepcopy(self.parent.config) + self.config = self.parent.config + # We used to deepcopy, but for now we are trying to just save + # by reference. This *could* have side effects as all components + # will share config. + # self.config = deepcopy(self.parent.config) self.created = datetime.datetime.now() diff --git a/IPython/core/tests/test_component.py b/IPython/core/tests/test_component.py index f03d4a3..9774320 100644 --- a/IPython/core/tests/test_component.py +++ b/IPython/core/tests/test_component.py @@ -147,12 +147,12 @@ class TestComponentConfig(TestCase): self.assertEquals(c1.config, config) self.assertEquals(c2.config, config) self.assertEquals(c3.config, config) - # Test that we always make copies - self.assert_(c1.config is not config) - self.assert_(c2.config is not config) - self.assert_(c3.config is not config) - self.assert_(c1.config is not c2.config) - self.assert_(c2.config is not c3.config) + # Test that copies are not made + self.assert_(c1.config is config) + self.assert_(c2.config is config) + self.assert_(c3.config is config) + self.assert_(c1.config is c2.config) + self.assert_(c2.config is c3.config) def test_inheritance(self): class MyComponent(Component):