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: Prevent crash for length-0 input to fromrecords #8486

Merged
merged 1 commit into from
Jan 18, 2017

Conversation

eric-wieser
Copy link
Member

When the dtype is provided, passing a length-0 input is perfectly sensible

@charris
Copy link
Member

charris commented Jan 17, 2017

@ahaldane Piing.

@ahaldane
Copy link
Member

Sure, it looks like an improvement.

I briefly thought about unintended consequences (eg, what can happens if someone puts in variable-length tuples) but I didn't see any problems.

@eric-wieser Could you squash to commits together? I'd also prefer a little one-line test somewhere. I would tack it on in the end of test_fromrecords in test_records.py.

This fixes:
 * The case when len(recList) == 0 and dtype is not None
 * The case when np.ndim(recList) > 1

In both cases, this would previously IndexError
@eric-wieser
Copy link
Member Author

eric-wieser commented Jan 17, 2017

@ahaldane: Tests added, and passing, and all three commits squashed

@ahaldane
Copy link
Member

LGTM, and nice extra tests.

Merging. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants