Skip to content

Commit 43d9a7b

Browse files
committed
Cross-reference two tests suites in test_yield_from and test_async_yield_from
1 parent 15fcd7e commit 43d9a7b

2 files changed

Lines changed: 5 additions & 24 deletions

File tree

Lib/test/test_async_yield_from.py

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
"""
2-
Test suite for PEP 828 implementation
2+
Test suite for PEP 828 implementation.
33
4-
Adapted from the 'yield from' tests.
4+
The tests below were adapted from the 'yield from' tests.
5+
For more context on any particular test, try searching for an analogue in `test_yield_from`.
56
"""
67

78
import unittest
@@ -1018,7 +1019,6 @@ async def eggs(g):
10181019

10191020
@_async_test
10201021
async def test_custom_iterator_return(self):
1021-
# See issue #15568
10221022
class MyIter:
10231023
def __aiter__(self):
10241024
return self
@@ -1033,24 +1033,6 @@ async def gen():
10331033

10341034
@_async_test
10351035
async def test_close_with_cleared_frame(self):
1036-
# See issue #17669.
1037-
#
1038-
# Create a stack of generators: outer() delegating to inner()
1039-
# delegating to innermost(). The key point is that the instance of
1040-
# inner is created first: this ensures that its frame appears before
1041-
# the instance of outer in the GC linked list.
1042-
#
1043-
# At the gc.collect call:
1044-
# - frame_clear is called on the inner_gen frame.
1045-
# - gen_dealloc is called on the outer_gen generator (the only
1046-
# reference is in the frame's locals).
1047-
# - gen_close is called on the outer_gen generator.
1048-
# - gen_close_iter is called to close the inner_gen generator, which
1049-
# in turn calls gen_close, and gen_yf.
1050-
#
1051-
# Previously, gen_yf would crash since inner_gen's frame had been
1052-
# cleared (and in particular f_stacktop was NULL).
1053-
10541036
async def innermost():
10551037
yield
10561038
async def inner():
@@ -1073,7 +1055,6 @@ async def outer():
10731055

10741056
@_async_test
10751057
async def test_send_tuple_with_custom_generator(self):
1076-
# See issue #21209.
10771058
class MyGen:
10781059
def __aiter__(self):
10791060
return self
@@ -1626,8 +1607,6 @@ async def outer():
16261607

16271608
@_async_test
16281609
async def test_throws_in_iter(self):
1629-
# See GH-126366: NULL pointer dereference if __iter__
1630-
# threw an exception.
16311610
class Silly:
16321611
async def __aiter__(self):
16331612
yield from ()

Lib/test/test_yield_from.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
66
adapted from original tests written by Greg Ewing
77
see <http://www.cosc.canterbury.ac.nz/greg.ewing/python/yield-from/YieldFrom-Python3.1.2-rev5.zip>
8+
9+
See also `test_async_yield_from'. Where applicable, consider keeping the two test suites in sync.
810
"""
911

1012
import unittest

0 commit comments

Comments
 (0)