Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion PythonForDelphi/Components/Sources/Core/PythonEngine.pas
Original file line number Diff line number Diff line change
Expand Up @@ -3149,6 +3149,7 @@ procedure PyObjectDestructor( pSelf : PPyObject); cdecl;
procedure FreeSubtypeInst(ob:PPyObject); cdecl;
procedure Register;
function PyType_HasFeature(AType : PPyTypeObject; AFlag : Integer) : Boolean;
function GetPythonVersionFromDLLName(const DLLFileName : String): String;

{ Helper functions}
(*
Expand Down Expand Up @@ -4746,7 +4747,9 @@ procedure TPythonEngine.DoOpenDll(const aDllName : String);
end;
if not PYTHON_KNOWN_VERSIONS[i].CanUseLatest then
Break;
end;
end
else
RegVersion := GetPythonVersionFromDLLName(aDllName);
inherited;
end;

Expand Down Expand Up @@ -9754,6 +9757,11 @@ procedure Register;
TPythonType, TPythonModule, TPythonDelphiVar]);
end;

function GetPythonVersionFromDLLName(const DLLFileName : String): String;
begin
Result := DLLFileName[{$IFDEF MSWINDOWS}7{$ELSE}10{$ENDIF}] + '.' + DLLFileName[{$IFDEF MSWINDOWS}8{$ELSE}11{$ENDIF}];
end;

function PyType_HasFeature(AType : PPyTypeObject; AFlag : Integer) : Boolean;
begin
//(((t)->tp_flags & (f)) != 0)
Expand Down
3 changes: 1 addition & 2 deletions PythonForDelphi/Components/Sources/Core/PythonVersions.pas
Original file line number Diff line number Diff line change
Expand Up @@ -464,8 +464,7 @@ function PythonVersionFromPath(const Path: string; out PythonVersion: TPythonVer
end;
PythonVersion.DLLPath := DLLPath;

SysVersion := Copy(DLLFileName, 7, 2);
Insert('.', SysVersion, 2);
SysVersion := GetPythonVersionFromDLLName(DLLFileName);

PythonVersion.SysVersion := SysVersion;
PythonVersion.fSysArchitecture := PythonVersion.ExpectedArchitecture;
Expand Down