06593fb0f2
Previous to this patch a call such as list.append(1, 2) would lead to a seg fault. This is because list.append is a builtin method and the first argument to such methods is always assumed to have the correct type. Now, when a builtin method is extracted like this it is wrapped in a checker object which checks the the type of the first argument before calling the builtin function. This feature is contrelled by MICROPY_BUILTIN_METHOD_CHECK_SELF_ARG and is enabled by default. See issue #1216.
13 lines
166 B
Python
13 lines
166 B
Python
# check that we can use an instance of B in a method of A
|
|
|
|
class A:
|
|
def store(a, b):
|
|
a.value = b
|
|
|
|
class B:
|
|
pass
|
|
|
|
b = B()
|
|
A.store(b, 1)
|
|
print(b.value)
|