Fix copying BitArray in immediate operators in python bindings

This commit is contained in:
Matthias Hochsteger 2024-09-12 11:11:15 +02:00
parent cef04cfd2a
commit 67a67a453d

View File

@ -141,10 +141,16 @@ PYBIND11_MODULE(pyngcore, m) // NOLINT
.def(py::self | py::self) .def(py::self | py::self)
.def(py::self & py::self) .def(py::self & py::self)
// .def(py::self |= py::self) // false clang warnings, #ifdef __clang__
// .def(py::self &= py::self) // see https://github.com/pybind/pybind11/issues/1893 // see https://github.com/pybind/pybind11/issues/1893
.def("__ior__", [](BitArray& lhs, const BitArray& rhs) { return lhs |= rhs; }, py::is_operator()) #pragma GCC diagnostic push
.def("__iand__", [](BitArray& lhs, const BitArray& rhs) { return lhs &= rhs; }, py::is_operator()) #pragma GCC diagnostic ignored "-Wself-assign-overloaded"
#endif
.def(py::self |= py::self)
.def(py::self &= py::self)
#ifdef __clang__
#pragma GCC diagnostic pop
#endif
.def(~py::self) .def(~py::self)
; ;