mirror of
https://github.com/RYDE-WORK/pybind11.git
synced 2026-01-21 06:05:32 +08:00
This fixes a bug introduced in b68959e822a619d1ad140f52c7197a29f4e6a06a when passing in a two-dimensional, but conformable, array as the value for a compile-time Eigen vector (such as VectorXd or RowVectorXd). The commit switched to using numpy to copy into the eigen data, but this broke the described case because numpy refuses to broadcast a (N,1) into a (N). This commit fixes it by squeezing the input array whenever the output array is 1-dimensional, which will let the problematic case through. (This shouldn't squeeze inappropriately as dimension compatibility is already checked for conformability before getting to the copy code).