Author: Philip Jenvey <[email protected]>
Branch: py3k
Changeset: r59182:8a643caba158
Date: 2012-12-01 11:35 -0800
http://bitbucket.org/pypy/pypy/changeset/8a643caba158/
Log: invalid reraises now a RuntimeError
diff --git a/pypy/interpreter/pyopcode.py b/pypy/interpreter/pyopcode.py
--- a/pypy/interpreter/pyopcode.py
+++ b/pypy/interpreter/pyopcode.py
@@ -479,8 +479,8 @@
break
frame = frame.f_backref()
else:
- raise OperationError(space.w_TypeError,
- space.wrap("raise: no active exception to re-raise"))
+ raise OperationError(space.w_RuntimeError,
+ space.wrap("No active exception to reraise"))
# re-raise, no new traceback obj will be attached
self.last_exception = operror
raise RaiseWithExplicitTraceback(operror)
diff --git a/pypy/interpreter/test/test_raise.py
b/pypy/interpreter/test/test_raise.py
--- a/pypy/interpreter/test/test_raise.py
+++ b/pypy/interpreter/test/test_raise.py
@@ -320,3 +320,11 @@
except ValueError:
break
assert sys.exc_info() == (None, None, None)
+
+ def test_invalid_reraise(self):
+ try:
+ raise
+ except RuntimeError as e:
+ assert "No active exception" in str(e)
+ else:
+ fail("Expected RuntimeError")
diff --git a/pypy/objspace/flow/flowcontext.py
b/pypy/objspace/flow/flowcontext.py
--- a/pypy/objspace/flow/flowcontext.py
+++ b/pypy/objspace/flow/flowcontext.py
@@ -662,8 +662,8 @@
self.last_exception = operr
raise operr
else:
- raise FSException(space.w_TypeError,
- space.wrap("raise: no active exception to re-raise"))
+ raise FSException(space.w_RuntimeError,
+ space.wrap("No active exception to reraise"))
w_value = w_traceback = space.w_None
if nbargs >= 3:
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit