Skip to content

Commit c257eda

Browse files
committed
gh-89520: IDLE - Fix default value logic in configdialog load_extensions
Fix two issues in load_extensions: 1. def_str (the "default" value) was sourced from user config when the option existed there. This meant opening the extensions dialog could silently revert user customizations, since the user's value would be treated as the default and then removed. Now prefers default config, falling back to user config only for user-only extensions. 2. The value lookup was skipping user config for default-only options. Restore the original behavior of always trying user config first (which returns def_obj as fallback when the option is absent).
1 parent 5a2d995 commit c257eda

1 file changed

Lines changed: 6 additions & 11 deletions

File tree

Lib/idlelib/configdialog.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1978,11 +1978,11 @@ def load_extensions(self):
19781978
opt_list = enables + opt_list
19791979

19801980
for opt_name in opt_list:
1981-
if opt_name in user:
1982-
def_str = self.ext_userCfg.Get(
1981+
if opt_name in default:
1982+
def_str = self.ext_defaultCfg.Get(
19831983
ext_name, opt_name, raw=True)
19841984
else:
1985-
def_str = self.ext_defaultCfg.Get(
1985+
def_str = self.ext_userCfg.Get(
19861986
ext_name, opt_name, raw=True)
19871987
try:
19881988
def_obj = {'True':True, 'False':False}[def_str]
@@ -1995,14 +1995,9 @@ def load_extensions(self):
19951995
def_obj = def_str
19961996
opt_type = None
19971997
try:
1998-
if opt_name in user:
1999-
value = self.ext_userCfg.Get(
2000-
ext_name, opt_name, type=opt_type, raw=True,
2001-
default=def_obj)
2002-
else:
2003-
value = self.ext_defaultCfg.Get(
2004-
ext_name, opt_name, type=opt_type, raw=True,
2005-
default=def_obj)
1998+
value = self.ext_userCfg.Get(
1999+
ext_name, opt_name, type=opt_type, raw=True,
2000+
default=def_obj)
20062001
except ValueError: # Need this until .Get fixed.
20072002
value = def_obj # Bad values overwritten by entry.
20082003
var = StringVar(self)

0 commit comments

Comments
 (0)