Skip to content

Commit e246c04

Browse files
authored
Merge pull request pyscripter#299 from csmspl/feature/const2
const is faster part 2
2 parents e0c3209 + 7bd9bb0 commit e246c04

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

Source/PythonEngine.pas

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1828,7 +1828,7 @@ TPythonEngine = class(TPythonInterface)
18281828
function EvalStrings( strings : TStrings; locals, globals : PPyObject ) : PPyObject; overload;
18291829
function EvalStringsAsStr( strings : TStrings ) : string;
18301830
function EvalPyFunction(pyfunc, pyargs:PPyObject): Variant;
1831-
function EvalFunction(pyfunc:PPyObject; args: array of const): Variant;
1831+
function EvalFunction(pyfunc:PPyObject; const args: array of const): Variant;
18321832
function EvalFunctionNoArgs(pyfunc:PPyObject): Variant;
18331833
function CheckEvalSyntax( const str : AnsiString ) : Boolean;
18341834
function CheckExecSyntax( const str : AnsiString ) : Boolean;
@@ -1844,19 +1844,19 @@ TPythonEngine = class(TPythonInterface)
18441844
function MethodsByName( const aMethodsContainer: string ) : PPyMethodDef;
18451845
function VariantAsPyObject( const V : Variant ) : PPyObject; virtual;
18461846
function PyObjectAsVariant( obj : PPyObject ) : Variant; virtual;
1847-
function VarRecAsPyObject( v : TVarRec ) : PPyObject;
1847+
function VarRecAsPyObject( const v : TVarRec ) : PPyObject;
18481848
function MakePyTuple( const objects : array of PPyObject ) : PPyObject;
18491849
function MakePyList( const objects : array of PPyObject ) : PPyObject;
1850-
function ArrayToPyTuple( items : array of const) : PPyObject;
1851-
function ArrayToPyList( items : array of const) : PPyObject;
1852-
function ArrayToPyDict( items : array of const) : PPyObject;
1850+
function ArrayToPyTuple( const items : array of const) : PPyObject;
1851+
function ArrayToPyList( const items : array of const) : PPyObject;
1852+
function ArrayToPyDict( const items : array of const) : PPyObject;
18531853
function StringsToPyList( strings : TStrings ) : PPyObject;
18541854
function StringsToPyTuple( strings : TStrings ) : PPyObject;
18551855
procedure PyListToStrings( list : PPyObject; strings : TStrings );
18561856
procedure PyTupleToStrings( tuple: PPyObject; strings : TStrings );
18571857
function ReturnNone : PPyObject;
18581858
function FindModule( const ModuleName : AnsiString ) : PPyObject;
1859-
function FindFunction(ModuleName,FuncName: AnsiString): PPyObject;
1859+
function FindFunction(const ModuleName,FuncName: AnsiString): PPyObject;
18601860
function SetToList( data : Pointer; size : Integer ) : PPyObject;
18611861
procedure ListToSet( List : PPyObject; data : Pointer; size : Integer );
18621862
procedure CheckError(ACatchStopEx : Boolean = False);
@@ -2235,7 +2235,7 @@ TPythonModule = class(TMethodsContainer)
22352235
procedure AddClient( client : TEngineClient );
22362236
function ErrorByName( const AName : AnsiString ) : TError;
22372237
procedure RaiseError( const error, msg : AnsiString );
2238-
procedure RaiseErrorFmt( const error, format : AnsiString; Args : array of const );
2238+
procedure RaiseErrorFmt( const error, format : AnsiString; const Args : array of const );
22392239
procedure RaiseErrorObj( const error, msg : AnsiString; obj : PPyObject );
22402240
procedure BuildErrors;
22412241
procedure SetVar( const varName : AnsiString; value : PPyObject );
@@ -4493,7 +4493,7 @@ function TPythonEngine.EvalPyFunction(pyfunc, pyargs:PPyObject): Variant;
44934493
end;
44944494
end;
44954495

4496-
function TPythonEngine.EvalFunction(pyfunc:PPyObject; args: array of const): Variant;
4496+
function TPythonEngine.EvalFunction(pyfunc:PPyObject; const args: array of const): Variant;
44974497
var pargs: PPyObject;
44984498
begin
44994499
CheckPython;
@@ -5017,7 +5017,7 @@ function TPythonEngine.ModuleByName( const aModuleName : AnsiString ) : PPyObj
50175017
raise Exception.CreateFmt('Could not find module: %s', [aModuleName]);
50185018
end;
50195019

5020-
function TPythonEngine.MethodsByName( const aMethodsContainer: string ) : PPyMethodDef;
5020+
function TPythonEngine.MethodsByName( const aMethodsContainer: string ) : PPyMethodDef;
50215021
var
50225022
i : Integer;
50235023
begin
@@ -5361,7 +5361,7 @@ function TPythonEngine.PyObjectAsVariant( obj : PPyObject ) : Variant;
53615361
Result := Null;
53625362
end;
53635363

5364-
function TPythonEngine.VarRecAsPyObject( v : TVarRec ) : PPyObject;
5364+
function TPythonEngine.VarRecAsPyObject( const v : TVarRec ) : PPyObject;
53655365
begin
53665366
case v.VType of
53675367
vtInteger: Result := PyLong_FromLong( v.VInteger );
@@ -5448,7 +5448,7 @@ function TPythonEngine.MakePyList( const objects : array of PPyObject ) : PPyObj
54485448
end;
54495449
end;
54505450

5451-
function TPythonEngine.ArrayToPyTuple( items : array of const) : PPyObject;
5451+
function TPythonEngine.ArrayToPyTuple( const items : array of const) : PPyObject;
54525452
var
54535453
i : Integer;
54545454
begin
@@ -5459,7 +5459,7 @@ function TPythonEngine.ArrayToPyTuple( items : array of const) : PPyObject;
54595459
PyTuple_SetItem( Result, i, VarRecAsPyObject( items[i] ) );
54605460
end;
54615461

5462-
function TPythonEngine.ArrayToPyList( items : array of const) : PPyObject;
5462+
function TPythonEngine.ArrayToPyList( const items : array of const) : PPyObject;
54635463
var
54645464
i : Integer;
54655465
begin
@@ -5471,9 +5471,9 @@ function TPythonEngine.ArrayToPyList( items : array of const) : PPyObject;
54715471
end;
54725472

54735473
// You must give each entry as a couple key(string)/value
5474-
function TPythonEngine.ArrayToPyDict( items : array of const) : PPyObject;
5474+
function TPythonEngine.ArrayToPyDict( const items : array of const) : PPyObject;
54755475

5476-
function VarRecAsString( v : TVarRec ) : AnsiString;
5476+
function VarRecAsString( const v : TVarRec ) : AnsiString;
54775477
begin
54785478
case v.VType of
54795479
vtChar: Result := v.VChar;
@@ -5700,7 +5700,7 @@ function TPythonEngine.FindModule( const ModuleName : AnsiString ) : PPyObject;
57005700
Result := nil;
57015701
end;
57025702

5703-
function TPythonEngine.FindFunction(ModuleName,FuncName: AnsiString): PPyObject;
5703+
function TPythonEngine.FindFunction(const ModuleName,FuncName: AnsiString): PPyObject;
57045704
var
57055705
module,func: PPyObject;
57065706
begin
@@ -6836,7 +6836,7 @@ procedure TPythonModule.RaiseError( const error, msg : AnsiString );
68366836
ErrorByName( error ).RaiseError( msg );
68376837
end;
68386838

6839-
procedure TPythonModule.RaiseErrorFmt( const error, format : AnsiString; Args : array of const );
6839+
procedure TPythonModule.RaiseErrorFmt( const error, format : AnsiString; const Args : array of const );
68406840
begin
68416841
RaiseError( error, AnsiString(SysUtils.Format( string(format), Args )) );
68426842
end;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy