Author: Raffael Tfirst <raffael.tfi...@gmail.com>
Branch: py3.5-async
Changeset: r85817:4f0931e016f6
Date: 2016-07-22 21:18 +0200
http://bitbucket.org/pypy/pypy/changeset/4f0931e016f6/

Log:    Set last_token only if token is available in pytokenizer (fixes
        tests), create new test

diff --git a/pypy/interpreter/pyparser/pytokenizer.py 
b/pypy/interpreter/pyparser/pytokenizer.py
--- a/pypy/interpreter/pyparser/pytokenizer.py
+++ b/pypy/interpreter/pyparser/pytokenizer.py
@@ -279,6 +279,7 @@
                         punct = tokens.OP
                     token_list.append((punct, token, lnum, start, line))
                     last_comment = ''
+                last_token = token
             else:
                 start = whiteSpaceDFA.recognize(line, pos)
                 if start < 0:
@@ -290,7 +291,6 @@
                 token_list.append(tok)
                 last_comment = ''
                 pos = pos + 1
-            last_token = token
 
     lnum -= 1
     if not (flags & consts.PyCF_DONT_IMPLY_DEDENT):
diff --git a/pypy/interpreter/pyparser/test/test_pyparse.py 
b/pypy/interpreter/pyparser/test/test_pyparse.py
--- a/pypy/interpreter/pyparser/test/test_pyparse.py
+++ b/pypy/interpreter/pyparser/test/test_pyparse.py
@@ -168,7 +168,8 @@
         py.test.raises(SyntaxError, self.parse, 'f()\nxy # blah\nblah()', 
"single")
         py.test.raises(SyntaxError, self.parse, 'x = 5 # comment\nx = 6\n', 
"single")
 
-    def test_await(self):
+    def test_async_await(self):
+        self.parse("async def coro(): pass")
         self.parse("await result = func()")
 
 class TestPythonParserWithSpace:
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to