More docstring filling woes

Bug #1102296 reported by Georg Brandl
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
python-mode.el
Fix Released
High
Andreas Roehler

Bug Description

(I selected "PEP-257-NN" as the docstring fill style.)
Given the following code:

class Test(object):
    """
    Builds target formats from the reST sources.
    """

    def method1(self):
        """Return the template bridge configured."""
        pass

    def method2(self):
        """Load necessary templates and perform initialization. The default implementation does nothing.
        """
        pass

After filling the three docstrings with fill-paragraph, it looks like this:

class Test(object):
    """ Builds target formats from the reST sources. """

    def method1(self):
        """Return the template bridge configured.""" pass

    def method2(self):
        """Load necessary templates and perform initialization. The default
        implementation does nothing. """ pass

There are three misbehaviors here:
* should have removed the whitespace at the beginning and end of the class docstring
* in method1, the "pass" should remain on its own line
* in method2, the closing triple-quote should get its own line, and the "pass" too

Changed in python-mode:
milestone: none → 6.1.1
assignee: nobody → Andreas Roehler (a-roehler)
importance: Undecided → Medium
status: New → In Progress
Revision history for this message
Andreas Roehler (a-roehler) wrote :

please try again

Revision history for this message
Georg Brandl (gbrandl) wrote :

Test file after filling, latest version:

-------------

class Test(object):
        """Builds target formats from the reST sources."""

    def method1(self):
                """Return the template bridge configured."""
        pass

    def method2(self):
                """Load necessary templates and perform initialization. The default implementation

        does nothing.
        """
        pass

-------------

There appears to be a bug with the amount of indentation inserted. Also in the last docstring the first paragraph should not be split by an empty line.

Oh, and after filling, point is placed after the closing quote. Calling fill-paragraph again I get "lisp nesting exceeds max-eval-depth".

Changed in python-mode:
importance: Medium → High
Revision history for this message
Ryan Olf (ryan-efrus) wrote :

In the latest version from the git mirror, I am seeing similar problems with py-fill-paragraph, where it pretty much just mangles the docstring.

Changed in python-mode:
status: In Progress → Fix Committed
Changed in python-mode:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.