Fix illegal instruction on osx-64 when returning 0 length arrays #1846
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.
Description
Replace
&vector[0]
withvector->data()
.data()
is undefined for 0 length vectors, so also add in a separate code path to return numpy managed arrays when they are 0 length.Motivation and context
I don't understand why this didn't cause problems sooner. The 4.8.0 builds fail with an illegal instruction on the osx-64 platform: https://dev.azure.com/conda-forge/feedstock-builds/_build/results?buildId=980051&view=logs&j=9c5ef928-2cd6-52e5-dbe6-9d173a7d951b&t=20c71c51-4b27-578b-485d-06ade2de1d00&l=6682
How has this been tested?
I applied this diff as a patch in a test PR and the build now passes:
https://dev.azure.com/conda-forge/feedstock-builds/_build/results?buildId=980708&view=logs&j=9c5ef928-2cd6-52e5-dbe6-9d173a7d951b&t=20c71c51-4b27-578b-485d-06ade2de1d00
Change log
Checklist:
sphinx-doc/credits.rst
) in the pull request source branch.