Fix bpo-30596: Add close() method to multiprocessing.Process (#2010)

* Fix bpo-30596: Add close() method to multiprocessing.Process

* Raise ValueError if close() is called before the Process is finished running

* Add docs

* Add NEWS blurb
This commit is contained in:
Antoine Pitrou 2017-06-24 19:22:23 +02:00 committed by GitHub
parent 0ee32c1481
commit 13e96cc596
9 changed files with 106 additions and 8 deletions

View file

@ -62,7 +62,7 @@ class Popen(popen_fork.Popen):
f.write(fp.getbuffer())
finally:
if parent_r is not None:
util.Finalize(self, os.close, (parent_r,))
self.finalizer = util.Finalize(self, os.close, (parent_r,))
for fd in (child_r, child_w, parent_w):
if fd is not None:
os.close(fd)