Files
micropython/tests/basics/builtin_super.py
stijn 093d0c0a17 py/objtype: Validate super() arguments.
This fixes various null dereferencing and out-of-bounds access because
super_attr assumes the held obj is effectively an object of the held type,
which is now verified.

Fixes issue #12830.

Signed-off-by: stijn <stijn@ignitron.net>
2024-07-25 12:27:33 +10:00

16 lines
242 B
Python

# Check that super rejects invalid arguments.
try:
super(str, 0)
except TypeError:
print("TypeError")
try:
super(str, int)
except TypeError:
print("TypeError")
try:
super(0, int)
except TypeError:
print("TypeError")