Merge pull request #1178 from iceljc/features/refine-py-interpreter

Features/refine py interpreter
This commit is contained in:
iceljc 2025-10-08 16:03:51 -05:00 committed by GitHub
commit a75c0a097f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -39,16 +39,12 @@ public class PythonInterpreterPlugin : IBotSharpAppPlugin
{ {
Runtime.PythonDLL = pyLoc; Runtime.PythonDLL = pyLoc;
PythonEngine.Initialize(); PythonEngine.Initialize();
#if DEBUG
_pyState = PythonEngine.BeginAllowThreads(); _pyState = PythonEngine.BeginAllowThreads();
#endif
lifetime.ApplicationStopping.Register(() => { lifetime.ApplicationStopping.Register(() => {
try try
{ {
#if DEBUG
PythonEngine.EndAllowThreads(_pyState); PythonEngine.EndAllowThreads(_pyState);
#endif
PythonEngine.Shutdown(); PythonEngine.Shutdown();
} }
catch { } catch { }