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

lib2to3.pgen2.parse.ParseError: bad input: type=8, value=u')', #412

Closed
cancan101 opened this issue Jun 1, 2017 · 3 comments
Closed

lib2to3.pgen2.parse.ParseError: bad input: type=8, value=u')', #412

cancan101 opened this issue Jun 1, 2017 · 3 comments

Comments

@cancan101
Copy link

yapf -d err.py dies with (contents of err.py):

args = tuple(x for x in [2],)

this is valid python 2.7.

Traceback (most recent call last):
  File "/Users/alex/.virtualenvs/yapf/bin/yapf", line 11, in <module>
    sys.exit(run_main())
  File "/Users/alex/.virtualenvs/yapf/lib/python2.7/site-packages/yapf/__init__.py", line 296, in run_main
    sys.exit(main(sys.argv))
  File "/Users/alex/.virtualenvs/yapf/lib/python2.7/site-packages/yapf/__init__.py", line 188, in main
    parallel=args.parallel)
  File "/Users/alex/.virtualenvs/yapf/lib/python2.7/site-packages/yapf/__init__.py", line 236, in FormatFiles
    in_place, print_diff, verify)
  File "/Users/alex/.virtualenvs/yapf/lib/python2.7/site-packages/yapf/__init__.py", line 259, in _FormatFile
    logger=logging.warning)
  File "/Users/alex/.virtualenvs/yapf/lib/python2.7/site-packages/yapf/yapflib/yapf_api.py", line 90, in FormatFile
    verify=verify)
  File "/Users/alex/.virtualenvs/yapf/lib/python2.7/site-packages/yapf/yapflib/yapf_api.py", line 126, in FormatCode
    tree = pytree_utils.ParseCodeToTree(unformatted_source)
  File "/Users/alex/.virtualenvs/yapf/lib/python2.7/site-packages/yapf/yapflib/pytree_utils.py", line 108, in ParseCodeToTree
    tree = parser_driver.parse_string(code, debug=False)
  File "/Users/alex/.pyenv/versions/2.7.12/Python.framework/Versions/2.7/lib/python2.7/lib2to3/pgen2/driver.py", line 106, in parse_string
    return self.parse_tokens(tokens, debug)
  File "/Users/alex/.pyenv/versions/2.7.12/Python.framework/Versions/2.7/lib/python2.7/lib2to3/pgen2/driver.py", line 71, in parse_tokens
    if p.addtoken(type, value, (prefix, start)):
  File "/Users/alex/.pyenv/versions/2.7.12/Python.framework/Versions/2.7/lib/python2.7/lib2to3/pgen2/parse.py", line 159, in addtoken
    raise ParseError("bad input", type, value, context)
lib2to3.pgen2.parse.ParseError: bad input: type=8, value=u')', context=('', (1, 28))
@taion
Copy link

taion commented Jun 1, 2017

That's valid Python period, BTW – in Python 2 or Python 3.

@cancan101
Copy link
Author

This looks to be the upstream issue: https://bugs.python.org/issue27494

@bwendling
Copy link
Member

We're (fortunately or unfortunately) tethered to lib2to3's parsing. It's why some of the Python3 issues haven't been addressed yet. This appears to be another issue we need to wait on them for...

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

No branches or pull requests

3 participants