[pypy-issue] Issue #2609: multiprocessing.queues.SimpleQueue missing close() (pypy/pypy)
Armin Rigo
issues-reply at bitbucket.org
Wed Jul 19 04:49:27 EDT 2017
New issue 2609: multiprocessing.queues.SimpleQueue missing close()
https://bitbucket.org/pypy/pypy/issues/2609/multiprocessingqueuessimplequeue-missing
Armin Rigo:
``multiprocessing.queues.SimpleQueue`` should have a close() method. This is needed to explicitly release the two file descriptors of the Pipe used internally. I think the following would do:
```
#!diff
diff -r 0b72fd1a7641 lib-python/2.7/multiprocessing/queues.py
--- a/lib-python/2.7/multiprocessing/queues.py Sun Jul 16 13:41:28 2017 +0200
+++ b/lib-python/2.7/multiprocessing/queues.py Wed Jul 19 10:45:03 2017 +0200
@@ -358,6 +358,11 @@
self._wlock = Lock()
self._make_methods()
+ def close(self):
+ # PyPy extension: CPython doesn't have this method!
+ self._reader.close()
+ self._writer.close()
+
def empty(self):
return not self._reader.poll()
```
We need to decide if it's ok to add this method when CPython doesn't have it.
More information about the pypy-issue
mailing list