mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #28053: Applying refactorings, docs and other cleanup to follow.
This commit is contained in:
parent
f1024f7425
commit
5458647bb8
13 changed files with 77 additions and 40 deletions
|
@ -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')
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue