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