Skip to content

Commit 7ad6978

Browse files
committed
fix
1 parent ec750a9 commit 7ad6978

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

pyWrapper.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,8 @@ int PyWrapper::wrapperOnceExecAsync(const char *usrTag, std::map <std::string, s
350350
if (cb != nullptr) {
351351
SetSidCallBack(cb, sid);
352352
}
353+
py::gil_scoped_acquire acquire;
354+
353355
int ret = 0;
354356
SetSidUsrTag(sid, usrTag);
355357
params["sid"] = sid;
@@ -635,10 +637,12 @@ int callBack(Response *resp, std::string sid) {
635637

636638
pDataList headPtr;
637639
pDataList curPtr;
640+
int ret ;
638641
// 先判断python有没有抛出错误. response中的 errorCode
639642
if (resp->errCode != 0) {
640643
spdlog::get("stderr_console")->error("find error from python: {}", resp->errCode);
641-
return resp->errCode;
644+
ret = cb_(usrTag, NULL,resp->errCode);
645+
return ret;
642646
}
643647
char *ptr;
644648
int dataSize = resp->list.size();

wrapper.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,7 @@ WrapperAPI wrapperCreate(const char *usrTag, pParamList params, wrapperCallback
221221
std::string handle = pyWrapper->wrapperCreate(usrTag, pyParams, cb, errNum, sid, psrId);
222222
char *handlePtr = strdup(handle.c_str());
223223
if (*errNum != 0) {
224-
spdlog::debug("wrapper exec Error, errNum:{}, sid:{}", *errNum, sid);
225-
224+
spdlog::debug("wrapper create Error, errNum:{}, sid:{}", *errNum, sid);
226225
return NULL;
227226
}
228227
SetHandleSid(handlePtr, sid);

0 commit comments

Comments
 (0)