From: Vladimír Vondruš Date: Wed, 5 Jan 2022 18:18:36 +0000 (+0100) Subject: documentation/python: ignore enum values when checking for duplicates. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~cjwatson/git?a=commitdiff_plain;h=0b6497481836a8e9ac57b4e8ee7cb208a2a371d8;p=blog.git documentation/python: ignore enum values when checking for duplicates. The test now passes again. --- diff --git a/documentation/python.py b/documentation/python.py index d29ee660..ce56d196 100755 --- a/documentation/python.py +++ b/documentation/python.py @@ -400,7 +400,10 @@ def crawl_class(state: State, path: List[str], class_): # one would hope so we can't just assert. if id(class_) in state.crawled: for name, previous_entry in state.name_map.items(): - if id(previous_entry.object) == id(class_): break + # Enum value entries don't have the object property, don't try to + # match them + if hasattr(previous_entry, 'object') and id(previous_entry.object) == id(class_): + break else: assert False, "%s marked as crawled but can't find it" % '.'.join(path) logging.error("Class %s previously found in %s, only one occurence will be chosen. Ensure each class is exposed only in a single module for generating correct documentation.", '.'.join(path), '.'.join(previous_entry.path)) state.name_map['.'.join(path)] = previous_entry