tests/micropython: Add a test for throwing incomplete exception.

This is a reproducer for #17117.

Signed-off-by: Jeff Epler <jepler@unpythonic.net>
This commit is contained in:
Jeff Epler
2025-10-14 18:06:09 -05:00
committed by Damien George
parent 6dbabc9267
commit 20500558f8
2 changed files with 45 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
# Test raising an incomplete exception.
class C(Exception):
def __init__(self):
raise self
class C1(C):
pass
class B:
pass
class C2(B, Exception):
def __init__(self):
raise self
class C3(Exception, B):
def __init__(self):
raise self
class D(Exception):
pass
class C4(D):
def __init__(self):
raise self
for cls in C, C1, C2, C3, C4:
try:
cls()
except TypeError as e:
print("TypeError")

View File

@@ -0,0 +1,5 @@
TypeError
TypeError
TypeError
TypeError
TypeError