From 59110fcfccfac7c71a3b861452eaf73f695bef27 Mon Sep 17 00:00:00 2001 From: Pablo Galindo Salgado Date: Sun, 26 Oct 2025 00:11:30 +0100 Subject: [PATCH] Don't reify on REPL completion --- Lib/rlcompleter.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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)