Skip to content

Commit

Permalink
Check for and handle None docstrings
Browse files Browse the repository at this point in the history
CPython's -OO flag optimizes out docstrings sets them to None.
  • Loading branch information
Justin Charlong committed Jun 6, 2024
1 parent 25baec4 commit edf157e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/galois/_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit edf157e

Please sign in to comment.