Author: Raffael Tfirst <[email protected]>
Branch: py3.5-async
Changeset: r85995:cf642e39ca7f
Date: 2016-08-02 21:51 +0200
http://bitbucket.org/pypy/pypy/changeset/cf642e39ca7f/
Log: Add parser and syntax tests for async and await, remove set_sentinel
comment
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
@@ -169,8 +169,15 @@
py.test.raises(SyntaxError, self.parse, 'x = 5 # comment\nx = 6\n',
"single")
def test_async_await(self):
- self.parse("async def coro(): pass")
- self.parse("await result = func()")
+ self.parse("async def coro(): await func")
+ #Test as var and func name
+ self.parse("async = 1")
+ self.parse("await = 1")
+ self.parse("def async(): pass")
+ #async for
+ self.parse("async def foo(): async for a in b: pass")
+ #async with
+ self.parse("async def foo(): async with a: pass")
class TestPythonParserWithSpace:
diff --git a/pypy/interpreter/test/test_syntax.py
b/pypy/interpreter/test/test_syntax.py
--- a/pypy/interpreter/test/test_syntax.py
+++ b/pypy/interpreter/test/test_syntax.py
@@ -99,7 +99,13 @@
async def foo():
await await fut
-
+
+ await x
+
+ def foo(): async for a in b: pass
+
+ def foo(): async with a: pass
+
""")
diff --git a/pypy/module/thread/os_lock.py b/pypy/module/thread/os_lock.py
--- a/pypy/module/thread/os_lock.py
+++ b/pypy/module/thread/os_lock.py
@@ -147,7 +147,6 @@
def set_sentinel(space):
"""Set a sentinel lock that will be released when the current thread
state is finalized (after it is untied from the interpreter)."""
- #NOT IMPLEMENTED YET!!! (required for some libs to work)
return space.wrap(Lock(space))
class W_RLock(W_Root):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit