Module: kamailio
Branch: master
Commit: ef73fb876f527c3bde4b425e3ec70d3f613fcb87
URL:
https://github.com/kamailio/kamailio/commit/ef73fb876f527c3bde4b425e3ec70d3…
Author: Matthias Urlichs <matthias(a)urlichs.de>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2024-12-09T12:13:54+01:00
app_python3s: fix exception handling
Python's C interface contract states that C code must *either*
raise an exception and return NULL, *or* return a Python object.
---
Modified: src/modules/app_python3s/apy3s_kemi.c
---
Diff:
https://github.com/kamailio/kamailio/commit/ef73fb876f527c3bde4b425e3ec70d3…
Patch:
https://github.com/kamailio/kamailio/commit/ef73fb876f527c3bde4b425e3ec70d3…
---
diff --git a/src/modules/app_python3s/apy3s_kemi.c
b/src/modules/app_python3s/apy3s_kemi.c
index f28354909b7..dd23bd0f2d7 100644
--- a/src/modules/app_python3s/apy3s_kemi.c
+++ b/src/modules/app_python3s/apy3s_kemi.c
@@ -409,7 +409,7 @@ PyObject *sr_apy_kemi_exec_func_ex(
if(pobj == NULL) {
LM_ERR("null parameter - func: %.*s idx: %d argc: %d\n", fname.len,
fname.s, i, (int)alen);
- return sr_kemi_apy_return_false();
+ return NULL;
}
if(ket->ptypes[i] == SR_KEMIP_STR) {
if(!PyUnicode_Check(pobj)) {
@@ -421,7 +421,7 @@ PyObject *sr_apy_kemi_exec_func_ex(
if(vps[i].v.s.s == NULL) {
LM_ERR("null-string parameter - func: %.*s idx: %d argc: %d\n",
fname.len, fname.s, i, (int)alen);
- return sr_kemi_apy_return_false();
+ return NULL;
}
vps[i].v.s.len = (int)slen;
vps[i].vtype = SR_KEMIP_STR;