diff options
author | Benjamin Peterson <benjamin@python.org> | 2008-07-21 16:32:10 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2008-07-21 16:32:10 (GMT) |
commit | 095c1199ffa20130451f01ce142de65147936daf (patch) | |
tree | 72381660ec9616933427c2d419e71d90b5cc2318 /Lib | |
parent | d68442dc933854dab7c942f9f343764235baf822 (diff) | |
download | cpython-095c1199ffa20130451f01ce142de65147936daf.zip cpython-095c1199ffa20130451f01ce142de65147936daf.tar.gz cpython-095c1199ffa20130451f01ce142de65147936daf.tar.bz2 |
Merged revisions 65168 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r65168 | facundo.batista | 2008-07-21 09:28:17 -0500 (Mon, 21 Jul 2008) | 5 lines
Issue 3396. Fixed the autocompletion of 'int.', and worked
a little that part of the code, fixing a detail and enhancing
a bit others.
........
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/rlcompleter.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/Lib/rlcompleter.py b/Lib/rlcompleter.py index db63aeb..6eb1b3d 100644 --- a/Lib/rlcompleter.py +++ b/Lib/rlcompleter.py @@ -128,18 +128,23 @@ class Completer: return [] expr, attr = m.group(1, 3) try: - object = eval(expr, self.namespace) + thisobject = eval(expr, self.namespace) except Exception: return [] - words = dir(object) - if hasattr(object,'__class__'): + + # get the content of the object, except __builtins__ + words = dir(thisobject) + if "__builtins__" in words: + words.remove("__builtins__") + + if hasattr(thisobject, '__class__'): words.append('__class__') - words = words + get_class_members(object.__class__) + words.extend(get_class_members(thisobject.__class__)) matches = [] n = len(attr) for word in words: - if word[:n] == attr and word != "__builtins__": - val = getattr(object, word) + if word[:n] == attr and hasattr(thisobject, word): + val = getattr(thisobject, word) word = self._callable_postfix(val, "%s.%s" % (expr, word)) matches.append(word) return matches |