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;
31493149procedure FreeSubtypeInst (ob:PPyObject); cdecl;
31503150procedure Register ;
31513151function PyType_HasFeature (AType : PPyTypeObject; AFlag : Integer) : Boolean;
3152+ function GetPythonVersionFromDLLName (const DLLFileName : String): String;
31523153
31533154{ Helper functions}
31543155(*
@@ -4746,7 +4747,9 @@ procedure TPythonEngine.DoOpenDll(const aDllName : String);
47464747 end ;
47474748 if not PYTHON_KNOWN_VERSIONS[i].CanUseLatest then
47484749 Break;
4749- end ;
4750+ end
4751+ else
4752+ RegVersion := GetPythonVersionFromDLLName(aDllName);
47504753 inherited ;
47514754end ;
47524755
@@ -9754,6 +9757,11 @@ procedure Register;
97549757 TPythonType, TPythonModule, TPythonDelphiVar]);
97559758end ;
97569759
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+
97579765function PyType_HasFeature (AType : PPyTypeObject; AFlag : Integer) : Boolean;
97589766begin
97599767 // (((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
464464 end ;
465465 PythonVersion.DLLPath := DLLPath;
466466
467- SysVersion := Copy(DLLFileName, 7 , 2 );
468- Insert(' .' , SysVersion, 2 );
467+ SysVersion := GetPythonVersionFromDLLName(DLLFileName);
469468
470469 PythonVersion.SysVersion := SysVersion;
471470 PythonVersion.fSysArchitecture := PythonVersion.ExpectedArchitecture;
You can’t perform that action at this time.
0 commit comments