New submission from Erik Carstensen <mandolae...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue44225>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to