From d109676ec0e8ebd648658583842ec3a91952adf3 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Sat, 29 Mar 2014 19:44:15 +0200 Subject: py: Reraising exception possible only in except block. --- tests/basics/try-reraise.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'tests/basics/try-reraise.py') diff --git a/tests/basics/try-reraise.py b/tests/basics/try-reraise.py index bc817fc386..bf5e77c0b0 100644 --- a/tests/basics/try-reraise.py +++ b/tests/basics/try-reraise.py @@ -1,4 +1,4 @@ -# Re-reraising last exception with raise w/o args +# Reraising last exception with raise w/o args def f(): try: @@ -10,3 +10,10 @@ try: f() except ValueError as e: print(repr(e)) + + +# Can reraise only in except block +try: + raise +except RuntimeError: + print("RuntimeError") -- cgit v1.2.3