Skip to content

Commit

Permalink
BUG: Fix a fatal error preventing documentation generation in some ca…
Browse files Browse the repository at this point in the history
…ses (#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
  • Loading branch information
mn3mos authored Jun 22, 2024
1 parent 4eb45b5 commit 3bf1cd8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pdoc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -686,9 +686,10 @@ def __init__(self, module: Union[ModuleType, str], *,
except AttributeError:
warn(f"Module {self.module!r} doesn't contain identifier `{name}` "
"exported in `__all__`")
if not _is_blacklisted(name, self):
obj = inspect.unwrap(obj)
public_objs.append((name, obj))
else:
if not _is_blacklisted(name, self):
obj = inspect.unwrap(obj)
public_objs.append((name, obj))
else:
def is_from_this_module(obj):
mod = inspect.getmodule(inspect.unwrap(obj))
Expand Down

0 comments on commit 3bf1cd8

Please sign in to comment.