Skip to content

Commit

Permalink
logging_backend/python: Do not call 'GATTLIB_LOG(GATTLIB_ERROR, ...)'…
Browse files Browse the repository at this point in the history
… on error to avoid recursion
  • Loading branch information
oliviermartin committed Mar 26, 2024
1 parent 6e6436c commit 5d9a36f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions common/logging_backend/python/gattlib_logging.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,14 @@ void gattlib_log(int level, const char *format, ...) {
#else
result = PyEval_CallObject(m_logging_func, arglist);
#endif
Py_DECREF(arglist);

if (result == NULL) {
GATTLIB_LOG(GATTLIB_ERROR, "Python notification handler has raised an exception.");
// We do not call GATTLIB_LOG(GATTLIB_ERROR, "") in case of error to avoid recursion
fprintf(stderr, "Failed to call Python logging function for this logging: %s\n", format);
PyErr_Print();
}

Py_DECREF(arglist);

PyGILState_Release(d_gstate);
}

Expand Down

0 comments on commit 5d9a36f

Please sign in to comment.