Skip to content

Commit ee6a828

Browse files
authored
Remove superfluous Incref
Also drop comment on the type check. If `PyCell_Set` is not called with a cell it will raise an exception, which is perfectly valid here.
1 parent 82b8fdb commit ee6a828

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/runtime/typemanager.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -284,11 +284,7 @@ internal static IntPtr CreateSubType(IntPtr py_name, IntPtr py_base_type, IntPtr
284284
IntPtr cell = Runtime.PyDict_GetItemString(cls_dict, "__classcell__");
285285
if (cell != IntPtr.Zero)
286286
{
287-
// if (Runtime.PyObject_TypeCheck(cell, Runtime.PyCellType))
288-
{
289-
Runtime.XIncref(cell);
290-
Runtime.PyCell_Set(cell, py_type);
291-
}
287+
Runtime.PyCell_Set(cell, py_type);
292288
Runtime.PyDict_DelItemString(cls_dict, "__classcell__");
293289
}
294290

0 commit comments

Comments
 (0)