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

Commitdbb88bc

Browse files
authored
Added parameter validation to PyObject methods (#1021)
* added parameter validation to PyObject methods
1 parent3362cf8 commitdbb88bc

File tree

3 files changed

+130
-15
lines changed

3 files changed

+130
-15
lines changed

‎src/embed_tests/TestPyObject.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,11 @@ def add(self, x, y):
5757
Assert.IsTrue(memberNames.Contains(expectedName),"Could not find member '{0}'.",expectedName);
5858
}
5959
}
60+
61+
[Test]
62+
publicvoidInvokeNull(){
63+
varlist=PythonEngine.Eval("list");
64+
Assert.Throws<ArgumentNullException>(()=>list.Invoke(newPyObject[]{null}));
65+
}
6066
}
6167
}

‎src/runtime/pyint.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public PyInt(int value)
6262
/// Creates a new Python int from a uint32 value.
6363
/// </remarks>
6464
[CLSCompliant(false)]
65-
publicPyInt(uintvalue):base(IntPtr.Zero)
65+
publicPyInt(uintvalue)
6666
{
6767
obj=Runtime.PyInt_FromInt64(value);
6868
Runtime.CheckExceptionOccurred();
@@ -75,7 +75,7 @@ public PyInt(uint value) : base(IntPtr.Zero)
7575
/// <remarks>
7676
/// Creates a new Python int from an int64 value.
7777
/// </remarks>
78-
publicPyInt(longvalue):base(IntPtr.Zero)
78+
publicPyInt(longvalue)
7979
{
8080
obj=Runtime.PyInt_FromInt64(value);
8181
Runtime.CheckExceptionOccurred();
@@ -89,7 +89,7 @@ public PyInt(long value) : base(IntPtr.Zero)
8989
/// Creates a new Python int from a uint64 value.
9090
/// </remarks>
9191
[CLSCompliant(false)]
92-
publicPyInt(ulongvalue):base(IntPtr.Zero)
92+
publicPyInt(ulongvalue)
9393
{
9494
obj=Runtime.PyInt_FromInt64((long)value);
9595
Runtime.CheckExceptionOccurred();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp