amyreese / fissix

backport of lib2to3, with enhancements
Other
45 stars 22 forks source link

include dict in iterating context #17

Closed graingert closed 4 years ago

graingert commented 4 years ago

see-also https://github.com/python-modernize/python-modernize/pull/149

Description

There is a bug in 2to3 which causes calls like zip to be wrapped in a list when being passed into a dict constructor. This is not needed.

dict(zip(foo))
dict(list(zip(foo)))
graingert commented 4 years ago

I need to move the example from the PR description into a test case

graingert commented 4 years ago

@jreese it's difficult to test, as the tests just use the system under test to check anything:

https://github.com/graingert/fissix/blob/patch-1/fissix/tests/test_fixers.py#L1336

thus not actually testing anything

also there seems to be two definitions of consuming calls!