From edf157ebcdc8aaedee208605b41976d89455614b Mon Sep 17 00:00:00 2001 From: Justin Charlong Date: Thu, 6 Jun 2024 13:28:18 -0400 Subject: [PATCH] Check for and handle None docstrings CPython's -OO flag optimizes out docstrings sets them to None. --- src/galois/_helper.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/galois/_helper.py b/src/galois/_helper.py index 0e15d0bd5..2c31c8675 100644 --- a/src/galois/_helper.py +++ b/src/galois/_helper.py @@ -108,6 +108,8 @@ def extend_docstring(method, replace=None, docstring=""): def decorator(obj): parent_docstring = getattr(method, "__doc__", "") + if parent_docstring is None: + return obj for from_str, to_str in replace.items(): parent_docstring = parent_docstring.replace(from_str, to_str) obj.__doc__ = parent_docstring + "\n" + docstring