diff -r 10efb1797e7b Lib/idlelib/configDialog.py --- a/Lib/idlelib/configDialog.py Thu Oct 01 13:16:43 2015 +0200 +++ b/Lib/idlelib/configDialog.py Sun Oct 04 12:43:46 2015 -0700 @@ -1113,6 +1113,18 @@ if idleConf.defaultCfg[configType].Get(section, item) == value: #the setting equals a default setting, remove it from user cfg return idleConf.userCfg[configType].RemoveOption(section, item) + # handle any special cases and backwards compatiblity concerns + if configType == 'main' and section == 'Theme' and item == 'name': + # For backwards compatibility, we write 'newer' themes to the + # user config file so they can be used in older versions of IDLE. + # These are ignored by newer versions which have the theme name + # in their default list. See Issue #25313 + if value in idleConf.defaultCfg['highlight'].sections() \ + and value not in ['IDLE Classic', 'IDLE New'] \ + and value not in idleConf.userCfg['highlight'].sections(): + for elt,val in idleConf.defaultCfg['highlight'].items(value): + idleConf.userCfg['highlight'].SetOption(value, elt, val) + idleConf.userCfg['highlight'].Save() #if we got here set the option return idleConf.userCfg[configType].SetOption(section, item, value) diff -r 10efb1797e7b Lib/idlelib/configHandler.py --- a/Lib/idlelib/configHandler.py Thu Oct 01 13:16:43 2015 +0200 +++ b/Lib/idlelib/configHandler.py Sun Oct 04 12:43:46 2015 -0700 @@ -270,13 +270,14 @@ """ if not (configType in self.config_types): raise InvalidConfigType('Invalid configType specified') - if configSet == 'user': - cfgParser = self.userCfg[configType] - elif configSet == 'default': - cfgParser=self.defaultCfg[configType] + if not (configSet in ['user', 'default']): + raise InvalidConfigSet('Invalid configSet specified') + defaultsections = self.defaultCfg[configType].sections() + if configSet == 'default': + return defaultsections else: - raise InvalidConfigSet('Invalid configSet specified') - return cfgParser.sections() + usersections = self.userCfg[configType].sections() + return [x for x in usersections if x not in defaultsections] def GetHighlight(self, theme, element, fgBg=None): """Return individual theme element highlight color(s).