File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -9664,11 +9664,18 @@ procedure TPythonThread.Execute;
96649664 ((FMajorVersion = 3 ) and (FMinorVersion < 12 )) or
96659665 PyStatus_Exception(Py_NewInterpreterFromConfig(@fThreadState, @Config))
96669666 then
9667- fThreadState := Py_NewInterpreter;
9667+ fThreadState := Py_NewInterpreter
9668+ else
9669+ // flag IOPythonModule as per interpreter GIL compatible
9670+ TPythonModule(IOPythonModule).MultInterpretersSupport := mmiPerInterpreterGIL;
96689671
9669- if Assigned( fThreadState) then
9672+ if Assigned(fThreadState) then
96709673 begin
96719674 PyThreadState_Swap(fThreadState);
9675+ // Redirect IO
9676+ TPythonModule(IOPythonModule).InitializeForNewInterpreter;
9677+ DoRedirectIO;
9678+ // Execute the python code
96729679 ExecuteWithPython;
96739680 Py_EndInterpreter( fThreadState);
96749681 PyThreadState_Swap(global_state);
You can’t perform that action at this time.
0 commit comments