Skip to content

Cache Initialized result #107

@Alexey-T

Description

@Alexey-T
procedure TPythonInterface.CheckPython;
begin
  if not Initialized then
    raise Exception.Create('Python is not properly initialized' );
end;

function TPythonInterface.GetInitialized: Boolean;
begin
  if Assigned(Py_IsInitialized) then
    Result := Py_IsInitialized() <> 0
  else
    Result := FInitialized;
end;

this is called on each EvalString/Execstring. it calls Py DLL (in Initialized), no good. i suggest to add cache boolean var: if Py_IsInitialized got True, save this var to True and don't call Py_IsInitialized in DLL again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions