mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
Merged revisions 70912,70944,70968,71033,71041,71208,71263,71286,71395-71396,71405-71406,71485,71492,71494 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r70912 | georg.brandl | 2009-03-31 17:35:46 -0500 (Tue, 31 Mar 2009) | 1 line #5617: add a handy function to print a unicode string to gdbinit. ........ r70944 | georg.brandl | 2009-03-31 23:32:39 -0500 (Tue, 31 Mar 2009) | 1 line #5631: add upload to list of possible commands, which is presented in --help-commands. ........ r70968 | michael.foord | 2009-04-01 13:25:38 -0500 (Wed, 01 Apr 2009) | 1 line Adding Wing project file ........ r71033 | brett.cannon | 2009-04-01 22:34:53 -0500 (Wed, 01 Apr 2009) | 3 lines Fix two issues introduced by issue #71031 by changing the signature of PyImport_AppendInittab() to take a const char *. ........ r71041 | jesse.noller | 2009-04-02 00:17:26 -0500 (Thu, 02 Apr 2009) | 1 line Add custom initializer argument to multiprocess.Manager*, courtesy of lekma ........ r71208 | michael.foord | 2009-04-04 20:15:01 -0500 (Sat, 04 Apr 2009) | 4 lines Change the way unittest.TestSuite use their tests to always access them through iteration. Non behavior changing, this allows you to create custom subclasses that override __iter__. Issue #5693 ........ r71263 | michael.foord | 2009-04-05 14:19:28 -0500 (Sun, 05 Apr 2009) | 4 lines Adding assertIs and assertIsNot methods to unittest.TestCase Issue #2578 ........ r71286 | tarek.ziade | 2009-04-05 17:04:38 -0500 (Sun, 05 Apr 2009) | 1 line added a simplest test to distutils.spawn._nt_quote_args ........ r71395 | benjamin.peterson | 2009-04-08 08:27:29 -0500 (Wed, 08 Apr 2009) | 1 line these must be installed to correctly run tests ........ r71396 | benjamin.peterson | 2009-04-08 08:29:41 -0500 (Wed, 08 Apr 2009) | 1 line fix syntax ........ r71405 | andrew.kuchling | 2009-04-09 06:22:47 -0500 (Thu, 09 Apr 2009) | 1 line Add items ........ r71406 | andrew.kuchling | 2009-04-09 06:23:36 -0500 (Thu, 09 Apr 2009) | 1 line Typo fixes ........ r71485 | andrew.kuchling | 2009-04-11 11:12:23 -0500 (Sat, 11 Apr 2009) | 1 line Add various items ........ r71492 | georg.brandl | 2009-04-11 13:19:27 -0500 (Sat, 11 Apr 2009) | 1 line Take credit for a patch of mine. ........ r71494 | benjamin.peterson | 2009-04-11 14:31:00 -0500 (Sat, 11 Apr 2009) | 1 line ignore py3_test_grammar when compiling the library ........
This commit is contained in:
parent
a0a7faab91
commit
f47ed4a014
15 changed files with 320 additions and 34 deletions
|
|
@ -478,12 +478,15 @@ class BaseManager(object):
|
|||
dispatch(conn, None, 'dummy')
|
||||
self._state.value = State.STARTED
|
||||
|
||||
def start(self):
|
||||
def start(self, initializer=None, initargs=()):
|
||||
'''
|
||||
Spawn a server process for this manager object
|
||||
'''
|
||||
assert self._state.value == State.INITIAL
|
||||
|
||||
if initializer is not None and not hasattr(initializer, '__call__'):
|
||||
raise TypeError('initializer must be a callable')
|
||||
|
||||
# pipe over which we will retrieve address of server
|
||||
reader, writer = connection.Pipe(duplex=False)
|
||||
|
||||
|
|
@ -491,7 +494,7 @@ class BaseManager(object):
|
|||
self._process = Process(
|
||||
target=type(self)._run_server,
|
||||
args=(self._registry, self._address, self._authkey,
|
||||
self._serializer, writer),
|
||||
self._serializer, writer, initializer, initargs),
|
||||
)
|
||||
ident = ':'.join(str(i) for i in self._process._identity)
|
||||
self._process.name = type(self).__name__ + '-' + ident
|
||||
|
|
@ -512,10 +515,14 @@ class BaseManager(object):
|
|||
)
|
||||
|
||||
@classmethod
|
||||
def _run_server(cls, registry, address, authkey, serializer, writer):
|
||||
def _run_server(cls, registry, address, authkey, serializer, writer,
|
||||
initializer=None, initargs=()):
|
||||
'''
|
||||
Create a server, report its address and run it
|
||||
'''
|
||||
if initializer is not None:
|
||||
initializer(*initargs)
|
||||
|
||||
# create server
|
||||
server = cls._Server(registry, address, authkey, serializer)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue