File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -4473,6 +4473,7 @@ procedure TPythonEngine.Initialize;
4473
4473
4474
4474
var
4475
4475
i : Integer;
4476
+ WorkAround: AnsiString;
4476
4477
begin
4477
4478
if Assigned(gPythonEngine) then
4478
4479
raise Exception.Create(' There is already one instance of TPythonEngine running' );
@@ -4510,8 +4511,27 @@ procedure TPythonEngine.Initialize;
4510
4511
with Clients[i] do
4511
4512
if not Initialized then
4512
4513
Initialize;
4514
+
4515
+ // WorkAround for https://github.com/python/cpython/issues/100171
4516
+ if (MajorVersion = 3 ) and (MinorVersion >= 11 ) then
4517
+ begin
4518
+ WorkAround :=
4519
+ ' import sys' #13 #10 + // 0
4520
+ ' if sys.version_info > (3,11,0):' #13 #10 + // 1
4521
+ ' import os' #13 #10 + // 2
4522
+ ' ' #13 #10 + // 3
4523
+ ' dllpath = os.path.join(sys.prefix, '' DLLs'' )' #13 #10 + // 4
4524
+ ' if dllpath not in sys.path:' #13 #10 + // 5
4525
+ ' sys.path.insert(3, dllpath)' #13 #10 + // 6
4526
+ ' ' #13 #10 + // 7
4527
+ ' del dllpath' #13 #10 + // 8
4528
+ ' del os' #13 #10 + // 9
4529
+ ' del sys' #13 #10 ; // 10
4530
+ ExecString(WorkAround);
4531
+ end ;
4532
+
4513
4533
if InitScript.Count > 0 then
4514
- ExecStrings( InitScript );
4534
+ ExecStrings(InitScript);
4515
4535
if Assigned(FOnAfterInit) then
4516
4536
FOnAfterInit(Self);
4517
4537
end ;
You can’t perform that action at this time.
0 commit comments