Module: kamailio
Branch: master
Commit: 9c746b26bf7ecb4922f445318de7756d21e0d041
URL: 
https://github.com/kamailio/kamailio/commit/9c746b26bf7ecb4922f445318de7756d21e0d041

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

app_python3: fix threads_mode = 1

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

---

Modified: src/modules/app_python3/app_python3_mod.c
Modified: src/modules/app_python3/python_exec.c

---

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

---

diff --git a/src/modules/app_python3/app_python3_mod.c 
b/src/modules/app_python3/app_python3_mod.c
index 7436d528f26..a25a0e354af 100644
--- a/src/modules/app_python3/app_python3_mod.c
+++ b/src/modules/app_python3/app_python3_mod.c
@@ -59,7 +59,7 @@ int _apy_process_rank = 0;
 int _ksr_apy3_threads_mode = 0;
 
 PyThreadState *myThreadState = NULL;
-__thread PyThreadState *_save = NULL;
+PyThreadState *_save = NULL;
 
 /* clang-format off */
 /** module parameters */
diff --git a/src/modules/app_python3/python_exec.c 
b/src/modules/app_python3/python_exec.c
index 3c62265abf6..d4c0f519d1c 100644
--- a/src/modules/app_python3/python_exec.c
+++ b/src/modules/app_python3/python_exec.c
@@ -49,7 +49,7 @@ sr_apy_env_t *sr_apy_env_get()
        return &_sr_apy_env;
 }
 
-extern __thread PyThreadState *_save;
+extern PyThreadState *_save;
 extern int _ksr_apy3_threads_mode;
 
 #define LOCK_RELEASE \

_______________________________________________
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