summaryrefslogtreecommitdiffstats
path: root/Lib/inspect.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/inspect.py')
-rw-r--r--Lib/inspect.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py
index 6039d4e..5758abd 100644
--- a/Lib/inspect.py
+++ b/Lib/inspect.py
@@ -368,6 +368,13 @@ def getdoc(object):
return None
if not isinstance(doc, str):
return None
+ return cleandoc(doc)
+
+def cleandoc(doc):
+ """Clean up indentation from docstrings.
+
+ Any whitespace that can be uniformly removed from the second line
+ onwards is removed."""
try:
lines = doc.expandtabs().split('\n')
except UnicodeError: