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

Crash when Python 2 argument list has a tuple argument #95

Open
JukkaL opened this issue Nov 28, 2019 · 0 comments
Open

Crash when Python 2 argument list has a tuple argument #95

JukkaL opened this issue Nov 28, 2019 · 0 comments
Labels

Comments

@JukkaL
Copy link

JukkaL commented Nov 28, 2019

This causes a crash (Python 2 only):

def f((x, y)):   # Note nested tuple within argument list
    pass

Here's the traceback:

Traceback (most recent call last):
  File ".mypy/venv-tools/bin/pyannotate", line 9, in <module>
    load_entry_point('pyannotate==1.2.0', 'console_scripts', 'pyannotate')()
  File "/Users/jukka/src/server/.mypy/venv-tools/lib/python3.7/site-packages/pyannotate_tools/annotations/__main__.py", line 143, in main
    rt.refactor(args.files, write=args.write, num_processes=args.processes)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib2to3/refactor.py", line 687, in refactor
    items, write, doctests_only)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib2to3/refactor.py", line 282, in refactor
    self.refactor_file(dir_or_file, write, doctests_only)
  File "/Users/jukka/src/server/.mypy/venv-tools/lib/python3.7/site-packages/pyannotate_tools/annotations/__main__.py", line 57, in refactor_file
    filename, write=write, doctests_only=doctests_only)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib2to3/refactor.py", line 728, in refactor_file
    *args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib2to3/refactor.py", line 335, in refactor_file
    tree = self.refactor_string(input, filename)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib2to3/refactor.py", line 367, in refactor_string
    self.refactor_tree(tree, name)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib2to3/refactor.py", line 441, in refactor_tree
    new = fixer.transform(node, results)
  File "/Users/jukka/src/server/.mypy/venv-tools/lib/python3.7/site-packages/pyannotate_tools/fixes/fix_annotate.py", line 167, in transform
    assert ch.type == token.COMMA
AssertionError
@JukkaL JukkaL added the bug label Nov 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant