summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Behnel <stefan_ml@behnel.de>2022-03-12 12:08:33 +0100
committerStefan Behnel <stefan_ml@behnel.de>2022-03-12 12:08:33 +0100
commitc7aed3283efdc1a0662bd8716abd9f7b1868488d (patch)
treec6753ff196ba7189a77de742756f2c59a850d323
parent6a573cd8fc169f5e53ea7090dec7fe6512a3ff6a (diff)
downloadcython-c7aed3283efdc1a0662bd8716abd9f7b1868488d.tar.gz
Add a test.
-rw-r--r--tests/run/tryexcept.pyx17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/run/tryexcept.pyx b/tests/run/tryexcept.pyx
index dddf7de9b..1acc1f3ab 100644
--- a/tests/run/tryexcept.pyx
+++ b/tests/run/tryexcept.pyx
@@ -501,3 +501,20 @@ def complete_except_as_raise(x, a, b):
else:
i = 5
return i
+
+
+def try_except_raise_new(initial, catch, throw):
+ """
+ >>> try_except_raise_new(None, TypeError, ValueError)
+ >>> try_except_raise_new(TypeError, IndexError, ValueError)
+ Traceback (most recent call last):
+ TypeError
+ >>> try_except_raise_new(TypeError, TypeError, ValueError)
+ Traceback (most recent call last):
+ ValueError
+ """
+ try:
+ if initial is not None:
+ raise initial
+ except catch:
+ raise throw