File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
PythonForDelphi/Components/Sources/Core Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -3149,6 +3149,7 @@ procedure PyObjectDestructor( pSelf : PPyObject); cdecl;
3149
3149
procedure FreeSubtypeInst (ob:PPyObject); cdecl;
3150
3150
procedure Register ;
3151
3151
function PyType_HasFeature (AType : PPyTypeObject; AFlag : Integer) : Boolean;
3152
+ function GetPythonVersionFromDLLName (const DLLFileName : String): String;
3152
3153
3153
3154
{ Helper functions}
3154
3155
(*
@@ -4746,7 +4747,9 @@ procedure TPythonEngine.DoOpenDll(const aDllName : String);
4746
4747
end ;
4747
4748
if not PYTHON_KNOWN_VERSIONS[i].CanUseLatest then
4748
4749
Break;
4749
- end ;
4750
+ end
4751
+ else
4752
+ RegVersion := GetPythonVersionFromDLLName(aDllName);
4750
4753
inherited ;
4751
4754
end ;
4752
4755
@@ -9754,6 +9757,11 @@ procedure Register;
9754
9757
TPythonType, TPythonModule, TPythonDelphiVar]);
9755
9758
end ;
9756
9759
9760
+ function GetPythonVersionFromDLLName (const DLLFileName : String): String;
9761
+ begin
9762
+ Result := DLLFileName[{ $IFDEF MSWINDOWS} 7 { $ELSE} 10 { $ENDIF} ] + ' .' + DLLFileName[{ $IFDEF MSWINDOWS} 8 { $ELSE} 11 { $ENDIF} ];
9763
+ end ;
9764
+
9757
9765
function PyType_HasFeature (AType : PPyTypeObject; AFlag : Integer) : Boolean;
9758
9766
begin
9759
9767
// (((t)->tp_flags & (f)) != 0)
Original file line number Diff line number Diff line change @@ -464,8 +464,7 @@ function PythonVersionFromPath(const Path: string; out PythonVersion: TPythonVer
464
464
end ;
465
465
PythonVersion.DLLPath := DLLPath;
466
466
467
- SysVersion := Copy(DLLFileName, 7 , 2 );
468
- Insert(' .' , SysVersion, 2 );
467
+ SysVersion := GetPythonVersionFromDLLName(DLLFileName);
469
468
470
469
PythonVersion.SysVersion := SysVersion;
471
470
PythonVersion.fSysArchitecture := PythonVersion.ExpectedArchitecture;
You can’t perform that action at this time.
0 commit comments