diff --git a/Lib/rlcompleter.py b/Lib/rlcompleter.py index 23eb0020f42..59341f08431 100644 --- a/Lib/rlcompleter.py +++ b/Lib/rlcompleter.py @@ -36,6 +36,7 @@ import re import __main__ import warnings +import types __all__ = ["Completer"] @@ -188,7 +189,16 @@ def attr_matches(self, text): # property method, which is not desirable. matches.append(match) continue - if (value := getattr(thisobject, word, None)) is not None: + + if (isinstance(thisobject, types.ModuleType) + and + isinstance(thisobject.__dict__.get(word),types.LazyImportType) + ): + value = thisobject.__dict__.get(word) + else: + value = getattr(thisobject, word, None) + + if value is not None: matches.append(self._callable_postfix(value, match)) else: matches.append(match)