summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeth M Morton <seth.m.morton@gmail.com>2016-06-04 13:16:04 -0700
committerSeth M Morton <seth.m.morton@gmail.com>2016-06-04 13:16:04 -0700
commitaaba1bf8227209d7640eba6de43438940a84d907 (patch)
tree8d4749f48234b4439cc08c04ede34b3da9a52cb9
parenta2a4f279440cf37d0160f97e5c05b1a233e50daf (diff)
downloadnatsort-optimized-python-patch.tar.gz
Fixed import bug when using python -OO.optimized-python-patch
The -OO flag removes docstrings (sets them to None), which caused issues with the doctoring compatability wrapper because it was trying to call .format on None. The wrapper has been modified to check for None. This should solve issue #38.
-rw-r--r--natsort/compat/py23.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/natsort/compat/py23.py b/natsort/compat/py23.py
index 31a2944..8155798 100644
--- a/natsort/compat/py23.py
+++ b/natsort/compat/py23.py
@@ -90,7 +90,8 @@ def _modify_str_or_docstring(str_change_func):
func = func_or_str
doc = func.__doc__
- doc = str_change_func(doc)
+ if doc is not None:
+ doc = str_change_func(doc)
if func:
func.__doc__ = doc