Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfe1b26a

Browse files
committed
allow leaking PyObject instances when CLR is stared from Python
1 parent507a2bf commitfe1b26a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

‎src/runtime/pythonengine.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,8 @@ public static IntPtr InitExt()
317317
{
318318
Initialize(setSysArgv:false,mode:ShutdownMode.Extension);
319319

320+
Finalizer.Instance.ErrorHandler+=AllowLeaksDuringShutdown;
321+
320322
// Trickery - when the import hook is installed into an already
321323
// running Python, the standard import machinery is still in
322324
// control for the duration of the import that caused bootstrap.
@@ -358,6 +360,14 @@ public static IntPtr InitExt()
358360
.DangerousMoveToPointerOrNull();
359361
}
360362

363+
privatestaticvoidAllowLeaksDuringShutdown(objectsender,Finalizer.ErrorArgse)
364+
{
365+
if(e.ErrorisRuntimeShutdownException)
366+
{
367+
e.Handled=true;
368+
}
369+
}
370+
361371
/// <summary>
362372
/// Shutdown Method
363373
/// </summary>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp