]> granicus.if.org Git - python/commitdiff
bpo-8231: Call idlelib.IdleConf.GetUserCfgDir only once. (#2629)
authorterryjreedy <tjreedy@udel.edu>
Sat, 8 Jul 2017 02:28:06 +0000 (22:28 -0400)
committerGitHub <noreply@github.com>
Sat, 8 Jul 2017 02:28:06 +0000 (22:28 -0400)
Lib/idlelib/config.py
Lib/idlelib/editor.py
Lib/idlelib/pyshell.py
Misc/NEWS.d/next/IDLE/2017-07-07-21-10-55.bpo-8231.yEge3L.rst [new file with mode: 0644]

index 621e0bfc8b4073d6f9651c8a0ba716fdcf09ee08..ed37f11a9cb8e02d867329af820df36f19bd54f2 100644 (file)
@@ -172,10 +172,10 @@ class IdleConf:
         "Populate default and user config parser dictionaries."
         #build idle install path
         if __name__ != '__main__': # we were imported
-            idleDir=os.path.dirname(__file__)
+            idleDir = os.path.dirname(__file__)
         else: # we were exec'ed (for testing only)
-            idleDir=os.path.abspath(sys.path[0])
-        userDir=self.GetUserCfgDir()
+            idleDir = os.path.abspath(sys.path[0])
+        self.userdir = userDir = self.GetUserCfgDir()
 
         defCfgFiles = {}
         usrCfgFiles = {}
index 5b64ef4630e737f2e87926adf94d0c407d4c222a..43b105f726573d1b2cf20232a00dbb8f14b869fc 100644 (file)
@@ -103,8 +103,8 @@ class EditorWindow(object):
             self.tkinter_vars = {}  # keys: Tkinter event names
                                     # values: Tkinter variable instances
             self.top.instance_dict = {}
-        self.recent_files_path = os.path.join(idleConf.GetUserCfgDir(),
-                'recent-files.lst')
+        self.recent_files_path = os.path.join(
+                idleConf.userdir, 'recent-files.lst')
         self.text_frame = text_frame = Frame(top)
         self.vbar = vbar = Scrollbar(text_frame, name='vbar')
         self.width = idleConf.GetOption('main', 'EditorWindow',
index be7bd3dfcfb30a3b42f75fe413dcf67ca5b4d3fe..47df74433cf87ac9ab83d72f1f589b1201b0bc6b 100755 (executable)
@@ -117,8 +117,8 @@ class PyShellEditorWindow(EditorWindow):
         self.text.bind("<<clear-breakpoint-here>>", self.clear_breakpoint_here)
         self.text.bind("<<open-python-shell>>", self.flist.open_shell)
 
-        self.breakpointPath = os.path.join(idleConf.GetUserCfgDir(),
-                                           'breakpoints.lst')
+        self.breakpointPath = os.path.join(
+                idleConf.userdir, 'breakpoints.lst')
         # whenever a file is changed, restore breakpoints
         def filename_changed_hook(old_hook=self.io.filename_change_hook,
                                   self=self):
diff --git a/Misc/NEWS.d/next/IDLE/2017-07-07-21-10-55.bpo-8231.yEge3L.rst b/Misc/NEWS.d/next/IDLE/2017-07-07-21-10-55.bpo-8231.yEge3L.rst
new file mode 100644 (file)
index 0000000..c96cc4e
--- /dev/null
@@ -0,0 +1 @@
+IDLE: call config.IdleConf.GetUserCfgDir only once.