Fix: Array additions (append, insert) should not cause an additional py__iter__ entry if there's none.

This commit is contained in:
Dave Halter
2015-12-01 22:57:54 +01:00
parent 53dbdf22a2
commit 41537a78e1
2 changed files with 7 additions and 3 deletions

View File

@@ -316,7 +316,9 @@ class Array(IterableWrapper, ArrayMixin):
for value in iterate:
yield self._evaluator.eval_element(value)
yield check_array_additions(self._evaluator, self)
additions = check_array_additions(self._evaluator, self)
if additions:
yield additions
def _values(self):
"""Returns a list of a list of node."""
@@ -709,7 +711,9 @@ class _ArrayInstance(IterableWrapper):
yield types
module = self.var_args.get_parent_until()
is_list = str(self.instance.name) == 'list'
yield _check_array_additions(self._evaluator, self.instance, module, is_list)
additions = _check_array_additions(self._evaluator, self.instance, module, is_list)
if additions:
yield additions
class Slice(object):

View File

@@ -44,7 +44,7 @@ left, right = [x for x in (left, right)]
left
# with a dict literal
#? str()
#? int()
[a for a in {1:'x'}][0]
# list comprehensions should also work in combination with functions