[sr-dev] git:master:138ef563: app_python3: for Python >= 3.7 call pre-fork hook
Anthony Alba
ascanio.alba7 at gmail.com
Fri Nov 5 11:10:59 CET 2021
Module: kamailio
Branch: master
Commit: 138ef5630402448ea2643097a3d25d4dcead6d70
URL: https://github.com/kamailio/kamailio/commit/138ef5630402448ea2643097a3d25d4dcead6d70
Author: Anthony Alba <ascanio.alba7 at gmail.com>
Committer: Anthony Alba <ascanio.alba7 at gmail.com>
Date: 2021-11-05T17:31:34+08:00
app_python3: for Python >= 3.7 call pre-fork hook
---
Modified: src/modules/app_python3/app_python3_mod.c
---
Diff: https://github.com/kamailio/kamailio/commit/138ef5630402448ea2643097a3d25d4dcead6d70.diff
Patch: https://github.com/kamailio/kamailio/commit/138ef5630402448ea2643097a3d25d4dcead6d70.patch
---
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;
More information about the sr-dev
mailing list