Utilities/ModuleParser.py

changeset 5651
982465f8389c
parent 5604
b047181a4a33
child 6048
82ad8ec9548c
diff -r 4c52f07c186e -r 982465f8389c Utilities/ModuleParser.py
--- a/Utilities/ModuleParser.py	Wed Mar 22 18:45:15 2017 +0100
+++ b/Utilities/ModuleParser.py	Wed Mar 22 18:50:20 2017 +0100
@@ -1448,7 +1448,7 @@
             self.linenos.append(lineno)
 
 
-def readModule(module, path=[], inpackage=False, basename="",
+def readModule(module, path=None, inpackage=False, basename="",
                extensions=None, caching=True):
     """
     Function to read a module file and parse it.
@@ -1457,12 +1457,12 @@
     If the module was parsed before, the information is taken
     from a cache in order to speed up processing.
     
-    @param module Name of the module to be parsed (string)
-    @param path Searchpath for the module (list of strings)
-    @param inpackage Flag indicating that module is inside a
+    @param module name of the module to be parsed (string)
+    @param path search path for the module (list of strings)
+    @param inpackage flag indicating that module is inside a
         package (boolean)
-    @param basename a path basename. This basename is deleted from
-        the filename of the module file to be read. (string)
+    @param basename a path basename that is deleted from the filename of
+        the module file to be read (string)
     @param extensions list of extensions, which should be considered valid
         source file extensions (list of strings)
     @param caching flag indicating that the parsed module should be
@@ -1518,6 +1518,7 @@
         return mod
     
     # search the path for the module
+    path = [] if path is None else path[:]
     f = None
     if inpackage:
         try:
@@ -1526,7 +1527,7 @@
         except ImportError:
             f = None
     if f is None:
-        fullpath = list(path) + sys.path
+        fullpath = path[:] + sys.path[:]
         f, file, (suff, mode, moduleType) = find_module(
             module, fullpath, _extensions)
     if f:

eric ide

mercurial