[New-bugs-announce] [issue2545] sphinx.ext.autodoc fails to expand tabs in docstrings

John Millikin report at bugs.python.org
Fri Apr 4 06:29:12 CEST 2008


New submission from John Millikin <jmillikin at gmail.com>:

Sphinx seems to need tabs expanded in reST, but the autodoc extension
doesn't do so. The following patch is very small, and fixes the issue on
my system.

Oddly, I can reproduce this on a Linux system with doctools and docutils
trunk, but not on a Mac with doctools and docutils trunk vOv.

Index: ext/autodoc.py
===================================================================
--- ext/autodoc.py      (revision 62140)
+++ ext/autodoc.py      (working copy)
@@ -41,7 +41,8 @@
     """
     if not s or s.isspace():
         return ['']
-    nl = s.expandtabs().rstrip().find('\n')
+    s = s.expandtabs ()
+    nl = s.rstrip().find('\n')
     if nl == -1:
         # Only one line...
         return [s.strip(), '']

----------
assignee: georg.brandl
components: Documentation tools (Sphinx)
messages: 64912
nosy: georg.brandl, jmillikin
severity: normal
status: open
title: sphinx.ext.autodoc fails to expand tabs in docstrings
versions: Python 2.5

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2545>
__________________________________


More information about the New-bugs-announce mailing list