Skip to content

Commit 14cdbef

Browse files
author
Rickard Holmberg
committed
Trying out __init__
1 parent bc7b74b commit 14cdbef

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/runtime/metatype.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Runtime.InteropServices;
33

44
namespace Python.Runtime
@@ -157,10 +157,7 @@ public static IntPtr tp_call(IntPtr tp, IntPtr args, IntPtr kw)
157157
return IntPtr.Zero;
158158
}
159159

160-
IntPtr py__init__ = Runtime.PyString_FromString("__init__");
161-
IntPtr type = Runtime.PyObject_TYPE(obj);
162-
IntPtr init = Runtime._PyType_Lookup(type, py__init__);
163-
Runtime.XDecref(py__init__);
160+
var init = Runtime.PyObject_GetAttrString(obj, "__init__");
164161
Runtime.PyErr_Clear();
165162

166163
if (init != IntPtr.Zero)

0 commit comments

Comments
 (0)