From: Vladimír Vondruš Date: Wed, 4 Sep 2019 18:37:15 +0000 (+0200) Subject: documentation/python: avoid blowing up on __name__ not being an attrib. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~cjwatson/git?a=commitdiff_plain;h=6b78a2f35249c2506cb5a7bcf5b01ef39072f13d;p=blog.git documentation/python: avoid blowing up on __name__ not being an attrib. Don't want to test for this, seems too obscure. --- diff --git a/documentation/python.py b/documentation/python.py index 25ae8388..c7c74440 100755 --- a/documentation/python.py +++ b/documentation/python.py @@ -487,7 +487,9 @@ def crawl_module(state: State, path: List[str], module) -> List[Tuple[List[str], if inspect.ismodule(object) and object.__name__ != '.'.join(subpath): assert object.__name__ not in state.name_mapping state.name_mapping[object.__name__] = '.'.join(subpath) - elif hasattr(object, '__module__'): + # logging.Logger objects have __module__ but don't have __name__, + # check both + elif hasattr(object, '__module__') and hasattr(object, '__name__'): subname = object.__module__ + '.' + object.__name__ if subname != '.'.join(subpath): assert subname not in state.name_mapping