Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Baron fails for for nested double star #158

Open
Melevir opened this issue Dec 5, 2019 · 2 comments
Open

Baron fails for for nested double star #158

Melevir opened this issue Dec 5, 2019 · 2 comments

Comments

@Melevir
Copy link

Melevir commented Dec 5, 2019

Here is working Python snippet:

def foo(*args, **kwargs):
    print(args, kwargs)

foo(**{"a": 1, **kwargs})

Last line fails when parsing with Baron:

>>> from baron import parse
>>> parse('foo(**{"a": 1, **kwargs})')
ParsingError: Error, got an unexpected token DOUBLE_STAR here:

   1 foo(**{"a": 1, **<---- here

The token DOUBLE_STAR should be one of those: BACKQUOTE, BINARY, BINARY_RAW_STRING, BINARY_STRING, COMPLEX, ELLIPSIS, FLOAT, FLOAT_EXPONANT, FLOAT_EXPONANT_COMPLEX, HEXA, INT, INTERPOLATED_RAW_STRING, INTERPOLATED_STRING, LAMBDA, LEFT_BRACKET, LEFT_PARENTHESIS, LEFT_SQUARE_BRACKET, LONG, MINUS, NAME, NOT, OCTA, PLUS, RAW_STRING, RIGHT_BRACKET, STRING, TILDE, UNICODE_RAW_STRING, UNICODE_STRING

Baron has failed to parse this input. If this is valid python code (and by that I mean that the python binary successfully parse this code without any syntax error) (also consider that python does not yet parse python 3 code integrally) it would be kind if you can extract a snippet of your code that make Baron fails and open a bug here: https://github.com/PyCQA/baron/issues

Sorry for the inconvenience.

baron==0.9, Python 3.7.2

@Jackenmen
Copy link

Jackenmen commented Dec 28, 2019

Baron fails for all dicts that have dict unpacking in them:

x = {
    "abc": "def"
}
y = {
    "fed": "cba",
    **x
}

This is a new functionality of Python 3.5 (PEP 448)

@PaulRenvoise
Copy link

Looks like this issue is a duplicate of #137

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants