Skip to content

Commit c2456d9

Browse files
committed
Apply suggestions by @Skylion007
1 parent 6ec5447 commit c2456d9

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

include/pybind11/pybind11.h

+7-4
Original file line numberDiff line numberDiff line change
@@ -1979,16 +1979,19 @@ struct enum_base {
19791979
std::string docstring;
19801980
dict entries = arg.attr("__entries");
19811981
if (((PyTypeObject *) arg.ptr())->tp_doc) {
1982-
docstring
1983-
+= std::string(((PyTypeObject *) arg.ptr())->tp_doc) + "\n\n";
1982+
docstring += std::string(
1983+
reinterpret_cast<PyTypeObject *>(arg.ptr())->tp_doc);
1984+
docstring += "\n\n";
19841985
}
19851986
docstring += "Members:";
19861987
for (auto kv : entries) {
19871988
auto key = std::string(pybind11::str(kv.first));
19881989
auto comment = kv.second[int_(1)];
1989-
docstring += "\n\n " + key;
1990+
docstring += "\n\n ";
1991+
docstring += key;
19901992
if (!comment.is_none()) {
1991-
docstring += " : " + (std::string) pybind11::str(comment);
1993+
docstring += " : ";
1994+
docstring += pybind11::str(comment).cast<std::string>();
19921995
}
19931996
}
19941997
return docstring;

0 commit comments

Comments
 (0)