|
39 | 39 | _URL_INDEX_MODULE_SUFFIX = '.m.html' # For modules named literal 'index'
|
40 | 40 | _URL_PACKAGE_SUFFIX = '/index.html'
|
41 | 41 |
|
| 42 | +# type.__module__ can be None by the Python spec. In those cases, use this value |
| 43 | +_UNKNOWN_MODULE = '?' |
| 44 | + |
42 | 45 | T = TypeVar('T', bound='Doc')
|
43 | 46 |
|
44 | 47 | __pdoc__ = {} # type: Dict[str, Union[bool, str]]
|
@@ -726,7 +729,7 @@ def find_class(self, cls: type):
|
726 | 729 | # XXX: Is this corrent? Does it always match
|
727 | 730 | # `Class.module.name + Class.qualname`?. Especially now?
|
728 | 731 | # If not, see what was here before.
|
729 |
| - return self.find_ident(cls.__module__ + '.' + cls.__qualname__) |
| 732 | + return self.find_ident((cls.__module__ or _UNKNOWN_MODULE) + '.' + cls.__qualname__) |
730 | 733 |
|
731 | 734 | def find_ident(self, name: str) -> Doc:
|
732 | 735 | """
|
@@ -1131,7 +1134,7 @@ def safe_default_value(p: inspect.Parameter):
|
1131 | 1134 | if isinstance(value, enum.Enum):
|
1132 | 1135 | replacement = str(value)
|
1133 | 1136 | elif inspect.isclass(value):
|
1134 |
| - replacement = value.__module__ + '.' + value.__qualname__ |
| 1137 | + replacement = (value.__module__ or _UNKNOWN_MODULE) + '.' + value.__qualname__ |
1135 | 1138 | elif ' at 0x' in repr(value):
|
1136 | 1139 | replacement = re.sub(r' at 0x\w+', '', repr(value))
|
1137 | 1140 |
|
|
0 commit comments