File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -134,18 +134,23 @@ def attr_matches(self, text):
134134 return []
135135 expr , attr = m .group (1 , 3 )
136136 try :
137- object = eval (expr , self .namespace )
137+ thisobject = eval (expr , self .namespace )
138138 except Exception :
139139 return []
140- words = dir (object )
141- if hasattr (object ,'__class__' ):
140+
141+ # get the content of the object, except __builtins__
142+ words = dir (thisobject )
143+ if "__builtins__" in words :
144+ words .remove ("__builtins__" )
145+
146+ if hasattr (thisobject , '__class__' ):
142147 words .append ('__class__' )
143- words = words + get_class_members (object .__class__ )
148+ words . extend ( get_class_members (thisobject .__class__ ) )
144149 matches = []
145150 n = len (attr )
146151 for word in words :
147- if word [:n ] == attr and word != "__builtins__" :
148- val = getattr (object , word )
152+ if word [:n ] == attr and hasattr ( thisobject , word ) :
153+ val = getattr (thisobject , word )
149154 word = self ._callable_postfix (val , "%s.%s" % (expr , word ))
150155 matches .append (word )
151156 return matches
You canβt perform that action at this time.
0 commit comments