Skip to content

Commit d61a1f0

Browse files
committed
Changed primitive overloads of PythonObjectLibrary.hash() to static methods
1 parent c7e3352 commit d61a1f0

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/complex/ComplexBuiltins.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -828,12 +828,10 @@ abstract static class ImagNode extends PythonBuiltinNode {
828828
@Builtin(name = __HASH__, minNumOfPositionalArgs = 1)
829829
abstract static class HashNode extends PythonUnaryBuiltinNode {
830830
@Specialization
831-
@TruffleBoundary
832-
long hash(PComplex self,
833-
@CachedLibrary(limit = "1") PythonObjectLibrary lib) {
831+
long hash(PComplex self) {
834832
// just like CPython
835-
long realHash = lib.hash(self.getReal());
836-
long imagHash = lib.hash(self.getImag());
833+
long realHash = PythonObjectLibrary.hash(self.getReal());
834+
long imagHash = PythonObjectLibrary.hash(self.getImag());
837835
return realHash + PComplex.IMAG_MULTIPLIER * imagHash;
838836
}
839837
}

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -253,23 +253,19 @@ public final long hashWithFrame(Object receiver, ConditionProfile hasFrameProfil
253253
}
254254
}
255255

256-
@SuppressWarnings("static-method")
257-
public final long hash(boolean receiver) {
256+
public static long hash(boolean receiver) {
258257
return DefaultPythonBooleanExports.hash(receiver);
259258
}
260259

261-
@SuppressWarnings("static-method")
262-
public final long hash(int receiver) {
260+
public static long hash(int receiver) {
263261
return DefaultPythonIntegerExports.hash(receiver);
264262
}
265263

266-
@SuppressWarnings("static-method")
267-
public final long hash(long receiver) {
264+
public static long hash(long receiver) {
268265
return DefaultPythonLongExports.hash(receiver);
269266
}
270267

271-
@SuppressWarnings("static-method")
272-
public final long hash(double receiver) {
268+
public static long hash(double receiver) {
273269
return DefaultPythonDoubleExports.hash(receiver);
274270
}
275271

0 commit comments

Comments
 (0)