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

Commit5fd8efc

Browse files
committed
respond to comments
1 parentcde2eca commit5fd8efc

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

‎src/runtime/CollectionWrappers/IterableWrapper.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public IEnumerator<T> GetEnumerator()
3030
varitem=Runtime.PyIter_Next(iterObject.Handle);
3131
if(item==IntPtr.Zero)
3232
{
33+
Runtime.CheckExceptionOccurred();
3334
iterObject.Dispose();
3435
break;
3536
}

‎src/runtime/CollectionWrappers/SequenceWrapper.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ public bool Contains(T item)
5656

5757
publicvoidCopyTo(T[]array,intarrayIndex)
5858
{
59+
if(array==null)
60+
thrownewNullReferenceException();
61+
62+
if((array.Length-arrayIndex)<this.Count)
63+
thrownewInvalidOperationException("Attempting to copy to an array that is too small");
64+
5965
varindex=0;
6066
foreach(variteminthis)
6167
{
@@ -69,9 +75,15 @@ protected bool removeAt(int index)
6975
if(IsReadOnly)
7076
thrownewNotImplementedException();
7177
if(index>=Count||index<0)
72-
thrownewIndexOutOfRangeException();
78+
returnfalse;
79+
80+
varresult=Runtime.PySequence_DelItem(pyObject.Handle,index);
7381

74-
returnRuntime.PySequence_DelItem(pyObject.Handle,index)!=0;
82+
if(result==0)
83+
returntrue;
84+
85+
Runtime.CheckExceptionOccurred();
86+
returnfalse;
7587
}
7688

7789
protectedintindexOf(Titem)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp