Commit 8b029a5
committed
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.1 parent 485d9fa commit 8b029a5
1 file changed
+2
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1307 | 1307 | | |
1308 | 1308 | | |
1309 | 1309 | | |
1310 | | - | |
| 1310 | + | |
| 1311 | + | |
1311 | 1312 | | |
1312 | 1313 | | |
1313 | 1314 | | |
| |||
0 commit comments