[New-bugs-announce] [issue44225] stop() on a stopped loop inhibits the next run_forever

Erik Carstensen report at bugs.python.org
Mon May 24 09:55:00 EDT 2021


New submission from Erik Carstensen <mandolaerik at gmail.com>:

If you call stop() on an already stopped event loop, then the next call to run_forever will terminate after one loop iteration. I would expect the stop to either be a nop, or to be invalid in this state (and raise an exception).

Example:

import asyncio
async def coro(x):
    print(x)
    if x < 10:
        asyncio.create_task(coro(x+1))
loop = asyncio.get_event_loop()
loop.create_task(coro(0))
loop.stop()
loop.run_forever()

----------
components: asyncio
messages: 394250
nosy: asvetlov, mandolaerik, yselivanov
priority: normal
severity: normal
status: open
title: stop() on a stopped loop inhibits the next run_forever
type: behavior
versions: Python 3.10, Python 3.11, Python 3.7, Python 3.8, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44225>
_______________________________________


More information about the New-bugs-announce mailing list