Module: kamailio Branch: master Commit: 6cae3661419d8d79fc8fb0463f6787b06911fa9d URL: https://github.com/kamailio/kamailio/commit/6cae3661419d8d79fc8fb0463f6787b0...
Author: Michel Pelletier michel@voip.ms Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2024-08-29T10:21:54+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.
---
Modified: src/modules/app_python3/apy_kemi.c
---
Diff: https://github.com/kamailio/kamailio/commit/6cae3661419d8d79fc8fb0463f6787b0... Patch: https://github.com/kamailio/kamailio/commit/6cae3661419d8d79fc8fb0463f6787b0...
---
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),