Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Finalise support for Numpy 2.0 #11999
Finalise support for Numpy 2.0 #11999
Changes from 2 commits
c092aa1
65adaca
00617e1
c4103b7
09c11df
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the previous
__array__
, the default ofcopy
isNone
, here it is_numpy_compat.COPY_ONLY_IF_NEEDED
is that fine?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we pass the
copy
argument directly to a Numpy function, we need to use the compatibility variable so that if a user has Numpy 1.x installed, they won't get errors (passingcopy=None
is an error in Numpy 1.x). If we don't use thecopy
argument, or we only look at it ourselves, it's fine to useNone
. Numpy 1.x never sets thecopy
argument to__array__
(because it doesn't exist in the protocol in 1.x).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I just realised that the previous
__array__
you're referring to is the one inqiskit.circuit
. That's actually just an example in the middle of a docstring, so matching the now-suggested Numpy API exactly is probably best.