8000 RaiseIndexMustBeIntegerError · pythonnet/pythonnet@4f18f9e · GitHub
[go: up one dir, main page]

Skip to content

Commit 4f18f9e

Browse files
committed
RaiseIndexMustBeIntegerError
1 parent fbd5846 commit 4f18f9e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/runtime/arrayobject.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ static NewReference NewInstance(Type elementType, BorrowedReference arrayPyType,
161161
{
162162
if (!Runtime.PyInt_Check(idx))
163163
{
164-
return RaiseTypeError(idx);
164+
return RaiseIndexMustBeIntegerError(idx);
165165
}
166166
index = Runtime.PyInt_AsLong(idx);
167167

@@ -205,7 +205,7 @@ static NewReference NewInstance(Type elementType, BorrowedReference arrayPyType,
205205
IntPtr op = Runtime.PyTuple_GetItem(idx, i);
206206
if (!Runtime.PyInt_Check(op))
207207
{
208-
return RaiseTypeError(op);
208+
return RaiseIndexMustBeIntegerError(op);
209209
}
210210
index = Runtime.PyInt_AsLong(op);
211211

@@ -263,7 +263,7 @@ static NewReference NewInstance(Type elementType, BorrowedReference arrayPyType,
263263
{
264264
if (!Runtime.PyInt_Check(idx))
265265
{
266-
RaiseTypeError(idx);
266+
RaiseIndexMustBeIntegerError(idx);
267267
return -1;
268268
}
269269
index = Runtime.PyInt_AsLong(idx);
@@ -306,7 +306,7 @@ static NewReference NewInstance(Type elementType, BorrowedReference arrayPyType,
306306
IntPtr op = Runtime.PyTuple_GetItem(idx, i);
307307
if (!Runtime.PyInt_Check(op))
308308
{
309-
RaiseTypeError(op);
309+
RaiseIndexMustBeIntegerError(op);
310310
return -1;
311311
}
312312
index = Runtime.PyInt_AsLong(op);
@@ -338,7 +338,7 @@ static NewReference NewInstance(Type elementType, BorrowedReference arrayPyType,
338338
return 0;
339339
}
340340

341-
private static IntPtr RaiseTypeError(IntPtr idx)
341+
private static IntPtr RaiseIndexMustBeIntegerError(IntPtr idx)
342342
{
343343
string tpName = Runtime.PyObject_GetTypeName(idx);
344344
return Exceptions.RaiseTypeError($"array index has type {tpName}, expected an integer");

0 commit comments

Comments
 (0)
0