Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5ecd8f2

Browse files
committed
1 parent3cc73da commit5ecd8f2

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

‎src/runtime/pyobject.cs

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -939,7 +939,7 @@ public override bool TryGetMember(GetMemberBinder binder, out object result)
939939
{
940940
if(this.HasAttr(binder.Name))
941941
{
942-
result=this.GetAttr(binder.Name);
942+
result=CheckNone(this.GetAttr(binder.Name));
943943
returntrue;
944944
}
945945
else
@@ -999,7 +999,7 @@ public override bool TryInvokeMember(InvokeMemberBinder binder, object[] args, o
999999
try
10001000
{
10011001
GetArgs(args,outpyargs,outkwargs);
1002-
result=InvokeMethod(binder.Name,pyargs,kwargs);
1002+
result=CheckNone(InvokeMethod(binder.Name,pyargs,kwargs));
10031003
}
10041004
finally
10051005
{
@@ -1023,7 +1023,7 @@ public override bool TryInvoke(InvokeBinder binder, object[] args, out object re
10231023
try
10241024
{
10251025
GetArgs(args,outpyargs,outkwargs);
1026-
result=Invoke(pyargs,kwargs);
1026+
result=CheckNone(Invoke(pyargs,kwargs));
10271027
}
10281028
finally
10291029
{
@@ -1133,10 +1133,26 @@ public override bool TryBinaryOperation(BinaryOperationBinder binder, Object arg
11331133
result=null;
11341134
returnfalse;
11351135
}
1136-
result=newPyObject(res);
1136+
result=CheckNone(newPyObject(res));
1137+
11371138
returntrue;
11381139
}
11391140

1141+
// Workaround for https://bugzilla.xamarin.com/show_bug.cgi?id=41509
1142+
// See https://github.com/pythonnet/pythonnet/pull/219
1143+
privatestaticobjectCheckNone(PyObjectpyObj)
1144+
{
1145+
if(pyObj!=null)
1146+
{
1147+
if(pyObj.obj==Runtime.PyNone)
1148+
{
1149+
returnnull;
1150+
}
1151+
}
1152+
1153+
returnpyObj;
1154+
}
1155+
11401156
publicoverrideboolTryUnaryOperation(UnaryOperationBinderbinder,outObjectresult)
11411157
{
11421158
intr;
@@ -1170,7 +1186,7 @@ public override bool TryUnaryOperation(UnaryOperationBinder binder, out Object r
11701186
result=null;
11711187
returnfalse;
11721188
}
1173-
result=newPyObject(res);
1189+
result=CheckNone(newPyObject(res));
11741190
returntrue;
11751191
}
11761192
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp