https://github.com/python/cpython/commit/6fb5f7f4d9d22c49f5c29d2ffcbcc32b6cd7d06a
commit: 6fb5f7f4d9d22c49f5c29d2ffcbcc32b6cd7d06a
branch: main
author: Thomas Grainger <tagr...@gmail.com>
committer: sobolevn <m...@sobolevn.me>
date: 2025-03-25T08:29:51Z
summary:

gh-131707: fix unawaited coroutine warning in test_coroutines.Corouti… (#131708)

gh-131707: fix unawaited coroutine warning in 
test_coroutines.CoroutineTest.test_17

files:
M Lib/test/test_coroutines.py

diff --git a/Lib/test/test_coroutines.py b/Lib/test/test_coroutines.py
index d78eaaca2796a6..deeaa724e79544 100644
--- a/Lib/test/test_coroutines.py
+++ b/Lib/test/test_coroutines.py
@@ -1199,8 +1199,8 @@ async def __anext__(self):
             def __aiter__(self):
                 return self
 
-        anext_awaitable = anext(A(), "a").__await__()
-        self.assertRaises(TypeError, anext_awaitable.close, 1)
+        with contextlib.closing(anext(A(), "a").__await__()) as 
anext_awaitable:
+            self.assertRaises(TypeError, anext_awaitable.close, 1)
 
     def test_with_1(self):
         class Manager:

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: arch...@mail-archive.com

Reply via email to