diff -r af03537d56b2 -r 93b496cc3c88 src/eric7/Utilities/ClassBrowsers/pyclbr.py --- a/src/eric7/Utilities/ClassBrowsers/pyclbr.py Sun Dec 11 18:24:41 2022 +0100 +++ b/src/eric7/Utilities/ClassBrowsers/pyclbr.py Mon Dec 12 16:35:21 2022 +0100 @@ -140,15 +140,6 @@ _commentsub = re.compile(r"""#[^\n]*\n|#[^\n]*$""").sub -_modules = {} # cache of modules we've seen - - -def clearModulesCache(): - """ - Function to clear the cached modules. - """ - _modules.clear() - class VisibilityMixin(ClbrBaseClasses.ClbrVisibilityMixinBase): """ @@ -369,16 +360,6 @@ @return the resulting dictionary @rtype dict """ - global _modules - - if module in _modules: - # we've seen this module before... - return _modules[module] - if module in sys.builtin_module_names: - # this is a built-in module - _modules[module] = {} - return {} - # search the path for the module path = [] if path is None else path[:] f = None @@ -391,18 +372,15 @@ f.close() if type not in SUPPORTED_TYPES: # not Python source, can't do anything with this module - _modules[module] = {} return {} try: src = Utilities.readEncodedFile(file)[0] except (UnicodeError, OSError): # can't do anything with this module - _modules[module] = {} return {} - _modules[module] = scan(src, file, module) - return _modules[module] + return scan(src, file, module) def scan(src, file, module): @@ -453,6 +431,8 @@ dictionary = {} dict_counts = {} + modules = {} + classstack = [] # stack of (class, indent) pairs conditionalsstack = [] # stack of indents of conditional defines deltastack = [] @@ -587,8 +567,8 @@ # module for class m = c[-2] c = c[-1] - if m in _modules: - d = _modules[m] + if m in modules: + d = modules[m] n = d.get(c, n) names.append(n) inherit = names