Skip to content

Commit 4a4543b

Browse files
committed
Guard against missing docstrings under python -OO (Fixes #52)
1 parent e6cf049 commit 4a4543b

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

patsy/mgcv_cubic_splines.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,10 @@ class CR(CubicRegressionSpline):
705705
as implemented in the R package 'mgcv' (GAM modelling).
706706
707707
"""
708-
__doc__ += CubicRegressionSpline.common_doc
708+
709+
# Under python -OO, __doc__ will be defined but set to None
710+
if __doc__:
711+
__doc__ += CubicRegressionSpline.common_doc
709712

710713
def __init__(self):
711714
CubicRegressionSpline.__init__(self, name='cr', cyclic=False)
@@ -732,7 +735,10 @@ class CC(CubicRegressionSpline):
732735
as implemented in the R package 'mgcv' (GAM modelling).
733736
734737
"""
735-
__doc__ += CubicRegressionSpline.common_doc
738+
739+
# Under python -OO, __doc__ will be defined but set to None
740+
if __doc__:
741+
__doc__ += CubicRegressionSpline.common_doc
736742

737743
def __init__(self):
738744
CubicRegressionSpline.__init__(self, name='cc', cyclic=True)

0 commit comments

Comments
 (0)