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

bug fix: avoid descriptor exceptions on 0d arrays (e.g. strings) #121

Merged
merged 3 commits into from
Sep 18, 2020

Conversation

jooh
Copy link
Contributor

@jooh jooh commented Sep 18, 2020

check_descriptor_length casts each descriptor value to np.array. This can result in 0-d arrays if the input is str. The subsequent check on shape[0] then triggers an exception because 0-d arrays are weird and have no shape elements.

So I fixed that by flattening the array whenever the shape is empty. I also added a test.

Finally, I snuck in a stylistic change - single character variable names are rarely a good idea, and when the character clashes with a common pdb shortcut it's really ill advised.

Copy link
Contributor

@HeikoSchuett HeikoSchuett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for writing a test immediately. looks good and I am happy to remove the n

Copy link
Contributor

@JasperVanDenBosch JasperVanDenBosch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@JasperVanDenBosch JasperVanDenBosch merged commit 858721b into rsagroup:master Sep 18, 2020
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.

3 participants