1# cython: language_level=3 2# mode: run 3# tag: pep492, pure3.5 4 5 6async def test_coroutine_frame(awaitable): 7 """ 8 >>> class Awaitable(object): 9 ... def __await__(self): 10 ... return iter([2]) 11 12 >>> coro = test_coroutine_frame(Awaitable()) 13 >>> import types 14 >>> isinstance(coro.cr_frame, types.FrameType) or coro.cr_frame 15 True 16 >>> coro.cr_frame is coro.cr_frame # assert that it's cached 17 True 18 >>> coro.cr_frame.f_code is not None 19 True 20 >>> code_obj = coro.cr_frame.f_code 21 >>> code_obj.co_argcount 22 1 23 >>> code_obj.co_varnames 24 ('awaitable', 'b') 25 26 >>> next(coro.__await__()) # avoid "not awaited" warning 27 2 28 """ 29 b = await awaitable 30 return b 31