Skip to content

Commit 32e8130

Browse files
filmorMartin-Molinero
authored andcommitted
Assign True instead of None to __clear_reentry_guard__
Not at all sure why this helps, but when assigning `None` instead, the object is gone at the time of garbage collection. (cherry picked from commit 8e0333d)
1 parent 7d13c02 commit 32e8130

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎src/runtime/Types/ClassBase.cs‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,12 @@ internal static unsafe int BaseUnmanagedClear(BorrowedReference ob)
419419
using var dict = Runtime.PyObject_GenericGetDict(ob);
420420
if (Runtime.PyMapping_HasKey(dict.Borrow(), PyIdentifier.__clear_reentry_guard__) != 0)
421421
return 0;
422-
int res = Runtime.PyDict_SetItem(dict.Borrow(), PyIdentifier.__clear_reentry_guard__, Runtime.None);
422+
423+
int res = Runtime.PyDict_SetItem(
424+
dict.Borrow(),
425+
PyIdentifier.__clear_reentry_guard__,
426+
Runtime.PyTrue
427+
);
423428
if (res != 0) return res;
424429

425430
res = clear(ob);

0 commit comments

Comments
 (0)