Message247746
An exception can be raised in SubprocessTransport.__init__() from SubprocessTransport._start() - for instance because an exception is raised in the preexec_fn callback.
In this case, the calling function never gets a reference to the transport object, and cannot close the transport. Hence, when the object is deleted, an "unclosed transport" ResourceWarning is always triggered.
Here is a test case showing this behavior:
import asyncio
loop = asyncio.get_event_loop()
try:
loop.run_until_complete(asyncio.create_subprocess_exec('/doesntexist'))
except FileNotFoundError:
pass
finally:
loop.close()
I propose the attached patch as a solution, which call SubprocessTransport.close() when an exception is raised in SubprocessTransport._start() in the constructor. |
|
Date |
User |
Action |
Args |
2015-07-31 14:57:06 | martius | set | recipients:
+ martius, gvanrossum, vstinner, yselivanov |
2015-07-31 14:57:06 | martius | set | messageid: <1438354626.92.0.802065077035.issue24763@psf.upfronthosting.co.za> |
2015-07-31 14:57:06 | martius | link | issue24763 messages |
2015-07-31 14:57:06 | martius | create | |
|