@@ -2254,6 +2254,7 @@ TPythonEngine = class(TPythonInterface)
2254
2254
function Run_CommandAsObject (const command : AnsiString; mode : Integer) : PPyObject;
2255
2255
function Run_CommandAsObjectWithDict (const command : AnsiString; mode : Integer; locals, globals : PPyObject) : PPyObject;
2256
2256
function EncodeString (const str: string): AnsiString;
2257
+ function EncodeWindowsFilePath (const str: string): AnsiString;
2257
2258
procedure ExecString (const command : AnsiString); overload;
2258
2259
procedure ExecStrings ( strings : TStrings ); overload;
2259
2260
function EvalString (const command : AnsiString) : PPyObject; overload;
@@ -4901,11 +4902,7 @@ procedure TPythonEngine.SetInitScript(Value: TStrings);
4901
4902
function TPythonEngine.GetInterpreterState : PPyInterpreterState;
4902
4903
var
4903
4904
res: PPyThreadState;
4904
- MajorVersion : integer;
4905
- MinorVersion : integer;
4906
4905
begin
4907
- MajorVersion := StrToInt(RegVersion[1 ]);
4908
- MinorVersion := StrToInt(RegVersion[3 ]);
4909
4906
if Assigned(PyThreadState_Get) then begin
4910
4907
res:= PyThreadState_Get();
4911
4908
if (MajorVersion > 3 ) or ((MajorVersion = 3 ) and (MinorVersion >= 4 )) then
@@ -5694,6 +5691,15 @@ function TPythonEngine.EncodeString(const str: string): AnsiString;
5694
5691
Result := AnsiString(str);
5695
5692
end ;
5696
5693
5694
+ function TPythonEngine.EncodeWindowsFilePath (const str: string): AnsiString;
5695
+ { PEP 529}
5696
+ begin
5697
+ if (MajorVersion > 3 ) or ((MajorVersion = 3 ) and (MinorVersion >=6 ) )then
5698
+ Result := UTF8Encode(str)
5699
+ else
5700
+ Result := AnsiString(str);
5701
+ end ;
5702
+
5697
5703
function TPythonEngine.TypeByName ( const aTypeName : AnsiString ) : PPyTypeObject;
5698
5704
var
5699
5705
i : Integer;
0 commit comments