Yury Selivanov added the comment:
> To make example more practical, let's change `loop.stop()` to `raise
> KeyboardInterrupt()`. Program stops without calling `close()`
Try to use the new `asyncio.run()` function (in Py 3.7)
--
___
Python tracker
Andriy Maletsky added the comment:
I meant that my example is a complete python script, and after
`loop.run_forever()` the interpreter stops. So I expected every python object
to be destructed on interpreter shutdown, but coro's `close()` is not called.
To make example more practical, let's
Yury Selivanov added the comment:
There's no bug here. `loop.stop()` simply stops the loop, all running tasks are
just paused. You can re-run the same loop, and the `work()` task will resume.
In other words, `loop.stop()` does not trigger task cancellation, therefore it
does not throw in any
New submission from Andriy Maletsky :
Source: https://stackoverflow.com/q/51245011/6275324
Asyncio somehow breaks coroutine finalization. I believe there may be a bug in
C implementation (_asyncio) of tasks or futures. Reproducible within version
3.7.0@python:3.7 docker container.
Consider t