summaryrefslogtreecommitdiffstatshomepage
path: root/tests/basics
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2016-09-28 11:52:13 +1000
committerDamien George <damien.p.george@gmail.com>2016-09-28 11:52:13 +1000
commitb32c01b7489f233ae7b1c211a8b93e23149fb0f3 (patch)
tree23a03c04dd038925e6c5990e437ad1689e08d0df /tests/basics
parent443cc0114d7669471e39661c97e2bad91c8eabb8 (diff)
downloadmicropython-b32c01b7489f233ae7b1c211a8b93e23149fb0f3.tar.gz
micropython-b32c01b7489f233ae7b1c211a8b93e23149fb0f3.zip
py/compile: Fix async-for/async-with to work with simpler exc on stack.
There is now just the exception instance on the stack when an exception is raised, not the full (type, exc, traceback).
Diffstat (limited to 'tests/basics')
-rw-r--r--tests/basics/async_with.py12
-rw-r--r--tests/basics/async_with.py.exp5
-rw-r--r--tests/basics/async_with2.py2
-rw-r--r--tests/basics/async_with2.py.exp2
4 files changed, 17 insertions, 4 deletions
diff --git a/tests/basics/async_with.py b/tests/basics/async_with.py
index 742f9ba993..9eccfd816c 100644
--- a/tests/basics/async_with.py
+++ b/tests/basics/async_with.py
@@ -4,7 +4,7 @@ class AContext:
async def __aenter__(self):
print('enter')
async def __aexit__(self, exc_type, exc, tb):
- print('exit')
+ print('exit', exc_type, exc)
async def f():
async with AContext():
@@ -15,3 +15,13 @@ try:
o.send(None)
except StopIteration:
print('finished')
+
+async def g():
+ async with AContext():
+ raise ValueError('error')
+
+o = g()
+try:
+ o.send(None)
+except ValueError:
+ print('ValueError')
diff --git a/tests/basics/async_with.py.exp b/tests/basics/async_with.py.exp
index 1e9176af7b..6072a3e0b3 100644
--- a/tests/basics/async_with.py.exp
+++ b/tests/basics/async_with.py.exp
@@ -1,4 +1,7 @@
enter
body
-exit
+exit None None
finished
+enter
+exit <class 'ValueError'> error
+ValueError
diff --git a/tests/basics/async_with2.py b/tests/basics/async_with2.py
index 0ebec489fe..44421ae917 100644
--- a/tests/basics/async_with2.py
+++ b/tests/basics/async_with2.py
@@ -20,7 +20,7 @@ class AContext:
print('enter')
print('f returned:', await f(10))
async def __aexit__(self, exc_type, exc, tb):
- print('exit')
+ print('exit', exc_type, exc)
print('f returned:', await f(20))
async def coro():
diff --git a/tests/basics/async_with2.py.exp b/tests/basics/async_with2.py.exp
index dd5a1c549a..76b173b4c2 100644
--- a/tests/basics/async_with2.py.exp
+++ b/tests/basics/async_with2.py.exp
@@ -9,7 +9,7 @@ coro yielded: 31
coro yielded: 32
body f returned: 33
body end
-exit
+exit None None
f start: 20
coro yielded: 21
coro yielded: 22