Author: Brian Kearns <[email protected]>
Branch:
Changeset: r63304:bb0fb0211de3
Date: 2013-04-12 22:10 -0400
http://bitbucket.org/pypy/pypy/changeset/bb0fb0211de3/
Log: unhandled exceptions in threads should print tracebacks like
cpython, test
diff --git a/pypy/module/thread/os_thread.py b/pypy/module/thread/os_thread.py
--- a/pypy/module/thread/os_thread.py
+++ b/pypy/module/thread/os_thread.py
@@ -132,7 +132,7 @@
if not e.match(space, space.w_SystemExit):
ident = rthread.get_ident()
where = 'thread %d started by ' % ident
- e.write_unraisable(space, where, w_callable)
+ e.write_unraisable(space, where, w_callable,
with_traceback=True)
e.clear(space)
# clean up space.threadlocals to remove the ExecutionContext
# entry corresponding to the current thread
diff --git a/pypy/module/thread/test/test_thread.py
b/pypy/module/thread/test/test_thread.py
--- a/pypy/module/thread/test/test_thread.py
+++ b/pypy/module/thread/test/test_thread.py
@@ -129,10 +129,10 @@
sys.stderr = StringIO.StringIO()
thread.start_new_thread(fn3, ())
self.waitfor(lambda: "ValueError" in sys.stderr.getvalue())
- result = sys.stderr.getvalue()
- assert "ValueError" in result
- assert "hello world" in result
- assert len(result.splitlines()) == 1
+ result = sys.stderr.getvalue().splitlines()
+ #assert result[0].startswith("Unhandled exception in thread ")
+ assert result[1].startswith("Traceback ")
+ assert result[-1] == "ValueError: hello world"
finally:
sys.stderr = prev
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit