aboutsummaryrefslogtreecommitdiffhomepage
path: root/python
diff options
context:
space:
mode:
authorGravatar Jisi Liu <jisi.liu@gmail.com>2017-07-24 20:44:59 -0700
committerGravatar Jisi Liu <jisi.liu@gmail.com>2017-07-24 20:44:59 -0700
commitce4416705b0f7e0dc7352618722d98ea268e4d4a (patch)
tree30925e44dadf18b92894be6fdf5129dbbee00869 /python
parent11b4d5ec73ca5667fdd0927a7c9ed47707defa11 (diff)
parent4ae94d69ffd450dcf4b108c9367aa91e1f55dc7d (diff)
Merge remote-tracking branch 'origin/3.4.x' into vb
Diffstat (limited to 'python')
-rwxr-xr-xpython/google/protobuf/internal/encoder.py2
-rwxr-xr-xpython/google/protobuf/internal/message_test.py3
2 files changed, 4 insertions, 1 deletions
diff --git a/python/google/protobuf/internal/encoder.py b/python/google/protobuf/internal/encoder.py
index f8c36390..ebec42e5 100755
--- a/python/google/protobuf/internal/encoder.py
+++ b/python/google/protobuf/internal/encoder.py
@@ -819,7 +819,7 @@ def MapEncoder(field_descriptor):
encode_message = MessageEncoder(field_descriptor.number, False, False)
def EncodeField(write, value, deterministic):
- value_keys = sorted(value.iterkeys()) if deterministic else value.iterkeys()
+ value_keys = sorted(value.keys()) if deterministic else value.keys()
for key in value_keys:
entry_msg = message_type._concrete_class(key=key, value=value[key])
encode_message(write, entry_msg, deterministic)
diff --git a/python/google/protobuf/internal/message_test.py b/python/google/protobuf/internal/message_test.py
index 6f60586a..29a515b2 100755
--- a/python/google/protobuf/internal/message_test.py
+++ b/python/google/protobuf/internal/message_test.py
@@ -166,6 +166,9 @@ class MessageTest(BaseTestCase):
def __nonzero__(self):
raise BadArgError()
+ def __bool__(self):
+ raise BadArgError()
+
with self.assertRaises(BadArgError):
golden_message.SerializeToString(deterministic=BadArg())