Module: kamailio
Branch: 5.8
Commit: 9e0f6acc23313f5b25300660b6a4b75aab5bd168
URL:
https://github.com/kamailio/kamailio/commit/9e0f6acc23313f5b25300660b6a4b75…
Author: Michel Pelletier <michel(a)voip.ms>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2024-09-02T09:37:27+02:00
app_python3: Fixes Kemi TypeError thrown when latency_limit_action is exceeded.
Replace PyBytes_AsString(..) calls with calls to PyUnicode_AsUTF8(..) in the
PY_VERSION_HEX >= 0x030B0000 block of apy_kemi.c.
The PyBytes_AsString expects a Bytes value but receives a Unicode value instead, thus
causing the TypeError exception.
(cherry picked from commit 6cae3661419d8d79fc8fb0463f6787b06911fa9d)
---
Modified: src/modules/app_python3/apy_kemi.c
---
Diff:
https://github.com/kamailio/kamailio/commit/9e0f6acc23313f5b25300660b6a4b75…
Patch:
https://github.com/kamailio/kamailio/commit/9e0f6acc23313f5b25300660b6a4b75…
---
diff --git a/src/modules/app_python3/apy_kemi.c b/src/modules/app_python3/apy_kemi.c
index 718d8ecedaf..0c1ab535809 100644
--- a/src/modules/app_python3/apy_kemi.c
+++ b/src/modules/app_python3/apy_kemi.c
@@ -379,8 +379,8 @@ PyObject *sr_apy_kemi_exec_func(PyObject *self, PyObject *args, int
idx)
" took too long [%u ms] (file:%s func:%s line:%d)\n",
(ket->mname.len > 0) ? ket->mname.s : "",
(ket->mname.len > 0) ? "." : "", ket->fname.s, tdiff,
- (pcode) ? PyBytes_AsString(pcode->co_filename) : "",
- (pcode) ? PyBytes_AsString(pcode->co_name) : "",
+ (pcode) ? PyUnicode_AsUTF8(pcode->co_filename) : "",
+ (pcode) ? PyUnicode_AsUTF8(pcode->co_name) : "",
(pframe) ? PyFrame_GetLineNumber(pframe) : 0);
#else
LOG(cfg_get(core, core_cfg, latency_log),