Dictionary extend with ** fails
- Dominant language
- Python
- Stars
- 14k
- Forks
- 904
- PR merge metrics
- No merged PRs in 30d
Description
I am using Python 3.5.2. The issue looks clearly coming from lib2to3
Reproduce with:
```
cat repro.py
var = {**a, **b}
```
Yelds:
```
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/yapf/yapflib/pytree_utils.py", line 102, in ParseCodeToTree
tree = parser_driver.parse_string(code, debug=False)
File "/usr/lib/python3.5/lib2to3/pgen2/driver.py", line 106, in parse_string
return self.parse_tokens(tokens, debug)
File "/usr/lib/python3.5/lib2to3/pgen2/driver.py", line 71, in parse_tokens
if p.addtoken(type, value, (prefix, start)):
File "/usr/lib/python3.5/lib2to3/pgen2/parse.py", line 159, in addtoken
raise ParseError("bad input", type, value, context)
lib2to3.pgen2.parse.ParseError: bad input: type=36, value='**', context=('', (1, 7))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/yapf", line 11, in
sys.exit(run_main())
File "/usr/local/lib/python3.5/dist-packages/yapf/__init__.py", line 296, in run_main
sys.exit(main(sys.argv))
File "/usr/local/lib/python3.5/dist-packages/yapf/__init__.py", line 188, in main
parallel=args.parallel)
File "/usr/local/lib/python3.5/dist-packages/yapf/__init__.py", line 236, in FormatFiles
in_place, print_diff, verify)
File "/usr/local/lib/python3.5/dist-packages/yapf/__init__.py", line 259, in _FormatFile
logger=logging.warning)
File "/usr/local/lib/python3.5/dist-packages/yapf/yapflib/yapf_api.py", line 90, in FormatFile
verify=verify)
File "/usr/local/lib/python3.5/dist-packages/yapf/yapflib/yapf_api.py", line 126, in FormatCode
tree = pytree_utils.ParseCodeToTree(unformatted_source)
File "/usr/local/lib/python3.5/dist-packages/yapf/yapflib/pytree_utils.py", line 108, in ParseCodeToTree
tree = parser_driver.parse_string(code, debug=False)
File "/usr/lib/python3.5/lib2to3/pgen2/driver.py", line 106, in parse_string
return self.parse_tokens(tokens, debug)
File "/usr/lib/python3.5/lib2to3/pgen2/driver.py", line 71, in parse_tokens
if p.addtoken(type, value, (prefix, start)):
File "/usr/lib/python3.5/lib2to3/pgen2/parse.py", line 159, in addtoken
raise ParseError("bad input", type, value, context)
lib2to3.pgen2.parse.ParseError: bad input: type=36, value='**', context=('', (1, 7))
```
Contributor guide
Assessment
This issue has not been assessed yet.