Skip to content

Commit 0702a5e

Browse files
authored
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.
1 parent 72e41db commit 0702a5e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: pdoc/__init__.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -680,12 +680,12 @@ def __init__(self, module: Union[ModuleType, str], *, docfilter: Callable[[Doc],
680680
for name in self.obj.__all__:
681681
try:
682682
obj = getattr(self.obj, name)
683+
if not _is_blacklisted(name, self):
684+
obj = inspect.unwrap(obj)
685+
public_objs.append((name, obj))
683686
except AttributeError:
684687
warn(f"Module {self.module!r} doesn't contain identifier `{name}` "
685688
"exported in `__all__`")
686-
if not _is_blacklisted(name, self):
687-
obj = inspect.unwrap(obj)
688-
public_objs.append((name, obj))
689689
else:
690690
def is_from_this_module(obj):
691691
mod = inspect.getmodule(inspect.unwrap(obj))

0 commit comments

Comments
 (0)