GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — `PyBuffer.GetPointer` throws exception for N-dimensional buffer · Issue #2743 · pythonnet/pythonnet Closed Labels Description
dynamic np = Py.Import("numpy"); // create 3D NumPy array int[] shape = [10, 10, 10]; PyObject ndArray = np.zeros(shape); PyBuffer buf = ndArray.GetBuffer(PyBUF.ND); // this throws System.ExecutionEngineException nint ptr = buf.GetPointer([0, 0, 0]); I suspect that this may be caused by a mismatch of a type. The following code seems to pass a CLR array to native function pointer. // src/runtime/Runtime.Delegates.cs PyBuffer_GetPointer = (delegate* unmanaged[Cdecl]<ref Py_buffer, nint[], IntPtr>)GetFunctionByName(nameof(PyBuffer_GetPointer), GetUnmanagedDll(_PythonDll)); The second argument should be My environment:
Activity
MetadataMetadataAssigneesLabelsTypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |