File tree 1 file changed +18
-0
lines changed
1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -167,6 +167,24 @@ async def recurse():
167
167
async for _ in agen : # pragma: no branch
168
168
pass # pragma: no cover
169
169
170
+ # https://bugs.python.org/issue32526
171
+ @pytest .mark .asyncio
172
+ async def test_reentrance_forbidden_while_suspended_in_coroutine_runner ():
173
+ @async_generator
174
+ async def f ():
175
+ await asyncio .sleep (1 )
176
+ await yield_ ()
177
+
178
+ ag = f ()
179
+ asend_coro = ag .asend (None )
180
+ fut = asend_coro .send (None )
181
+ # Now the async generator's frame is not executing, but a call to asend()
182
+ # *is* executing. Make sure that in this case, ag_running is True, and we
183
+ # can't start up another call to asend().
184
+ assert ag .ag_running
185
+ with pytest .raises (ValueError ):
186
+ await ag .asend (None )
187
+
170
188
################################################################
171
189
#
172
190
# asend
You can’t perform that action at this time.
0 commit comments