grumpyhome / grumpy

Grumpy is a Python to Go source code transcompiler and runtime.
Apache License 2.0
420 stars 18 forks source link

Fix multiple `with` statement #121

Closed alanjds closed 5 years ago

alanjds commented 5 years ago

Fixes with statement having more than one target

$ grumpy -v debug -m zipfile
info: GOPATH: /Users/alanjds/go:/Users/alanjds/src/git/grumpy/grumpy-runtime-src/grumpy_runtime/data/gopath
info: __main__ pycache folder: /var/folders/ch/j0__hzj563l55q2pz_c249km0000gn/T/tmpApl332__pycache__
debug: Should transpile '__main__'
debug: Dependencies file regenerated
Traceback (most recent call last):
...
  File "/Users/alanjds/src/git/grumpy/grumpy-tools-src/grumpy_tools/compiler/stmt.py", line 421, in visit_With
    assert len(node.items) == 1, 'multiple items in a with not yet supported'
AssertionError: multiple items in a with not yet supported

This is needed by zipfile and pip at least