aboutsummaryrefslogtreecommitdiff
path: root/python/google/protobuf/message.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/google/protobuf/message.py')
-rwxr-xr-xpython/google/protobuf/message.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/python/google/protobuf/message.py b/python/google/protobuf/message.py
index 6f19f85f..6ec2f8be 100755
--- a/python/google/protobuf/message.py
+++ b/python/google/protobuf/message.py
@@ -73,6 +73,7 @@ class Message(object):
return clone
def __eq__(self, other_msg):
+ """Recursively compares two messages by value and structure."""
raise NotImplementedError
def __ne__(self, other_msg):
@@ -83,9 +84,11 @@ class Message(object):
raise TypeError('unhashable object')
def __str__(self):
+ """Outputs a human-readable representation of the message."""
raise NotImplementedError
def __unicode__(self):
+ """Outputs a human-readable representation of the message."""
raise NotImplementedError
def MergeFrom(self, other_msg):
@@ -266,3 +269,12 @@ class Message(object):
via a previous _SetListener() call.
"""
raise NotImplementedError
+
+ def __getstate__(self):
+ """Support the pickle protocol."""
+ return dict(serialized=self.SerializePartialToString())
+
+ def __setstate__(self, state):
+ """Support the pickle protocol."""
+ self.__init__()
+ self.ParseFromString(state['serialized'])