mirror of
https://github.com/python/cpython.git
synced 2025-07-09 20:35:26 +00:00
Fix wrapping into StopIteration of return values in generators and coroutines (#644)
This commit is contained in:
parent
2b27e2e6a3
commit
b7c9150b68
2 changed files with 16 additions and 2 deletions
|
@ -1103,6 +1103,21 @@ class CoroutineTest(unittest.TestCase):
|
|||
"coroutine is being awaited already"):
|
||||
waiter(coro).send(None)
|
||||
|
||||
def test_await_16(self):
|
||||
# See https://bugs.python.org/issue29600 for details.
|
||||
|
||||
async def f():
|
||||
return ValueError()
|
||||
|
||||
async def g():
|
||||
try:
|
||||
raise KeyError
|
||||
except:
|
||||
return await f()
|
||||
|
||||
_, result = run_async(g())
|
||||
self.assertIsNone(result.__context__)
|
||||
|
||||
def test_with_1(self):
|
||||
class Manager:
|
||||
def __init__(self, name):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue