Skip to content

[BUG] py::move() is untested? #2468

Closed
Closed
@EricCousineau-TRI

Description

@EricCousineau-TRI

Issue description

I am updating my fork of pybind11 in this PR (where I have futzed with rvalue casting and unique_ptr):
RobotLocomotion#43
And I run into this error with py::move():
https://github.com/RobotLocomotion/pybind11/pull/43/checks?check_run_id=1074299373#step:7:71

I started manually bisecting, and I briefly got confused by the existing implementation of py::move here:
https://github.com/pybind/pybind11/blob/1caf1d06/include/pybind11/cast.h#L1755

Reproducible example code

If I try to grep for non-std::move() occurrences in the SHA I'm trying to update to (1caf1d0), the only place I see it is in the aforementioned definition:

$ cd pybind11
$ git log -n 1 --oneline --no-decorate
1caf1d06 fix: check list validity and add missing file (#2352)
$ grep -rnI -P '\b(?<!std::)move\(' .
./include/pybind11/cast.h:1755:detail::enable_if_t<!detail::move_never<T>::value, T> move(object &&obj) {

Suggested Solutions

Either remove the untested code, or add a test.

\cc @rwgk

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions