1
0
forked from VimPlug/jedi

Fix: py__iter__ in dynamic list/set usages with empy params.

This commit is contained in:
Dave Halter
2015-12-01 18:35:12 +01:00
parent 0a10947ff0
commit 37c21726e7
3 changed files with 38 additions and 17 deletions
+11
View File
@@ -198,6 +198,17 @@ class CompiledObject(Base):
pass # self.obj maynot have an __iter__ method.
return result
def py__iter__(self):
if not hasattr(self.obj, '__iter__'):
debug.warning('Tried to call __getitem__ on non-iterable.')
return
if type(self.obj) not in (str, list, tuple, unicode, bytes, bytearray, dict):
# Get rid of side effects, we won't call custom `__getitem__`s.
return
for obj in self.obj:
yield set([CompiledObject(obj)])
@property
def name(self):
# might not exist sometimes (raises AttributeError)