Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a610aa3

Browse files
committed
can't really clear managed references to Python objects from ManagedType instances, unless they are per-alloc call
no problem though - they will be collected by .NET garbage collector eventually
1 parent 1a4ada7 commit a610aa3

6 files changed

Lines changed: 0 additions & 29 deletions

File tree

src/runtime/classmanager.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,6 @@ internal static ClassManagerState SaveRuntimeData()
9999
using var dict = Runtime.PyObject_GenericGetDict(cls.Value);
100100
foreach (var member in cb.dotNetMembers)
101101
{
102-
// No need to decref the member, the ClassBase instance does
103-
// not own the reference.
104102
if ((Runtime.PyDict_DelItemString(dict.Borrow(), member) == -1) &&
105103
(Exceptions.ExceptionMatches(Exceptions.KeyError)))
106104
{

src/runtime/eventbinding.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,5 @@ public static NewReference tp_repr(BorrowedReference ob)
9494
string s = string.Format("<{0} event '{1}'>", type, self.e.name);
9595
return Runtime.PyString_FromString(s);
9696
}
97-
98-
protected override void Clear(BorrowedReference ob)
99-
{
100-
Runtime.Py_CLEAR(ref this.target);
101-
base.Clear(ob);
102-
}
10397
}
10498
}

src/runtime/methodbinding.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -277,12 +277,5 @@ public static NewReference tp_repr(BorrowedReference ob)
277277
string name = self.m.name;
278278
return Runtime.PyString_FromString($"<{type} method '{name}'>");
279279
}
280-
281-
protected override void Clear(BorrowedReference ob)
282-
{
283-
this.target = null;
284-
this.targetType = null!;
285-
base.Clear(ob);
286-
}
287280
}
288281
}

src/runtime/methodobject.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,6 @@ public static NewReference tp_repr(BorrowedReference ob)
204204

205205
protected override void Clear(BorrowedReference ob)
206206
{
207-
Runtime.Py_CLEAR(ref this.doc);
208207
this.unbound = null;
209208
base.Clear(ob);
210209
}

src/runtime/moduleobject.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -331,12 +331,6 @@ public static int tp_traverse(BorrowedReference ob, IntPtr visit, IntPtr arg)
331331
return 0;
332332
}
333333

334-
protected override void Clear(BorrowedReference ob)
335-
{
336-
this.cache.Clear();
337-
base.Clear(ob);
338-
}
339-
340334
/// <summary>
341335
/// Override the setattr implementation.
342336
/// This is needed because the import mechanics need

src/runtime/overload.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,5 @@ public static NewReference tp_repr(BorrowedReference op)
5454
var self = (OverloadMapper)GetManagedObject(op)!;
5555
return self.m.GetDocString();
5656
}
57-
58-
protected override void Clear(BorrowedReference ob)
59-
{
60-
this.target = null;
61-
this.m = null!;
62-
base.Clear(ob);
63-
}
6457
}
6558
}

0 commit comments

Comments
 (0)