Skip to content

Commit 2f45246

Browse files
committed
Fix: delegate 'PythonAbstractNativeObject.hashCode' to pointer object.
1 parent 51e9cd8 commit 2f45246

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/PythonAbstractNativeObject.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@
4040
*/
4141
package com.oracle.graal.python.builtins.objects.cext;
4242

43+
import java.util.Objects;
44+
4345
import com.oracle.graal.python.builtins.objects.PythonAbstractObject;
46+
import com.oracle.truffle.api.CompilerAsserts;
4447
import com.oracle.truffle.api.CompilerDirectives;
4548
import com.oracle.truffle.api.interop.TruffleObject;
4649
import com.oracle.truffle.api.object.Shape;
@@ -72,4 +75,10 @@ public TruffleObject getPtr() {
7275
return object;
7376
}
7477

78+
@Override
79+
public int hashCode() {
80+
CompilerAsserts.neverPartOfCompilation();
81+
// this is important for the default '__hash__' implementation
82+
return Objects.hashCode(object);
83+
}
7584
}

0 commit comments

Comments
 (0)