diff --git a/rpyc/core/netref.py b/rpyc/core/netref.py index 4e47a191..df22af67 100644 --- a/rpyc/core/netref.py +++ b/rpyc/core/netref.py @@ -148,6 +148,11 @@ def __getattribute__(self, name): return self.__dir__() elif name in _deleted_netref_attrs: raise AttributeError() + elif name == "__array__": # Speedup array copy if the remote is an array + if hasattr(self, '__array__'): + return object.__getattribute__(self, "__array__") + else: + raise AttributeError() else: return object.__getattribute__(self, name) elif name == "__call__": # IronPython issue #10 @@ -188,7 +193,8 @@ def __reduce_ex__(self, proto): # This is not strictly necessary, but a performance optimization: # Note that protocol=-1 will only work between python interpreters of the - # same version: + # same version. + # This method should only be called if the remote object implements __array__. def __array__(self): return pickle.loads(syncreq(self, consts.HANDLE_PICKLE, -1))