You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It looks like all numpy types are autoconverted to C++-level int/double/etc. as needed, with the exception of np.bool_. I'd think np.bool_ should likewise get autoconverted to a C++ bool.
Reproducible example code
Compiling the example repository pybind11/python_example with the following patch applied:
diff --git a/src/main.cpp b/src/main.cpp
index d81046d..8adbe25 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,6 +1,6 @@
#include <pybind11/pybind11.h>
-int add(int i, int j) {
+int add(int i, bool j) {
return i + j;
}
Then
python_example.add(np.int64(1), True)
works, but
python_example.add(1, np.bool_(True))
fails with a TypeError.
(initially reported on gitter)
The text was updated successfully, but these errors were encountered:
Issue description
It looks like all numpy types are autoconverted to C++-level int/double/etc. as needed, with the exception of np.bool_. I'd think np.bool_ should likewise get autoconverted to a C++ bool.
Reproducible example code
Compiling the example repository pybind11/python_example with the following patch applied:
Then
works, but
fails with a TypeError.
(initially reported on gitter)
The text was updated successfully, but these errors were encountered: