bpo-37685: Fixed __eq__, __lt__ etc implementations in some classes. (GH-14952)
They now return NotImplemented for unsupported type of the other operand.
diff --git a/Lib/traceback.py b/Lib/traceback.py
index ab35da9..7a4c8e1 100644
--- a/Lib/traceback.py
+++ b/Lib/traceback.py
@@ -538,7 +538,9 @@
self.__cause__._load_lines()
def __eq__(self, other):
- return self.__dict__ == other.__dict__
+ if isinstance(other, TracebackException):
+ return self.__dict__ == other.__dict__
+ return NotImplemented
def __str__(self):
return self._str