@@ -2729,7 +2729,7 @@ procedure Register;
27292729function PyType_HasFeature (AType : PPyTypeObject; AFlag : Integer) : Boolean;
27302730function SysVersionFromDLLName (const DLLFileName : string): string;
27312731procedure PythonVersionFromDLLName (LibName: string; out MajorVersion, MinorVersion: integer);
2732- function SpliVersionFromRegVersion (const ARegVersion: string;
2732+ function VersionFromRegVersion (const ARegVersion: string;
27332733 out AMajorVersion, AMinorVersion: integer): boolean;
27342734
27352735{ Helper functions}
@@ -3246,7 +3246,7 @@ procedure TPythonInterface.AfterLoad;
32463246 inherited ;
32473247 if not FInExtensionModule then
32483248 PythonVersionFromDLLName(DLLName, FMajorVersion, FMinorVersion)
3249- else if not SpliVersionFromRegVersion (RegVersion, FMajorVersion, FMinorVersion) then
3249+ else if not VersionFromRegVersion (RegVersion, FMajorVersion, FMinorVersion) then
32503250 raise EDLLLoadError.Create(' Undetermined Python version.' );
32513251
32523252 FBuiltInModuleName := ' builtins' ;
@@ -4408,8 +4408,8 @@ procedure TPythonEngine.CheckRegistry;
44084408 Path : string;
44094409 NewPath : string;
44104410{ $IFDEF CPUX86}
4411- MajorVersion : integer;
4412- MinorVersion : integer;
4411+ LMajorVersion : integer;
4412+ LMinorVersion : integer;
44134413{ $ENDIF}
44144414 VersionSuffix: string;
44154415{ $ENDIF}
@@ -4421,9 +4421,8 @@ procedure TPythonEngine.CheckRegistry;
44214421 try
44224422 VersionSuffix := ' ' ;
44234423{ $IFDEF CPUX86}
4424- MajorVersion := StrToInt(RegVersion[1 ]);
4425- MinorVersion := StrToInt(Copy(RegVersion, 3 ));
4426- if (MajorVersion > 3 ) or ((MajorVersion = 3 ) and (MinorVersion >= 5 )) then
4424+ VersionFromRegVersion(RegVersion, LMajorVersion, LMinorVersion);
4425+ if (LMajorVersion > 3 ) or ((LMajorVersion = 3 ) and (LMinorVersion >= 5 )) then
44274426 VersionSuffix := ' -32' ;
44284427{ $ENDIF}
44294428 key := Format(' \Software\Python\PythonCore\%s%s\PythonPath' , [RegVersion, VersionSuffix]);
@@ -9153,17 +9152,16 @@ function IsPythonVersionRegistered(PythonVersion : string;
91539152var
91549153 key: string;
91559154 VersionSuffix: string;
9156- MajorVersion : integer;
9157- MinorVersion : integer;
9155+ LMajorVersion : integer;
9156+ LMinorVersion : integer;
91589157begin
91599158 Result := False;
91609159 InstallPath := ' ' ;
91619160 AllUserInstall := False;
9162- MajorVersion := StrToInt(PythonVersion[1 ]);
9163- MinorVersion := StrToInt(Copy(PythonVersion, 3 ));
91649161 VersionSuffix := ' ' ;
9162+ VersionFromRegVersion(PythonVersion, LMajorVersion, LMinorVersion);
91659163{ $IFDEF CPUX86}
9166- if (MajorVersion > 3 ) or ((MajorVersion = 3 ) and (MinorVersion >= 5 )) then
9164+ if (LMajorVersion > 3 ) or ((LMajorVersion = 3 ) and (LMinorVersion >= 5 )) then
91679165 VersionSuffix := ' -32' ;
91689166{ $ENDIF}
91699167 key := Format(' \Software\Python\PythonCore\%s%s\InstallPath' , [PythonVersion, VersionSuffix]);
@@ -9191,7 +9189,7 @@ function IsPythonVersionRegistered(PythonVersion : string;
91919189 RootKey := HKEY_LOCAL_MACHINE;
91929190 if OpenKey(Key, False) then begin
91939191 AllUserInstall := True;
9194- if (MajorVersion > 3 ) or ((MajorVersion = 3 ) and (MinorVersion >= 5 )) then
9192+ if (LMajorVersion > 3 ) or ((LMajorVersion = 3 ) and (LMinorVersion >= 5 )) then
91959193 InstallPath := ReadString(' ' );
91969194 Result := True;
91979195 end ;
@@ -9253,7 +9251,7 @@ procedure PythonVersionFromDLLName(LibName: string; out MajorVersion, MinorVersi
92539251 MinorVersion:= StrToIntDef(LibName, DefaultMinor);
92549252end ;
92559253
9256- function SpliVersionFromRegVersion (const ARegVersion: string;
9254+ function VersionFromRegVersion (const ARegVersion: string;
92579255 out AMajorVersion, AMinorVersion: integer): boolean;
92589256var
92599257 LSepPos: integer;
0 commit comments