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 authored and mhostetter committed Jun 10, 2024
1 parent 1d3f84f commit 0757591
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 @@ -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
Expand Down

0 comments on commit 0757591

Please sign in to comment.