diff CodeAnalysis/FunctionBody.mustache @ 172:8382c7dea471 java-code-model

created CodeAnalysis/GenerateOrthancSDK.py
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 27 Jun 2024 17:47:05 +0200
parents e7ff5efb100d
children f49864df6f1f
line wrap: on
line diff
--- a/CodeAnalysis/FunctionBody.mustache	Thu Jun 27 15:52:51 2024 +0200
+++ b/CodeAnalysis/FunctionBody.mustache	Thu Jun 27 17:47:05 2024 +0200
@@ -9,6 +9,13 @@
     return NULL;
   }
 {{/has_args}}
+{{#args}}{{#check_object_type}}
+  if ({{name}} != Py_None && Py_TYPE({{name}}) != Get{{check_object_type}}Type())
+  {
+    PyErr_SetString(PyExc_TypeError, "Invalid orthanc.{{check_object_type}} object");
+    return NULL;
+  }
+{{/check_object_type}}{{/args}}
 {{#return_long}}
   long value = {{c_function}}(OrthancPlugins::GetGlobalContext(){{self}}{{call_args}});
   {{#args}}{{release}}{{/args}}