@@ -189,9 +189,6 @@ public static void Initialize(IEnumerable<string> args, bool setSysArgv = true,
189
189
// Make sure we clean up properly on app domain unload.
190
190
AppDomain . CurrentDomain . DomainUnload += OnDomainUnload ;
191
191
192
- // Remember to shut down the runtime.
193
- AddShutdownHandler ( Runtime . Shutdown ) ;
194
-
195
192
// The global scope gets used implicitly quite early on, remember
196
193
// to clear it out when we shut down.
197
194
AddShutdownHandler ( PyScopeManager . Global . Clear ) ;
@@ -318,7 +315,8 @@ public static IntPtr InitExt()
318
315
/// Python runtime can no longer be used in the current process
319
316
/// after calling the Shutdown method.
320
317
/// </remarks>
321
- public static void Shutdown ( )
318
+ /// <param name="mode">The ShutdownMode to use when shutting down the Runtime</param>
319
+ public static void Shutdown ( ShutdownMode mode )
322
320
{
323
321
if ( ! initialized )
324
322
{
@@ -330,11 +328,26 @@ public static void Shutdown()
330
328
331
329
PyScopeManager . Global . Clear ( ) ;
332
330
ExecuteShutdownHandlers ( ) ;
331
+ // Remember to shut down the runtime.
332
+ Runtime . Shutdown ( mode ) ;
333
333
PyObjectConversions . Reset ( ) ;
334
334
335
335
initialized = false ;
336
336
}
337
337
338
+ /// <summary>
339
+ /// Shutdown Method
340
+ /// </summary>
341
+ /// <remarks>
342
+ /// Shutdown and release resources held by the Python runtime. The
343
+ /// Python runtime can no longer be used in the current process
344
+ /// after calling the Shutdown method.
345
+ /// </remarks>
346
+ public static void Shutdown ( )
347
+ {
348
+ Shutdown ( Runtime . ShutdownMode ) ;
349
+ }
350
+
338
351
/// <summary>
339
352
/// Called when the engine is shut down.
340
353
///
0 commit comments