Author: Armin Rigo <[email protected]>
Branch:
Changeset: r88304:81d063af711f
Date: 2016-11-10 19:29 +0100
http://bitbucket.org/pypy/pypy/changeset/81d063af711f/
Log: Don't wrap a random interp-level exception inside an app-level
SystemError when untranslated, because it makes testing harder.
Unclear how to test the translated behavior now...
diff --git a/pypy/interpreter/error.py b/pypy/interpreter/error.py
--- a/pypy/interpreter/error.py
+++ b/pypy/interpreter/error.py
@@ -511,20 +511,6 @@
space.setattr(w_exc, space.wrap("__module__"), space.wrap(module))
return w_exc
-def _convert_unexpected_exception_extra(space, e):
- "NOT_RPYTHON"
- if e.__class__.__name__ in (
- 'Skipped', # list of exception class names that are ok
- ): # to get during ==untranslated tests== only
- raise
- # include the RPython-level traceback
- exc = sys.exc_info()
- import traceback, cStringIO
- f = cStringIO.StringIO()
- print >> f, "\nTraceback (interpreter-level):"
- traceback.print_tb(exc[2], file=f)
- return f.getvalue()
-
@jit.dont_look_inside
def get_converted_unexpected_exception(space, e):
"""This is used in two places when we get an non-OperationError
@@ -562,7 +548,9 @@
debug_print_traceback()
extra = '; internal traceback was dumped to stderr'
else:
- extra = _convert_unexpected_exception_extra(space, e)
+ # when untranslated, we don't wrap into an app-level
+ # SystemError (this makes debugging tests harder)
+ raise
return OperationError(space.w_SystemError, space.wrap(
"unexpected internal exception (please report a bug): %r%s" %
(e, extra)))
diff --git a/pypy/interpreter/test/test_gateway.py
b/pypy/interpreter/test/test_gateway.py
--- a/pypy/interpreter/test/test_gateway.py
+++ b/pypy/interpreter/test/test_gateway.py
@@ -773,6 +773,8 @@
assert space.unwrap(space.getattr(w_g, space.wrap('__doc__'))) == 'bar'
def test_system_error(self):
+ py.test.skip("we don't wrap a random exception inside SystemError "
+ "when untranslated, because it makes testing harder")
class UnexpectedException(Exception):
pass
space = self.space
@@ -788,6 +790,8 @@
'report a bug): UnexpectedException') in err
def test_system_error_2(self):
+ py.test.skip("we don't wrap a random exception inside SystemError "
+ "when untranslated, because it makes testing harder")
class UnexpectedException(Exception):
pass
space = self.space
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit