From 9ad2a76f1d8af4ece4e27f147d9ff9ae2771a2f2 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Fri, 6 Feb 2026 11:43:34 +0100 Subject: [PATCH] #13571 Python: Fix issubclass check for PDM method return types - Use issubclass() instead of exact class name matching - Instantiate using child class to preserve subclass type - Enables polymorphic return types in Python API Fixes #13571. --- GrpcInterface/Python/rips/pdmobject.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/GrpcInterface/Python/rips/pdmobject.py b/GrpcInterface/Python/rips/pdmobject.py index 1708a6cd49..cae24397e5 100644 --- a/GrpcInterface/Python/rips/pdmobject.py +++ b/GrpcInterface/Python/rips/pdmobject.py @@ -523,8 +523,10 @@ class PdmObjectBase: if child_class_definition is None: return None - assert class_definition.__name__ == child_class_definition.__name__ - pdm_object = class_definition(pb2_object=pb2_object, channel=self.channel()) + assert issubclass(child_class_definition, class_definition) + pdm_object = child_class_definition( + pb2_object=pb2_object, channel=self.channel() + ) return pdm_object except grpc.RpcError as exc: