Coerce inspect.getdoc() None to empty string before parsing

`inspect.getdoc()` returns `str | None`, but `docstring_parser.parse()`
requires `str`. Functions without a docstring produced `None`, which
the type checker correctly flagged.

Coerce to `""` at the call site. `docstring_parser.parse("")` returns
an empty docstring whose `.description` and `.params` are already
handled by the surrounding `or ""` fallbacks, so runtime behavior is
unchanged.
This commit is contained in:
Mark Backman
2026-04-22 12:01:00 -04:00
parent 8ec56092c0
commit 10b86b4bbe
2 changed files with 9 additions and 4 deletions

View File

@@ -127,7 +127,7 @@ class BaseDirectFunctionWrapper:
self.name = self.function.__name__
# Parse docstring for description and parameters
docstring = docstring_parser.parse(inspect.getdoc(self.function))
docstring = docstring_parser.parse(inspect.getdoc(self.function) or "")
# Get function description
self.description = (docstring.description or "").strip()