New submission from Hrvoje Nikšić <[email protected]>:
It seems impossible to correctly close() an asyncio Process on which terminate
has been invoked. Take the following coroutine:
async def test():
proc = await asyncio.create_subprocess_shell(
"sleep 1", stdout=asyncio.subprocess.PIPE)
proc.terminate()
await proc.wait()
After running it with asyncio.run(), Python prints a warning about "Event loop
is closed" exception ignored in BaseSubprocessTransport.__del__. The code does
wait for the process to exit, and neither proc nor proc.stdout have a close()
method, so the warning seems spurious.
Commenting out proc.terminate() makes the program finish without an exception
(but then it waits for a full second, of course).
Runnable example attached.
----------
components: asyncio
files: terminate.py
messages: 332165
nosy: asvetlov, hniksic, yselivanov
priority: normal
severity: normal
status: open
title: Cannot properly close terminated process
versions: Python 3.7
Added file: https://bugs.python.org/file48008/terminate.py
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue35539>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com