Check dimensions of arrays passed to C++ #5246
Closed
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.
Proposed fix for #5185.
This checks all arrays that must have particular dimensions to lessen the likelihood of addressing uninitialized memory.
This includes #5241. I waffled about that, but ultimately, I just can't buy that the behavior of Numpy's
atleast_3d
, or at least not for our use case here, so better to not use it. We could work around that behavior, but it gets rather messy. The changes here will at least turn the use ofatleast_3d
to pass arrays to the C++ side as an exception that we'll catch early, rather than accessing undefined memory.Replaces #5241 and #5245 (but I'm not closing those just yet in case those approaches are ultimately preferred).