[sr-dev] git:5.5:2b10b505: app_python3: for Python >= 3.7 call pre-fork hook
Anthony Alba
ascanio.alba7 at gmail.com
Fri Nov 5 11:15:03 CET 2021
Module: kamailio
Branch: 5.5
Commit: 2b10b50518950246ad3a224b13e9817b00877a90
URL: https://github.com/kamailio/kamailio/commit/2b10b50518950246ad3a224b13e9817b00877a90
Author: Anthony Alba <ascanio.alba7 at gmail.com>
Committer: Anthony Alba <ascanio.alba7 at gmail.com>
Date: 2021-11-05T18:13: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/2b10b50518950246ad3a224b13e9817b00877a90.diff
Patch: https://github.com/kamailio/kamailio/commit/2b10b50518950246ad3a224b13e9817b00877a90.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