Skip to content

Commit 85c6f6a

Browse files
committed
ApiVersion added in PythonVersions.pas
1 parent bbd80bf commit 85c6f6a

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

PythonForDelphi/Components/Sources/Core/PythonVersions.pas

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ TPythonVersion = record
2525
function GetIsPython3K: Boolean;
2626
function GetHelpFile: string;
2727
function GetDisplayName: string;
28+
function GetApiVersion: integer;
2829
public
2930
IsRegistered: Boolean;
3031
IsAllUsers: Boolean;
@@ -39,6 +40,7 @@ TPythonVersion = record
3940
property IsPython3K: Boolean read GetIsPython3K;
4041
property HelpFile: string read GetHelpFile write FHelpFile;
4142
property DisplayName: string read GetDisplayName write FDisplayName;
43+
property ApiVersion: integer read GetApiVersion;
4244
end;
4345

4446
TPythonVersions = array of TPythonVersion;
@@ -106,9 +108,18 @@ procedure TPythonVersion.AssignTo(PythonEngine: TPersistent);
106108
TPythonEngine(PythonEngine).RegVersion := SysVersion;
107109
TPythonEngine(PythonEngine).DllName := DLLName;
108110
TPythonEngine(PythonEngine).DllPath := DLLPath;
111+
TPythonEngine(PythonEngine).APIVersion := ApiVersion;
109112
end;
110113
end;
111114

115+
function TPythonVersion.GetApiVersion: integer;
116+
begin
117+
if CompareVersions(SysVersion, 2.4) < 0 then
118+
Result := 1013
119+
else
120+
Result := 1012;
121+
end;
122+
112123
function TPythonVersion.GetDisplayName: string;
113124
begin
114125
Result := FDisplayName;

0 commit comments

Comments
 (0)