fgerlits commented on code in PR #2156:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2156#discussion_r3063264875
##########
extensions/python/PythonBindings.h:
##########
@@ -23,20 +23,22 @@
#include "types/Types.h"
-#define PYTHON_METHOD_BEGIN \
+namespace org::apache::nifi::minifi::extensions::python {
+
+PyMODINIT_FUNC
+PyInit_minifi_native(void);
+
+template<auto Fn>
+PyObject* safePyFunction(PyObject* self, PyObject* args) {
try {
-#define PYTHON_METHOD_END \
+ return ((PyCFunction)Fn)(self, args);
} catch (const std::exception& e) { \
PyErr_Format(PyExc_RuntimeError, "C++ binding error: %s", e.what()); \
Review Comment:
nitpicking, and old code, but I think
```suggestion
PyErr_Format(PyExc_RuntimeError, "C++ exception: %s", e.what()); \
```
would be better, since the problem is not with the binding.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]