|
43 | 43 | import static com.oracle.graal.python.builtins.objects.PNone.NO_VALUE;
|
44 | 44 | import static com.oracle.graal.python.builtins.objects.cext.capi.NativeCAPISymbol.FUN_PTR_ADD;
|
45 | 45 | import static com.oracle.graal.python.builtins.objects.cext.capi.NativeCAPISymbol.FUN_PTR_COMPARE;
|
| 46 | +import static com.oracle.graal.python.builtins.objects.cext.capi.NativeCAPISymbol.FUN_PY_OBJECT_GC_DEL; |
46 | 47 | import static com.oracle.graal.python.builtins.objects.cext.capi.NativeCAPISymbol.FUN_PY_TRUFFLE_MEMORYVIEW_FROM_OBJECT;
|
| 48 | +import static com.oracle.graal.python.builtins.objects.cext.capi.NativeCAPISymbol.FUN_PY_TYPE_GENERIC_ALLOC; |
47 | 49 | import static com.oracle.graal.python.builtins.objects.cext.structs.CConstants.PYLONG_BITS_IN_DIGIT;
|
48 | 50 | import static com.oracle.graal.python.builtins.objects.cext.structs.CFields.PyFloatObject__ob_fval;
|
49 | 51 | import static com.oracle.graal.python.builtins.objects.cext.structs.CFields.PyMethodDef__ml_doc;
|
@@ -872,16 +874,19 @@ public static PCallCapiFunction getUncached() {
|
872 | 874 | */
|
873 | 875 | @TruffleBoundary
|
874 | 876 | public static Object lookupNativeMemberInMRO(PythonManagedClass cls, @SuppressWarnings("unused") CFields nativeMemberName, HiddenAttr managedMemberName) {
|
875 |
| - if (cls instanceof PythonClass && (managedMemberName == HiddenAttr.ALLOC || managedMemberName == HiddenAttr.DEL)) { |
| 877 | + if (cls instanceof PythonClass && (managedMemberName == HiddenAttr.ALLOC || managedMemberName == HiddenAttr.FREE)) { |
876 | 878 | Object func = HiddenAttr.ReadNode.executeUncached(cls, managedMemberName, null);
|
877 | 879 | if (func != null) {
|
878 | 880 | return func;
|
879 | 881 | }
|
880 |
| - PythonObject object = PythonContext.get(null).lookupType(PythonBuiltinClassType.PythonObject); |
881 | 882 | // We need to point to PyType_GenericAlloc or PyObject_GC_Del
|
882 |
| - func = HiddenAttr.ReadNode.executeUncached(object, managedMemberName, NO_VALUE); |
883 |
| - HiddenAttr.WriteNode.executeUncached(cls, managedMemberName, func); |
884 |
| - return func; |
| 883 | + NativeCAPISymbol symbol; |
| 884 | + if (managedMemberName == HiddenAttr.ALLOC) { |
| 885 | + symbol = FUN_PY_TYPE_GENERIC_ALLOC; |
| 886 | + } else { |
| 887 | + symbol = FUN_PY_OBJECT_GC_DEL; |
| 888 | + } |
| 889 | + return CApiContext.getNativeSymbol(null, symbol); |
885 | 890 | }
|
886 | 891 | MroSequenceStorage mroStorage = GetMroStorageNode.executeUncached(cls);
|
887 | 892 | int n = mroStorage.length();
|
|
0 commit comments