objclosure: Fix printing of generator closures.

The code previously assumed that only functions can be closed over.
This commit is contained in:
Paul Sokolovsky
2014-10-16 00:14:01 +03:00
parent 9b0b373e5e
commit 067ae1269d
2 changed files with 9 additions and 1 deletions

View File

@@ -24,3 +24,9 @@ generator_of_generators = (((x, y) for x in range(2)) for y in range(3))
for i in generator_of_generators:
for j in i:
print(j)
# test that printing of closed-over generators doesn't lead to segfaults
def genc():
foo = 1
repr(lambda: (yield foo))
genc()