def obtain(proxy): """obtains (copies) a remote object from a proxy object. the object is ``pickled`` on the remote side and ``unpickled`` locally, thus moved **by value**. changes made to the local object will not reflect remotely. :param proxy: an RPyC proxy object .. note:: the remote object to must be ``pickle``-able :returns: a copy of the remote object """ return pickle.loads(pickle.dumps(proxy))
def deliver(conn, localobj): """delivers (recreates) a local object on the other party. the object is ``pickled`` locally and ``unpickled`` on the remote side, thus moved **by value**. changes made to the remote object will not reflect locally. :param conn: the RPyC connection :param localobj: the local object to deliver .. note:: the object must be ``picklable`` :returns: a proxy to the remote object """ return conn.modules["rpyc.lib.compat"].pickle.loads(pickle.dumps(localobj))
def _handle_pickle(self, obj, proto): if not self._config["allow_pickle"]: raise ValueError("pickling is disabled") return bytes(pickle.dumps(obj, proto))
def _handle_pickle(self, oid, proto): if not self._config["allow_pickle"]: raise ValueError("pickling is disabled") return pickle.dumps(self._local_objects[oid], proto)