Esempio n. 1
0
 def DupFd(fd):
     '''Return a wrapper for an fd.'''
     popen_obj = context.get_spawning_popen()
     if popen_obj is not None:
         return popen_obj.DupFd(popen_obj.duplicate_for_child(fd))
     elif HAVE_SEND_HANDLE:
         from . import resource_sharer
         return resource_sharer.DupFd(fd)
     else:
         raise ValueError('SCM_RIGHTS appears not to be available')
Esempio n. 2
0
    def __reduce__(self):
        kwds = {}
        if get_spawning_popen() is not None:
            kwds['authkey'] = self._authkey

        if getattr(self, '_isauto', False):
            kwds['exposed'] = self._exposed_
            return (RebuildProxy, (AutoProxy, self._token, self._serializer,
                                   kwds))
        else:
            return (RebuildProxy, (type(self), self._token, self._serializer,
                                   kwds))
Esempio n. 3
0
 def assert_spawning(obj):
     if get_spawning_popen() is None:
         raise RuntimeError(
             '%s objects should only be shared between processes'
             ' through inheritance' % type(obj).__name__)
Esempio n. 4
0
 def duplicate_for_child(self, handle):
     assert self is get_spawning_popen()
     return duplicate(handle, self.sentinel)
Esempio n. 5
0
 def assert_spawning(obj):
     if get_spawning_popen() is None:
         raise RuntimeError(
             '%s objects should only be shared between processes'
             ' through inheritance' % type(obj).__name__
         )