Skip to content

Commit

Permalink
Fix #175.
Browse files Browse the repository at this point in the history
Since the logger of the application is called during, the GIL has to be
acquired.
  • Loading branch information
rkaminsk committed Nov 7, 2019
1 parent 2998860 commit f22f4bc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion libpyclingo/pyclingo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7237,8 +7237,8 @@ void pycall(Reference fun, clingo_symbol_t const *arguments, size_t arguments_si
}

static void logger_callback(clingo_warning_t code, char const *message, void *data) {
PyBlock block;
try {
PyBlock block;
Object pyMsg = cppToPy(message);
Object pyCode = MessageCode::getAttr(code);
Object ret = PyObject_CallFunctionObjArgs(static_cast<PyObject*>(data), pyCode.toPy(), pyMsg.toPy(), nullptr);
Expand Down Expand Up @@ -8771,6 +8771,7 @@ bool g_app_main(clingo_control_t *control, char const *const * files, size_t siz
}

void g_app_logger(clingo_warning_t code, char const *message, void *data) {
PyBlock block;
try {
AppData &pyApp = *static_cast<AppData*>(data);
pyApp.first.call("logger", MessageCode::getAttr(code), cppToPy(message));
Expand Down

0 comments on commit f22f4bc

Please sign in to comment.