Skip to content

Commit 17eea03

Browse files
committed
Remove tests for async gen syntax restrictions.
1 parent 8cb5166 commit 17eea03

File tree

4 files changed

+23
-52
lines changed

4 files changed

+23
-52
lines changed

Lib/test/test_asyncgen.py

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -82,55 +82,6 @@ async def anext_impl():
8282
return anext_impl()
8383

8484

85-
class AsyncGenSyntaxTest(unittest.TestCase):
86-
87-
def test_async_gen_syntax_01(self):
88-
code = '''async def foo():
89-
await abc
90-
yield from 123
91-
'''
92-
93-
with self.assertRaisesRegex(SyntaxError, 'yield from.*inside async'):
94-
exec(code, {}, {})
95-
96-
def test_async_gen_syntax_02(self):
97-
code = '''async def foo():
98-
yield from 123
99-
'''
100-
101-
with self.assertRaisesRegex(SyntaxError, 'yield from.*inside async'):
102-
exec(code, {}, {})
103-
104-
def test_async_gen_syntax_03(self):
105-
code = '''async def foo():
106-
await abc
107-
yield
108-
return 123
109-
'''
110-
111-
with self.assertRaisesRegex(SyntaxError, 'return.*value.*async gen'):
112-
exec(code, {}, {})
113-
114-
def test_async_gen_syntax_04(self):
115-
code = '''async def foo():
116-
yield
117-
return 123
118-
'''
119-
120-
with self.assertRaisesRegex(SyntaxError, 'return.*value.*async gen'):
121-
exec(code, {}, {})
122-
123-
def test_async_gen_syntax_05(self):
124-
code = '''async def foo():
125-
if 0:
126-
yield
127-
return 12
128-
'''
129-
130-
with self.assertRaisesRegex(SyntaxError, 'return.*value.*async gen'):
131-
exec(code, {}, {})
132-
133-
13485
class AsyncGenTest(unittest.TestCase):
13586

13687
def compare_generators(self, sync_gen, async_gen):

Modules/_testinternalcapi/test_cases.c.h

Lines changed: 11 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/bytecodes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1587,10 +1587,10 @@ dummy_func(
15871587
PyObject *exc_value = PyStackRef_AsPyObjectSteal(exc_value_st);
15881588
assert(exc_value != NULL);
15891589
assert(PyExceptionInstance_Check(exc_value));
1590-
INPUTS_DEAD();
15911590

15921591
int matches = PyErr_GivenExceptionMatches(exc_value, PyExc_StopAsyncIteration);
15931592
if (matches) {
1593+
DECREF_INPUTS();
15941594
value = PyStackRef_FromPyObjectNew(((PyStopAsyncIterationObject *)exc_value)->value);
15951595
}
15961596
else {

Python/generated_cases.c.h

Lines changed: 11 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)