- Notifications
You must be signed in to change notification settings - Fork750
Closed
Description
Environment
- Pythonnet version: 3.0
- Python version: 3.x
- Operating System: Windows/Linux
- .NET Runtime: x
Details
Passing in a numpy array to a C# function that takes a double[] parameter fails.
python code:
test_array = np.array([123, 345], np.float)
CSharpClass.Test(test_array)
C# code
public static void Test(double[] TestData) {...}
I already have a fix for this issue.
In Runtime.cs, change PyFloat_Check(...) to
internal static bool PyFloat_Check(BorrowedReference ob) { return PyObject_TypeCheck(ob, PyFloatType); //return PyObject_TYPE(ob) == PyFloatType; // existing code }
This will convert any type that is derived from PyFloatType, which includes numpy.float64
Metadata
Metadata
Assignees
Labels
No labels