New submission from Ronal Abraham <ronalabra...@gmail.com>:

There doesn't appear to be a way to prematurely kill a subprocess using the 
high-level asyncio subprocess APIs 
(https://docs.python.org/3.9/library/asyncio-subprocess.html) without getting a 
traceback on exit.

On exit, the attached program writes the following to stderr:

$ python3.9 kill_subprocess.py

Exception ignored in: <function BaseSubprocessTransport.__del__ at 0x1065f0dc0>
Traceback (most recent call last):
    ...
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed

If I uncomment `# process._transport.close()` or comment `asyncio.sleep(1)`, 
the walkback disappears. (I get the same behavior in python 3.8. I haven't 
tried other python versions.)

----------
components: asyncio
files: kill_subprocess.py
messages: 391349
nosy: asvetlov, rabraham, yselivanov
priority: normal
severity: normal
status: open
title: Cannot cleanly kill a subprocess using high-level asyncio APIs
type: behavior
versions: Python 3.8, Python 3.9
Added file: https://bugs.python.org/file49965/kill_subprocess.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue43884>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to