summaryrefslogtreecommitdiff
path: root/Lib/multiprocessing/dummy/connection.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/multiprocessing/dummy/connection.py')
-rw-r--r--Lib/multiprocessing/dummy/connection.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/multiprocessing/dummy/connection.py b/Lib/multiprocessing/dummy/connection.py
index af105794f1..874ec8e432 100644
--- a/Lib/multiprocessing/dummy/connection.py
+++ b/Lib/multiprocessing/dummy/connection.py
@@ -53,6 +53,12 @@ class Listener(object):
address = property(lambda self: self._backlog_queue)
+ def __enter__(self):
+ return self
+
+ def __exit__(self, exc_type, exc_value, exc_tb):
+ self.close()
+
def Client(address):
_in, _out = Queue(), Queue()
@@ -85,3 +91,9 @@ class Connection(object):
def close(self):
pass
+
+ def __enter__(self):
+ return self
+
+ def __exit__(self, exc_type, exc_value, exc_tb):
+ self.close()