[pypy-commit] pypy py3.7: await support in unparsing
cfbolz
pypy.commits at gmail.com
Mon Jan 6 13:52:04 EST 2020
Author: Carl Friedrich Bolz-Tereick <cfbolz at gmx.de>
Branch: py3.7
Changeset: r98459:d024dd626c73
Date: 2020-01-06 19:50 +0100
http://bitbucket.org/pypy/pypy/changeset/d024dd626c73/
Log: await support in unparsing
diff --git a/pypy/interpreter/astcompiler/test/test_unparse.py b/pypy/interpreter/astcompiler/test/test_unparse.py
--- a/pypy/interpreter/astcompiler/test/test_unparse.py
+++ b/pypy/interpreter/astcompiler/test/test_unparse.py
@@ -190,8 +190,8 @@
res = unparse_annotations(self.space, ast)
assert self.space.text_w(res.body[0].annotation.value) == 'list[int]'
- @pytest.mark.xfail
def test_await(self):
ast = self.get_ast("""def f() -> await some.complicated[0].call(with_args=True or 1 is not 1): pass""")
- res = unparse_annotations(self.space, ast)
+ func = ast.body[0]
+ res = unparse_annotations(self.space, func)
assert self.space.text_w(res.returns.value) == "await some.complicated[0].call(with_args=True or 1 is not 1)"
diff --git a/pypy/interpreter/astcompiler/unparse.py b/pypy/interpreter/astcompiler/unparse.py
--- a/pypy/interpreter/astcompiler/unparse.py
+++ b/pypy/interpreter/astcompiler/unparse.py
@@ -465,6 +465,11 @@
self.append_ascii("f")
self.append_w_str(self.space.repr(self.space.newutf8(s, l)))
+ def visit_Await(self, node):
+ with self.maybe_parenthesize(PRIORITY_AWAIT):
+ self.append_ascii("await ")
+ self.append_expr(node.value)
+
class FstringVisitor(Utf8BuilderVisitor):
More information about the pypy-commit
mailing list