Skip to content

Commit b6873aa

Browse files
committed
Fallback to shitty blocking code for now, until we find out the root cause of issue.
1 parent 16699a5 commit b6873aa

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

PythonNETExtensions/Core/PythonCore.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,18 @@ private PythonCore() { }
5151

5252
private static dynamic MainPythonThread;
5353

54-
public Task InitializeAsync() => InitializeAsyncInternal();
54+
public Task InitializeAsync()
55+
{
56+
// It seems like async await code causes stack overflow exception when importing Py modules.
57+
// I suspect PythonEngine.Initialize() must be ran in the initial thread,
58+
// and crossing await boundaries does mess with that.
59+
60+
// TODO: Find out why this happens.
61+
InitializeAsyncInternal().Wait();
62+
return Task.CompletedTask;
63+
64+
// return InitializeAsyncInternal();
65+
}
5566

5667
// AggressiveInlining - Inline into instance method
5768
// AggressiveOptimization - Only ran once during startup, will never have the chance to tier up

0 commit comments

Comments
 (0)