Module: kamailio
Branch: master
Commit: 91dc75e65bb2a6643b8b322024416c420caf5d64
URL:
https://github.com/kamailio/kamailio/commit/91dc75e65bb2a6643b8b322024416c4…
Author: Matthias Urlichs <matthias(a)urlichs.de>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2024-12-09T12:13:54+01:00
app_python3: 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_python3/apy_kemi.c
---
Diff:
https://github.com/kamailio/kamailio/commit/91dc75e65bb2a6643b8b322024416c4…
Patch:
https://github.com/kamailio/kamailio/commit/91dc75e65bb2a6643b8b322024416c4…
---
diff --git a/src/modules/app_python3/apy_kemi.c b/src/modules/app_python3/apy_kemi.c
index 213a19e4703..ddc987168b6 100644
--- a/src/modules/app_python3/apy_kemi.c
+++ b/src/modules/app_python3/apy_kemi.c
@@ -281,7 +281,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)) {
@@ -293,7 +293,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;