@@ -1972,29 +1972,32 @@ struct enum_base {
19721972 name (" name" ),
19731973 is_method (m_base));
19741974
1975- m_base.attr (" __doc__" ) = static_property (
1976- cpp_function (
1977- [](handle arg) -> std::string {
1978- std::string docstring;
1979- dict entries = arg.attr (" __entries" );
1980- if (((PyTypeObject *) arg.ptr ())->tp_doc ) {
1981- docstring += std::string (((PyTypeObject *) arg.ptr ())->tp_doc ) + " \n\n " ;
1982- }
1983- docstring += " Members:" ;
1984- for (auto kv : entries) {
1985- auto key = std::string (pybind11::str (kv.first ));
1986- auto comment = kv.second [int_ (1 )];
1987- docstring += " \n\n " + key;
1988- if (!comment.is_none ()) {
1989- docstring += " : " + (std::string) pybind11::str (comment);
1975+ if (options::show_enum_members_docstring ()) {
1976+ m_base.attr (" __doc__" ) = static_property (
1977+ cpp_function (
1978+ [](handle arg) -> std::string {
1979+ std::string docstring;
1980+ dict entries = arg.attr (" __entries" );
1981+ if (((PyTypeObject *) arg.ptr ())->tp_doc ) {
1982+ docstring
1983+ += std::string (((PyTypeObject *) arg.ptr ())->tp_doc ) + " \n\n " ;
19901984 }
1991- }
1992- return docstring;
1993- },
1994- name (" __doc__" )),
1995- none (),
1996- none (),
1997- " " );
1985+ docstring += " Members:" ;
1986+ for (auto kv : entries) {
1987+ auto key = std::string (pybind11::str (kv.first ));
1988+ auto comment = kv.second [int_ (1 )];
1989+ docstring += " \n\n " + key;
1990+ if (!comment.is_none ()) {
1991+ docstring += " : " + (std::string) pybind11::str (comment);
1992+ }
1993+ }
1994+ return docstring;
1995+ },
1996+ name (" __doc__" )),
1997+ none (),
1998+ none (),
1999+ " " );
2000+ }
19982001
19992002 m_base.attr (" __members__" ) = static_property (cpp_function (
20002003 [](handle arg) -> dict {
0 commit comments