pylint-bot / astroid-unofficial

UNOFFICIAL playground for astroid github migration
GNU Lesser General Public License v2.1
0 stars 0 forks source link

as_string gives wrong result for keyword-only arguments #185

Closed pylint-bot closed 8 years ago

pylint-bot commented 9 years ago

Originally reported by: Claudiu Popa (BitBucket: PCManticore, GitHub: PCManticore)


Given the following code, calling as_string on the resulting module leads to a surprising output:

#!python

from astroid import parse
m = parse('''
def test(a, b, c=42, *, x=42, **kwargs):
    print(a, b, c, args)
''')
print(m.as_string())

It seems that keyword only arguments are somehow treated as annotations.

#!python

def test(a, b, c=42, **kwargs, *, x:42):
    print(a, b, c, args)

pylint-bot commented 9 years ago

Original comment by BitBucket: ceridwenv, GitHub: ceridwenv:


Want me to fix this?

pylint-bot commented 9 years ago

Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: PCManticore):


Sure, why not. :-)

pylint-bot commented 9 years ago

Original comment by BitBucket: ceridwenv, GitHub: ceridwenv:


This should be fixed by https://bitbucket.org/logilab/astroid/commits/7b127880987d8896349e070debaccc587a3c6570 .

pylint-bot commented 9 years ago

Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: PCManticore):


It's partially fixed. The resulting output it's still not valid syntax.

pylint-bot commented 9 years ago

Original comment by BitBucket: ceridwenv, GitHub: ceridwenv:


Oh, ugh, you're right.

pylint-bot commented 9 years ago

Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: PCManticore):


Hopefully actually fix #185

pylint-bot commented 8 years ago

Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: PCManticore):


Hopefully actually fix #185