From 4a4543be6cb6f675f08dbe01483199a3e3484087 Mon Sep 17 00:00:00 2001 From: "Nathaniel J. Smith" Date: Tue, 13 Jan 2015 19:23:04 +0000 Subject: [PATCH] Guard against missing docstrings under python -OO (Fixes #52) --- patsy/mgcv_cubic_splines.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/patsy/mgcv_cubic_splines.py b/patsy/mgcv_cubic_splines.py index 75c74ae..9c97f7d 100644 --- a/patsy/mgcv_cubic_splines.py +++ b/patsy/mgcv_cubic_splines.py @@ -705,7 +705,10 @@ class CR(CubicRegressionSpline): as implemented in the R package 'mgcv' (GAM modelling). """ - __doc__ += CubicRegressionSpline.common_doc + + # Under python -OO, __doc__ will be defined but set to None + if __doc__: + __doc__ += CubicRegressionSpline.common_doc def __init__(self): CubicRegressionSpline.__init__(self, name='cr', cyclic=False) @@ -732,7 +735,10 @@ class CC(CubicRegressionSpline): as implemented in the R package 'mgcv' (GAM modelling). """ - __doc__ += CubicRegressionSpline.common_doc + + # Under python -OO, __doc__ will be defined but set to None + if __doc__: + __doc__ += CubicRegressionSpline.common_doc def __init__(self): CubicRegressionSpline.__init__(self, name='cc', cyclic=True)