summaryrefslogtreecommitdiff
path: root/Lib/rlcompleter.py
diff options
context:
space:
mode:
authorFacundo Batista <facundobatista@gmail.com>2008-07-21 14:28:17 +0000
committerFacundo Batista <facundobatista@gmail.com>2008-07-21 14:28:17 +0000
commit1ffa58ab916003ece27cc33dbb4894bb2dc153cb (patch)
treedc5d713f41b6420112aaee86f11c5e76e63a2afe /Lib/rlcompleter.py
parente6a1b35a2e63e3c6477035863e7ff05323b73cf3 (diff)
downloadcpython-1ffa58ab916003ece27cc33dbb4894bb2dc153cb.tar.gz
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/rlcompleter.py')
-rw-r--r--Lib/rlcompleter.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/Lib/rlcompleter.py b/Lib/rlcompleter.py
index a08b825708..3784cdb35d 100644
--- a/Lib/rlcompleter.py
+++ b/Lib/rlcompleter.py
@@ -134,18 +134,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