From c22bf333be51cdd0e58e86e5edf33cd682caeda0 2015-03-22 23:47:40 From: Min RK Date: 2015-03-22 23:47:40 Subject: [PATCH] use delay_trait_notifications in Configurable._load_config --- diff --git a/IPython/config/configurable.py b/IPython/config/configurable.py index 27af27f..c392352 100644 --- a/IPython/config/configurable.py +++ b/IPython/config/configurable.py @@ -138,17 +138,20 @@ class Configurable(HasTraits): section_names = self.section_names() my_config = self._find_my_config(cfg) - for name, config_value in iteritems(my_config): - if name in traits: - if isinstance(config_value, LazyConfigValue): - # ConfigValue is a wrapper for using append / update on containers - # without having to copy the - initial = getattr(self, name) - config_value = config_value.get_value(initial) - # We have to do a deepcopy here if we don't deepcopy the entire - # config object. If we don't, a mutable config_value will be - # shared by all instances, effectively making it a class attribute. - setattr(self, name, deepcopy(config_value)) + + # hold trait notifications until after all config has been loaded + with self.delay_trait_notifications(): + for name, config_value in iteritems(my_config): + if name in traits: + if isinstance(config_value, LazyConfigValue): + # ConfigValue is a wrapper for using append / update on containers + # without having to copy the initial value + initial = getattr(self, name) + config_value = config_value.get_value(initial) + # We have to do a deepcopy here if we don't deepcopy the entire + # config object. If we don't, a mutable config_value will be + # shared by all instances, effectively making it a class attribute. + setattr(self, name, deepcopy(config_value)) def _config_changed(self, name, old, new): """Update all the class traits having ``config=True`` as metadata.