We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 16699a5 commit b6873aaCopy full SHA for b6873aa
1 file changed
PythonNETExtensions/Core/PythonCore.cs
@@ -51,7 +51,18 @@ private PythonCore() { }
51
52
private static dynamic MainPythonThread;
53
54
- public Task InitializeAsync() => InitializeAsyncInternal();
+ 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
+ }
66
67
// AggressiveInlining - Inline into instance method
68
// AggressiveOptimization - Only ran once during startup, will never have the chance to tier up
0 commit comments