summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2012-01-13 20:06:12 (GMT)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2012-01-13 20:06:12 (GMT)
commite557da804aae6ae6478809243c349659f5c3e722 (patch)
tree8bd67c70fc72c5cf33734d9a9f78c70e9f6ac7a2 /Lib
parent7e447c8224c0ce7748dfd502c746139965d2d1e4 (diff)
downloadcpython-e557da804aae6ae6478809243c349659f5c3e722.zip
cpython-e557da804aae6ae6478809243c349659f5c3e722.tar.gz
cpython-e557da804aae6ae6478809243c349659f5c3e722.tar.bz2
Fix a crash when the return value of a subgenerator is a temporary
object (with a refcount of 1)
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_pep380.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_pep380.py b/Lib/test/test_pep380.py
index 6554b0f..3a1db29 100644
--- a/Lib/test/test_pep380.py
+++ b/Lib/test/test_pep380.py
@@ -364,6 +364,17 @@ class TestPEP380Operation(unittest.TestCase):
])
+ def test_exception_value_crash(self):
+ # There used to be a refcount error when the return value
+ # stored in the StopIteration has a refcount of 1.
+ def g1():
+ yield from g2()
+ def g2():
+ yield "g2"
+ return [42]
+ self.assertEqual(list(g1()), ["g2"])
+
+
def test_generator_return_value(self):
"""
Test generator return value