Ver Fonte

app_python3: for Python >= 3.7 call pre-fork hook

(cherry picked from commit 138ef5630402448ea2643097a3d25d4dcead6d70)
Anthony Alba há 3 anos atrás
pai
commit
d84a89dba2
1 ficheiros alterados com 11 adições e 0 exclusões
  1. 11 0
      src/modules/app_python3/app_python3_mod.c

+ 11 - 0
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;