-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Check dimensions of arrays passed to C++, handle 0 dimensions #5274
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
Conversation
Check the dimensions on arrays passed to C++ to ensure they are what we expect.
👍 |
@@ -358,7 +358,7 @@ void get_path_collection_extents(agg::trans_affine &master_transform, | |||
agg::trans_affine &offset_trans, | |||
extent_limits &extent) | |||
{ | |||
if (offsets.dim(0) != 0 && offsets.dim(1) != 2) { | |||
if (offsets.size() != 0 && offsets.dim(1) != 2) { |
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.
I'm not sure if this needed changing, but it doesn't hurt aside from a vague feeling of asymmetry.
👍 Should there be a note in the documentation recommending the use of |
I've added a comment about size(). We don't really have formal documentation about our internal C++ APIs outside of header comments. |
Check dimensions of arrays passed to C++, handle 0 dimensions
Check dimensions of arrays passed to C++, handle 0 dimensions
Backported to 1.5.x as f529327 |
This is a combination of #5264 and #5246 that doesn't require #5241, and thus should be more robust to unusual arrays that Numpy creates with 0 dimensions in the middle somewhere.
Fixes #5185