Repository navigation
Fix io.fits failure on 32-bit systems - #5078
Conversation
… buffer interface (this occurs e.g. on Ubuntu 32-bit).
|
I'm marking this as 'no changelog entry needed' for now because I'm not aware of any real-life cases where this caused issues. However, I could always add one if needed. |
|
@eteq - does this looks reasonable? (this PR has been open for a while, but no feedback, so would like to go ahead and merge, but not comfortable doing that without review) |
| `numpy.ndarray.tofile`). | ||
| """ | ||
|
|
||
| if len(arr) == 0: |
There was a problem hiding this comment.
According to PEP8 one generally uses if not len(arr): (or if not arr.size) instead of directly comparing it with == 0.
As a side note: What does this line fix? Could you add a short comment why it is necessary or convenient?
There was a problem hiding this comment.
I think the code is fine as-is personally, I don't think if not len(arr) is as readable...
There was a problem hiding this comment.
For scientific code especially I prefer len(...) == 0 because the expectation is more explicit.
There was a problem hiding this comment.
@MSeifert04 I added a comment - this is just a shortcut to avoid executing the rest of the function.
|
I'll go ahead and merge this since @embray 👍 'd this above |
Fix io.fits failure on 32-bit systems
This fixes the
TypeError: 'buffer' does not have the buffer interfacetest failures that occurred in io.fits on 32-bit Linux systems (see #3380).@embray - could you review this?