[3.6] bpo-8231: Call idlelib.IdleConf.GetUserCfgDir only once. (GH-2629) (#2631)

(cherry picked from commit 223c7e7)
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 @@
         "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 = {}