From 6d731cad16d2884ad8db177806194c1b4bc6b535 Mon Sep 17 00:00:00 2001 From: mce2 Date: Thu, 9 Apr 2020 22:39:51 +0300 Subject: [PATCH] VarPyth fix for named parameters in multithreaded environment issue #125 Supposed fix to Named parameters in VarPyth not cleared between function calls #125 issue. The patch is very inelegant, but I cannot see any side effects. As I understand, all data from named parameters is copied to a python object prior to do the actual function call, so truncation of fNamedParams should be OK at any moment. --- PythonForDelphi/Components/Sources/Core/VarPyth.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PythonForDelphi/Components/Sources/Core/VarPyth.pas b/PythonForDelphi/Components/Sources/Core/VarPyth.pas index 10502567..53b1dbae 100644 --- a/PythonForDelphi/Components/Sources/Core/VarPyth.pas +++ b/PythonForDelphi/Components/Sources/Core/VarPyth.pas @@ -1088,7 +1088,7 @@ procedure TPythonVariantType.DispInvoke(Dest: PVarData; Var NewCallDesc : TCallDesc; begin - if CallDesc^.NamedArgCount > 0 then GetNamedParams; + GetNamedParams; try if (CallDesc^.CallType = CPropertyGet) and (CallDesc^.ArgCount = 1) then begin NewCallDesc := CallDesc^; @@ -1105,7 +1105,7 @@ procedure TPythonVariantType.DispInvoke(Dest: PVarData; inherited; {$ENDIF PATCHEDSYSTEMDISPINVOKE} finally - if CallDesc^.NamedArgCount > 0 then SetLength(fNamedParams, 0); + SetLength(fNamedParams, 0); end; end;