|
40 | 40 | */ |
41 | 41 | package com.oracle.graal.python.builtins.objects.type; |
42 | 42 |
|
43 | | -import static com.oracle.graal.python.builtins.objects.cext.capi.NativeCAPISymbol.FUN_PYOBJECT_HASH_NOT_IMPLEMENTED; |
44 | 43 | import static com.oracle.graal.python.nodes.SpecialMethodNames.T___ABS__; |
45 | 44 | import static com.oracle.graal.python.nodes.SpecialMethodNames.T___ADD__; |
46 | 45 | import static com.oracle.graal.python.nodes.SpecialMethodNames.T___AND__; |
@@ -1232,19 +1231,19 @@ public static TpSlots fromNative(PythonAbstractNativeObject pythonClass, PythonC |
1232 | 1231 | Object executable = ctx.getCApiContext().getClosureExecutable(fieldPointer); |
1233 | 1232 | if (executable instanceof TpSlotWrapper execWrapper) { |
1234 | 1233 | existingSlotWrapper = execWrapper; |
1235 | | - } else if (executable == null && CApiContext.isIdenticalToSymbol(field, FUN_PYOBJECT_HASH_NOT_IMPLEMENTED)) { |
1236 | | - builder.set(def, PyObjectHashNotImplemented.INSTANCE); |
1237 | | - continue; |
1238 | 1234 | } else if (executable != null) { |
1239 | 1235 | // This can happen for legacy slots where the delegate would be a PFunction |
1240 | 1236 | LOGGER.fine(() -> String.format("Unexpected executable for slot pointer: %s", executable)); |
1241 | | - } else if (def == TpSlotMeta.TP_ITERNEXT) { |
| 1237 | + } else if (def == TpSlotMeta.TP_HASH) { |
1242 | 1238 | // If the slot is not tp_iternext, but the value is |
1243 | | - // _PyObject_NextNotImplemented, we still assign it to the slot as wrapped |
1244 | | - // native executable |
1245 | | - Object symbol = CApiContext.getNativeSymbol(null, NativeCAPISymbol.FUN_PY_OBJECT_NEXT_NOT_IMPLEMENTED); |
1246 | | - InteropLibrary symbolLibrary = InteropLibrary.getUncached(symbol); |
1247 | | - if (fieldPointer == symbolLibrary.asPointer(symbol)) { |
| 1239 | + // PyObject_HashNotImplemented, we still assign it to the slot as wrapped |
| 1240 | + // native executable later on |
| 1241 | + if (CApiContext.isIdenticalToSymbol(fieldPointer, NativeCAPISymbol.FUN_PYOBJECT_HASH_NOT_IMPLEMENTED)) { |
| 1242 | + builder.set(def, TpSlotIterNext.NEXT_NOT_IMPLEMENTED); |
| 1243 | + continue; |
| 1244 | + } |
| 1245 | + } else if (def == TpSlotMeta.TP_ITERNEXT) { |
| 1246 | + if (CApiContext.isIdenticalToSymbol(fieldPointer, NativeCAPISymbol.FUN_PY_OBJECT_NEXT_NOT_IMPLEMENTED)) { |
1248 | 1247 | builder.set(def, TpSlotIterNext.NEXT_NOT_IMPLEMENTED); |
1249 | 1248 | continue; |
1250 | 1249 | } |
|
0 commit comments