mirror of
https://github.com/pybind/pybind11.git
synced 2026-04-19 22:39:09 +00:00
fix: do not set docstring for function when empty (#2745)
* Do not set docstring for function when it's empty * No need to check pointer for `free` * Use ternary operator to conditionally set `ml_doc`
This commit is contained in:
@@ -45,6 +45,14 @@ TEST_SUBMODULE(docstring_options, m) {
|
||||
|
||||
m.def("test_function7", [](int, int) {}, py::arg("a"), py::arg("b"), "A custom docstring");
|
||||
|
||||
{
|
||||
py::options options;
|
||||
options.disable_user_defined_docstrings();
|
||||
options.disable_function_signatures();
|
||||
|
||||
m.def("test_function8", []() {});
|
||||
}
|
||||
|
||||
{
|
||||
py::options options;
|
||||
options.disable_user_defined_docstrings();
|
||||
|
||||
Reference in New Issue
Block a user