10000 Fix GC on PyObject during Finalizing · BadSingleton/pythonnet@c69297e · GitHub
[go: up one dir, main page]

Skip to content

Commit c69297e

Browse files
committed
Fix GC on PyObject during Finalizing
Similar to how `PythonDerivedType` finalizes. Closes pythonnet#364 Possibly related to pythonnet#245
1 parent 75dd544 commit c69297e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/runtime/pyobject.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ protected virtual void Dispose(bool disposing)
113113
{
114114
if (!disposed)
115115
{
116-
if (Runtime.Py_IsInitialized() > 0)
116+
if (Runtime.Py_IsInitialized() > 0 && !Runtime.IsFinalizing)
117117
{
118118
IntPtr gs = PythonEngine.AcquireLock();
119119
Runtime.XDecref(obj);

0 commit comments

Comments
 (0)
0