mirror of
https://github.com/python/cpython.git
synced 2025-10-06 23:21:06 +00:00
bpo-37685: Fixed __eq__, __lt__ etc implementations in some classes. (GH-14952)
They now return NotImplemented for unsupported type of the other operand.
This commit is contained in:
parent
4c69be22df
commit
662db125cd
23 changed files with 1295 additions and 1150 deletions
|
@ -101,7 +101,9 @@ class Font:
|
|||
return self.name
|
||||
|
||||
def __eq__(self, other):
|
||||
return isinstance(other, Font) and self.name == other.name
|
||||
if not isinstance(other, Font):
|
||||
return NotImplemented
|
||||
return self.name == other.name
|
||||
|
||||
def __getitem__(self, key):
|
||||
return self.cget(key)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue