aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_coroutines.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_coroutines.py')
-rw-r--r--Lib/test/test_coroutines.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/Lib/test/test_coroutines.py b/Lib/test/test_coroutines.py
index e79896a9b8e..670852d20c0 100644
--- a/Lib/test/test_coroutines.py
+++ b/Lib/test/test_coroutines.py
@@ -995,6 +995,26 @@ class SysSetCoroWrapperTest(unittest.TestCase):
sys.set_coroutine_wrapper(1)
self.assertIsNone(sys.get_coroutine_wrapper())
+ def test_set_wrapper_3(self):
+ async def foo():
+ return 'spam'
+
+ def wrapper(coro):
+ async def wrap(coro):
+ return await coro
+ return wrap(coro)
+
+ sys.set_coroutine_wrapper(wrapper)
+ try:
+ with self.assertRaisesRegex(
+ RuntimeError,
+ "coroutine wrapper.*\.wrapper at 0x.*attempted to "
+ "recursively wrap <coroutine.*\.wrap"):
+
+ foo()
+ finally:
+ sys.set_coroutine_wrapper(None)
+
class CAPITest(unittest.TestCase):