[pypy-commit] pypy stacklet: Yay, this test passes too.
arigo
noreply at buildbot.pypy.org
Wed Aug 17 21:57:44 CEST 2011
Author: Armin Rigo <arigo at tunes.org>
Branch: stacklet
Changeset: r46575:f13c4f5d6cca
Date: 2011-08-17 22:01 +0200
http://bitbucket.org/pypy/pypy/changeset/f13c4f5d6cca/
Log: Yay, this test passes too.
diff --git a/pypy/module/_continuation/test/test_stacklet.py b/pypy/module/_continuation/test/test_stacklet.py
--- a/pypy/module/_continuation/test/test_stacklet.py
+++ b/pypy/module/_continuation/test/test_stacklet.py
@@ -312,6 +312,31 @@
assert f4 is None
raises(ValueError, c.switch) # "call stack is not deep enough"
+ def test_traceback_is_complete(self):
+ import sys
+ from _continuation import continuation
+ #
+ def g():
+ raise KeyError
+ def f(c):
+ g()
+ #
+ def do(c):
+ c.switch()
+ #
+ c = continuation(f)
+ try:
+ do(c)
+ except KeyError:
+ tb = sys.exc_info()[2]
+ else:
+ raise AssertionError("should have raised!")
+ #
+ assert tb.tb_next.tb_frame.f_code.co_name == 'do'
+ assert tb.tb_next.tb_next.tb_frame.f_code.co_name == 'f'
+ assert tb.tb_next.tb_next.tb_next.tb_frame.f_code.co_name == 'g'
+ assert tb.tb_next.tb_next.tb_next.tb_next is None
+
def test_various_depths(self):
skip("may fail on top of CPython")
# run it from test_translated, but not while being actually translated
More information about the pypy-commit
mailing list