You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recently, I have faced an issue using protobuf in Python3, where CPP environ works fine, but python environ fails to find the key. This behavior has recently caused disruption to the distribution of our software using protobuf.
Lets assume the following protoformat
message myData {
map<string, uint64> data = 1;
}
Now lets assume I set the cpp environment I do the following after generating stub.
os.environ['PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION'] = 'cpp'
myData.data['hello'] = 10
print(b'hello' in myData.data)
The above would print True, in cpp api of protobuf.
Now lets do the same with python
os.environ['PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION'] = 'python'
myData.data['hello'] = 10
print(b'hello' in myData.data)
The above would print False as python api doesn't convert bytes into string.
Due to this, our software, using protobuf, when deployed into different nodes of our users, had mixed result. Users with cpp api of protobuf, in their nodes, our software worked fine, without any problem. But users with the python api of protobuf, had faced a lot of bug just because of this.
The text was updated successfully, but these errors were encountered:
Recently, I have faced an issue using protobuf in Python3, where CPP environ works fine, but python environ fails to find the key. This behavior has recently caused disruption to the distribution of our software using protobuf.
Lets assume the following protoformat
message myData {
map<string, uint64> data = 1;
}
Now lets assume I set the cpp environment I do the following after generating stub.
os.environ['PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION'] = 'cpp'
myData.data['hello'] = 10
print(b'hello' in myData.data)
The above would print True, in cpp api of protobuf.
Now lets do the same with python
os.environ['PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION'] = 'python'
myData.data['hello'] = 10
print(b'hello' in myData.data)
The above would print False as python api doesn't convert bytes into string.
Due to this, our software, using protobuf, when deployed into different nodes of our users, had mixed result. Users with cpp api of protobuf, in their nodes, our software worked fine, without any problem. But users with the python api of protobuf, had faced a lot of bug just because of this.
The text was updated successfully, but these errors were encountered: