Skip to content

Commit ebbd22d

Browse files
committed
Add identity messages to PythonNativeNull
1 parent ee48ace commit ebbd22d

File tree

1 file changed

+18
-0
lines changed
  • graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext

1 file changed

+18
-0
lines changed

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
import com.oracle.truffle.api.library.CachedLibrary;
4747
import com.oracle.truffle.api.library.ExportLibrary;
4848
import com.oracle.truffle.api.library.ExportMessage;
49+
import com.oracle.truffle.api.utilities.TriState;
4950
import com.oracle.truffle.llvm.spi.NativeTypeLibrary;
5051
import com.oracle.truffle.llvm.spi.ReferenceLibrary;
5152

@@ -100,4 +101,21 @@ boolean isSame(Object other,
100101
@CachedLibrary("this.getPtr()") ReferenceLibrary delegateLib) {
101102
return delegateLib.isSame(ptr, other);
102103
}
104+
105+
@ExportMessage(limit = "1")
106+
int identityHashCode(@CachedLibrary("this.getPtr()") InteropLibrary lib) throws UnsupportedMessageException {
107+
return lib.identityHashCode(ptr);
108+
}
109+
110+
@ExportMessage(limit = "1")
111+
boolean isIdentical(Object other, InteropLibrary otherLib,
112+
@CachedLibrary("this.getPtr()") InteropLibrary lib) {
113+
return lib.isIdentical(ptr, other, otherLib);
114+
}
115+
116+
@SuppressWarnings({"unused", "static-method"})
117+
@ExportMessage
118+
TriState isIdenticalOrUndefined(Object other) {
119+
throw new AssertionError("cannot delegate isIdenticalOrUndefined for null properly");
120+
}
103121
}

0 commit comments

Comments
 (0)