Skip to content

Commit

Permalink
BUG: Fix Module.is_namespace crash on dynamic/generated modules
Browse files Browse the repository at this point in the history
  • Loading branch information
kernc committed Apr 16, 2020
1 parent 2f3db5f commit 0380950
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pdoc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,10 @@ def is_namespace(self) -> bool:
"""
`True` if this module is a namespace package.
"""
return self.obj.__spec__.origin in (None, 'namespace') # None in Py3.7+
try:
return self.obj.__spec__.origin in (None, 'namespace') # None in Py3.7+
except AttributeError:
return False

def find_class(self, cls: type) -> Doc:
"""
Expand Down

0 comments on commit 0380950

Please sign in to comment.