Skip to content

Commit 4969994

Browse files
committed
Small optimization with name parameters.
1 parent 2017fb9 commit 4969994

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Source/VarPyth.pas

+3-3
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ implementation
130130
type
131131
TNamedParamDesc = record
132132
Index : Integer;
133-
Name : AnsiString;
133+
Name : PAnsiChar;
134134
end;
135135
TNamedParamArray = array of TNamedParamDesc;
136136

@@ -1278,7 +1278,7 @@ procedure TPythonVariantType.DispInvoke(Dest: PVarData;
12781278
for I := 0 to CallDesc^.NamedArgCount - 1 do begin
12791279
LNamePtr := LNamePtr + Succ(Length(LNamePtr));
12801280
fNamedParams[I].Index := I+LNamedArgStart;
1281-
fNamedParams[I].Name := AnsiString(LNamePtr);
1281+
fNamedParams[I].Name := LNamePtr;
12821282
end;
12831283
end;
12841284

@@ -1596,7 +1596,7 @@ function TPythonVariantType.EvalPython(const V: TVarData;
15961596
for i := 0 to _ArgLen-1 do
15971597
PyTuple_SetItem( _Args, i, ArgAsPythonObject(i) );
15981598
for i := 0 to Length(fNamedParams)-1 do
1599-
PyDict_SetItemString(_KW, PAnsiChar(fNamedParams[i].Name), ArgAsPythonObject(fNamedParams[i].Index));
1599+
PyDict_SetItemString(_KW, fNamedParams[i].Name, ArgAsPythonObject(fNamedParams[i].Index));
16001600

16011601
// call the func or method, with or without named parameters (KW)
16021602
if Assigned(_KW) then

0 commit comments

Comments
 (0)