Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NumPyScalar is not implemented for all types that implement numpy::Element #97

Open
jsutton24 opened this issue Oct 31, 2024 · 1 comment

Comments

@jsutton24
Copy link

Certain types cannot be used as numpy array element types in method signatures. Specifically:

  • PyObject
  • bf16
  • bool
  • f16
  • i16
  • isize
  • usize

I came across this issue while trying to use numpy::PyArray1<bool>:

error[E0277]: the trait bound `bool: pyo3_stub_gen::stub_type::numpy::NumPyScalar` is not satisfied
    |
279 |     ) -> PyResult<Bound<'py, PyArray1<bool>>> {
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `pyo3_stub_gen::stub_type::numpy::NumPyScalar` is not implemented for `bool`, which is required by `pyo3::Bound<'_, numpy::PyArray<bool, numpy::ndarray::Dim<[usize; 1]>>>: pyo3_stub_gen::PyStubType`
@jsutton24
Copy link
Author

The fix looks like it ought to be simple, just adding the missing types to the existing set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant