mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +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
|
|
@ -484,6 +484,8 @@ class Variable:
|
|||
Note: if the Variable's master matters to behavior
|
||||
also compare self._master == other._master
|
||||
"""
|
||||
if not isinstance(other, Variable):
|
||||
return NotImplemented
|
||||
return self.__class__.__name__ == other.__class__.__name__ \
|
||||
and self._name == other._name
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue