diff options
Diffstat (limited to 'Lib/multiprocessing/managers.py')
-rw-r--r-- | Lib/multiprocessing/managers.py | 44 |
1 files changed, 3 insertions, 41 deletions
diff --git a/Lib/multiprocessing/managers.py b/Lib/multiprocessing/managers.py index 7e1818bb09..75b5150f82 100644 --- a/Lib/multiprocessing/managers.py +++ b/Lib/multiprocessing/managers.py @@ -360,36 +360,10 @@ class Server(object): finally: self.stop_event.set() - def create(*args, **kwds): + def create(self, c, typeid, /, *args, **kwds): ''' Create a new shared object and return its id ''' - if len(args) >= 3: - self, c, typeid, *args = args - elif not args: - raise TypeError("descriptor 'create' of 'Server' object " - "needs an argument") - else: - if 'typeid' not in kwds: - raise TypeError('create expected at least 2 positional ' - 'arguments, got %d' % (len(args)-1)) - typeid = kwds.pop('typeid') - if len(args) >= 2: - self, c, *args = args - import warnings - warnings.warn("Passing 'typeid' as keyword argument is deprecated", - DeprecationWarning, stacklevel=2) - else: - if 'c' not in kwds: - raise TypeError('create expected at least 2 positional ' - 'arguments, got %d' % (len(args)-1)) - c = kwds.pop('c') - self, *args = args - import warnings - warnings.warn("Passing 'c' as keyword argument is deprecated", - DeprecationWarning, stacklevel=2) - args = tuple(args) - with self.mutex: callable, exposed, method_to_typeid, proxytype = \ self.registry[typeid] @@ -421,7 +395,6 @@ class Server(object): self.incref(c, ident) return ident, tuple(exposed) - create.__text_signature__ = '($self, c, typeid, /, *args, **kwds)' def get_methods(self, c, token): ''' @@ -1293,26 +1266,15 @@ if HAS_SHMEM: _SharedMemoryTracker(f"shmm_{self.address}_{getpid()}") util.debug(f"SharedMemoryServer started by pid {getpid()}") - def create(*args, **kwargs): + def create(self, c, typeid, /, *args, **kwargs): """Create a new distributed-shared object (not backed by a shared memory block) and return its id to be used in a Proxy Object.""" # Unless set up as a shared proxy, don't make shared_memory_context # a standard part of kwargs. This makes things easier for supplying # simple functions. - if len(args) >= 3: - typeod = args[2] - elif 'typeid' in kwargs: - typeid = kwargs['typeid'] - elif not args: - raise TypeError("descriptor 'create' of 'SharedMemoryServer' " - "object needs an argument") - else: - raise TypeError('create expected at least 2 positional ' - 'arguments, got %d' % (len(args)-1)) if hasattr(self.registry[typeid][-1], "_shared_memory_proxy"): kwargs['shared_memory_context'] = self.shared_memory_context - return Server.create(*args, **kwargs) - create.__text_signature__ = '($self, c, typeid, /, *args, **kwargs)' + return Server.create(self, c, typeid, *args, **kwargs) def shutdown(self, c): "Call unlink() on all tracked shared memory, terminate the Server." |