Use py::handle instead of py::object to avoid clang-tidy errors.

This commit is contained in:
Ralf W. Grosse-Kunstleve 2023-11-14 23:46:42 -08:00
parent 79f6bdca36
commit 2376f6e953

View File

@ -106,13 +106,13 @@ void bind_basics(py::module &basics) {
[](Point &self) { return self.y; }, [](Point &self) { return self.y; },
[](Point &self, double value) { self.y = value; }) [](Point &self, double value) { self.y = value; })
.def_property_readonly("length", &Point::length) .def_property_readonly("length", &Point::length)
.def_property_readonly_static("x_axis", [](py::object /*cls*/) { return Point::x_axis; }) .def_property_readonly_static("x_axis", [](py::handle /*cls*/) { return Point::x_axis; })
.def_property_readonly_static("y_axis", [](py::object /*cls*/) { return Point::y_axis; }) .def_property_readonly_static("y_axis", [](py::handle /*cls*/) { return Point::y_axis; })
.def_readwrite_static("length_unit", &Point::length_unit) .def_readwrite_static("length_unit", &Point::length_unit)
.def_property_static( .def_property_static(
"angle_unit", "angle_unit",
[](py::object & /*cls*/) { return Point::angle_unit; }, [](py::handle /*cls*/) { return Point::angle_unit; },
[](py::object & /*cls*/, Point::AngleUnit value) { Point::angle_unit = value; }); [](py::handle /*cls*/, Point::AngleUnit value) { Point::angle_unit = value; });
pyPoint.attr("origin") = Point::origin; pyPoint.attr("origin") = Point::origin;