Skip to content

Commit

Permalink
Merge pull request #1323 from cnheitman/fix/fix-python-binding
Browse files Browse the repository at this point in the history
Fix addCallback binding
  • Loading branch information
JonathanSalwan committed May 9, 2024
2 parents 6474d96 + ff2c3a4 commit 0a1f2e5
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions src/libtriton/bindings/python/objects/pyTritonContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -533,12 +533,13 @@ namespace triton {
/* Call the callback */
PyObject* ret = PyObject_CallObject(cb, args);

/* Release args */
Py_DECREF(args);

/* Check the call */
if (ret == nullptr) {
throw triton::exceptions::PyCallbacks();
}

Py_DECREF(args);
/********* End of lambda *********/
}, cb));
break;
Expand All @@ -565,12 +566,13 @@ namespace triton {
/* Call the callback */
PyObject* ret = PyObject_CallObject(cb, args);

/* Release args */
Py_DECREF(args);

/* Check the call */
if (ret == nullptr) {
throw triton::exceptions::PyCallbacks();
}

Py_DECREF(args);
/********* End of lambda *********/
}, cb));
break;
Expand Down Expand Up @@ -599,12 +601,13 @@ namespace triton {
/* Call the callback */
PyObject* ret = PyObject_CallObject(cb, args);

/* Release args */
Py_DECREF(args);

/* Check the call */
if (ret == nullptr) {
throw triton::exceptions::PyCallbacks();
}

Py_DECREF(args);
/********* End of lambda *********/
}, cb));
break;
Expand Down Expand Up @@ -633,12 +636,13 @@ namespace triton {
/* Call the callback */
PyObject* ret = PyObject_CallObject(cb, args);

/* Release args */
Py_DECREF(args);

/* Check the call */
if (ret == nullptr) {
throw triton::exceptions::PyCallbacks();
}

Py_DECREF(args);
/********* End of lambda *********/
}, cb));
break;
Expand All @@ -665,6 +669,9 @@ namespace triton {
/* Call the callback */
PyObject* ret = PyObject_CallObject(cb, args);

/* Release args */
Py_DECREF(args);

/* Check the call */
if (ret == nullptr) {
throw triton::exceptions::PyCallbacks();
Expand All @@ -676,7 +683,6 @@ namespace triton {

/* Update node */
node = PyAstNode_AsAstNode(ret);
Py_DECREF(args);
return node;
/********* End of lambda *********/
}, cb));
Expand Down

0 comments on commit 0a1f2e5

Please sign in to comment.