Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 26a3563

Browse filesBrowse files
[3.12] gh-110378: Fix test_async_gen_propagates_generator_exit in test_contextlib_async (GH-110500) (#110610)
It now fails if the original bug is not fixed, and no longer produce ResourceWarning with fixed code. (cherry picked from commit 5aa62a8) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
1 parent c1e8e90 commit 26a3563
Copy full SHA for 26a3563

File tree

1 file changed

+5
-9
lines changed
Filter options

1 file changed

+5
-9
lines changed

‎Lib/test/test_contextlib_async.py

Copy file name to clipboardExpand all lines: Lib/test/test_contextlib_async.py
+5-9Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,11 @@ async def gen():
4949
async with ctx():
5050
yield 11
5151

52-
ret = []
53-
exc = ValueError(22)
54-
with self.assertRaises(ValueError):
55-
async with ctx():
56-
async for val in gen():
57-
ret.append(val)
58-
raise exc
59-
60-
self.assertEqual(ret, [11])
52+
g = gen()
53+
async for val in g:
54+
self.assertEqual(val, 11)
55+
break
56+
await g.aclose()
6157

6258
def test_exit_is_abstract(self):
6359
class MissingAexit(AbstractAsyncContextManager):

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.