Module: kamailio
Branch: 6.0
Commit: 9e8e6efc812795498d6d540c9f4afcae30965e35
URL: 
https://github.com/kamailio/kamailio/commit/9e8e6efc812795498d6d540c9f4afcae30965e35

Author: S-P Chan <shihping.c...@gmail.com>
Committer: S-P Chan <shihping.c...@gmail.com>
Date: 2025-04-22T07:58:18+08:00

app_python3s: fix threads_mode = 1

- fixes gh #4153
- commit 62b4ee4: incorrect use of thread-local storage
    to save python thread state

(cherry picked from commit 779cb229ba9a693ac241f4b359c596c0ed46bb7b)

---

Modified: src/modules/app_python3s/app_python3s_mod.c
Modified: src/modules/app_python3s/apy3s_kemi.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/9e8e6efc812795498d6d540c9f4afcae30965e35.diff
Patch: 
https://github.com/kamailio/kamailio/commit/9e8e6efc812795498d6d540c9f4afcae30965e35.patch

---

diff --git a/src/modules/app_python3s/app_python3s_mod.c 
b/src/modules/app_python3s/app_python3s_mod.c
index a99154366ad..876bd3c2a20 100644
--- a/src/modules/app_python3s/app_python3s_mod.c
+++ b/src/modules/app_python3s/app_python3s_mod.c
@@ -60,7 +60,7 @@ int _apy3s_process_rank = 0;
 int _ksr_apy3s_threads_mode = 0;
 
 PyThreadState *myThreadState = NULL;
-__thread PyThreadState *_save = NULL;
+PyThreadState *_save = NULL;
 
 static int apy3s_script_init_exec(PyObject *pModule, str *fname, int *vparam);
 
diff --git a/src/modules/app_python3s/apy3s_kemi.c 
b/src/modules/app_python3s/apy3s_kemi.c
index c25ccfdc91a..48ee1c46b67 100644
--- a/src/modules/app_python3s/apy3s_kemi.c
+++ b/src/modules/app_python3s/apy3s_kemi.c
@@ -52,7 +52,7 @@ extern str _sr_python_load_file;
 extern int _apy3s_process_rank;
 extern int _ksr_apy3s_threads_mode;
 
-extern __thread PyThreadState *_save;
+extern PyThreadState *_save;
 
 int apy_reload_script(void);
 
@@ -69,8 +69,6 @@ sr_apy_env_t *sr_apy_env_get()
 /**
  *
  */
-extern __thread PyThreadState *_save;
-
 int apy3s_exec_func(sip_msg_t *_msg, char *fname, char *fparam, int emode)
 {
        PyObject *pFunc, *pArgs, *pValue;

_______________________________________________
Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to