chiark / gitweb /
documentation/python: attrs does bad things and I'm not happy about that.
authorVladimír Vondruš <mosra@centrum.cz>
Sun, 14 Jul 2019 12:13:23 +0000 (14:13 +0200)
committerVladimír Vondruš <mosra@centrum.cz>
Sun, 14 Jul 2019 17:11:08 +0000 (19:11 +0200)
documentation/python.py

index 97a8ac94120593f2086deefbfc47a6c4eabd0596..ef94bf71162da6b63f2f7f8288ec4e73461bc75f 100755 (executable)
@@ -913,7 +913,10 @@ def extract_function_doc(state: State, parent, path: List[str], function) -> Lis
     # What's not solvable with metadata, however, are function overloads ---
     # one function in Python may equal more than one function on the C++ side.
     # To make the docs usable, list all overloads separately.
-    if state.config['PYBIND11_COMPATIBILITY'] and function.__doc__.startswith(path[-1]):
+    #
+    # Some shitty packages might be setting __doc__ to None (attrs is one of
+    # them), explicitly check for that first.
+    if state.config['PYBIND11_COMPATIBILITY'] and function.__doc__ and function.__doc__.startswith(path[-1]):
         funcs = parse_pybind_docstring(state, path, function.__doc__)
         overloads = []
         for name, summary, args, type in funcs: