80 @param namespace namespace for the completer |
81 @param namespace namespace for the completer |
81 @type dict |
82 @type dict |
82 @exception TypeError raised to indicate a wrong data structure of |
83 @exception TypeError raised to indicate a wrong data structure of |
83 the namespace object |
84 the namespace object |
84 """ |
85 """ |
85 if namespace and not isinstance(namespace, dict): |
86 if namespace and not isinstance(namespace, (dict, sys._getframe().f_locals.__class__)): |
86 raise TypeError("namespace must be a dictionary") |
87 raise TypeError("namespace must be a dictionary or since 3.13 a FrameLocalsProxy") |
87 |
88 |
88 # Don't bind to namespace quite yet, but flag whether the user wants a |
89 # Don't bind to namespace quite yet, but flag whether the user wants a |
89 # specific namespace or to use __main__.__dict__. This will allow us |
90 # specific namespace or to use __main__.__dict__. This will allow us |
90 # to bind to __main__.__dict__ at completion time, not now. |
91 # to bind to __main__.__dict__ at completion time, not now. |
91 if namespace is None: |
92 if namespace is None: |
200 |
201 |
201 # get the content of the object, except __builtins__ |
202 # get the content of the object, except __builtins__ |
202 words = set(dir(thisobject)) |
203 words = set(dir(thisobject)) |
203 words.discard("__builtins__") |
204 words.discard("__builtins__") |
204 |
205 |
205 if hasattr(object, "__class__"): |
206 if hasattr(thisobject, "__class__"): |
206 words.add("__class__") |
207 words.add("__class__") |
207 words.update(get_class_members(thisobject.__class__)) |
208 words.update(get_class_members(thisobject.__class__)) |
208 matches = [] |
209 matches = [] |
209 n = len(attr) |
210 n = len(attr) |
210 if attr == "": |
211 if attr == "": |