mirror of
https://github.com/micropython/micropython.git
synced 2026-01-07 12:40:15 +01:00
py/objboundmeth: Optimise check for types in binary_op.
Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user