diff --git a/include/pybind11/pytypes.h b/include/pybind11/pytypes.h index 7d7cd9f6..48e3d1f3 100644 --- a/include/pybind11/pytypes.h +++ b/include/pybind11/pytypes.h @@ -264,6 +264,7 @@ inline pybind11::str handle::str() const { class bool_ : public object { public: PYBIND11_OBJECT_DEFAULT(bool_, object, PyBool_Check) + bool_(bool value) : object(value ? Py_True : Py_False, true) { } operator bool() const { return m_ptr && PyLong_AsLong(m_ptr) != 0; } };