Skip to content

Commit 2589283

Browse files
committed
Undo changes (i.e. revert back to master).
1 parent a5462ed commit 2589283

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

tests/test_eigen.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -201,14 +201,7 @@ TEST_SUBMODULE(eigen, m) {
201201
int start_row,
202202
int start_col,
203203
int block_rows,
204-
int block_cols) {
205-
// In case x is a copy made in the type_caster for Eigen::Ref
206-
// (https://pybind11.readthedocs.io/en/stable/advanced/cast/eigen.html#pass-by-reference),
207-
// returning the Eigen::Ref returned by x.block() will lead to heap-use-after-free,
208-
// because the block references the copy, which is destroyed when this function
209-
// returns. Therefore the block needs to be returned by value.
210-
return Eigen::MatrixXd{x.block(start_row, start_col, block_rows, block_cols)};
211-
});
204+
int block_cols) { return x.block(start_row, start_col, block_rows, block_cols); });
212205

213206
// test_eigen_return_references, test_eigen_keepalive
214207
// return value referencing/copying tests:

0 commit comments

Comments
 (0)