Skip to content

Another shot at #495 #503

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jun 26, 2017
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