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

Move std::vector methods above scalar methods in bindings #280

Merged
merged 1 commit into from
Jun 30, 2023

Conversation

mgeplf
Copy link
Contributor

@mgeplf mgeplf commented Jun 30, 2023

  • Otherwise, numpy coercion kicks in, and an argument like np.asarray([42]) gets coerced to 42, the scalar binding is used, and then we convert it to a std::vector internally.

  • not only is this inefficient, newer numpy versions emit:

    DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future.
    Ensure you extract a single element from your array before performing this operation.
    (Deprecated NumPy 1.25.)

* Otherwise, numpy coercion kicks in, and an argument like
  `np.asarray([42])` gets coerced to 42, the scalar binding
  is used, and then we convert it to a std::vector internally.
* not only is this inefficient, newer numpy versions emit:

    DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future.
    Ensure you extract a single element from your array before performing this operation.
    (Deprecated NumPy 1.25.)
@mgeplf
Copy link
Contributor Author

mgeplf commented Jun 30, 2023

fixes #279

@mgeplf mgeplf merged commit 54ebbdb into master Jun 30, 2023
@mgeplf mgeplf deleted the fix-numpy-125 branch June 30, 2023 10:59
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

Successfully merging this pull request may close these issues.

2 participants