Module: kamailio
Branch: 5.4
Commit: d84a89dba261d7a75ec35125174fe6723cf13295
URL:
https://github.com/kamailio/kamailio/commit/d84a89dba261d7a75ec35125174fe67…
Author: Anthony Alba <ascanio.alba7(a)gmail.com>
Committer: Anthony Alba <ascanio.alba7(a)gmail.com>
Date: 2021-11-05T18:17:36+08:00
app_python3: for Python >= 3.7 call pre-fork hook
(cherry picked from commit 138ef5630402448ea2643097a3d25d4dcead6d70)
---
Modified: src/modules/app_python3/app_python3_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/d84a89dba261d7a75ec35125174fe67…
Patch:
https://github.com/kamailio/kamailio/commit/d84a89dba261d7a75ec35125174fe67…
---
diff --git a/src/modules/app_python3/app_python3_mod.c
b/src/modules/app_python3/app_python3_mod.c
index 0ce93b71cd..8ec252039c 100644
--- a/src/modules/app_python3/app_python3_mod.c
+++ b/src/modules/app_python3/app_python3_mod.c
@@ -175,6 +175,17 @@ static int mod_init(void)
static int child_init(int rank)
{
if(rank==PROC_INIT) {
+ /*
+ * this is called before any process is forked
+ * so the Python internal state handler
+ * should be called now.
+ *
+ * TODO: is PyOS_AfterFork_Parent() necesary
+ * in the main process?
+ */
+#if PY_VERSION_HEX >= 0x03070000
+ PyOS_BeforeFork() ;
+#endif
return 0;
}
_apy_process_rank = rank;