|
66 | 66 | import static com.oracle.graal.python.nodes.SpecialAttributeNames.__BASICSIZE__; |
67 | 67 | import static com.oracle.graal.python.nodes.SpecialAttributeNames.__DICTOFFSET__; |
68 | 68 | import static com.oracle.graal.python.nodes.SpecialAttributeNames.__ITEMSIZE__; |
| 69 | +import static com.oracle.graal.python.nodes.SpecialAttributeNames.__MODULE__; |
69 | 70 | import static com.oracle.graal.python.nodes.SpecialAttributeNames.__WEAKLISTOFFSET__; |
70 | 71 | import static com.oracle.graal.python.nodes.SpecialMethodNames.RICHCMP; |
71 | 72 | import static com.oracle.graal.python.nodes.SpecialMethodNames.__CALL__; |
|
152 | 153 | import com.oracle.graal.python.builtins.objects.type.TypeNodes.GetTypeFlagsNode; |
153 | 154 | import com.oracle.graal.python.lib.PyNumberAsSizeNode; |
154 | 155 | import com.oracle.graal.python.lib.PyObjectGetAttr; |
| 156 | +import com.oracle.graal.python.lib.PyObjectLookupAttr; |
155 | 157 | import com.oracle.graal.python.lib.PyObjectSizeNode; |
156 | 158 | import com.oracle.graal.python.nodes.ErrorMessages; |
157 | 159 | import com.oracle.graal.python.nodes.PGuards; |
@@ -1068,6 +1070,14 @@ static Object doPyCFunctionObjectMMl(PythonObject object, @SuppressWarnings("unu |
1068 | 1070 | return new PyMethodDefWrapper(object); |
1069 | 1071 | } |
1070 | 1072 |
|
| 1073 | + @Specialization(guards = {"eq(M_MODULE, key)", "isAnyFunctionObject(object)"}) |
| 1074 | + static Object doPyCFunctionObjectMModule(Object object, @SuppressWarnings("unused") PythonNativeWrapper nativeWrapper, @SuppressWarnings("unused") String key, |
| 1075 | + @Cached PyObjectLookupAttr lookup, |
| 1076 | + @Cached ToSulongNode toSulongNode) { |
| 1077 | + Object module = lookup.execute(null, object, __MODULE__); |
| 1078 | + return toSulongNode.execute(module != PNone.NO_VALUE ? module : PythonContext.get(toSulongNode).getNativeNull()); |
| 1079 | + } |
| 1080 | + |
1071 | 1081 | @Specialization(guards = "eq(M_SELF, key)") |
1072 | 1082 | static Object doPyCFunctionObjectMSelf(PBuiltinMethod object, @SuppressWarnings("unused") PythonNativeWrapper nativeWrapper, @SuppressWarnings("unused") String key, |
1073 | 1083 | @Cached ToSulongNode toSulongNode) { |
|
0 commit comments