From 0757591de9fb318475b9520ee5453e78169d0581 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 5a6c76d3f..4b96110d8 100644 --- a/src/galois/_helper.py +++ b/src/galois/_helper.py @@ -109,6 +109,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