mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-26 23:20:29 -05:00
#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.
This commit is contained in:
1 parent
ed995d1891
commit
9ad2a76f1d
1 file changed
+4
-2
@@ -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:
|
||||
|
||||
Reference in new issue
Block a user