Skip to content

Commit 3bf1cd8

Browse files
authored
BUG: Fix a fatal error preventing documentation generation in some cases (#302)
* Update __init__.py Got a fatal exception on this line, which prevented the generation of the documentation. The problem is that some variable is initialized in a try bloc but still used out of it afterwards. If the getattr fails line 682 - which was my problem - then the variable is used without being initialized, which lead to fatal error. * Use `try-else` block
1 parent 4eb45b5 commit 3bf1cd8

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Diff for: pdoc/__init__.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -686,9 +686,10 @@ def __init__(self, module: Union[ModuleType, str], *,
686686
except AttributeError:
687687
warn(f"Module {self.module!r} doesn't contain identifier `{name}` "
688688
"exported in `__all__`")
689-
if not _is_blacklisted(name, self):
690-
obj = inspect.unwrap(obj)
691-
public_objs.append((name, obj))
689+
else:
690+
if not _is_blacklisted(name, self):
691+
obj = inspect.unwrap(obj)
692+
public_objs.append((name, obj))
692693
else:
693694
def is_from_this_module(obj):
694695
mod = inspect.getmodule(inspect.unwrap(obj))

0 commit comments

Comments
 (0)