Commit 4a5fd51
Fix TypeError when cls.__module__ is None (#770)
* Fix TypeError when cls.__module__ is None
Trying to use `pdoc -o` instead of `pdoc` in my project caused a long
stacktrace with this error at the end:
File "/Users/feuh/.../.venv/lib/python3.12/site-packages/pdoc/doc.py", line 640, in _var_annotations
_safe_getattr(cls, "__module__", "") + "." + cls.__qualname__
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
This was caused by one class' `__module__` attribute being `None`.
I could not find the reason why that happens and why it happens only
when using `-o`, but this change ensures it won't happen again.
* add parentheses
---------
Co-authored-by: Maximilian Hils <[email protected]>1 parent 2746a02 commit 4a5fd51
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
637 | 637 | | |
638 | 638 | | |
639 | 639 | | |
640 | | - | |
| 640 | + | |
641 | 641 | | |
642 | 642 | | |
643 | 643 | | |
| |||
0 commit comments