Skip to content

Commit 014b658

Browse files
committed
fix an issue that protoc buff will raise exception if a _pb object create but never assign value
1 parent 3753821 commit 014b658

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

gcloud/datastore/helpers.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,15 @@ def _set_protobuf_value(value_pb, val):
223223
:param val: The value to be assigned.
224224
"""
225225
if val is None:
226+
value_pb.ClearField('boolean_value')
227+
value_pb.ClearField('integer_value')
228+
value_pb.ClearField('double_value')
229+
value_pb.ClearField('timestamp_microseconds_value')
230+
value_pb.ClearField('key_value')
231+
value_pb.ClearField('blob_key_value')
232+
value_pb.ClearField('string_value')
233+
value_pb.ClearField('blob_value')
234+
value_pb.ClearField('entity_value')
226235
return
227236

228237
attr, val = _get_protobuf_attribute_and_value(val)

0 commit comments

Comments
 (0)