mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
subprocess now emits a ResourceWarning warning
Issue #26741: subprocess.Popen destructor now emits a ResourceWarning warning if the child process is still running.
This commit is contained in:
parent
a58e2c5c49
commit
5a48e21ff1
5 changed files with 26 additions and 2 deletions
|
@ -2286,7 +2286,9 @@ class POSIXProcessTestCase(BaseTestCase):
|
|||
self.addCleanup(p.stderr.close)
|
||||
ident = id(p)
|
||||
pid = p.pid
|
||||
del p
|
||||
with support.check_warnings(('', ResourceWarning)):
|
||||
p = None
|
||||
|
||||
# check that p is in the active processes list
|
||||
self.assertIn(ident, [id(o) for o in subprocess._active])
|
||||
|
||||
|
@ -2305,7 +2307,9 @@ class POSIXProcessTestCase(BaseTestCase):
|
|||
self.addCleanup(p.stderr.close)
|
||||
ident = id(p)
|
||||
pid = p.pid
|
||||
del p
|
||||
with support.check_warnings(('', ResourceWarning)):
|
||||
p = None
|
||||
|
||||
os.kill(pid, signal.SIGKILL)
|
||||
# check that p is in the active processes list
|
||||
self.assertIn(ident, [id(o) for o in subprocess._active])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue