Skip to content

Commit f8d48fd

Browse files
committed
Catch exceptions in Demo 33
1 parent 7452bf1 commit f8d48fd

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Demos/Demo33/SortThds.pas

+4-2
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,17 @@ procedure TSortThread.ExecuteWithPython;
127127
if Assigned(FModule) and (ThreadExecMode <> emNewState) then
128128
FModule.InitializeForNewInterpreter;
129129
if Assigned(fScript) then
130+
try
130131
ExecStrings(fScript);
132+
except
133+
end;
131134
pyfunc := FindFunction(ExecModule, utf8encode(fpyfuncname));
132135
if Assigned(pyfunc) then
133136
try
134137
EvalFunction(pyfunc,[NativeInt(self),0,FSize]);
135138
except
136139
end;
137-
138-
Py_DecRef(pyfunc);
140+
Py_XDecRef(pyfunc);
139141
end;
140142
finally
141143
running := false;

0 commit comments

Comments
 (0)