Skip to content

Commit 5c030f7

Browse files
committed
compare PythonNativeObjects by their contents
1 parent 8715ff5 commit 5c030f7

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/list/ListBuiltins.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ protected Object doGeneric(Object self, Object objectIdx) {
355355
}
356356

357357
protected boolean isValidIndexType(Object idx) {
358-
return PGuards.isInteger(idx) || idx instanceof PSlice;
358+
return PGuards.isInteger(idx) || idx instanceof PSlice || idx instanceof PInt;
359359
}
360360
}
361361

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/object/ObjectBuiltins.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,11 @@ public int hash(Object self) {
134134
@Builtin(name = __EQ__, fixedNumOfArguments = 2)
135135
@GenerateNodeFactory
136136
public abstract static class EqNode extends PythonBinaryBuiltinNode {
137+
@Specialization
138+
public boolean eq(PythonNativeObject self, PythonNativeObject other) {
139+
return self.object.equals(other.object);
140+
}
141+
137142
@Specialization
138143
public boolean eq(Object self, Object other) {
139144
return self == other;

0 commit comments

Comments
 (0)