aboutsummaryrefslogtreecommitdiff
path: root/python/google/protobuf/reflection.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/google/protobuf/reflection.py')
-rwxr-xr-xpython/google/protobuf/reflection.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/python/google/protobuf/reflection.py b/python/google/protobuf/reflection.py
index f345067a..5ab7a1b1 100755
--- a/python/google/protobuf/reflection.py
+++ b/python/google/protobuf/reflection.py
@@ -599,6 +599,10 @@ def _AddHasExtensionMethod(cls):
def _AddEqualsMethod(message_descriptor, cls):
"""Helper for _AddMessageMethods()."""
def __eq__(self, other):
+ if (not isinstance(other, message_mod.Message) or
+ other.DESCRIPTOR != self.DESCRIPTOR):
+ return False
+
if self is other:
return True