Skip to content

Commit 672aef6

Browse files
committed
fixed compile errors in TypeMethod (untested)
1 parent 8619e77 commit 672aef6

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

src/runtime/typemethod.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,25 @@ public TypeMethod(Type type, string name, MethodInfo[] info, bool allow_threads)
2121
public override NewReference Invoke(BorrowedReference ob, BorrowedReference args, BorrowedReference kw)
2222
{
2323
MethodInfo mi = info[0];
24-
var arglist = new object[3];
25-
arglist[0] = ob;
26-
arglist[1] = args;
27-
arglist[2] = kw;
24+
var arglist = new object?[3];
25+
arglist[0] = PyObject.FromNullableReference(ob);
26+
arglist[1] = PyObject.FromNullableReference(args);
27+
arglist[2] = PyObject.FromNullableReference(kw);
2828

2929
try
3030
{
31-
object inst = null;
32-
if (ob != IntPtr.Zero)
31+
object? inst = null;
32+
if (ob != null)
3333
{
3434
inst = GetManagedObject(ob);
3535
}
36-
return (IntPtr)mi.Invoke(inst, BindingFlags.Default, null, arglist, null);
36+
var result = (PyObject)mi.Invoke(inst, BindingFlags.Default, null, arglist, null);
37+
return new NewReference(result);
3738
}
3839
catch (Exception e)
3940
{
4041
Exceptions.SetError(e);
41-
return IntPtr.Zero;
42+
return default;
4243
}
4344
}
4445
}

0 commit comments

Comments
 (0)