|
40 | 40 | */
|
41 | 41 | package com.oracle.graal.python.builtins.modules.ctypes;
|
42 | 42 |
|
| 43 | +import static com.oracle.graal.python.builtins.PythonBuiltinClassType.NotImplementedError; |
43 | 44 | import static com.oracle.graal.python.builtins.PythonBuiltinClassType.RuntimeError;
|
44 | 45 | import static com.oracle.graal.python.builtins.modules.ctypes.CDataTypeBuiltins.T__HANDLE;
|
45 | 46 | import static com.oracle.graal.python.builtins.modules.ctypes.CtypesModuleBuiltins.FUNCFLAG_CDECL;
|
|
126 | 127 | import com.oracle.graal.python.runtime.PythonContext;
|
127 | 128 | import com.oracle.graal.python.runtime.exception.PException;
|
128 | 129 | import com.oracle.graal.python.runtime.object.PythonObjectFactory;
|
| 130 | +import com.oracle.truffle.api.CompilerDirectives; |
129 | 131 | import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
|
130 | 132 | import com.oracle.truffle.api.dsl.Bind;
|
131 | 133 | import com.oracle.truffle.api.dsl.Cached;
|
@@ -499,6 +501,11 @@ Object PyCFuncPtr_call(VirtualFrame frame, PyCFuncPtrObject self, Object[] inarg
|
499 | 501 |
|
500 | 502 | int[] props = new int[3];
|
501 | 503 | NativeFunction pProc = handleFromPointerNode.getNativeFunction(inliningTarget, readPointerNode.execute(inliningTarget, self.b_ptr));
|
| 504 | + if (pProc == null) { |
| 505 | + CompilerDirectives.transferToInterpreterAndInvalidate(); |
| 506 | + // TODO this happens in numpy/core/tests/test_ufunc.py::TestLowlevelAPIAccess::test_loop_access |
| 507 | + throw PRaiseNode.raiseUncached(inliningTarget, NotImplementedError, ErrorMessages.CTYPES_FUNCTION_CALL_COULD_NOT_OBTAIN_FUNCTION_POINTER); |
| 508 | + } |
502 | 509 | Object[] callargs = _build_callargs(frame, inliningTarget, self, argtypes, inargs, kwds, props,
|
503 | 510 | pyTypeCheck, getArray, castToJavaIntExactNode, castToTruffleStringNode, pyTypeStgDictNode, callNode, getNameNode, equalNode);
|
504 | 511 | int inoutmask = props[pinoutmask_idx];
|
|
0 commit comments