py/objboundmeth: Optimise check for types in binary_op.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George
2023-10-13 15:27:05 +11:00
parent 66c62353ce
commit 516385c4cc
2 changed files with 14 additions and 1 deletions

View File

@@ -33,6 +33,8 @@ try:
except AttributeError:
print("AttributeError")
print("--------")
# bound method comparison with same object
a = A()
m1 = a.f
@@ -51,6 +53,14 @@ print(m1 == a2.f) # should result in False
print(m2 == a1.f) # should result in False
print(m1 != a2.f) # should result in True
# bound method comparison with non-bound-method objects
print(A().f == None) # should result in False
print(A().f != None) # should result in True
print(None == A().f) # should result in False
print(None != A().f) # should result in True
print("--------")
# bound method hashing
a = A()
m1 = a.f