Bare asterisk fix breaks docstrings

Bug #880389 reported by Denis Zawada
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
awkwardduet
Fix Released
Low
Denis Zawada

Bug Description

It works but breaks docstrings:

#!/usr/bin/env python3

def func(obligatory, *, other=' ', arguments=''):
    """func(obligatory, [other, arguments]) -> ponies

    Returns ponies for the given `obligatory` argument. Optional `other`
    `arguments` may be passed."""

    return "{} ponies.{}{}".format(obligatory, other, arguments)

print(func.__doc__)
print()
print(func("Pink", arguments="Not yours."))

is converted to

#!/usr/bin/env python

def func(obligatory, **_3to2kwargs):
    if 'arguments' in _3to2kwargs: arguments = _3to2kwargs['arguments']; del _3to2kwargs['arguments']
    else: arguments = u''
    if 'other' in _3to2kwargs: other = _3to2kwargs['other']; del _3to2kwargs['other']
    else: other = u' '
    u"""func(obligatory, [other, arguments]) -> ponies

    Returns ponies for the given `obligatory` argument. Optional `other`
    `arguments` may be passed."""

    return u"{} ponies.{}{}".format(obligatory, other, arguments)

print func.__doc__
print
print func(u"Pink", arguments=u"Not yours.")

Now func.__doc__ is None.

(Inherited from https://bitbucket.org/amentajo/lib3to2/issue/21)

Denis Zawada (ohdeno)
Changed in awkwardduet:
status: New → Confirmed
importance: Undecided → Wishlist
Denis Zawada (ohdeno)
Changed in awkwardduet:
importance: Wishlist → Low
Denis Zawada (ohdeno)
Changed in awkwardduet:
status: Confirmed → Triaged
milestone: none → 1.1a2
Denis Zawada (ohdeno)
Changed in awkwardduet:
status: Triaged → Fix Committed
assignee: nobody → Denis Zawada (ohdeno)
Denis Zawada (ohdeno)
Changed in awkwardduet:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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