summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorterryjreedy <tjreedy@udel.edu>2017-07-08 02:28:06 (GMT)
committerGitHub <noreply@github.com>2017-07-08 02:28:06 (GMT)
commit223c7e70e48eb6eed4aab3906fbe32b098faafe3 (patch)
tree84e345911d561e168bc84f647dcddd7b04d07ab6
parent24f2e19d68cc6ca563d2be5944d11d5f55a46918 (diff)
downloadcpython-223c7e70e48eb6eed4aab3906fbe32b098faafe3.zip
cpython-223c7e70e48eb6eed4aab3906fbe32b098faafe3.tar.gz
cpython-223c7e70e48eb6eed4aab3906fbe32b098faafe3.tar.bz2
bpo-8231: Call idlelib.IdleConf.GetUserCfgDir only once. (#2629)
-rw-r--r--Lib/idlelib/config.py6
-rw-r--r--Lib/idlelib/editor.py4
-rwxr-xr-xLib/idlelib/pyshell.py4
-rw-r--r--Misc/NEWS.d/next/IDLE/2017-07-07-21-10-55.bpo-8231.yEge3L.rst1
4 files changed, 8 insertions, 7 deletions
diff --git a/Lib/idlelib/config.py b/Lib/idlelib/config.py
index 621e0bf..ed37f11 100644
--- a/Lib/idlelib/config.py
+++ b/Lib/idlelib/config.py
@@ -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 = {}
diff --git a/Lib/idlelib/editor.py b/Lib/idlelib/editor.py
index 5b64ef4..43b105f 100644
--- a/Lib/idlelib/editor.py
+++ b/Lib/idlelib/editor.py
@@ -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',
diff --git a/Lib/idlelib/pyshell.py b/Lib/idlelib/pyshell.py
index be7bd3d..47df744 100755
--- a/Lib/idlelib/pyshell.py
+++ b/Lib/idlelib/pyshell.py
@@ -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
index 0000000..c96cc4e
--- /dev/null
+++ b/Misc/NEWS.d/next/IDLE/2017-07-07-21-10-55.bpo-8231.yEge3L.rst
@@ -0,0 +1 @@
+IDLE: call config.IdleConf.GetUserCfgDir only once.