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

Skip to content

Commit bd6d847

Browse files
author
Barton Cline
committed
Re-enable the Incref() call on ConstructorBinding.tp_descr_get()
For now, it seems, the sole reason for the Descriptor __get__ is to return AN INCREF()ed reference to the wrapped instance.
1 parent 94260ae commit bd6d847

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

pythonnet/src/runtime/constructorbinding.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,7 @@ public static IntPtr tp_descr_get(IntPtr op, IntPtr instance, IntPtr owner)
8080
return Exceptions.RaiseTypeError("How in the world could that happen!");
8181
}
8282
}*/
83-
/* Since ExtensionType calls Runtime.PyObject_GC_UnTrack(py), don't
84-
Runtime.Incref(self.pyHandle); // Decref'd by the interpreter??? */
83+
Runtime.Incref(self.pyHandle); // Decref'd by the interpreter.
8584
return self.pyHandle;
8685
}
8786

@@ -112,7 +111,7 @@ public static IntPtr mp_subscript(IntPtr op, IntPtr key) {
112111
}
113112
BoundContructor boundCtor = new BoundContructor(self.type, self.pyTypeHndl, self.ctorBinder, ci);
114113

115-
/* Since ExtensionType calls Runtime.PyObject_GC_UnTrack(py), don't
114+
/* Since nothing's chached, do we need the increment???
116115
Runtime.Incref(boundCtor.pyHandle); // Decref'd by the interpreter??? */
117116
return boundCtor.pyHandle;
118117
}
@@ -128,7 +127,7 @@ public static IntPtr tp_repr(IntPtr ob) {
128127
return self.repr;
129128
}
130129
MethodBase[] methods = self.ctorBinder.GetMethods();
131-
string name = self.type.Name;
130+
string name = self.type.FullName;
132131
string doc = "";
133132
for (int i = 0; i < methods.Length; i++) {
134133
if (doc.Length > 0)

0 commit comments

Comments
 (0)