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

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove __init__ call from ClassDerived.InvokeCtor
  • Loading branch information
Rickard Holmberg committed Jun 20, 2017
commit bc7b74bad93a2c3d65f3327f9e590a42803b0cf7
22 changes: 1 addition & 21 deletions src/runtime/classderived.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
Expand Down Expand Up @@ -829,26 +829,6 @@ public static void InvokeCtor(IPythonDerivedType obj, string origCtorName, objec
Runtime.XIncref(Runtime.PyNone);
var pynone = new PyObject(Runtime.PyNone);
disposeList.Add(pynone);

// call __init__
PyObject init = pyself.GetAttr("__init__", pynone);
disposeList.Add(init);
if (init.Handle != Runtime.PyNone)
{
// if __init__ hasn't been overridden then it will be a managed object
ManagedType managedMethod = ManagedType.GetManagedObject(init.Handle);
if (null == managedMethod)
{
var pyargs = new PyObject[args.Length];
for (var i = 0; i < args.Length; ++i)
{
pyargs[i] = new PyObject(Converter.ToPython(args[i], args[i]?.GetType()));
disposeList.Add(pyargs[i]);
}

disposeList.Add(init.Invoke(pyargs));
}
}
}
finally
{
Expand Down