diff --git a/rpyc/core/netref.py b/rpyc/core/netref.py index a5e13c38..39fb905d 100644 --- a/rpyc/core/netref.py +++ b/rpyc/core/netref.py @@ -231,7 +231,7 @@ def __instancecheck__(self, other): else: return syncreq(self, consts.HANDLE_INSTANCECHECK, other.____id_pack__) else: - return isinstance(other, self) + return isinstance(other, self.__class__) def _make_method(name, doc): @@ -295,7 +295,7 @@ def class_factory(id_pack, methods): else: _module = sys.modules.get(name_pack) if _module: - if id_pack[0] != 0: + if id_pack[2] == 0: ns["__class__"] = _module else: ns["__class__"] = getattr(_module, "__class__", None) diff --git a/tests/test_custom_service.py b/tests/test_custom_service.py index 847a026d..a2277a48 100644 --- a/tests/test_custom_service.py +++ b/tests/test_custom_service.py @@ -43,6 +43,9 @@ def foobar(self): def exposed_getmeta(self): return MyClass() + def exposed_instance(self, inst, cls): + return isinstance(inst, cls) + class TestCustomService(unittest.TestCase): config = {} @@ -84,6 +87,10 @@ def test_metaclasses(self): x = self.conn.root.getmeta() print(x) + def test_instancecheck_list(self): + remote_list = self.conn.root.getlist() + self.assertTrue(self.conn.root.instance(remote_list, list)) + if __name__ == "__main__": unittest.main()