mirror of
https://github.com/pybind/pybind11.git
synced 2026-04-20 06:49:25 +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:
@@ -34,6 +34,9 @@ def test_docstring_options():
|
||||
assert m.test_function7.__doc__.startswith("test_function7(a: int, b: int) -> None")
|
||||
assert m.test_function7.__doc__.endswith("A custom docstring\n")
|
||||
|
||||
# when all options are disabled, no docstring (instead of an empty one) should be generated
|
||||
assert m.test_function8.__doc__ is None
|
||||
|
||||
# Suppression of user-defined docstrings for non-function objects
|
||||
assert not m.DocstringTestFoo.__doc__
|
||||
assert not m.DocstringTestFoo.value_prop.__doc__
|
||||
|
||||
Reference in New Issue
Block a user