Skip to content

Commit fdf70a6

Browse files
Speicherlecks
1 parent 972cf48 commit fdf70a6

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

Source/PythonEngine.pas

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4313,10 +4313,14 @@ procedure TPythonEngine.Finalize;
43134313
begin
43144314
RedirectIO := False;
43154315
// restore the initial streams also.
4316-
ExecString('import sys'+LF+
4317-
'if hasattr(sys, "old_stdin"): sys.stdin=sys.old_stdin'+LF+
4318-
'if hasattr(sys, "old_stdout"): sys.stdout=sys.old_stdout'+LF+
4319-
'if hasattr(sys, "old_stderr"): sys.stderr=sys.old_stderr' );
4316+
try
4317+
ExecString('import sys'+LF+
4318+
'if hasattr(sys, "old_stdin"): sys.stdin=sys.old_stdin'+LF+
4319+
'if hasattr(sys, "old_stdout"): sys.stdout=sys.old_stdout'+LF+
4320+
'if hasattr(sys, "old_stderr"): sys.stderr=sys.old_stderr' );
4321+
except
4322+
// Exception if a script error occurred previously. e.g. in CheckExecSyntax with incorrect syntax.
4323+
end;
43204324
end;
43214325
// First finalize our clients
43224326
if Initialized then

0 commit comments

Comments
 (0)