summaryrefslogtreecommitdiffstats
path: root/Lib/multiprocessing/context.py
diff options
context:
space:
mode:
authorDavin Potts <python@discontinuity.net>2016-09-09 23:03:10 (GMT)
committerDavin Potts <python@discontinuity.net>2016-09-09 23:03:10 (GMT)
commit5458647bb867770fc3d830a618cef6994fdfac4b (patch)
treef16fef69f4ddf36872152328fe302d22e2258763 /Lib/multiprocessing/context.py
parentf1024f74250d534d16a9970e5093b3b4e693b398 (diff)
downloadcpython-5458647bb867770fc3d830a618cef6994fdfac4b.zip
cpython-5458647bb867770fc3d830a618cef6994fdfac4b.tar.gz
cpython-5458647bb867770fc3d830a618cef6994fdfac4b.tar.bz2
Issue #28053: Applying refactorings, docs and other cleanup to follow.
Diffstat (limited to 'Lib/multiprocessing/context.py')
-rw-r--r--Lib/multiprocessing/context.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/Lib/multiprocessing/context.py b/Lib/multiprocessing/context.py
index 63849f9..09455e2 100644
--- a/Lib/multiprocessing/context.py
+++ b/Lib/multiprocessing/context.py
@@ -3,6 +3,7 @@ import sys
import threading
from . import process
+from . import reduction
__all__ = [] # things are copied from here to __init__.py
@@ -198,6 +199,16 @@ class BaseContext(object):
def set_start_method(self, method=None):
raise ValueError('cannot set start method of concrete context')
+ @property
+ def reducer(self):
+ '''Controls how objects will be reduced to a form that can be
+ shared with other processes.'''
+ return globals().get('reduction')
+
+ @reducer.setter
+ def reducer(self, reduction):
+ globals()['reduction'] = reduction
+
def _check_available(self):
pass
@@ -245,7 +256,6 @@ class DefaultContext(BaseContext):
if sys.platform == 'win32':
return ['spawn']
else:
- from . import reduction
if reduction.HAVE_SEND_HANDLE:
return ['fork', 'spawn', 'forkserver']
else:
@@ -292,7 +302,6 @@ if sys.platform != 'win32':
_name = 'forkserver'
Process = ForkServerProcess
def _check_available(self):
- from . import reduction
if not reduction.HAVE_SEND_HANDLE:
raise ValueError('forkserver start method not available')