diff --git a/include/pybind11/pytypes.h b/include/pybind11/pytypes.h index cb77cc8184..2e871ed4b3 100644 --- a/include/pybind11/pytypes.h +++ b/include/pybind11/pytypes.h @@ -2568,8 +2568,7 @@ str_attr_accessor object_api::doc() const { template // Always a dict object object_api::annotations() const { - dict annotations_dict = getattr(derived(), "__annotations__", dict()); - return std::move(annotations_dict); + return getattr(derived(), "__annotations__", dict()); } template diff --git a/tests/test_pytypes.py b/tests/test_pytypes.py index 9db6a36fe3..40cba7c8e7 100644 --- a/tests/test_pytypes.py +++ b/tests/test_pytypes.py @@ -1104,6 +1104,7 @@ def test_dict_ranges(tested_dict, expected): def get_annotations_helper(o): + print(help(o)) return getattr(o, "__annotations__", None)